From f58941e89f122c2e1fd54a2f817fb8114e6c80ed Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 5 Apr 2011 01:30:13 +0100
Subject: 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 +++-
 .../Region/ClientStack/LindenUDP/LLClientView.cs   |  24 +++-
 .../World/Estate/EstateManagementModule.cs         | 149 ++++++++++++++++++++-
 OpenSim/Region/CoreModules/World/Sun/SunModule.cs  |   6 +-
 .../Framework/Interfaces/IEstateDataService.cs     |   6 +
 .../Framework/Interfaces/IEstateDataStore.cs       |   6 +
 .../BareBonesShared/BareBonesSharedModule.cs       |   3 +
 .../Connectors/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 92a8d80..d10ebe4 100644
--- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs
@@ -372,6 +372,11 @@ namespace OpenSim.Data.MSSQL
             return new List<int>();
         }
 
+        public List<int> GetEstatesByOwner(UUID ownerID)
+        {
+            return new List<int>();
+        }
+
         public bool LinkRegion(UUID regionID, int estateID)
         {
             // TODO: Implementation!            
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs
index 6d72e82..86416d1 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<int> GetEstatesByOwner(UUID ownerID)
+        {
+            List<int> result = new List<int>();
+
+            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 6afc540..2f05a6e 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<int> GetEstatesByOwner(UUID ownerID)
+        {
+            List<int> result = new List<int>();
+
+            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 ad28c00..4dd225f 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<int> GetEstatesByOwner(UUID ownerID)
+        {
+            List<int> result = new List<int>();
+
+            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 2faffae..f8a0e07 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 57ab135..b6d64ac 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<int> 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<int> 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<int> 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<int> 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<int> 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<int> 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<int> 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<int> 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 cea7c78..4e14c73 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 38c10a6..7066cf2 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
@@ -71,6 +71,12 @@ namespace OpenSim.Region.Framework.Interfaces
         List<int> GetEstates(string search);
         
         /// <summary>
+        /// Get the IDs of all estates owned by the given user.
+        /// </summary>
+        /// <returns>An empty list if no estates were found.</returns>
+        List<int> GetEstatesByOwner(UUID ownerID);        
+        
+        /// <summary>
         /// Get the IDs of all estates.
         /// </summary>
         /// <returns>An empty list if no estates were found.</returns>
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
index c82661d..d790a30 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
@@ -74,6 +74,12 @@ namespace OpenSim.Region.Framework.Interfaces
         /// <param name="search">Name of estate to search for.  This is the exact name, no parttern matching is done.</param>
         /// <returns></returns>
         List<int> GetEstates(string search);
+
+        /// <summary>
+        /// Get the IDs of all estates owned by the given user.
+        /// </summary>
+        /// <returns>An empty list if no estates were found.</returns>
+        List<int> GetEstatesByOwner(UUID ownerID);
         
         /// <summary>
         /// 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 781fe95..dddea3e 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
 {
     /// <summary>
diff --git a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
index d0588bf..7184ba1 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<int> GetEstatesByOwner(UUID ownerID)
+        {
+            return m_database.GetEstatesByOwner(ownerID);
+        }
+
         public bool LinkRegion(UUID regionID, int estateID)
         {
             return m_database.LinkRegion(regionID, estateID);
-- 
cgit v1.1


From b2fbadeae82f0bdbfb3b7bdc8e14cb7f5b693092 Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Mon, 4 Apr 2011 20:02:13 -0700
Subject: 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 0000000..6ce7a36
--- /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<EstateSettings> LoadEstateSettingsAll()
+        {
+            List<EstateSettings> allEstateSettings = new List<EstateSettings>();
+            allEstateSettings.Add(new EstateSettings());
+            return allEstateSettings;
+        }
+        
+        public List<int> GetEstatesAll()
+        {
+            List<int> result = new List<int>();
+            return result;            
+        }
+
+        public List<int> GetEstates(string search)
+        {
+            List<int> result = new List<int>();
+            return result;
+        }
+
+        public bool LinkRegion(UUID regionID, int estateID)
+        {
+            return false;
+        }
+
+        public List<UUID> GetRegions(int estateID)
+        {
+            List<UUID> result = new List<UUID>();
+            return result;
+        }
+
+        public bool DeleteEstate(int estateID)
+        {
+            return false;
+        }
+    }
+}
diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs
index eb4e313..e8d733b 100644
--- a/OpenSim/Data/Null/NullSimulationData.cs
+++ b/OpenSim/Data/Null/NullSimulationData.cs
@@ -38,6 +38,15 @@ namespace OpenSim.Data.Null
     /// </summary>
     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<SceneObjectGroup>();
         }
 
+        Dictionary<UUID, double[,]> m_terrains = new Dictionary<UUID, double[,]>();
         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;
         }
 
-- 
cgit v1.1


From 18e206d2ed5cc1828f2ada27ff4698bdc0b84352 Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Mon, 4 Apr 2011 23:45:28 -0400
Subject: * Bugfix - Compile NullEstateData implement public List<int>
 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 6ce7a36..0cebff5 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<int> GetEstatesByOwner(UUID ownerID)
+        {
+            return new List<int>();
+        }
+
+        #endregion
     }
 }
