Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

slimupdates
John Hurliman 2010-05-04 13:58:43 -07:00
commit 40df4e7203
7 changed files with 186 additions and 41 deletions

View File

@ -474,7 +474,36 @@ namespace OpenSim.Data.MySQL
public List<UUID> GetRegions(int estateID)
{
return new List<UUID>();
List<UUID> result = new List<UUID>();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
try
{
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "select RegionID from estate_map where EstateID = ?EstateID";
cmd.Parameters.AddWithValue("?EstateID", estateID.ToString());
using (IDataReader reader = cmd.ExecuteReader())
{
while(reader.Read())
result.Add(new UUID(reader["RegionID"].ToString()));
reader.Close();
}
}
}
catch (Exception e)
{
m_log.Error("[REGION DB]: Error reading estate map. " + e.ToString());
return result;
}
dbcon.Close();
}
return result;
}
public bool DeleteEstate(int estateID)

View File

@ -160,5 +160,36 @@ namespace OpenSim.Data.MySQL
}
}
}
public override bool Store(XInventoryItem item)
{
if (!base.Store(item))
return false;
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.Connection = dbcon;
cmd.CommandText = String.Format("update inventoryfolders set version=version+1 where folderID = ?folderID");
cmd.Parameters.AddWithValue("?folderID", item.parentFolderID.ToString());
try
{
cmd.ExecuteNonQuery();
}
catch (Exception e)
{
return false;
}
cmd.Dispose();
}
dbcon.Close();
}
return true;
}
}
}

View File

@ -1,9 +1,8 @@
BEGIN TRANSACTION;
ATTACH 'inventoryStore.db' AS old;
ATTACH 'inventoryStore.db' AS old;
BEGIN TRANSACTION;
INSERT INTO inventoryfolders (folderName, type, version, folderID, agentID, parentFolderID) SELECT `name` AS folderName, `type` AS type, `version` AS version, `UUID` AS folderID, `agentID` AS agentID, `parentID` AS parentFolderID from old.inventoryfolders;
INSERT INTO inventoryitems (assetID, assetType, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags, inventoryID, parentFolderID, avatarID, inventoryGroupPermissions) SELECT `assetID`, `assetType` AS assetType, `inventoryName` AS inventoryName, `inventoryDescription` AS inventoryDescription, `inventoryNextPermissions` AS inventoryNextPermissions, `inventoryCurrentPermissions` AS inventoryCurrentPermissions, `invType` AS invType, `creatorsID` AS creatorID, `inventoryBasePermissions` AS inventoryBasePermissions, `inventoryEveryOnePermissions` AS inventoryEveryOnePermissions, `salePrice` AS salePrice, `saleType` AS saleType, `creationDate` AS creationDate, `groupID` AS groupID, `groupOwned` AS groupOwned, `flags` AS flags, `UUID` AS inventoryID, `parentFolderID` AS parentFolderID, `avatarID` AS avatarID, `inventoryGroupPermissions` AS inventoryGroupPermissions FROM old.inventoryitems;
COMMIT;

View File

