change encoding of event cap messages

0.9.1.0-post-fixes
UbitUmarov 2019-01-28 04:01:09 +00:00
parent 4c79a85621
commit cc27168cc1
2 changed files with 215 additions and 317 deletions

View File

@ -232,10 +232,9 @@ namespace OpenSim.Region.ClientStack.Linden
}
else
{
OSDMap evMap = (OSDMap)ev;
m_log.WarnFormat(
"[EVENTQUEUE]: (Enqueue) No queue found for agent {0} when placing message {1} in region {2}",
avatarID, evMap["message"], m_scene.Name);
m_log.WarnFormat(
"[EVENTQUEUE]: (Enqueue) No queue found for agent {0} in region {2}",
avatarID, m_scene.Name);
}
}
catch (NullReferenceException e)
@ -254,14 +253,13 @@ namespace OpenSim.Region.ClientStack.Linden
//m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", agentID, m_scene.RegionInfo.RegionName);
lock (queues)
{
queues.Remove(agentID);
lock (m_AvatarQueueUUIDMapping)
m_AvatarQueueUUIDMapping.Remove(agentID);
lock (m_AvatarQueueUUIDMapping)
m_AvatarQueueUUIDMapping.Remove(agentID);
lock (m_ids)
{
if (!m_ids.ContainsKey(agentID))
lock (m_ids)
m_ids.Remove(agentID);
}
@ -288,16 +286,12 @@ namespace OpenSim.Region.ClientStack.Linden
agentID, caps, m_scene.RegionInfo.RegionName);
UUID eventQueueGetUUID;
Queue<OSD> queue;
Random rnd = new Random(Environment.TickCount);
int nrnd = rnd.Next(30000000);
Queue<OSD> queue = null;
lock (queues)
{
if (queues.ContainsKey(agentID))
queue = queues[agentID];
else
queue = null;
if (queue == null)
{
@ -307,26 +301,26 @@ namespace OpenSim.Region.ClientStack.Linden
lock (m_AvatarQueueUUIDMapping)
{
eventQueueGetUUID = UUID.Random();
while(m_AvatarQueueUUIDMapping.ContainsKey(agentID))
eventQueueGetUUID = UUID.Random();
m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID);
}
lock (m_ids)
{
if (!m_ids.ContainsKey(agentID))
m_ids.Add(agentID, nrnd);
else
m_ids[agentID]++;
m_AvatarQueueUUIDMapping[agentID] = eventQueueGetUUID;
lock (m_ids)
{
if (m_ids.ContainsKey(agentID))
m_ids[agentID]++;
else
{
Random rnd = new Random(Environment.TickCount);
m_ids[agentID] = rnd.Next(30000000);
}
}
}
}
else
{
queue.Enqueue(null);
queue.Enqueue(null); // one should be enough
// reuse or not to reuse
lock (m_AvatarQueueUUIDMapping)
{
// Reuse open queues. The client does!
// Its reuse caps path not queues those are been reused already
if (m_AvatarQueueUUIDMapping.ContainsKey(agentID))
{
@ -337,25 +331,29 @@ namespace OpenSim.Region.ClientStack.Linden
// change to negative numbers so they are changed at end of sending first marker
// old data on a queue may be sent on a response for a new caps
// but at least will be sent with coerent IDs
if (!m_ids.ContainsKey(agentID))
m_ids.Add(agentID, -nrnd); // should not happen
else
if (m_ids.ContainsKey(agentID))
m_ids[agentID] = -m_ids[agentID];
else
{
Random rnd = new Random(Environment.TickCount);
m_ids[agentID] = -rnd.Next(30000000);
}
}
}
else
{
eventQueueGetUUID = UUID.Random();
while(m_AvatarQueueUUIDMapping.ContainsKey(agentID))
eventQueueGetUUID = UUID.Random();
m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID);
m_AvatarQueueUUIDMapping[agentID] = eventQueueGetUUID;
m_log.DebugFormat("[EVENTQUEUE]: Using random UUID!");
lock (m_ids)
{
if (!m_ids.ContainsKey(agentID))
m_ids.Add(agentID, nrnd);
else
if (m_ids.ContainsKey(agentID))
m_ids[agentID]++;
else
{
Random rnd = new Random(Environment.TickCount);
m_ids.Add(agentID, rnd.Next(30000000));
}
}
}
}
@ -407,9 +405,7 @@ namespace OpenSim.Region.ClientStack.Linden
Queue<OSD> queue = GetQueue(pAgentId);
if (queue == null)
{
return NoEvents(requestID, pAgentId);
}
OSD element = null;;
OSDArray array = new OSDArray();
@ -437,45 +433,37 @@ namespace OpenSim.Region.ClientStack.Linden
// so they get into a response
if (element == null)
break;
if (DebugLevel > 0)
LogOutboundDebugMessage(element, pAgentId);
array.Add(element);
}
}
OSDMap events = null;
if (array.Count > 0)
{
events = new OSDMap();
events.Add("events", array);
events.Add("id", new OSDInteger(thisID));
}
if (negativeID && element == null)
{
Random rnd = new Random(Environment.TickCount);
thisID = rnd.Next(30000000);
}
lock (m_ids)
{
m_ids[pAgentId] = thisID + 1;
if (element == null && negativeID)
{
Random rnd = new Random(Environment.TickCount);
m_ids[pAgentId] = rnd.Next(30000000);
}
else
m_ids[pAgentId] = thisID + 1;
}
Hashtable responsedata;
// if there where no elements before a marker send a NoEvents
if (events == null)
{
return NoEvents(requestID, pAgentId);
}
else
{
responsedata = new Hashtable();
responsedata["int_response_code"] = 200;
responsedata["content_type"] = "application/xml";
responsedata["bin_response_data"] = Encoding.UTF8.GetBytes(OSDParser.SerializeLLSDXmlString(events));
}
if (array.Count == 0)
return NoEvents(requestID, pAgentId);
OSDMap events = new OSDMap();
events.Add("events", array);
events.Add("id", new OSDInteger(thisID));
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));
//m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", pAgentId, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
return responsedata;
}
@ -522,7 +510,17 @@ namespace OpenSim.Region.ClientStack.Linden
m_log.DebugFormat("{0} EnableSimulator. handle={1}, endPoint={2}, avatarID={3}",
LogHeader, handle, endPoint, avatarID, regionSizeX, regionSizeY);
OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, 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);
}
@ -533,8 +531,18 @@ namespace OpenSim.Region.ClientStack.Linden
m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, endPoint={2}, avatarID={3}",
LogHeader, regionHandle, endPoint, avatarID, regionSizeX, regionSizeY);
OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath, regionHandle, regionSizeX, regionSizeY);
Enqueue(item, avatarID);
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,
@ -546,9 +554,29 @@ namespace OpenSim.Region.ClientStack.Linden
m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, endPoint={2}, avatarID={3}",
LogHeader, regionHandle, regionExternalEndPoint, avatarID, regionSizeX, regionSizeY);
OSD item = EventQueueHelper.TeleportFinishEvent(regionHandle, simAccess, regionExternalEndPoint,
locationID, flags, capsURL, avatarID, regionSizeX, regionSizeY);
Enqueue(item, avatarID);
// 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,
@ -559,9 +587,29 @@ namespace OpenSim.Region.ClientStack.Linden
m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>",
LogHeader, handle, avatarID, regionSizeX, regionSizeY);
OSD item = EventQueueHelper.CrossRegion(handle, pos, lookAt, newRegionExternalEndPoint,
capsURL, avatarID, sessionID, regionSizeX, regionSizeY);
Enqueue(item, avatarID);
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,
@ -593,16 +641,49 @@ namespace OpenSim.Region.ClientStack.Linden
Enqueue(item, toAgent);
}
public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID)
public void GroupMembershipData(UUID AgentID, GroupMembershipData[] data)
{
OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage);
Enqueue(item, avatarID);
}
StringBuilder sb = StartEvent("AgentGroupDataUpdate");
public void GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data)
{
OSD item = EventQueueHelper.GroupMembershipData(receiverAgent, data);
Enqueue(item, receiverAgent);
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)
@ -613,19 +694,32 @@ namespace OpenSim.Region.ClientStack.Linden
public void ScriptRunningEvent(UUID objectID, UUID itemID, bool running, UUID avatarID)
{
StringBuilder sb = EventQueueHelper.StartEvent("ScriptRunningReply");
LLSDxmlEncode.AddArray("Script", sb);
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);
LLSDxmlEncode.AddMap(sb);
LLSDxmlEncode.AddElem("ObjectID", objectID, sb);
LLSDxmlEncode.AddElem("ItemID", itemID, sb);
LLSDxmlEncode.AddElem("Running", running, sb);
LLSDxmlEncode.AddElem("Mono", true, sb);
LLSDxmlEncode.AddEndMap(sb);
OSDllsdxml item = new OSDllsdxml(EndEvent(sb));
Enqueue(item, avatarID);
}
LLSDxmlEncode.AddEndArray(sb);
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(EventQueueHelper.EndEvent(sb));
OSDllsdxml item = new OSDllsdxml(EndEvent(sb));
Enqueue(item, avatarID);
}
@ -633,13 +727,5 @@ namespace OpenSim.Region.ClientStack.Linden
{
return EventQueueHelper.BuildEvent(eventName, eventBody);
}
public void partPhysicsProperties(uint localID, byte physhapetype,
float density, float friction, float bounce, float gravmod,UUID avatarID)
{
OSD item = EventQueueHelper.partPhysicsProperties(localID, physhapetype,
density, friction, bounce, gravmod);
Enqueue(item, avatarID);
}
}
}

