diff --git a/.nant/local.include b/.nant/local.include index 97c0c0fb56..b11c1e58c8 100644 --- a/.nant/local.include +++ b/.nant/local.include @@ -128,6 +128,11 @@ + + + + + @@ -201,6 +206,17 @@ + + + + + + + + + + + @@ -298,6 +314,11 @@ + + + + + @@ -314,6 +335,7 @@ + @@ -338,6 +360,7 @@ + diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 027f9c54b1..b9c932339e 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -174,9 +174,10 @@ namespace OpenSim.Framework public delegate void ParcelAccessListRequest( UUID agentID, UUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client); - public delegate void ParcelAccessListUpdateRequest( - UUID agentID, UUID sessionID, uint flags, int landLocalID, List entries, - IClientAPI remote_client); + public delegate void ParcelAccessListUpdateRequest(UUID agentID, uint flags, + int landLocalID, UUID transactionID, int sequenceID, + int sections, List entries, + IClientAPI remote_client); public delegate void ParcelPropertiesRequest( int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client); diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 3c58a7d4d8..3343f608a5 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1845,7 +1845,7 @@ namespace OpenSim.Framework.Servers.HttpServer /// property in StartHttp() for the HttpListener public class HttpServerLogWriter : ILogWriter { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public void Write(object source, LogPrio priority, string message) { diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index ae2d836a94..c2dd84cf77 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -265,10 +265,11 @@ namespace OpenSim LoadOar); m_console.Commands.AddCommand("region", false, "save oar", - "save oar [-v|--version=] [-p|--profile=] []", + //"save oar [-v|--version=] [-p|--profile=] []", + "save oar [-p|--profile=] []", "Save a region's data to an OAR archive.", - "-v|--version= generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine - + "-p|--profile= adds the url of the profile service to the saved user information" + Environment.NewLine +// "-v|--version= generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine + "-p|--profile= adds the url of the profile service to the saved user information" + Environment.NewLine + "The OAR path must be a filesystem path." + " If this is not given then the oar is saved to region.oar in the current directory.", SaveOar); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index f125822604..2a59a0c1ad 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3553,111 +3553,114 @@ namespace OpenSim.Region.ClientStack.LindenUDP OpenSim.Framework.Lazy> objectUpdateBlocks = new OpenSim.Framework.Lazy>(); OpenSim.Framework.Lazy> compressedUpdateBlocks = new OpenSim.Framework.Lazy>(); OpenSim.Framework.Lazy> terseUpdateBlocks = new OpenSim.Framework.Lazy>(); + OpenSim.Framework.Lazy> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy>(); if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; int updatesThisCall = 0; - lock (m_entityUpdates.SyncRoot) + EntityUpdate update; + while (updatesThisCall < maxUpdates) { - EntityUpdate update; - while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update)) - { - if (update.Entity is SceneObjectPart) - { - SceneObjectPart part = (SceneObjectPart)update.Entity; + lock (m_entityUpdates.SyncRoot) + if (!m_entityUpdates.TryDequeue(out update)) + break; - // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client - // will never receive an update after a prim kill. Even then, keeping the kill record may be a good - // safety measure. - // - // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update - // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs - // updates and kills on different threads with different scheduling strategies, hence this protection. - // - // This doesn't appear to apply to child prims - a client will happily ignore these updates - // after the root prim has been deleted. - if (m_killRecord.Contains(part.LocalId)) - { - // m_log.WarnFormat( - // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted", - // part.LocalId, Name); - continue; - } + if (update.Entity is SceneObjectPart) + { + SceneObjectPart part = (SceneObjectPart)update.Entity; + + // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client + // will never receive an update after a prim kill. Even then, keeping the kill record may be a good + // safety measure. + // + // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update + // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs + // updates and kills on different threads with different scheduling strategies, hence this protection. + // + // This doesn't appear to apply to child prims - a client will happily ignore these updates + // after the root prim has been deleted. + if (m_killRecord.Contains(part.LocalId)) + { + // m_log.WarnFormat( + // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted", + // part.LocalId, Name); + continue; + } - if (part.ParentGroup.IsAttachment && m_disableFacelights) + if (part.ParentGroup.IsAttachment && m_disableFacelights) + { + if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && + part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) { - if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && - part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) - { - part.Shape.LightEntry = false; - } + part.Shape.LightEntry = false; } } + } - ++updatesThisCall; + ++updatesThisCall; - #region UpdateFlags to packet type conversion + #region UpdateFlags to packet type conversion - PrimUpdateFlags updateFlags = update.Flags; + PrimUpdateFlags updateFlags = update.Flags; - bool canUseCompressed = true; - bool canUseImproved = true; + bool canUseCompressed = true; + bool canUseImproved = true; - // Compressed object updates only make sense for LL primitives - if (!(update.Entity is SceneObjectPart)) + // Compressed object updates only make sense for LL primitives + if (!(update.Entity is SceneObjectPart)) + { + canUseCompressed = false; + } + + if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) + { + canUseCompressed = false; + canUseImproved = false; + } + else + { + if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || + updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || + updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || + updateFlags.HasFlag(PrimUpdateFlags.Joint)) { canUseCompressed = false; } - if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) + if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || + updateFlags.HasFlag(PrimUpdateFlags.ParentID) || + updateFlags.HasFlag(PrimUpdateFlags.Scale) || + updateFlags.HasFlag(PrimUpdateFlags.PrimData) || + updateFlags.HasFlag(PrimUpdateFlags.Text) || + updateFlags.HasFlag(PrimUpdateFlags.NameValue) || + updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || + updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || + updateFlags.HasFlag(PrimUpdateFlags.Sound) || + updateFlags.HasFlag(PrimUpdateFlags.Particles) || + updateFlags.HasFlag(PrimUpdateFlags.Material) || + updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || + updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || + updateFlags.HasFlag(PrimUpdateFlags.Joint)) { - canUseCompressed = false; canUseImproved = false; } + } + + #endregion UpdateFlags to packet type conversion + + #region Block Construction + + // TODO: Remove this once we can build compressed updates + canUseCompressed = false; + + if (!canUseImproved && !canUseCompressed) + { + if (update.Entity is ScenePresence) + { + objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); + } else { - if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || - updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || - updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || - updateFlags.HasFlag(PrimUpdateFlags.Joint)) - { - canUseCompressed = false; - } - - if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || - updateFlags.HasFlag(PrimUpdateFlags.ParentID) || - updateFlags.HasFlag(PrimUpdateFlags.Scale) || - updateFlags.HasFlag(PrimUpdateFlags.PrimData) || - updateFlags.HasFlag(PrimUpdateFlags.Text) || - updateFlags.HasFlag(PrimUpdateFlags.NameValue) || - updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || - updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || - updateFlags.HasFlag(PrimUpdateFlags.Sound) || - updateFlags.HasFlag(PrimUpdateFlags.Particles) || - updateFlags.HasFlag(PrimUpdateFlags.Material) || - updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || - updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || - updateFlags.HasFlag(PrimUpdateFlags.Joint)) - { - canUseImproved = false; - } - } - - #endregion UpdateFlags to packet type conversion - - #region Block Construction - - // TODO: Remove this once we can build compressed updates - canUseCompressed = false; - - if (!canUseImproved && !canUseCompressed) - { - if (update.Entity is ScenePresence) - { - objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); - } - else - { // if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment) // { // SceneObjectPart sop = (SceneObjectPart)update.Entity; @@ -3686,71 +3689,90 @@ namespace OpenSim.Region.ClientStack.LindenUDP // } // else // { - objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); + objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); // } - } - } - else if (!canUseImproved) - { - compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); } + } + else if (!canUseImproved) + { + compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); + } + else + { + if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) + // Self updates go into a special list + terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); else - { + // Everything else goes here terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); - } - - #endregion Block Construction } - #region Packet Sending + #endregion Block Construction + } + + #region Packet Sending - const float TIME_DILATION = 1.0f; - ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); + const float TIME_DILATION = 1.0f; + ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); + + if (terseAgentUpdateBlocks.IsValueCreated) + { + List blocks = terseAgentUpdateBlocks.Value; + + ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = timeDilation; + packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; + + for (int i = 0; i < blocks.Count; i++) + packet.ObjectData[i] = blocks[i]; + + OutPacket(packet, ThrottleOutPacketType.Unknown, true); + } + + if (objectUpdateBlocks.IsValueCreated) + { + List blocks = objectUpdateBlocks.Value; - if (objectUpdateBlocks.IsValueCreated) - { - List blocks = objectUpdateBlocks.Value; + ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = timeDilation; + packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; - ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = timeDilation; - packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; + for (int i = 0; i < blocks.Count; i++) + packet.ObjectData[i] = blocks[i]; - for (int i = 0; i < blocks.Count; i++) - packet.ObjectData[i] = blocks[i]; + OutPacket(packet, ThrottleOutPacketType.Task, true); + } - OutPacket(packet, ThrottleOutPacketType.Task, true); - } + if (compressedUpdateBlocks.IsValueCreated) + { + List blocks = compressedUpdateBlocks.Value; - if (compressedUpdateBlocks.IsValueCreated) - { - List blocks = compressedUpdateBlocks.Value; + ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = timeDilation; + packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; - ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = timeDilation; - packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; + for (int i = 0; i < blocks.Count; i++) + packet.ObjectData[i] = blocks[i]; - for (int i = 0; i < blocks.Count; i++) - packet.ObjectData[i] = blocks[i]; + OutPacket(packet, ThrottleOutPacketType.Task, true); + } - OutPacket(packet, ThrottleOutPacketType.Task, true); - } + if (terseUpdateBlocks.IsValueCreated) + { + List blocks = terseUpdateBlocks.Value; - if (terseUpdateBlocks.IsValueCreated) - { - List blocks = terseUpdateBlocks.Value; + ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = timeDilation; + packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; - ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = timeDilation; - packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; + for (int i = 0; i < blocks.Count; i++) + packet.ObjectData[i] = blocks[i]; - for (int i = 0; i < blocks.Count; i++) - packet.ObjectData[i] = blocks[i]; - - OutPacket(packet, ThrottleOutPacketType.Task, true); - } + OutPacket(packet, ThrottleOutPacketType.Task, true); } #endregion Packet Sending @@ -8239,7 +8261,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); entry.AgentID = block.ID; entry.Flags = (AccessList)block.Flags; - entry.Time = new DateTime(); + entry.Time = Util.ToDateTime(block.Time); entries.Add(entry); } @@ -8247,8 +8269,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (handlerParcelAccessListUpdateRequest != null) { handlerParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID, - updatePacket.AgentData.SessionID, updatePacket.Data.Flags, - updatePacket.Data.LocalID, entries, this); + updatePacket.Data.Flags, + updatePacket.Data.LocalID, + updatePacket.Data.TransactionID, + updatePacket.Data.SequenceID, + updatePacket.Data.Sections, + entries, this); } return true; } diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs index ac2ad7af65..1f60e36dea 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs @@ -226,7 +226,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps } else { - AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.CreatorID); + AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID); newTexture.Data = ConvertTextureData(texture, format); if (newTexture.Data.Length == 0) return false; // !!! Caller try another codec, please! @@ -336,7 +336,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps try { - // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular jpeg data + // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data imgstream = new MemoryStream(); diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 1f49a015da..360a0145ff 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -484,6 +484,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } } + public void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos) + { + // First we save the + // attachment point information, then we update the relative + // positioning. Then we have to mark the object as NOT an + // attachment. This is necessary in order to correctly save + // and retrieve GroupPosition information for the attachment. + // Finally, we restore the object's attachment status. + byte attachmentPoint = sog.GetAttachmentPoint(); + sog.UpdateGroupPosition(pos); + sog.RootPart.IsAttachment = false; + sog.AbsolutePosition = sog.RootPart.AttachedPos; + sog.SetAttachmentPoint(attachmentPoint); + sog.HasGroupChanged = true; + } + /// /// Update the attachment asset for the new sog details if they have changed. /// diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index cab341dbff..5e5f6c0590 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -156,7 +156,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// The inventory folder to save /// The path to which the folder should be saved /// If true, save this folder itself. If false, only saves contents - protected void SaveInvFolder(InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, Dictionary options, IUserAccountService userAccountService) + /// + /// + protected void SaveInvFolder( + InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, + Dictionary options, IUserAccountService userAccountService) { if (saveThisFolderItself) { @@ -249,7 +253,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver // Write out control file. This has to be done first so that subsequent loaders will see this file first // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this - m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); + // not sure how to fix this though, short of going with a completely different file format. + m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, CreateControlFile(options)); m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive."); if (inventoryFolder != null) @@ -372,12 +377,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } /// - /// Create the control file for a 0.1 version archive + /// Create the control file for the archive /// + /// /// - public static string Create0p1ControlFile() + public static string CreateControlFile(Dictionary options) { - int majorVersion = 0, minorVersion = 1; + int majorVersion, minorVersion; + + if (options.ContainsKey("profile")) + { + majorVersion = 1; + minorVersion = 0; + } + else + { + majorVersion = 0; + minorVersion = 1; + } m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index b33c2b1af5..1e1809544b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// /// Enable or disable checking whether the iar user is actually logged in /// - public bool DisablePresenceChecks { get; set; } +// public bool DisablePresenceChecks { get; set; } public event InventoryArchiveSaved OnInventoryArchiveSaved; @@ -95,10 +95,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver public InventoryArchiverModule() {} - public InventoryArchiverModule(bool disablePresenceChecks) - { - DisablePresenceChecks = disablePresenceChecks; - } +// public InventoryArchiverModule(bool disablePresenceChecks) +// { +// DisablePresenceChecks = disablePresenceChecks; +// } public void Initialise(Scene scene, IConfigSource source) { @@ -172,8 +172,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (userInfo != null) { - if (CheckPresence(userInfo.PrincipalID)) - { +// if (CheckPresence(userInfo.PrincipalID)) +// { try { new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService); @@ -189,13 +189,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } return true; - } - else - { - m_log.ErrorFormat( - "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", - userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); - } +// } +// else +// { +// m_log.ErrorFormat( +// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", +// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); +// } } } @@ -212,8 +212,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (userInfo != null) { - if (CheckPresence(userInfo.PrincipalID)) - { +// if (CheckPresence(userInfo.PrincipalID)) +// { try { new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService); @@ -229,13 +229,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } return true; - } - else - { - m_log.ErrorFormat( - "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", - userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); - } +// } +// else +// { +// m_log.ErrorFormat( +// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", +// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); +// } } } @@ -257,9 +257,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (userInfo != null) { - if (CheckPresence(userInfo.PrincipalID)) - { - +// if (CheckPresence(userInfo.PrincipalID)) +// { InventoryArchiveReadRequest request; bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); @@ -280,13 +279,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver UpdateClientWithLoadedNodes(userInfo, request.Execute()); return true; - } - else - { - m_log.ErrorFormat( - "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", - userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); - } +// } +// else +// { +// m_log.ErrorFormat( +// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", +// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); +// } } else m_log.ErrorFormat("[INVENTORY ARCHIVER]: User {0} {1} not found", @@ -306,8 +305,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (userInfo != null) { - if (CheckPresence(userInfo.PrincipalID)) - { +// if (CheckPresence(userInfo.PrincipalID)) +// { InventoryArchiveReadRequest request; bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); @@ -328,13 +327,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver UpdateClientWithLoadedNodes(userInfo, request.Execute()); return true; - } - else - { - m_log.ErrorFormat( - "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", - userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); - } +// } +// else +// { +// m_log.ErrorFormat( +// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", +// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); +// } } } @@ -529,28 +528,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } } - /// - /// Check if the given user is present in any of the scenes. - /// - /// The user to check - /// true if the user is in any of the scenes, false otherwise - protected bool CheckPresence(UUID userId) - { - if (DisablePresenceChecks) - return true; - - foreach (Scene scene in m_scenes.Values) - { - ScenePresence p; - if ((p = scene.GetScenePresence(userId)) != null) - { - p.ControllingClient.SendAgentAlertMessage("Inventory operation has been started", false); - return true; - } - } - - return false; - } - +// /// +// /// Check if the given user is present in any of the scenes. +// /// +// /// The user to check +// /// true if the user is in any of the scenes, false otherwise +// protected bool CheckPresence(UUID userId) +// { +// if (DisablePresenceChecks) +// return true; +// +// foreach (Scene scene in m_scenes.Values) +// { +// ScenePresence p; +// if ((p = scene.GetScenePresence(userId)) != null) +// { +// p.ControllingClient.SendAgentAlertMessage("Inventory operation has been started", false); +// return true; +// } +// } +// +// return false; +// } } } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 2747e157be..76d0b85774 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -120,7 +120,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); Scene scene = SceneSetupHelpers.SetupScene("Inventory"); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); @@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); Scene scene = SceneSetupHelpers.SetupScene("Inventory"); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); @@ -355,7 +355,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); Scene scene = SceneSetupHelpers.SetupScene("inventory"); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); @@ -382,7 +382,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests //log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene Scene scene = SceneSetupHelpers.SetupScene("inventory"); @@ -443,7 +443,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests string humanEscapedItemName = @"You & you are a mean\/man\/"; string userPassword = "meowfood"; - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); Scene scene = SceneSetupHelpers.SetupScene("Inventory"); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); @@ -558,7 +558,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); SerialiserModule serialiserModule = new SerialiserModule(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene Scene scene = SceneSetupHelpers.SetupScene("inventory"); @@ -619,7 +619,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); // SerialiserModule serialiserModule = new SerialiserModule(); - // InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + // InventoryArchiverModule archiverModule = new InventoryArchiverModule(); // // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene // Scene scene = SceneSetupHelpers.SetupScene(); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index fd28ba0190..a3251aae58 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1299,7 +1299,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer #region Agent Arrived public void AgentArrivedAtDestination(UUID id) { - //m_log.Debug(" >>> ReleaseAgent called <<< "); + m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Agent {0} released", id); ResetFromTransit(id); } diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 3291be4163..7316e5b546 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs @@ -165,7 +165,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender int width = 256; int height = 256; int alpha = 255; // 0 is transparent - Color bgColour = Color.White; // Default background color + Color bgColor = Color.White; // Default background color char altDataDelim = ';'; char[] paramDelimiter = { ',' }; @@ -253,15 +253,16 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender alpha = 256; } break; + case "bgcolor": case "bgcolour": - int hex = 0; + int hex = 0; if (Int32.TryParse(value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) { - bgColour = Color.FromArgb(hex); + bgColor = Color.FromArgb(hex); } else { - bgColour = Color.FromName(value); + bgColor = Color.FromName(value); } break; case "altdatadelim": @@ -315,7 +316,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender // background color in their scripts, only do when fully opaque if (alpha >= 255) { - graph.FillRectangle(new SolidBrush(bgColour), 0, 0, width, height); + graph.FillRectangle(new SolidBrush(bgColor), 0, 0, width, height); } for (int w = 0; w < bitmap.Width; w++) @@ -616,25 +617,25 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender } } } - else if (nextLine.StartsWith("PenColour")) + else if (nextLine.StartsWith("PenColour") || nextLine.StartsWith("PenColor")) { nextLine = nextLine.Remove(0, 9); nextLine = nextLine.Trim(); int hex = 0; - Color newColour; + Color newColor; if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) { - newColour = Color.FromArgb(hex); + newColor = Color.FromArgb(hex); } else { // this doesn't fail, it just returns black if nothing is found - newColour = Color.FromName(nextLine); + newColor = Color.FromName(nextLine); } - myBrush.Color = newColour; - drawPen.Color = newColour; + myBrush.Color = newColor; + drawPen.Color = newColor; } } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index 16e25e6f11..dfba0d6994 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs @@ -41,8 +41,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { - public class RemoteGridServicesConnector : - GridServicesConnector, ISharedRegionModule, IGridService + public class RemoteGridServicesConnector : ISharedRegionModule, IGridService { private static readonly ILog m_log = LogManager.GetLogger( @@ -51,6 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid private bool m_Enabled = false; private IGridService m_LocalGridService; + private IGridService m_RemoteGridService; public RemoteGridServicesConnector() { @@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid get { return "RemoteGridServicesConnector"; } } - public override void Initialise(IConfigSource source) + public void Initialise(IConfigSource source) { IConfig moduleConfig = source.Configs["Modules"]; if (moduleConfig != null) @@ -97,9 +97,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid return; } - base.Initialise(source); - m_LocalGridService = new LocalGridServicesConnector(source); + m_RemoteGridService = new GridServicesConnector(source); } public void PostInitialise() @@ -135,61 +134,61 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid #region IGridService - public override string RegisterRegion(UUID scopeID, GridRegion regionInfo) + public string RegisterRegion(UUID scopeID, GridRegion regionInfo) { string msg = m_LocalGridService.RegisterRegion(scopeID, regionInfo); if (msg == String.Empty) - return base.RegisterRegion(scopeID, regionInfo); + return m_RemoteGridService.RegisterRegion(scopeID, regionInfo); return msg; } - public override bool DeregisterRegion(UUID regionID) + public bool DeregisterRegion(UUID regionID) { if (m_LocalGridService.DeregisterRegion(regionID)) - return base.DeregisterRegion(regionID); + return m_RemoteGridService.DeregisterRegion(regionID); return false; } - public override List GetNeighbours(UUID scopeID, UUID regionID) + public List GetNeighbours(UUID scopeID, UUID regionID) { - return base.GetNeighbours(scopeID, regionID); + return m_RemoteGridService.GetNeighbours(scopeID, regionID); } - public override GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) + public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) { GridRegion rinfo = m_LocalGridService.GetRegionByUUID(scopeID, regionID); if (rinfo == null) - rinfo = base.GetRegionByUUID(scopeID, regionID); + rinfo = m_RemoteGridService.GetRegionByUUID(scopeID, regionID); return rinfo; } - public override GridRegion GetRegionByPosition(UUID scopeID, int x, int y) + public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) { GridRegion rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y); if (rinfo == null) - rinfo = base.GetRegionByPosition(scopeID, x, y); + rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y); return rinfo; } - public override GridRegion GetRegionByName(UUID scopeID, string regionName) + public GridRegion GetRegionByName(UUID scopeID, string regionName) { GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName); if (rinfo == null) - rinfo = base.GetRegionByName(scopeID, regionName); + rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); return rinfo; } - public override List GetRegionsByName(UUID scopeID, string name, int maxNumber) + public List GetRegionsByName(UUID scopeID, string name, int maxNumber) { List rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber); //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count); - List grinfo = base.GetRegionsByName(scopeID, name, maxNumber); + List grinfo = m_RemoteGridService.GetRegionsByName(scopeID, name, maxNumber); if (grinfo != null) { @@ -202,13 +201,79 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid return rinfo; } - // Let's not override GetRegionRange -- let's get them all from the grid server + public virtual List GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) + { + List rinfo = m_LocalGridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax); + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionRange {0} found {1} regions", name, rinfo.Count); + List grinfo = m_RemoteGridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax); - public override int GetRegionFlags(UUID scopeID, UUID regionID) + if (grinfo != null) + { + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetRegionRange {0} found {1} regions", name, grinfo.Count); + foreach (GridRegion r in grinfo) + if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) + rinfo.Add(r); + } + + return rinfo; + } + + public List GetDefaultRegions(UUID scopeID) + { + List rinfo = m_LocalGridService.GetDefaultRegions(scopeID); + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetDefaultRegions {0} found {1} regions", name, rinfo.Count); + List grinfo = m_RemoteGridService.GetDefaultRegions(scopeID); + + if (grinfo != null) + { + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetDefaultRegions {0} found {1} regions", name, grinfo.Count); + foreach (GridRegion r in grinfo) + if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) + rinfo.Add(r); + } + + return rinfo; + } + + public List GetFallbackRegions(UUID scopeID, int x, int y) + { + List rinfo = m_LocalGridService.GetFallbackRegions(scopeID, x, y); + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetFallbackRegions {0} found {1} regions", name, rinfo.Count); + List grinfo = m_RemoteGridService.GetFallbackRegions(scopeID, x, y); + + if (grinfo != null) + { + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetFallbackRegions {0} found {1} regions", name, grinfo.Count); + foreach (GridRegion r in grinfo) + if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) + rinfo.Add(r); + } + + return rinfo; + } + + public List GetHyperlinks(UUID scopeID) + { + List rinfo = m_LocalGridService.GetHyperlinks(scopeID); + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetHyperlinks {0} found {1} regions", name, rinfo.Count); + List grinfo = m_RemoteGridService.GetHyperlinks(scopeID); + + if (grinfo != null) + { + //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetHyperlinks {0} found {1} regions", name, grinfo.Count); + foreach (GridRegion r in grinfo) + if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) + rinfo.Add(r); + } + + return rinfo; + } + + public int GetRegionFlags(UUID scopeID, UUID regionID) { int flags = m_LocalGridService.GetRegionFlags(scopeID, regionID); if (flags == -1) - flags = base.GetRegionFlags(scopeID, regionID); + flags = m_RemoteGridService.GetRegionFlags(scopeID, regionID); return flags; } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index f8a599a232..9ec4ebe8da 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs @@ -136,14 +136,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver ms.Close(); m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); - // Write out scene object metadata foreach (SceneObjectGroup sceneObject in m_sceneObjects) { //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); - string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options); + string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options); m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 0699407d12..f2d487ef94 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// /// The maximum major version of OAR that we can write. /// - public static int MAX_MAJOR_VERSION = 1; + public static int MAX_MAJOR_VERSION = 0; protected Scene m_scene; protected Stream m_saveStream; @@ -206,37 +206,37 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// public static string CreateControlFile(Dictionary options) { - int majorVersion = MAX_MAJOR_VERSION, minorVersion = 0; - - if (options.ContainsKey("version")) - { - string[] parts = options["version"].ToString().Split('.'); - if (parts.Length >= 1) - { - majorVersion = Int32.Parse(parts[0]); - - if (parts.Length >= 2) - minorVersion = Int32.Parse(parts[1]); - } - } - - if (majorVersion < MIN_MAJOR_VERSION || majorVersion > MAX_MAJOR_VERSION) - { - throw new Exception( - string.Format( - "OAR version number for save must be between {0} and {1}", - MIN_MAJOR_VERSION, MAX_MAJOR_VERSION)); - } - else if (majorVersion == MAX_MAJOR_VERSION) - { - // Force 1.0 - minorVersion = 0; - } - else if (majorVersion == MIN_MAJOR_VERSION) - { - // Force 0.4 - minorVersion = 4; - } + int majorVersion = MAX_MAJOR_VERSION, minorVersion = 5; +// +// if (options.ContainsKey("version")) +// { +// string[] parts = options["version"].ToString().Split('.'); +// if (parts.Length >= 1) +// { +// majorVersion = Int32.Parse(parts[0]); +// +// if (parts.Length >= 2) +// minorVersion = Int32.Parse(parts[1]); +// } +// } +// +// if (majorVersion < MIN_MAJOR_VERSION || majorVersion > MAX_MAJOR_VERSION) +// { +// throw new Exception( +// string.Format( +// "OAR version number for save must be between {0} and {1}", +// MIN_MAJOR_VERSION, MAX_MAJOR_VERSION)); +// } +// else if (majorVersion == MAX_MAJOR_VERSION) +// { +// // Force 1.0 +// minorVersion = 0; +// } +// else if (majorVersion == MIN_MAJOR_VERSION) +// { +// // Force 0.4 +// minorVersion = 4; +// } m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); //if (majorVersion == 1) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 2d7244e48b..9277c594f0 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver Dictionary options = new Dictionary(); OptionSet ops = new OptionSet(); - ops.Add("v|version=", delegate(string v) { options["version"] = v; }); +// ops.Add("v|version=", delegate(string v) { options["version"] = v; }); ops.Add("p|profile=", delegate(string v) { options["profile"] = v; }); List mainParams = ops.Parse(cmdparams); diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 695202f741..ac4705c222 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.World.Land client.OnParcelSelectObjects += ClientOnParcelSelectObjects; client.OnParcelObjectOwnerRequest += ClientOnParcelObjectOwnerRequest; client.OnParcelAccessListRequest += ClientOnParcelAccessListRequest; - client.OnParcelAccessListUpdateRequest += ClientOnParcelAccessUpdateListRequest; + client.OnParcelAccessListUpdateRequest += ClientOnParcelAccessListUpdateRequest; client.OnParcelAbandonRequest += ClientOnParcelAbandonRequest; client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; client.OnParcelReclaim += ClientOnParcelReclaim; @@ -508,14 +508,22 @@ namespace OpenSim.Region.CoreModules.World.Land if (land != null) { - m_landList[landLocalID].SendAccessList(agentID, sessionID, flags, sequenceID, remote_client); + land.SendAccessList(agentID, sessionID, flags, sequenceID, remote_client); } } - public void ClientOnParcelAccessUpdateListRequest(UUID agentID, UUID sessionID, uint flags, int landLocalID, - List entries, - IClientAPI remote_client) + public void ClientOnParcelAccessListUpdateRequest(UUID agentID, + uint flags, int landLocalID, UUID transactionID, int sequenceID, + int sections, List entries, + IClientAPI remote_client) { + // Flags is the list to update, it can mean either the ban or + // the access list (WTH is a pass list? Mentioned in ParcelFlags) + // + // There may be multiple packets, because these can get LONG. + // Use transactionID to determine a new chain of packets since + // packets may have come in out of sequence and that would be + // a big mess if using the sequenceID ILandObject land; lock (m_landList) { @@ -524,9 +532,15 @@ namespace OpenSim.Region.CoreModules.World.Land if (land != null) { - if (agentID == land.LandData.OwnerID) + GroupPowers requiredPowers = GroupPowers.LandManageAllowed; + if (flags == (uint)AccessList.Ban) + requiredPowers = GroupPowers.LandManageBanned; + + if (m_scene.Permissions.CanEditParcelProperties(agentID, + land, requiredPowers)) { - land.UpdateAccessList(flags, entries, remote_client); + land.UpdateAccessList(flags, transactionID, sequenceID, + sections, entries, remote_client); } } else @@ -854,7 +868,7 @@ namespace OpenSim.Region.CoreModules.World.Land //If we are still here, then they are subdividing within one piece of land //Check owner - if (!m_scene.Permissions.CanEditParcel(attempting_user_id, startLandObject)) + if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin)) { return; } @@ -922,7 +936,7 @@ namespace OpenSim.Region.CoreModules.World.Land { return; } - if (!m_scene.Permissions.CanEditParcel(attempting_user_id, masterLandObject)) + if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin)) { return; } @@ -1570,7 +1584,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (land == null) return; - if (!m_scene.Permissions.CanEditParcel(remoteClient.AgentId, land)) + if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.AgentId, land, GroupPowers.LandOptions)) return; land.LandData.OtherCleanTime = otherCleanTime; diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index d87352f849..3e41c55dcd 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -54,6 +54,7 @@ namespace OpenSim.Region.CoreModules.World.Land protected LandData m_landData = new LandData(); protected Scene m_scene; protected List primsOverMe = new List(); + protected Dictionary m_listTransactions = new Dictionary(); public bool[,] LandBitmap { @@ -199,36 +200,81 @@ namespace OpenSim.Region.CoreModules.World.Land public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) { - if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) - { - //Needs later group support - bool snap_selection = false; - LandData newData = LandData.Copy(); + //Needs later group support + bool snap_selection = false; + LandData newData = LandData.Copy(); - if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) + uint allowedDelta = 0; + + // These two are always blocked as no client can set them anyway + // ParcelFlags.ForSaleObjects + // ParcelFlags.LindenHome + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) + { + allowedDelta |= (uint)(ParcelFlags.AllowLandmark | + ParcelFlags.AllowTerraform | + ParcelFlags.AllowDamage | + ParcelFlags.CreateObjects | + ParcelFlags.RestrictPushObject | + ParcelFlags.AllowGroupScripts | + ParcelFlags.CreateGroupObjects | + ParcelFlags.AllowAPrimitiveEntry | + ParcelFlags.AllowGroupObjectEntry); + } + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale)) + { + if (args.AuthBuyerID != newData.AuthBuyerID || + args.SalePrice != newData.SalePrice) { - if (m_scene.Permissions.CanSellParcel(remote_client.AgentId, this)) - { - newData.AuthBuyerID = args.AuthBuyerID; - newData.SalePrice = args.SalePrice; - snap_selection = true; - } + snap_selection = true; } + + newData.AuthBuyerID = args.AuthBuyerID; + newData.SalePrice = args.SalePrice; + + if (!LandData.IsGroupOwned) + { + newData.GroupID = args.GroupID; + + allowedDelta |= (uint)(ParcelFlags.AllowDeedToGroup | + ParcelFlags.ContributeWithDeed | + ParcelFlags.SellParcelObjects); + } + + allowedDelta |= (uint)ParcelFlags.ForSale; + } + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces)) + { newData.Category = args.Category; + + allowedDelta |= (uint)(ParcelFlags.ShowDirectory | + ParcelFlags.AllowPublish | + ParcelFlags.MaturePublish); + } + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity)) + { newData.Description = args.Desc; - newData.GroupID = args.GroupID; + newData.Name = args.Name; + newData.SnapshotID = args.SnapshotID; + } + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint)) + { newData.LandingType = args.LandingType; + newData.UserLocation = args.UserLocation; + newData.UserLookAt = args.UserLookAt; + } + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia)) + { newData.MediaAutoScale = args.MediaAutoScale; newData.MediaID = args.MediaID; newData.MediaURL = args.MediaURL; newData.MusicURL = args.MusicURL; - newData.Name = args.Name; - newData.Flags = args.ParcelFlags; - newData.PassHours = args.PassHours; - newData.PassPrice = args.PassPrice; - newData.SnapshotID = args.SnapshotID; - newData.UserLocation = args.UserLocation; - newData.UserLookAt = args.UserLookAt; newData.MediaType = args.MediaType; newData.MediaDescription = args.MediaDescription; newData.MediaWidth = args.MediaWidth; @@ -237,10 +283,40 @@ namespace OpenSim.Region.CoreModules.World.Land newData.ObscureMusic = args.ObscureMusic; newData.ObscureMedia = args.ObscureMedia; - m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); - - SendLandUpdateToAvatarsOverMe(snap_selection); + allowedDelta |= (uint)(ParcelFlags.SoundLocal | + ParcelFlags.UrlWebPage | + ParcelFlags.UrlRawHtml | + ParcelFlags.AllowVoiceChat | + ParcelFlags.UseEstateVoiceChan); } + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses)) + { + newData.PassHours = args.PassHours; + newData.PassPrice = args.PassPrice; + + allowedDelta |= (uint)ParcelFlags.UsePassList; + } + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed)) + { + allowedDelta |= (uint)(ParcelFlags.UseAccessGroup | + ParcelFlags.UseAccessList); + } + + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned)) + { + allowedDelta |= (uint)(ParcelFlags.UseBanList | + ParcelFlags.DenyAnonymous | + ParcelFlags.DenyAgeUnverified); + } + + uint preserve = LandData.Flags & ~allowedDelta; + newData.Flags = preserve | (args.ParcelFlags & allowedDelta); + + m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); + + SendLandUpdateToAvatarsOverMe(snap_selection); } public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) @@ -295,14 +371,14 @@ namespace OpenSim.Region.CoreModules.World.Land if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) { - ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); - entry.AgentID = avatar; - entry.Flags = AccessList.Ban; - entry.Time = new DateTime(); - //See if they are on the list, but make sure the owner isn't banned - if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) + if (LandData.ParcelAccessList.FindIndex( + delegate(ParcelManager.ParcelAccessEntry e) + { + if (e.AgentID == avatar && e.Flags == AccessList.Ban) + return true; + return false; + }) != -1 && LandData.OwnerID != avatar) { - //They are banned, so lets send them a notice about this parcel return true; } } @@ -316,15 +392,14 @@ namespace OpenSim.Region.CoreModules.World.Land if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) { - ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); - entry.AgentID = avatar; - entry.Flags = AccessList.Access; - entry.Time = new DateTime(); - - //If they are not on the access list and are not the owner - if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) + if (LandData.ParcelAccessList.FindIndex( + delegate(ParcelManager.ParcelAccessEntry e) + { + if (e.AgentID == avatar && e.Flags == AccessList.Access) + return true; + return false; + }) == -1 && LandData.OwnerID != avatar) { - //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel return true; } } @@ -421,39 +496,52 @@ namespace OpenSim.Region.CoreModules.World.Land } } - public void UpdateAccessList(uint flags, List entries, IClientAPI remote_client) + public void UpdateAccessList(uint flags, UUID transactionID, + int sequenceID, int sections, + List entries, + IClientAPI remote_client) { LandData newData = LandData.Copy(); - if (entries.Count == 1 && entries[0].AgentID == UUID.Zero) + if ((!m_listTransactions.ContainsKey(flags)) || + m_listTransactions[flags] != transactionID) { - entries.Clear(); - } + m_listTransactions[flags] = transactionID; - List toRemove = new List(); - foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) - { - if (entry.Flags == (AccessList)flags) + List toRemove = + new List(); + + foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) { - toRemove.Add(entry); + if (entry.Flags == (AccessList)flags) + toRemove.Add(entry); + } + + foreach (ParcelManager.ParcelAccessEntry entry in toRemove) + { + newData.ParcelAccessList.Remove(entry); + } + + // Checked here because this will always be the first + // and only packet in a transaction + if (entries.Count == 1 && entries[0].AgentID == UUID.Zero) + { + m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); + + return; } } - foreach (ParcelManager.ParcelAccessEntry entry in toRemove) - { - newData.ParcelAccessList.Remove(entry); - } foreach (ParcelManager.ParcelAccessEntry entry in entries) { - ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); + ParcelManager.ParcelAccessEntry temp = + new ParcelManager.ParcelAccessEntry(); + temp.AgentID = entry.AgentID; - temp.Time = new DateTime(); //Pointless? Yes. + temp.Time = entry.Time; temp.Flags = (AccessList)flags; - if (!newData.ParcelAccessList.Contains(temp)) - { - newData.ParcelAccessList.Add(temp); - } + newData.ParcelAccessList.Add(temp); } m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); @@ -711,7 +799,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void SendForceObjectSelect(int local_id, int request_type, List returnIDs, IClientAPI remote_client) { - if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) { List resultLocalIDs = new List(); try @@ -761,7 +849,7 @@ namespace OpenSim.Region.CoreModules.World.Land /// public void SendLandObjectOwners(IClientAPI remote_client) { - if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) + if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) { Dictionary primCount = new Dictionary(); List groups = new List(); diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index f5f383964e..364dd6cb28 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -37,56 +37,6 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; -// Temporary fix of wrong GroupPowers constants in OpenMetaverse library -enum GroupPowers : long - { - None = 0, - LandEjectAndFreeze = 1, - Invite = 2, - ReturnGroupSet = 2, - Eject = 4, - ReturnNonGroup = 4, - ChangeOptions = 8, - LandGardening = 8, - CreateRole = 16, - DeedObject = 16, - ModerateChat = 32, - DeleteRole = 32, - RoleProperties = 64, - ObjectManipulate = 64, - ObjectSetForSale = 128, - AssignMemberLimited = 128, - AssignMember = 256, - Accountable = 256, - RemoveMember = 512, - SendNotices = 1024, - ChangeActions = 1024, - ChangeIdentity = 2048, - ReceiveNotices = 2048, - StartProposal = 4096, - LandDeed = 4096, - VoteOnProposal = 8192, - LandRelease = 8192, - LandSetSale = 16384, - LandDivideJoin = 32768, - ReturnGroupOwned = 65536, - JoinChat = 65536, - FindPlaces = 131072, - LandChangeIdentity = 262144, - SetLandingPoint = 524288, - ChangeMedia = 1048576, - LandEdit = 2097152, - LandOptions = 4194304, - AllowEditLand = 8388608, - AllowFly = 16777216, - AllowRez = 33554432, - AllowLandmark = 67108864, - AllowVoiceChat = 134217728, - AllowSetHome = 268435456, - LandManageAllowed = 536870912, - LandManageBanned = 1073741824 - } - namespace OpenSim.Region.CoreModules.World.Permissions { public class PermissionsModule : IRegionModule @@ -214,7 +164,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED - m_scene.Permissions.OnEditParcel += CanEditParcel; //MAYBE FULLY IMPLEMENTED + m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED m_scene.Permissions.OnInstantMessage += CanInstantMessage; m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED @@ -1005,12 +955,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions return GenericObjectPermission(editorID, objectID, false); } - private bool CanEditParcel(UUID user, ILandObject parcel, Scene scene) + private bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, Scene scene) { DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); if (m_bypassPermissions) return m_bypassPermissionsValue; - return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDivideJoin); + return GenericParcelOwnerPermission(user, parcel, (ulong)p); } /// diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 9f8851708c..bdd1a0b7c5 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs @@ -93,13 +93,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap } // try to fetch from GridServer - List regionInfos = m_scene.GridService.GetRegionsByName(UUID.Zero, mapName, 20); + List regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); if (regionInfos == null) { m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?"); // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region regionInfos = new List(); - GridRegion info = m_scene.GridService.GetRegionByName(UUID.Zero, mapName); + GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName); if (info != null) regionInfos.Add(info); } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 9869f4a4e1..e3ba1901f1 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -33,6 +33,7 @@ using System.Drawing.Imaging; using System.IO; using System.Net; using System.Reflection; +using System.Runtime.Remoting.Messaging; using System.Threading; using log4net; using Nini.Config; @@ -413,11 +414,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap } } + private int nAsyncRequests = 0; /// /// Processing thread main() loop for doing remote mapitem requests /// public void process() { + const int MAX_ASYNC_REQUESTS = 20; try { while (true) @@ -437,10 +440,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap dorequest = false; } - if (dorequest) + if (dorequest && !m_blacklistedregions.ContainsKey(st.regionhandle)) { - OSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); - RequestMapItemsCompleted(response); + while (nAsyncRequests >= MAX_ASYNC_REQUESTS) // hit the break + Thread.Sleep(80); + + RequestMapItemsDelegate d = RequestMapItemsAsync; + d.BeginInvoke(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle, RequestMapItemsCompleted, null); + //OSDMap response = RequestMapItemsAsync(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); + //RequestMapItemsCompleted(response); + Interlocked.Increment(ref nAsyncRequests); } } @@ -469,8 +478,18 @@ namespace OpenSim.Region.CoreModules.World.WorldMap /// Sends the mapitem response to the IClientAPI /// /// The OSDMap Response for the mapitem - private void RequestMapItemsCompleted(OSDMap response) + private void RequestMapItemsCompleted(IAsyncResult iar) { + AsyncResult result = (AsyncResult)iar; + RequestMapItemsDelegate icon = (RequestMapItemsDelegate)result.AsyncDelegate; + + OSDMap response = (OSDMap)icon.EndInvoke(iar); + + Interlocked.Decrement(ref nAsyncRequests); + + if (!response.ContainsKey("requestID")) + return; + UUID requestID = response["requestID"].AsUUID(); if (requestID != UUID.Zero) @@ -538,6 +557,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap EnqueueMapItemRequest(st); } + private delegate OSDMap RequestMapItemsDelegate(UUID id, uint flags, + uint EstateID, bool godlike, uint itemtype, ulong regionhandle); /// /// Does the actual remote mapitem request /// This should be called from an asynchronous thread @@ -552,9 +573,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap /// passed in from packet /// Region we're looking up /// - private OSDMap RequestMapItemsAsync(string httpserver, UUID id, uint flags, + private OSDMap RequestMapItemsAsync(UUID id, uint flags, uint EstateID, bool godlike, uint itemtype, ulong regionhandle) { + string httpserver = ""; bool blacklisted = false; lock (m_blacklistedregions) { @@ -593,7 +615,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (!m_blacklistedregions.ContainsKey(regionhandle)) m_blacklistedregions.Add(regionhandle, Environment.TickCount); } - m_log.InfoFormat("[WORLD MAP]: Blacklisted region {0}", regionhandle.ToString()); + //m_log.InfoFormat("[WORLD MAP]: Blacklisted region {0}", regionhandle.ToString()); } } @@ -638,7 +660,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap os = mapitemsrequest.GetRequestStream(); os.Write(buffer, 0, buffer.Length); //Send it os.Close(); - //m_log.DebugFormat("[WORLD MAP]: Getting MapItems from Sim {0}", httpserver); + //m_log.DebugFormat("[WORLD MAP]: Getting MapItems from {0}", httpserver); } catch (WebException ex) { @@ -654,15 +676,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap return responseMap; } + catch + { + m_log.DebugFormat("[WORLD MAP]: RequestMapItems failed for {0}", httpserver); + responseMap["connect"] = OSD.FromBoolean(false); + return responseMap; + } string response_mapItems_reply = null; { // get the response + StreamReader sr = null; try { WebResponse webResponse = mapitemsrequest.GetResponse(); if (webResponse != null) { - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + sr = new StreamReader(webResponse.GetResponseStream()); response_mapItems_reply = sr.ReadToEnd().Trim(); } else @@ -683,6 +712,24 @@ namespace OpenSim.Region.CoreModules.World.WorldMap return responseMap; } + catch + { + m_log.DebugFormat("[WORLD MAP]: RequestMapItems failed for {0}", httpserver); + responseMap["connect"] = OSD.FromBoolean(false); + lock (m_blacklistedregions) + { + if (!m_blacklistedregions.ContainsKey(regionhandle)) + m_blacklistedregions.Add(regionhandle, Environment.TickCount); + } + + return responseMap; + } + finally + { + if (sr != null) + sr.Close(); + } + OSD rezResponse = null; try { @@ -691,14 +738,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap responseMap = (OSDMap)rezResponse; responseMap["requestID"] = OSD.FromUUID(requestID); } - catch (Exception) + catch (Exception ex) { - //m_log.InfoFormat("[OGP]: exception on parse of rez reply {0}", ex.Message); + m_log.InfoFormat("[WORLD MAP]: exception on parse of RequestMapItems reply from {0}: {1}", httpserver, ex.Message); responseMap["connect"] = OSD.FromBoolean(false); + lock (m_blacklistedregions) + { + if (!m_blacklistedregions.ContainsKey(regionhandle)) + m_blacklistedregions.Add(regionhandle, Environment.TickCount); + } return responseMap; } } + + if (!responseMap.ContainsKey(itemtype.ToString())) // remote sim doesnt have the stated region handle + { + if (!m_blacklistedregions.ContainsKey(regionhandle)) + { + m_log.DebugFormat("[WORLD MAP]: Remote sim does not have the stated region. Blacklisting."); + m_blacklistedregions.Add(regionhandle, Environment.TickCount); + } + } + return responseMap; } diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index b3576c5c73..6cc64c6113 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs @@ -113,14 +113,17 @@ namespace OpenSim.Region.Framework.Interfaces /// /// Update the user inventory to show a detach. /// - /// - /// A - /// - /// - /// A - /// + /// /param> + /// void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); + /// + /// Update the position of an attachment. + /// + /// + /// + void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos); + /// /// Update the user inventory with a changed attachment /// diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs index 084184ffb4..585eb004fa 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs +++ b/OpenSim/Region/Framework/Interfaces/ILandObject.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.Framework.Interfaces void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); List CreateAccessListArrayByFlag(AccessList flag); void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client); - void UpdateAccessList(uint flags, List entries, IClientAPI remote_client); + void UpdateAccessList(uint flags, UUID transactionID, int sequenceID, int sections, List entries, IClientAPI remote_client); void UpdateLandBitmapByteArray(); void SetLandBitmapFromByteArray(); bool[,] GetLandBitmap(); diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index a90e0f38d4..4865481904 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -233,6 +233,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation // Falling long enough to trigger the animation return "FALLDOWN"; } + else if (m_animTickJump == -1) + { + m_animTickJump = 0; + return "STAND"; + } return m_movementAnimation; } @@ -279,6 +284,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation m_animTickJump = -1; return "JUMP"; } + else + return "JUMP"; } else { @@ -307,7 +314,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation #endregion Ground Movement - return m_movementAnimation; + //return m_movementAnimation; } /// @@ -316,16 +323,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation public void UpdateMovementAnimations() { m_movementAnimation = GetMovementAnimation(); - - if (m_movementAnimation == "PREJUMP" && !m_scenePresence.Scene.m_usePreJump) - { - // This was the previous behavior before PREJUMP - TrySetMovementAnimation("JUMP"); - } - else - { - TrySetMovementAnimation(m_movementAnimation); - } + TrySetMovementAnimation(m_movementAnimation); } public UUID[] GetAnimationArray() diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 19f8180780..f9599f5a96 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -218,20 +218,28 @@ namespace OpenSim.Region.Framework.Scenes private double GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity) { + // If this is an update for our own avatar give it the highest priority + if (client.AgentId == entity.UUID) + return 0.0; + if (entity == null) + return double.NaN; + + // Use group position for child prims + Vector3 entityPos = entity.AbsolutePosition; + if (entity is SceneObjectPart) + { + SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; + if (group != null) + entityPos = group.AbsolutePosition; + else + entityPos = entity.AbsolutePosition; + } + else + entityPos = entity.AbsolutePosition; + ScenePresence presence = m_scene.GetScenePresence(client.AgentId); if (presence != null) { - // If this is an update for our own avatar give it the highest priority - if (presence == entity) - return 0.0; - - // Use group position for child prims - Vector3 entityPos = entity.AbsolutePosition; - if (entity is SceneObjectPart) - entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; - else - entityPos = entity.AbsolutePosition; - if (!presence.IsChildAgent) { if (entity is ScenePresence) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index d67638ad1f..1295e580eb 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -68,6 +68,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate bool IsGodHandler(UUID user, Scene requestFromScene); public delegate bool IsAdministratorHandler(UUID user); public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); + public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene); public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene); @@ -131,6 +132,7 @@ namespace OpenSim.Region.Framework.Scenes public event IsGodHandler OnIsGod; public event IsAdministratorHandler OnIsAdministrator; public event EditParcelHandler OnEditParcel; + public event EditParcelPropertiesHandler OnEditParcelProperties; public event SellParcelHandler OnSellParcel; public event AbandonParcelHandler OnAbandonParcel; public event ReclaimParcelHandler OnReclaimParcel; @@ -720,15 +722,16 @@ namespace OpenSim.Region.Framework.Scenes #endregion #region EDIT PARCEL - public bool CanEditParcel(UUID user, ILandObject parcel) + + public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p) { - EditParcelHandler handler = OnEditParcel; + EditParcelPropertiesHandler handler = OnEditParcelProperties; if (handler != null) { Delegate[] list = handler.GetInvocationList(); - foreach (EditParcelHandler h in list) + foreach (EditParcelPropertiesHandler h in list) { - if (h(user, parcel, m_scene) == false) + if (h(user, parcel, p, m_scene) == false) return false; } } @@ -1043,4 +1046,4 @@ namespace OpenSim.Region.Framework.Scenes return true; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 032c859b6b..a2ed54ff9b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -215,7 +215,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart sop = m_parentScene.GetSceneObjectPart(sp.ParentID); if (sop != null) { - coarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition); + coarseLocations.Add(sop.AbsolutePosition + sp.OffsetPosition); avatarUUIDs.Add(sp.UUID); } else @@ -1281,13 +1281,8 @@ namespace OpenSim.Region.Framework.Scenes { if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) { - // Set the new attachment point data in the object - byte attachmentPoint = group.GetAttachmentPoint(); - group.UpdateGroupPosition(pos); - group.RootPart.IsAttachment = false; - group.AbsolutePosition = group.RootPart.AttachedPos; - group.SetAttachmentPoint(attachmentPoint); - group.HasGroupChanged = true; + if (m_parentScene.AttachmentsModule != null) + m_parentScene.AttachmentsModule.UpdateAttachmentPosition(group, pos); } else { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f87056e48e..4fcd8f5c9d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3251,13 +3251,6 @@ namespace OpenSim.Region.Framework.Scenes //} } - public void SetAvatarOnSitTarget(UUID avatarID) - { - m_sitTargetAvatar = avatarID; - if (ParentGroup != null) - ParentGroup.TriggerScriptChangedEvent(Changed.LINK); - } - public void SetAxisRotation(int axis, int rotate) { if (m_parentGroup != null) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a1c80e55fa..62d7011ac2 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1703,7 +1703,8 @@ namespace OpenSim.Region.Framework.Scenes } // Reset sit target. if (part.GetAvatarOnSitTarget() == UUID) - part.SetAvatarOnSitTarget(UUID.Zero); + part.SitTargetAvatar = UUID.Zero; + part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); m_parentPosition = part.GetWorldPosition(); ControllingClient.SendClearFollowCamProperties(part.ParentUUID); @@ -1807,11 +1808,12 @@ namespace OpenSim.Region.Framework.Scenes if (SitTargetisSet && SitTargetUnOccupied) { - part.SetAvatarOnSitTarget(UUID); + part.SitTargetAvatar = UUID; offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); sitOrientation = avSitOrientation; autopilot = false; } + part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); pos = part.AbsolutePosition + offset; //if (Math.Abs(part.AbsolutePosition.Z - AbsolutePosition.Z) > 1) @@ -2225,33 +2227,6 @@ namespace OpenSim.Region.Framework.Scenes { // WHAT??? m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!"); - - // we have to reset the user's child agent connections. - // Likely, here they've lost the eventqueue for other regions so border - // crossings will fail at this point unless we reset them. - - List regions = new List(KnownChildRegionHandles); - regions.Remove(m_scene.RegionInfo.RegionHandle); - - MakeRootAgent(new Vector3(127f, 127f, 127f), true); - - // Async command - if (m_scene.SceneGridService != null) - { - m_scene.SceneGridService.SendCloseChildAgentConnections(UUID, regions); - - // Give the above command some time to try and close the connections. - // this is really an emergency.. so sleep, or we'll get all discombobulated. - System.Threading.Thread.Sleep(500); - } - - if (m_scene.SceneGridService != null) - { - IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); - if (m_agentTransfer != null) - m_agentTransfer.EnableChildAgents(this); - } - return; } @@ -3226,8 +3201,11 @@ namespace OpenSim.Region.Framework.Scenes Vector3 force = m_forceToApply.Value; m_updateflag = true; -// movementvector = force; - Velocity = force; + + // The magic constant 0.855f seems to make walking feel less jerky, + // probably because it hackishly accounts for the overall latency of + // these Velocity updates -- Diva + Velocity = force * .855F; m_forceToApply = null; } diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs similarity index 95% rename from OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs rename to OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index b3b99f4922..39116b6615 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs @@ -43,13 +43,14 @@ using OpenSim.Tests.Common.Setup; namespace OpenSim.Region.Framework.Scenes.Tests { /// - /// Tests manipulation of scene objects by users. + /// Tests derez of scene objects by users. /// - /// + /// /// This is at a level above the SceneObjectBasicTests, which act on the scene directly. - /// FIXME: These tests are very incomplete - they only test for a few conditions. + /// TODO: These tests are very incomplete - they only test for a few conditions. + /// [TestFixture] - public class SceneObjectUserTests + public class SceneObjectDeRezTests { /// /// Test deleting an object from a scene. @@ -122,6 +123,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); sogd.InventoryDeQueueAndDelete(); + // Object should still be in the scene. SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); } diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs new file mode 100644 index 0000000000..c78038f7a7 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs @@ -0,0 +1,87 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using Nini.Config; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.CoreModules.Avatar.InstantMessage; +using OpenSim.Region.CoreModules.World.Permissions; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; +using OpenSim.Tests.Common.Setup; + +namespace OpenSim.Region.Framework.Scenes.Tests +{ + [TestFixture] + public class SceneObjectUserGroupTests + { + /// + /// Test share with group object functionality + /// + /// This test is not yet fully implemented + [Test] + public void TestShareWithGroup() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); + + TestScene scene = SceneSetupHelpers.SetupScene(); + IConfigSource configSource = new IniConfigSource(); + + IConfig startupConfig = configSource.AddConfig("Startup"); + startupConfig.Set("serverside_object_permissions", true); + + IConfig groupsConfig = configSource.AddConfig("Groups"); + groupsConfig.Set("Enabled", true); + groupsConfig.Set("Module", "GroupsModule"); + groupsConfig.Set("DebugEnabled", true); + + SceneSetupHelpers.SetupSceneModules( + scene, configSource, new object[] + { new PermissionsModule(), + new GroupsModule(), + new MockGroupsServicesConnector() }); + + TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); + + IGroupsModule groupsModule = scene.RequestModuleInterface(); + + groupsModule.CreateGroup(client, "group1", "To boldly go", true, UUID.Zero, 5, true, true, true); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index ccf52892dc..4aab87fb3c 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -163,9 +163,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_msgTransferModule == null) { m_groupsEnabled = false; - m_log.Error("[GROUPS]: Could not get MessageTransferModule"); - Close(); - return; + m_log.Warn("[GROUPS]: Could not get MessageTransferModule"); } } @@ -1299,7 +1297,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is local, delivering directly", localClient.Name); localClient.SendInstantMessage(msg); } - else + else if (m_msgTransferModule != null) { if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is not local, delivering via TransferModule", msgTo); m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Message Sent: {0}", success?"Succeeded":"Failed"); }); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs index a046e094cd..5c779debc5 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs @@ -27,14 +27,12 @@ using System; using System.Collections.Generic; - using OpenMetaverse; - using OpenSim.Framework; namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { - interface IGroupsServicesConnector + public interface IGroupsServicesConnector { UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID); void UpdateGroup(UUID RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs new file mode 100644 index 0000000000..bc55b04743 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs @@ -0,0 +1,65 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Reflection; +using Nini.Config; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; +using OpenSim.Tests.Common.Setup; + +namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests +{ + /// + /// Basic groups module tests + /// + [TestFixture] + public class GroupsModuleTests + { + [Test] + public void TestBasic() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + TestScene scene = SceneSetupHelpers.SetupScene(); + IConfigSource configSource = new IniConfigSource(); + IConfig config = configSource.AddConfig("Groups"); + config.Set("Enabled", true); + config.Set("Module", "GroupsModule"); + config.Set("DebugEnabled", true); + SceneSetupHelpers.SetupSceneModules( + scene, configSource, new object[] { new MockGroupsServicesConnector() }); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 3386e729d8..211a0a787f 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -311,7 +311,7 @@ namespace OpenSim.Region.Physics.Meshing OSD decodedMeshOsd = new OSD(); byte[] meshBytes = new byte[physSize]; System.Buffer.BlockCopy(primShape.SculptData, physOffset, meshBytes, 0, physSize); - byte[] decompressed = new byte[physSize * 5]; +// byte[] decompressed = new byte[physSize * 5]; try { using (MemoryStream inMs = new MemoryStream(meshBytes)) diff --git a/OpenSim/Region/Physics/Meshing/SculptMesh.cs b/OpenSim/Region/Physics/Meshing/SculptMesh.cs index e58eb896bb..4a7f3ada5c 100644 --- a/OpenSim/Region/Physics/Meshing/SculptMesh.cs +++ b/OpenSim/Region/Physics/Meshing/SculptMesh.cs @@ -375,7 +375,7 @@ namespace PrimMesher int coordsDown = rows.Count; int coordsAcross = rows[0].Count; - int lastColumn = coordsAcross - 1; +// int lastColumn = coordsAcross - 1; float widthUnit = 1.0f / (coordsAcross - 1); float heightUnit = 1.0f / (coordsDown - 1); diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index ff0e743113..4a24c7d223 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -1001,7 +1001,7 @@ namespace OpenSim.Region.RegionCombinerModule VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject; VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED - VirtualRegion.Permissions.OnEditParcel += BigRegion.PermissionModule.CanEditParcel; //MAYBE FULLY IMPLEMENTED + VirtualRegion.Permissions.OnEditParcelProperties += BigRegion.PermissionModule.CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage; VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs index 393322d2d1..7c662c9b3a 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs @@ -105,9 +105,9 @@ namespace OpenSim.Region.RegionCombinerModule return m_rootScene.Permissions.CanEditObject(objectid, editorid); } - public bool CanEditParcel(UUID user, ILandObject parcel, Scene scene) + public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers g, Scene scene) { - return m_rootScene.Permissions.CanEditParcel(user, parcel); + return m_rootScene.Permissions.CanEditParcelProperties(user, parcel, g); } public bool CanInstantMessage(UUID user, UUID target, Scene startscene) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3c5f2d03c8..30fb252cbd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6287,16 +6287,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); UUID key; - LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; - if (land.OwnerID == m_host.OwnerID) + ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); + if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) { ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); if (UUID.TryParse(avatar, out key)) { - entry.AgentID = key; - entry.Flags = AccessList.Access; - entry.Time = DateTime.Now.AddHours(hours); - land.ParcelAccessList.Add(entry); + if (land.LandData.ParcelAccessList.FindIndex( + delegate(ParcelManager.ParcelAccessEntry e) + { + if (e.AgentID == key && e.Flags == AccessList.Access) + return true; + return false; + }) == -1) + { + entry.AgentID = key; + entry.Flags = AccessList.Access; + entry.Time = DateTime.Now.AddHours(hours); + land.LandData.ParcelAccessList.Add(entry); + } } } ScriptSleep(100); @@ -9023,7 +9032,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // according to the docs, this command only works if script owner and land owner are the same // lets add estate owners and gods, too, and use the generic permission check. ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); - if (!World.Permissions.CanEditParcel(m_host.OwnerID, landObject)) return; + if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return; bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? byte loop = 0; @@ -9466,16 +9475,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); UUID key; - LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; - if (land.OwnerID == m_host.OwnerID) + ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); + if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) { ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); if (UUID.TryParse(avatar, out key)) { - entry.AgentID = key; - entry.Flags = AccessList.Ban; - entry.Time = DateTime.Now.AddHours(hours); - land.ParcelAccessList.Add(entry); + if (land.LandData.ParcelAccessList.FindIndex( + delegate(ParcelManager.ParcelAccessEntry e) + { + if (e.AgentID == key && e.Flags == AccessList.Ban) + return true; + return false; + }) == -1) + { + entry.AgentID = key; + entry.Flags = AccessList.Ban; + entry.Time = DateTime.Now.AddHours(hours); + land.LandData.ParcelAccessList.Add(entry); + } } } ScriptSleep(100); @@ -9485,19 +9503,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); UUID key; - LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; - if (land.OwnerID == m_host.OwnerID) + ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); + if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) { if (UUID.TryParse(avatar, out key)) { - foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) - { - if (entry.AgentID == key && entry.Flags == AccessList.Access) - { - land.ParcelAccessList.Remove(entry); - break; - } - } + int idx = land.LandData.ParcelAccessList.FindIndex( + delegate(ParcelManager.ParcelAccessEntry e) + { + if (e.AgentID == key && e.Flags == AccessList.Access) + return true; + return false; + }); + + if (idx != -1) + land.LandData.ParcelAccessList.RemoveAt(idx); } } ScriptSleep(100); @@ -9507,19 +9527,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); UUID key; - LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; - if (land.OwnerID == m_host.OwnerID) + ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); + if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) { if (UUID.TryParse(avatar, out key)) { - foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) - { - if (entry.AgentID == key && entry.Flags == AccessList.Ban) - { - land.ParcelAccessList.Remove(entry); - break; - } - } + int idx = land.LandData.ParcelAccessList.FindIndex( + delegate(ParcelManager.ParcelAccessEntry e) + { + if (e.AgentID == key && e.Flags == AccessList.Ban) + return true; + return false; + }); + + if (idx != -1) + land.LandData.ParcelAccessList.RemoveAt(idx); } } ScriptSleep(100); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 827626f46e..5a796b8787 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -336,6 +336,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + internal void OSSLDeprecated(string function, string replacement) + { + OSSLShoutError(string.Format("Use of function {0} is deprecated. Use {1} instead.", function, replacement)); + } + protected void ScriptSleep(int delay) { delay = (int)((float)delay * m_ScriptDelayFactor); @@ -347,13 +352,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // // OpenSim functions // + public LSL_Integer osSetTerrainHeight(int x, int y, double val) + { + CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight"); + return SetTerrainHeight(x, y, val); + } public LSL_Integer osTerrainSetHeight(int x, int y, double val) { CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); - + OSSLDeprecated("osTerrainSetHeight", "osSetTerrainHeight"); + return SetTerrainHeight(x, y, val); + } + private LSL_Integer SetTerrainHeight(int x, int y, double val) + { m_host.AddScriptLPS(1); if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) - OSSLError("osTerrainSetHeight: Coordinate out of bounds"); + OSSLError("osSetTerrainHeight: Coordinate out of bounds"); if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0))) { @@ -366,13 +380,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public LSL_Float osGetTerrainHeight(int x, int y) + { + CheckThreatLevel(ThreatLevel.None, "osGetTerrainHeight"); + return GetTerrainHeight(x, y); + } public LSL_Float osTerrainGetHeight(int x, int y) { CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight"); - + OSSLDeprecated("osTerrainGetHeight", "osGetTerrainHeight"); + return GetTerrainHeight(x, y); + } + private LSL_Float GetTerrainHeight(int x, int y) + { m_host.AddScriptLPS(1); if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) - OSSLError("osTerrainGetHeight: Coordinate out of bounds"); + OSSLError("osGetTerrainHeight: Coordinate out of bounds"); return World.Heightmap[x, y]; } @@ -1001,9 +1024,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return drawList; } + public string osSetPenColor(string drawList, string color) + { + CheckThreatLevel(ThreatLevel.None, "osSetPenColor"); + + m_host.AddScriptLPS(1); + drawList += "PenColor " + color + "; "; + return drawList; + } + // Deprecated public string osSetPenColour(string drawList, string colour) { CheckThreatLevel(ThreatLevel.None, "osSetPenColour"); + OSSLDeprecated("osSetPenColour", "osSetPenColor"); m_host.AddScriptLPS(1); drawList += "PenColour " + colour + "; "; @@ -1012,7 +1045,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public string osSetPenCap(string drawList, string direction, string type) { - CheckThreatLevel(ThreatLevel.None, "osSetPenColour"); + CheckThreatLevel(ThreatLevel.None, "osSetPenCap"); m_host.AddScriptLPS(1); drawList += "PenCap " + direction + "," + type + "; "; @@ -1157,6 +1190,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public double osSunGetParam(string param) { CheckThreatLevel(ThreatLevel.None, "osSunGetParam"); + OSSLDeprecated("osSunGetParam", "osGetSunParam"); + return GetSunParam(param); + } + public double osGetSunParam(string param) + { + CheckThreatLevel(ThreatLevel.None, "osGetSunParam"); + return GetSunParam(param); + } + private double GetSunParam(string param) + { m_host.AddScriptLPS(1); double value = 0.0; @@ -1173,6 +1216,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void osSunSetParam(string param, double value) { CheckThreatLevel(ThreatLevel.None, "osSunSetParam"); + OSSLDeprecated("osSunSetParam", "osSetSunParam"); + SetSunParam(param, value); + } + public void osSetSunParam(string param, double value) + { + CheckThreatLevel(ThreatLevel.None, "osSetSunParam"); + SetSunParam(param, value); + } + private void SetSunParam(string param, double value) + { m_host.AddScriptLPS(1); ISunModule module = World.RequestModuleInterface(); @@ -1198,9 +1251,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return String.Empty; } - public void osWindParamSet(string plugin, string param, float value) + public void osSetWindParam(string plugin, string param, float value) { - CheckThreatLevel(ThreatLevel.VeryLow, "osWindParamSet"); + CheckThreatLevel(ThreatLevel.VeryLow, "osSetWindParam"); m_host.AddScriptLPS(1); IWindModule module = World.RequestModuleInterface(); @@ -1214,9 +1267,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public float osWindParamGet(string plugin, string param) + public float osGetWindParam(string plugin, string param) { - CheckThreatLevel(ThreatLevel.VeryLow, "osWindParamGet"); + CheckThreatLevel(ThreatLevel.VeryLow, "osGetWindParam"); m_host.AddScriptLPS(1); IWindModule module = World.RequestModuleInterface(); @@ -1257,7 +1310,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void osParcelSetDetails(LSL_Vector pos, LSL_List rules) { - CheckThreatLevel(ThreatLevel.High, "osParcelSetDetails"); + const string functionName = "osParcelSetDetails"; + CheckThreatLevel(ThreatLevel.High, functionName); + OSSLDeprecated(functionName, "osSetParcelDetails"); + SetParcelDetails(pos, rules, functionName); + } + public void osSetParcelDetails(LSL_Vector pos, LSL_List rules) + { + const string functionName = "osSetParcelDetails"; + CheckThreatLevel(ThreatLevel.High, functionName); + SetParcelDetails(pos, rules, functionName); + } + private void SetParcelDetails(LSL_Vector pos, LSL_List rules, string functionName) + { m_host.AddScriptLPS(1); // Get a reference to the land data and make sure the owner of the script @@ -1270,7 +1335,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - if (! World.Permissions.CanEditParcel(m_host.OwnerID, startLandObject)) + if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions)) { OSSLShoutError("You do not have permission to modify the parcel"); return; @@ -1296,13 +1361,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; case 2: - CheckThreatLevel(ThreatLevel.VeryHigh, "osParcelSetDetails"); + CheckThreatLevel(ThreatLevel.VeryHigh, functionName); if (UUID.TryParse(arg , out uuid)) newLand.OwnerID = uuid; break; case 3: - CheckThreatLevel(ThreatLevel.VeryHigh, "osParcelSetDetails"); + CheckThreatLevel(ThreatLevel.VeryHigh, functionName); if (UUID.TryParse(arg , out uuid)) newLand.GroupID = uuid; break; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 10d61caeff..63007c64f8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -67,8 +67,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, bool blend, int disp, int timer, int alpha, int face); - LSL_Float osTerrainGetHeight(int x, int y); - LSL_Integer osTerrainSetHeight(int x, int y, double val); + LSL_Float osGetTerrainHeight(int x, int y); + LSL_Float osTerrainGetHeight(int x, int y); // Deprecated + LSL_Integer osSetTerrainHeight(int x, int y, double val); + LSL_Integer osTerrainSetHeight(int x, int y, double val); //Deprecated void osTerrainFlush(); int osRegionRestart(double seconds); @@ -107,7 +109,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces string osSetFontName(string drawList, string fontName); string osSetFontSize(string drawList, int fontSize); string osSetPenSize(string drawList, int penSize); - string osSetPenColour(string drawList, string colour); + string osSetPenColor(string drawList, string color); + string osSetPenColour(string drawList, string colour); // Deprecated string osSetPenCap(string drawList, string direction, string type); string osDrawImage(string drawList, int width, int height, string imageUrl); vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize); @@ -119,18 +122,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour); void osSetEstateSunSettings(bool sunFixed, double sunHour); double osGetCurrentSunHour(); - double osSunGetParam(string param); - void osSunSetParam(string param, double value); + double osGetSunParam(string param); + double osSunGetParam(string param); // Deprecated + void osSetSunParam(string param, double value); + void osSunSetParam(string param, double value); // Deprecated // Wind Module Functions string osWindActiveModelPluginName(); - void osWindParamSet(string plugin, string param, float value); - float osWindParamGet(string plugin, string param); + void osSetWindParam(string plugin, string param, float value); + float osGetWindParam(string plugin, string param); // Parcel commands void osParcelJoin(vector pos1, vector pos2); void osParcelSubdivide(vector pos1, vector pos2); - void osParcelSetDetails(vector pos, LSL_List rules); + void osSetParcelDetails(vector pos, LSL_List rules); + void osParcelSetDetails(vector pos, LSL_List rules); // Deprecated string osGetScriptEngineName(); string osGetSimulatorVersion(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index f3142e65f0..e3ea556e5e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -81,11 +81,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osGetCurrentSunHour(); } + public double osGetSunParam(string param) + { + return m_OSSL_Functions.osGetSunParam(param); + } + // Deprecated public double osSunGetParam(string param) { return m_OSSL_Functions.osSunGetParam(param); } + public void osSetSunParam(string param, double value) + { + m_OSSL_Functions.osSetSunParam(param, value); + } + // Deprecated public void osSunSetParam(string param, double value) { m_OSSL_Functions.osSunSetParam(param, value); @@ -97,14 +107,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase } // Not yet plugged in as available OSSL functions, so commented out -// void osWindParamSet(string plugin, string param, float value) +// void osSetWindParam(string plugin, string param, float value) // { -// m_OSSL_Functions.osWindParamSet(plugin, param, value); +// m_OSSL_Functions.osSetWindParam(plugin, param, value); // } // -// float osWindParamGet(string plugin, string param) +// float osGetWindParam(string plugin, string param) // { -// return m_OSSL_Functions.osWindParamGet(plugin, param); +// return m_OSSL_Functions.osGetWindParam(plugin, param); // } public void osParcelJoin(vector pos1, vector pos2) @@ -116,7 +126,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { m_OSSL_Functions.osParcelSubdivide(pos1, pos2); } - + + public void osSetParcelDetails(vector pos, LSL_List rules) + { + m_OSSL_Functions.osSetParcelDetails(pos, rules); + } + // Deprecated public void osParcelSetDetails(vector pos, LSL_List rules) { m_OSSL_Functions.osParcelSetDetails(pos,rules); @@ -165,11 +180,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase blend, disp, timer, alpha, face); } + public LSL_Float osGetTerrainHeight(int x, int y) + { + return m_OSSL_Functions.osGetTerrainHeight(x, y); + } + // Deprecated public LSL_Float osTerrainGetHeight(int x, int y) { return m_OSSL_Functions.osTerrainGetHeight(x, y); } + public LSL_Integer osSetTerrainHeight(int x, int y, double val) + { + return m_OSSL_Functions.osSetTerrainHeight(x, y, val); + } + // Deprecated public LSL_Integer osTerrainSetHeight(int x, int y, double val) { return m_OSSL_Functions.osTerrainSetHeight(x, y, val); @@ -333,6 +358,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osSetPenCap(drawList, direction, type); } + public string osSetPenColor(string drawList, string color) + { + return m_OSSL_Functions.osSetPenColor(drawList, color); + } + // Deprecated public string osSetPenColour(string drawList, string colour) { return m_OSSL_Functions.osSetPenColour(drawList, colour); diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 85c13804a6..a1d9167c5a 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -29,6 +29,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.Drawing; +using System.IO; using System.Net; using System.Reflection; using OpenSim.Framework; @@ -48,7 +49,7 @@ namespace OpenSim.Services.Connectors.Hypergrid { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); -// private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013"); + private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013"); private IAssetService m_AssetService; @@ -143,43 +144,44 @@ namespace OpenSim.Services.Connectors.Hypergrid return true; } - UUID m_MissingTexture = new UUID("5748decc-f629-461c-9a36-a35a221fe21f"); - - public UUID GetMapImage(UUID regionID, string imageURL) + public UUID GetMapImage(UUID regionID, string imageURL, string storagePath) { if (m_AssetService == null) - return m_MissingTexture; + { + m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: No AssetService defined. Map tile not retrieved."); + return m_HGMapImage; + } + UUID mapTile = m_HGMapImage; + string filename = string.Empty; + Bitmap bitmap = null; try { - WebClient c = new WebClient(); //m_log.Debug("JPEG: " + imageURL); - string filename = regionID.ToString(); - c.DownloadFile(imageURL, filename + ".jpg"); - Bitmap m = new Bitmap(filename + ".jpg"); + string name = regionID.ToString(); + filename = Path.Combine(storagePath, name + ".jpg"); + c.DownloadFile(imageURL, filename); + bitmap = new Bitmap(filename); //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); - byte[] imageData = OpenJPEG.EncodeFromImage(m, true); - AssetBase ass = new AssetBase(UUID.Random(), "region " + filename, (sbyte)AssetType.Texture, regionID.ToString()); + byte[] imageData = OpenJPEG.EncodeFromImage(bitmap, true); + AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString()); // !!! for now //info.RegionSettings.TerrainImageID = ass.FullID; - ass.Temporary = true; - ass.Local = true; ass.Data = imageData; m_AssetService.Store(ass); // finally - return ass.FullID; - + mapTile = ass.FullID; } catch // LEGIT: Catching problems caused by OpenJPEG p/invoke { - m_log.Warn("[GATEKEEPER SERVICE CONNECTOR]: Failed getting/storing map image, because it is probably already in the cache"); + m_log.Info("[GATEKEEPER SERVICE CONNECTOR]: Failed getting/storing map image, because it is probably already in the cache"); } - return UUID.Zero; + return mapTile; } public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID) diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 0c41935215..7ddcfa61ae 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -104,7 +104,7 @@ namespace OpenSim.Services.Connectors.Hypergrid return false; } - string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/"; + string uri = m_ServerURL + "homeagent/" + aCircuit.AgentID + "/"; Console.WriteLine(" >>> LoginAgentToGrid <<< " + uri); diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index e2032d9200..4e3cfa56a8 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -235,6 +235,7 @@ namespace OpenSim.Services.Connectors.Simulation m_log.Warn("[REMOTE SIMULATION CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); return null; } + // Add the input arguments args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index d5d019566a..643d0fc114 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -26,7 +26,9 @@ */ using System; +using System.Collections; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Net; using System.Reflection; @@ -51,8 +53,6 @@ namespace OpenSim.Services.GridService LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013"); - private static uint m_autoMappingX = 0; private static uint m_autoMappingY = 0; private static bool m_enableAutoMapping = false; @@ -64,6 +64,7 @@ namespace OpenSim.Services.GridService protected UUID m_ScopeID = UUID.Zero; protected bool m_Check4096 = true; + protected string m_MapTileDirectory = string.Empty; // Hyperlink regions are hyperlinks on the map public readonly Dictionary m_HyperlinkRegions = new Dictionary(); @@ -120,9 +121,24 @@ namespace OpenSim.Services.GridService m_Check4096 = gridConfig.GetBoolean("Check4096", true); + m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", string.Empty); + m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); - m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services..."); + m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); + } + + if (!string.IsNullOrEmpty(m_MapTileDirectory)) + { + try + { + Directory.CreateDirectory(m_MapTileDirectory); + } + catch (Exception e) + { + m_log.WarnFormat("[HYPERGRID LINKER]: Could not create map tile storage directory {0}: {1}", m_MapTileDirectory, e); + m_MapTileDirectory = string.Empty; + } } if (MainConsole.Instance != null) @@ -215,7 +231,9 @@ namespace OpenSim.Services.GridService public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) { - m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, remoteRegionName, xloc, yloc); + m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", + ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), + remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); reason = string.Empty; regInfo = new GridRegion(); @@ -242,7 +260,9 @@ namespace OpenSim.Services.GridService GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); if (region != null) { - m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", regInfo.RegionLocX, regInfo.RegionLocY, region.RegionName, region.RegionID); + m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", + regInfo.RegionLocX / Constants.RegionSize, regInfo.RegionLocY / Constants.RegionSize, + region.RegionName, region.RegionID); reason = "Coordinates are already in use"; return false; } @@ -266,41 +286,22 @@ namespace OpenSim.Services.GridService if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out externalName, out imageURL, out reason)) return false; - if (regionID != UUID.Zero) - { - region = m_GridService.GetRegionByUUID(scopeID, regionID); - if (region != null) - { - m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize); - regInfo = region; - return true; - } - - regInfo.RegionID = regionID; - - if ( externalName == string.Empty ) - regInfo.RegionName = regInfo.ServerURI; - else - regInfo.RegionName = externalName; - - m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName); - - // Try get the map image - //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); - // I need a texture that works for this... the one I tried doesn't seem to be working - regInfo.TerrainImage = m_HGMapImage; - - AddHyperlinkRegion(regInfo, handle); - m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID); - - } - else + if (regionID == UUID.Zero) { m_log.Warn("[HYPERGRID LINKER]: Unable to link region"); reason = "Remote region could not be found"; return false; } + region = m_GridService.GetRegionByUUID(scopeID, regionID); + if (region != null) + { + m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", + region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize); + regInfo = region; + return true; + } + uint x, y; if (m_Check4096 && !Check4096(handle, out x, out y)) { @@ -310,7 +311,20 @@ namespace OpenSim.Services.GridService return false; } - m_log.Debug("[HYPERGRID LINKER]: link region succeeded"); + regInfo.RegionID = regionID; + + if ( externalName == string.Empty ) + regInfo.RegionName = regInfo.ServerURI; + else + regInfo.RegionName = externalName; + + m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName); + + // Get the map image + regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); + + AddHyperlinkRegion(regInfo, handle); + m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID); return true; } @@ -423,15 +437,14 @@ namespace OpenSim.Services.GridService return; } - MainConsole.Instance.Output("Region Name Region UUID"); - MainConsole.Instance.Output("Location URI"); - MainConsole.Instance.Output("-------------------------------------------------------------------------------"); + MainConsole.Instance.Output("Region Name"); + MainConsole.Instance.Output("Location Region UUID"); + MainConsole.Instance.Output(new string('-', 72)); foreach (RegionData r in regions) { - MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n", - r.RegionName, r.RegionID, - String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256), - "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverHttpPort"].ToString())); + MainConsole.Instance.Output(String.Format("{0}\n{2,-32} {1}\n", + r.RegionName, r.RegionID, String.Format("{0},{1} ({2},{3})", r.posX, r.posY, + r.posX / Constants.RegionSize, r.posY / Constants.RegionSize))); } return; } @@ -459,11 +472,14 @@ namespace OpenSim.Services.GridService xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize; yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize; serverURI = cmdparams[2]; - if (cmdparams.Length == 4) - remoteName = cmdparams[3]; + if (cmdparams.Length > 3) + remoteName = string.Join(" ", cmdparams, 3, cmdparams.Length - 3); string reason = string.Empty; GridRegion regInfo; - TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, UUID.Zero, out regInfo, out reason); + if (TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, UUID.Zero, out regInfo, out reason)) + MainConsole.Instance.Output("Hyperlink established"); + else + MainConsole.Instance.Output("Failed to link region: " + reason); } private void RunHGCommand(string command, string[] cmdparams) @@ -487,18 +503,6 @@ namespace OpenSim.Services.GridService } } else if (command.Equals("link-region")) - { - if (cmdparams.Length > 0 && cmdparams.Length < 5) - { - RunLinkRegionCommand(cmdparams); - } - else - { - LinkRegionCmdUsage(); - } - return; - } - else if (command.Equals("link-region")) { if (cmdparams.Length < 3) { @@ -514,40 +518,24 @@ namespace OpenSim.Services.GridService } //this should be the prefererred way of setting up hg links now - if ( cmdparams[2].StartsWith("http") && ( cmdparams.Length >= 3 && cmdparams.Length <= 5 )) { + if (cmdparams[2].StartsWith("http")) + { RunLinkRegionCommand(cmdparams); } else if (cmdparams[2].Contains(":")) { // New format - int xloc, yloc; - string mapName; - try + string[] parts = cmdparams[2].Split(':'); + if (parts.Length > 2) { - xloc = Convert.ToInt32(cmdparams[0]); - yloc = Convert.ToInt32(cmdparams[1]); - mapName = cmdparams[2]; - if (cmdparams.Length > 3) - for (int i = 3; i < cmdparams.Length; i++) - mapName += " " + cmdparams[i]; - - //m_log.Info(">> MapName: " + mapName); - } - catch (Exception e) - { - MainConsole.Instance.Output("[HGrid] Wrong format for link-region command: " + e.Message); - LinkRegionCmdUsage(); - return; + // Insert remote region name + ArrayList parameters = new ArrayList(cmdparams); + parameters.Insert(3, parts[2]); + cmdparams = (string[])parameters.ToArray(typeof(string)); } + cmdparams[2] = "http://" + parts[0] + ':' + parts[1]; - // Convert cell coordinates given by the user to meters - xloc = xloc * (int)Constants.RegionSize; - yloc = yloc * (int)Constants.RegionSize; - string reason = string.Empty; - if (TryLinkRegionToCoords(UUID.Zero, mapName, xloc, yloc, out reason) == null) - MainConsole.Instance.Output("Failed to link region: " + reason); - else - MainConsole.Instance.Output("Hyperlink established"); + RunLinkRegionCommand(cmdparams); } else { @@ -556,16 +544,12 @@ namespace OpenSim.Services.GridService int xloc, yloc; uint externalPort; string externalHostName; - string serverURI; try { xloc = Convert.ToInt32(cmdparams[0]); yloc = Convert.ToInt32(cmdparams[1]); externalPort = Convert.ToUInt32(cmdparams[3]); externalHostName = cmdparams[2]; - if ( cmdparams.Length == 4 ) { - - } //internalPort = Convert.ToUInt32(cmdparams[4]); //remotingPort = Convert.ToUInt32(cmdparams[5]); } @@ -582,27 +566,30 @@ namespace OpenSim.Services.GridService string reason = string.Empty; if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) { - if (cmdparams.Length >= 5) - { - regInfo.RegionName = ""; - for (int i = 4; i < cmdparams.Length; i++) - regInfo.RegionName += cmdparams[i] + " "; - } + // What is this? The GridRegion instance will be discarded anyway, + // which effectively ignores any local name given with the command. + //if (cmdparams.Length >= 5) + //{ + // regInfo.RegionName = ""; + // for (int i = 4; i < cmdparams.Length; i++) + // regInfo.RegionName += cmdparams[i] + " "; + //} } } return; } else if (command.Equals("unlink-region")) { - if (cmdparams.Length < 1 || cmdparams.Length > 1) + if (cmdparams.Length < 1) { UnlinkRegionCmdUsage(); return; } - if (TryUnlinkRegion(cmdparams[0])) - MainConsole.Instance.Output("Successfully unlinked " + cmdparams[0]); + string region = string.Join(" ", cmdparams); + if (TryUnlinkRegion(region)) + MainConsole.Instance.Output("Successfully unlinked " + region); else - MainConsole.Instance.Output("Unable to unlink " + cmdparams[0] + ", region not found."); + MainConsole.Instance.Output("Unable to unlink " + region + ", region not found."); } } diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 05be7b8307..4419201a50 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -123,42 +123,39 @@ namespace OpenSim.Services.HypergridService externalName = m_ExternalName + ((regionName != string.Empty) ? " " + regionName : ""); imageURL = string.Empty; reason = string.Empty; - + GridRegion region = null; m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty)? "default region" : regionName); if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty) { List defs = m_GridService.GetDefaultRegions(m_ScopeID); if (defs != null && defs.Count > 0) - m_DefaultGatewayRegion = defs[0]; - - try { - regionID = m_DefaultGatewayRegion.RegionID; - regionHandle = m_DefaultGatewayRegion.RegionHandle; + region = defs[0]; + m_DefaultGatewayRegion = region; } - catch + else { reason = "Grid setup problem. Try specifying a particular region here."; m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to send information. Please specify a default region for this grid!"); return false; } - - return true; } - - GridRegion region = m_GridService.GetRegionByName(m_ScopeID, regionName); - if (region == null) + else { - reason = "Region not found"; - return false; + region = m_GridService.GetRegionByName(m_ScopeID, regionName); + if (region == null) + { + reason = "Region not found"; + return false; + } } regionID = region.RegionID; regionHandle = region.RegionHandle; - string regionimage = "regionImage" + region.RegionID.ToString(); - regionimage = regionimage.Replace("-", ""); + string regionimage = "regionImage" + regionID.ToString(); + regionimage = regionimage.Replace("-", ""); imageURL = region.ServerURI + "index.php?method=" + regionimage; return true; diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 35192505a4..12dda48164 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -101,7 +101,7 @@ namespace OpenSim.Services.HypergridService serverConfig = config.Configs["GatekeeperService"]; m_GridName = serverConfig.GetString("ExternalName", string.Empty); } - else if (!m_GridName.EndsWith("/")) + if (!m_GridName.EndsWith("/")) m_GridName = m_GridName + "/"; } } diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs index c580078de3..9c992e04a6 100644 --- a/OpenSim/Services/Interfaces/IUserAccountService.cs +++ b/OpenSim/Services/Interfaces/IUserAccountService.cs @@ -101,7 +101,7 @@ namespace OpenSim.Services.Interfaces if (str != string.Empty) { string[] parts = str.Split(new char[] { ';' }); - Dictionary dic = new Dictionary(); +// Dictionary dic = new Dictionary(); foreach (string s in parts) { string[] parts2 = s.Split(new char[] { '*' }); diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 25d80bd99c..281b6e3d52 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -772,6 +772,8 @@ namespace OpenSim.Services.LLLoginService { aCircuit.ServiceURLs[kvp.Key] = kvp.Value; } + if (!aCircuit.ServiceURLs[kvp.Key].ToString().EndsWith("/")) + aCircuit.ServiceURLs[kvp.Key] = aCircuit.ServiceURLs[kvp.Key] + "/"; } // New style: service keys start with SRV_; override the previous @@ -784,6 +786,9 @@ namespace OpenSim.Services.LLLoginService { string keyName = serviceKey.Replace("SRV_", ""); aCircuit.ServiceURLs[keyName] = m_LoginServerConfig.GetString(serviceKey, string.Empty); + if (!aCircuit.ServiceURLs[keyName].ToString().EndsWith("/")) + aCircuit.ServiceURLs[keyName] = aCircuit.ServiceURLs[keyName] + "/"; + m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]); } } diff --git a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs new file mode 100644 index 0000000000..6fb9df1313 --- /dev/null +++ b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs @@ -0,0 +1,237 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using log4net; +using Mono.Addins; +using Nini.Config; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; + +namespace OpenSim.Tests.Common.Mock +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class MockGroupsServicesConnector : ISharedRegionModule, IGroupsServicesConnector + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public string Name + { + get { return "MockGroupsServicesConnector"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource config) + { + } + + public void Close() + { + } + + public void AddRegion(Scene scene) + { + m_log.DebugFormat("[MOCK GROUPS SERVICES CONNECTOR]: Adding to region {0}", scene.RegionInfo.RegionName); + scene.RegisterModuleInterface(this); + } + + public void RemoveRegion(Scene scene) + { + } + + public void RegionLoaded(Scene scene) + { + } + + public void PostInitialise() + { + } + + public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID, + int membershipFee, bool openEnrollment, bool allowPublish, + bool maturePublish, UUID founderID) + { + return UUID.Zero; + } + + public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, + UUID insigniaID, int membershipFee, bool openEnrollment, + bool allowPublish, bool maturePublish) + { + } + + public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, + string title, ulong powers) + { + } + + public void RemoveGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID) + { + } + + public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, + string title, ulong powers) + { + } + + public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName) + { + return null; + } + + public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID) + { + return default(GroupProfileData); + } + + public void SetAgentActiveGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) + { + } + + public void SetAgentActiveGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) + { + } + + public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) + { + } + + public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) + { + } + + public GroupInviteInfo GetAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) + { + return null; + } + + public void RemoveAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) + { + } + + public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) + { + } + + public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) + { + } + + public void AddAgentToGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) + { + } + + public void RemoveAgentFromGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) + { + } + + public List FindGroups(UUID requestingAgentID, string search) + { + return null; + } + + public GroupMembershipData GetAgentGroupMembership(UUID requestingAgentID, UUID AgentID, UUID GroupID) + { + return null; + } + + public GroupMembershipData GetAgentActiveMembership(UUID requestingAgentID, UUID AgentID) + { + return null; + } + + public List GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID) + { + return new List(); + } + + public List GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID) + { + return null; + } + + public List GetGroupRoles(UUID requestingAgentID, UUID GroupID) + { + return null; + } + + public List GetGroupMembers(UUID requestingAgentID, UUID GroupID) + { + return null; + } + + public List GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID) + { + return null; + } + + public List GetGroupNotices(UUID requestingAgentID, UUID GroupID) + { + return null; + } + + public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) + { + return null; + } + + public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) + { + } + + public void ResetAgentGroupChatSessions(UUID agentID) + { + } + + public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID) + { + return false; + } + + public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID) + { + return false; + } + + public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID) + { + } + + public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID) + { + } + } +} \ No newline at end of file diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 9d7733e465..8b1649635c 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -424,9 +424,12 @@ namespace OpenSim.Tests.Common.Setup foreach (IRegionModuleBase module in newModules) { module.AddRegion(scene); - module.RegionLoaded(scene); scene.AddRegionModule(module.Name, module); } + + // RegionLoaded is fired after all modules have been appropriately added to all scenes + foreach (IRegionModuleBase module in newModules) + module.RegionLoaded(scene); scene.SetModuleInterfaces(); } diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 0c21c66b6c..9cfac98eeb 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -397,9 +397,7 @@ ; sized packets and faster sending of data, but more delay in ; updating interest lists ; - ;PrimTerseUpdatesPerPacket = 25 - ;AvatarTerseUpdatesPerPacket = 10 - ;PrimFullUpdatesPerPacket = 100 + ;PrimUpdatesPerCallback = 100 ; TextureSendLimit determines how many packets will be put on ; the outgoing queue each cycle. Like the settings above, this diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index dbac73b277..9adf1ac5ff 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -24,7 +24,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,HGAssetService@8002/OpenSim.Server.Handlers.dll:AssetServiceConnector,8002/OpenSim.Server.Handlers.dll:HeloServiceInConnector" ; * This is common for all services, it's the network setup for the entire -; * server instance, if none if specified above +; * server instance, if none is specified above ; * [Network] port = 8003 @@ -48,7 +48,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 [AssetService] LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService" DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" - AssetLoaderArgs = "assets/AssetSets.xml" + AssetLoaderArgs = "./assets/AssetSets.xml" ; * This configuration loads the inventory server modules. It duplicates ; * the function of the legacy inventory server @@ -68,6 +68,12 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ;; Perform distance check for the creation of a linked region ; Check4096 = "True" + ;; Needed to display non-default map tile images for linked regions + AssetService = "OpenSim.Services.AssetService.dll:AssetService" + + ;; Directory for map tile images of linked regions + ; MapTileDirectory = "./" + ;; Next, we can specify properties of regions, including default and fallback regions ;; The syntax is: Region_ = "" ;; or: Region_ = "" @@ -79,11 +85,22 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; * This is the configuration for the freeswitch server in grid mode [FreeswitchService] LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService" + ;; IP of your FS server + ; ServerAddress = 127.0.0.1 + + ;; All other options are - well - optional + ; Realm = "127.0.0.1" + ; SIPProxy = "127.0.0.1:5060" + ; EchoServer = "127.0.0.1" + ; EchoPort = 50505 + ; AttemptSTUN = "false" + ; DefaultTimeout = 5000 + ; Context = "default" + ; UserName = "freeswitch" + ; Password = "password" ; * This is the new style authentication service. Currently, only MySQL -; * is implemented. "Realm" is the table that is used for user lookup. -; * It defaults to "useraccounts", which uses the new style. -; * Realm = "users" will use the legacy tables as an authentication source +; * is implemented. ; * [AuthenticationService] ; for the server connector @@ -97,7 +114,8 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; * This is the new style user service. ; * "Realm" is the table that is used for user lookup. -; * It defaults to "users", which uses the legacy tables +; * It defaults to "useraccounts", which uses the new style. +; * Realm = "users" will use the legacy tables as an authentication source ; * [UserAccountService] ; for the server connector @@ -150,7 +168,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 AllowRemoteSetLoginLevel = "false" ; If you run this login server behind a proxy, set this to true - ; HasProxy = true + ; HasProxy = false ; Defaults for the users, if none is specified in the useraccounts table entry (ServiceURLs) ; CHANGE THIS @@ -159,7 +177,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 SRV_HomeURI = "http://127.0.0.1:8002" SRV_InventoryServerURI = "http://127.0.0.1:8002" SRV_AssetServerURI = "http://127.0.0.1:8002" - SRV_ProfileServerURI = "http://127.0.0.1:8002" + SRV_ProfileServerURI = "http://127.0.0.1:8002/user" [GridInfoService] ; These settings are used to return information on a get_grid_info call. @@ -218,7 +236,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 AllowTeleportsToAnyRegion = true ; If you run this gatekeeper server behind a proxy, set this to true - ; HasProxy = true + ; HasProxy = false [UserAgentService] @@ -229,7 +247,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 GatekeeperService = "OpenSim.Services.HypergridService.dll:GatekeeperService" ; If you run this user agent server behind a proxy, set this to true - ; HasProxy = true + ; HasProxy = false ;; If you separate the UserAgentService from the LoginService, set this to ;; the IP address of the machine where your LoginService is diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index b12e05b398..7c13076eb8 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -16,7 +16,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector" ; * This is common for all services, it's the network setup for the entire -; * server instance, if none if specified above +; * server instance, if none is specified above ; * [Network] port = 8003 @@ -40,7 +40,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 [AssetService] LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService" DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" - AssetLoaderArgs = "assets/AssetSets.xml" + AssetLoaderArgs = "./assets/AssetSets.xml" AllowRemoteDelete = "false" ; * This configuration loads the inventory server modules. It duplicates @@ -84,9 +84,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; Password = "password" ; * This is the new style authentication service. Currently, only MySQL -; * is implemented. "Realm" is the table that is used for user lookup. -; * It defaults to "users", which uses the legacy tables as an -; * authentication source. +; * is implemented. ; * [AuthenticationService] ; for the server connector @@ -158,7 +156,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; MapTileURL = ""; ; If you run this login server behind a proxy, set this to true - ; HasProxy = true + ; HasProxy = false [GridInfoService] ; These settings are used to return information on a get_grid_info call. diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index 762b09a30e..761e5eb1dd 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example @@ -42,6 +42,9 @@ GridServerURI = "http://mygridserver.com:8003" ;AllowHypergridMapSearch = true + ;; Directory for map tile images of linked regions + ; MapTileDirectory = "./" + [AvatarService] ; ; change this to your grid-wide grid server @@ -84,7 +87,7 @@ ; Change this to your profile server ; accessible from other grids ; - ProfileServerURI = "http://mygridserver.com:8002/profiles" + ProfileServerURI = "http://mygridserver.com:8002/user" [Modules] ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. diff --git a/bin/config-include/GridHypergrid.ini b/bin/config-include/GridHypergrid.ini index 409b2a9760..e983755787 100644 --- a/bin/config-include/GridHypergrid.ini +++ b/bin/config-include/GridHypergrid.ini @@ -44,12 +44,15 @@ LocalGridInventoryService = "OpenSim.Region.CoreModules.dll:RemoteXInventoryServicesConnector" [GridService] - ; RemoteGridServicesConnector instantiates a LocalGridServicesConnector, - ; which in turn uses this + ; RemoteGridServicesConnector instantiates a LocalGridServicesConnector, + ; which in turn uses this LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" - AllowHypergridMapSearch = true + ; Needed to display non-default map tile images for linked regions + AssetService = "OpenSim.Services.Connectors.dll:AssetServicesConnector" + + AllowHypergridMapSearch = true [LibraryService] LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService" diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 58059f52a1..4956bc34fa 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -65,6 +65,9 @@ ;; With hypergrid, perform distance check for the creation of a linked region ; Check4096 = true + ;; Directory for map tile images of remote regions + ; MapTileDirectory = "./" + ;; Next, we can specify properties of regions, including default and fallback regions ;; The syntax is: Region_ = "" ;; where can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini index 68aa7397fc..486f22e698 100644 --- a/bin/config-include/StandaloneHypergrid.ini +++ b/bin/config-include/StandaloneHypergrid.ini @@ -65,12 +65,15 @@ LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" [GridService] - ; LocalGridServicesConnector needs this - LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" - Realm = "regions" + ; LocalGridServicesConnector needs this + LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" + Realm = "regions" StorageProvider = "OpenSim.Data.Null.dll" - AllowHypergridMapSearch = true + ; Needed to display non-default map tile images for remote regions + AssetService = "OpenSim.Services.AssetService.dll:AssetService" + + AllowHypergridMapSearch = true [PresenceService] LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService" diff --git a/bin/libode-x86_64.so b/bin/libode-x86_64.so index 57b7e1d683..9c3070abf4 100644 Binary files a/bin/libode-x86_64.so and b/bin/libode-x86_64.so differ diff --git a/prebuild.xml b/prebuild.xml index 9f2ef432d0..e408ccd26f 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2733,6 +2733,7 @@ + @@ -2747,6 +2748,7 @@ + @@ -2974,6 +2976,62 @@ + + + + ../../../bin/ + + + + + ../../../bin/ + + + + ../../../bin/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3002,6 +3060,7 @@ +