@ -48,6 +48,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
private EstateTerrainXferHandler TerrainUploader;
public event ChangeDelegate OnRegionInfoChange;
public event ChangeDelegate OnEstateInfoChange;
#region Packet Data Responders
private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice)
@ -137,6 +140,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide = false;
m_scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange();
sendRegionInfoPacketToAll();
}
@ -162,6 +166,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
break;
}
m_scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange();
sendRegionInfoPacketToAll();
}
@ -187,6 +192,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
break;
}
m_scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange();
sendRegionInfoPacketToAll();
}
@ -212,13 +218,14 @@ namespace OpenSim.Region.CoreModules.World.Estate
m_scene.RegionInfo.RegionSettings.FixedSun = UseFixedSun;
m_scene.RegionInfo.RegionSettings.SunPosition = SunHour;
TriggerEstateToolsSunUpdate();
m_scene.TriggerEstateSunUpdate();
//m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString());
//m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString());
sendRegionInfoPacketToAll();
m_scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange();
}
private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds)
@ -230,6 +237,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
m_scene.RegionInfo.RegionSettings.Covenant = estateCovenantID;
m_scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange();
}
private void handleEstateAccessDeltaRequest(IClientAPI remote_client, UUID invoice, int estateAccessType, UUID user)
@ -245,6 +253,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
m_scene.RegionInfo.EstateSettings.AddEstateUser(user);
m_scene.RegionInfo.EstateSettings.Save();
TriggerEstateInfoChange();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID);
}
else
@ -259,6 +268,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
m_scene.RegionInfo.EstateSettings.RemoveEstateUser(user);
m_scene.RegionInfo.EstateSettings.Save();
TriggerEstateInfoChange();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID);
}
@ -273,6 +283,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
m_scene.RegionInfo.EstateSettings.AddEstateGroup(user);
m_scene.RegionInfo.EstateSettings.Save();
TriggerEstateInfoChange();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID);
}
else
@ -286,6 +297,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user);
m_scene.RegionInfo.EstateSettings.Save();
TriggerEstateInfoChange();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID);
}
@ -323,6 +335,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
m_scene.RegionInfo.EstateSettings.AddBan(item);
m_scene.RegionInfo.EstateSettings.Save();
TriggerEstateInfoChange();
ScenePresence s = m_scene.GetScenePresence(user);
if (s != null)
@ -370,6 +383,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID);
m_scene.RegionInfo.EstateSettings.Save();
TriggerEstateInfoChange();
}
else
{
@ -389,6 +403,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
m_scene.RegionInfo.EstateSettings.AddEstateManager(user);
m_scene.RegionInfo.EstateSettings.Save();
TriggerEstateInfoChange();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID);
}
else
@ -402,6 +417,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
m_scene.RegionInfo.EstateSettings.Save();
TriggerEstateInfoChange();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID);
}
@ -449,6 +465,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
m_scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange();
m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics);
}
@ -860,8 +877,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
m_scene.RegionInfo.EstateSettings.DenyMinors = false;
m_scene.RegionInfo.EstateSettings.Save();
TriggerEstateInfoChange();
TriggerEstateToolsSunUpdate();
m_scene.TriggerEstateSunUpdate();
sendDetailedEstateData(remoteClient, invoice);
}
@ -927,6 +945,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
break;
}
m_scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange();
sendRegionInfoPacketToAll();
}
@ -972,6 +991,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
break;
}
m_scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange();
sendRegionHandshakeToAll();
}
}
@ -983,7 +1003,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
// Sets up the sun module based no the saved Estate and Region Settings
// DO NOT REMOVE or the sun will stop working
TriggerEstateToolsSunUpdate();
m_scene.TriggerEstateSunUpdate();
}
public void Close()
@ -1004,40 +1024,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
#region Other Functions
private void TriggerEstateToolsSunUpdate()
{
float sun;
if (m_scene.RegionInfo.RegionSettings.UseEstateSun)
{
sun = (float)m_scene.RegionInfo.EstateSettings.SunPosition;
if (m_scene.RegionInfo.EstateSettings.UseGlobalTime)
{
sun = m_scene.EventManager.GetCurrentTimeAsSunLindenHour() - 6.0f;
}
//
m_scene.EventManager.TriggerEstateToolsSunUpdate(
m_scene.RegionInfo.RegionHandle,
m_scene.RegionInfo.EstateSettings.FixedSun,
m_scene.RegionInfo.RegionSettings.UseEstateSun,
sun);
}
else
{
// Use the Sun Position from the Region Settings
sun = (float)m_scene.RegionInfo.RegionSettings.SunPosition - 6.0f;
m_scene.EventManager.TriggerEstateToolsSunUpdate(
m_scene.RegionInfo.RegionHandle,
m_scene.RegionInfo.RegionSettings.FixedSun,
m_scene.RegionInfo.RegionSettings.UseEstateSun,
sun);
}
}
public void changeWaterHeight(float height)
{
setRegionTerrainSettings(height,
@ -1175,5 +1161,21 @@ namespace OpenSim.Region.CoreModules.World.Estate
return false;
}
protected void TriggerRegionInfoChange()
{
ChangeDelegate change = OnRegionInfoChange;
if (change != null)
change(m_scene.RegionInfo.RegionID);
}
protected void TriggerEstateInfoChange()
{
ChangeDelegate change = OnEstateInfoChange;
if (change != null)
change(m_scene.RegionInfo.RegionID);
}
}
}