View File

@ -41,40 +41,23 @@ namespace OpenSim.Region.ClientStack.Linden
{
private EventQueueHelper() {} // no construction possible, it's an utility class
public static byte[] ulongToByteArray(ulong uLongValue)
{
// Reverse endianness of RegionHandle
return new byte[8]
{
(byte)((uLongValue >> 56) & 0xff),
(byte)((uLongValue >> 48) & 0xff),
(byte)((uLongValue >> 40) & 0xff),
(byte)((uLongValue >> 32) & 0xff),
(byte)((uLongValue >> 24) & 0xff),
(byte)((uLongValue >> 16) & 0xff),
(byte)((uLongValue >> 8) & 0xff),
(byte)(uLongValue & 0xff)
};
}
public static StringBuilder StartEvent(string eventName)
{
StringBuilder sb = new StringBuilder(256);
LLSDxmlEncode.AddMap(sb);
LLSDxmlEncode.AddElem("message", eventName, sb);
LLSDxmlEncode.AddMap("body", sb);
LLSDxmlEncode.AddMap("body", sb);
return sb;
}
public static string EndEvent(StringBuilder sb)
{
LLSDxmlEncode.AddEndMap(sb); // close body
LLSDxmlEncode.AddEndMap(sb); // close body
LLSDxmlEncode.AddEndMap(sb); // close event
return sb.ToString();
}
public static OSD BuildEvent(string eventName, OSD eventBody)
{
OSDMap llsdEvent = new OSDMap(2);
@ -84,137 +67,6 @@ namespace OpenSim.Region.ClientStack.Linden
return llsdEvent;
}
public static OSD EnableSimulator(ulong handle, IPEndPoint endPoint, int regionSizeX, int regionSizeY)
{
OSDMap llsdSimInfo = new OSDMap(5);
llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle)));
llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes()));
llsdSimInfo.Add("Port", OSD.FromInteger(endPoint.Port));
llsdSimInfo.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX));
llsdSimInfo.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY));
OSDArray arr = new OSDArray(1);
arr.Add(llsdSimInfo);
OSDMap llsdBody = new OSDMap(1);
llsdBody.Add("SimulatorInfo", arr);
return BuildEvent("EnableSimulator", llsdBody);
}
/*
public static OSD DisableSimulator(ulong handle)
{
//OSDMap llsdSimInfo = new OSDMap(1);
//llsdSimInfo.Add("Handle", new OSDBinary(regionHandleToByteArray(handle)));
//OSDArray arr = new OSDArray(1);
//arr.Add(llsdSimInfo);
OSDMap llsdBody = new OSDMap(0);
//llsdBody.Add("SimulatorInfo", arr);
return BuildEvent("DisableSimulator", llsdBody);
}
*/
public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt,
IPEndPoint newRegionExternalEndPoint,
string capsURL, UUID agentID, UUID sessionID,
int regionSizeX, int regionSizeY)
{
OSDArray lookAtArr = new OSDArray(3);
lookAtArr.Add(OSD.FromReal(lookAt.X));
lookAtArr.Add(OSD.FromReal(lookAt.Y));
lookAtArr.Add(OSD.FromReal(lookAt.Z));
OSDArray positionArr = new OSDArray(3);
positionArr.Add(OSD.FromReal(pos.X));
positionArr.Add(OSD.FromReal(pos.Y));
positionArr.Add(OSD.FromReal(pos.Z));
OSDMap infoMap = new OSDMap(2);
infoMap.Add("LookAt", lookAtArr);
infoMap.Add("Position", positionArr);
OSDArray infoArr = new OSDArray(1);
infoArr.Add(infoMap);
OSDMap agentDataMap = new OSDMap(2);
agentDataMap.Add("AgentID", OSD.FromUUID(agentID));
agentDataMap.Add("SessionID", OSD.FromUUID(sessionID));
OSDArray agentDataArr = new OSDArray(1);
agentDataArr.Add(agentDataMap);
OSDMap regionDataMap = new OSDMap(6);
regionDataMap.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(handle)));
regionDataMap.Add("SeedCapability", OSD.FromString(capsURL));
regionDataMap.Add("SimIP", OSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes()));
regionDataMap.Add("SimPort", OSD.FromInteger(newRegionExternalEndPoint.Port));
regionDataMap.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX));
regionDataMap.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY));
OSDArray regionDataArr = new OSDArray(1);
regionDataArr.Add(regionDataMap);
OSDMap llsdBody = new OSDMap(3);
llsdBody.Add("Info", infoArr);
llsdBody.Add("AgentData", agentDataArr);
llsdBody.Add("RegionData", regionDataArr);
return BuildEvent("CrossedRegion", llsdBody);
}
public static OSD TeleportFinishEvent(
ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
uint locationID, uint flags, string capsURL, UUID agentID,
int regionSizeX, int 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;
OSDMap info = new OSDMap();
info.Add("AgentID", OSD.FromUUID(agentID));
info.Add("LocationID", OSD.FromInteger(4)); // TODO what is this?
info.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(regionHandle)));
info.Add("SeedCapability", OSD.FromString(capsURL));
info.Add("SimAccess", OSD.FromInteger(simAccess));
info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes()));
info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port));
// info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
info.Add("TeleportFlags", OSD.FromUInteger(flags));
info.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX));
info.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY));
OSDArray infoArr = new OSDArray();
infoArr.Add(info);
OSDMap body = new OSDMap();
body.Add("Info", infoArr);
return BuildEvent("TeleportFinish", body);
}
public static OSD EstablishAgentCommunication(UUID agentID, string simIpAndPort, string seedcap,
ulong regionHandle, int regionSizeX, int regionSizeY)
{
OSDMap body = new OSDMap(6)
{
{"agent-id", new OSDUUID(agentID)},
{"sim-ip-and-port", new OSDString(simIpAndPort)},
{"seed-capability", new OSDString(seedcap)},
{"region-handle", OSD.FromULong(regionHandle)},
{"region-size-x", OSD.FromUInteger((uint)regionSizeX)},
{"region-size-y", OSD.FromUInteger((uint)regionSizeY)}
};
return BuildEvent("EstablishAgentCommunication", body);
}
public static OSD KeepAliveEvent()
{
return BuildEvent("FAKEEVENT", new OSDMap());
@ -261,7 +113,33 @@ namespace OpenSim.Region.ClientStack.Linden
messageParams.Add("ttl", new OSDInteger((int)ttl));
messageParams.Add("from_id", new OSDUUID(fromAgent));
messageParams.Add("from_group", new OSDInteger(fromGroup ? 1 : 0));
/*
StringBuilder sb = new StringBuilder(256);
LLSDxmlEncode.AddMap(sb); //messageParams
LLSDxmlEncode.AddElem("type", dialog, sb);
LLSDxmlEncode.AddElem("position", position, sb);
LLSDxmlEncode.AddElem("region_id", UUID.Zero, sb);
LLSDxmlEncode.AddElem("to_id", toAgent, sb);
LLSDxmlEncode.AddElem("source", 0, sb);
LLSDxmlEncode.AddMap("data", sb); //messageParams data
LLSDxmlEncode.AddElem("binary_bucket", binaryBucket, sb);
LLSDxmlEncode.AddEndMap(sb); //messageParams data
LLSDxmlEncode.AddElem("message", message, sb);
LLSDxmlEncode.AddElem("id", transactionID, sb);
LLSDxmlEncode.AddElem("from_name", fromName, sb);
LLSDxmlEncode.AddElem("timestamp", timeStamp, sb);
LLSDxmlEncode.AddElem("offline", (offline ? 1 : 0), sb);
LLSDxmlEncode.AddElem("parent_estate_id", parentEstateID, sb);
LLSDxmlEncode.AddElem("ttl", (int)ttl, sb);
LLSDxmlEncode.AddElem("from_id", fromAgent, sb);
LLSDxmlEncode.AddElem("from_group",fromGroup, sb);
LLSDxmlEncode.AddEndMap(sb); //messageParams
string tt = sb.ToString();
*/
return messageParams;
}
@ -349,42 +227,6 @@ namespace OpenSim.Region.ClientStack.Linden
return chatterBoxForceClose;
}
public static OSD GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data)
{
OSDArray AgentData = new OSDArray(1);
OSDMap AgentDataMap = new OSDMap(1);
AgentDataMap.Add("AgentID", OSD.FromUUID(receiverAgent));
AgentData.Add(AgentDataMap);
OSDArray GroupData = new OSDArray(data.Length);
OSDArray NewGroupData = new OSDArray(data.Length);
foreach (GroupMembershipData membership in data)
{
OSDMap GroupDataMap = new OSDMap(6);
OSDMap NewGroupDataMap = new OSDMap(1);
GroupDataMap.Add("GroupID", OSD.FromUUID(membership.GroupID));
GroupDataMap.Add("GroupPowers", OSD.FromULong(membership.GroupPowers));
GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(membership.AcceptNotices));
GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(membership.GroupPicture));
GroupDataMap.Add("Contribution", OSD.FromInteger(membership.Contribution));
GroupDataMap.Add("GroupName", OSD.FromString(membership.GroupName));
NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(membership.ListInProfile));
GroupData.Add(GroupDataMap);
NewGroupData.Add(NewGroupDataMap);
}
OSDMap llDataStruct = new OSDMap(3);
llDataStruct.Add("AgentData", AgentData);
llDataStruct.Add("GroupData", GroupData);
llDataStruct.Add("NewGroupData", NewGroupData);
return BuildEvent("AgentGroupDataUpdate", llDataStruct);
}
public static OSD PlacesQuery(PlacesReplyPacket PlacesReply)
{
OSDMap placesReply = new OSDMap();
@ -426,35 +268,5 @@ namespace OpenSim.Region.ClientStack.Linden
return placesReply;
}
public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage)
{
OSDMap message = new OSDMap();
message.Add("message", OSD.FromString("ParcelProperties"));
OSD message_body = parcelPropertiesMessage.Serialize();
message.Add("body", message_body);
return message;
}
public static OSD partPhysicsProperties(uint localID, byte physhapetype,
float density, float friction, float bounce, float gravmod)
{
OSDMap physinfo = new OSDMap(6);
physinfo["LocalID"] = localID;
physinfo["Density"] = density;
physinfo["Friction"] = friction;
physinfo["GravityMultiplier"] = gravmod;
physinfo["Restitution"] = bounce;
physinfo["PhysicsShapeType"] = (int)physhapetype;
OSDArray array = new OSDArray(1);
array.Add(physinfo);
OSDMap llsdBody = new OSDMap(1);
llsdBody.Add("ObjectData", array);
return BuildEvent("ObjectPhysicsProperties", llsdBody);
}
}
}