mirror of
https://github.com/opensim/opensim.git
synced 2026-06-29 18:55:37 +08:00
change eventqueue queues type, move event methods to other file (using partial class)
This commit is contained in:
@@ -35,12 +35,8 @@ using log4net;
|
||||
using Nini.Config;
|
||||
using Mono.Addins;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Messages.Linden;
|
||||
using OpenMetaverse.Packets;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
@@ -55,11 +51,15 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EventQueueGetModule")]
|
||||
public class EventQueueGetModule : IEventQueue, INonSharedRegionModule
|
||||
public partial class EventQueueGetModule : IEventQueue, INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static string LogHeader = "[EVENT QUEUE GET MODULE]";
|
||||
|
||||
private const int KEEPALIVE = 60; // this could be larger now, but viewers expect it on opensim
|
||||
// we need to go back to close before viwers, or we may lose data
|
||||
private const int VIEWERKEEPALIVE = (KEEPALIVE - 1) * 1000; // do it shorter
|
||||
|
||||
/// <value>
|
||||
/// Debug level.
|
||||
/// </value>
|
||||
@@ -69,7 +69,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>();
|
||||
|
||||
private Dictionary<UUID, Queue<OSD>> queues = new Dictionary<UUID, Queue<OSD>>();
|
||||
private Dictionary<UUID, Queue<byte[]>> queues = new Dictionary<UUID, Queue<byte[]>>();
|
||||
private Dictionary<UUID, UUID> m_AvatarQueueUUIDMapping = new Dictionary<UUID, UUID>();
|
||||
|
||||
#region INonSharedRegionModule methods
|
||||
@@ -149,22 +149,19 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
DebugLevel = debugLevel;
|
||||
MainConsole.Instance.Output(
|
||||
"Set event queue debug level to {0} in {1}", null, DebugLevel, m_scene.RegionInfo.RegionName);
|
||||
"Set event queue debug level to {0} in {1}", DebugLevel, m_scene.RegionInfo.RegionName);
|
||||
}
|
||||
}
|
||||
|
||||
protected void HandleShowEq(string module, string[] args)
|
||||
{
|
||||
MainConsole.Instance.Output("For scene {0}", null, m_scene.Name);
|
||||
MainConsole.Instance.Output("Events in Scene {0} agents queues :", m_scene.Name);
|
||||
|
||||
lock (queues)
|
||||
{
|
||||
foreach (KeyValuePair<UUID, Queue<OSD>> kvp in queues)
|
||||
foreach (KeyValuePair<UUID, Queue<byte[]>> kvp in queues)
|
||||
{
|
||||
MainConsole.Instance.Output(
|
||||
"For agent {0} there are {1} messages queued for send.",
|
||||
null,
|
||||
kvp.Key, kvp.Value.Count);
|
||||
MainConsole.Instance.Output(" {0} {1}", kvp.Key, kvp.Value.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,21 +171,23 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
/// </summary>
|
||||
/// <param name="agentId"></param>
|
||||
/// <returns></returns>
|
||||
private Queue<OSD> TryGetQueue(UUID agentId)
|
||||
private Queue<byte[]> TryGetQueue(UUID agentId)
|
||||
{
|
||||
lock (queues)
|
||||
{
|
||||
if (!queues.ContainsKey(agentId))
|
||||
{
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat(
|
||||
"[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
|
||||
agentId, m_scene.RegionInfo.RegionName);
|
||||
Queue<byte[]> queue;
|
||||
if (queues.TryGetValue(agentId, out queue))
|
||||
return queue;
|
||||
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat(
|
||||
"[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
|
||||
agentId, m_scene.RegionInfo.RegionName);
|
||||
|
||||
queues[agentId] = new Queue<OSD>();
|
||||
}
|
||||
queue = new Queue<byte[]>();
|
||||
queues[agentId] = queue;
|
||||
|
||||
return queues[agentId];
|
||||
return queue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,31 +197,58 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
/// </summary>
|
||||
/// <param name="agentId"></param>
|
||||
/// <returns></returns>
|
||||
private Queue<OSD> GetQueue(UUID agentId)
|
||||
private Queue<byte[]> GetQueue(UUID agentId)
|
||||
{
|
||||
lock (queues)
|
||||
{
|
||||
if (queues.ContainsKey(agentId))
|
||||
{
|
||||
return queues[agentId];
|
||||
}
|
||||
else
|
||||
return null;
|
||||
if (queues.TryGetValue(agentId, out Queue<byte[]> queue))
|
||||
return queue;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#region IEventQueue Members
|
||||
|
||||
public bool Enqueue(OSD ev, UUID avatarID)
|
||||
//legacy
|
||||
public bool Enqueue(OSD data, UUID avatarID)
|
||||
{
|
||||
//m_log.DebugFormat("[EVENTQUEUE]: Enqueuing event for {0} in region {1}", avatarID, m_scene.RegionInfo.RegionName);
|
||||
try
|
||||
{
|
||||
Queue<OSD> queue = GetQueue(avatarID);
|
||||
Queue<byte[]> queue = GetQueue(avatarID);
|
||||
if (queue != null)
|
||||
{
|
||||
byte[] evData = Util.UTF8NBGetbytes(OSDParser.SerializeLLSDInnerXmlString(data));
|
||||
lock (queue)
|
||||
queue.Enqueue(ev);
|
||||
queue.Enqueue(evData);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[EVENTQUEUE]: (Enqueue) No queue found for agent {0} in region {1}",
|
||||
avatarID, m_scene.Name);
|
||||
}
|
||||
}
|
||||
catch (NullReferenceException e)
|
||||
{
|
||||
m_log.Error("[EVENTQUEUE] Caught exception: " + e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//legacy
|
||||
/*
|
||||
public bool Enqueue(string ev, UUID avatarID)
|
||||
{
|
||||
//m_log.DebugFormat("[EVENTQUEUE]: Enqueuing event for {0} in region {1}", avatarID, m_scene.RegionInfo.RegionName);
|
||||
try
|
||||
{
|
||||
Queue<byte[]> queue = GetQueue(avatarID);
|
||||
if (queue != null)
|
||||
{
|
||||
byte[] evData = Util.UTF8NBGetbytes(ev);
|
||||
lock (queue)
|
||||
queue.Enqueue(evData);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -236,7 +262,33 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_log.Error("[EVENTQUEUE] Caught exception: " + e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
public bool Enqueue(byte[] evData, UUID avatarID)
|
||||
{
|
||||
//m_log.DebugFormat("[EVENTQUEUE]: Enqueuing event for {0} in region {1}", avatarID, m_scene.RegionInfo.RegionName);
|
||||
try
|
||||
{
|
||||
Queue<byte[]> queue = GetQueue(avatarID);
|
||||
if (queue != null)
|
||||
{
|
||||
lock (queue)
|
||||
queue.Enqueue(evData);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[EVENTQUEUE]: (Enqueue) No queue found for agent {0} in region {1}",
|
||||
avatarID, m_scene.Name);
|
||||
}
|
||||
}
|
||||
catch (NullReferenceException e)
|
||||
{
|
||||
m_log.Error("[EVENTQUEUE] Caught exception: " + e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -267,7 +319,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
/// <param name='eqgUuid'></param>
|
||||
private string GenerateEqgCapPath(UUID eqgUuid)
|
||||
{
|
||||
return string.Format("/CAPS/EQG/{0}/", eqgUuid);
|
||||
return string.Format("/CE/{0}/", eqgUuid);
|
||||
}
|
||||
|
||||
public void OnRegisterCaps(UUID agentID, Caps caps)
|
||||
@@ -280,16 +332,15 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
agentID, caps, m_scene.RegionInfo.RegionName);
|
||||
|
||||
UUID eventQueueGetUUID;
|
||||
Queue<OSD> queue = null;
|
||||
Queue<Byte[]> queue = null;
|
||||
|
||||
lock (queues)
|
||||
{
|
||||
if (queues.ContainsKey(agentID))
|
||||
queue = queues[agentID];
|
||||
queues.TryGetValue(agentID, out queue);
|
||||
|
||||
if (queue == null)
|
||||
{
|
||||
queue = new Queue<OSD>();
|
||||
queue = new Queue<byte[]>();
|
||||
queues[agentID] = queue;
|
||||
|
||||
lock (m_AvatarQueueUUIDMapping)
|
||||
@@ -338,7 +389,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
eventQueueGetUUID = UUID.Random();
|
||||
m_AvatarQueueUUIDMapping[agentID] = eventQueueGetUUID;
|
||||
m_log.DebugFormat("[EVENTQUEUE]: Using random UUID!");
|
||||
lock (m_ids)
|
||||
{
|
||||
if (m_ids.ContainsKey(agentID))
|
||||
@@ -354,21 +404,22 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
}
|
||||
|
||||
caps.RegisterPollHandler(
|
||||
"EventQueueGet",
|
||||
new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, Drop, agentID, int.MaxValue));
|
||||
caps.RegisterPollHandler(
|
||||
"EventQueueGet",
|
||||
new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, Drop, agentID, VIEWERKEEPALIVE));
|
||||
}
|
||||
|
||||
public bool HasEvents(UUID requestID, UUID agentID)
|
||||
{
|
||||
Queue<OSD> queue = GetQueue(agentID);
|
||||
Queue<byte[]> queue = GetQueue(agentID);
|
||||
if (queue != null)
|
||||
{
|
||||
lock (queue)
|
||||
{
|
||||
//m_log.WarnFormat("POLLED FOR EVENTS BY {0} in {1} -- {2}", agentID, m_scene.RegionInfo.RegionName, queue.Count);
|
||||
return queue.Count > 0;
|
||||
}
|
||||
|
||||
}
|
||||
//m_log.WarnFormat("POLLED FOR EVENTS BY {0} unknown agent", agentID);
|
||||
return true;
|
||||
}
|
||||
@@ -387,22 +438,32 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
ev["message"], m_scene.GetScenePresence(agentId).Name, m_scene.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public void Drop(UUID requestID, UUID pAgentId)
|
||||
{
|
||||
// do nothing, in last case http server will do it
|
||||
}
|
||||
|
||||
private readonly byte[] EventHeader = GenEventHeader();
|
||||
|
||||
private static byte[] GenEventHeader()
|
||||
{
|
||||
return Encoding.UTF8.GetBytes("<llsd><map><key>events</key><array>");
|
||||
}
|
||||
|
||||
public Hashtable GetEvents(UUID requestID, UUID pAgentId)
|
||||
{
|
||||
if (DebugLevel >= 2)
|
||||
m_log.WarnFormat("POLLED FOR EQ MESSAGES BY {0} in {1}", pAgentId, m_scene.Name);
|
||||
|
||||
Queue<OSD> queue = GetQueue(pAgentId);
|
||||
Queue<byte[]> queue = GetQueue(pAgentId);
|
||||
if (queue == null)
|
||||
return NoEvents(requestID, pAgentId);
|
||||
return NoAgent(requestID, pAgentId);
|
||||
|
||||
OSD element = null;;
|
||||
OSDArray array = new OSDArray();
|
||||
byte[] element = null;
|
||||
List<byte[]> elements;
|
||||
|
||||
int totalSize = 0;
|
||||
int thisID = 0;
|
||||
bool negativeID = false;
|
||||
|
||||
@@ -420,6 +481,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
thisID = -thisID;
|
||||
}
|
||||
|
||||
elements = new List<byte[]>(queue.Count + 2);
|
||||
elements.Add(EventHeader);
|
||||
|
||||
while (queue.Count > 0)
|
||||
{
|
||||
element = queue.Dequeue();
|
||||
@@ -430,7 +494,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
if (DebugLevel > 0)
|
||||
LogOutboundDebugMessage(element, pAgentId);
|
||||
array.Add(element);
|
||||
|
||||
elements.Add(element);
|
||||
totalSize += element.Length;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,280 +511,56 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_ids[pAgentId] = thisID + 1;
|
||||
}
|
||||
|
||||
if (array.Count == 0)
|
||||
if (totalSize == 0)
|
||||
return NoEvents(requestID, pAgentId);
|
||||
|
||||
OSDMap events = new OSDMap();
|
||||
events.Add("events", array);
|
||||
events.Add("id", new OSDInteger(thisID));
|
||||
totalSize += EventHeader.Length;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
LLSDxmlEncode.AddEndArray(sb); // events array
|
||||
LLSDxmlEncode.AddElem("id", thisID, sb);
|
||||
LLSDxmlEncode.AddEndMap(sb);
|
||||
element = Encoding.UTF8.GetBytes(LLSDxmlEncode.End(sb));
|
||||
elements.Add(element);
|
||||
totalSize += element.Length;
|
||||
|
||||
Hashtable responsedata = new Hashtable();
|
||||
responsedata["int_response_code"] = 200;
|
||||
responsedata["content_type"] = "application/xml";
|
||||
//string tt = OSDParser.SerializeLLSDXmlString(events);
|
||||
responsedata["bin_response_data"] = Encoding.UTF8.GetBytes(OSDParser.SerializeLLSDXmlString(events));
|
||||
responsedata["keepaliveTimeout"] = 60;
|
||||
//m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", pAgentId, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
|
||||
|
||||
//temporary
|
||||
byte[] finalData = new byte[totalSize];
|
||||
int dst = 0;
|
||||
foreach(byte[] src in elements)
|
||||
{
|
||||
Array.Copy(src, 0, finalData, dst, src.Length);
|
||||
dst += src.Length;
|
||||
}
|
||||
|
||||
responsedata["bin_response_data"] = finalData;
|
||||
responsedata["keepaliveTimeout"] = KEEPALIVE;
|
||||
|
||||
return responsedata;
|
||||
}
|
||||
|
||||
public Hashtable NoEvents(UUID requestID, UUID agentID)
|
||||
{
|
||||
Hashtable responsedata = new Hashtable();
|
||||
responsedata["int_response_code"] = 502;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["str_response_string"] = "<llsd></llsd>";
|
||||
responsedata["error_status_text"] = "<llsd></llsd>";
|
||||
responsedata["keepalive"] = false;
|
||||
Queue<byte[]> queue = GetQueue(agentID);
|
||||
if (queue == null)
|
||||
{
|
||||
responsedata["int_response_code"] = (int)HttpStatusCode.NotFound;
|
||||
return responsedata;
|
||||
}
|
||||
responsedata["int_response_code"] = (int)HttpStatusCode.BadGateway;
|
||||
return responsedata;
|
||||
}
|
||||
|
||||
/* this is not a event message
|
||||
public void DisableSimulator(ulong handle, UUID avatarID)
|
||||
public Hashtable NoAgent(UUID requestID, UUID agentID)
|
||||
{
|
||||
OSD item = EventQueueHelper.DisableSimulator(handle);
|
||||
Enqueue(item, avatarID);
|
||||
}
|
||||
*/
|
||||
public StringBuilder StartEvent(string eventName)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(256);
|
||||
LLSDxmlEncode.AddMap(sb);
|
||||
LLSDxmlEncode.AddElem("message", eventName, sb);
|
||||
LLSDxmlEncode.AddMap("body", sb);
|
||||
|
||||
return sb;
|
||||
}
|
||||
|
||||
public string EndEvent(StringBuilder sb)
|
||||
{
|
||||
LLSDxmlEncode.AddEndMap(sb); // close body
|
||||
LLSDxmlEncode.AddEndMap(sb); // close event
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY)
|
||||
{
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat("{0} EnableSimulator. handle={1}, endPoint={2}, avatarID={3}",
|
||||
LogHeader, handle, endPoint, avatarID, regionSizeX, regionSizeY);
|
||||
|
||||
StringBuilder sb = StartEvent("EnableSimulator");
|
||||
LLSDxmlEncode.AddArrayAndMap("SimulatorInfo", sb);
|
||||
LLSDxmlEncode.AddElem("Handle", handle, sb);
|
||||
LLSDxmlEncode.AddElem("IP", endPoint.Address.GetAddressBytes(), sb);
|
||||
LLSDxmlEncode.AddElem("Port", endPoint.Port, sb);
|
||||
LLSDxmlEncode.AddElem("RegionSizeX", (uint)regionSizeX, sb);
|
||||
LLSDxmlEncode.AddElem("RegionSizeY", (uint)regionSizeY, sb);
|
||||
LLSDxmlEncode.AddEndMapAndArray(sb);
|
||||
|
||||
OSD item = new OSDllsdxml(EndEvent(sb));
|
||||
|
||||
Enqueue(item, avatarID);
|
||||
}
|
||||
|
||||
public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath,
|
||||
ulong regionHandle, int regionSizeX, int regionSizeY)
|
||||
{
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, endPoint={2}, avatarID={3}",
|
||||
LogHeader, regionHandle, endPoint, avatarID, regionSizeX, regionSizeY);
|
||||
|
||||
StringBuilder sb = StartEvent("EstablishAgentCommunication");
|
||||
|
||||
LLSDxmlEncode.AddElem("agent-id", avatarID, sb);
|
||||
LLSDxmlEncode.AddElem("sim-ip-and-port", endPoint.ToString(), sb);
|
||||
LLSDxmlEncode.AddElem("seed-capability", capsPath, sb);
|
||||
// current viewers ignore this, also not needed its sent on enablesim
|
||||
//LLSDxmlEncode.AddElem("region-handle", regionHandle, sb);
|
||||
//LLSDxmlEncode.AddElem("region-size-x", (uint)regionSizeX, sb);
|
||||
//LLSDxmlEncode.AddElem("region-size-y", (uint)regionSizeY, sb);
|
||||
|
||||
OSD ev = new OSDllsdxml(EndEvent(sb));
|
||||
Enqueue(ev, avatarID);
|
||||
}
|
||||
|
||||
public virtual void TeleportFinishEvent(ulong regionHandle, byte simAccess,
|
||||
IPEndPoint regionExternalEndPoint,
|
||||
uint locationID, uint flags, string capsURL,
|
||||
UUID avatarID, int regionSizeX, int regionSizeY)
|
||||
{
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, endPoint={2}, avatarID={3}",
|
||||
LogHeader, regionHandle, regionExternalEndPoint, avatarID, regionSizeX, regionSizeY);
|
||||
|
||||
// not sure why flags get overwritten here
|
||||
if ((flags & (uint)TeleportFlags.IsFlying) != 0)
|
||||
flags = (uint)TeleportFlags.ViaLocation | (uint)TeleportFlags.IsFlying;
|
||||
else
|
||||
flags = (uint)TeleportFlags.ViaLocation;
|
||||
|
||||
StringBuilder sb = StartEvent("TeleportFinish");
|
||||
|
||||
LLSDxmlEncode.AddArrayAndMap("Info", sb);
|
||||
LLSDxmlEncode.AddElem("AgentID", avatarID, sb);
|
||||
LLSDxmlEncode.AddElem("LocationID", (uint)4, sb); // TODO what is this?
|
||||
LLSDxmlEncode.AddElem("SimIP", regionExternalEndPoint.Address.GetAddressBytes(), sb);
|
||||
LLSDxmlEncode.AddElem("SimPort", regionExternalEndPoint.Port, sb);
|
||||
LLSDxmlEncode.AddElem("RegionHandle", regionHandle, sb);
|
||||
LLSDxmlEncode.AddElem("SeedCapability", capsURL, sb);
|
||||
LLSDxmlEncode.AddElem("SimAccess",(int)simAccess, sb);
|
||||
LLSDxmlEncode.AddElem("TeleportFlags", flags, sb);
|
||||
LLSDxmlEncode.AddElem("RegionSizeX", (uint)regionSizeX, sb);
|
||||
LLSDxmlEncode.AddElem("RegionSizeY", (uint)regionSizeY, sb);
|
||||
LLSDxmlEncode.AddEndMapAndArray(sb);
|
||||
|
||||
OSD ev = new OSDllsdxml(EndEvent(sb));
|
||||
Enqueue(ev, avatarID);
|
||||
}
|
||||
|
||||
public virtual void CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt,
|
||||
IPEndPoint newRegionExternalEndPoint,
|
||||
string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY)
|
||||
{
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>",
|
||||
LogHeader, handle, avatarID, regionSizeX, regionSizeY);
|
||||
|
||||
StringBuilder sb = StartEvent("CrossedRegion");
|
||||
|
||||
LLSDxmlEncode.AddArrayAndMap("AgentData", sb);
|
||||
LLSDxmlEncode.AddElem("AgentID", avatarID, sb);
|
||||
LLSDxmlEncode.AddElem("SessionID", sessionID, sb);
|
||||
LLSDxmlEncode.AddEndMapAndArray(sb);
|
||||
|
||||
LLSDxmlEncode.AddArrayAndMap("Info", sb);
|
||||
LLSDxmlEncode.AddElem("LookAt", lookAt, sb);
|
||||
LLSDxmlEncode.AddElem("Position", pos, sb);
|
||||
LLSDxmlEncode.AddEndMapAndArray(sb);
|
||||
|
||||
LLSDxmlEncode.AddArrayAndMap("RegionData", sb);
|
||||
LLSDxmlEncode.AddElem("RegionHandle", handle, sb);
|
||||
LLSDxmlEncode.AddElem("SeedCapability", capsURL, sb);
|
||||
LLSDxmlEncode.AddElem("SimIP", newRegionExternalEndPoint.Address.GetAddressBytes(), sb);
|
||||
LLSDxmlEncode.AddElem("SimPort", newRegionExternalEndPoint.Port, sb);
|
||||
LLSDxmlEncode.AddElem("RegionSizeX", (uint)regionSizeX, sb);
|
||||
LLSDxmlEncode.AddElem("RegionSizeY", (uint)regionSizeY, sb);
|
||||
LLSDxmlEncode.AddEndMapAndArray(sb);
|
||||
|
||||
OSD ev = new OSDllsdxml(EndEvent(sb));
|
||||
Enqueue(ev, avatarID);
|
||||
}
|
||||
|
||||
public void ChatterboxInvitation(UUID sessionID, string sessionName,
|
||||
UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog,
|
||||
uint timeStamp, bool offline, int parentEstateID, Vector3 position,
|
||||
uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket)
|
||||
{
|
||||
OSD item = EventQueueHelper.ChatterboxInvitation(sessionID, sessionName, fromAgent, message, toAgent, fromName, dialog,
|
||||
timeStamp, offline, parentEstateID, position, ttl, transactionID,
|
||||
fromGroup, binaryBucket);
|
||||
Enqueue(item, toAgent);
|
||||
//m_log.InfoFormat("########### eq ChatterboxInvitation #############\n{0}", item);
|
||||
|
||||
}
|
||||
|
||||
public void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat,
|
||||
bool isModerator, bool textMute, bool isEnterorLeave)
|
||||
{
|
||||
OSD item = EventQueueHelper.ChatterBoxSessionAgentListUpdates(sessionID, fromAgent, canVoiceChat,
|
||||
isModerator, textMute, isEnterorLeave);
|
||||
Enqueue(item, toAgent);
|
||||
//m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item);
|
||||
}
|
||||
|
||||
public void ChatterBoxForceClose(UUID toAgent, UUID sessionID, string reason)
|
||||
{
|
||||
OSD item = EventQueueHelper.ChatterBoxForceClose(sessionID, reason);
|
||||
|
||||
Enqueue(item, toAgent);
|
||||
}
|
||||
|
||||
public void GroupMembershipData(UUID AgentID, GroupMembershipData[] data)
|
||||
{
|
||||
StringBuilder sb = StartEvent("AgentGroupDataUpdate");
|
||||
|
||||
LLSDxmlEncode.AddArrayAndMap("AgentData", sb);
|
||||
LLSDxmlEncode.AddElem("AgentID", AgentID, sb);
|
||||
LLSDxmlEncode.AddEndMapAndArray(sb);
|
||||
|
||||
if (data.Length == 0)
|
||||
{
|
||||
LLSDxmlEncode.AddEmptyArray("GroupData", sb);
|
||||
LLSDxmlEncode.AddEmptyArray("NewGroupData", sb);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<bool> lstInProfiles = new List<bool>(data.Length);
|
||||
LLSDxmlEncode.AddArray("GroupData", sb);
|
||||
foreach (GroupMembershipData m in data)
|
||||
{
|
||||
LLSDxmlEncode.AddMap(sb);
|
||||
LLSDxmlEncode.AddElem("GroupID", m.GroupID, sb);
|
||||
LLSDxmlEncode.AddElem("GroupPowers", m.GroupPowers, sb);
|
||||
LLSDxmlEncode.AddElem("AcceptNotices", m.AcceptNotices, sb);
|
||||
LLSDxmlEncode.AddElem("GroupInsigniaID", m.GroupPicture, sb);
|
||||
LLSDxmlEncode.AddElem("Contribution", m.Contribution, sb);
|
||||
LLSDxmlEncode.AddElem("GroupName", m.GroupName, sb);
|
||||
LLSDxmlEncode.AddEndMap(sb);
|
||||
lstInProfiles.Add(m.ListInProfile);
|
||||
}
|
||||
LLSDxmlEncode.AddEndArray(sb);
|
||||
|
||||
LLSDxmlEncode.AddArray("NewGroupData", sb);
|
||||
foreach(bool b in lstInProfiles)
|
||||
{
|
||||
LLSDxmlEncode.AddMap(sb);
|
||||
LLSDxmlEncode.AddElem("ListInProfile", b, sb);
|
||||
LLSDxmlEncode.AddEndMap(sb);
|
||||
}
|
||||
LLSDxmlEncode.AddEndArray(sb);
|
||||
}
|
||||
|
||||
OSD ev = new OSDllsdxml(EndEvent(sb));
|
||||
Enqueue(ev, AgentID);
|
||||
}
|
||||
|
||||
public void QueryReply(PlacesReplyPacket groupUpdate, UUID avatarID)
|
||||
{
|
||||
OSD item = EventQueueHelper.PlacesQuery(groupUpdate);
|
||||
Enqueue(item, avatarID);
|
||||
}
|
||||
|
||||
public void ScriptRunningEvent(UUID objectID, UUID itemID, bool running, UUID avatarID)
|
||||
{
|
||||
StringBuilder sb = StartEvent("ScriptRunningReply");
|
||||
LLSDxmlEncode.AddArrayAndMap("Script", sb);
|
||||
LLSDxmlEncode.AddElem("ObjectID", objectID, sb);
|
||||
LLSDxmlEncode.AddElem("ItemID", itemID, sb);
|
||||
LLSDxmlEncode.AddElem("Running", running, sb);
|
||||
LLSDxmlEncode.AddElem("Mono", true, sb);
|
||||
LLSDxmlEncode.AddEndMapAndArray(sb);
|
||||
|
||||
OSDllsdxml item = new OSDllsdxml(EndEvent(sb));
|
||||
Enqueue(item, avatarID);
|
||||
}
|
||||
|
||||
public void partPhysicsProperties(uint localID, byte physhapetype,
|
||||
float density, float friction, float bounce, float gravmod,UUID avatarID)
|
||||
{
|
||||
StringBuilder sb = StartEvent("ObjectPhysicsProperties");
|
||||
LLSDxmlEncode.AddArrayAndMap("ObjectData", sb);
|
||||
LLSDxmlEncode.AddElem("LocalID", (int)localID, sb);
|
||||
LLSDxmlEncode.AddElem("Density", density, sb);
|
||||
LLSDxmlEncode.AddElem("Friction", friction, sb);
|
||||
LLSDxmlEncode.AddElem("GravityMultiplier", gravmod, sb);
|
||||
LLSDxmlEncode.AddElem("Restitution", bounce, sb);
|
||||
LLSDxmlEncode.AddElem("PhysicsShapeType", (int)physhapetype, sb);
|
||||
LLSDxmlEncode.AddEndMapAndArray(sb);
|
||||
|
||||
OSDllsdxml item = new OSDllsdxml(EndEvent(sb));
|
||||
Enqueue(item, avatarID);
|
||||
}
|
||||
|
||||
public OSD BuildEvent(string eventName, OSD eventBody)
|
||||
{
|
||||
return EventQueueHelper.BuildEvent(eventName, eventBody);
|
||||
Hashtable responsedata = new Hashtable();
|
||||
responsedata["int_response_code"] = (int)HttpStatusCode.NotFound;
|
||||
return responsedata;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user