aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs524
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs548
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs42
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs32
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs31
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs32
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs77
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs16
10 files changed, 1307 insertions, 4 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index f02c28b..0ec2ed5 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -298,6 +298,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
298 public event AvatarInterestUpdate OnAvatarInterestUpdate; 298 public event AvatarInterestUpdate OnAvatarInterestUpdate;
299 public event PlacesQuery OnPlacesQuery; 299 public event PlacesQuery OnPlacesQuery;
300 public event AgentFOV OnAgentFOV; 300 public event AgentFOV OnAgentFOV;
301 public event FindAgentUpdate OnFindAgentEvent;
302 public event TrackAgentUpdate OnTrackAgentEvent;
303 public event NewUserReport OnUserReportEvent;
304 public event SaveStateHandler OnSaveStateEvent;
305 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest;
306 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest;
307 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest;
308 public event FreezeUserUpdate OnParcelFreezeUserEvent;
309 public event EjectUserUpdate OnParcelEjectUserEvent;
310 public event ParcelBuyPass OnParcelBuyPass;
311 public event ParcelGodMark OnParcelGodMark;
312 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest;
313 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
314 public event SimWideDeletesDelegate OnSimWideDeletes;
315 public event SendPostcard OnSendPostcard;
316 public event MuteListEntryUpdate OnUpdateMuteListEntryEvent;
317 public event MuteListEntryRemove OnRemoveMuteListEntryEvent;
318 public event GodlikeMessage onGodlikeMessageEvent;
319 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent;
320
301 321
302 #endregion Events 322 #endregion Events
303 323
@@ -805,6 +825,189 @@ namespace OpenSim.Region.ClientStack.LindenUDP
805 } 825 }
806 OutPacket(gmp, ThrottleOutPacketType.Task); 826 OutPacket(gmp, ThrottleOutPacketType.Task);
807 } 827 }
828
829 public void SendGroupActiveProposals(IClientAPI sender,UUID agentID, UUID sessionID, UUID groupID, UUID transactionID, Dictionary<int, string> VoteID, Dictionary<int, string> VoteInitiator, Dictionary<int, string> Majority, Dictionary<int, string> Quorum, Dictionary<int, string> TerseDateID, Dictionary<int, string> StartDateTime, Dictionary<int, string> EndDateTime, Dictionary<int, string> ProposalText)
830 {
831 foreach(KeyValuePair<int, string> Blank in VoteID)
832 {
833 GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket();
834
835 GAPIRP.AgentData.AgentID = agentID;
836 GAPIRP.AgentData.GroupID = groupID;
837 GAPIRP.TransactionData.TransactionID = transactionID;
838 GAPIRP.TransactionData.TotalNumItems = 1;
839 GroupActiveProposalItemReplyPacket.ProposalDataBlock ProposalData = new GroupActiveProposalItemReplyPacket.ProposalDataBlock();
840 GAPIRP.ProposalData = new GroupActiveProposalItemReplyPacket.ProposalDataBlock[1];
841 ProposalData.VoteCast = Utils.StringToBytes("false");
842 ProposalData.VoteID = new UUID(VoteID[Blank.Key]);
843 ProposalData.VoteInitiator = new UUID(VoteInitiator[Blank.Key]);
844 ProposalData.Majority = (float)Convert.ToInt32(Majority[Blank.Key]);
845 ProposalData.Quorum = Convert.ToInt32(Quorum[Blank.Key]);
846 ProposalData.TerseDateID = Utils.StringToBytes(TerseDateID[Blank.Key]);
847 ProposalData.StartDateTime = Utils.StringToBytes(StartDateTime[Blank.Key]);
848 ProposalData.EndDateTime = Utils.StringToBytes(EndDateTime[Blank.Key]);
849 ProposalData.ProposalText = Utils.StringToBytes(ProposalText[Blank.Key]);
850 ProposalData.AlreadyVoted = false;
851 GAPIRP.ProposalData[0] = ProposalData;
852 OutPacket(GAPIRP, ThrottleOutPacketType.Task);
853 }
854 if(VoteID.Count == 0)
855 {
856 GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket();
857
858 GAPIRP.AgentData.AgentID = agentID;
859 GAPIRP.AgentData.GroupID = groupID;
860 GAPIRP.TransactionData.TransactionID = transactionID;
861 GAPIRP.TransactionData.TotalNumItems = 1;
862 GroupActiveProposalItemReplyPacket.ProposalDataBlock ProposalData = new GroupActiveProposalItemReplyPacket.ProposalDataBlock();
863 GAPIRP.ProposalData = new GroupActiveProposalItemReplyPacket.ProposalDataBlock[1];
864 ProposalData.VoteCast = Utils.StringToBytes("false");
865 ProposalData.VoteID = UUID.Zero;
866 ProposalData.VoteInitiator = UUID.Zero;
867 ProposalData.Majority = 0;
868 ProposalData.Quorum = 0;
869 ProposalData.TerseDateID = Utils.StringToBytes("");
870 ProposalData.StartDateTime = Utils.StringToBytes("");
871 ProposalData.EndDateTime = Utils.StringToBytes("");
872 ProposalData.ProposalText = Utils.StringToBytes("");
873 ProposalData.AlreadyVoted = false;
874 GAPIRP.ProposalData[0] = ProposalData;
875 OutPacket(GAPIRP, ThrottleOutPacketType.Task);
876 }
877 }
878
879 public void SendGroupVoteHistory(IClientAPI sender,UUID agentID, UUID sessionID, UUID groupID, UUID transactionID, Dictionary<int, string> VoteID, Dictionary<int, string> VoteInitiator, Dictionary<int, string> Majority, Dictionary<int, string> Quorum, Dictionary<int, string> TerseDateID, Dictionary<int, string> StartDateTime, Dictionary<int, string> EndDateTime, Dictionary<int, string> VoteType, Dictionary<int, string> VoteResult, Dictionary<int, string> ProposalText)
880 {
881 foreach(KeyValuePair<int, string> Blank in VoteID)
882 {
883 GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket();
884
885 GVHIRP.AgentData.AgentID = agentID;
886 GVHIRP.AgentData.GroupID = groupID;
887 GVHIRP.TransactionData.TransactionID = transactionID;
888 GVHIRP.TransactionData.TotalNumItems = 1;
889 GVHIRP.HistoryItemData.VoteID = new UUID(VoteID[Blank.Key]);
890 GVHIRP.HistoryItemData.VoteInitiator = new UUID(VoteInitiator[Blank.Key]);
891 GVHIRP.HistoryItemData.Majority = (float)Convert.ToInt32(Majority[Blank.Key]);
892 GVHIRP.HistoryItemData.Quorum = Convert.ToInt32(Quorum[Blank.Key]);
893 GVHIRP.HistoryItemData.TerseDateID = Utils.StringToBytes(TerseDateID[Blank.Key]);
894 GVHIRP.HistoryItemData.StartDateTime = Utils.StringToBytes(StartDateTime[Blank.Key]);
895 GVHIRP.HistoryItemData.EndDateTime = Utils.StringToBytes(EndDateTime[Blank.Key]);
896 GVHIRP.HistoryItemData.VoteType = Utils.StringToBytes(VoteType[Blank.Key]);
897 GVHIRP.HistoryItemData.VoteResult = Utils.StringToBytes(VoteResult[Blank.Key]);
898 GVHIRP.HistoryItemData.ProposalText = Utils.StringToBytes(ProposalText[Blank.Key]);
899 GroupVoteHistoryItemReplyPacket.VoteItemBlock VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock();
900 GVHIRP.VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock[1];
901 VoteItem.CandidateID = UUID.Zero;
902 VoteItem.NumVotes = 0; //TODO: FIX THIS!!!
903 VoteItem.VoteCast = Utils.StringToBytes("Yes");
904 GVHIRP.VoteItem[0] = VoteItem;
905 OutPacket(GVHIRP, ThrottleOutPacketType.Task);
906 }
907 if(VoteID.Count == 0)
908 {
909 GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket();
910
911 GVHIRP.AgentData.AgentID = agentID;
912 GVHIRP.AgentData.GroupID = groupID;
913 GVHIRP.TransactionData.TransactionID = transactionID;
914 GVHIRP.TransactionData.TotalNumItems = 0;
915 GVHIRP.HistoryItemData.VoteID = UUID.Zero;
916 GVHIRP.HistoryItemData.VoteInitiator = UUID.Zero;
917 GVHIRP.HistoryItemData.Majority = 0;
918 GVHIRP.HistoryItemData.Quorum = 0;
919 GVHIRP.HistoryItemData.TerseDateID = Utils.StringToBytes("");
920 GVHIRP.HistoryItemData.StartDateTime = Utils.StringToBytes("");
921 GVHIRP.HistoryItemData.EndDateTime = Utils.StringToBytes("");
922 GVHIRP.HistoryItemData.VoteType = Utils.StringToBytes("");
923 GVHIRP.HistoryItemData.VoteResult = Utils.StringToBytes("");
924 GVHIRP.HistoryItemData.ProposalText = Utils.StringToBytes("");
925 GroupVoteHistoryItemReplyPacket.VoteItemBlock VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock();
926 GVHIRP.VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock[1];
927 VoteItem.CandidateID = UUID.Zero;
928 VoteItem.NumVotes = 0; //TODO: FIX THIS!!!
929 VoteItem.VoteCast = Utils.StringToBytes("No");
930 GVHIRP.VoteItem[0] = VoteItem;
931 OutPacket(GVHIRP, ThrottleOutPacketType.Task);
932 }
933 }
934
935 public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
936 {
937 GroupAccountDetailsReplyPacket GADRP = new GroupAccountDetailsReplyPacket();
938 GADRP.AgentData = new GroupAccountDetailsReplyPacket.AgentDataBlock();
939 GADRP.AgentData.AgentID = sender.AgentId;
940 GADRP.AgentData.GroupID = groupID;
941 GADRP.HistoryData = new GroupAccountDetailsReplyPacket.HistoryDataBlock[1];
942 GroupAccountDetailsReplyPacket.HistoryDataBlock History = new GroupAccountDetailsReplyPacket.HistoryDataBlock();
943 GADRP.MoneyData = new GroupAccountDetailsReplyPacket.MoneyDataBlock();
944 GADRP.MoneyData.CurrentInterval = 0;
945 GADRP.MoneyData.IntervalDays = 7;
946 GADRP.MoneyData.RequestID = transactionID;
947 GADRP.MoneyData.StartDate = Utils.StringToBytes(DateTime.Today.ToString());
948 History.Amount = amt;
949 History.Description = Utils.StringToBytes("");
950 GADRP.HistoryData[0] = History;
951 OutPacket(GADRP, ThrottleOutPacketType.Task);
952 }
953
954 public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier)
955 {
956 GroupAccountSummaryReplyPacket GASRP =
957 (GroupAccountSummaryReplyPacket)PacketPool.Instance.GetPacket(
958 PacketType.GroupAccountSummaryReply);
959
960 GASRP.AgentData = new GroupAccountSummaryReplyPacket.AgentDataBlock();
961 GASRP.AgentData.AgentID = sender.AgentId;
962 GASRP.AgentData.GroupID = groupID;
963 GASRP.MoneyData = new GroupAccountSummaryReplyPacket.MoneyDataBlock();
964 GASRP.MoneyData.Balance = (int)moneyAmt;
965 GASRP.MoneyData.TotalCredits = totalTier;
966 GASRP.MoneyData.TotalDebits = usedTier;
967 GASRP.MoneyData.StartDate = new byte[1];
968 GASRP.MoneyData.CurrentInterval = 1;
969 GASRP.MoneyData.GroupTaxCurrent = 0;
970 GASRP.MoneyData.GroupTaxEstimate = 0;
971 GASRP.MoneyData.IntervalDays = 0;
972 GASRP.MoneyData.LandTaxCurrent = 0;
973 GASRP.MoneyData.LandTaxEstimate = 0;
974 GASRP.MoneyData.LastTaxDate = new byte[1];
975 GASRP.MoneyData.LightTaxCurrent = 0;
976 GASRP.MoneyData.TaxDate = new byte[1];
977 GASRP.MoneyData.RequestID = sender.AgentId;
978 GASRP.MoneyData.ParcelDirFeeEstimate = 0;
979 GASRP.MoneyData.ParcelDirFeeCurrent = 0;
980 GASRP.MoneyData.ObjectTaxEstimate = 0;
981 GASRP.MoneyData.NonExemptMembers = 0;
982 GASRP.MoneyData.ObjectTaxCurrent = 0;
983 GASRP.MoneyData.LightTaxEstimate = 0;
984 OutPacket(GASRP, ThrottleOutPacketType.Task);
985 }
986
987 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
988 {
989 GroupAccountTransactionsReplyPacket GATRP =
990 (GroupAccountTransactionsReplyPacket)PacketPool.Instance.GetPacket(
991 PacketType.GroupAccountTransactionsReply);
992
993 GATRP.AgentData = new GroupAccountTransactionsReplyPacket.AgentDataBlock();
994 GATRP.AgentData.AgentID = sender.AgentId;
995 GATRP.AgentData.GroupID = groupID;
996 GATRP.MoneyData = new GroupAccountTransactionsReplyPacket.MoneyDataBlock();
997 GATRP.MoneyData.CurrentInterval = 0;
998 GATRP.MoneyData.IntervalDays = 7;
999 GATRP.MoneyData.RequestID = transactionID;
1000 GATRP.MoneyData.StartDate = Utils.StringToBytes(DateTime.Today.ToString());
1001 GATRP.HistoryData = new GroupAccountTransactionsReplyPacket.HistoryDataBlock[1];
1002 GroupAccountTransactionsReplyPacket.HistoryDataBlock History = new GroupAccountTransactionsReplyPacket.HistoryDataBlock();
1003 History.Amount = 0;
1004 History.Item = Utils.StringToBytes("");
1005 History.Time = Utils.StringToBytes("");
1006 History.Type = 0;
1007 History.User = Utils.StringToBytes("");
1008 GATRP.HistoryData[0] = History;
1009 OutPacket(GATRP, ThrottleOutPacketType.Task);
1010 }
808 1011
809 /// <summary> 1012 /// <summary>
810 /// Send the region heightmap to the client 1013 /// Send the region heightmap to the client
@@ -4554,6 +4757,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4554 AddLocalPacketHandler(PacketType.AvatarInterestsUpdate, HandleAvatarInterestsUpdate); 4757 AddLocalPacketHandler(PacketType.AvatarInterestsUpdate, HandleAvatarInterestsUpdate);
4555 AddLocalPacketHandler(PacketType.GrantUserRights, HandleGrantUserRights); 4758 AddLocalPacketHandler(PacketType.GrantUserRights, HandleGrantUserRights);
4556 AddLocalPacketHandler(PacketType.PlacesQuery, HandlePlacesQuery); 4759 AddLocalPacketHandler(PacketType.PlacesQuery, HandlePlacesQuery);
4760 AddLocalPacketHandler(PacketType.UpdateMuteListEntry, HandleUpdateMuteListEntry);
4761 AddLocalPacketHandler(PacketType.RemoveMuteListEntry, HandleRemoveMuteListEntry);
4762 AddLocalPacketHandler(PacketType.UserReport, HandleUserReport);
4763 AddLocalPacketHandler(PacketType.FindAgent, HandleFindAgent);
4764 AddLocalPacketHandler(PacketType.TrackAgent, HandleTrackAgent);
4765 AddLocalPacketHandler(PacketType.GodUpdateRegionInfo, HandleGodUpdateRegionInfoUpdate);
4766 AddLocalPacketHandler(PacketType.GodlikeMessage, HandleGodlikeMessage);
4767 AddLocalPacketHandler(PacketType.StateSave, HandleSaveStatePacket);
4768 AddLocalPacketHandler(PacketType.GroupAccountDetailsRequest, HandleGroupAccountDetailsRequest);
4769 AddLocalPacketHandler(PacketType.GroupAccountSummaryRequest, HandleGroupAccountSummaryRequest);
4770 AddLocalPacketHandler(PacketType.GroupAccountTransactionsRequest, HandleGroupTransactionsDetailsRequest);
4771 AddLocalPacketHandler(PacketType.FreezeUser, HandleFreezeUser);
4772 AddLocalPacketHandler(PacketType.EjectUser, HandleEjectUser);
4773 AddLocalPacketHandler(PacketType.ParcelBuyPass, HandleParcelBuyPass);
4774 AddLocalPacketHandler(PacketType.ParcelGodMarkAsContent, HandleParcelGodMarkAsContent);
4775 AddLocalPacketHandler(PacketType.GroupActiveProposalsRequest, HandleGroupActiveProposalsRequest);
4776 AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest);
4777 AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes);
4778 AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard);
4557 } 4779 }
4558 4780
4559 #region Packet Handlers 4781 #region Packet Handlers
@@ -4649,7 +4871,72 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4649 4871
4650 return false; 4872 return false;
4651 } 4873 }
4652 4874
4875 private bool HandleParcelGodMarkAsContent(IClientAPI client, Packet Packet)
4876 {
4877 ParcelGodMarkAsContentPacket ParcelGodMarkAsContent =
4878 (ParcelGodMarkAsContentPacket)Packet;
4879
4880 ParcelGodMark ParcelGodMarkAsContentHandler = OnParcelGodMark;
4881 if (ParcelGodMarkAsContentHandler != null)
4882 {
4883 ParcelGodMarkAsContentHandler(this,
4884 ParcelGodMarkAsContent.AgentData.AgentID,
4885 ParcelGodMarkAsContent.ParcelData.LocalID);
4886 return true;
4887 }
4888 return false;
4889 }
4890
4891 private bool HandleFreezeUser(IClientAPI client, Packet Packet)
4892 {
4893 FreezeUserPacket FreezeUser = (FreezeUserPacket)Packet;
4894
4895 FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUserEvent;
4896 if (FreezeUserHandler != null)
4897 {
4898 FreezeUserHandler(this,
4899 FreezeUser.AgentData.AgentID,
4900 FreezeUser.Data.Flags,
4901 FreezeUser.Data.TargetID);
4902 return true;
4903 }
4904 return false;
4905 }
4906
4907 private bool HandleEjectUser(IClientAPI client, Packet Packet)
4908 {
4909 EjectUserPacket EjectUser =
4910 (EjectUserPacket)Packet;
4911
4912 EjectUserUpdate EjectUserHandler = OnParcelEjectUserEvent;
4913 if (EjectUserHandler != null)
4914 {
4915 EjectUserHandler(this,
4916 EjectUser.AgentData.AgentID,
4917 EjectUser.Data.Flags,
4918 EjectUser.Data.TargetID);
4919 return true;
4920 }
4921 return false;
4922 }
4923
4924 private bool HandleParcelBuyPass(IClientAPI client, Packet Packet)
4925 {
4926 ParcelBuyPassPacket ParcelBuyPass =
4927 (ParcelBuyPassPacket)Packet;
4928
4929 ParcelBuyPass ParcelBuyPassHandler = OnParcelBuyPass;
4930 if (ParcelBuyPassHandler != null)
4931 {
4932 ParcelBuyPassHandler(this,
4933 ParcelBuyPass.AgentData.AgentID,
4934 ParcelBuyPass.ParcelData.LocalID);
4935 return true;
4936 }
4937 return false;
4938 }
4939
4653 private bool HandleParcelBuyRequest(IClientAPI sender, Packet Pack) 4940 private bool HandleParcelBuyRequest(IClientAPI sender, Packet Pack)
4654 { 4941 {
4655 ParcelBuyPacket parcel = (ParcelBuyPacket)Pack; 4942 ParcelBuyPacket parcel = (ParcelBuyPacket)Pack;
@@ -5015,7 +5302,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5015 } 5302 }
5016 return true; 5303 return true;
5017 } 5304 }
5018 5305
5306 private bool HandleFindAgent(IClientAPI client, Packet Packet)
5307 {
5308 FindAgentPacket FindAgent =
5309 (FindAgentPacket)Packet;
5310
5311 FindAgentUpdate FindAgentHandler = OnFindAgentEvent;
5312 if (FindAgentHandler != null)
5313 {
5314 FindAgentHandler(this,FindAgent.AgentBlock.Hunter,FindAgent.AgentBlock.Prey);
5315 return true;
5316 }
5317 return false;
5318 }
5319
5320 private bool HandleTrackAgent(IClientAPI client, Packet Packet)
5321 {
5322 TrackAgentPacket TrackAgent =
5323 (TrackAgentPacket)Packet;
5324
5325 TrackAgentUpdate TrackAgentHandler = OnTrackAgentEvent;
5326 if (TrackAgentHandler != null)
5327 {
5328 TrackAgentHandler(this,
5329 TrackAgent.AgentData.AgentID,
5330 TrackAgent.TargetData.PreyID);
5331 return true;
5332 }
5333 return false;
5334 }
5335
5019 private bool HandlerRezObject(IClientAPI sender, Packet Pack) 5336 private bool HandlerRezObject(IClientAPI sender, Packet Pack)
5020 { 5337 {
5021 RezObjectPacket rezPacket = (RezObjectPacket)Pack; 5338 RezObjectPacket rezPacket = (RezObjectPacket)Pack;
@@ -8285,6 +8602,70 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8285 8602
8286 return true; 8603 return true;
8287 } 8604 }
8605
8606 private bool HandleGodUpdateRegionInfoUpdate(IClientAPI client, Packet Packet)
8607 {
8608 GodUpdateRegionInfoPacket GodUpdateRegionInfo =
8609 (GodUpdateRegionInfoPacket)Packet;
8610
8611 GodUpdateRegionInfoUpdate handlerGodUpdateRegionInfo = OnGodUpdateRegionInfoUpdateEvent;
8612 if (handlerGodUpdateRegionInfo != null)
8613 {
8614 handlerGodUpdateRegionInfo(this,
8615 GodUpdateRegionInfo.RegionInfo.BillableFactor,
8616 GodUpdateRegionInfo.RegionInfo.EstateID,
8617 GodUpdateRegionInfo.RegionInfo.RegionFlags,
8618 GodUpdateRegionInfo.RegionInfo.SimName,
8619 GodUpdateRegionInfo.RegionInfo.RedirectGridX,
8620 GodUpdateRegionInfo.RegionInfo.RedirectGridY);
8621 return true;
8622 }
8623 return false;
8624 }
8625
8626 private bool HandleSimWideDeletes(IClientAPI client, Packet Packet)
8627 {
8628 SimWideDeletesPacket SimWideDeletesRequest =
8629 (SimWideDeletesPacket)Packet;
8630 SimWideDeletesDelegate handlerSimWideDeletesRequest = OnSimWideDeletes;
8631 if (handlerSimWideDeletesRequest != null)
8632 {
8633 handlerSimWideDeletesRequest(this, SimWideDeletesRequest.AgentData.AgentID,(int)SimWideDeletesRequest.DataBlock.Flags,SimWideDeletesRequest.DataBlock.TargetID);
8634 return true;
8635 }
8636 return false;
8637 }
8638
8639 private bool HandleGodlikeMessage(IClientAPI client, Packet Packet)
8640 {
8641 GodlikeMessagePacket GodlikeMessage =
8642 (GodlikeMessagePacket)Packet;
8643
8644 GodlikeMessage handlerGodlikeMessage = onGodlikeMessageEvent;
8645 if (handlerGodlikeMessage != null)
8646 {
8647 handlerGodlikeMessage(this,
8648 GodlikeMessage.MethodData.Invoice,
8649 GodlikeMessage.MethodData.Method,
8650 GodlikeMessage.ParamList[0].Parameter);
8651 return true;
8652 }
8653 return false;
8654 }
8655
8656 private bool HandleSaveStatePacket(IClientAPI client, Packet Packet)
8657 {
8658 StateSavePacket SaveStateMessage =
8659 (StateSavePacket)Packet;
8660 SaveStateHandler handlerSaveStatePacket = OnSaveStateEvent;
8661 if (handlerSaveStatePacket != null)
8662 {
8663 handlerSaveStatePacket(this,SaveStateMessage.AgentData.AgentID);
8664 return true;
8665 }
8666 return false;
8667 }
8668
8288 private bool HandleGodKickUser(IClientAPI sender, Packet Pack) 8669 private bool HandleGodKickUser(IClientAPI sender, Packet Pack)
8289 { 8670 {
8290 GodKickUserPacket gkupack = (GodKickUserPacket)Pack; 8671 GodKickUserPacket gkupack = (GodKickUserPacket)Pack;
@@ -8635,6 +9016,76 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8635 } 9016 }
8636 return true; 9017 return true;
8637 } 9018 }
9019
9020 private bool HandleUpdateMuteListEntry(IClientAPI client, Packet Packet)
9021 {
9022 UpdateMuteListEntryPacket UpdateMuteListEntry =
9023 (UpdateMuteListEntryPacket)Packet;
9024 MuteListEntryUpdate handlerUpdateMuteListEntry = OnUpdateMuteListEntryEvent;
9025 if (handlerUpdateMuteListEntry != null)
9026 {
9027 handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID,
9028 Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName),
9029 UpdateMuteListEntry.MuteData.MuteType,
9030 UpdateMuteListEntry.AgentData.AgentID);
9031 return true;
9032 }
9033 return false;
9034 }
9035
9036 private bool HandleRemoveMuteListEntry(IClientAPI client, Packet Packet)
9037 {
9038 RemoveMuteListEntryPacket RemoveMuteListEntry =
9039 (RemoveMuteListEntryPacket)Packet;
9040 MuteListEntryRemove handlerRemoveMuteListEntry = OnRemoveMuteListEntryEvent;
9041 if (handlerRemoveMuteListEntry != null)
9042 {
9043 handlerRemoveMuteListEntry(this,
9044 RemoveMuteListEntry.MuteData.MuteID,
9045 Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName),
9046 RemoveMuteListEntry.AgentData.AgentID);
9047 return true;
9048 }
9049 return false;
9050 }
9051
9052 private bool HandleUserReport(IClientAPI client, Packet Packet)
9053 {
9054 UserReportPacket UserReport =
9055 (UserReportPacket)Packet;
9056
9057 NewUserReport handlerUserReport = OnUserReportEvent;
9058 if (handlerUserReport != null)
9059 {
9060 handlerUserReport(this,
9061 Utils.BytesToString(UserReport.ReportData.AbuseRegionName),
9062 UserReport.ReportData.AbuserID,
9063 UserReport.ReportData.Category,
9064 UserReport.ReportData.CheckFlags,
9065 Utils.BytesToString(UserReport.ReportData.Details),
9066 UserReport.ReportData.ObjectID,
9067 UserReport.ReportData.Position,
9068 UserReport.ReportData.ReportType,
9069 UserReport.ReportData.ScreenshotID,
9070 Utils.BytesToString(UserReport.ReportData.Summary),
9071 UserReport.AgentData.AgentID);
9072 return true;
9073 }
9074 return false;
9075 }
9076
9077 private bool HandleSendPostcard(IClientAPI client, Packet packet)
9078 {
9079 SendPostcardPacket SendPostcard =
9080 (SendPostcardPacket)packet;
9081 SendPostcard handlerSendPostcard = OnSendPostcard;
9082 if (handlerSendPostcard != null)
9083 {
9084 handlerSendPostcard(this);
9085 return true;
9086 }
9087 return false;
9088 }
8638 9089
8639 private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) 9090 private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack)
8640 { 9091 {
@@ -8904,7 +9355,72 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8904 return true; 9355 return true;
8905 9356
8906 } 9357 }
8907 9358
9359 private bool HandleGroupVoteHistoryRequest(IClientAPI client, Packet Packet)
9360 {
9361 GroupVoteHistoryRequestPacket GroupVoteHistoryRequest =
9362 (GroupVoteHistoryRequestPacket)Packet;
9363 GroupVoteHistoryRequest handlerGroupVoteHistoryRequest = OnGroupVoteHistoryRequest;
9364 if (handlerGroupVoteHistoryRequest != null)
9365 {
9366 handlerGroupVoteHistoryRequest(this, GroupVoteHistoryRequest.AgentData.AgentID,GroupVoteHistoryRequest.AgentData.SessionID,GroupVoteHistoryRequest.GroupData.GroupID,GroupVoteHistoryRequest.TransactionData.TransactionID);
9367 return true;
9368 }
9369 return false;
9370 }
9371
9372 private bool HandleGroupActiveProposalsRequest(IClientAPI client, Packet Packet)
9373 {
9374 GroupActiveProposalsRequestPacket GroupActiveProposalsRequest =
9375 (GroupActiveProposalsRequestPacket)Packet;
9376 GroupActiveProposalsRequest handlerGroupActiveProposalsRequest = OnGroupActiveProposalsRequest;
9377 if (handlerGroupActiveProposalsRequest != null)
9378 {
9379 handlerGroupActiveProposalsRequest(this, GroupActiveProposalsRequest.AgentData.AgentID,GroupActiveProposalsRequest.AgentData.SessionID,GroupActiveProposalsRequest.GroupData.GroupID,GroupActiveProposalsRequest.TransactionData.TransactionID);
9380 return true;
9381 }
9382 return false;
9383 }
9384
9385 private bool HandleGroupAccountDetailsRequest(IClientAPI client, Packet Packet)
9386 {
9387 GroupAccountDetailsRequestPacket GroupAccountDetailsRequest =
9388 (GroupAccountDetailsRequestPacket)Packet;
9389 GroupAccountDetailsRequest handlerGroupAccountDetailsRequest = OnGroupAccountDetailsRequest;
9390 if (handlerGroupAccountDetailsRequest != null)
9391 {
9392 handlerGroupAccountDetailsRequest(this, GroupAccountDetailsRequest.AgentData.AgentID,GroupAccountDetailsRequest.AgentData.GroupID,GroupAccountDetailsRequest.MoneyData.RequestID,GroupAccountDetailsRequest.AgentData.SessionID);
9393 return true;
9394 }
9395 return false;
9396 }
9397
9398 private bool HandleGroupAccountSummaryRequest(IClientAPI client, Packet Packet)
9399 {
9400 GroupAccountSummaryRequestPacket GroupAccountSummaryRequest =
9401 (GroupAccountSummaryRequestPacket)Packet;
9402 GroupAccountSummaryRequest handlerGroupAccountSummaryRequest = OnGroupAccountSummaryRequest;
9403 if (handlerGroupAccountSummaryRequest != null)
9404 {
9405 handlerGroupAccountSummaryRequest(this, GroupAccountSummaryRequest.AgentData.AgentID,GroupAccountSummaryRequest.AgentData.GroupID);
9406 return true;
9407 }
9408 return false;
9409 }
9410
9411 private bool HandleGroupTransactionsDetailsRequest(IClientAPI client, Packet Packet)
9412 {
9413 GroupAccountTransactionsRequestPacket GroupAccountTransactionsRequest =
9414 (GroupAccountTransactionsRequestPacket)Packet;
9415 GroupAccountTransactionsRequest handlerGroupAccountTransactionsRequest = OnGroupAccountTransactionsRequest;
9416 if (handlerGroupAccountTransactionsRequest != null)
9417 {
9418 handlerGroupAccountTransactionsRequest(this, GroupAccountTransactionsRequest.AgentData.AgentID,GroupAccountTransactionsRequest.AgentData.GroupID,GroupAccountTransactionsRequest.MoneyData.RequestID,GroupAccountTransactionsRequest.AgentData.SessionID);
9419 return true;
9420 }
9421 return false;
9422 }
9423
8908 private bool HandleGroupTitlesRequest(IClientAPI sender, Packet Pack) 9424 private bool HandleGroupTitlesRequest(IClientAPI sender, Packet Pack)
8909 { 9425 {
8910 GroupTitlesRequestPacket groupTitlesRequest = 9426 GroupTitlesRequestPacket groupTitlesRequest =
@@ -13705,7 +14221,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
13705 if (handlerGodKickUser != null) 14221 if (handlerGodKickUser != null)
13706 { 14222 {
13707 handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID, 14223 handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID,
13708 gkupack.UserInfo.AgentID, gkupack.UserInfo.KickFlags, gkupack.UserInfo.Reason,gkupack.UserInfo); 14224 gkupack.UserInfo.AgentID, gkupack.UserInfo.KickFlags, gkupack.UserInfo.Reason,gkupack.UserInfo);
13709 } 14225 }
13710 } 14226 }
13711 else 14227 else
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index f5d30b7..fceca8e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -54,6 +54,534 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
54 { 54 {
55 } 55 }
56 56
57 public void Close()
58 {
59 }
60
61 public string Name
62 {
63 get { return "FriendsModule"; }
64 }
65
66 public bool IsSharedModule
67 {
68 get { return true; }
69 }
70
71 #endregion
72
73 #region IInterregionFriendsComms
74
75 public List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online)
76 {
77 List<UUID> tpdAway = new List<UUID>();
78
79 // destRegionHandle is a region on another server
80 uint x = 0, y = 0;
81 Utils.LongToUInts(destRegionHandle, out x, out y);
82 GridRegion info = m_gridServices.GetRegionByPosition(m_initialScene.RegionInfo.ScopeID, (int)x, (int)y);
83 if (info != null)
84 {
85 string httpServer = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/presence_update_bulk";
86
87 Hashtable reqParams = new Hashtable();
88 reqParams["agentID"] = agentId.ToString();
89 reqParams["agentOnline"] = online;
90 int count = 0;
91 foreach (UUID uuid in friends)
92 {
93 reqParams["friendID_" + count++] = uuid.ToString();
94 }
95 reqParams["friendCount"] = count;
96
97 IList parameters = new ArrayList();
98 parameters.Add(reqParams);
99 try
100 {
101 XmlRpcRequest request = new XmlRpcRequest("presence_update_bulk", parameters);
102 XmlRpcResponse response = request.Send(httpServer, 5000);
103 Hashtable respData = (Hashtable)response.Value;
104
105 count = (int)respData["friendCount"];
106 for (int i = 0; i < count; ++i)
107 {
108 UUID uuid;
109 if (UUID.TryParse((string)respData["friendID_" + i], out uuid)) tpdAway.Add(uuid);
110 }
111 }
112 catch (WebException e)
113 {
114 // Ignore connect failures, simulators come and go
115 //
116 if (!e.Message.Contains("ConnectFailure"))
117 {
118 m_log.Error("[OGS1 GRID SERVICES]: InformFriendsInOtherRegion XMLRPC failure: ", e);
119 }
120 }
121 catch (Exception e)
122 {
123 m_log.Error("[OGS1 GRID SERVICES]: InformFriendsInOtherRegion XMLRPC failure: ", e);
124 }
125 }
126 else m_log.WarnFormat("[OGS1 GRID SERVICES]: Couldn't find region {0}???", destRegionHandle);
127
128 return tpdAway;
129 }
130
131 public bool TriggerTerminateFriend(ulong destRegionHandle, UUID agentID, UUID exFriendID)
132 {
133 // destRegionHandle is a region on another server
134 uint x = 0, y = 0;
135 Utils.LongToUInts(destRegionHandle, out x, out y);
136 GridRegion info = m_gridServices.GetRegionByPosition(m_initialScene.RegionInfo.ScopeID, (int)x, (int)y);
137 if (info == null)
138 {
139 m_log.WarnFormat("[OGS1 GRID SERVICES]: Couldn't find region {0}", destRegionHandle);
140 return false; // region not found???
141 }
142
143 string httpServer = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/presence_update_bulk";
144
145 Hashtable reqParams = new Hashtable();
146 reqParams["agentID"] = agentID.ToString();
147 reqParams["friendID"] = exFriendID.ToString();
148
149 IList parameters = new ArrayList();
150 parameters.Add(reqParams);
151 try
152 {
153 XmlRpcRequest request = new XmlRpcRequest("terminate_friend", parameters);
154 XmlRpcResponse response = request.Send(httpServer, 5000);
155 Hashtable respData = (Hashtable)response.Value;
156
157 return (bool)respData["success"];
158 }
159 catch (Exception e)
160 {
161 m_log.Error("[OGS1 GRID SERVICES]: InformFriendsInOtherRegion XMLRPC failure: ", e);
162 return false;
163 }
164 }
165
166 #endregion
167
168 #region Incoming XMLRPC messages
169 /// <summary>
170 /// Receive presence information changes about clients in other regions.
171 /// </summary>
172 /// <param name="req"></param>
173 /// <returns></returns>
174 public XmlRpcResponse processPresenceUpdateBulk(XmlRpcRequest req, IPEndPoint remoteClient)
175 {
176 Hashtable requestData = (Hashtable)req.Params[0];
177
178 List<UUID> friendsNotHere = new List<UUID>();
179
180 // this is called with the expectation that all the friends in the request are on this region-server.
181 // But as some time passed since we checked (on the other region-server, via the MessagingServer),
182 // some of the friends might have teleported away.
183 // Actually, even now, between this line and the sending below, some people could TP away. So,
184 // we'll have to lock the m_rootAgents list for the duration to prevent/delay that.
185 lock (m_rootAgents)
186 {
187 List<ScenePresence> friendsHere = new List<ScenePresence>();
188
189 try
190 {
191 UUID agentID = new UUID((string)requestData["agentID"]);
192 bool agentOnline = (bool)requestData["agentOnline"];
193 int count = (int)requestData["friendCount"];
194 for (int i = 0; i < count; ++i)
195 {
196 UUID uuid;
197 if (UUID.TryParse((string)requestData["friendID_" + i], out uuid))
198 {
199 if (m_rootAgents.ContainsKey(uuid)) friendsHere.Add(GetRootPresenceFromAgentID(uuid));
200 else friendsNotHere.Add(uuid);
201 }
202 }
203
204 // now send, as long as they are still here...
205 UUID[] agentUUID = new UUID[] { agentID };
206 if (agentOnline)
207 {
208 foreach (ScenePresence agent in friendsHere)
209 {
210 agent.ControllingClient.SendAgentOnline(agentUUID);
211 }
212 }
213 else
214 {
215 foreach (ScenePresence agent in friendsHere)
216 {
217 agent.ControllingClient.SendAgentOffline(agentUUID);
218 }
219 }
220 }
221 catch(Exception e)
222 {
223 m_log.Warn("[FRIENDS]: Got exception while parsing presence_update_bulk request:", e);
224 }
225 }
226
227 // no need to lock anymore; if TPs happen now, worst case is that we have an additional agent in this region,
228 // which should be caught on the next iteration...
229 Hashtable result = new Hashtable();
230 int idx = 0;
231 foreach (UUID uuid in friendsNotHere)
232 {
233 result["friendID_" + idx++] = uuid.ToString();
234 }
235 result["friendCount"] = idx;
236
237 XmlRpcResponse response = new XmlRpcResponse();
238 response.Value = result;
239
240 return response;
241 }
242
243 public XmlRpcResponse processTerminateFriend(XmlRpcRequest req, IPEndPoint remoteClient)
244 {
245 Hashtable requestData = (Hashtable)req.Params[0];
246
247 bool success = false;
248
249 UUID agentID;
250 UUID friendID;
251 if (requestData.ContainsKey("agentID") && UUID.TryParse((string)requestData["agentID"], out agentID) &&
252 requestData.ContainsKey("friendID") && UUID.TryParse((string)requestData["friendID"], out friendID))
253 {
254 // try to find it and if it is there, prevent it to vanish before we sent the message
255 lock (m_rootAgents)
256 {
257 if (m_rootAgents.ContainsKey(agentID))
258 {
259 m_log.DebugFormat("[FRIEND]: Sending terminate friend {0} to agent {1}", friendID, agentID);
260 GetRootPresenceFromAgentID(agentID).ControllingClient.SendTerminateFriend(friendID);
261 success = true;
262 }
263 }
264 }
265
266 // return whether we were successful
267 Hashtable result = new Hashtable();
268 result["success"] = success;
269
270 XmlRpcResponse response = new XmlRpcResponse();
271 response.Value = result;
272 return response;
273 }
274
275 #endregion
276
277 #region Scene events
278
279 private void OnNewClient(IClientAPI client)
280 {
281 // All friends establishment protocol goes over instant message
282 // There's no way to send a message from the sim
283 // to a user to 'add a friend' without causing dialog box spam
284
285 // Subscribe to instant messages
286 client.OnInstantMessage += OnInstantMessage;
287
288 // Friend list management
289 client.OnApproveFriendRequest += OnApproveFriendRequest;
290 client.OnDenyFriendRequest += OnDenyFriendRequest;
291 client.OnTerminateFriendship += OnTerminateFriendship;
292
293 // ... calling card handling...
294 client.OnOfferCallingCard += OnOfferCallingCard;
295 client.OnAcceptCallingCard += OnAcceptCallingCard;
296 client.OnDeclineCallingCard += OnDeclineCallingCard;
297
298 // we need this one exactly once per agent session (see comments in the handler below)
299 client.OnEconomyDataRequest += OnEconomyDataRequest;
300
301 // if it leaves, we want to know, too
302 client.OnLogout += OnLogout;
303
304 client.OnGrantUserRights += GrantUserFriendRights;
305 client.OnTrackAgentEvent += FindAgent;
306 client.OnFindAgentEvent += FindAgent;
307
308 }
309
310 private void ClientClosed(UUID AgentId, Scene scene)
311 {
312 // agent's client was closed. As we handle logout in OnLogout, this here has only to handle
313 // TPing away (root agent is closed) or TPing/crossing in a region far enough away (client
314 // agent is closed).
315 // NOTE: In general, this doesn't mean that the agent logged out, just that it isn't around
316 // in one of the regions here anymore.
317 lock (m_rootAgents)
318 {
319 if (m_rootAgents.ContainsKey(AgentId))
320 {
321 m_rootAgents.Remove(AgentId);
322 }
323 }
324 }
325
326 private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID)
327 {
328 lock (m_rootAgents)
329 {
330 m_rootAgents[avatar.UUID] = avatar.RegionHandle;
331 // Claim User! my user! Mine mine mine!
332 }
333 }
334
335 private void MakeChildAgent(ScenePresence avatar)
336 {
337 lock (m_rootAgents)
338 {
339 if (m_rootAgents.ContainsKey(avatar.UUID))
340 {
341 // only delete if the region matches. As this is a shared module, the avatar could be
342 // root agent in another region on this server.
343 if (m_rootAgents[avatar.UUID] == avatar.RegionHandle)
344 {
345 m_rootAgents.Remove(avatar.UUID);
346// m_log.Debug("[FRIEND]: Removing " + avatar.Firstname + " " + avatar.Lastname + " as a root agent");
347 }
348 }
349 }
350 }
351 #endregion
352
353 private ScenePresence GetRootPresenceFromAgentID(UUID AgentID)
354 {
355 ScenePresence returnAgent = null;
356 lock (m_scenes)
357 {
358 ScenePresence queryagent = null;
359 foreach (Scene scene in m_scenes.Values)
360 {
361 queryagent = scene.GetScenePresence(AgentID);
362 if (queryagent != null)
363 {
364 if (!queryagent.IsChildAgent)
365 {
366 returnAgent = queryagent;
367 break;
368 }
369 }
370 }
371 }
372 return returnAgent;
373 }
374
375 private ScenePresence GetAnyPresenceFromAgentID(UUID AgentID)
376 {
377 ScenePresence returnAgent = null;
378 lock (m_scenes)
379 {
380 ScenePresence queryagent = null;
381 foreach (Scene scene in m_scenes.Values)
382 {
383 queryagent = scene.GetScenePresence(AgentID);
384 if (queryagent != null)
385 {
386 returnAgent = queryagent;
387 break;
388 }
389 }
390 }
391 return returnAgent;
392 }
393
394 public void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage)
395 {
396 CachedUserInfo userInfo = m_initialScene.CommsManager.UserProfileCacheService.GetUserDetails(fromUserId);
397
398 if (userInfo != null)
399 {
400 GridInstantMessage msg = new GridInstantMessage(
401 toUserClient.Scene, fromUserId, userInfo.UserProfile.Name, toUserClient.AgentId,
402 (byte)InstantMessageDialog.FriendshipOffered, offerMessage, false, Vector3.Zero);
403
404 FriendshipOffered(msg);
405 }
406 else
407 {
408 m_log.ErrorFormat("[FRIENDS]: No user found for id {0} in OfferFriendship()", fromUserId);
409 }
410 }
411
412 #region FriendRequestHandling
413
414 private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
415 {
416 // Friend Requests go by Instant Message.. using the dialog param
417 // https://wiki.secondlife.com/wiki/ImprovedInstantMessage
418
419 if (im.dialog == (byte)InstantMessageDialog.FriendshipOffered) // 38
420 {
421 // fromAgentName is the *destination* name (the friend we offer friendship to)
422 ScenePresence initiator = GetAnyPresenceFromAgentID(new UUID(im.fromAgentID));
423 im.fromAgentName = initiator != null ? initiator.Name : "(hippo)";
424
425 FriendshipOffered(im);
426 }
427 else if (im.dialog == (byte)InstantMessageDialog.FriendshipAccepted) // 39
428 {
429 FriendshipAccepted(client, im);
430 }
431 else if (im.dialog == (byte)InstantMessageDialog.FriendshipDeclined) // 40
432 {
433 FriendshipDeclined(client, im);
434 }
435 }
436
437 /// <summary>
438 /// Invoked when a user offers a friendship.
439 /// </summary>
440 ///
441 /// <param name="im"></param>
442 /// <param name="client"></param>
443 private void FriendshipOffered(GridInstantMessage im)
444 {
445 // this is triggered by the initiating agent:
446 // A local agent offers friendship to some possibly remote friend.
447 // A IM is triggered, processed here and sent to the friend (possibly in a remote region).
448
449 m_log.DebugFormat("[FRIEND]: Offer(38) - From: {0}, FromName: {1} To: {2}, Session: {3}, Message: {4}, Offline {5}",
450 im.fromAgentID, im.fromAgentName, im.toAgentID, im.imSessionID, im.message, im.offline);
451
452 // 1.20 protocol sends an UUID in the message field, instead of the friendship offer text.
453 // For interoperability, we have to clear that
454 if (Util.isUUID(im.message)) im.message = "";
455
456 // be sneeky and use the initiator-UUID as transactionID. This means we can be stateless.
457 // we have to look up the agent name on friendship-approval, though.
458 im.imSessionID = im.fromAgentID;
459
460 if (m_TransferModule != null)
461 {
462 // Send it to whoever is the destination.
463 // If new friend is local, it will send an IM to the viewer.
464 // If new friend is remote, it will cause a OnGridInstantMessage on the remote server
465 m_TransferModule.SendInstantMessage(
466 im,
467 delegate(bool success)
468 {
469 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
470 }
471 );
472 }
473 }
474
475 /// <summary>
476 /// Invoked when a user accepts a friendship offer.
477 /// </summary>
478 /// <param name="im"></param>
479 /// <param name="client"></param>
480 private void FriendshipAccepted(IClientAPI client, GridInstantMessage im)
481 {
482 m_log.DebugFormat("[FRIEND]: 39 - from client {0}, agent {2} {3}, imsession {4} to {5}: {6} (dialog {7})",
483 client.AgentId, im.fromAgentID, im.fromAgentName, im.imSessionID, im.toAgentID, im.message, im.dialog);
484 }
485
486 /// <summary>
487 /// Invoked when a user declines a friendship offer.
488 /// </summary>
489 /// May not currently be used - see OnDenyFriendRequest() instead
490 /// <param name="im"></param>
491 /// <param name="client"></param>
492 private void FriendshipDeclined(IClientAPI client, GridInstantMessage im)
493 {
494 UUID fromAgentID = new UUID(im.fromAgentID);
495 UUID toAgentID = new UUID(im.toAgentID);
496
497 // declining the friendship offer causes a type 40 IM being sent to the (possibly remote) initiator
498 // toAgentID is initiator, fromAgentID declined friendship
499 m_log.DebugFormat("[FRIEND]: 40 - from client {0}, agent {1} {2}, imsession {3} to {4}: {5} (dialog {6})",
500 client != null ? client.AgentId.ToString() : "<null>",
501 fromAgentID, im.fromAgentName, im.imSessionID, im.toAgentID, im.message, im.dialog);
502
503 // Send the decline to whoever is the destination.
504 GridInstantMessage msg
505 = new GridInstantMessage(
506 client.Scene, fromAgentID, client.Name, toAgentID,
507 im.dialog, im.message, im.offline != 0, im.Position);
508
509 // If new friend is local, it will send an IM to the viewer.
510 // If new friend is remote, it will cause a OnGridInstantMessage on the remote server
511 m_TransferModule.SendInstantMessage(msg,
512 delegate(bool success) {
513 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
514 }
515 );
516 }
517
518 private void OnGridInstantMessage(GridInstantMessage msg)
519 {
520 // This event won't be raised unless we have that agent,
521 // so we can depend on the above not trying to send
522 // via grid again
523 //m_log.DebugFormat("[FRIEND]: Got GridIM from {0}, to {1}, imSession {2}, message {3}, dialog {4}",
524 // msg.fromAgentID, msg.toAgentID, msg.imSessionID, msg.message, msg.dialog);
525
526 if (msg.dialog == (byte)InstantMessageDialog.FriendshipOffered ||
527 msg.dialog == (byte)InstantMessageDialog.FriendshipAccepted ||
528 msg.dialog == (byte)InstantMessageDialog.FriendshipDeclined)
529 {
530 // this should succeed as we *know* the root agent is here.
531 m_TransferModule.SendInstantMessage(msg,
532 delegate(bool success) {
533 //m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
534 }
535 );
536 }
537
538 if (msg.dialog == (byte)InstantMessageDialog.FriendshipAccepted)
539 {
540 // for accept friendship, we have to do a bit more
541 ApproveFriendship(new UUID(msg.fromAgentID), new UUID(msg.toAgentID), msg.fromAgentName);
542 }
543 }
544
545 private void ApproveFriendship(UUID fromAgentID, UUID toAgentID, string fromName)
546 {
547 m_log.DebugFormat("[FRIEND]: Approve friendship from {0} (ID: {1}) to {2}",
548 fromAgentID, fromName, toAgentID);
549
550 // a new friend was added in the initiator's and friend's data, so the cache entries are wrong now.
551 lock (m_friendLists)
552 {
553 m_friendLists.Invalidate(fromAgentID.ToString());
554 m_friendLists.Invalidate(toAgentID.ToString());
555 }
556
557 // now send presence update and add a calling card for the new friend
558
559 ScenePresence initiator = GetAnyPresenceFromAgentID(toAgentID);
560 if (initiator == null)
561 {
562 // quite wrong. Shouldn't happen.
563 m_log.WarnFormat("[FRIEND]: Coudn't find initiator of friend request {0}", toAgentID);
564 return;
565 }
566
567 m_log.DebugFormat("[FRIEND]: Tell {0} that {1} is online",
568 initiator.Name, fromName);
569 // tell initiator that friend is online
570 initiator.ControllingClient.SendAgentOnline(new UUID[] { fromAgentID });
571
572 // find the folder for the friend...
573 //InventoryFolderImpl folder =
574 // initiator.Scene.CommsManager.UserProfileCacheService.GetUserDetails(toAgentID).FindFolderForType((int)InventoryType.CallingCard);
575 IInventoryService invService = initiator.Scene.InventoryService;
576 InventoryFolderBase folder = invService.GetFolderForType(toAgentID, AssetType.CallingCard);
577 if (folder != null)
578 {
579 // ... and add the calling card
580 CreateCallingCard(initiator.ControllingClient, fromAgentID, folder.ID, fromName);
581 }
582>>>>>>> master:OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
583 }
584
57 public void AddRegion(Scene scene) 585 public void AddRegion(Scene scene)
58 { 586 {
59 } 587 }
@@ -84,6 +612,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
84 string offerMessage) 612 string offerMessage)
85 { 613 {
86 } 614 }
615 public void FindAgent(IClientAPI remoteClient, UUID hunter, UUID target)
616 {
617 List<FriendListItem> friendList = GetUserFriends(hunter);
618 foreach (FriendListItem item in friendList)
619 {
620 if(item.onlinestatus == true)
621 {
622 if(item.Friend == target && (item.FriendPerms & (uint)FriendRights.CanSeeOnMap) != 0)
623 {
624 ScenePresence SPTarget = ((Scene)remoteClient.Scene).GetScenePresence(target);
625 string regionname = SPTarget.Scene.RegionInfo.RegionName;
626 remoteClient.SendScriptTeleportRequest("FindAgent", regionname,new Vector3(SPTarget.AbsolutePosition),new Vector3(SPTarget.Lookat));
627 }
628 }
629 else
630 {
631 remoteClient.SendAgentAlertMessage("The agent you are looking for is not online.", false);
632 }
633 }
634 }
87 635
88 public List<FriendListItem> GetUserFriends(UUID agentID) 636 public List<FriendListItem> GetUserFriends(UUID agentID)
89 { 637 {
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
index 1b23d92..0c6cb1b 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
@@ -708,5 +708,10 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
708 OSD item = EventQueueHelper.GroupMembership(groupUpdate); 708 OSD item = EventQueueHelper.GroupMembership(groupUpdate);
709 Enqueue(item, avatarID); 709 Enqueue(item, avatarID);
710 } 710 }
711 public void QueryReply(PlacesReplyPacket groupUpdate, UUID avatarID)
712 {
713 OSD item = EventQueueHelper.PlacesQuery(groupUpdate);
714 Enqueue(item, avatarID);
715 }
711 } 716 }
712} 717}
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
index c50318d..67fc8e6 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
@@ -454,6 +454,48 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
454 454
455 return groupUpdate; 455 return groupUpdate;
456 } 456 }
457
458 public static OSD PlacesQuery(PlacesReplyPacket PlacesReply)
459 {
460 OSDMap placesReply = new OSDMap();
461 placesReply.Add("message", OSD.FromString("PlacesReplyMessage"));
462
463 OSDMap body = new OSDMap();
464 OSDArray agentData = new OSDArray();
465 OSDMap agentDataMap = new OSDMap();
466 agentDataMap.Add("AgentID", OSD.FromUUID(PlacesReply.AgentData.AgentID));
467 agentDataMap.Add("QueryID", OSD.FromUUID(PlacesReply.AgentData.QueryID));
468 agentDataMap.Add("TransactionID", OSD.FromUUID(PlacesReply.TransactionData.TransactionID));
469 agentData.Add(agentDataMap);
470 body.Add("AgentData", agentData);
471
472 OSDArray QueryData = new OSDArray();
473
474 foreach (PlacesReplyPacket.QueryDataBlock groupDataBlock in PlacesReply.QueryData)
475 {
476 OSDMap QueryDataMap = new OSDMap();
477 QueryDataMap.Add("ActualArea", OSD.FromInteger(groupDataBlock.ActualArea));
478 QueryDataMap.Add("BillableArea", OSD.FromInteger(groupDataBlock.BillableArea));
479 QueryDataMap.Add("Description", OSD.FromBinary(groupDataBlock.Desc));
480 QueryDataMap.Add("Dwell", OSD.FromInteger((int)groupDataBlock.Dwell));
481 QueryDataMap.Add("Flags", OSD.FromString(Convert.ToString(groupDataBlock.Flags)));
482 QueryDataMap.Add("GlobalX", OSD.FromInteger((int)groupDataBlock.GlobalX));
483 QueryDataMap.Add("GlobalY", OSD.FromInteger((int)groupDataBlock.GlobalY));
484 QueryDataMap.Add("GlobalZ", OSD.FromInteger((int)groupDataBlock.GlobalZ));
485 QueryDataMap.Add("Name", OSD.FromBinary(groupDataBlock.Name));
486 QueryDataMap.Add("OwnerID", OSD.FromUUID(groupDataBlock.OwnerID));
487 QueryDataMap.Add("SimName", OSD.FromBinary(groupDataBlock.SimName));
488 QueryDataMap.Add("SnapShotID", OSD.FromUUID(groupDataBlock.SnapshotID));
489 QueryDataMap.Add("ProductSku", OSD.FromInteger(0));
490 QueryDataMap.Add("Price", OSD.FromInteger(groupDataBlock.Price));
491
492 QueryData.Add(QueryDataMap);
493 }
494 body.Add("QueryData", QueryData);
495 placesReply.Add("QueryData[]", body);
496
497 return placesReply;
498 }
457 499
458 } 500 }
459} 501}
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 89e7747..086103b 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -273,6 +273,26 @@ namespace OpenSim.Region.Examples.SimpleModule
273 public event AvatarInterestUpdate OnAvatarInterestUpdate; 273 public event AvatarInterestUpdate OnAvatarInterestUpdate;
274 274
275 public event PlacesQuery OnPlacesQuery; 275 public event PlacesQuery OnPlacesQuery;
276
277 public event FindAgentUpdate OnFindAgentEvent;
278 public event TrackAgentUpdate OnTrackAgentEvent;
279 public event NewUserReport OnUserReportEvent;
280 public event SaveStateHandler OnSaveStateEvent;
281 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest;
282 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest;
283 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest;
284 public event FreezeUserUpdate OnParcelFreezeUserEvent;
285 public event EjectUserUpdate OnParcelEjectUserEvent;
286 public event ParcelBuyPass OnParcelBuyPass;
287 public event ParcelGodMark OnParcelGodMark;
288 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest;
289 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
290 public event SimWideDeletesDelegate OnSimWideDeletes;
291 public event SendPostcard OnSendPostcard;
292 public event MuteListEntryUpdate OnUpdateMuteListEntryEvent;
293 public event MuteListEntryRemove OnRemoveMuteListEntryEvent;
294 public event GodlikeMessage onGodlikeMessageEvent;
295 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent;
276 296
277#pragma warning restore 67 297#pragma warning restore 67
278 298
@@ -1103,5 +1123,17 @@ namespace OpenSim.Region.Examples.SimpleModule
1103 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages) 1123 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages)
1104 { 1124 {
1105 } 1125 }
1126
1127 public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
1128 {
1129 }
1130
1131 public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier)
1132 {
1133 }
1134
1135 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1136 {
1137 }
1106 } 1138 }
1107} 1139}
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 8b34396..6c2b94a 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -836,6 +836,25 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
836 public event MuteListRequest OnMuteListRequest; 836 public event MuteListRequest OnMuteListRequest;
837 public event AvatarInterestUpdate OnAvatarInterestUpdate; 837 public event AvatarInterestUpdate OnAvatarInterestUpdate;
838 public event PlacesQuery OnPlacesQuery; 838 public event PlacesQuery OnPlacesQuery;
839 public event FindAgentUpdate OnFindAgentEvent;
840 public event TrackAgentUpdate OnTrackAgentEvent;
841 public event NewUserReport OnUserReportEvent;
842 public event SaveStateHandler OnSaveStateEvent;
843 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest;
844 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest;
845 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest;
846 public event FreezeUserUpdate OnParcelFreezeUserEvent;
847 public event EjectUserUpdate OnParcelEjectUserEvent;
848 public event ParcelBuyPass OnParcelBuyPass;
849 public event ParcelGodMark OnParcelGodMark;
850 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest;
851 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
852 public event SimWideDeletesDelegate OnSimWideDeletes;
853 public event SendPostcard OnSendPostcard;
854 public event MuteListEntryUpdate OnUpdateMuteListEntryEvent;
855 public event MuteListEntryRemove OnRemoveMuteListEntryEvent;
856 public event GodlikeMessage onGodlikeMessageEvent;
857 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent;
839 858
840#pragma warning restore 67 859#pragma warning restore 67
841 860
@@ -1628,5 +1647,17 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1628 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages) 1647 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages)
1629 { 1648 {
1630 } 1649 }
1650
1651 public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
1652 {
1653 }
1654
1655 public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier)
1656 {
1657 }
1658
1659 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1660 {
1661 }
1631 } 1662 }
1632} 1663}
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 1573c73..da7f018 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -379,6 +379,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC
379 public event AvatarInterestUpdate OnAvatarInterestUpdate; 379 public event AvatarInterestUpdate OnAvatarInterestUpdate;
380 380
381 public event PlacesQuery OnPlacesQuery; 381 public event PlacesQuery OnPlacesQuery;
382
383 public event FindAgentUpdate OnFindAgentEvent;
384 public event TrackAgentUpdate OnTrackAgentEvent;
385 public event NewUserReport OnUserReportEvent;
386 public event SaveStateHandler OnSaveStateEvent;
387 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest;
388 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest;
389 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest;
390 public event FreezeUserUpdate OnParcelFreezeUserEvent;
391 public event EjectUserUpdate OnParcelEjectUserEvent;
392 public event ParcelBuyPass OnParcelBuyPass;
393 public event ParcelGodMark OnParcelGodMark;
394 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest;
395 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
396 public event SimWideDeletesDelegate OnSimWideDeletes;
397 public event SendPostcard OnSendPostcard;
398 public event MuteListEntryUpdate OnUpdateMuteListEntryEvent;
399 public event MuteListEntryRemove OnRemoveMuteListEntryEvent;
400 public event GodlikeMessage onGodlikeMessageEvent;
401 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdateEvent;
382 402
383#pragma warning restore 67 403#pragma warning restore 67
384 404
@@ -1108,5 +1128,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC
1108 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages) 1128 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages)
1109 { 1129 {
1110 } 1130 }
1131
1132 public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
1133 {
1134 }
1135
1136 public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier)
1137 {
1138 }
1139
1140 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1141 {
1142 }
1111 } 1143 }
1112} 1144}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 9c7604b..5abe4b1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1983,5 +1983,82 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1983 1983
1984 return (int)pws; 1984 return (int)pws;
1985 } 1985 }
1986 public void osSetSpeed(string UUID, float SpeedModifier)
1987 {
1988 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
1989 m_host.AddScriptLPS(1);
1990 ScenePresence avatar = World.GetScenePresence(new UUID(UUID));
1991 avatar.SpeedModifier = SpeedModifier;
1992 }
1993 public void osKickAvatar(string FirstName,string SurName,string alert)
1994 {
1995 CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar");
1996 if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
1997 {
1998 foreach (ScenePresence presence in World.GetAvatars())
1999 {
2000 if ((presence.Firstname == FirstName) &&
2001 presence.Lastname == SurName)
2002 {
2003 // kick client...
2004 if (alert != null)
2005 presence.ControllingClient.Kick(alert);
2006
2007 // ...and close on our side
2008 presence.Scene.IncomingCloseAgent(presence.UUID);
2009 }
2010 }
2011 }
2012 }
2013 public void osCauseDamage(string avatar, double damage)
2014 {
2015 CheckThreatLevel(ThreatLevel.High, "osCauseDamage");
2016 m_host.AddScriptLPS(1);
2017
2018 UUID avatarId = new UUID(avatar);
2019 Vector3 pos = m_host.GetWorldPosition();
2020
2021 ScenePresence presence = World.GetScenePresence(avatarId);
2022 if (presence != null)
2023 {
2024 LandData land = World.GetLandData((float)pos.X, (float)pos.Y);
2025 if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage)
2026 {
2027 float health = presence.Health;
2028 health -= (float)damage;
2029 presence.setHealthWithUpdate(health);
2030 if (health <= 0)
2031 {
2032 float healthliveagain = 100;
2033 presence.ControllingClient.SendAgentAlertMessage("You died!", true);
2034 presence.setHealthWithUpdate(healthliveagain);
2035 presence.Scene.TeleportClientHome(presence.UUID, presence.ControllingClient);
2036 }
2037 }
2038 }
2039 }
2040 public void osCauseHealing(string avatar, double healing)
2041 {
2042 CheckThreatLevel(ThreatLevel.High, "osCauseHealing");
2043 m_host.AddScriptLPS(1);
2044
2045 UUID avatarId = new UUID(avatar);
2046 ScenePresence presence = World.GetScenePresence(avatarId);
2047 Vector3 pos = m_host.GetWorldPosition();
2048 bool result = World.ScriptDanger(m_host.LocalId, new Vector3((float)pos.X, (float)pos.Y, (float)pos.Z));
2049 if (result)
2050 {
2051 if (presence != null)
2052 {
2053 float health = presence.Health;
2054 health += (float)healing;
2055 if (health >= 100)
2056 {
2057 health = 100;
2058 }
2059 presence.setHealthWithUpdate(health);
2060 }
2061 }
2062 }
1986 } 2063 }
1987} 2064}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 580c354..ac9405e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -165,5 +165,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
165 LSL_List osGetRegionStats(); 165 LSL_List osGetRegionStats();
166 166
167 int osGetSimulatorMemory(); 167 int osGetSimulatorMemory();
168 void osKickAvatar(string FirstName,string SurName,string alert);
169 void osSetSpeed(string UUID, float SpeedModifier);
170 void osCauseHealing(string avatar, double healing);
171 void osCauseDamage(string avatar, double damage);
168 } 172 }
169} 173}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 2876ad6..2ec6226 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -647,5 +647,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
647 { 647 {
648 return m_OSSL_Functions.osGetSimulatorMemory(); 648 return m_OSSL_Functions.osGetSimulatorMemory();
649 } 649 }
650 public void osKickAvatar(string FirstName,string SurName,string alert)
651 {
652 m_OSSL_Functions.osKickAvatar( FirstName, SurName, alert);
653 }
654 public void osSetSpeed(string UUID, float SpeedModifier)
655 {
656 m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier);
657 }
658 public void osCauseDamage(string avatar, double damage)
659 {
660 m_OSSL_Functions.osCauseDamage(avatar, damage);
661 }
662 public void osCauseHealing(string avatar, double healing)
663 {
664 m_OSSL_Functions.osCauseHealing(avatar, healing);
665 }
650 } 666 }
651} 667}