aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-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 c515ded..c914d81 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4283,6 +4283,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4283 AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest); 4283 AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest);
4284 AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); 4284 AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
4285 AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate); 4285 AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate);
4286 AddLocalPacketHandler(PacketType.ScriptDialogReply, HandlerScriptDialogReply);
4287 AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage);
4288 AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship);
4289 AddLocalPacketHandler(PacketType.DeclineFriendship, HandlerDeclineFriendship);
4290 AddLocalPacketHandler(PacketType.TerminateFriendship, HandlerTerminateFrendship);
4291 AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject);
4292 AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject);
4293 AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand);
4294 AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply);
4295 AddLocalPacketHandler(PacketType.AgentWearablesRequest, HandlerAgentWearablesRequest);
4296 AddLocalPacketHandler(PacketType.AgentSetAppearance, HandlerAgentSetAppearance);
4297 AddLocalPacketHandler(PacketType.AgentIsNowWearing, HandlerAgentIsNowWearing);
4298 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
4299 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
4300 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
4286 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); 4301 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
4287 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); 4302 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
4288 } 4303 }
@@ -4592,6 +4607,356 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4592 return true; 4607 return true;
4593 } 4608 }
4594 4609
4610 private bool HandlerScriptDialogReply(IClientAPI sender, Packet Pack)
4611 {
4612 ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
4613
4614 #region Packet Session and User Check
4615 if (m_checkPackets)
4616 {
4617 if (rdialog.AgentData.SessionID != SessionId ||
4618 rdialog.AgentData.AgentID != AgentId)
4619 return true;
4620 }
4621 #endregion
4622
4623 int ch = rdialog.Data.ChatChannel;
4624 byte[] msg = rdialog.Data.ButtonLabel;
4625 if (OnChatFromClient != null)
4626 {
4627 OSChatMessage args = new OSChatMessage();
4628 args.Channel = ch;
4629 args.From = String.Empty;
4630 args.Message = Utils.BytesToString(msg);
4631 args.Type = ChatTypeEnum.Shout;
4632 args.Position = new Vector3();
4633 args.Scene = Scene;
4634 args.Sender = this;
4635 ChatMessage handlerChatFromClient2 = OnChatFromClient;
4636 if (handlerChatFromClient2 != null)
4637 handlerChatFromClient2(this, args);
4638 }
4639
4640 return true;
4641 }
4642
4643 private bool HandlerImprovedInstantMessage(IClientAPI sender, Packet Pack)
4644 {
4645 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack;
4646
4647 #region Packet Session and User Check
4648 if (m_checkPackets)
4649 {
4650 if (msgpack.AgentData.SessionID != SessionId ||
4651 msgpack.AgentData.AgentID != AgentId)
4652 return true;
4653 }
4654 #endregion
4655
4656 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
4657 string IMmessage = Utils.BytesToString(msgpack.MessageBlock.Message);
4658 ImprovedInstantMessage handlerInstantMessage = OnInstantMessage;
4659
4660 if (handlerInstantMessage != null)
4661 {
4662 GridInstantMessage im = new GridInstantMessage(Scene,
4663 msgpack.AgentData.AgentID,
4664 IMfromName,
4665 msgpack.MessageBlock.ToAgentID,
4666 msgpack.MessageBlock.Dialog,
4667 msgpack.MessageBlock.FromGroup,
4668 IMmessage,
4669 msgpack.MessageBlock.ID,
4670 msgpack.MessageBlock.Offline != 0 ? true : false,
4671 msgpack.MessageBlock.Position,
4672 msgpack.MessageBlock.BinaryBucket);
4673
4674 handlerInstantMessage(this, im);
4675 }
4676 return true;
4677
4678 }
4679
4680 private bool HandlerAcceptFriendship(IClientAPI sender, Packet Pack)
4681 {
4682 AcceptFriendshipPacket afriendpack = (AcceptFriendshipPacket)Pack;
4683
4684 #region Packet Session and User Check
4685 if (m_checkPackets)
4686 {
4687 if (afriendpack.AgentData.SessionID != SessionId ||
4688 afriendpack.AgentData.AgentID != AgentId)
4689 return true;
4690 }
4691 #endregion
4692
4693 // My guess is this is the folder to stick the calling card into
4694 List<UUID> callingCardFolders = new List<UUID>();
4695
4696 UUID agentID = afriendpack.AgentData.AgentID;
4697 UUID transactionID = afriendpack.TransactionBlock.TransactionID;
4698
4699 for (int fi = 0; fi < afriendpack.FolderData.Length; fi++)
4700 {
4701 callingCardFolders.Add(afriendpack.FolderData[fi].FolderID);
4702 }
4703
4704 FriendActionDelegate handlerApproveFriendRequest = OnApproveFriendRequest;
4705 if (handlerApproveFriendRequest != null)
4706 {
4707 handlerApproveFriendRequest(this, agentID, transactionID, callingCardFolders);
4708 }
4709 return true;
4710
4711 }
4712
4713 private bool HandlerDeclineFriendship(IClientAPI sender, Packet Pack)
4714 {
4715 DeclineFriendshipPacket dfriendpack = (DeclineFriendshipPacket)Pack;
4716
4717 #region Packet Session and User Check
4718 if (m_checkPackets)
4719 {
4720 if (dfriendpack.AgentData.SessionID != SessionId ||
4721 dfriendpack.AgentData.AgentID != AgentId)
4722 return true;
4723 }
4724 #endregion
4725
4726 if (OnDenyFriendRequest != null)
4727 {
4728 OnDenyFriendRequest(this,
4729 dfriendpack.AgentData.AgentID,
4730 dfriendpack.TransactionBlock.TransactionID,
4731 null);
4732 }
4733 return true;
4734 }
4735
4736 private bool HandlerTerminateFrendship(IClientAPI sender, Packet Pack)
4737 {
4738 TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack;
4739
4740 #region Packet Session and User Check
4741 if (m_checkPackets)
4742 {
4743 if (tfriendpack.AgentData.SessionID != SessionId ||
4744 tfriendpack.AgentData.AgentID != AgentId)
4745 return true;
4746 }
4747 #endregion
4748
4749 UUID listOwnerAgentID = tfriendpack.AgentData.AgentID;
4750 UUID exFriendID = tfriendpack.ExBlock.OtherID;
4751
4752 FriendshipTermination handlerTerminateFriendship = OnTerminateFriendship;
4753 if (handlerTerminateFriendship != null)
4754 {
4755 handlerTerminateFriendship(this, listOwnerAgentID, exFriendID);
4756 }
4757 return true;
4758 }
4759
4760 private bool HandlerRezObject(IClientAPI sender, Packet Pack)
4761 {
4762 RezObjectPacket rezPacket = (RezObjectPacket)Pack;
4763
4764 #region Packet Session and User Check
4765 if (m_checkPackets)
4766 {
4767 if (rezPacket.AgentData.SessionID != SessionId ||
4768 rezPacket.AgentData.AgentID != AgentId)
4769 return true;
4770 }
4771 #endregion
4772
4773 RezObject handlerRezObject = OnRezObject;
4774 if (handlerRezObject != null)
4775 {
4776 handlerRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd,
4777 rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID,
4778 rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection,
4779 rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem,
4780 rezPacket.RezData.FromTaskID);
4781 }
4782 return true;
4783 }
4784
4785 private bool HandlerDeRezObject(IClientAPI sender, Packet Pack)
4786 {
4787 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)Pack;
4788
4789 #region Packet Session and User Check
4790 if (m_checkPackets)
4791 {
4792 if (DeRezPacket.AgentData.SessionID != SessionId ||
4793 DeRezPacket.AgentData.AgentID != AgentId)
4794 return true;
4795 }
4796 #endregion
4797
4798 DeRezObject handlerDeRezObject = OnDeRezObject;
4799 if (handlerDeRezObject != null)
4800 {
4801 List<uint> deRezIDs = new List<uint>();
4802
4803 foreach (DeRezObjectPacket.ObjectDataBlock data in
4804 DeRezPacket.ObjectData)
4805 {
4806 deRezIDs.Add(data.ObjectLocalID);
4807 }
4808 // It just so happens that the values on the DeRezAction enumerator match the Destination
4809 // values given by a Second Life client
4810 handlerDeRezObject(this, deRezIDs,
4811 DeRezPacket.AgentBlock.GroupID,
4812 (DeRezAction)DeRezPacket.AgentBlock.Destination,
4813 DeRezPacket.AgentBlock.DestinationID);
4814
4815 }
4816 return true;
4817 }
4818
4819 private bool HandlerModifyLand(IClientAPI sender, Packet Pack)
4820 {
4821 ModifyLandPacket modify = (ModifyLandPacket)Pack;
4822
4823 #region Packet Session and User Check
4824 if (m_checkPackets)
4825 {
4826 if (modify.AgentData.SessionID != SessionId ||
4827 modify.AgentData.AgentID != AgentId)
4828 return true;
4829 }
4830
4831 #endregion
4832 //m_log.Info("[LAND]: LAND:" + modify.ToString());
4833 if (modify.ParcelData.Length > 0)
4834 {
4835 if (OnModifyTerrain != null)
4836 {
4837 for (int i = 0; i < modify.ParcelData.Length; i++)
4838 {
4839 ModifyTerrain handlerModifyTerrain = OnModifyTerrain;
4840 if (handlerModifyTerrain != null)
4841 {
4842 handlerModifyTerrain(AgentId, modify.ModifyBlock.Height, modify.ModifyBlock.Seconds,
4843 modify.ModifyBlock.BrushSize,
4844 modify.ModifyBlock.Action, modify.ParcelData[i].North,
4845 modify.ParcelData[i].West, modify.ParcelData[i].South,
4846 modify.ParcelData[i].East, AgentId);
4847 }
4848 }
4849 }
4850 }
4851
4852 return true;
4853 }
4854
4855 private bool HandlerRegionHandshakeReply(IClientAPI sender, Packet Pack)
4856 {
4857 Action<IClientAPI> handlerRegionHandShakeReply = OnRegionHandShakeReply;
4858 if (handlerRegionHandShakeReply != null)
4859 {
4860 handlerRegionHandShakeReply(this);
4861 }
4862
4863 return true;
4864 }
4865
4866 private bool HandlerAgentWearablesRequest(IClientAPI sender, Packet Pack)
4867 {
4868 GenericCall2 handlerRequestWearables = OnRequestWearables;
4869
4870 if (handlerRequestWearables != null)
4871 {
4872 handlerRequestWearables();
4873 }
4874
4875 Action<IClientAPI> handlerRequestAvatarsData = OnRequestAvatarsData;
4876
4877 if (handlerRequestAvatarsData != null)
4878 {
4879 handlerRequestAvatarsData(this);
4880 }
4881
4882 return true;
4883 }
4884
4885 private bool HandlerAgentSetAppearance(IClientAPI sender, Packet Pack)
4886 {
4887 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
4888
4889 #region Packet Session and User Check
4890 if (m_checkPackets)
4891 {
4892 if (appear.AgentData.SessionID != SessionId ||
4893 appear.AgentData.AgentID != AgentId)
4894 return true;
4895 }
4896 #endregion
4897
4898 SetAppearance handlerSetAppearance = OnSetAppearance;
4899 if (handlerSetAppearance != null)
4900 {
4901 // Temporarily protect ourselves from the mantis #951 failure.
4902 // However, we could do this for several other handlers where a failure isn't terminal
4903 // for the client session anyway, in order to protect ourselves against bad code in plugins
4904 try
4905 {
4906 byte[] visualparams = new byte[appear.VisualParam.Length];
4907 for (int i = 0; i < appear.VisualParam.Length; i++)
4908 visualparams[i] = appear.VisualParam[i].ParamValue;
4909
4910 Primitive.TextureEntry te = null;
4911 if (appear.ObjectData.TextureEntry.Length > 1)
4912 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length);
4913
4914 handlerSetAppearance(te, visualparams);
4915 }
4916 catch (Exception e)
4917 {
4918 m_log.ErrorFormat(
4919 "[CLIENT VIEW]: AgentSetApperance packet handler threw an exception, {0}",
4920 e);
4921 }
4922 }
4923
4924 return true;
4925 }
4926
4927 private bool HandlerAgentIsNowWearing(IClientAPI sender, Packet Pack)
4928 {
4929 if (OnAvatarNowWearing != null)
4930 {
4931 AgentIsNowWearingPacket nowWearing = (AgentIsNowWearingPacket)Pack;
4932
4933 #region Packet Session and User Check
4934 if (m_checkPackets)
4935 {
4936 if (nowWearing.AgentData.SessionID != SessionId ||
4937 nowWearing.AgentData.AgentID != AgentId)
4938 return true;
4939 }
4940 #endregion
4941
4942 AvatarWearingArgs wearingArgs = new AvatarWearingArgs();
4943 for (int i = 0; i < nowWearing.WearableData.Length; i++)
4944 {
4945 AvatarWearingArgs.Wearable wearable =
4946 new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID,
4947 nowWearing.WearableData[i].WearableType);
4948 wearingArgs.NowWearing.Add(wearable);
4949 }
4950
4951 AvatarNowWearing handlerAvatarNowWearing = OnAvatarNowWearing;
4952 if (handlerAvatarNowWearing != null)
4953 {
4954 handlerAvatarNowWearing(this, wearingArgs);
4955 }
4956 }
4957 return true;
4958 }
4959
4595 #endregion Packet Handlers 4960 #endregion Packet Handlers
4596 4961
4597 public void SendScriptQuestion(UUID taskID, string taskName, string ownerName, UUID itemID, int question) 4962 public void SendScriptQuestion(UUID taskID, string taskName, string ownerName, UUID itemID, int question)
@@ -5089,6 +5454,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5089 switch (Pack.Type) 5454 switch (Pack.Type)
5090 { 5455 {
5091 #region Scene/Avatar 5456 #region Scene/Avatar
5457 #region CommentedOut
5092 /* 5458 /*
5093 case PacketType.AvatarPropertiesRequest: 5459 case PacketType.AvatarPropertiesRequest:
5094 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; 5460 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
@@ -5176,7 +5542,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5176 handlerUpdateAvatarProperties(this, UserProfile); 5542 handlerUpdateAvatarProperties(this, UserProfile);
5177 } 5543 }
5178 break; 5544 break;
5179 */ 5545
5180 case PacketType.ScriptDialogReply: 5546 case PacketType.ScriptDialogReply:
5181 ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; 5547 ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
5182 5548
@@ -5207,7 +5573,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5207 } 5573 }
5208 5574
5209 break; 5575 break;
5210 5576
5211 case PacketType.ImprovedInstantMessage: 5577 case PacketType.ImprovedInstantMessage:
5212 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; 5578 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack;
5213 5579
@@ -5241,7 +5607,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5241 handlerInstantMessage(this, im); 5607 handlerInstantMessage(this, im);
5242 } 5608 }
5243 break; 5609 break;
5244 5610
5245 case PacketType.AcceptFriendship: 5611 case PacketType.AcceptFriendship:
5246 AcceptFriendshipPacket afriendpack = (AcceptFriendshipPacket)Pack; 5612 AcceptFriendshipPacket afriendpack = (AcceptFriendshipPacket)Pack;
5247 5613
@@ -5314,7 +5680,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5314 handlerTerminateFriendship(this, listOwnerAgentID, exFriendID); 5680 handlerTerminateFriendship(this, listOwnerAgentID, exFriendID);
5315 } 5681 }
5316 break; 5682 break;
5317 5683
5318 case PacketType.RezObject: 5684 case PacketType.RezObject:
5319 RezObjectPacket rezPacket = (RezObjectPacket)Pack; 5685 RezObjectPacket rezPacket = (RezObjectPacket)Pack;
5320 5686
@@ -5369,7 +5735,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5369 5735
5370 } 5736 }
5371 break; 5737 break;
5372 5738
5373 case PacketType.ModifyLand: 5739 case PacketType.ModifyLand:
5374 ModifyLandPacket modify = (ModifyLandPacket)Pack; 5740 ModifyLandPacket modify = (ModifyLandPacket)Pack;
5375 5741
@@ -5501,7 +5867,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5501 } 5867 }
5502 } 5868 }
5503 break; 5869 break;
5504 5870*/
5871 #endregion
5505 case PacketType.RezSingleAttachmentFromInv: 5872 case PacketType.RezSingleAttachmentFromInv:
5506 RezSingleAttachmentFromInv handlerRezSingleAttachment = OnRezSingleAttachmentFromInv; 5873 RezSingleAttachmentFromInv handlerRezSingleAttachment = OnRezSingleAttachmentFromInv;
5507 if (handlerRezSingleAttachment != null) 5874 if (handlerRezSingleAttachment != null)