aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs379
1 files changed, 373 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index d178187..5cf59d8 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4300,6 +4300,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4300 AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest); 4300 AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest);
4301 AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); 4301 AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
4302 AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate); 4302 AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate);
4303 AddLocalPacketHandler(PacketType.ScriptDialogReply, HandlerScriptDialogReply);
4304 AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage);
4305 AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship);
4306 AddLocalPacketHandler(PacketType.DeclineFriendship, HandlerDeclineFriendship);
4307 AddLocalPacketHandler(PacketType.TerminateFriendship, HandlerTerminateFrendship);
4308 AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject);
4309 AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject);
4310 AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand);
4311 AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply);
4312 AddLocalPacketHandler(PacketType.AgentWearablesRequest, HandlerAgentWearablesRequest);
4313 AddLocalPacketHandler(PacketType.AgentSetAppearance, HandlerAgentSetAppearance);
4314 AddLocalPacketHandler(PacketType.AgentIsNowWearing, HandlerAgentIsNowWearing);
4315 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
4316 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
4317 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
4303 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); 4318 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
4304 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); 4319 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
4305 } 4320 }
@@ -4609,6 +4624,356 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4609 return true; 4624 return true;
4610 } 4625 }
4611 4626
4627 private bool HandlerScriptDialogReply(IClientAPI sender, Packet Pack)
4628 {
4629 ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
4630
4631 #region Packet Session and User Check
4632 if (m_checkPackets)
4633 {
4634 if (rdialog.AgentData.SessionID != SessionId ||
4635 rdialog.AgentData.AgentID != AgentId)
4636 return true;
4637 }
4638 #endregion
4639
4640 int ch = rdialog.Data.ChatChannel;
4641 byte[] msg = rdialog.Data.ButtonLabel;
4642 if (OnChatFromClient != null)
4643 {
4644 OSChatMessage args = new OSChatMessage();
4645 args.Channel = ch;
4646 args.From = String.Empty;
4647 args.Message = Utils.BytesToString(msg);
4648 args.Type = ChatTypeEnum.Shout;
4649 args.Position = new Vector3();
4650 args.Scene = Scene;
4651 args.Sender = this;
4652 ChatMessage handlerChatFromClient2 = OnChatFromClient;
4653 if (handlerChatFromClient2 != null)
4654 handlerChatFromClient2(this, args);
4655 }
4656
4657 return true;
4658 }
4659
4660 private bool HandlerImprovedInstantMessage(IClientAPI sender, Packet Pack)
4661 {
4662 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack;
4663
4664 #region Packet Session and User Check
4665 if (m_checkPackets)
4666 {
4667 if (msgpack.AgentData.SessionID != SessionId ||
4668 msgpack.AgentData.AgentID != AgentId)
4669 return true;
4670 }
4671 #endregion
4672
4673 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
4674 string IMmessage = Utils.BytesToString(msgpack.MessageBlock.Message);
4675 ImprovedInstantMessage handlerInstantMessage = OnInstantMessage;
4676
4677 if (handlerInstantMessage != null)
4678 {
4679 GridInstantMessage im = new GridInstantMessage(Scene,
4680 msgpack.AgentData.AgentID,
4681 IMfromName,
4682 msgpack.MessageBlock.ToAgentID,
4683 msgpack.MessageBlock.Dialog,
4684 msgpack.MessageBlock.FromGroup,
4685 IMmessage,
4686 msgpack.MessageBlock.ID,
4687 msgpack.MessageBlock.Offline != 0 ? true : false,
4688 msgpack.MessageBlock.Position,
4689 msgpack.MessageBlock.BinaryBucket);
4690
4691 handlerInstantMessage(this, im);
4692 }
4693 return true;
4694
4695 }
4696
4697 private bool HandlerAcceptFriendship(IClientAPI sender, Packet Pack)
4698 {
4699 AcceptFriendshipPacket afriendpack = (AcceptFriendshipPacket)Pack;
4700
4701 #region Packet Session and User Check
4702 if (m_checkPackets)
4703 {
4704 if (afriendpack.AgentData.SessionID != SessionId ||
4705 afriendpack.AgentData.AgentID != AgentId)
4706 return true;
4707 }
4708 #endregion
4709
4710 // My guess is this is the folder to stick the calling card into
4711 List<UUID> callingCardFolders = new List<UUID>();
4712
4713 UUID agentID = afriendpack.AgentData.AgentID;
4714 UUID transactionID = afriendpack.TransactionBlock.TransactionID;
4715
4716 for (int fi = 0; fi < afriendpack.FolderData.Length; fi++)
4717 {
4718 callingCardFolders.Add(afriendpack.FolderData[fi].FolderID);
4719 }
4720
4721 FriendActionDelegate handlerApproveFriendRequest = OnApproveFriendRequest;
4722 if (handlerApproveFriendRequest != null)
4723 {
4724 handlerApproveFriendRequest(this, agentID, transactionID, callingCardFolders);
4725 }
4726 return true;
4727
4728 }
4729
4730 private bool HandlerDeclineFriendship(IClientAPI sender, Packet Pack)
4731 {
4732 DeclineFriendshipPacket dfriendpack = (DeclineFriendshipPacket)Pack;
4733
4734 #region Packet Session and User Check
4735 if (m_checkPackets)
4736 {
4737 if (dfriendpack.AgentData.SessionID != SessionId ||
4738 dfriendpack.AgentData.AgentID != AgentId)
4739 return true;
4740 }
4741 #endregion
4742
4743 if (OnDenyFriendRequest != null)
4744 {
4745 OnDenyFriendRequest(this,
4746 dfriendpack.AgentData.AgentID,
4747 dfriendpack.TransactionBlock.TransactionID,
4748 null);
4749 }
4750 return true;
4751 }
4752
4753 private bool HandlerTerminateFrendship(IClientAPI sender, Packet Pack)
4754 {
4755 TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack;
4756
4757 #region Packet Session and User Check
4758 if (m_checkPackets)
4759 {
4760 if (tfriendpack.AgentData.SessionID != SessionId ||
4761 tfriendpack.AgentData.AgentID != AgentId)
4762 return true;
4763 }
4764 #endregion
4765
4766 UUID listOwnerAgentID = tfriendpack.AgentData.AgentID;
4767 UUID exFriendID = tfriendpack.ExBlock.OtherID;
4768
4769 FriendshipTermination handlerTerminateFriendship = OnTerminateFriendship;
4770 if (handlerTerminateFriendship != null)
4771 {
4772 handlerTerminateFriendship(this, listOwnerAgentID, exFriendID);
4773 }
4774 return true;
4775 }
4776
4777 private bool HandlerRezObject(IClientAPI sender, Packet Pack)
4778 {
4779 RezObjectPacket rezPacket = (RezObjectPacket)Pack;
4780
4781 #region Packet Session and User Check
4782 if (m_checkPackets)
4783 {
4784 if (rezPacket.AgentData.SessionID != SessionId ||
4785 rezPacket.AgentData.AgentID != AgentId)
4786 return true;
4787 }
4788 #endregion
4789
4790 RezObject handlerRezObject = OnRezObject;
4791 if (handlerRezObject != null)
4792 {
4793 handlerRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd,
4794 rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID,
4795 rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection,
4796 rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem,
4797 rezPacket.RezData.FromTaskID);
4798 }
4799 return true;
4800 }
4801
4802 private bool HandlerDeRezObject(IClientAPI sender, Packet Pack)
4803 {
4804 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)Pack;
4805
4806 #region Packet Session and User Check
4807 if (m_checkPackets)
4808 {
4809 if (DeRezPacket.AgentData.SessionID != SessionId ||
4810 DeRezPacket.AgentData.AgentID != AgentId)
4811 return true;
4812 }
4813 #endregion
4814
4815 DeRezObject handlerDeRezObject = OnDeRezObject;
4816 if (handlerDeRezObject != null)
4817 {
4818 List<uint> deRezIDs = new List<uint>();
4819
4820 foreach (DeRezObjectPacket.ObjectDataBlock data in
4821 DeRezPacket.ObjectData)
4822 {
4823 deRezIDs.Add(data.ObjectLocalID);
4824 }
4825 // It just so happens that the values on the DeRezAction enumerator match the Destination
4826 // values given by a Second Life client
4827 handlerDeRezObject(this, deRezIDs,
4828 DeRezPacket.AgentBlock.GroupID,
4829 (DeRezAction)DeRezPacket.AgentBlock.Destination,
4830 DeRezPacket.AgentBlock.DestinationID);
4831
4832 }
4833 return true;
4834 }
4835
4836 private bool HandlerModifyLand(IClientAPI sender, Packet Pack)
4837 {
4838 ModifyLandPacket modify = (ModifyLandPacket)Pack;
4839
4840 #region Packet Session and User Check
4841 if (m_checkPackets)
4842 {
4843 if (modify.AgentData.SessionID != SessionId ||
4844 modify.AgentData.AgentID != AgentId)
4845 return true;
4846 }
4847
4848 #endregion
4849 //m_log.Info("[LAND]: LAND:" + modify.ToString());
4850 if (modify.ParcelData.Length > 0)
4851 {
4852 if (OnModifyTerrain != null)
4853 {
4854 for (int i = 0; i < modify.ParcelData.Length; i++)
4855 {
4856 ModifyTerrain handlerModifyTerrain = OnModifyTerrain;
4857 if (handlerModifyTerrain != null)
4858 {
4859 handlerModifyTerrain(AgentId, modify.ModifyBlock.Height, modify.ModifyBlock.Seconds,
4860 modify.ModifyBlock.BrushSize,
4861 modify.ModifyBlock.Action, modify.ParcelData[i].North,
4862 modify.ParcelData[i].West, modify.ParcelData[i].South,
4863 modify.ParcelData[i].East, AgentId);
4864 }
4865 }
4866 }
4867 }
4868
4869 return true;
4870 }
4871
4872 private bool HandlerRegionHandshakeReply(IClientAPI sender, Packet Pack)
4873 {
4874 Action<IClientAPI> handlerRegionHandShakeReply = OnRegionHandShakeReply;
4875 if (handlerRegionHandShakeReply != null)
4876 {
4877 handlerRegionHandShakeReply(this);
4878 }
4879
4880 return true;
4881 }
4882
4883 private bool HandlerAgentWearablesRequest(IClientAPI sender, Packet Pack)
4884 {
4885 GenericCall2 handlerRequestWearables = OnRequestWearables;
4886
4887 if (handlerRequestWearables != null)
4888 {
4889 handlerRequestWearables();
4890 }
4891
4892 Action<IClientAPI> handlerRequestAvatarsData = OnRequestAvatarsData;
4893
4894 if (handlerRequestAvatarsData != null)
4895 {
4896 handlerRequestAvatarsData(this);
4897 }
4898
4899 return true;
4900 }
4901
4902 private bool HandlerAgentSetAppearance(IClientAPI sender, Packet Pack)
4903 {
4904 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
4905
4906 #region Packet Session and User Check
4907 if (m_checkPackets)
4908 {
4909 if (appear.AgentData.SessionID != SessionId ||
4910 appear.AgentData.AgentID != AgentId)
4911 return true;
4912 }
4913 #endregion
4914
4915 SetAppearance handlerSetAppearance = OnSetAppearance;
4916 if (handlerSetAppearance != null)
4917 {
4918 // Temporarily protect ourselves from the mantis #951 failure.
4919 // However, we could do this for several other handlers where a failure isn't terminal
4920 // for the client session anyway, in order to protect ourselves against bad code in plugins
4921 try
4922 {
4923 byte[] visualparams = new byte[appear.VisualParam.Length];
4924 for (int i = 0; i < appear.VisualParam.Length; i++)
4925 visualparams[i] = appear.VisualParam[i].ParamValue;
4926
4927 Primitive.TextureEntry te = null;
4928 if (appear.ObjectData.TextureEntry.Length > 1)
4929 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length);
4930
4931 handlerSetAppearance(te, visualparams);
4932 }
4933 catch (Exception e)
4934 {
4935 m_log.ErrorFormat(
4936 "[CLIENT VIEW]: AgentSetApperance packet handler threw an exception, {0}",
4937 e);
4938 }
4939 }
4940
4941 return true;
4942 }
4943
4944 private bool HandlerAgentIsNowWearing(IClientAPI sender, Packet Pack)
4945 {
4946 if (OnAvatarNowWearing != null)
4947 {
4948 AgentIsNowWearingPacket nowWearing = (AgentIsNowWearingPacket)Pack;
4949
4950 #region Packet Session and User Check
4951 if (m_checkPackets)
4952 {
4953 if (nowWearing.AgentData.SessionID != SessionId ||
4954 nowWearing.AgentData.AgentID != AgentId)
4955 return true;
4956 }
4957 #endregion
4958
4959 AvatarWearingArgs wearingArgs = new AvatarWearingArgs();
4960 for (int i = 0; i < nowWearing.WearableData.Length; i++)
4961 {
4962 AvatarWearingArgs.Wearable wearable =
4963 new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID,
4964 nowWearing.WearableData[i].WearableType);
4965 wearingArgs.NowWearing.Add(wearable);
4966 }
4967
4968 AvatarNowWearing handlerAvatarNowWearing = OnAvatarNowWearing;
4969 if (handlerAvatarNowWearing != null)
4970 {
4971 handlerAvatarNowWearing(this, wearingArgs);
4972 }
4973 }
4974 return true;
4975 }
4976
4612 #endregion Packet Handlers 4977 #endregion Packet Handlers
4613 4978
4614 public void SendScriptQuestion(UUID taskID, string taskName, string ownerName, UUID itemID, int question) 4979 public void SendScriptQuestion(UUID taskID, string taskName, string ownerName, UUID itemID, int question)
@@ -5106,6 +5471,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5106 switch (Pack.Type) 5471 switch (Pack.Type)
5107 { 5472 {
5108 #region Scene/Avatar 5473 #region Scene/Avatar
5474 #region CommentedOut
5109 /* 5475 /*
5110 case PacketType.AvatarPropertiesRequest: 5476 case PacketType.AvatarPropertiesRequest:
5111 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; 5477 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
@@ -5193,7 +5559,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5193 handlerUpdateAvatarProperties(this, UserProfile); 5559 handlerUpdateAvatarProperties(this, UserProfile);
5194 } 5560 }
5195 break; 5561 break;
5196 */ 5562
5197 case PacketType.ScriptDialogReply: 5563 case PacketType.ScriptDialogReply:
5198 ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; 5564 ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
5199 5565
@@ -5224,7 +5590,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5224 } 5590 }
5225 5591
5226 break; 5592 break;
5227 5593
5228 case PacketType.ImprovedInstantMessage: 5594 case PacketType.ImprovedInstantMessage:
5229 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; 5595 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack;
5230 5596
@@ -5258,7 +5624,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5258 handlerInstantMessage(this, im); 5624 handlerInstantMessage(this, im);
5259 } 5625 }
5260 break; 5626 break;
5261 5627
5262 case PacketType.AcceptFriendship: 5628 case PacketType.AcceptFriendship:
5263 AcceptFriendshipPacket afriendpack = (AcceptFriendshipPacket)Pack; 5629 AcceptFriendshipPacket afriendpack = (AcceptFriendshipPacket)Pack;
5264 5630
@@ -5331,7 +5697,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5331 handlerTerminateFriendship(this, listOwnerAgentID, exFriendID); 5697 handlerTerminateFriendship(this, listOwnerAgentID, exFriendID);
5332 } 5698 }
5333 break; 5699 break;
5334 5700
5335 case PacketType.RezObject: 5701 case PacketType.RezObject:
5336 RezObjectPacket rezPacket = (RezObjectPacket)Pack; 5702 RezObjectPacket rezPacket = (RezObjectPacket)Pack;
5337 5703
@@ -5386,7 +5752,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5386 5752
5387 } 5753 }
5388 break; 5754 break;
5389 5755
5390 case PacketType.ModifyLand: 5756 case PacketType.ModifyLand:
5391 ModifyLandPacket modify = (ModifyLandPacket)Pack; 5757 ModifyLandPacket modify = (ModifyLandPacket)Pack;
5392 5758
@@ -5518,7 +5884,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5518 } 5884 }
5519 } 5885 }
5520 break; 5886 break;
5521 5887*/
5888 #endregion
5522 case PacketType.RezSingleAttachmentFromInv: 5889 case PacketType.RezSingleAttachmentFromInv:
5523 RezSingleAttachmentFromInv handlerRezSingleAttachment = OnRezSingleAttachmentFromInv; 5890 RezSingleAttachmentFromInv handlerRezSingleAttachment = OnRezSingleAttachmentFromInv;
5524 if (handlerRezSingleAttachment != null) 5891 if (handlerRezSingleAttachment != null)