diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index b3f0a2516a..4d74b2a0a0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -489,7 +489,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends im.imSessionID = im.fromAgentID; // Try the local sim - UserAccount account = UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, agentID); + UserAccount account = UserAccountService.GetUserAccount(UUID.Zero, agentID); im.fromAgentName = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName; if (LocalFriendshipOffered(friendID, im)) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs index 496f2abdfb..1b53a42dec 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs @@ -116,7 +116,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (!UUID.TryParse(request["ToID"].ToString(), out toID)) return FailureResult(); - UserAccount account = m_FriendsModule.UserAccountService.GetUserAccount(m_FriendsModule.Scene.RegionInfo.ScopeID, fromID); + UserAccount account = m_FriendsModule.UserAccountService.GetUserAccount(UUID.Zero, fromID); string name = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName; GridInstantMessage im = new GridInstantMessage(m_FriendsModule.Scene, fromID, name, toID, diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index a3251aae58..e5cefe4e92 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1515,7 +1515,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // If we fail to cross the border, then reset the position of the scene object on that border. uint x = 0, y = 0; Utils.LongToUInts(newRegionHandle, out x, out y); - GridRegion destination = scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); + GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent)) { grp.OffsetForNewRegion(oldGroupPosition); diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index bf84100ef5..4cc6905a0f 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -183,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement return returnstring; } - UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid); + UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, uuid); if (account != null) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs index 23251c9b1c..fcc69e949f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs @@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Server.Base; using OpenSim.Server.Handlers.Base; using OpenSim.Services.Interfaces; +using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land @@ -121,7 +122,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land #region ILandService - public LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess) + public LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess) { m_log.DebugFormat("[LAND IN CONNECTOR]: GetLandData for {0}. Count = {1}", regionHandle, m_Scenes.Count); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs index e15f624d70..86c0b85891 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs @@ -35,6 +35,7 @@ using OpenSim.Server.Base; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; +using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land { @@ -116,7 +117,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land #region ILandService - public LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess) + public LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess) { regionAccess = 2; m_log.DebugFormat("[LAND CONNECTOR]: request for land data in {0} at {1}, {2}", diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs index 252d9e7286..766ef81ea1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs @@ -36,6 +36,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using OpenSim.Server.Base; +using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land @@ -109,13 +110,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land #region ILandService - public override LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess) + public override LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess) { - LandData land = m_LocalService.GetLandData(regionHandle, x, y, out regionAccess); + LandData land = m_LocalService.GetLandData(scopeID, regionHandle, x, y, out regionAccess); if (land != null) return land; - return base.GetLandData(regionHandle, x, y, out regionAccess); + return base.GetLandData(scopeID, regionHandle, x, y, out regionAccess); } #endregion ILandService diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index ac4705c222..4f8e2059e5 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -1510,40 +1510,40 @@ namespace OpenSim.Region.CoreModules.World.Land if (parcelID == UUID.Zero) return; - ExtendedLandData data = - (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(), - delegate(string id) - { - UUID parcel = UUID.Zero; - UUID.TryParse(id, out parcel); - // assume we've got the parcelID we just computed in RemoteParcelRequest - ExtendedLandData extLandData = new ExtendedLandData(); - Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, - out extLandData.X, out extLandData.Y); - m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", - extLandData.RegionHandle, extLandData.X, extLandData.Y); + ExtendedLandData data = (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(), + delegate(string id) + { + UUID parcel = UUID.Zero; + UUID.TryParse(id, out parcel); + // assume we've got the parcelID we just computed in RemoteParcelRequest + ExtendedLandData extLandData = new ExtendedLandData(); + Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, + out extLandData.X, out extLandData.Y); + m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", + extLandData.RegionHandle, extLandData.X, extLandData.Y); - // for this region or for somewhere else? - if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle) - { - extLandData.LandData = this.GetLandObject(extLandData.X, extLandData.Y).LandData; - extLandData.RegionAccess = m_scene.RegionInfo.AccessLevel; - } - else - { - ILandService landService = m_scene.RequestModuleInterface(); - extLandData.LandData = landService.GetLandData(extLandData.RegionHandle, - extLandData.X, - extLandData.Y, - out extLandData.RegionAccess); - if (extLandData.LandData == null) - { - // we didn't find the region/land => don't cache - return null; - } - } - return extLandData; - }); + // for this region or for somewhere else? + if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle) + { + extLandData.LandData = this.GetLandObject(extLandData.X, extLandData.Y).LandData; + extLandData.RegionAccess = m_scene.RegionInfo.AccessLevel; + } + else + { + ILandService landService = m_scene.RequestModuleInterface(); + extLandData.LandData = landService.GetLandData(m_scene.RegionInfo.ScopeID, + extLandData.RegionHandle, + extLandData.X, + extLandData.Y, + out extLandData.RegionAccess); + if (extLandData.LandData == null) + { + // we didn't find the region/land => don't cache + return null; + } + } + return extLandData; + }); if (data != null) // if we found some data, send it { @@ -1557,7 +1557,7 @@ namespace OpenSim.Region.CoreModules.World.Land // most likely still cached from building the extLandData entry uint x = 0, y = 0; Utils.LongToUInts(data.RegionHandle, out x, out y); - info = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); + info = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); } // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark. m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...", diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 66439ab29d..e1fedf4bd0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -43,6 +43,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate bool PropagatePermissionsHandler(); public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene); public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene); + public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene); public delegate bool TakeObjectHandler(UUID objectID, UUID stealer, Scene scene); public delegate bool TakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene); public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition); @@ -80,10 +81,12 @@ namespace OpenSim.Region.Framework.Scenes public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID); public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); + public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); public delegate bool CreateUserInventoryHandler(int invType, UUID userID); public delegate bool EditUserInventoryHandler(UUID itemID, UUID userID); public delegate bool CopyUserInventoryHandler(UUID itemID, UUID userID); public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID); + public delegate bool TransferUserInventoryHandler(UUID itemID, UUID userID, UUID recipientID); public delegate bool TeleportHandler(UUID userID, Scene scene); public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face); public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face); @@ -107,6 +110,7 @@ namespace OpenSim.Region.Framework.Scenes public event PropagatePermissionsHandler OnPropagatePermissions; public event RezObjectHandler OnRezObject; public event DeleteObjectHandler OnDeleteObject; + public event TransferObjectHandler OnTransferObject; public event TakeObjectHandler OnTakeObject; public event TakeCopyObjectHandler OnTakeCopyObject; public event DuplicateObjectHandler OnDuplicateObject; @@ -144,10 +148,12 @@ namespace OpenSim.Region.Framework.Scenes public event CreateObjectInventoryHandler OnCreateObjectInventory; public event CopyObjectInventoryHandler OnCopyObjectInventory; public event DeleteObjectInventoryHandler OnDeleteObjectInventory; + public event TransferObjectInventoryHandler OnTransferObjectInventory; public event CreateUserInventoryHandler OnCreateUserInventory; public event EditUserInventoryHandler OnEditUserInventory; public event CopyUserInventoryHandler OnCopyUserInventory; public event DeleteUserInventoryHandler OnDeleteUserInventory; + public event TransferUserInventoryHandler OnTransferUserInventory; public event TeleportHandler OnTeleport; public event ControlPrimMediaHandler OnControlPrimMedia; public event InteractWithPrimMediaHandler OnInteractWithPrimMedia; @@ -264,10 +270,27 @@ namespace OpenSim.Region.Framework.Scenes } } -// m_log.DebugFormat( -// "[SCENE PERMISSIONS]: CanDeleteObject() fired for object {0}, deleter {1}, result {2}", -// objectID, deleter, result); - + return result; + } + + public bool CanTransferObject(UUID objectID, UUID recipient) + { + bool result = true; + + TransferObjectHandler handler = OnTransferObject; + if (handler != null) + { + Delegate[] list = handler.GetInvocationList(); + foreach (TransferObjectHandler h in list) + { + if (h(objectID, recipient, m_scene) == false) + { + result = false; + break; + } + } + } + return result; } @@ -917,6 +940,21 @@ namespace OpenSim.Region.Framework.Scenes return true; } + public bool CanTransferObjectInventory(UUID itemID, UUID objectID, UUID userID) + { + TransferObjectInventoryHandler handler = OnTransferObjectInventory; + if (handler != null) + { + Delegate[] list = handler.GetInvocationList(); + foreach (TransferObjectInventoryHandler h in list) + { + if (h(itemID, objectID, userID) == false) + return false; + } + } + return true; + } + /// /// Check whether the specified user is allowed to create the given inventory type in their inventory. /// @@ -1001,6 +1039,21 @@ namespace OpenSim.Region.Framework.Scenes return true; } + public bool CanTransferUserInventory(UUID itemID, UUID userID, UUID recipientID) + { + TransferUserInventoryHandler handler = OnTransferUserInventory; + if (handler != null) + { + Delegate[] list = handler.GetInvocationList(); + foreach (TransferUserInventoryHandler h in list) + { + if (h(itemID, userID, recipientID) == false) + return false; + } + } + return true; + } + public bool CanTeleport(UUID userID) { TeleportHandler handler = OnTeleport; diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 88e084eecd..69ebe9efde 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -193,7 +193,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, ulong regionHandle); + public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, UUID scopeID, ulong regionHandle); /// /// This informs all neighboring regions about the settings of it's child agent. @@ -202,7 +202,7 @@ namespace OpenSim.Region.Framework.Scenes /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. /// /// - private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, ulong regionHandle) + private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, UUID scopeID, ulong regionHandle) { //m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName); try @@ -245,7 +245,7 @@ namespace OpenSim.Region.Framework.Scenes if (regionHandle != m_regionInfo.RegionHandle) { SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; - d.BeginInvoke(cAgentData, regionHandle, + d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, regionHandle, SendChildAgentDataUpdateCompleted, d); } @@ -273,7 +273,7 @@ namespace OpenSim.Region.Framework.Scenes //m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID); uint x = 0, y = 0; Utils.LongToUInts(regionHandle, out x, out y); - GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); + GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y); m_scene.SimulationService.CloseAgent(destination, agentID); } diff --git a/OpenSim/Server/Handlers/Land/LandHandlers.cs b/OpenSim/Server/Handlers/Land/LandHandlers.cs index 561f285a4b..b45289a788 100644 --- a/OpenSim/Server/Handlers/Land/LandHandlers.cs +++ b/OpenSim/Server/Handlers/Land/LandHandlers.cs @@ -67,7 +67,7 @@ namespace OpenSim.Server.Handlers.Land m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle); byte regionAccess; - LandData landData = m_LocalService.GetLandData(regionHandle, x, y, out regionAccess); + LandData landData = m_LocalService.GetLandData(UUID.Zero, regionHandle, x, y, out regionAccess); Hashtable hash = new Hashtable(); if (landData != null) { diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs index 4b25ac819a..252f7a1d16 100644 --- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs @@ -64,7 +64,7 @@ namespace OpenSim.Services.Connectors m_GridService = gridServices; } - public virtual LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess) + public virtual LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess) { LandData landData = null; Hashtable hash = new Hashtable(); @@ -80,7 +80,7 @@ namespace OpenSim.Services.Connectors { uint xpos = 0, ypos = 0; Utils.LongToUInts(regionHandle, out xpos, out ypos); - GridRegion info = m_GridService.GetRegionByPosition(UUID.Zero, (int)xpos, (int)ypos); + GridRegion info = m_GridService.GetRegionByPosition(scopeID, (int)xpos, (int)ypos); if (info != null) // just to be sure { XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs index 93da10eeab..9e444c49bc 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs @@ -71,7 +71,7 @@ namespace OpenSim.Services.Connectors { uint x = 0, y = 0; Utils.LongToUInts(regionHandle, out x, out y); - GridRegion regInfo = m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); + GridRegion regInfo = m_GridService.GetRegionByPosition(thisRegion.ScopeID, (int)x, (int)y); if ((regInfo != null) && // Don't remote-call this instance; that's a startup hickup !((regInfo.ExternalHostName == thisRegion.ExternalHostName) && (regInfo.HttpPort == thisRegion.HttpPort))) diff --git a/OpenSim/Services/Interfaces/ILandService.cs b/OpenSim/Services/Interfaces/ILandService.cs index 7a12aff951..63d9a271c3 100644 --- a/OpenSim/Services/Interfaces/ILandService.cs +++ b/OpenSim/Services/Interfaces/ILandService.cs @@ -33,6 +33,6 @@ namespace OpenSim.Services.Interfaces { public interface ILandService { - LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess); + LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess); } }