aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs698
1 files changed, 413 insertions, 285 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 1e72aa2..a097ec9 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -158,6 +158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
158 public event RequestTaskInventory OnRequestTaskInventory; 158 public event RequestTaskInventory OnRequestTaskInventory;
159 public event UpdateInventoryItem OnUpdateInventoryItem; 159 public event UpdateInventoryItem OnUpdateInventoryItem;
160 public event CopyInventoryItem OnCopyInventoryItem; 160 public event CopyInventoryItem OnCopyInventoryItem;
161 public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy;
161 public event MoveInventoryItem OnMoveInventoryItem; 162 public event MoveInventoryItem OnMoveInventoryItem;
162 public event RemoveInventoryItem OnRemoveInventoryItem; 163 public event RemoveInventoryItem OnRemoveInventoryItem;
163 public event RemoveInventoryFolder OnRemoveInventoryFolder; 164 public event RemoveInventoryFolder OnRemoveInventoryFolder;
@@ -255,7 +256,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
255 public event ClassifiedInfoRequest OnClassifiedInfoRequest; 256 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
256 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; 257 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
257 public event ClassifiedDelete OnClassifiedDelete; 258 public event ClassifiedDelete OnClassifiedDelete;
258 public event ClassifiedDelete OnClassifiedGodDelete; 259 public event ClassifiedGodDelete OnClassifiedGodDelete;
259 public event EventNotificationAddRequest OnEventNotificationAddRequest; 260 public event EventNotificationAddRequest OnEventNotificationAddRequest;
260 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; 261 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
261 public event EventGodDelete OnEventGodDelete; 262 public event EventGodDelete OnEventGodDelete;
@@ -286,6 +287,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
286 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 287 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
287 public event SimWideDeletesDelegate OnSimWideDeletes; 288 public event SimWideDeletesDelegate OnSimWideDeletes;
288 public event SendPostcard OnSendPostcard; 289 public event SendPostcard OnSendPostcard;
290 public event ChangeInventoryItemFlags OnChangeInventoryItemFlags;
289 public event MuteListEntryUpdate OnUpdateMuteListEntry; 291 public event MuteListEntryUpdate OnUpdateMuteListEntry;
290 public event MuteListEntryRemove OnRemoveMuteListEntry; 292 public event MuteListEntryRemove OnRemoveMuteListEntry;
291 public event GodlikeMessage onGodlikeMessage; 293 public event GodlikeMessage onGodlikeMessage;
@@ -336,7 +338,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
336 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an 338 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an
337 /// ownerless phantom. 339 /// ownerless phantom.
338 /// 340 ///
339 /// All manipulation of this set has to occur under a lock 341 /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
340 /// 342 ///
341 /// </value> 343 /// </value>
342 protected HashSet<uint> m_killRecord; 344 protected HashSet<uint> m_killRecord;
@@ -344,6 +346,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
344// protected HashSet<uint> m_attachmentsSent; 346// protected HashSet<uint> m_attachmentsSent;
345 347
346 private int m_moneyBalance; 348 private int m_moneyBalance;
349 private bool m_deliverPackets = true;
347 private int m_animationSequenceNumber = 1; 350 private int m_animationSequenceNumber = 1;
348 private bool m_SendLogoutPacketWhenClosing = true; 351 private bool m_SendLogoutPacketWhenClosing = true;
349 private AgentUpdateArgs lastarg; 352 private AgentUpdateArgs lastarg;
@@ -383,6 +386,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
383 get { return m_startpos; } 386 get { return m_startpos; }
384 set { m_startpos = value; } 387 set { m_startpos = value; }
385 } 388 }
389 public bool DeliverPackets
390 {
391 get { return m_deliverPackets; }
392 set {
393 m_deliverPackets = value;
394 m_udpClient.m_deliverPackets = value;
395 }
396 }
386 public UUID AgentId { get { return m_agentId; } } 397 public UUID AgentId { get { return m_agentId; } }
387 public ISceneAgent SceneAgent { get; private set; } 398 public ISceneAgent SceneAgent { get; private set; }
388 public UUID ActiveGroupId { get { return m_activeGroupID; } } 399 public UUID ActiveGroupId { get { return m_activeGroupID; } }
@@ -487,18 +498,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
487 498
488 #region Client Methods 499 #region Client Methods
489 500
501
490 /// <summary> 502 /// <summary>
491 /// Shut down the client view 503 /// Shut down the client view
492 /// </summary> 504 /// </summary>
493 public void Close() 505 public void Close()
494 { 506 {
507 Close(true);
508 }
509
510 /// <summary>
511 /// Shut down the client view
512 /// </summary>
513 public void Close(bool sendStop)
514 {
495 m_log.DebugFormat( 515 m_log.DebugFormat(
496 "[CLIENT]: Close has been called for {0} attached to scene {1}", 516 "[CLIENT]: Close has been called for {0} attached to scene {1}",
497 Name, m_scene.RegionInfo.RegionName); 517 Name, m_scene.RegionInfo.RegionName);
498 518
499 // Send the STOP packet 519 if (sendStop)
500 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); 520 {
501 OutPacket(disable, ThrottleOutPacketType.Unknown); 521 // Send the STOP packet
522 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
523 OutPacket(disable, ThrottleOutPacketType.Unknown);
524 }
502 525
503 IsActive = false; 526 IsActive = false;
504 527
@@ -801,7 +824,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
801 reply.ChatData.OwnerID = fromAgentID; 824 reply.ChatData.OwnerID = fromAgentID;
802 reply.ChatData.SourceID = fromAgentID; 825 reply.ChatData.SourceID = fromAgentID;
803 826
804 OutPacket(reply, ThrottleOutPacketType.Task); 827 OutPacket(reply, ThrottleOutPacketType.Unknown);
805 } 828 }
806 829
807 /// <summary> 830 /// <summary>
@@ -1087,6 +1110,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1087 public virtual void SendLayerData(float[] map) 1110 public virtual void SendLayerData(float[] map)
1088 { 1111 {
1089 Util.FireAndForget(DoSendLayerData, map); 1112 Util.FireAndForget(DoSendLayerData, map);
1113
1114 // Send it sync, and async. It's not that much data
1115 // and it improves user experience just so much!
1116 DoSendLayerData(map);
1090 } 1117 }
1091 1118
1092 /// <summary> 1119 /// <summary>
@@ -1099,16 +1126,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1099 1126
1100 try 1127 try
1101 { 1128 {
1102 //for (int y = 0; y < 16; y++) 1129 for (int y = 0; y < 16; y++)
1103 //{ 1130 {
1104 // for (int x = 0; x < 16; x++) 1131 for (int x = 0; x < 16; x+=4)
1105 // { 1132 {
1106 // SendLayerData(x, y, map); 1133 SendLayerPacket(x, y, map);
1107 // } 1134 }
1108 //} 1135 }
1109
1110 // Send LayerData in a spiral pattern. Fun!
1111 SendLayerTopRight(map, 0, 0, 15, 15);
1112 } 1136 }
1113 catch (Exception e) 1137 catch (Exception e)
1114 { 1138 {
@@ -1116,51 +1140,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1116 } 1140 }
1117 } 1141 }
1118 1142
1119 private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2)
1120 {
1121 // Row
1122 for (int i = x1; i <= x2; i++)
1123 SendLayerData(i, y1, map);
1124
1125 // Column
1126 for (int j = y1 + 1; j <= y2; j++)
1127 SendLayerData(x2, j, map);
1128
1129 if (x2 - x1 > 0)
1130 SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
1131 }
1132
1133 void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2)
1134 {
1135 // Row in reverse
1136 for (int i = x2; i >= x1; i--)
1137 SendLayerData(i, y2, map);
1138
1139 // Column in reverse
1140 for (int j = y2 - 1; j >= y1; j--)
1141 SendLayerData(x1, j, map);
1142
1143 if (x2 - x1 > 0)
1144 SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
1145 }
1146
1147 /// <summary> 1143 /// <summary>
1148 /// Sends a set of four patches (x, x+1, ..., x+3) to the client 1144 /// Sends a set of four patches (x, x+1, ..., x+3) to the client
1149 /// </summary> 1145 /// </summary>
1150 /// <param name="map">heightmap</param> 1146 /// <param name="map">heightmap</param>
1151 /// <param name="px">X coordinate for patches 0..12</param> 1147 /// <param name="px">X coordinate for patches 0..12</param>
1152 /// <param name="py">Y coordinate for patches 0..15</param> 1148 /// <param name="py">Y coordinate for patches 0..15</param>
1153 // private void SendLayerPacket(float[] map, int y, int x) 1149 private void SendLayerPacket(int x, int y, float[] map)
1154 // { 1150 {
1155 // int[] patches = new int[4]; 1151 int[] patches = new int[4];
1156 // patches[0] = x + 0 + y * 16; 1152 patches[0] = x + 0 + y * 16;
1157 // patches[1] = x + 1 + y * 16; 1153 patches[1] = x + 1 + y * 16;
1158 // patches[2] = x + 2 + y * 16; 1154 patches[2] = x + 2 + y * 16;
1159 // patches[3] = x + 3 + y * 16; 1155 patches[3] = x + 3 + y * 16;
1160 1156
1161 // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); 1157 float[] heightmap = (map.Length == 65536) ?
1162 // OutPacket(layerpack, ThrottleOutPacketType.Land); 1158 map :
1163 // } 1159 LLHeightFieldMoronize(map);
1160
1161 try
1162 {
1163 Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1164 OutPacket(layerpack, ThrottleOutPacketType.Land);
1165 }
1166 catch
1167 {
1168 for (int px = x ; px < x + 4 ; px++)
1169 SendLayerData(px, y, map);
1170 }
1171 }
1164 1172
1165 /// <summary> 1173 /// <summary>
1166 /// Sends a specified patch to a client 1174 /// Sends a specified patch to a client
@@ -1180,7 +1188,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1180 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); 1188 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1181 layerpack.Header.Reliable = true; 1189 layerpack.Header.Reliable = true;
1182 1190
1183 OutPacket(layerpack, ThrottleOutPacketType.Land); 1191 OutPacket(layerpack, ThrottleOutPacketType.Task);
1184 } 1192 }
1185 catch (Exception e) 1193 catch (Exception e)
1186 { 1194 {
@@ -2304,6 +2312,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2304 OutPacket(sound, ThrottleOutPacketType.Task); 2312 OutPacket(sound, ThrottleOutPacketType.Task);
2305 } 2313 }
2306 2314
2315 public void SendTransferAbort(TransferRequestPacket transferRequest)
2316 {
2317 TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort);
2318 abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID;
2319 abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType;
2320 m_log.Debug("[Assets] Aborting transfer; asset request failed");
2321 OutPacket(abort, ThrottleOutPacketType.Task);
2322 }
2323
2307 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) 2324 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain)
2308 { 2325 {
2309 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); 2326 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger);
@@ -3606,7 +3623,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3606 /// </summary> 3623 /// </summary>
3607 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) 3624 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
3608 { 3625 {
3609 //double priority = m_prioritizer.GetUpdatePriority(this, entity); 3626 if (entity is SceneObjectPart)
3627 {
3628 SceneObjectPart e = (SceneObjectPart)entity;
3629 SceneObjectGroup g = e.ParentGroup;
3630 if (g.RootPart.Shape.State > 30) // HUD
3631 if (g.OwnerID != AgentId)
3632 return; // Don't send updates for other people's HUDs
3633 }
3634
3610 uint priority = m_prioritizer.GetUpdatePriority(this, entity); 3635 uint priority = m_prioritizer.GetUpdatePriority(this, entity);
3611 3636
3612 lock (m_entityUpdates.SyncRoot) 3637 lock (m_entityUpdates.SyncRoot)
@@ -3673,211 +3698,230 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3673 3698
3674 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race 3699 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race
3675 // condition where a kill can be processed before an out-of-date update for the same object. 3700 // condition where a kill can be processed before an out-of-date update for the same object.
3676 lock (m_killRecord) 3701 float avgTimeDilation = 1.0f;
3702 IEntityUpdate iupdate;
3703 Int32 timeinqueue; // this is just debugging code & can be dropped later
3704
3705 while (updatesThisCall < maxUpdates)
3677 { 3706 {
3678 float avgTimeDilation = 1.0f; 3707 lock (m_entityUpdates.SyncRoot)
3679 IEntityUpdate iupdate; 3708 if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue))
3680 Int32 timeinqueue; // this is just debugging code & can be dropped later 3709 break;
3681
3682 while (updatesThisCall < maxUpdates)
3683 {
3684 lock (m_entityUpdates.SyncRoot)
3685 if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue))
3686 break;
3687 3710
3688 EntityUpdate update = (EntityUpdate)iupdate; 3711 EntityUpdate update = (EntityUpdate)iupdate;
3689 3712
3690 avgTimeDilation += update.TimeDilation; 3713 avgTimeDilation += update.TimeDilation;
3691 avgTimeDilation *= 0.5f; 3714 avgTimeDilation *= 0.5f;
3692 3715
3693 if (update.Entity is SceneObjectPart) 3716 if (update.Entity is SceneObjectPart)
3717 {
3718 SceneObjectPart part = (SceneObjectPart)update.Entity;
3719
3720 // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
3721 // will never receive an update after a prim kill. Even then, keeping the kill record may be a good
3722 // safety measure.
3723 //
3724 // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update
3725 // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs
3726 // updates and kills on different threads with different scheduling strategies, hence this protection.
3727 //
3728 // This doesn't appear to apply to child prims - a client will happily ignore these updates
3729 // after the root prim has been deleted.
3730 lock (m_killRecord)
3694 { 3731 {
3695 SceneObjectPart part = (SceneObjectPart)update.Entity;
3696
3697 // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
3698 // will never receive an update after a prim kill. Even then, keeping the kill record may be a good
3699 // safety measure.
3700 //
3701 // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update
3702 // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs
3703 // updates and kills on different threads with different scheduling strategies, hence this protection.
3704 //
3705 // This doesn't appear to apply to child prims - a client will happily ignore these updates
3706 // after the root prim has been deleted.
3707 if (m_killRecord.Contains(part.LocalId)) 3732 if (m_killRecord.Contains(part.LocalId))
3708 {
3709 // m_log.WarnFormat(
3710 // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted",
3711 // part.LocalId, Name);
3712 continue; 3733 continue;
3713 } 3734 if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId))
3714 3735 continue;
3715 if (part.ParentGroup.IsAttachment && m_disableFacelights) 3736 }
3737
3738 if (part.ParentGroup.IsDeleted)
3739 continue;
3740
3741 if (part.ParentGroup.IsAttachment)
3742 { // Someone else's HUD, why are we getting these?
3743 if (part.ParentGroup.OwnerID != AgentId &&
3744 part.ParentGroup.RootPart.Shape.State >= 30)
3745 continue;
3746 ScenePresence sp;
3747 // Owner is not in the sim, don't update it to
3748 // anyone
3749 if (!m_scene.TryGetScenePresence(part.OwnerID, out sp))
3750 continue;
3751
3752 List<SceneObjectGroup> atts = sp.GetAttachments();
3753 bool found = false;
3754 foreach (SceneObjectGroup att in atts)
3716 { 3755 {
3717 if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && 3756 if (att == part.ParentGroup)
3718 part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
3719 { 3757 {
3720 part.Shape.LightEntry = false; 3758 found = true;
3759 break;
3721 } 3760 }
3722 } 3761 }
3762
3763 // It's an attachment of a valid avatar, but
3764 // doesn't seem to be attached, skip
3765 if (!found)
3766 continue;
3723 } 3767 }
3724 3768 if (part.ParentGroup.IsAttachment && m_disableFacelights)
3725 ++updatesThisCall;
3726
3727 #region UpdateFlags to packet type conversion
3728
3729 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
3730
3731 bool canUseCompressed = true;
3732 bool canUseImproved = true;
3733
3734 // Compressed object updates only make sense for LL primitives
3735 if (!(update.Entity is SceneObjectPart))
3736 {
3737 canUseCompressed = false;
3738 }
3739
3740 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
3741 {
3742 canUseCompressed = false;
3743 canUseImproved = false;
3744 }
3745 else
3746 { 3769 {
3747 if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || 3770 if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
3748 updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || 3771 part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
3749 updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
3750 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3751 {
3752 canUseCompressed = false;
3753 }
3754
3755 if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
3756 updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
3757 updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
3758 updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
3759 updateFlags.HasFlag(PrimUpdateFlags.Text) ||
3760 updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
3761 updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
3762 updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
3763 updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
3764 updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
3765 updateFlags.HasFlag(PrimUpdateFlags.Material) ||
3766 updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
3767 updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
3768 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3769 { 3772 {
3770 canUseImproved = false; 3773 part.Shape.LightEntry = false;
3771 } 3774 }
3772 } 3775 }
3773 3776 }
3774 #endregion UpdateFlags to packet type conversion 3777
3775 3778 ++updatesThisCall;
3776 #region Block Construction 3779
3777 3780 #region UpdateFlags to packet type conversion
3778 // TODO: Remove this once we can build compressed updates 3781
3782 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
3783
3784 bool canUseCompressed = true;
3785 bool canUseImproved = true;
3786
3787 // Compressed object updates only make sense for LL primitives
3788 if (!(update.Entity is SceneObjectPart))
3789 {
3779 canUseCompressed = false; 3790 canUseCompressed = false;
3780 3791 }
3781 if (!canUseImproved && !canUseCompressed) 3792
3782 { 3793 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
3783 if (update.Entity is ScenePresence) 3794 {
3784 { 3795 canUseCompressed = false;
3785 objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); 3796 canUseImproved = false;
3786 objectUpdates.Value.Add(update); 3797 }
3787 } 3798 else
3788 else 3799 {
3789 { 3800 if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) ||
3790 objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); 3801 updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
3791 objectUpdates.Value.Add(update); 3802 updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
3792 } 3803 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3793 }
3794 else if (!canUseImproved)
3795 { 3804 {
3796 compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); 3805 canUseCompressed = false;
3797 compressedUpdates.Value.Add(update);
3798 } 3806 }
3799 else 3807
3808 if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
3809 updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
3810 updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
3811 updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
3812 updateFlags.HasFlag(PrimUpdateFlags.Text) ||
3813 updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
3814 updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
3815 updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
3816 updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
3817 updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
3818 updateFlags.HasFlag(PrimUpdateFlags.Material) ||
3819 updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
3820 updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
3821 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3800 { 3822 {
3801 if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) 3823 canUseImproved = false;
3802 {
3803 // Self updates go into a special list
3804 terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3805 terseAgentUpdates.Value.Add(update);
3806 }
3807 else
3808 {
3809 // Everything else goes here
3810 terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3811 terseUpdates.Value.Add(update);
3812 }
3813 } 3824 }
3814
3815 #endregion Block Construction
3816 } 3825 }
3817
3818
3819 #region Packet Sending
3820 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f);
3821 3826
3822 if (terseAgentUpdateBlocks.IsValueCreated) 3827 #endregion UpdateFlags to packet type conversion
3823 {
3824 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
3825 3828
3826 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); 3829 #region Block Construction
3827 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3828 packet.RegionData.TimeDilation = timeDilation;
3829 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3830 3830
3831 for (int i = 0; i < blocks.Count; i++) 3831 // TODO: Remove this once we can build compressed updates
3832 packet.ObjectData[i] = blocks[i]; 3832 canUseCompressed = false;
3833 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3834 OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); });
3835 }
3836 3833
3837 if (objectUpdateBlocks.IsValueCreated) 3834 if (!canUseImproved && !canUseCompressed)
3838 { 3835 {
3839 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; 3836 if (update.Entity is ScenePresence)
3840 3837 {
3841 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); 3838 objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
3842 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 3839 }
3843 packet.RegionData.TimeDilation = timeDilation; 3840 else
3844 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 3841 {
3845 3842 objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
3846 for (int i = 0; i < blocks.Count; i++) 3843 }
3847 packet.ObjectData[i] = blocks[i];
3848 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3849 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); });
3850 } 3844 }
3851 3845 else if (!canUseImproved)
3852 if (compressedUpdateBlocks.IsValueCreated)
3853 { 3846 {
3854 List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; 3847 compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags));
3855
3856 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
3857 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3858 packet.RegionData.TimeDilation = timeDilation;
3859 packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
3860
3861 for (int i = 0; i < blocks.Count; i++)
3862 packet.ObjectData[i] = blocks[i];
3863 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3864 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); });
3865 } 3848 }
3866 3849 else
3867 if (terseUpdateBlocks.IsValueCreated)
3868 { 3850 {
3869 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; 3851 if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId)
3870 3852 // Self updates go into a special list
3871 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); 3853 terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3872 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 3854 else
3873 packet.RegionData.TimeDilation = timeDilation; 3855 // Everything else goes here
3874 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 3856 terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3875
3876 for (int i = 0; i < blocks.Count; i++)
3877 packet.ObjectData[i] = blocks[i];
3878 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3879 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); });
3880 } 3857 }
3858
3859 #endregion Block Construction
3860 }
3861
3862 #region Packet Sending
3863
3864 const float TIME_DILATION = 1.0f;
3865 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f);
3866
3867 if (terseAgentUpdateBlocks.IsValueCreated)
3868 {
3869 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
3870
3871 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket();
3872 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3873 packet.RegionData.TimeDilation = timeDilation;
3874 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3875
3876 for (int i = 0; i < blocks.Count; i++)
3877 packet.ObjectData[i] = blocks[i];
3878
3879 OutPacket(packet, ThrottleOutPacketType.Unknown, true);
3880 }
3881
3882 if (objectUpdateBlocks.IsValueCreated)
3883 {
3884 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value;
3885
3886 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
3887 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3888 packet.RegionData.TimeDilation = timeDilation;
3889 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3890
3891 for (int i = 0; i < blocks.Count; i++)
3892 packet.ObjectData[i] = blocks[i];
3893
3894 OutPacket(packet, ThrottleOutPacketType.Task, true);
3895 }
3896
3897 if (compressedUpdateBlocks.IsValueCreated)
3898 {
3899 List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value;
3900
3901 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
3902 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3903 packet.RegionData.TimeDilation = timeDilation;
3904 packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
3905
3906 for (int i = 0; i < blocks.Count; i++)
3907 packet.ObjectData[i] = blocks[i];
3908
3909 OutPacket(packet, ThrottleOutPacketType.Task, true);
3910 }
3911
3912 if (terseUpdateBlocks.IsValueCreated)
3913 {
3914 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
3915
3916 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket();
3917 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3918 packet.RegionData.TimeDilation = timeDilation;
3919 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3920
3921 for (int i = 0; i < blocks.Count; i++)
3922 packet.ObjectData[i] = blocks[i];
3923
3924 OutPacket(packet, ThrottleOutPacketType.Task, true);
3881 } 3925 }
3882 3926
3883 #endregion Packet Sending 3927 #endregion Packet Sending
@@ -4170,11 +4214,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4170 4214
4171 // Pass in the delegate so that if this packet needs to be resent, we send the current properties 4215 // Pass in the delegate so that if this packet needs to be resent, we send the current properties
4172 // of the object rather than the properties when the packet was created 4216 // of the object rather than the properties when the packet was created
4173 OutPacket(packet, ThrottleOutPacketType.Task, true, 4217 // HACK : Remove intelligent resending until it's fixed in core
4174 delegate(OutgoingPacket oPacket) 4218 //OutPacket(packet, ThrottleOutPacketType.Task, true,
4175 { 4219 // delegate(OutgoingPacket oPacket)
4176 ResendPropertyUpdates(updates, oPacket); 4220 // {
4177 }); 4221 // ResendPropertyUpdates(updates, oPacket);
4222 // });
4223 OutPacket(packet, ThrottleOutPacketType.Task, true);
4178 4224
4179 // pbcnt += blocks.Count; 4225 // pbcnt += blocks.Count;
4180 // ppcnt++; 4226 // ppcnt++;
@@ -4200,11 +4246,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4200 // of the object rather than the properties when the packet was created 4246 // of the object rather than the properties when the packet was created
4201 List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); 4247 List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>();
4202 updates.Add(familyUpdates.Value[i]); 4248 updates.Add(familyUpdates.Value[i]);
4203 OutPacket(packet, ThrottleOutPacketType.Task, true, 4249 // HACK : Remove intelligent resending until it's fixed in core
4204 delegate(OutgoingPacket oPacket) 4250 //OutPacket(packet, ThrottleOutPacketType.Task, true,
4205 { 4251 // delegate(OutgoingPacket oPacket)
4206 ResendPropertyUpdates(updates, oPacket); 4252 // {
4207 }); 4253 // ResendPropertyUpdates(updates, oPacket);
4254 // });
4255 OutPacket(packet, ThrottleOutPacketType.Task, true);
4208 4256
4209 // fpcnt++; 4257 // fpcnt++;
4210 // fbcnt++; 4258 // fbcnt++;
@@ -4353,37 +4401,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4353 if (bl[i].BannedUserID == UUID.Zero) 4401 if (bl[i].BannedUserID == UUID.Zero)
4354 continue; 4402 continue;
4355 BannedUsers.Add(bl[i].BannedUserID); 4403 BannedUsers.Add(bl[i].BannedUserID);
4356 }
4357 4404
4358 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); 4405 if (BannedUsers.Count >= 50 || (i == (bl.Length - 1) && BannedUsers.Count > 0))
4359 packet.AgentData.TransactionID = UUID.Random(); 4406 {
4360 packet.AgentData.AgentID = AgentId; 4407 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
4361 packet.AgentData.SessionID = SessionId; 4408 packet.AgentData.TransactionID = UUID.Random();
4362 packet.MethodData.Invoice = invoice; 4409 packet.AgentData.AgentID = AgentId;
4363 packet.MethodData.Method = Utils.StringToBytes("setaccess"); 4410 packet.AgentData.SessionID = SessionId;
4411 packet.MethodData.Invoice = invoice;
4412 packet.MethodData.Method = Utils.StringToBytes("setaccess");
4364 4413
4365 EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count]; 4414 EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count];
4366 4415
4367 for (int i = 0; i < (6 + BannedUsers.Count); i++) 4416 int j;
4368 { 4417 for (j = 0; j < (6 + BannedUsers.Count); j++)
4369 returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); 4418 {
4370 } 4419 returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock();
4371 int j = 0; 4420 }
4421 j = 0;
4372 4422
4373 returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; 4423 returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++;
4374 returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; 4424 returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++;
4375 returnblock[j].Parameter = Utils.StringToBytes("0"); j++; 4425 returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
4376 returnblock[j].Parameter = Utils.StringToBytes("0"); j++; 4426 returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
4377 returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++; 4427 returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++;
4378 returnblock[j].Parameter = Utils.StringToBytes("0"); j++; 4428 returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
4379 4429
4380 foreach (UUID banned in BannedUsers) 4430 foreach (UUID banned in BannedUsers)
4381 { 4431 {
4382 returnblock[j].Parameter = banned.GetBytes(); j++; 4432 returnblock[j].Parameter = banned.GetBytes(); j++;
4433 }
4434 packet.ParamList = returnblock;
4435 packet.Header.Reliable = true;
4436 OutPacket(packet, ThrottleOutPacketType.Task);
4437
4438 BannedUsers.Clear();
4439 }
4383 } 4440 }
4384 packet.ParamList = returnblock; 4441
4385 packet.Header.Reliable = false;
4386 OutPacket(packet, ThrottleOutPacketType.Task);
4387 } 4442 }
4388 4443
4389 public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) 4444 public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
@@ -4552,7 +4607,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4552 4607
4553 if (landData.SimwideArea > 0) 4608 if (landData.SimwideArea > 0)
4554 { 4609 {
4555 int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); 4610 int simulatorCapacity = (int)((double)(landData.SimwideArea * m_scene.RegionInfo.ObjectCapacity) * m_scene.RegionInfo.RegionSettings.ObjectBonus) / 65536;
4611 // Never report more than sim total capacity
4612 if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity)
4613 simulatorCapacity = m_scene.RegionInfo.ObjectCapacity;
4556 updateMessage.SimWideMaxPrims = simulatorCapacity; 4614 updateMessage.SimWideMaxPrims = simulatorCapacity;
4557 } 4615 }
4558 else 4616 else
@@ -4681,14 +4739,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4681 4739
4682 if (notifyCount > 0) 4740 if (notifyCount > 0)
4683 { 4741 {
4684 if (notifyCount > 32) 4742// if (notifyCount > 32)
4685 { 4743// {
4686 m_log.InfoFormat( 4744// m_log.InfoFormat(
4687 "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" 4745// "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}"
4688 + " - a developer might want to investigate whether this is a hard limit", 32); 4746// + " - a developer might want to investigate whether this is a hard limit", 32);
4689 4747//
4690 notifyCount = 32; 4748// notifyCount = 32;
4691 } 4749// }
4692 4750
4693 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock 4751 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock
4694 = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; 4752 = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount];
@@ -5221,6 +5279,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5221 AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); 5279 AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false);
5222 AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); 5280 AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false);
5223 AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); 5281 AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode);
5282 AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments);
5224 AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); 5283 AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false);
5225 AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); 5284 AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents);
5226 AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); 5285 AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery);
@@ -5287,6 +5346,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5287 AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); 5346 AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest);
5288 AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); 5347 AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes);
5289 AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); 5348 AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard);
5349 AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags);
5290 5350
5291 AddGenericPacketHandler("autopilot", HandleAutopilot); 5351 AddGenericPacketHandler("autopilot", HandleAutopilot);
5292 } 5352 }
@@ -5322,6 +5382,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5322 (x.CameraLeftAxis != lastarg.CameraLeftAxis) || 5382 (x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
5323 (x.CameraUpAxis != lastarg.CameraUpAxis) || 5383 (x.CameraUpAxis != lastarg.CameraUpAxis) ||
5324 (x.ControlFlags != lastarg.ControlFlags) || 5384 (x.ControlFlags != lastarg.ControlFlags) ||
5385 (x.ControlFlags != 0) ||
5325 (x.Far != lastarg.Far) || 5386 (x.Far != lastarg.Far) ||
5326 (x.Flags != lastarg.Flags) || 5387 (x.Flags != lastarg.Flags) ||
5327 (x.State != lastarg.State) || 5388 (x.State != lastarg.State) ||
@@ -5699,7 +5760,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5699 args.Channel = ch; 5760 args.Channel = ch;
5700 args.From = String.Empty; 5761 args.From = String.Empty;
5701 args.Message = Utils.BytesToString(msg); 5762 args.Message = Utils.BytesToString(msg);
5702 args.Type = ChatTypeEnum.Shout; 5763 args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance
5703 args.Position = new Vector3(); 5764 args.Position = new Vector3();
5704 args.Scene = Scene; 5765 args.Scene = Scene;
5705 args.Sender = this; 5766 args.Sender = this;
@@ -9711,7 +9772,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9711 handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, 9772 handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID,
9712 Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), 9773 Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName),
9713 UpdateMuteListEntry.MuteData.MuteType, 9774 UpdateMuteListEntry.MuteData.MuteType,
9714 UpdateMuteListEntry.AgentData.AgentID); 9775 UpdateMuteListEntry.MuteData.MuteFlags);
9715 return true; 9776 return true;
9716 } 9777 }
9717 return false; 9778 return false;
@@ -9726,8 +9787,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9726 { 9787 {
9727 handlerRemoveMuteListEntry(this, 9788 handlerRemoveMuteListEntry(this,
9728 RemoveMuteListEntry.MuteData.MuteID, 9789 RemoveMuteListEntry.MuteData.MuteID,
9729 Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName), 9790 Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName));
9730 RemoveMuteListEntry.AgentData.AgentID);
9731 return true; 9791 return true;
9732 } 9792 }
9733 return false; 9793 return false;
@@ -9771,10 +9831,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9771 return false; 9831 return false;
9772 } 9832 }
9773 9833
9834 private bool HandleChangeInventoryItemFlags(IClientAPI client, Packet packet)
9835 {
9836 ChangeInventoryItemFlagsPacket ChangeInventoryItemFlags =
9837 (ChangeInventoryItemFlagsPacket)packet;
9838 ChangeInventoryItemFlags handlerChangeInventoryItemFlags = OnChangeInventoryItemFlags;
9839 if (handlerChangeInventoryItemFlags != null)
9840 {
9841 foreach(ChangeInventoryItemFlagsPacket.InventoryDataBlock b in ChangeInventoryItemFlags.InventoryData)
9842 handlerChangeInventoryItemFlags(this, b.ItemID, b.Flags);
9843 return true;
9844 }
9845 return false;
9846 }
9847
9774 private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) 9848 private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack)
9775 { 9849 {
9776 return true; 9850 return true;
9777 } 9851 }
9852
9853 private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack)
9854 {
9855 CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack;
9856
9857 #region Packet Session and User Check
9858 if (m_checkPackets)
9859 {
9860 if (packet.AgentData.SessionID != SessionId ||
9861 packet.AgentData.AgentID != AgentId)
9862 return true;
9863 }
9864 #endregion
9865 MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null;
9866 List<InventoryItemBase> items = new List<InventoryItemBase>();
9867 foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData)
9868 {
9869 InventoryItemBase b = new InventoryItemBase();
9870 b.ID = n.OldItemID;
9871 b.Folder = n.OldFolderID;
9872 items.Add(b);
9873 }
9874
9875 handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy;
9876 if (handlerMoveItemsAndLeaveCopy != null)
9877 {
9878 handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID);
9879 }
9880
9881 return true;
9882 }
9778 9883
9779 private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) 9884 private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack)
9780 { 9885 {
@@ -10201,6 +10306,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10201 groupProfileReply.GroupData.MaturePublish = d.MaturePublish; 10306 groupProfileReply.GroupData.MaturePublish = d.MaturePublish;
10202 groupProfileReply.GroupData.OwnerRole = d.OwnerRole; 10307 groupProfileReply.GroupData.OwnerRole = d.OwnerRole;
10203 10308
10309 Scene scene = (Scene)m_scene;
10310 if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID)))
10311 {
10312 ScenePresence p;
10313 if (scene.TryGetScenePresence(sender.AgentId, out p))
10314 {
10315 if (p.GodLevel >= 200)
10316 {
10317 groupProfileReply.GroupData.OpenEnrollment = true;
10318 groupProfileReply.GroupData.MembershipFee = 0;
10319 }
10320 }
10321 }
10322
10204 OutPacket(groupProfileReply, ThrottleOutPacketType.Task); 10323 OutPacket(groupProfileReply, ThrottleOutPacketType.Task);
10205 } 10324 }
10206 return true; 10325 return true;
@@ -10774,11 +10893,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10774 10893
10775 StartLure handlerStartLure = OnStartLure; 10894 StartLure handlerStartLure = OnStartLure;
10776 if (handlerStartLure != null) 10895 if (handlerStartLure != null)
10777 handlerStartLure(startLureRequest.Info.LureType, 10896 {
10778 Utils.BytesToString( 10897 for (int i = 0 ; i < startLureRequest.TargetData.Length ; i++)
10779 startLureRequest.Info.Message), 10898 {
10780 startLureRequest.TargetData[0].TargetID, 10899 handlerStartLure(startLureRequest.Info.LureType,
10781 this); 10900 Utils.BytesToString(
10901 startLureRequest.Info.Message),
10902 startLureRequest.TargetData[i].TargetID,
10903 this);
10904 }
10905 }
10782 return true; 10906 return true;
10783 } 10907 }
10784 private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) 10908 private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack)
@@ -10892,10 +11016,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10892 } 11016 }
10893 #endregion 11017 #endregion
10894 11018
10895 ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; 11019 ClassifiedGodDelete handlerClassifiedGodDelete = OnClassifiedGodDelete;
10896 if (handlerClassifiedGodDelete != null) 11020 if (handlerClassifiedGodDelete != null)
10897 handlerClassifiedGodDelete( 11021 handlerClassifiedGodDelete(
10898 classifiedGodDelete.Data.ClassifiedID, 11022 classifiedGodDelete.Data.ClassifiedID,
11023 classifiedGodDelete.Data.QueryID,
10899 this); 11024 this);
10900 return true; 11025 return true;
10901 } 11026 }
@@ -11939,7 +12064,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11939 12064
11940// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); 12065// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
11941 12066
12067
12068 //Note, the bool returned from the below function is useless since it is always false.
11942 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); 12069 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
12070
11943 } 12071 }
11944 12072
11945 /// <summary> 12073 /// <summary>