Convert the AvatarGroupsReply message to the event queue.

0.6.8-post-fixes
Melanie 2009-10-30 19:54:56 +00:00
parent 39f95e8cf0
commit 92f4835ba6
1 changed files with 39 additions and 26 deletions

View File

@ -2787,32 +2787,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendAvatarGroupsReply(UUID avatarID, GroupMembershipData[] data) public void SendAvatarGroupsReply(UUID avatarID, GroupMembershipData[] data)
{ {
AvatarGroupsReplyPacket p = (AvatarGroupsReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarGroupsReply); OSDMap llsd = new OSDMap(3);
OSDArray AgentData = new OSDArray(1);
p.AgentData = new AvatarGroupsReplyPacket.AgentDataBlock(); OSDMap AgentDataMap = new OSDMap(1);
p.AgentData.AgentID = AgentId; AgentDataMap.Add("AgentID", OSD.FromUUID(this.AgentId));
p.AgentData.AvatarID = avatarID; AgentDataMap.Add("AvatarID", OSD.FromUUID(avatarID));
AgentData.Add(AgentDataMap);
p.GroupData = new AvatarGroupsReplyPacket.GroupDataBlock[data.Length]; llsd.Add("AgentData", AgentData);
OSDArray GroupData = new OSDArray(data.Length);
for (int i = 0; i < data.Length; i++) OSDArray NewGroupData = new OSDArray(data.Length);
{ foreach (GroupMembershipData m in data)
GroupMembershipData m = data[i]; {
OSDMap GroupDataMap = new OSDMap(6);
AvatarGroupsReplyPacket.GroupDataBlock block = new AvatarGroupsReplyPacket.GroupDataBlock(); OSDMap NewGroupDataMap = new OSDMap(1);
block.GroupPowers = m.GroupPowers; GroupDataMap.Add("GroupPowers", OSD.FromBinary(m.GroupPowers));
block.AcceptNotices = m.AcceptNotices; GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(m.AcceptNotices));
block.GroupTitle = Util.StringToBytes256(m.GroupTitle.Length > 20 ? m.GroupTitle.Substring(0, 20) : m.GroupTitle); GroupDataMap.Add("GroupTitle", OSD.FromString(m.GroupTitle));
block.GroupID = m.GroupID; GroupDataMap.Add("GroupID", OSD.FromUUID(m.GroupID));
block.GroupName = Util.StringToBytes256(m.GroupName.Length > 35 ? m.GroupName.Substring(0, 35) : m.GroupName); GroupDataMap.Add("GroupName", OSD.FromString(m.GroupName));
block.GroupInsigniaID = m.GroupPicture; GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(m.GroupPicture));
NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(m.ListInProfile));
p.GroupData[i] = block; GroupData.Add(GroupDataMap);
} NewGroupData.Add(NewGroupDataMap);
}
p.NewGroupData.ListInProfile = true; llsd.Add("GroupData", GroupData);
llsd.Add("NewGroupData", NewGroupData);
OutPacket(p, ThrottleOutPacketType.Task);
IEventQueue eq = this.Scene.RequestModuleInterface<IEventQueue>();
if (eq != null)
{
eq.Enqueue(BuildEvent("AvatarGroupsReply", llsd), this.AgentId);
}
} }
public void SendJoinGroupReply(UUID groupID, bool success) public void SendJoinGroupReply(UUID groupID, bool success)
@ -10299,5 +10304,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
#endregion #endregion
public static OSD BuildEvent(string eventName, OSD eventBody)
{
OSDMap osdEvent = new OSDMap(2);
osdEvent.Add("message", new OSDString(eventName));
osdEvent.Add("body", eventBody);
return osdEvent;
}
} }
} }