-- 
cgit v1.1


From c1dec225abd09efc5061b2ffd40996ad13fd16e9 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 5 Apr 2011 17:47:11 +0100
Subject: 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 f8a0e07..34d72ac 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);
-- 
cgit v1.1


From 3d400fc663104b6d899ee37afeb7f83c68af45d4 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 5 Apr 2011 18:24:23 +0100
Subject: 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 bc140ae..7a04eb1 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;
                 }
             }
             
-- 
cgit v1.1


From dc6ce2444385730a3ea1ba1104f2e2caa15a907a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 5 Apr 2011 20:31:52 +0100
Subject: switch llGetParcelPrimCount() to use new prim counts module

---
 .../Shared/Api/Implementation/LSL_Api.cs           | 85 ++++++++++------------
 1 file changed, 39 insertions(+), 46 deletions(-)

diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 43b0da3..5f8ca91 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 (lo == null)
+                return 0;
+            
+            IPrimCounts pc = lo.PrimCounts;
 
-            if (land == null)
+            if (sim_wide != 0)
             {
-                return 0;
+                if (category == 0)
+                {
+                    return pc.Simulator;
+                }
+                else
+                {
+                    // counts not implemented yet
+                    return 0;
+                }
             }
-
             else
             {
-                if (sim_wide != 0)
+                if (category == 0)//Total Prims
                 {
-                    if (category == 0)
-                    {
-                        return land.SimwidePrims;
-                    }
-
-                    else
-                    {
-                        //public int simwideArea = 0;
-                        return 0;
-                    }
+                    return pc.Total;
                 }
-
-                else
+                else if (category == 1)//Owner Prims
                 {
-                    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.
-                    }
+                    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;
         }
 
-- 
cgit v1.1


From f030ba8992a17553b5824955c95096b8326b23c8 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 5 Apr 2011 20:39:58 +0100
Subject: 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 5f8ca91..e5be641 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;
-- 
cgit v1.1


From 0e465da187c93e7ff21f91742f75ee9f3b76b04e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 5 Apr 2011 21:25:54 +0100
Subject: 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 +----------------
 .../Serialization/Tests/LandDataSerializerTests.cs |  8 +--
 .../Region/CoreModules/World/Land/LandChannel.cs   | 10 ---
 .../CoreModules/World/Land/LandManagementModule.cs | 39 +++-------
 .../Region/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 30bae16..869d4c8 100644
--- a/OpenSim/Framework/ILandChannel.cs
+++ b/OpenSim/Framework/ILandChannel.cs
@@ -77,7 +77,6 @@ namespace OpenSim.Region.Framework.Interfaces
         /// </param>
         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 931e24a..98ea01e 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<UUID> 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 a9a493d..145ccdd 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<ParcelManager.ParcelAccessEntry> _parcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
         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;
@@ -284,19 +278,6 @@ namespace OpenSim.Framework
         }
 
         /// <summary>
-        /// Number of SceneObjectPart that are owned by a Group
-        /// </summary>
-        [XmlIgnore]
-        public int GroupPrims {
-            get {
-                return _groupPrims;
-            }
-            set {
-                _groupPrims = value;
-            }
-        }
-
-        /// <summary>
         /// Returns true if the Land Parcel is owned by a group
         /// </summary>
         public bool IsGroupOwned {
@@ -454,20 +435,6 @@ namespace OpenSim.Framework
         }
 
         /// <summary>
-        /// 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
-        /// </summary>
-        [XmlIgnore]
-        public int OtherPrims {
-            get {
-                return _otherPrims;
-            }
-            set {
-                _otherPrims = value;
-            }
-        }
-
-        /// <summary>
         /// Owner Avatar or Group of the parcel.  Naturally, all land masses must be
         /// owned by someone
         /// </summary>
