From f58941e89f122c2e1fd54a2f817fb8114e6c80ed Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 5 Apr 2011 01:30:13 +0100 Subject: [PATCH 01/10] Make the "All Estates" option work from the client (this makes chosen changes to all the estates that the user owns). This applies to adding/removing estate users, groups, managers and bans. This is the application of the AllEstates_0.5.patch from http://opensimulator.org/mantis/view.php?id=5420 Thanks very much, Snoopy! --- OpenSim/Data/MSSQL/MSSQLEstateData.cs | 5 + OpenSim/Data/MySQL/MySQLEstateData.cs | 30 ++++ OpenSim/Data/SQLite/SQLiteEstateData.cs | 22 +++ OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs | 24 ++- .../ClientStack/LindenUDP/LLClientView.cs | 24 ++- .../World/Estate/EstateManagementModule.cs | 149 +++++++++++++++++- .../Region/CoreModules/World/Sun/SunModule.cs | 6 +- .../Interfaces/IEstateDataService.cs | 6 + .../Framework/Interfaces/IEstateDataStore.cs | 6 + .../BareBonesShared/BareBonesSharedModule.cs | 3 + .../Simulation/EstateDataService.cs | 5 + 11 files changed, 268 insertions(+), 12 deletions(-) diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs index 92a8d80b9a..d10ebe4f48 100644 --- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs +++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs @@ -372,6 +372,11 @@ namespace OpenSim.Data.MSSQL return new List(); } + public List GetEstatesByOwner(UUID ownerID) + { + return new List(); + } + public bool LinkRegion(UUID regionID, int estateID) { // TODO: Implementation! diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index 6d72e82e2b..86416d1775 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs @@ -484,6 +484,36 @@ namespace OpenSim.Data.MySQL return result; } + public List GetEstatesByOwner(UUID ownerID) + { + List result = new List(); + + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "select estateID from estate_settings where EstateOwner = ?EstateOwner"; + cmd.Parameters.AddWithValue("?EstateOwner", ownerID); + + using (IDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + result.Add(Convert.ToInt32(reader["EstateID"])); + } + reader.Close(); + } + } + + + dbcon.Close(); + } + + return result; + } + public bool LinkRegion(UUID regionID, int estateID) { using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index 6afc5401d8..2f05a6e9f4 100644 --- a/OpenSim/Data/SQLite/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs @@ -412,6 +412,28 @@ namespace OpenSim.Data.SQLite return result; } + public List GetEstatesByOwner(UUID ownerID) + { + List result = new List(); + + string sql = "select EstateID from estate_settings where estate_settings.EstateOwner = :EstateOwner"; + + SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); + + cmd.CommandText = sql; + cmd.Parameters.AddWithValue(":EstateOwner", ownerID); + + IDataReader r = cmd.ExecuteReader(); + + while (r.Read()) + { + result.Add(Convert.ToInt32(r["EstateID"])); + } + r.Close(); + + return result; + } + public bool LinkRegion(UUID regionID, int estateID) { SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs index ad28c000c6..4dd225fddb 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs @@ -401,7 +401,29 @@ namespace OpenSim.Data.SQLiteLegacy return result; } - + + public List GetEstatesByOwner(UUID ownerID) + { + List result = new List(); + + string sql = "select EstateID from estate_settings where estate_settings.EstateOwner = :EstateOwner"; + + SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); + + cmd.CommandText = sql; + cmd.Parameters.Add(":EstateOwner", ownerID); + + IDataReader r = cmd.ExecuteReader(); + + while (r.Read()) + { + result.Add(Convert.ToInt32(r["EstateID"])); + } + r.Close(); + + return result; + } + public bool LinkRegion(UUID regionID, int estateID) { SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 2faffae58e..f8a0e0758a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -8809,13 +8809,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP case "instantmessage": if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) { - if (messagePacket.ParamList.Length < 5) + if (messagePacket.ParamList.Length < 2) return true; + UUID invoice = messagePacket.MethodData.Invoice; - UUID SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)); - string SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter); - string Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter); UUID sessionID = messagePacket.AgentData.SessionID; + + UUID SenderID; + string SenderName; + string Message; + + if (messagePacket.ParamList.Length < 5) + { + SenderID = AgentId; + SenderName = Utils.BytesToString(messagePacket.ParamList[0].Parameter); + Message = Utils.BytesToString(messagePacket.ParamList[1].Parameter); + } + else + { + SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)); + SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter); + Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter); + } + OnEstateBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message); } return true; diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 57ab13550a..b6d64acb80 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -200,12 +200,13 @@ namespace OpenSim.Region.CoreModules.World.Estate } Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); + sendRegionHandshakeToAll(); sendRegionInfoPacketToAll(); } private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient) { - sendRegionHandshakeToAll(); + // sendRegionHandshakeToAll(); } public void setRegionTerrainSettings(float WaterHeight, @@ -274,8 +275,25 @@ namespace OpenSim.Region.CoreModules.World.Estate { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.AddEstateUser(user); + estateSettings.Save(); + } + } + } + Scene.RegionInfo.EstateSettings.AddEstateUser(user); Scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); } @@ -289,10 +307,26 @@ namespace OpenSim.Region.CoreModules.World.Estate { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.RemoveEstateUser(user); + estateSettings.Save(); + } + } + } + Scene.RegionInfo.EstateSettings.RemoveEstateUser(user); Scene.RegionInfo.EstateSettings.Save(); - TriggerEstateInfoChange(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); } else @@ -304,8 +338,25 @@ namespace OpenSim.Region.CoreModules.World.Estate { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.AddEstateGroup(user); + estateSettings.Save(); + } + } + } + Scene.RegionInfo.EstateSettings.AddEstateGroup(user); Scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); } @@ -318,10 +369,26 @@ namespace OpenSim.Region.CoreModules.World.Estate { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.RemoveEstateGroup(user); + estateSettings.Save(); + } + } + } + Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); Scene.RegionInfo.EstateSettings.Save(); - TriggerEstateInfoChange(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); } else @@ -349,6 +416,29 @@ namespace OpenSim.Region.CoreModules.World.Estate if (!alreadyInList) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + EstateBan bitem = new EstateBan(); + + bitem.BannedUserID = user; + bitem.EstateID = (uint)estateID; + bitem.BannedHostAddress = "0.0.0.0"; + bitem.BannedHostIPMask = "0.0.0.0"; + + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.AddBan(bitem); + estateSettings.Save(); + } + } + } + EstateBan item = new EstateBan(); item.BannedUserID = user; @@ -358,6 +448,7 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.EstateSettings.AddBan(item); Scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); ScenePresence s = Scene.GetScenePresence(user); @@ -403,8 +494,25 @@ namespace OpenSim.Region.CoreModules.World.Estate if (alreadyInList && listitem != null) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.RemoveBan(user); + estateSettings.Save(); + } + } + } + Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); Scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); } else @@ -424,8 +532,25 @@ namespace OpenSim.Region.CoreModules.World.Estate { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.AddEstateManager(user); + estateSettings.Save(); + } + } + } + Scene.RegionInfo.EstateSettings.AddEstateManager(user); Scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); } @@ -438,10 +563,26 @@ namespace OpenSim.Region.CoreModules.World.Estate { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.RemoveEstateManager(user); + estateSettings.Save(); + } + } + } + Scene.RegionInfo.EstateSettings.RemoveEstateManager(user); Scene.RegionInfo.EstateSettings.Save(); - TriggerEstateInfoChange(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); } else diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index cea7c78ce8..4e14c73a25 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs @@ -469,8 +469,8 @@ namespace OpenSim.Region.CoreModules m_SunFixedHour = FixedSunHour; m_SunFixed = FixedSun; - m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString()); - m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString()); + // m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString()); + // m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString()); receivedEstateToolsSunUpdate = true; @@ -480,7 +480,7 @@ namespace OpenSim.Region.CoreModules // When sun settings are updated, we should update all clients with new settings. SunUpdateToAllClients(); - m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); + // m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); } } diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs index 38c10a6d1b..7066cf21e0 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs @@ -70,6 +70,12 @@ namespace OpenSim.Region.Framework.Interfaces /// List GetEstates(string search); + /// + /// Get the IDs of all estates owned by the given user. + /// + /// An empty list if no estates were found. + List GetEstatesByOwner(UUID ownerID); + /// /// Get the IDs of all estates. /// diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs index c82661db74..d790a30b8a 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs @@ -74,6 +74,12 @@ namespace OpenSim.Region.Framework.Interfaces /// Name of estate to search for. This is the exact name, no parttern matching is done. /// List GetEstates(string search); + + /// + /// Get the IDs of all estates owned by the given user. + /// + /// An empty list if no estates were found. + List GetEstatesByOwner(UUID ownerID); /// /// Get the IDs of all estates. diff --git a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs index 781fe952d2..dddea3e1d8 100644 --- a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs +++ b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs @@ -33,6 +33,9 @@ using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +[assembly: Addin("BareBonesSharedModule", "0.1")] +[assembly: AddinDependency("OpenSim", "0.5")] + namespace OpenSim.Region.OptionalModules.Example.BareBonesShared { /// diff --git a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs index d0588bff09..7184ba188e 100644 --- a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs +++ b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs @@ -111,6 +111,11 @@ namespace OpenSim.Services.Connectors return m_database.GetEstatesAll(); } + public List GetEstatesByOwner(UUID ownerID) + { + return m_database.GetEstatesByOwner(ownerID); + } + public bool LinkRegion(UUID regionID, int estateID) { return m_database.LinkRegion(regionID, estateID); From b2fbadeae82f0bdbfb3b7bdc8e14cb7f5b693092 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 4 Apr 2011 20:02:13 -0700 Subject: [PATCH 02/10] Updates NullStorage plugin. Thanks MisterBlue... --- OpenSim/Data/Null/NullEstateData.cs | 123 ++++++++++++++++++++++++ OpenSim/Data/Null/NullSimulationData.cs | 17 ++++ 2 files changed, 140 insertions(+) create mode 100755 OpenSim/Data/Null/NullEstateData.cs diff --git a/OpenSim/Data/Null/NullEstateData.cs b/OpenSim/Data/Null/NullEstateData.cs new file mode 100755 index 0000000000..6ce7a367fe --- /dev/null +++ b/OpenSim/Data/Null/NullEstateData.cs @@ -0,0 +1,123 @@ +/* + * 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 OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework; +using OpenSim.Region.Framework.Interfaces; + +namespace OpenSim.Data.Null +{ + public class NullEstateStore : IEstateDataStore + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private string m_connectionString; + + protected virtual Assembly Assembly + { + get { return GetType().Assembly; } + } + + public NullEstateStore() + { + } + + public NullEstateStore(string connectionString) + { + Initialise(connectionString); + } + + public void Initialise(string connectionString) + { + m_connectionString = connectionString; + } + + private string[] FieldList + { + get { return new string[0]; } + } + + public EstateSettings LoadEstateSettings(UUID regionID, bool create) + { + // This fools the initialization caller into thinking an estate was fetched (a check in OpenSimBase). + // The estate info is pretty empty so don't try banning anyone. + EstateSettings oneEstate = new EstateSettings(); + oneEstate.EstateID = 1; + return oneEstate; + } + + public void StoreEstateSettings(EstateSettings es) + { + return; + } + + public EstateSettings LoadEstateSettings(int estateID) + { + return new EstateSettings(); + } + + public List LoadEstateSettingsAll() + { + List allEstateSettings = new List(); + allEstateSettings.Add(new EstateSettings()); + return allEstateSettings; + } + + public List GetEstatesAll() + { + List result = new List(); + return result; + } + + public List GetEstates(string search) + { + List result = new List(); + return result; + } + + public bool LinkRegion(UUID regionID, int estateID) + { + return false; + } + + public List GetRegions(int estateID) + { + List result = new List(); + return result; + } + + public bool DeleteEstate(int estateID) + { + return false; + } + } +} diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs index eb4e313f84..e8d733b582 100644 --- a/OpenSim/Data/Null/NullSimulationData.cs +++ b/OpenSim/Data/Null/NullSimulationData.cs @@ -38,6 +38,15 @@ namespace OpenSim.Data.Null /// public class NullSimulationData : ISimulationDataStore { + public NullSimulationData() + { + } + + public NullSimulationData(string connectionString) + { + Initialise(connectionString); + } + public void Initialise(string dbfile) { return; @@ -85,12 +94,20 @@ namespace OpenSim.Data.Null return new List(); } + Dictionary m_terrains = new Dictionary(); public void StoreTerrain(double[,] ter, UUID regionID) { + if (m_terrains.ContainsKey(regionID)) + m_terrains.Remove(regionID); + m_terrains.Add(regionID, ter); } public double[,] LoadTerrain(UUID regionID) { + if (m_terrains.ContainsKey(regionID)) + { + return m_terrains[regionID]; + } return null; } From 18e206d2ed5cc1828f2ada27ff4698bdc0b84352 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Mon, 4 Apr 2011 23:45:28 -0400 Subject: [PATCH 03/10] * Bugfix - Compile NullEstateData implement public List IEstateDataStore.GetEstatesByOwner(UUID) --- OpenSim/Data/Null/NullEstateData.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/OpenSim/Data/Null/NullEstateData.cs b/OpenSim/Data/Null/NullEstateData.cs index 6ce7a367fe..0cebff55aa 100755 --- a/OpenSim/Data/Null/NullEstateData.cs +++ b/OpenSim/Data/Null/NullEstateData.cs @@ -119,5 +119,15 @@ namespace OpenSim.Data.Null { return false; } + + #region IEstateDataStore Members + + + public List GetEstatesByOwner(UUID ownerID) + { + return new List(); + } + + #endregion } } From c1dec225abd09efc5061b2ffd40996ad13fd16e9 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 5 Apr 2011 17:47:11 +0100 Subject: [PATCH 04/10] Handle the client's parcel info requests asynchronously rather than synchronously. Handling these synchronously kills the inbound packet loop if many requests are made for remote land and those requests are handled slowly or timeout (timeout is 10s) This can happen if a user searches for "land for sale" and then clicks many of the parcels in the list (or just presses down arrow to move through every entry). --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index f8a0e0758a..34d72ac69b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4938,7 +4938,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.TeleportLocationRequest, HandleTeleportLocationRequest); AddLocalPacketHandler(PacketType.UUIDNameRequest, HandleUUIDNameRequest, false); AddLocalPacketHandler(PacketType.RegionHandleRequest, HandleRegionHandleRequest); - AddLocalPacketHandler(PacketType.ParcelInfoRequest, HandleParcelInfoRequest, false); + AddLocalPacketHandler(PacketType.ParcelInfoRequest, HandleParcelInfoRequest); AddLocalPacketHandler(PacketType.ParcelAccessListRequest, HandleParcelAccessListRequest, false); AddLocalPacketHandler(PacketType.ParcelAccessListUpdate, HandleParcelAccessListUpdate, false); AddLocalPacketHandler(PacketType.ParcelPropertiesRequest, HandleParcelPropertiesRequest, false); From 3d400fc663104b6d899ee37afeb7f83c68af45d4 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 5 Apr 2011 18:24:23 +0100 Subject: [PATCH 05/10] If an object is selected, then don't include it in owner/group/others prim counts. This fixes the total prim count that the viewer displays when prims are selected - it appears to ignore the total that we pass it and adds up the counts separately. --- .../CoreModules/World/Land/PrimCountModule.cs | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index bc140aee5b..7a04eb18f8 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -206,25 +206,29 @@ namespace OpenSim.Region.CoreModules.World.Land else parcelCounts.Users[obj.OwnerID] = partCount; - if (landData.IsGroupOwned) + if (obj.IsSelected) { - if (obj.OwnerID == landData.GroupID) - parcelCounts.Owner += partCount; - else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID) - parcelCounts.Group += partCount; - else - parcelCounts.Others += partCount; + parcelCounts.Selected += partCount; } else { - if (obj.OwnerID == landData.OwnerID) - parcelCounts.Owner += partCount; + if (landData.IsGroupOwned) + { + if (obj.OwnerID == landData.GroupID) + parcelCounts.Owner += partCount; + else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID) + parcelCounts.Group += partCount; + else + parcelCounts.Others += partCount; + } else - parcelCounts.Others += partCount; + { + if (obj.OwnerID == landData.OwnerID) + parcelCounts.Owner += partCount; + else + parcelCounts.Others += partCount; + } } - - if (obj.IsSelected) - parcelCounts.Selected += partCount; } } @@ -380,6 +384,7 @@ namespace OpenSim.Region.CoreModules.World.Land count = counts.Owner; count += counts.Group; count += counts.Others; + count += counts.Selected; } } From dc6ce2444385730a3ea1ba1104f2e2caa15a907a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 5 Apr 2011 20:31:52 +0100 Subject: [PATCH 06/10] switch llGetParcelPrimCount() to use new prim counts module --- .../Shared/Api/Implementation/LSL_Api.cs | 87 +++++++++---------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 43b0da320e..5f8ca91550 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9835,63 +9835,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) { m_host.AddScriptLPS(1); + + ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); + + //LandData land = World.GetLandData((float)pos.x, (float)pos.y); - LandData land = World.GetLandData((float)pos.x, (float)pos.y); - - if (land == null) - { + if (lo == null) return 0; - } + + IPrimCounts pc = lo.PrimCounts; - else + if (sim_wide != 0) { - if (sim_wide != 0) + if (category == 0) { - if (category == 0) - { - return land.SimwidePrims; - } - - else - { - //public int simwideArea = 0; - return 0; - } + return pc.Simulator; } - else { - if (category == 0)//Total Prims - { - return 0;//land. - } - - else if (category == 1)//Owner Prims - { - return land.OwnerPrims; - } - - else if (category == 2)//Group Prims - { - return land.GroupPrims; - } - - else if (category == 3)//Other Prims - { - return land.OtherPrims; - } - - else if (category == 4)//Selected - { - return land.SelectedPrims; - } - - else if (category == 5)//Temp - { - return 0;//land. - } + // counts not implemented yet + return 0; } } + else + { + if (category == 0)//Total Prims + { + return pc.Total; + } + else if (category == 1)//Owner Prims + { + return pc.Owner; + } + else if (category == 2)//Group Prims + { + return pc.Group; + } + else if (category == 3)//Other Prims + { + return pc.Others; + } + else if (category == 4)//Selected + { + return pc.Selected; + } + else if (category == 5)//Temp + { + return 0; // counts not implemented yet + } + } + return 0; } From f030ba8992a17553b5824955c95096b8326b23c8 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 5 Apr 2011 20:39:58 +0100 Subject: [PATCH 07/10] replace magic numbers in llGetParcelPrimCount() with constants --- .../Shared/Api/Implementation/LSL_Api.cs | 30 +++++-------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5f8ca91550..e5be641d26 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9837,17 +9837,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); - - //LandData land = World.GetLandData((float)pos.x, (float)pos.y); if (lo == null) return 0; IPrimCounts pc = lo.PrimCounts; - if (sim_wide != 0) + if (sim_wide != ScriptBaseClass.FALSE) { - if (category == 0) + if (category == ScriptBaseClass.PARCEL_COUNT_TOTAL) { return pc.Simulator; } @@ -9859,30 +9857,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - if (category == 0)//Total Prims - { + if (category == ScriptBaseClass.PARCEL_COUNT_TOTAL) return pc.Total; - } - else if (category == 1)//Owner Prims - { + else if (category == ScriptBaseClass.PARCEL_COUNT_OWNER) return pc.Owner; - } - else if (category == 2)//Group Prims - { + else if (category == ScriptBaseClass.PARCEL_COUNT_GROUP) return pc.Group; - } - else if (category == 3)//Other Prims - { + else if (category == ScriptBaseClass.PARCEL_COUNT_OTHER) return pc.Others; - } - else if (category == 4)//Selected - { + else if (category == ScriptBaseClass.PARCEL_COUNT_SELECTED) return pc.Selected; - } - else if (category == 5)//Temp - { + else if (category == ScriptBaseClass.PARCEL_COUNT_TEMP) return 0; // counts not implemented yet - } } return 0; From 0e465da187c93e7ff21f91742f75ee9f3b76b04e Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 5 Apr 2011 21:25:54 +0100 Subject: [PATCH 08/10] remove now unused individual LandData prim counts. However, the calls to the land management module to record prims need to remain, since they were also being used to return owner object lists, etc. This is probably why prim counts were being done there in the first place. --- OpenSim/Framework/ILandChannel.cs | 1 - OpenSim/Framework/ILandObject.cs | 2 +- OpenSim/Framework/LandData.cs | 65 +-------------- .../Tests/LandDataSerializerTests.cs | 8 +- .../CoreModules/World/Land/LandChannel.cs | 10 --- .../World/Land/LandManagementModule.cs | 39 +++------ .../CoreModules/World/Land/LandObject.cs | 83 ++++--------------- OpenSim/Region/Framework/Scenes/Scene.cs | 14 ---- .../RegionCombinerLargeLandChannel.cs | 5 -- 9 files changed, 31 insertions(+), 196 deletions(-) diff --git a/OpenSim/Framework/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs index 30bae16d81..869d4c8184 100644 --- a/OpenSim/Framework/ILandChannel.cs +++ b/OpenSim/Framework/ILandChannel.cs @@ -77,7 +77,6 @@ namespace OpenSim.Region.Framework.Interfaces /// void Clear(bool setupDefaultParcel); - bool IsLandPrimCountTainted(); bool IsForcefulBansAllowed(); void UpdateLandObject(int localID, LandData data); void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient); diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index 931e24aebb..98ea01ee31 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs @@ -89,7 +89,7 @@ namespace OpenSim.Framework void SendForceObjectSelect(int local_id, int request_type, List returnIDs, IClientAPI remote_client); void SendLandObjectOwners(IClientAPI remote_client); void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client); - void ResetLandPrimCounts(); + void ResetOverMeRecord(); void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area); void DeedToGroup(UUID groupID); diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index a9a493d876..145ccddb44 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -54,12 +54,10 @@ namespace OpenSim.Framework private int _claimPrice = 0; //Unemplemented private UUID _globalID = UUID.Zero; private UUID _groupID = UUID.Zero; - private int _groupPrims = 0; private bool _isGroupOwned = false; private byte[] _bitmap = new byte[512]; private string _description = String.Empty; - private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark | (uint) ParcelFlags.AllowAPrimitiveEntry | (uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform | @@ -72,17 +70,13 @@ namespace OpenSim.Framework private int _localID = 0; private byte _mediaAutoScale = 0; private UUID _mediaID = UUID.Zero; - private string _mediaURL = String.Empty; private string _musicURL = String.Empty; - private int _otherPrims = 0; private UUID _ownerID = UUID.Zero; - private int _ownerPrims = 0; private List _parcelAccessList = new List(); private float _passHours = 0; private int _passPrice = 0; private int _salePrice = 0; //Unemeplemented. Parcels price. - private int _selectedPrims = 0; private int _simwideArea = 0; private int _simwidePrims = 0; private UUID _snapshotID = UUID.Zero; @@ -283,19 +277,6 @@ namespace OpenSim.Framework } } - /// - /// Number of SceneObjectPart that are owned by a Group - /// - [XmlIgnore] - public int GroupPrims { - get { - return _groupPrims; - } - set { - _groupPrims = value; - } - } - /// /// Returns true if the Land Parcel is owned by a group /// @@ -453,20 +434,6 @@ namespace OpenSim.Framework } } - /// - /// Number of SceneObjectPart that are owned by users who do not own the parcel - /// and don't have the 'group. These are elegable for AutoReturn collection - /// - [XmlIgnore] - public int OtherPrims { - get { - return _otherPrims; - } - set { - _otherPrims = value; - } - } - /// /// Owner Avatar or Group of the parcel. Naturally, all land masses must be /// owned by someone @@ -480,19 +447,6 @@ namespace OpenSim.Framework } } - /// - /// Number of SceneObjectPart that are owned by the owner of the parcel - /// - [XmlIgnore] - public int OwnerPrims { - get { - return _ownerPrims; - } - set { - _ownerPrims = value; - } - } - /// /// List of access data for the parcel. User data, some bitflags, and a time /// @@ -541,19 +495,6 @@ namespace OpenSim.Framework } } - /// - /// Number of SceneObjectPart that are currently selected by avatar - /// - [XmlIgnore] - public int SelectedPrims { - get { - return _selectedPrims; - } - set { - _selectedPrims = value; - } - } - /// /// Number of meters^2 in the Simulator /// @@ -666,10 +607,6 @@ namespace OpenSim.Framework landData._claimPrice = _claimPrice; landData._globalID = _globalID; landData._groupID = _groupID; - landData._groupPrims = _groupPrims; - landData._otherPrims = _otherPrims; - landData._ownerPrims = _ownerPrims; - landData._selectedPrims = _selectedPrims; landData._isGroupOwned = _isGroupOwned; landData._localID = _localID; landData._landingType = _landingType; @@ -731,4 +668,4 @@ namespace OpenSim.Framework return land; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs index 70e87b3c08..c69c89dc0a 100644 --- a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs +++ b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs @@ -42,10 +42,7 @@ namespace OpenSim.Framework.Serialization.Tests private LandData landWithParcelAccessList; private static string preSerialized = "\n\n 128\n 0\n 00000000-0000-0000-0000-000000000000\n 10\n 0\n 0\n 54ff9641-dd40-4a2c-b1f1-47dd3af24e50\n d740204e-bbbf-44aa-949d-02c7d739f6a5\n False\n AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\n land data to test LandDataSerializer\n 536870944\n 2\n LandDataSerializerTest Land\n 0\n 0\n 1\n d4452578-2f25-4b97-a81b-819af559cfd7\n http://videos.opensimulator.org/bumblebee.mp4\n \n 1b8eedf9-6d15-448b-8015-24286f1756bf\n \n 0\n 0\n 0\n 00000000-0000-0000-0000-000000000000\n <0, 0, 0>\n <0, 0, 0>\n 0\n 0\n"; - private static string preSerializedWithParcelAccessList = "\n\n 128\n 0\n 00000000-0000-0000-0000-000000000000\n 10\n 0\n 0\n 54ff9641-dd40-4a2c-b1f1-47dd3af24e50\n d740204e-bbbf-44aa-949d-02c7d739f6a5\n False\n AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\n land data to test LandDataSerializer\n 536870944\n 2\n LandDataSerializerTest Land\n 0\n 0\n 1\n d4452578-2f25-4b97-a81b-819af559cfd7\n http://videos.opensimulator.org/bumblebee.mp4\n \n 1b8eedf9-6d15-448b-8015-24286f1756bf\n \n \n 62d65d45-c91a-4f77-862c-46557d978b6c\n \n 2\n \n \n ec2a8d18-2378-4fe0-8b68-2a31b57c481e\n \n 1\n \n \n 0\n 0\n 0\n 00000000-0000-0000-0000-000000000000\n <0, 0, 0>\n <0, 0, 0>\n 0\n 0\n"; - - - + private static string preSerializedWithParcelAccessList = "\n\n 128\n 0\n 00000000-0000-0000-0000-000000000000\n 10\n 0\n 0\n 54ff9641-dd40-4a2c-b1f1-47dd3af24e50\n d740204e-bbbf-44aa-949d-02c7d739f6a5\n False\n AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\n land data to test LandDataSerializer\n 536870944\n 2\n LandDataSerializerTest Land\n 0\n 0\n 1\n d4452578-2f25-4b97-a81b-819af559cfd7\n http://videos.opensimulator.org/bumblebee.mp4\n \n 1b8eedf9-6d15-448b-8015-24286f1756bf\n \n \n 62d65d45-c91a-4f77-862c-46557d978b6c\n \n 2\n \n \n ec2a8d18-2378-4fe0-8b68-2a31b57c481e\n \n 1\n \n \n 0\n 0\n 0\n 00000000-0000-0000-0000-000000000000\n <0, 0, 0>\n <0, 0, 0>\n 0\n 0\n"; [SetUp] public void setup() @@ -62,7 +59,6 @@ namespace OpenSim.Framework.Serialization.Tests this.land.ClaimPrice = 0; this.land.GlobalID = new UUID("54ff9641-dd40-4a2c-b1f1-47dd3af24e50"); this.land.GroupID = new UUID("d740204e-bbbf-44aa-949d-02c7d739f6a5"); - this.land.GroupPrims = 0; this.land.Description = "land data to test LandDataSerializer"; this.land.Flags = (uint)(ParcelFlags.AllowDamage | ParcelFlags.AllowVoiceChat); this.land.LandingType = (byte)LandingType.Direct; @@ -132,4 +128,4 @@ namespace OpenSim.Framework.Serialization.Tests "Reified LandData.Name != original LandData.Name (pre-serialized with parcel access list)"); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index 7d990c265c..7fc358dc54 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs @@ -133,16 +133,6 @@ namespace OpenSim.Region.CoreModules.World.Land return new List(); } - public bool IsLandPrimCountTainted() - { - if (m_landManagementModule != null) - { - return m_landManagementModule.IsLandPrimCountTainted(); - } - - return false; - } - public bool IsForcefulBansAllowed() { if (m_landManagementModule != null) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 2b5f7a037a..adfac0511f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -89,7 +89,6 @@ namespace OpenSim.Region.CoreModules.World.Land /// private readonly Dictionary m_landList = new Dictionary(); - private bool m_landPrimCountTainted; private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; private bool m_allowedForcefulBans = true; @@ -122,18 +121,18 @@ namespace OpenSim.Region.CoreModules.World.Land m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd; m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate; + m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene; + m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; + m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel; m_scene.EventManager.OnClientMovement += EventManagerOnClientMovement; m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy; m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy; m_scene.EventManager.OnNewClient += EventManagerOnNewClient; m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement; - m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene; m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage; m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; - m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; - m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; - m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted; + m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole; @@ -779,34 +778,24 @@ namespace OpenSim.Region.CoreModules.World.Land #region Parcel Modification - public void ResetAllLandPrimCounts() + public void ResetOverMeRecord() { lock (m_landList) { foreach (LandObject p in m_landList.Values) { - p.ResetLandPrimCounts(); + p.ResetOverMeRecord(); } } } - public void EventManagerOnParcelPrimCountTainted() - { - m_landPrimCountTainted = true; - } - - public bool IsLandPrimCountTainted() - { - return m_landPrimCountTainted; - } - public void EventManagerOnParcelPrimCountAdd(SceneObjectGroup obj) { Vector3 position = obj.AbsolutePosition; ILandObject landUnderPrim = GetLandObject(position.X, position.Y); if (landUnderPrim != null) { - ((LandObject)landUnderPrim).AddPrimToCount(obj); + ((LandObject)landUnderPrim).AddPrimOverMe(obj); } } @@ -816,7 +805,7 @@ namespace OpenSim.Region.CoreModules.World.Land { foreach (LandObject p in m_landList.Values) { - p.RemovePrimFromCount(obj); + p.RemovePrimFromOverMe(obj); } } } @@ -849,8 +838,7 @@ namespace OpenSim.Region.CoreModules.World.Land foreach (LandObject p in landOwnersAndParcels[owner]) { simArea += p.LandData.Area; - simPrims += p.LandData.OwnerPrims + p.LandData.OtherPrims + p.LandData.GroupPrims + - p.LandData.SelectedPrims; + simPrims += p.PrimCounts.Total; } foreach (LandObject p in landOwnersAndParcels[owner]) @@ -867,7 +855,7 @@ namespace OpenSim.Region.CoreModules.World.Land // "[LAND MANAGEMENT MODULE]: Triggered EventManagerOnParcelPrimCountUpdate() for {0}", // m_scene.RegionInfo.RegionName); - ResetAllLandPrimCounts(); + ResetOverMeRecord(); EntityBase[] entities = m_scene.Entities.GetEntities(); foreach (EntityBase obj in entities) { @@ -880,15 +868,13 @@ namespace OpenSim.Region.CoreModules.World.Land } } FinalizeLandPrimCountUpdate(); - m_landPrimCountTainted = false; } public void EventManagerOnRequestParcelPrimCountUpdate() { - ResetAllLandPrimCounts(); + ResetOverMeRecord(); m_scene.EventManager.TriggerParcelPrimCountUpdate(); FinalizeLandPrimCountUpdate(); - m_landPrimCountTainted = false; } /// @@ -952,8 +938,6 @@ namespace OpenSim.Region.CoreModules.World.Land m_landList[startLandObjectIndex].ForceUpdateLandInfo(); } - EventManagerOnParcelPrimCountTainted(); - //Now add the new land object ILandObject result = AddLandObject(newLand); UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); @@ -1020,7 +1004,6 @@ namespace OpenSim.Region.CoreModules.World.Land performFinalLandJoin(masterLandObject, slaveLandObject); } } - EventManagerOnParcelPrimCountTainted(); masterLandObject.SendLandUpdateToAvatarsOverMe(); } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index e7bdb19e56..9803bdfd0a 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -64,8 +64,6 @@ namespace OpenSim.Region.CoreModules.World.Land #endregion - #region ILandObject Members - public int GetPrimsFree() { m_scene.EventManager.TriggerParcelPrimCountUpdate(); @@ -213,6 +211,7 @@ namespace OpenSim.Region.CoreModules.World.Land return simMax; } } + #endregion #region Packet Request Handling @@ -909,9 +908,12 @@ namespace OpenSim.Region.CoreModules.World.Land lock (primsOverMe) { +// m_log.DebugFormat( +// "[LAND OBJECT]: Request for SendLandObjectOwners() from {0} with {1} known prims on region", +// remote_client.Name, primsOverMe.Count); + try { - foreach (SceneObjectGroup obj in primsOverMe) { try @@ -950,6 +952,7 @@ namespace OpenSim.Region.CoreModules.World.Land public Dictionary GetLandObjectOwners() { Dictionary ownersAndCount = new Dictionary(); + lock (primsOverMe) { try @@ -986,8 +989,10 @@ namespace OpenSim.Region.CoreModules.World.Land public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) { - Dictionary> returns = - new Dictionary>(); +// m_log.DebugFormat( +// "[LAND OBJECT]: Request to return objects in {0} from {1}", LandData.Name, remote_client.Name); + + Dictionary> returns = new Dictionary>(); lock (primsOverMe) { @@ -1060,82 +1065,24 @@ namespace OpenSim.Region.CoreModules.World.Land #region Object Adding/Removing from Parcel - public void ResetLandPrimCounts() + public void ResetOverMeRecord() { - LandData.GroupPrims = 0; - LandData.OwnerPrims = 0; - LandData.OtherPrims = 0; - LandData.SelectedPrims = 0; - - lock (primsOverMe) primsOverMe.Clear(); } - public void AddPrimToCount(SceneObjectGroup obj) + public void AddPrimOverMe(SceneObjectGroup obj) { - - UUID prim_owner = obj.OwnerID; - int prim_count = obj.PrimCount; - - if (obj.IsSelected) - { - LandData.SelectedPrims += prim_count; - } - else - { - if (prim_owner == LandData.OwnerID) - { - LandData.OwnerPrims += prim_count; - } - else if ((obj.GroupID == LandData.GroupID || - prim_owner == LandData.GroupID) && - LandData.GroupID != UUID.Zero) - { - LandData.GroupPrims += prim_count; - } - else - { - LandData.OtherPrims += prim_count; - } - } - lock (primsOverMe) primsOverMe.Add(obj); } - public void RemovePrimFromCount(SceneObjectGroup obj) + public void RemovePrimFromOverMe(SceneObjectGroup obj) { lock (primsOverMe) - { - if (primsOverMe.Contains(obj)) - { - UUID prim_owner = obj.OwnerID; - int prim_count = obj.PrimCount; - - if (prim_owner == LandData.OwnerID) - { - LandData.OwnerPrims -= prim_count; - } - else if (obj.GroupID == LandData.GroupID || - prim_owner == LandData.GroupID) - { - LandData.GroupPrims -= prim_count; - } - else - { - LandData.OtherPrims -= prim_count; - } - - primsOverMe.Remove(obj); - } - } + primsOverMe.Remove(obj); } - #endregion - - #endregion - #endregion /// @@ -1157,5 +1104,7 @@ namespace OpenSim.Region.CoreModules.World.Land LandData.MusicURL = url; SendLandUpdateToAvatarsOverMe(); } + + #endregion } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 35a798e2d0..a62d6d7e0d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1427,20 +1427,6 @@ namespace OpenSim.Region.Framework.Scenes ); } - /// - /// Recount SceneObjectPart in parcel aabb - /// - private void UpdateLand() - { - if (LandChannel != null) - { - if (LandChannel.IsLandPrimCountTainted()) - { - EventManager.TriggerParcelPrimCountUpdate(); - } - } - } - /// /// Update the terrain if it needs to be updated. /// diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs index 98e5453d1e..a133e51da6 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs @@ -130,11 +130,6 @@ public class RegionCombinerLargeLandChannel : ILandChannel } } - public bool IsLandPrimCountTainted() - { - return RootRegionLandChannel.IsLandPrimCountTainted(); - } - public bool IsForcefulBansAllowed() { return RootRegionLandChannel.IsForcefulBansAllowed(); From acacee98c6e4398b0ea808f23333a31689966133 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 5 Apr 2011 22:15:06 +0100 Subject: [PATCH 09/10] properly refresh object owner list when refresh button is hit on land parcel object tab --- .../World/Land/LandManagementModule.cs | 17 +++++++++-------- .../Region/CoreModules/World/Land/LandObject.cs | 6 +++++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index adfac0511f..abc7a3afc0 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -62,8 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Land public class LandManagementModule : INonSharedRegionModule { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly string remoteParcelRequestPath = "0009/"; @@ -307,8 +306,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// The parcel created. protected ILandObject CreateDefaultParcel() { -// m_log.DebugFormat( -// "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); + m_log.DebugFormat( + "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); @@ -778,7 +777,7 @@ namespace OpenSim.Region.CoreModules.World.Land #region Parcel Modification - public void ResetOverMeRecord() + public void ResetOverMeRecords() { lock (m_landList) { @@ -855,7 +854,7 @@ namespace OpenSim.Region.CoreModules.World.Land // "[LAND MANAGEMENT MODULE]: Triggered EventManagerOnParcelPrimCountUpdate() for {0}", // m_scene.RegionInfo.RegionName); - ResetOverMeRecord(); + ResetOverMeRecords(); EntityBase[] entities = m_scene.Entities.GetEntities(); foreach (EntityBase obj in entities) { @@ -872,7 +871,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnRequestParcelPrimCountUpdate() { - ResetOverMeRecord(); + ResetOverMeRecords(); m_scene.EventManager.TriggerParcelPrimCountUpdate(); FinalizeLandPrimCountUpdate(); } @@ -1193,6 +1192,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (land != null) { + m_scene.EventManager.TriggerParcelPrimCountUpdate(); m_landList[local_id].SendLandObjectOwners(remote_client); } else @@ -1424,7 +1424,8 @@ namespace OpenSim.Region.CoreModules.World.Land private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) { IClientAPI client; - if (! m_scene.TryGetClient(agentID, out client)) { + if (!m_scene.TryGetClient(agentID, out client)) + { m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to retrieve IClientAPI for {0}", agentID); return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 9803bdfd0a..c4fb11e232 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -925,7 +925,7 @@ namespace OpenSim.Region.CoreModules.World.Land } catch (NullReferenceException) { - m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); + m_log.Error("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); } try { @@ -1073,12 +1073,16 @@ namespace OpenSim.Region.CoreModules.World.Land public void AddPrimOverMe(SceneObjectGroup obj) { +// m_log.DebugFormat("[LAND OBJECT]: Adding scene object {0} {1} over {2}", obj.Name, obj.LocalId, LandData.Name); + lock (primsOverMe) primsOverMe.Add(obj); } public void RemovePrimFromOverMe(SceneObjectGroup obj) { +// m_log.DebugFormat("[LAND OBJECT]: Removing scene object {0} {1} from over {2}", obj.Name, obj.LocalId, LandData.Name); + lock (primsOverMe) primsOverMe.Remove(obj); } From 2497962360258eb6cb1a78c7b4d5227d88eabb87 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 5 Apr 2011 22:25:00 +0100 Subject: [PATCH 10/10] Change some text to make the autoreturn mechanism more obvious, and align with the fact that it's one word rather than two. --- OpenSim/Framework/LandData.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++++- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 145ccddb44..c107143a6c 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -560,7 +560,7 @@ namespace OpenSim.Framework } /// - /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own + /// Autoreturn number of minutes to return SceneObjectGroup that are owned by someone who doesn't own /// the parcel and isn't set to the same 'group' as the parcel. /// public int OtherCleanTime { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a62d6d7e0d..f0acc38820 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1521,8 +1521,11 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Return object to avatar Message + /// Tell an agent that their object has been returned. /// + /// + /// The actual return is handled by the caller. + /// /// Avatar Unique Id /// Name of object returned /// Location of object returned diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f17fb28f8d..a7107f0184 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1313,8 +1313,10 @@ namespace OpenSim.Region.Framework.Scenes parcel.LandData.OtherCleanTime) { DetachFromBackup(); - m_log.InfoFormat("[SCENE]: Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); - m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return"); + m_log.DebugFormat( + "[SCENE OBJECT GROUP]: Returning object {0} due to parcel autoreturn", + RootPart.UUID); + m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel autoreturn"); m_scene.DeRezObjects(null, new List() { RootPart.LocalId }, UUID.Zero, DeRezAction.Return, UUID.Zero);