From c747990187f7ad655434c61d033de0ebbbf2da8d Mon Sep 17 00:00:00 2001 From: Dahlia Trimble Date: Tue, 27 Jan 2009 06:14:11 +0000 Subject: Send groups list via event queue --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 20 ++++- .../Framework/EventQueue/EventQueueHelper.cs | 85 +++++++++++++++++++--- 2 files changed, 92 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index e58549a..42bb783 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -1216,7 +1216,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OSD Item = Environment.EventQueueHelper.ChatterboxInvitation( 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); eq.Enqueue(Item, toAgent); @@ -7600,7 +7600,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP Groupupdate.AgentData.AgentID = AgentId; OutPacket(Groupupdate, ThrottleOutPacketType.Task); + try + { + IEventQueue eq = Scene.RequestModuleInterface(); + 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) { UUIDGroupNameReplyPacket pack = new UUIDGroupNameReplyPacket(); diff --git a/OpenSim/Region/Environment/Modules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/Environment/Modules/Framework/EventQueue/EventQueueHelper.cs index aa57bd0..a64418d 100644 --- a/OpenSim/Region/Environment/Modules/Framework/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/Environment/Modules/Framework/EventQueue/EventQueueHelper.cs @@ -37,19 +37,19 @@ namespace OpenSim.Region.Environment { 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 return new byte[] { - (byte)((regionHandle >> 56) % 256), - (byte)((regionHandle >> 48) % 256), - (byte)((regionHandle >> 40) % 256), - (byte)((regionHandle >> 32) % 256), - (byte)((regionHandle >> 24) % 256), - (byte)((regionHandle >> 16) % 256), - (byte)((regionHandle >> 8) % 256), - (byte)(regionHandle % 256) + (byte)((uLongValue >> 56) % 256), + (byte)((uLongValue >> 48) % 256), + (byte)((uLongValue >> 40) % 256), + (byte)((uLongValue >> 32) % 256), + (byte)((uLongValue >> 24) % 256), + (byte)((uLongValue >> 16) % 256), + (byte)((uLongValue >> 8) % 256), + (byte)(uLongValue % 256) }; } @@ -79,7 +79,7 @@ namespace OpenSim.Region.Environment { 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("Port", new OSDInteger(endPoint.Port)); @@ -136,7 +136,7 @@ namespace OpenSim.Region.Environment AgentDataArr.Add(AgentDataMap); 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("SimIP", OSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes())); RegionDataMap.Add("SimPort", OSD.FromInteger(newRegionExternalEndPoint.Port)); @@ -159,7 +159,7 @@ namespace OpenSim.Region.Environment 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(regionHandleToByteArray(regionHandle))); + 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())); @@ -418,5 +418,66 @@ namespace OpenSim.Region.Environment 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); + + } + */ + } } -- cgit v1.1