@@ -481,19 +448,6 @@ namespace OpenSim.Framework
         }
 
         /// <summary>
-        /// Number of SceneObjectPart that are owned by the owner of the parcel
-        /// </summary>
-        [XmlIgnore]
-        public int OwnerPrims {
-            get {
-                return _ownerPrims;
-            }
-            set {
-                _ownerPrims = value;
-            }
-        }
-
-        /// <summary>
         /// List of access data for the parcel.  User data, some bitflags, and a time
         /// </summary>
         public List<ParcelManager.ParcelAccessEntry> ParcelAccessList {
@@ -542,19 +496,6 @@ namespace OpenSim.Framework
         }
 
         /// <summary>
-        /// Number of SceneObjectPart that are currently selected by avatar
-        /// </summary>
-        [XmlIgnore]
-        public int SelectedPrims {
-            get {
-                return _selectedPrims;
-            }
-            set {
-                _selectedPrims = value;
-            }
-        }
-
-        /// <summary>
         /// Number of meters^2 in the Simulator
         /// </summary>
         [XmlIgnore]
@@ -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 70e87b3..c69c89d 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 = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n  <Area>128</Area>\n  <AuctionID>0</AuctionID>\n  <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n  <Category>10</Category>\n  <ClaimDate>0</ClaimDate>\n  <ClaimPrice>0</ClaimPrice>\n  <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n  <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n  <IsGroupOwned>False</IsGroupOwned>\n  <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n  <Description>land data to test LandDataSerializer</Description>\n  <Flags>536870944</Flags>\n  <LandingType>2</LandingType>\n  <Name>LandDataSerializerTest Land</Name>\n  <Status>0</Status>\n  <LocalID>0</LocalID>\n  <MediaAutoScale>1</MediaAutoScale>\n  <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n  <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n  <MusicURL />\n  <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n  <ParcelAccessList />\n  <PassHours>0</PassHours>\n  <PassPrice>0</PassPrice>\n  <SalePrice>0</SalePrice>\n  <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n  <UserLocation>&lt;0, 0, 0&gt;</UserLocation>\n  <UserLookAt>&lt;0, 0, 0&gt;</UserLookAt>\n  <Dwell>0</Dwell>\n  <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
-        private static string preSerializedWithParcelAccessList = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n  <Area>128</Area>\n  <AuctionID>0</AuctionID>\n  <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n  <Category>10</Category>\n  <ClaimDate>0</ClaimDate>\n  <ClaimPrice>0</ClaimPrice>\n  <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n  <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n  <IsGroupOwned>False</IsGroupOwned>\n  <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n  <Description>land data to test LandDataSerializer</Description>\n  <Flags>536870944</Flags>\n  <LandingType>2</LandingType>\n  <Name>LandDataSerializerTest Land</Name>\n  <Status>0</Status>\n  <LocalID>0</LocalID>\n  <MediaAutoScale>1</MediaAutoScale>\n  <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n  <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n  <MusicURL />\n  <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n  <ParcelAccessList>\n    <ParcelAccessEntry>\n      <AgentID>62d65d45-c91a-4f77-862c-46557d978b6c</AgentID>\n      <Time>2009-10-01T00:00:00</Time>\n      <AccessList>2</AccessList>\n    </ParcelAccessEntry>\n    <ParcelAccessEntry>\n      <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n      <Time>2010-10-20T00:00:00</Time>\n      <AccessList>1</AccessList>\n    </ParcelAccessEntry>\n  </ParcelAccessList>\n  <PassHours>0</PassHours>\n  <PassPrice>0</PassPrice>\n  <SalePrice>0</SalePrice>\n  <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n  <UserLocation>&lt;0, 0, 0&gt;</UserLocation>\n  <UserLookAt>&lt;0, 0, 0&gt;</UserLookAt>\n  <Dwell>0</Dwell>\n  <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
-
-
-  
+        private static string preSerializedWithParcelAccessList = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n  <Area>128</Area>\n  <AuctionID>0</AuctionID>\n  <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n  <Category>10</Category>\n  <ClaimDate>0</ClaimDate>\n  <ClaimPrice>0</ClaimPrice>\n  <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n  <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n  <IsGroupOwned>False</IsGroupOwned>\n  <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n  <Description>land data to test LandDataSerializer</Description>\n  <Flags>536870944</Flags>\n  <LandingType>2</LandingType>\n  <Name>LandDataSerializerTest Land</Name>\n  <Status>0</Status>\n  <LocalID>0</LocalID>\n  <MediaAutoScale>1</MediaAutoScale>\n  <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n  <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n  <MusicURL />\n  <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n  <ParcelAccessList>\n    <ParcelAccessEntry>\n      <AgentID>62d65d45-c91a-4f77-862c-46557d978b6c</AgentID>\n      <Time>2009-10-01T00:00:00</Time>\n      <AccessList>2</AccessList>\n    </ParcelAccessEntry>\n    <ParcelAccessEntry>\n      <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n      <Time>2010-10-20T00:00:00</Time>\n      <AccessList>1</AccessList>\n    </ParcelAccessEntry>\n  </ParcelAccessList>\n  <PassHours>0</PassHours>\n  <PassPrice>0</PassPrice>\n  <SalePrice>0</SalePrice>\n  <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n  <UserLocation>&lt;0, 0, 0&gt;</UserLocation>\n  <UserLookAt>&lt;0, 0, 0&gt;</UserLookAt>\n  <Dwell>0</Dwell>\n  <OtherCleanTime>0</OtherCleanTime>\n</LandData>";  
 
         [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 7d990c2..7fc358d 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<ILandObject>();
         }
 
