Send groups list via event queue

0.6.3-post-fixes
Dahlia Trimble 2009-01-27 06:14:11 +00:00
parent 54a1b9dbff
commit c747990187
2 changed files with 92 additions and 13 deletions

View File

@ -1216,7 +1216,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OSD Item = Environment.EventQueueHelper.ChatterboxInvitation( OSD Item = Environment.EventQueueHelper.ChatterboxInvitation(
new UUID("00000000-68f9-1111-024e-222222111123"), new UUID("00000000-68f9-1111-024e-222222111123"),
"Test Group", fromAgent, message, toAgent, fromName, dialog, 0, "OpenSimulator Testing", fromAgent, message, toAgent, fromName, dialog, 0,
false, 0, new Vector3(), 1, transactionID, fromGroup, binaryBucket); false, 0, new Vector3(), 1, transactionID, fromGroup, binaryBucket);
eq.Enqueue(Item, toAgent); eq.Enqueue(Item, toAgent);
@ -7600,7 +7600,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Groupupdate.AgentData.AgentID = AgentId; Groupupdate.AgentData.AgentID = AgentId;
OutPacket(Groupupdate, ThrottleOutPacketType.Task); OutPacket(Groupupdate, ThrottleOutPacketType.Task);
try
{
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
if (eq != null)
{
OSD Item = Environment.EventQueueHelper.GroupMembership(Groupupdate);
eq.Enqueue(Item, this.AgentId);
}
}
catch (Exception ex)
{
m_log.Error("Unable to send group membership data via eventqueue - exception: " + ex.ToString());
m_log.Warn("sending group membership data via UDP");
OutPacket(Groupupdate, ThrottleOutPacketType.Task);
}
} }
public void SendGroupNameReply(UUID groupLLUID, string GroupName) public void SendGroupNameReply(UUID groupLLUID, string GroupName)
{ {
UUIDGroupNameReplyPacket pack = new UUIDGroupNameReplyPacket(); UUIDGroupNameReplyPacket pack = new UUIDGroupNameReplyPacket();

View File

@ -37,19 +37,19 @@ namespace OpenSim.Region.Environment
{ {
private EventQueueHelper() {} // no construction possible, it's an utility class private EventQueueHelper() {} // no construction possible, it's an utility class
private static byte[] regionHandleToByteArray(ulong regionHandle) private static byte[] ulongToByteArray(ulong uLongValue)
{ {
// Reverse endianness of RegionHandle // Reverse endianness of RegionHandle
return new byte[] return new byte[]
{ {
(byte)((regionHandle >> 56) % 256), (byte)((uLongValue >> 56) % 256),
(byte)((regionHandle >> 48) % 256), (byte)((uLongValue >> 48) % 256),
(byte)((regionHandle >> 40) % 256), (byte)((uLongValue >> 40) % 256),
(byte)((regionHandle >> 32) % 256), (byte)((uLongValue >> 32) % 256),
(byte)((regionHandle >> 24) % 256), (byte)((uLongValue >> 24) % 256),
(byte)((regionHandle >> 16) % 256), (byte)((uLongValue >> 16) % 256),
(byte)((regionHandle >> 8) % 256), (byte)((uLongValue >> 8) % 256),
(byte)(regionHandle % 256) (byte)(uLongValue % 256)
}; };
} }
@ -79,7 +79,7 @@ namespace OpenSim.Region.Environment
{ {
OSDMap llsdSimInfo = new OSDMap(3); OSDMap llsdSimInfo = new OSDMap(3);
llsdSimInfo.Add("Handle", new OSDBinary(regionHandleToByteArray(Handle))); llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(Handle)));
llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes())); llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes()));
llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port)); llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port));
@ -136,7 +136,7 @@ namespace OpenSim.Region.Environment
AgentDataArr.Add(AgentDataMap); AgentDataArr.Add(AgentDataMap);
OSDMap RegionDataMap = new OSDMap(4); OSDMap RegionDataMap = new OSDMap(4);
RegionDataMap.Add("RegionHandle", OSD.FromBinary(regionHandleToByteArray(Handle))); RegionDataMap.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(Handle)));
RegionDataMap.Add("SeedCapability", OSD.FromString(capsURL)); RegionDataMap.Add("SeedCapability", OSD.FromString(capsURL));
RegionDataMap.Add("SimIP", OSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes())); RegionDataMap.Add("SimIP", OSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes()));
RegionDataMap.Add("SimPort", OSD.FromInteger(newRegionExternalEndPoint.Port)); RegionDataMap.Add("SimPort", OSD.FromInteger(newRegionExternalEndPoint.Port));
@ -159,7 +159,7 @@ namespace OpenSim.Region.Environment
OSDMap info = new OSDMap(); OSDMap info = new OSDMap();
info.Add("AgentID", OSD.FromUUID(AgentID)); info.Add("AgentID", OSD.FromUUID(AgentID));
info.Add("LocationID", OSD.FromInteger(4)); // TODO what is this? info.Add("LocationID", OSD.FromInteger(4)); // TODO what is this?
info.Add("RegionHandle", OSD.FromBinary(regionHandleToByteArray(regionHandle))); info.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(regionHandle)));
info.Add("SeedCapability", OSD.FromString(capsURL)); info.Add("SeedCapability", OSD.FromString(capsURL));
info.Add("SimAccess", OSD.FromInteger(simAccess)); info.Add("SimAccess", OSD.FromInteger(simAccess));
info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes()));
@ -418,5 +418,66 @@ namespace OpenSim.Region.Environment
return parcelProperties; return parcelProperties;
} }
public static OSD GroupMembership(AgentGroupDataUpdatePacket groupUpdatePacket)
{
OSDMap groupUpdate = new OSDMap();
groupUpdate.Add("message", OSD.FromString("AgentGroupDataUpdate"));
OSDMap body = new OSDMap();
OSDArray agentData = new OSDArray();
OSDMap agentDataMap = new OSDMap();
agentDataMap.Add("AgentID", OSD.FromUUID(groupUpdatePacket.AgentData.AgentID));
agentData.Add(agentDataMap);
body.Add("AgentData", agentData);
OSDArray groupData = new OSDArray();
foreach (AgentGroupDataUpdatePacket.GroupDataBlock groupDataBlock in groupUpdatePacket.GroupData)
{
OSDMap groupDataMap = new OSDMap();
groupDataMap.Add("ListInProfile", OSD.FromBoolean(false));
groupDataMap.Add("GroupID", OSD.FromUUID(groupDataBlock.GroupID));
groupDataMap.Add("GroupInsigniaID", OSD.FromUUID(groupDataBlock.GroupInsigniaID));
groupDataMap.Add("Contribution", OSD.FromInteger(groupDataBlock.Contribution));
groupDataMap.Add("GroupPowers", OSD.FromBinary(ulongToByteArray(groupDataBlock.GroupPowers)));
groupDataMap.Add("GroupName", OSD.FromString(Utils.BytesToString(groupDataBlock.GroupName)));
groupDataMap.Add("AcceptNotices", OSD.FromBoolean(groupDataBlock.AcceptNotices));
groupData.Add(groupDataMap);
}
body.Add("GroupData", groupData);
groupUpdate.Add("body", body);
return groupUpdate;
}
/*
public void SendGroupMembership(GroupMembershipData[] GroupMembership)
{
m_groupPowers.Clear();
AgentGroupDataUpdatePacket Groupupdate = new AgentGroupDataUpdatePacket();
AgentGroupDataUpdatePacket.GroupDataBlock[] Groups = new AgentGroupDataUpdatePacket.GroupDataBlock[GroupMembership.Length];
for (int i = 0; i < GroupMembership.Length; i++)
{
m_groupPowers[GroupMembership[i].GroupID] = GroupMembership[i].GroupPowers;
AgentGroupDataUpdatePacket.GroupDataBlock Group = new AgentGroupDataUpdatePacket.GroupDataBlock();
Group.AcceptNotices = GroupMembership[i].AcceptNotices;
Group.Contribution = GroupMembership[i].Contribution;
Group.GroupID = GroupMembership[i].GroupID;
Group.GroupInsigniaID = GroupMembership[i].GroupPicture;
Group.GroupName = Utils.StringToBytes(GroupMembership[i].GroupName);
Group.GroupPowers = GroupMembership[i].GroupPowers;
Groups[i] = Group;
Groupupdate.GroupData = Groups;
}
Groupupdate.AgentData.AgentID = AgentId;
OutPacket(Groupupdate, ThrottleOutPacketType.Task);
}
*/
} }
} }