diff --git a/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs index d7af1f29a0..9f2aed08a0 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs @@ -71,7 +71,6 @@ namespace OpenSim.Region.ClientStack.Linden return; m_URL = config.GetString("Cap_AvatarPickerSearch", string.Empty); - m_log.DebugFormat("[XXX]: Cap_AvatarPickerSearch = {0}", m_URL); // Cap doesn't exist if (m_URL != string.Empty) m_Enabled = true; diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index b4f7d51e46..317dfd812f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -74,6 +74,7 @@ namespace OpenSim.Region.CoreModules.World.Land protected IUserManagement m_userManager; protected IPrimCountModule m_primCountModule; + protected IDialogModule m_Dialog; // Minimum for parcels to work is 64m even if we don't actually use them. #pragma warning disable 0429 @@ -161,6 +162,7 @@ namespace OpenSim.Region.CoreModules.World.Land { m_userManager = m_scene.RequestModuleInterface(); m_primCountModule = m_scene.RequestModuleInterface(); + m_Dialog = m_scene.RequestModuleInterface(); } public void RemoveRegion(Scene scene) @@ -213,6 +215,7 @@ namespace OpenSim.Region.CoreModules.World.Land client.OnPreAgentUpdate += ClientOnPreAgentUpdate; client.OnParcelEjectUser += ClientOnParcelEjectUser; client.OnParcelFreezeUser += ClientOnParcelFreezeUser; + client.OnSetStartLocationRequest += ClientOnSetHome; EntityBase presenceEntity; if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) @@ -1894,7 +1897,53 @@ namespace OpenSim.Region.CoreModules.World.Land land.LandData.ParcelAccessList.Add(entry); } } - + + /// + /// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in + /// + /// + /// + /// + /// + /// + public virtual void ClientOnSetHome(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) + { + // Let's find the parcel in question + ILandObject land = landChannel.GetLandObject(position); + if (land == null || m_scene.GridUserService == null) + { + m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed."); + return; + } + + // Gather some data + ulong gpowers = remoteClient.GetGroupPowers(land.LandData.GroupID); + SceneObjectGroup telehub = null; + if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero) + // Does the telehub exist in the scene? + telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); + + // Can the user set home here? + if (// (a) gods and land managers can set home + m_scene.Permissions.IsAdministrator(remoteClient.AgentId) || + m_scene.Permissions.IsGod(remoteClient.AgentId) || + // (b) land owners can set home + remoteClient.AgentId == land.LandData.OwnerID || + // (c) members of the land-associated group in roles that can set home + ((gpowers & (ulong)GroupPowers.AllowSetHome) == (ulong)GroupPowers.AllowSetHome) || + // (d) parcels with telehubs can be the home of anyone + (telehub != null && land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y))) + { + if (m_scene.GridUserService.SetHome(remoteClient.AgentId.ToString(), land.RegionUUID, position, lookAt)) + // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. + m_Dialog.SendAlertToUser(remoteClient, "Home position set."); + else + m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed."); + } + else + m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel."); + } + protected void InstallInterfaces() { Command clearCommand diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 07d00c091e..31f8a3fd92 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -249,13 +249,6 @@ namespace OpenSim.Region.CoreModules.World.Land if (estateModule != null) regionFlags = estateModule.GetRegionFlags(); - // In a perfect world, this would have worked. - // -// if ((landData.Flags & (uint)ParcelFlags.AllowLandmark) != 0) -// regionFlags |= (uint)RegionFlags.AllowLandmark; -// if (landData.OwnerID == remote_client.AgentId) -// regionFlags |= (uint)RegionFlags.AllowSetHome; - int seq_id; if (snap_selection && (sequence_id == 0)) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1023e258ab..3aabd14d25 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3246,7 +3246,6 @@ namespace OpenSim.Region.Framework.Scenes { //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; - client.OnSetStartLocationRequest += SetHomeRezPoint; client.OnRegionHandleRequest += RegionHandleRequest; } @@ -3373,7 +3372,6 @@ namespace OpenSim.Region.Framework.Scenes { //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; - client.OnSetStartLocationRequest -= SetHomeRezPoint; client.OnRegionHandleRequest -= RegionHandleRequest; } @@ -3499,33 +3497,6 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in - /// - /// - /// - /// - /// - /// - public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) - { - //Add half the avatar's height so that the user doesn't fall through prims - ScenePresence presence; - if (TryGetScenePresence(remoteClient.AgentId, out presence)) - { - if (presence.Appearance != null) - { - position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); - } - } - - if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) - // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. - m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); - else - m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed."); - } - /// /// Get the avatar apperance for the given client. ///