From 5d5d0e699af34b9300ed2f60c0c59b256be3dd89 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Fri, 30 Oct 2009 11:12:32 -0700
Subject: * Disables automatic packet splitting on AvatarGroupsReply packets.
 This packet is a mess and shouldn't be used at all (in favor of the event
 queue message) * Clean up the way we send AvatarGroupsReply packets,
 including clamping the group name and group title

---
 .../Region/ClientStack/LindenUDP/LLClientView.cs   | 26 ++++++++++++----------
 .../Region/ClientStack/LindenUDP/LLUDPServer.cs    |  4 ++--
 2 files changed, 16 insertions(+), 14 deletions(-)

(limited to 'OpenSim')

diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index bd75f0c..f33d2fa 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2793,20 +2793,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
             p.AgentData.AvatarID = avatarID;
 
             p.GroupData = new AvatarGroupsReplyPacket.GroupDataBlock[data.Length];
-            int i = 0;
-            foreach (GroupMembershipData m in data)
-            {
-                p.GroupData[i] = new AvatarGroupsReplyPacket.GroupDataBlock();
-                p.GroupData[i].GroupPowers = m.GroupPowers;
-                p.GroupData[i].AcceptNotices = m.AcceptNotices;
-                p.GroupData[i].GroupTitle = Utils.StringToBytes(m.GroupTitle);
-                p.GroupData[i].GroupID = m.GroupID;
-                p.GroupData[i].GroupName = Utils.StringToBytes(m.GroupName);
-                p.GroupData[i].GroupInsigniaID = m.GroupPicture;
-                i++;
+
+            for (int i = 0; i < data.Length; i++)
+            {
+                GroupMembershipData m = data[i];
+
+                AvatarGroupsReplyPacket.GroupDataBlock block = new AvatarGroupsReplyPacket.GroupDataBlock();
+                block.GroupPowers = m.GroupPowers;
+                block.AcceptNotices = m.AcceptNotices;
+                block.GroupTitle = Util.StringToBytes256(m.GroupTitle.Substring(0, 20));
+                block.GroupID = m.GroupID;
+                block.GroupName = Util.StringToBytes256(m.GroupName.Substring(0, 35));
+                block.GroupInsigniaID = m.GroupPicture;
+
+                p.GroupData[i] = block;
             }
 
-            p.NewGroupData = new AvatarGroupsReplyPacket.NewGroupDataBlock();
             p.NewGroupData.ListInProfile = true;
 
             OutPacket(p, ThrottleOutPacketType.Task);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index cc06a85..6f94921 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -247,8 +247,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 
         public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting)
         {
-            // CoarseLocationUpdate packets cannot be split in an automated way
-            if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting)
+            // CoarseLocationUpdate and AvatarGroupsReply packets cannot be split in an automated way
+            if ((packet.Type == PacketType.CoarseLocationUpdate || packet.Type == PacketType.AvatarGroupsReply) && allowSplitting)
                 allowSplitting = false;
 
             if (allowSplitting && packet.HasVariableBlocks)
-- 
cgit v1.1