View File

@ -29,8 +29,13 @@ using OpenMetaverse;
namespace OpenSim.Region.Framework.Interfaces
{
public delegate void ChangeDelegate(UUID regionID);
public interface IEstateModule : IRegionModule
{
event ChangeDelegate OnRegionInfoChange;
event ChangeDelegate OnEstateInfoChange;
uint GetRegionFlags();
bool IsManager(UUID avatarID);

View File

@ -415,6 +415,25 @@ namespace OpenSim.Region.Framework.Scenes
itemCopy.BasePermissions = item.BasePermissions;
}
if (itemCopy.Folder == UUID.Zero)
{
InventoryFolderBase folder = InventoryService.GetFolderForType(recipient, (AssetType)itemCopy.AssetType);
if (folder != null)
{
itemCopy.Folder = folder.ID;
}
else
{
InventoryFolderBase root = InventoryService.GetRootFolder(recipient);
if (root != null)
itemCopy.Folder = root.ID;
else
return null; // No destination
}
}
itemCopy.GroupID = UUID.Zero;
itemCopy.GroupOwned = false;
itemCopy.Flags = item.Flags;

View File

@ -646,6 +646,10 @@ namespace OpenSim.Region.Framework.Scenes
}
}
MainConsole.Instance.Commands.AddCommand("region", false, "reload estate",
"reload estate",
"Reload the estate data", HandleReloadEstate);
//Bind Storage Manager functions to some land manager functions for this scene
EventManager.OnLandObjectAdded +=
new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject);
@ -5075,5 +5079,61 @@ namespace OpenSim.Region.Framework.Scenes
{
return new Vector3(x, y, GetGroundHeight(x, y));
}
public List<UUID> GetEstateRegions(int estateID)
{
if (m_storageManager.EstateDataStore == null)
return new List<UUID>();
return m_storageManager.EstateDataStore.GetRegions(estateID);
}
public void ReloadEstateData()
{
m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
TriggerEstateSunUpdate();
}
public void TriggerEstateSunUpdate()
{
float sun;
if (RegionInfo.RegionSettings.UseEstateSun)
{
sun = (float)RegionInfo.EstateSettings.SunPosition;
if (RegionInfo.EstateSettings.UseGlobalTime)
{
sun = EventManager.GetCurrentTimeAsSunLindenHour() - 6.0f;
}
//
EventManager.TriggerEstateToolsSunUpdate(
RegionInfo.RegionHandle,
RegionInfo.EstateSettings.FixedSun,
RegionInfo.RegionSettings.UseEstateSun,
sun);
}
else
{
// Use the Sun Position from the Region Settings
sun = (float)RegionInfo.RegionSettings.SunPosition - 6.0f;
EventManager.TriggerEstateToolsSunUpdate(
RegionInfo.RegionHandle,
RegionInfo.RegionSettings.FixedSun,
RegionInfo.RegionSettings.UseEstateSun,
sun);
}
}
private void HandleReloadEstate(string module, string[] cmd)
{
if (MainConsole.Instance.ConsoleScene == null ||
(MainConsole.Instance.ConsoleScene is Scene &&
(Scene)MainConsole.Instance.ConsoleScene == this))
{
ReloadEstateData();
}
}
}
}