From 85b280385fd7400da8bc721131d25eee9fd7f8da Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 27 Sep 2008 09:42:31 +0000 Subject: * This is the very very early beginnings of an EventQueue:get module. * This won't function yet as far as the client can tell.. because it doesn't respond to the first query with a 200 message. * We have to figure out how to encode those binary values in the example code in the module... * Committing this so we have a start point. Will continue to work on this more today. --- .../Modules/Framework/EventQueueGetModule.cs | 164 +++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs (limited to 'OpenSim/Region/Environment/Modules') 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 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Net; +using System.Net.Sockets; +using System.Reflection; +using System.Xml; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using log4net; +using Nini.Config; +using Nwc.XmlRpc; +using OpenSim.Framework; +using OpenSim.Framework.Communications.Cache; +using OpenSim.Framework.Communications.Capabilities; +using OpenSim.Framework.Servers; +using OpenSim.Region.Environment.Interfaces; +using OpenSim.Region.Interfaces; +using OpenSim.Region.Environment.Scenes; + +using LLSD = OpenMetaverse.StructuredData.LLSD; +using LLSDMap = OpenMetaverse.StructuredData.LLSDMap; +using LLSDArray = OpenMetaverse.StructuredData.LLSDArray; +using Caps = OpenSim.Framework.Communications.Capabilities.Caps; + +namespace OpenSim.Region.Environment.Modules.Framework +{ + public class EventQueueGetModule : IEventQueue, IRegionModule + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + Scene m_scene = null; + IConfigSource m_gConfig; + + #region IRegionModule methods + public void Initialise(Scene scene, IConfigSource config) + { + m_gConfig = config; + m_scene = scene; + + + IConfig startupConfig = m_gConfig.Configs["Startup"]; + + ReadConfigAndPopulate(scene, startupConfig, "Startup"); + + scene.RegisterModuleInterface(this); + + scene.EventManager.OnNewClient += OnNewClient; + scene.EventManager.OnClientClosed += ClientClosed; + scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; + scene.EventManager.OnMakeChildAgent += MakeChildAgent; + scene.EventManager.OnClientClosed += ClientLoggedOut; + scene.EventManager.OnRegisterCaps += OnRegisterCaps; + + } + + private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p) + { + + } + + + + + + public void PostInitialise() + { + } + + public void Close() + { + } + + public string Name + { + get { return "EventQueueGetModule"; } + } + + public bool IsSharedModule + { + get { return false; } + } + #endregion + + #region IEventQueue Members + public bool Enqueue(object o, UUID avatarID) + { + + return false; + } + #endregion + + private void OnNewClient(IClientAPI client) + { + + client.OnLogout += ClientClosed; + } + + + public void ClientClosed(IClientAPI client) + { + ClientClosed(client.AgentId); + } + + private void ClientLoggedOut(UUID AgentId) + { + + } + + private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) + { + + } + + public void ClientClosed(UUID AgentID) + { + + } + private void MakeChildAgent(ScenePresence avatar) + { + } + public void OnRegisterCaps(UUID agentID, Caps caps) + { + m_log.DebugFormat("[EVENTQUEUE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps); + string capsBase = "/CAPS/"; + caps.RegisterHandler("EventQueueGet", + new RestHTTPHandler("POST", capsBase + UUID.Random().ToString(), + delegate(Hashtable m_dhttpMethod) + { + return ProcessQueue(m_dhttpMethod,agentID, caps); + })); + } + public Hashtable ProcessQueue(Hashtable request,UUID agentID, Caps caps) + { + + Hashtable responsedata = new Hashtable(); + responsedata["int_response_code"] = 502; + responsedata["str_response_string"] = "Upstream error:"; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = true; + + /* + responsedata["int_response_code"] = 200; + responsedata["content_type"] = "application/xml"; + responsedata["keepalive"] = true; + + responsedata["str_response_string"] = @"eventsbodyAgentDataAgentID + 0fd0e798-a54f-40b1-0000-000000000000SessionIDcc91f1fe-9d52-435d-0000-000000000000 + InfoLookAt0.9869639873504638671875 + -0.16094399988651275634765620Position1.43747997283935546875 + 95.3056030273437557.3480987548828125RegionData + RegionHandleAAPnAAAD8AA=SeedCapability + https://sim7.aditi.lindenlab.com:12043/cap/64015fb3-6fee-9205-0000-000000000000SimIPyA8FSA==SimPort13005message + CrossedRegionid1"; + + */ + //string requestbody = (string)request["requestbody"]; + //LLSD llsdRequest = LLSDParser.DeserializeXml(request); + //System.Console.WriteLine(requestbody); + return responsedata; + + } + } +} -- cgit v1.1