diff options
author | Teravus Ovares (Dan Olivares) | 2009-11-21 21:58:11 -0500 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-11-21 21:58:11 -0500 |
commit | 079691b98f0a2d42087a99742a44705cf34071d5 (patch) | |
tree | be77daf9e34fd08fd2c42fc0b81041a509e3f9cd /OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |
parent | * This fixes landing on Prim and removes the hack from yesterday. Landing ... (diff) | |
download | opensim-SC-079691b98f0a2d42087a99742a44705cf34071d5.zip opensim-SC-079691b98f0a2d42087a99742a44705cf34071d5.tar.gz opensim-SC-079691b98f0a2d42087a99742a44705cf34071d5.tar.bz2 opensim-SC-079691b98f0a2d42087a99742a44705cf34071d5.tar.xz |
* Move a few of the ProcessInPacket switch case blocks into packet handler delegates
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 109 |
1 files changed, 103 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 9570769..ab4b7a0 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -350,7 +350,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
350 | 350 | ||
351 | protected IAssetService m_assetService; | 351 | protected IAssetService m_assetService; |
352 | private IHyperAssetService m_hyperAssets; | 352 | private IHyperAssetService m_hyperAssets; |
353 | 353 | private const bool m_checkPackets = true; | |
354 | 354 | ||
355 | #endregion Class Members | 355 | #endregion Class Members |
356 | 356 | ||
@@ -4297,6 +4297,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4297 | AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest); | 4297 | AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest); |
4298 | AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest); | 4298 | AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest); |
4299 | AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage); | 4299 | AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage); |
4300 | AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest); | ||
4301 | AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); | ||
4302 | AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate); | ||
4303 | AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); | ||
4304 | AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); | ||
4300 | } | 4305 | } |
4301 | 4306 | ||
4302 | #region Packet Handlers | 4307 | #region Packet Handlers |
@@ -4512,6 +4517,98 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4512 | return true; | 4517 | return true; |
4513 | } | 4518 | } |
4514 | 4519 | ||
4520 | private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack) | ||
4521 | { | ||
4522 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; | ||
4523 | |||
4524 | #region Packet Session and User Check | ||
4525 | if (m_checkPackets) | ||
4526 | { | ||
4527 | if (avatarProperties.AgentData.SessionID != SessionId || | ||
4528 | avatarProperties.AgentData.AgentID != AgentId) | ||
4529 | return true; | ||
4530 | } | ||
4531 | #endregion | ||
4532 | |||
4533 | RequestAvatarProperties handlerRequestAvatarProperties = OnRequestAvatarProperties; | ||
4534 | if (handlerRequestAvatarProperties != null) | ||
4535 | { | ||
4536 | handlerRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID); | ||
4537 | } | ||
4538 | return true; | ||
4539 | } | ||
4540 | |||
4541 | private bool HandleChatFromViewer(IClientAPI sender, Packet Pack) | ||
4542 | { | ||
4543 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; | ||
4544 | |||
4545 | #region Packet Session and User Check | ||
4546 | if (m_checkPackets) | ||
4547 | { | ||
4548 | if (inchatpack.AgentData.SessionID != SessionId || | ||
4549 | inchatpack.AgentData.AgentID != AgentId) | ||
4550 | return true; | ||
4551 | } | ||
4552 | #endregion | ||
4553 | |||
4554 | string fromName = String.Empty; //ClientAvatar.firstname + " " + ClientAvatar.lastname; | ||
4555 | byte[] message = inchatpack.ChatData.Message; | ||
4556 | byte type = inchatpack.ChatData.Type; | ||
4557 | Vector3 fromPos = new Vector3(); // ClientAvatar.Pos; | ||
4558 | // UUID fromAgentID = AgentId; | ||
4559 | |||
4560 | int channel = inchatpack.ChatData.Channel; | ||
4561 | |||
4562 | if (OnChatFromClient != null) | ||
4563 | { | ||
4564 | OSChatMessage args = new OSChatMessage(); | ||
4565 | args.Channel = channel; | ||
4566 | args.From = fromName; | ||
4567 | args.Message = Utils.BytesToString(message); | ||
4568 | args.Type = (ChatTypeEnum)type; | ||
4569 | args.Position = fromPos; | ||
4570 | |||
4571 | args.Scene = Scene; | ||
4572 | args.Sender = this; | ||
4573 | args.SenderUUID = this.AgentId; | ||
4574 | |||
4575 | ChatMessage handlerChatFromClient = OnChatFromClient; | ||
4576 | if (handlerChatFromClient != null) | ||
4577 | handlerChatFromClient(this, args); | ||
4578 | } | ||
4579 | return true; | ||
4580 | } | ||
4581 | |||
4582 | private bool HandlerAvatarPropertiesUpdate(IClientAPI sender, Packet Pack) | ||
4583 | { | ||
4584 | AvatarPropertiesUpdatePacket avatarProps = (AvatarPropertiesUpdatePacket)Pack; | ||
4585 | |||
4586 | #region Packet Session and User Check | ||
4587 | if (m_checkPackets) | ||
4588 | { | ||
4589 | if (avatarProps.AgentData.SessionID != SessionId || | ||
4590 | avatarProps.AgentData.AgentID != AgentId) | ||
4591 | return true; | ||
4592 | } | ||
4593 | #endregion | ||
4594 | |||
4595 | UpdateAvatarProperties handlerUpdateAvatarProperties = OnUpdateAvatarProperties; | ||
4596 | if (handlerUpdateAvatarProperties != null) | ||
4597 | { | ||
4598 | AvatarPropertiesUpdatePacket.PropertiesDataBlock Properties = avatarProps.PropertiesData; | ||
4599 | UserProfileData UserProfile = new UserProfileData(); | ||
4600 | UserProfile.ID = AgentId; | ||
4601 | UserProfile.AboutText = Utils.BytesToString(Properties.AboutText); | ||
4602 | UserProfile.FirstLifeAboutText = Utils.BytesToString(Properties.FLAboutText); | ||
4603 | UserProfile.FirstLifeImage = Properties.FLImageID; | ||
4604 | UserProfile.Image = Properties.ImageID; | ||
4605 | UserProfile.ProfileUrl = Utils.BytesToString(Properties.ProfileURL); | ||
4606 | |||
4607 | handlerUpdateAvatarProperties(this, UserProfile); | ||
4608 | } | ||
4609 | return true; | ||
4610 | } | ||
4611 | |||
4515 | #endregion Packet Handlers | 4612 | #endregion Packet Handlers |
4516 | 4613 | ||
4517 | public void SendScriptQuestion(UUID taskID, string taskName, string ownerName, UUID itemID, int question) | 4614 | public void SendScriptQuestion(UUID taskID, string taskName, string ownerName, UUID itemID, int question) |
@@ -5003,13 +5100,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5003 | return; | 5100 | return; |
5004 | } | 5101 | } |
5005 | 5102 | ||
5006 | const bool m_checkPackets = true; | 5103 | |
5007 | 5104 | ||
5008 | // Main packet processing conditional | 5105 | // Main packet processing conditional |
5009 | switch (Pack.Type) | 5106 | switch (Pack.Type) |
5010 | { | 5107 | { |
5011 | #region Scene/Avatar | 5108 | #region Scene/Avatar |
5012 | 5109 | /* | |
5013 | case PacketType.AvatarPropertiesRequest: | 5110 | case PacketType.AvatarPropertiesRequest: |
5014 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; | 5111 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; |
5015 | 5112 | ||
@@ -5029,7 +5126,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5029 | } | 5126 | } |
5030 | 5127 | ||
5031 | break; | 5128 | break; |
5032 | 5129 | ||
5033 | case PacketType.ChatFromViewer: | 5130 | case PacketType.ChatFromViewer: |
5034 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; | 5131 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; |
5035 | 5132 | ||
@@ -5068,7 +5165,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5068 | handlerChatFromClient(this, args); | 5165 | handlerChatFromClient(this, args); |
5069 | } | 5166 | } |
5070 | break; | 5167 | break; |
5071 | 5168 | ||
5072 | case PacketType.AvatarPropertiesUpdate: | 5169 | case PacketType.AvatarPropertiesUpdate: |
5073 | AvatarPropertiesUpdatePacket avatarProps = (AvatarPropertiesUpdatePacket)Pack; | 5170 | AvatarPropertiesUpdatePacket avatarProps = (AvatarPropertiesUpdatePacket)Pack; |
5074 | 5171 | ||
@@ -5096,7 +5193,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5096 | handlerUpdateAvatarProperties(this, UserProfile); | 5193 | handlerUpdateAvatarProperties(this, UserProfile); |
5097 | } | 5194 | } |
5098 | break; | 5195 | break; |
5099 | 5196 | */ | |
5100 | case PacketType.ScriptDialogReply: | 5197 | case PacketType.ScriptDialogReply: |
5101 | ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; | 5198 | ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; |
5102 | 5199 | ||