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

0.7.1-dev
Mic Bowman 2011-04-04 20:04:01 -07:00
commit d5e0674213
11 changed files with 268 additions and 12 deletions

View File

@ -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!

View File

@ -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))

View File

@ -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();

View File

@ -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();

View File

@ -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;

View File

@ -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

View File

@ -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());
}
}

View File

@ -70,6 +70,12 @@ namespace OpenSim.Region.Framework.Interfaces
/// <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.
/// </summary>

View File

@ -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.

View File

@ -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>

View File

@ -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);