From 7c7ea57c5c2bf01280e2df03cedc999aa5e7be87 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 9 Jan 2009 02:59:56 +0000 Subject: [PATCH] Finish dwell sending, adding the forgotten method body. Add UserInfo and a dummy reply to enable Hippo Viewer users to disable IM logging (option was greyed out in OpenSim before) --- OpenSim/Framework/IClientAPI.cs | 9 ++- .../ClientStack/LindenUDP/LLClientView.cs | 65 +++++++++++++++++-- .../Modules/World/NPC/NPCAvatar.cs | 8 ++- .../Examples/SimpleModule/MyNpcCharacter.cs | 7 +- OpenSim/Tests/Common/Mock/TestClient.cs | 8 ++- 5 files changed, 88 insertions(+), 9 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index cb4af3708b..cb60028a53 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -424,6 +424,9 @@ namespace OpenSim.Framework public delegate void ParcelDwellRequest(int localID, IClientAPI client); + public delegate void UserInfoRequest(IClientAPI client); + public delegate void UpdateUserInfo(bool imViaEmail, bool visible, IClientAPI client); + #endregion public struct DirPlacesReplyData @@ -577,7 +580,6 @@ namespace OpenSim.Framework event AddNewPrim OnAddPrim; event FetchInventory OnAgentDataUpdateRequest; - event FetchInventory OnUserInfoRequest; event TeleportLocationRequest OnSetStartLocationRequest; event RequestGodlikePowers OnRequestGodlikePowers; @@ -745,6 +747,9 @@ namespace OpenSim.Framework event ParcelDwellRequest OnParcelDwellRequest; + event UserInfoRequest OnUserInfoRequest; + event UpdateUserInfo OnUpdateUserInfo; + // void ActivateGesture(UUID assetId, UUID gestureId); /// @@ -1088,6 +1093,8 @@ namespace OpenSim.Framework void SendParcelDwellReply(int localID, UUID parcelID, float dwell); + void SendUserInfoReply(bool imViaEmail, bool visible, string email); + void KillEndDone(); bool AddGenericPacketHandler(string MethodName, GenericMessage handler); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7398c70b0d..c88e6b5b53 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -147,7 +147,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP private AgentSit handlerAgentSit; //OnAgentSit; private AvatarPickerRequest handlerAvatarPickerRequest; //OnAvatarPickerRequest; private FetchInventory handlerAgentDataUpdateRequest; //OnAgentDataUpdateRequest; - private FetchInventory handlerUserInfoRequest; //OnUserInfoRequest; private TeleportLocationRequest handlerSetStartLocationRequest; //OnSetStartLocationRequest; private TeleportLandmarkRequest handlerTeleportLandmarkRequest; //OnTeleportLandmarkRequest; private LinkObjects handlerLinkObjects; //OnLinkObjects; @@ -288,6 +287,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private ParcelDwellRequest handlerParcelDwellRequest; + private UserInfoRequest handlerUserInfoRequest; + private UpdateUserInfo handlerUpdateUserInfo; + private readonly IGroupsModule m_GroupsModule; //private TerrainUnacked handlerUnackedTerrain = null; @@ -939,7 +941,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event RequestAvatarProperties OnRequestAvatarProperties; public event SetAlwaysRun OnSetAlwaysRun; public event FetchInventory OnAgentDataUpdateRequest; - public event FetchInventory OnUserInfoRequest; public event TeleportLocationRequest OnSetStartLocationRequest; public event UpdateAvatarProperties OnUpdateAvatarProperties; public event CreateNewInventoryItem OnCreateNewInventoryItem; @@ -1060,6 +1061,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event ParcelDwellRequest OnParcelDwellRequest; + public event UserInfoRequest OnUserInfoRequest; + public event UpdateUserInfo OnUpdateUserInfo; + public void ActivateGesture(UUID assetId, UUID gestureId) { } @@ -4680,15 +4684,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP break; case PacketType.UserInfoRequest: - UserInfoRequestPacket avUserInfoRequestPacket = (UserInfoRequestPacket)Pack; - handlerUserInfoRequest = OnUserInfoRequest; if (handlerUserInfoRequest != null) { - handlerUserInfoRequest(this, avUserInfoRequestPacket.AgentData.AgentID, avUserInfoRequestPacket.AgentData.SessionID); + handlerUserInfoRequest(this); + } + else + { + SendUserInfoReply(false, true, ""); } break; + case PacketType.UpdateUserInfo: + UpdateUserInfoPacket updateUserInfo = (UpdateUserInfoPacket)Pack; + handlerUpdateUserInfo = OnUpdateUserInfo; + if (handlerUpdateUserInfo != null) + { + bool visible = true; + string DirectoryVisibility = + Utils.BytesToString(updateUserInfo.UserData.DirectoryVisibility); + if (DirectoryVisibility == "hidden") + visible = false; + handlerUpdateUserInfo( + updateUserInfo.UserData.IMViaEMail, + visible, this); + } + break; case PacketType.SetStartLocationRequest: SetStartLocationRequestPacket avSetStartLocationRequestPacket = (SetStartLocationRequestPacket)Pack; @@ -8302,6 +8323,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendParcelDwellReply(int localID, UUID parcelID, float dwell) { + ParcelDwellReplyPacket pd = + (ParcelDwellReplyPacket)PacketPool.Instance.GetPacket( + PacketType.ParcelDwellReply); + + pd.AgentData = new ParcelDwellReplyPacket.AgentDataBlock(); + pd.AgentData.AgentID = AgentId; + + pd.Data = new ParcelDwellReplyPacket.DataBlock(); + pd.Data.LocalID = localID; + pd.Data.ParcelID = parcelID; + pd.Data.Dwell = dwell; + + OutPacket(pd, ThrottleOutPacketType.Land); + } + + public void SendUserInfoReply(bool imViaEmail, bool visible, string email) + { + UserInfoReplyPacket ur = + (UserInfoReplyPacket)PacketPool.Instance.GetPacket( + PacketType.UserInfoReply); + + string Visible = "hidden"; + if (visible) + Visible = "default"; + + ur.AgentData = new UserInfoReplyPacket.AgentDataBlock(); + ur.AgentData.AgentID = AgentId; + + ur.UserData = new UserInfoReplyPacket.UserDataBlock(); + ur.UserData.IMViaEMail = imViaEmail; + ur.UserData.DirectoryVisibility = Utils.StringToBytes(Visible); + ur.UserData.EMail = Utils.StringToBytes(email); + + OutPacket(ur, ThrottleOutPacketType.Task); } public void KillEndDone() diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 2b91391475..d06f35ac6e 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -204,7 +204,6 @@ namespace OpenSim.Region.Environment.Modules.World.NPC public event ViewerEffectEventHandler OnViewerEffect; public event FetchInventory OnAgentDataUpdateRequest; - public event FetchInventory OnUserInfoRequest; public event TeleportLocationRequest OnSetStartLocationRequest; public event UpdateShape OnUpdatePrimShape; @@ -357,6 +356,9 @@ namespace OpenSim.Region.Environment.Modules.World.NPC public event ParcelDwellRequest OnParcelDwellRequest; + public event UserInfoRequest OnUserInfoRequest; + public event UpdateUserInfo OnUpdateUserInfo; + #pragma warning restore 67 #endregion @@ -1045,6 +1047,10 @@ namespace OpenSim.Region.Environment.Modules.World.NPC { } + public void SendUserInfoReply(bool imViaEmail, bool visible, string email) + { + } + #endregion } } diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 8cfaf883a9..5a7d42cd4a 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -98,7 +98,6 @@ namespace OpenSim.Region.Examples.SimpleModule public event ViewerEffectEventHandler OnViewerEffect; public event FetchInventory OnAgentDataUpdateRequest; - public event FetchInventory OnUserInfoRequest; public event TeleportLocationRequest OnSetStartLocationRequest; public event UpdateShape OnUpdatePrimShape; @@ -251,6 +250,8 @@ namespace OpenSim.Region.Examples.SimpleModule public event EventGodDelete OnEventGodDelete; public event ParcelDwellRequest OnParcelDwellRequest; + public event UserInfoRequest OnUserInfoRequest; + public event UpdateUserInfo OnUpdateUserInfo; #pragma warning restore 67 @@ -1046,6 +1047,10 @@ namespace OpenSim.Region.Examples.SimpleModule { } + public void SendUserInfoReply(bool imViaEmail, bool visible, string email) + { + } + #endregion } } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 83bd9d92a1..b5d6f6b311 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -93,7 +93,6 @@ namespace OpenSim.Tests.Common.Mock public event ViewerEffectEventHandler OnViewerEffect; public event FetchInventory OnAgentDataUpdateRequest; - public event FetchInventory OnUserInfoRequest; public event TeleportLocationRequest OnSetStartLocationRequest; public event UpdateShape OnUpdatePrimShape; @@ -248,6 +247,9 @@ namespace OpenSim.Tests.Common.Mock public event ParcelDwellRequest OnParcelDwellRequest; + public event UserInfoRequest OnUserInfoRequest; + public event UpdateUserInfo OnUpdateUserInfo; + #pragma warning restore 67 /// @@ -991,5 +993,9 @@ namespace OpenSim.Tests.Common.Mock public void SendParcelDwellReply(int localID, UUID parcelID, float dwell) { } + + public void SendUserInfoReply(bool imViaEmail, bool visible, string email) + { + } } }