-        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 2b5f7a0..adfac05 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
         /// </value>
         private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
 
-        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;
         }
 
         /// <summary>
@@ -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 e7bdb19..9803bdf 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<UUID, int> GetLandObjectOwners()
         {
             Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>();
+            
             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<UUID,List<SceneObjectGroup>> returns =
-                    new Dictionary<UUID,List<SceneObjectGroup>>();
+//            m_log.DebugFormat(
+//                "[LAND OBJECT]: Request to return objects in {0} from {1}", LandData.Name, remote_client.Name);
+            
+            Dictionary<UUID,List<SceneObjectGroup>> returns = new Dictionary<UUID,List<SceneObjectGroup>>();
 
             lock (primsOverMe)
             {
@@ -1060,83 +1065,25 @@ 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
         
         /// <summary>
         /// Set the media url for this land parcel
@@ -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 35a798e..a62d6d7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1428,20 +1428,6 @@ namespace OpenSim.Region.Framework.Scenes
         }
 
         /// <summary>
-        /// Recount SceneObjectPart in parcel aabb
-        /// </summary>
-        private void UpdateLand()
-        {
-            if (LandChannel != null)
-            {
-                if (LandChannel.IsLandPrimCountTainted())
-                {
-                    EventManager.TriggerParcelPrimCountUpdate();
-                }
-            }
-        }
-
-        /// <summary>
         /// Update the terrain if it needs to be updated.
         /// </summary>
         private void UpdateTerrain()
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
index 98e5453..a133e51 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();
-- 
cgit v1.1


From acacee98c6e4398b0ea808f23333a31689966133 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 5 Apr 2011 22:15:06 +0100
Subject: properly refresh object owner list when refresh button is hit on land
 parcel object tab

---
 .../CoreModules/World/Land/LandManagementModule.cs      | 17 +++++++++--------
 OpenSim/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 adfac05..abc7a3a 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
         /// <returns>The parcel created.</returns>
         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 9803bdf..c4fb11e 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);
         }
-- 
cgit v1.1


From 2497962360258eb6cb1a78c7b4d5227d88eabb87 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 5 Apr 2011 22:25:00 +0100
Subject: 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 145ccdd..c107143 100644
--- a/OpenSim/Framework/LandData.cs
+++ b/OpenSim/Framework/LandData.cs
@@ -560,7 +560,7 @@ namespace OpenSim.Framework
         }
 
         /// <summary>
-        /// 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.
         /// </summary>
         public int OtherCleanTime {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index a62d6d7..f0acc38 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1521,8 +1521,11 @@ namespace OpenSim.Region.Framework.Scenes
         }
 
         /// <summary>
-        /// Return object to avatar Message
+        /// Tell an agent that their object has been returned. 
         /// </summary>
+        /// <remarks>
+        /// The actual return is handled by the caller.
+        /// </remarks>
         /// <param name="agentID">Avatar Unique Id</param>
         /// <param name="objectName">Name of object returned</param>
         /// <param name="location">Location of object returned</param>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index f17fb28..a7107f0 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<uint>() { RootPart.LocalId }, UUID.Zero,
                                         DeRezAction.Return, UUID.Zero);
 
-- 
cgit v1.1