Merge branch 'master' into careminster-presence-refactor

The modules will need to be updated for this to compile and run again. Please
don't use until I do the companion commit to modules later on.
avinationmerge
Melanie 2010-09-13 16:16:40 +01:00
commit 6a1ce17cdb
216 changed files with 6585 additions and 4483 deletions

View File

@ -756,7 +756,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// Set the estate // Set the estate
// Check for an existing estate // Check for an existing estate
List<int> estateIDs = m_application.StorageManager.EstateDataStore.GetEstates((string) requestData["estate_name"]); List<int> estateIDs = m_application.EstateDataService.GetEstates((string) requestData["estate_name"]);
if (estateIDs.Count < 1) if (estateIDs.Count < 1)
{ {
UUID userID = UUID.Zero; UUID userID = UUID.Zero;
@ -784,7 +784,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
} }
// Create a new estate with the name provided // Create a new estate with the name provided
region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(region.RegionID, true); region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(region.RegionID, true);
region.EstateSettings.EstateName = (string) requestData["estate_name"]; region.EstateSettings.EstateName = (string) requestData["estate_name"];
region.EstateSettings.EstateOwner = userID; region.EstateSettings.EstateOwner = userID;
@ -794,10 +794,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
else else
{ {
int estateID = estateIDs[0]; int estateID = estateIDs[0];
region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(estateID); region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(estateID);
if (!m_application.StorageManager.EstateDataStore.LinkRegion(region.RegionID, estateID)) if (!m_application.EstateDataService.LinkRegion(region.RegionID, estateID))
throw new Exception("Failed to join estate."); throw new Exception("Failed to join estate.");
} }

View File

@ -384,7 +384,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// } // }
// //
// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method)); // rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
// //
// } // }
/// <summary> /// <summary>
@ -449,7 +449,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// rdata.userAppearance = new AvatarAppearance(); // rdata.userAppearance = new AvatarAppearance();
// rdata.userAppearance.Owner = old.Owner; // rdata.userAppearance.Owner = old.Owner;
// adata = new AvatarData(rdata.userAppearance); // adata = new AvatarData(rdata.userAppearance);
// //
// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata); // Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
// //
// rdata.Complete(); // rdata.Complete();

View File

@ -1,4 +1,31 @@
using System; /*
* 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.Collections.Generic;
using System.Text; using System.Text;
using OpenMetaverse; using OpenMetaverse;
@ -17,7 +44,7 @@ namespace OpenSim.Data
/// <returns></returns> /// <returns></returns>
public static UUID FromDB(object id) public static UUID FromDB(object id)
{ {
if( (id == null) || (id == DBNull.Value)) if ((id == null) || (id == DBNull.Value))
return UUID.Zero; return UUID.Zero;
if (id.GetType() == typeof(Guid)) if (id.GetType() == typeof(Guid))

View File

@ -40,15 +40,4 @@ namespace OpenSim.Data
void Initialise(string connect); void Initialise(string connect);
bool Delete(string id); bool Delete(string id);
} }
public class AssetDataInitialiser : PluginInitialiserBase
{
private string connect;
public AssetDataInitialiser (string s) { connect = s; }
public override void Initialise (IPlugin plugin)
{
IAssetDataPlugin p = plugin as IAssetDataPlugin;
p.Initialise (connect);
}
}
} }

View File

@ -155,15 +155,4 @@ namespace OpenSim.Data
/// </returns> /// </returns>
List<InventoryItemBase> fetchActiveGestures(UUID avatarID); List<InventoryItemBase> fetchActiveGestures(UUID avatarID);
} }
public class InventoryDataInitialiser : PluginInitialiserBase
{
private string connect;
public InventoryDataInitialiser (string s) { connect = s; }
public override void Initialise (IPlugin plugin)
{
IInventoryDataPlugin p = plugin as IInventoryDataPlugin;
p.Initialise (connect);
}
}
} }

View File

@ -50,6 +50,15 @@ namespace OpenSim.Data.MSSQL
#region Public methods #region Public methods
public MSSQLEstateStore()
{
}
public MSSQLEstateStore(string connectionString)
{
Initialise(connectionString);
}
/// <summary> /// <summary>
/// Initialises the estatedata class. /// Initialises the estatedata class.
/// </summary> /// </summary>

View File

@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL
/// <summary> /// <summary>
/// A MSSQL Interface for the Region Server. /// A MSSQL Interface for the Region Server.
/// </summary> /// </summary>
public class MSSQLRegionDataStore : IRegionDataStore public class MSSQLSimulationData : ISimulationDataStore
{ {
private const string _migrationStore = "RegionStore"; private const string _migrationStore = "RegionStore";
@ -55,6 +55,16 @@ namespace OpenSim.Data.MSSQL
/// </summary> /// </summary>
private MSSQLManager _Database; private MSSQLManager _Database;
private string m_connectionString; private string m_connectionString;
public MSSQLSimulationData()
{
}
public MSSQLSimulationData(string connectionString)
{
Initialise(connectionString);
}
/// <summary> /// <summary>
/// Initialises the region datastore /// Initialises the region datastore
/// </summary> /// </summary>
@ -1126,7 +1136,7 @@ VALUES
prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]);
if (!(primRow["MediaURL"] is System.DBNull)) if (!(primRow["MediaURL"] is System.DBNull))
prim.MediaUrl = (string)primRow["MediaURL"]; prim.MediaUrl = (string)primRow["MediaURL"];
return prim; return prim;
} }
@ -1180,7 +1190,7 @@ VALUES
{ {
} }
if (!(shapeRow["Media"] is System.DBNull)) if (!(shapeRow["Media"] is System.DBNull))
baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]);
return baseShape; return baseShape;
@ -1511,7 +1521,7 @@ VALUES
parameters.Add(_Database.CreateParameter("PassTouches", 1)); parameters.Add(_Database.CreateParameter("PassTouches", 1));
else else
parameters.Add(_Database.CreateParameter("PassTouches", 0)); parameters.Add(_Database.CreateParameter("PassTouches", 0));
parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
return parameters.ToArray(); return parameters.ToArray();

View File

@ -122,7 +122,7 @@ namespace OpenSim.Data
int ver = FindVersion(_conn, "migrations"); int ver = FindVersion(_conn, "migrations");
if (ver <= 0) // -1 = no table, 0 = no version record if (ver <= 0) // -1 = no table, 0 = no version record
{ {
if( ver < 0 ) if (ver < 0)
ExecuteScript("create table migrations(name varchar(100), version int)"); ExecuteScript("create table migrations(name varchar(100), version int)");
InsertVersion("migrations", 1); InsertVersion("migrations", 1);
} }
@ -288,7 +288,7 @@ namespace OpenSim.Data
SortedList<int, string[]> migrations = new SortedList<int, string[]>(); SortedList<int, string[]> migrations = new SortedList<int, string[]>();
string[] names = _assem.GetManifestResourceNames(); string[] names = _assem.GetManifestResourceNames();
if( names.Length == 0 ) // should never happen if (names.Length == 0) // should never happen
return migrations; return migrations;
Array.Sort(names); // we want all the migrations ordered Array.Sort(names); // we want all the migrations ordered
@ -297,7 +297,7 @@ namespace OpenSim.Data
Match m = null; Match m = null;
string sFile = Array.FindLast(names, nm => { m = _match_new.Match(nm); return m.Success; }); // ; nm.StartsWith(sPrefix, StringComparison.InvariantCultureIgnoreCase string sFile = Array.FindLast(names, nm => { m = _match_new.Match(nm); return m.Success; }); // ; nm.StartsWith(sPrefix, StringComparison.InvariantCultureIgnoreCase
if( (m != null) && !String.IsNullOrEmpty(sFile) ) if ((m != null) && !String.IsNullOrEmpty(sFile))
{ {
/* The filename should be '<StoreName>.migrations[.NNN]' where NNN /* The filename should be '<StoreName>.migrations[.NNN]' where NNN
* is the last version number defined in the file. If the '.NNN' part is recognized, the code can skip * is the last version number defined in the file. If the '.NNN' part is recognized, the code can skip
@ -312,7 +312,7 @@ namespace OpenSim.Data
if (m.Groups.Count > 1 && int.TryParse(m.Groups[1].Value, out nLastVerFound)) if (m.Groups.Count > 1 && int.TryParse(m.Groups[1].Value, out nLastVerFound))
{ {
if( nLastVerFound <= after ) if (nLastVerFound <= after)
goto scan_old_style; goto scan_old_style;
} }
@ -329,7 +329,7 @@ namespace OpenSim.Data
sb.Length = 0; sb.Length = 0;
} }
if ( (nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list if ((nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list
{ {
migrations[nVersion] = script.ToArray(); migrations[nVersion] = script.ToArray();
} }
@ -345,7 +345,7 @@ namespace OpenSim.Data
string sLine = resourceReader.ReadLine(); string sLine = resourceReader.ReadLine();
nLineNo++; nLineNo++;
if( String.IsNullOrEmpty(sLine) || sLine.StartsWith("#") ) // ignore a comment or empty line if (String.IsNullOrEmpty(sLine) || sLine.StartsWith("#")) // ignore a comment or empty line
continue; continue;
if (sLine.Trim().Equals(":GO", StringComparison.InvariantCultureIgnoreCase)) if (sLine.Trim().Equals(":GO", StringComparison.InvariantCultureIgnoreCase))
@ -392,7 +392,7 @@ scan_old_style:
if (m.Success) if (m.Success)
{ {
int version = int.Parse(m.Groups[1].ToString()); int version = int.Parse(m.Groups[1].ToString());
if ( (version > after) && !migrations.ContainsKey(version) ) if ((version > after) && !migrations.ContainsKey(version))
{ {
using (Stream resource = _assem.GetManifestResourceStream(s)) using (Stream resource = _assem.GetManifestResourceStream(s))
{ {

View File

@ -216,9 +216,6 @@ namespace OpenSim.Data.MySQL
private void UpdateAccessTime(AssetBase asset) private void UpdateAccessTime(AssetBase asset)
{ {
// Writing to the database every time Get() is called on an asset is killing us. Seriously. -jph
return;
lock (m_dbLock) lock (m_dbLock)
{ {
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))

View File

@ -54,6 +54,15 @@ namespace OpenSim.Data.MySQL
private Dictionary<string, FieldInfo> m_FieldMap = private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>(); new Dictionary<string, FieldInfo>();
public MySQLEstateStore()
{
}
public MySQLEstateStore(string connectionString)
{
Initialise(connectionString);
}
public void Initialise(string connectionString) public void Initialise(string connectionString)
{ {
m_connectionString = connectionString; m_connectionString = connectionString;

View File

@ -286,7 +286,7 @@ namespace OpenSim.Data.MySQL
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
// TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these. // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these.
// ( DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero ) // (DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero)
item.CreatorId = reader["creatorID"].ToString(); item.CreatorId = reader["creatorID"].ToString();
// Be a bit safer in parsing these because the // Be a bit safer in parsing these because the

View File

@ -45,13 +45,22 @@ namespace OpenSim.Data.MySQL
/// <summary> /// <summary>
/// A MySQL Interface for the Region Server /// A MySQL Interface for the Region Server
/// </summary> /// </summary>
public class MySQLDataStore : IRegionDataStore public class MySQLSimulationData : ISimulationDataStore
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_connectionString; private string m_connectionString;
private object m_dbLock = new object(); private object m_dbLock = new object();
public MySQLSimulationData()
{
}
public MySQLSimulationData(string connectionString)
{
Initialise(connectionString);
}
public void Initialise(string connectionString) public void Initialise(string connectionString)
{ {
m_connectionString = connectionString; m_connectionString = connectionString;
@ -680,7 +689,7 @@ namespace OpenSim.Data.MySQL
"UserLocationX, UserLocationY, UserLocationZ, " + "UserLocationX, UserLocationY, UserLocationZ, " +
"UserLookAtX, UserLookAtY, UserLookAtZ, " + "UserLookAtX, UserLookAtY, UserLookAtZ, " +
"AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " + "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " +
"MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
"?UUID, ?RegionUUID, " + "?UUID, ?RegionUUID, " +
"?LocalLandID, ?Bitmap, ?Name, ?Description, " + "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
"?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
@ -691,7 +700,7 @@ namespace OpenSim.Data.MySQL
"?UserLocationX, ?UserLocationY, ?UserLocationZ, " + "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
"?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
"?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+ "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+
"CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
@ -728,7 +737,7 @@ namespace OpenSim.Data.MySQL
string command = "select * from `regionwindlight` where region_id = ?regionID"; string command = "select * from `regionwindlight` where region_id = ?regionID";
using(MySqlCommand cmd = new MySqlCommand(command)) using (MySqlCommand cmd = new MySqlCommand(command))
{ {
cmd.Connection = dbcon; cmd.Connection = dbcon;
@ -1350,13 +1359,13 @@ namespace OpenSim.Data.MySQL
m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
} }
newData.MediaDescription = (string) row["MediaDescription"]; newData.MediaDescription = (string) row["MediaDescription"];
newData.MediaType = (string) row["MediaType"]; newData.MediaType = (string) row["MediaType"];
newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]); newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]);
newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]); newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]);
newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
@ -1724,7 +1733,7 @@ namespace OpenSim.Data.MySQL
s.State = (byte)(int)row["State"]; s.State = (byte)(int)row["State"];
if (!(row["Media"] is System.DBNull)) if (!(row["Media"] is System.DBNull))
s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
return s; return s;

View File

@ -1,4 +1,31 @@
using System; /*
* 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.Collections.Generic;
using OpenMetaverse; using OpenMetaverse;

View File

@ -36,7 +36,7 @@ namespace OpenSim.Data.Null
/// <summary> /// <summary>
/// NULL DataStore, do not store anything /// NULL DataStore, do not store anything
/// </summary> /// </summary>
public class NullDataStore : IRegionDataStore public class NullSimulationData : ISimulationDataStore
{ {
public void Initialise(string dbfile) public void Initialise(string dbfile)
{ {
@ -73,7 +73,6 @@ namespace OpenSim.Data.Null
{ {
} }
// see IRegionDatastore
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
{ {
} }

View File

@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLite
private Dictionary<string, FieldInfo> m_FieldMap = private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>(); new Dictionary<string, FieldInfo>();
public SQLiteEstateStore()
{
}
public SQLiteEstateStore(string connectionString)
{
Initialise(connectionString);
}
public void Initialise(string connectionString) public void Initialise(string connectionString)
{ {
m_connectionString = connectionString; m_connectionString = connectionString;

View File

@ -731,12 +731,12 @@ namespace OpenSim.Data.SQLite
**********************************************************************/ **********************************************************************/
protected void CreateDataSetMapping(IDataAdapter da, string tableName) protected void CreateDataSetMapping(IDataAdapter da, string tableName)
{ {
ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName); ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
foreach (DataColumn col in ds.Tables[tableName].Columns) foreach (DataColumn col in ds.Tables[tableName].Columns)
{ {
dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName); dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
} }
} }
/// <summary> /// <summary>

View File

@ -44,7 +44,7 @@ namespace OpenSim.Data.SQLite
/// <summary> /// <summary>
/// A RegionData Interface to the SQLite database /// A RegionData Interface to the SQLite database
/// </summary> /// </summary>
public class SQLiteRegionData : IRegionDataStore public class SQLiteSimulationData : ISimulationDataStore
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -70,6 +70,15 @@ namespace OpenSim.Data.SQLite
private String m_connectionString; private String m_connectionString;
public SQLiteSimulationData()
{
}
public SQLiteSimulationData(string connectionString)
{
Initialise(connectionString);
}
// Temporary attribute while this is experimental // Temporary attribute while this is experimental
/*********************************************************************** /***********************************************************************
@ -79,7 +88,6 @@ namespace OpenSim.Data.SQLite
**********************************************************************/ **********************************************************************/
/// <summary> /// <summary>
/// See IRegionDataStore
/// <list type="bullet"> /// <list type="bullet">
/// <item>Initialises RegionData Interface</item> /// <item>Initialises RegionData Interface</item>
/// <item>Loads and initialises a new SQLite connection and maintains it.</item> /// <item>Loads and initialises a new SQLite connection and maintains it.</item>
@ -177,7 +185,7 @@ namespace OpenSim.Data.SQLite
{ {
m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table"); m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table");
} }
try try
{ {
terrainDa.Fill(ds.Tables["terrain"]); terrainDa.Fill(ds.Tables["terrain"]);
@ -511,7 +519,7 @@ namespace OpenSim.Data.SQLite
"[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape"); "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
prim.Shape = PrimitiveBaseShape.Default; prim.Shape = PrimitiveBaseShape.Default;
} }
createdObjects[new UUID(objID)].AddPart(prim); createdObjects[new UUID(objID)].AddPart(prim);
LoadItems(prim); LoadItems(prim);
} }
@ -535,17 +543,17 @@ namespace OpenSim.Data.SQLite
/// </summary> /// </summary>
/// <param name="prim">the prim</param> /// <param name="prim">the prim</param>
private void LoadItems(SceneObjectPart prim) private void LoadItems(SceneObjectPart prim)
{ {
// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID); // m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID);
DataTable dbItems = ds.Tables["primitems"]; DataTable dbItems = ds.Tables["primitems"];
String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
DataRow[] dbItemRows = dbItems.Select(sql); DataRow[] dbItemRows = dbItems.Select(sql);
IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID); // "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
foreach (DataRow row in dbItemRows) foreach (DataRow row in dbItemRows)
{ {
TaskInventoryItem item = buildItem(row); TaskInventoryItem item = buildItem(row);
@ -694,8 +702,6 @@ namespace OpenSim.Data.SQLite
{ {
landaccesslist.Rows.Remove(rowsToDelete[iter]); landaccesslist.Rows.Remove(rowsToDelete[iter]);
} }
} }
Commit(); Commit();
} }
@ -805,7 +811,7 @@ namespace OpenSim.Data.SQLite
try try
{ {
regionSettingsDa.Update(ds, "regionsettings"); regionSettingsDa.Update(ds, "regionsettings");
} }
catch (SqliteException SqlEx) catch (SqliteException SqlEx)
{ {
throw new Exception( throw new Exception(
@ -975,7 +981,7 @@ namespace OpenSim.Data.SQLite
createCol(prims, "CollisionSoundVolume", typeof(Double)); createCol(prims, "CollisionSoundVolume", typeof(Double));
createCol(prims, "VolumeDetect", typeof(Int16)); createCol(prims, "VolumeDetect", typeof(Int16));
createCol(prims, "MediaURL", typeof(String)); createCol(prims, "MediaURL", typeof(String));
// Add in contraints // Add in contraints
@ -1192,10 +1198,10 @@ namespace OpenSim.Data.SQLite
private SceneObjectPart buildPrim(DataRow row) private SceneObjectPart buildPrim(DataRow row)
{ {
// Code commented. Uncomment to test the unit test inline. // Code commented. Uncomment to test the unit test inline.
// The unit test mentions this commented code for the purposes // The unit test mentions this commented code for the purposes
// of debugging a unit test failure // of debugging a unit test failure
// SceneObjectGroup sog = new SceneObjectGroup(); // SceneObjectGroup sog = new SceneObjectGroup();
// SceneObjectPart sop = new SceneObjectPart(); // SceneObjectPart sop = new SceneObjectPart();
// sop.LocalId = 1; // sop.LocalId = 1;
@ -1212,7 +1218,7 @@ namespace OpenSim.Data.SQLite
// TODO: this doesn't work yet because something more // TODO: this doesn't work yet because something more
// interesting has to be done to actually get these values // interesting has to be done to actually get these values
// back out. Not enough time to figure it out yet. // back out. Not enough time to figure it out yet.
SceneObjectPart prim = new SceneObjectPart(); SceneObjectPart prim = new SceneObjectPart();
prim.UUID = new UUID((String) row["UUID"]); prim.UUID = new UUID((String) row["UUID"]);
// explicit conversion of integers is required, which sort // explicit conversion of integers is required, which sort
@ -1342,7 +1348,7 @@ namespace OpenSim.Data.SQLite
if (Convert.ToInt16(row["VolumeDetect"]) != 0) if (Convert.ToInt16(row["VolumeDetect"]) != 0)
prim.VolumeDetectActive = true; prim.VolumeDetectActive = true;
if (!(row["MediaURL"] is System.DBNull)) if (!(row["MediaURL"] is System.DBNull))
{ {
//m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType());
@ -1681,7 +1687,7 @@ namespace OpenSim.Data.SQLite
row["VolumeDetect"] = 1; row["VolumeDetect"] = 1;
else else
row["VolumeDetect"] = 0; row["VolumeDetect"] = 0;
row["MediaURL"] = prim.MediaUrl; row["MediaURL"] = prim.MediaUrl;
} }
@ -1759,12 +1765,12 @@ namespace OpenSim.Data.SQLite
row["UserLookAtZ"] = land.UserLookAt.Z; row["UserLookAtZ"] = land.UserLookAt.Z;
row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["AuthbuyerID"] = land.AuthBuyerID.ToString();
row["OtherCleanTime"] = land.OtherCleanTime; row["OtherCleanTime"] = land.OtherCleanTime;
row["MediaType"] = land.MediaType; row["MediaType"] = land.MediaType;
row["MediaDescription"] = land.MediaDescription; row["MediaDescription"] = land.MediaDescription;
row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();
row["MediaLoop"] = land.MediaLoop.ToString(); row["MediaLoop"] = land.MediaLoop.ToString();
row["ObscureMusic"] = land.ObscureMusic.ToString(); row["ObscureMusic"] = land.ObscureMusic.ToString();
row["ObscureMedia"] = land.ObscureMedia.ToString(); row["ObscureMedia"] = land.ObscureMedia.ToString();
} }
/// <summary> /// <summary>
@ -1862,10 +1868,10 @@ namespace OpenSim.Data.SQLite
s.TextureEntry = textureEntry; s.TextureEntry = textureEntry;
s.ExtraParams = (byte[]) row["ExtraParams"]; s.ExtraParams = (byte[]) row["ExtraParams"];
if (!(row["Media"] is System.DBNull)) if (!(row["Media"] is System.DBNull))
s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
return s; return s;
} }
@ -1909,7 +1915,7 @@ namespace OpenSim.Data.SQLite
row["Texture"] = s.TextureEntry; row["Texture"] = s.TextureEntry;
row["ExtraParams"] = s.ExtraParams; row["ExtraParams"] = s.ExtraParams;
if (s.Media != null) if (s.Media != null)
row["Media"] = s.Media.ToXml(); row["Media"] = s.Media.ToXml();
} }
@ -1951,7 +1957,6 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// see IRegionDatastore
/// </summary> /// </summary>
/// <param name="primID"></param> /// <param name="primID"></param>
/// <param name="items"></param> /// <param name="items"></param>
@ -2248,7 +2253,6 @@ namespace OpenSim.Data.SQLite
delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String))); delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String)));
da.DeleteCommand = delete; da.DeleteCommand = delete;
da.DeleteCommand.Connection = conn; da.DeleteCommand.Connection = conn;
} }
private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn) private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn)
@ -2320,7 +2324,7 @@ namespace OpenSim.Data.SQLite
return DbType.String; return DbType.String;
} }
} }
static void PrintDataSet(DataSet ds) static void PrintDataSet(DataSet ds)
{ {
// Print out any name and extended properties. // Print out any name and extended properties.

View File

@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLiteLegacy
private Dictionary<string, FieldInfo> m_FieldMap = private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>(); new Dictionary<string, FieldInfo>();
public SQLiteEstateStore()
{
}
public SQLiteEstateStore(string connectionString)
{
Initialise(connectionString);
}
public void Initialise(string connectionString) public void Initialise(string connectionString)
{ {
m_connectionString = connectionString; m_connectionString = connectionString;

View File

@ -43,7 +43,7 @@ namespace OpenSim.Data.SQLiteLegacy
/// <summary> /// <summary>
/// A RegionData Interface to the SQLite database /// A RegionData Interface to the SQLite database
/// </summary> /// </summary>
public class SQLiteRegionData : IRegionDataStore public class SQLiteSimulationData : ISimulationDataStore
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -69,6 +69,15 @@ namespace OpenSim.Data.SQLiteLegacy
private String m_connectionString; private String m_connectionString;
public SQLiteSimulationData()
{
}
public SQLiteSimulationData(string connectionString)
{
Initialise(connectionString);
}
// Temporary attribute while this is experimental // Temporary attribute while this is experimental
/*********************************************************************** /***********************************************************************
@ -78,7 +87,6 @@ namespace OpenSim.Data.SQLiteLegacy
**********************************************************************/ **********************************************************************/
/// <summary> /// <summary>
/// See IRegionDataStore
/// <list type="bullet"> /// <list type="bullet">
/// <item>Initialises RegionData Interface</item> /// <item>Initialises RegionData Interface</item>
/// <item>Loads and initialises a new SQLite connection and maintains it.</item> /// <item>Loads and initialises a new SQLite connection and maintains it.</item>
@ -1888,7 +1896,6 @@ namespace OpenSim.Data.SQLiteLegacy
} }
/// <summary> /// <summary>
/// see IRegionDatastore
/// </summary> /// </summary>
/// <param name="primID"></param> /// <param name="primID"></param>
/// <param name="items"></param> /// <param name="items"></param>

View File

@ -1,4 +1,31 @@
using System; /*
* 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.IO; using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using log4net.Config; using log4net.Config;
@ -41,13 +68,13 @@ namespace OpenSim.Data.Tests
{ {
m_connStr = !String.IsNullOrEmpty(conn) ? conn : DefaultTestConns.Get(typeof(TConn)); m_connStr = !String.IsNullOrEmpty(conn) ? conn : DefaultTestConns.Get(typeof(TConn));
m_log = LogManager.GetLogger(this.GetType()); m_log = LogManager.GetLogger(this.GetType());
OpenSim.Tests.Common.TestLogging.LogToConsole(); // TODO: Is that right? OpenSim.Tests.Common.TestLogging.LogToConsole(); // TODO: Is that right?
} }
/// <summary> /// <summary>
/// To be overridden in derived classes. Do whatever init with the m_service, like setting the conn string to it. /// To be overridden in derived classes. Do whatever init with the m_service, like setting the conn string to it.
/// You'd probably want to to cast the 'service' to a more specific type and store it in a member var. /// You'd probably want to to cast the 'service' to a more specific type and store it in a member var.
/// This framework takes care of disposing it, if it's disposable. /// This framework takes care of disposing it, if it's disposable.
/// </summary> /// </summary>
/// <param name="service">The service being tested</param> /// <param name="service">The service being tested</param>
@ -118,12 +145,12 @@ namespace OpenSim.Data.Tests
{ {
if (m_service != null) if (m_service != null)
{ {
if( m_service is IDisposable) if (m_service is IDisposable)
((IDisposable)m_service).Dispose(); ((IDisposable)m_service).Dispose();
m_service = null; m_service = null;
} }
if( !String.IsNullOrEmpty(m_file) && File.Exists(m_file) ) if (!String.IsNullOrEmpty(m_file) && File.Exists(m_file))
File.Delete(m_file); File.Delete(m_file);
} }
@ -204,7 +231,7 @@ namespace OpenSim.Data.Tests
lst += ", " + s; lst += ", " + s;
} }
string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst); string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst);
try try
{ {
ExecuteSql("DELETE FROM migrations where name " + sCond); ExecuteSql("DELETE FROM migrations where name " + sCond);

View File

@ -1,4 +1,31 @@
using System; /*
* 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.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;

View File

@ -61,17 +61,17 @@ namespace OpenSim.Data.Tests
#else #else
[TestFixture(Description = "Region store tests (SQLite)")] [TestFixture(Description = "Region store tests (SQLite)")]
public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteRegionData> public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteSimulationData>
{ {
} }
[TestFixture(Description = "Region store tests (MySQL)")] [TestFixture(Description = "Region store tests (MySQL)")]
public class MySqlRegionTests : RegionTests<MySqlConnection, MySQLDataStore> public class MySqlRegionTests : RegionTests<MySqlConnection, MySQLSimulationData>
{ {
} }
[TestFixture(Description = "Region store tests (MS SQL Server)")] [TestFixture(Description = "Region store tests (MS SQL Server)")]
public class MSSQLRegionTests : RegionTests<SqlConnection, MSSQLRegionDataStore> public class MSSQLRegionTests : RegionTests<SqlConnection, MSSQLSimulationData>
{ {
} }
@ -79,11 +79,11 @@ namespace OpenSim.Data.Tests
public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore> public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore>
where TConn : DbConnection, new() where TConn : DbConnection, new()
where TRegStore : class, IRegionDataStore, new() where TRegStore : class, ISimulationDataStore, new()
{ {
bool m_rebuildDB; bool m_rebuildDB;
public IRegionDataStore db; public ISimulationDataStore db;
public UUID zero = UUID.Zero; public UUID zero = UUID.Zero;
public UUID region1 = UUID.Random(); public UUID region1 = UUID.Random();
public UUID region2 = UUID.Random(); public UUID region2 = UUID.Random();
@ -122,7 +122,7 @@ namespace OpenSim.Data.Tests
protected override void InitService(object service) protected override void InitService(object service)
{ {
ClearDB(); ClearDB();
db = (IRegionDataStore)service; db = (ISimulationDataStore)service;
db.Initialise(m_connStr); db.Initialise(m_connStr);
} }

View File

@ -760,7 +760,7 @@ namespace OpenSim.Framework.Capabilities
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
BakedTextureUploader uploader = BakedTextureUploader uploader =
new BakedTextureUploader( capsBase + uploaderPath, new BakedTextureUploader(capsBase + uploaderPath,
m_httpListener); m_httpListener);
uploader.OnUpLoad += BakedTextureUploaded; uploader.OnUpLoad += BakedTextureUploaded;

View File

@ -124,22 +124,6 @@ namespace OpenSim.Framework
set { m_standaloneUserSource = value; } set { m_standaloneUserSource = value; }
} }
protected string m_storageConnectionString;
public string StorageConnectionString
{
get { return m_storageConnectionString; }
set { m_storageConnectionString = value; }
}
protected string m_estateConnectionString;
public string EstateConnectionString
{
get { return m_estateConnectionString; }
set { m_estateConnectionString = value; }
}
protected string m_librariesXMLFile; protected string m_librariesXMLFile;
public string LibrariesXMLFile public string LibrariesXMLFile
{ {

View File

@ -151,7 +151,7 @@ namespace OpenSim.Framework.Console
help.Add(commandInfo.descriptive_help); help.Add(commandInfo.descriptive_help);
if (descriptiveHelp != string.Empty) if (descriptiveHelp != string.Empty)
help.Add(string.Empty); help.Add(string.Empty);
} }
else else
{ {

View File

@ -89,6 +89,57 @@ namespace OpenSim.Framework.Console
return ret; return ret;
} }
public string CmdPrompt(string p, List<char> excludedCharacters)
{
bool itisdone = false;
string ret = String.Empty;
while (!itisdone)
{
itisdone = true;
ret = CmdPrompt(p);
foreach (char c in excludedCharacters)
{
if (ret.Contains(c.ToString()))
{
System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted.");
itisdone = false;
}
}
}
return ret;
}
public string CmdPrompt(string p, string def, List<char> excludedCharacters)
{
bool itisdone = false;
string ret = String.Empty;
while (!itisdone)
{
itisdone = true;
ret = CmdPrompt(p, def);
if (ret == String.Empty)
{
ret = def;
}
else
{
foreach (char c in excludedCharacters)
{
if (ret.Contains(c.ToString()))
{
System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted.");
itisdone = false;
}
}
}
}
return ret;
}
// Displays a command prompt and returns a default value, user may only enter 1 of 2 options // Displays a command prompt and returns a default value, user may only enter 1 of 2 options
public string CmdPrompt(string prompt, string defaultresponse, List<string> options) public string CmdPrompt(string prompt, string defaultresponse, List<string> options)

View File

@ -38,7 +38,7 @@ namespace OpenSim.Framework.Console
{ {
/// <summary> /// <summary>
/// A console that uses cursor control and color /// A console that uses cursor control and color
/// </summary> /// </summary>
public class LocalConsole : CommandConsole public class LocalConsole : CommandConsole
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -100,8 +100,8 @@ namespace OpenSim.Framework.Console
private int SetCursorTop(int top) private int SetCursorTop(int top)
{ {
// From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
// to set a cursor row position with a currently invalid column, mono will throw an exception. // to set a cursor row position with a currently invalid column, mono will throw an exception.
// Therefore, we need to make sure that the column position is valid first. // Therefore, we need to make sure that the column position is valid first.
int left = System.Console.CursorLeft; int left = System.Console.CursorLeft;
if (left < 0) if (left < 0)
@ -121,7 +121,7 @@ namespace OpenSim.Framework.Console
{ {
top = 0; top = 0;
} }
else else
{ {
int bh = System.Console.BufferHeight; int bh = System.Console.BufferHeight;
@ -133,7 +133,7 @@ namespace OpenSim.Framework.Console
System.Console.CursorTop = top; System.Console.CursorTop = top;
return top; return top;
} }
/// <summary> /// <summary>
/// Set the cursor column. /// Set the cursor column.
@ -145,12 +145,12 @@ namespace OpenSim.Framework.Console
/// </param> /// </param>
/// <returns> /// <returns>
/// The new cursor column. /// The new cursor column.
/// </returns> /// </returns>
private int SetCursorLeft(int left) private int SetCursorLeft(int left)
{ {
// From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
// to set a cursor column position with a currently invalid row, mono will throw an exception. // to set a cursor column position with a currently invalid row, mono will throw an exception.
// Therefore, we need to make sure that the row position is valid first. // Therefore, we need to make sure that the row position is valid first.
int top = System.Console.CursorTop; int top = System.Console.CursorTop;
if (top < 0) if (top < 0)
@ -214,7 +214,7 @@ namespace OpenSim.Framework.Console
System.Console.Write("{0}", prompt); System.Console.Write("{0}", prompt);
SetCursorTop(new_y); SetCursorTop(new_y);
SetCursorLeft(new_x); SetCursorLeft(new_x);
} }
} }
@ -461,7 +461,8 @@ namespace OpenSim.Framework.Console
SetCursorLeft(0); SetCursorLeft(0);
y = SetCursorTop(y); y = SetCursorTop(y);
System.Console.WriteLine("{0}{1}", prompt, cmdline); System.Console.WriteLine();
//Show();
lock (cmdline) lock (cmdline)
{ {
@ -486,7 +487,7 @@ namespace OpenSim.Framework.Console
} }
} }
AddToHistory(cmdline.ToString()); //AddToHistory(cmdline.ToString());
return cmdline.ToString(); return cmdline.ToString();
default: default:
break; break;

View File

@ -1,4 +1,31 @@
using System; /*
* 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.Threading; using System.Threading;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;

View File

@ -89,13 +89,13 @@ namespace OpenSim.Framework
private Vector3 _userLocation = new Vector3(); private Vector3 _userLocation = new Vector3();
private Vector3 _userLookAt = new Vector3(); private Vector3 _userLookAt = new Vector3();
private int _otherCleanTime = 0; private int _otherCleanTime = 0;
private string _mediaType = "none/none"; private string _mediaType = "none/none";
private string _mediaDescription = ""; private string _mediaDescription = "";
private int _mediaHeight = 0; private int _mediaHeight = 0;
private int _mediaWidth = 0; private int _mediaWidth = 0;
private bool _mediaLoop = false; private bool _mediaLoop = false;
private bool _obscureMusic = false; private bool _obscureMusic = false;
private bool _obscureMedia = false; private bool _obscureMedia = false;
/// <summary> /// <summary>
/// Whether to obscure parcel media URL /// Whether to obscure parcel media URL
@ -690,13 +690,13 @@ namespace OpenSim.Framework
landData._userLocation = _userLocation; landData._userLocation = _userLocation;
landData._userLookAt = _userLookAt; landData._userLookAt = _userLookAt;
landData._otherCleanTime = _otherCleanTime; landData._otherCleanTime = _otherCleanTime;
landData._mediaType = _mediaType; landData._mediaType = _mediaType;
landData._mediaDescription = _mediaDescription; landData._mediaDescription = _mediaDescription;
landData._mediaWidth = _mediaWidth; landData._mediaWidth = _mediaWidth;
landData._mediaHeight = _mediaHeight; landData._mediaHeight = _mediaHeight;
landData._mediaLoop = _mediaLoop; landData._mediaLoop = _mediaLoop;
landData._obscureMusic = _obscureMusic; landData._obscureMusic = _obscureMusic;
landData._obscureMedia = _obscureMedia; landData._obscureMedia = _obscureMedia;
landData._parcelAccessList.Clear(); landData._parcelAccessList.Clear();
foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList) foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)

View File

@ -49,12 +49,12 @@ namespace OpenSim.Framework
public UUID SnapshotID; public UUID SnapshotID;
public Vector3 UserLocation; public Vector3 UserLocation;
public Vector3 UserLookAt; public Vector3 UserLookAt;
public string MediaType; public string MediaType;
public string MediaDescription; public string MediaDescription;
public int MediaHeight; public int MediaHeight;
public int MediaWidth; public int MediaWidth;
public bool MediaLoop; public bool MediaLoop;
public bool ObscureMusic; public bool ObscureMusic;
public bool ObscureMedia; public bool ObscureMedia;
} }
} }

View File

@ -1,4 +1,4 @@
// //
// Lazy.cs // Lazy.cs
// //
// Authors: // Authors:

View File

@ -175,7 +175,7 @@ namespace OpenSim.Framework
} }
} }
} }
/// <summary> /// <summary>
/// Entries to store media textures on each face /// Entries to store media textures on each face
/// </summary> /// </summary>
@ -1216,28 +1216,28 @@ namespace OpenSim.Framework
prim.Properties.Permissions = new Permissions(); prim.Properties.Permissions = new Permissions();
prim.Properties.SalePrice = 10; prim.Properties.SalePrice = 10;
prim.Properties.SaleType = new SaleType(); prim.Properties.SaleType = new SaleType();
return prim; return prim;
} }
/// <summary> /// <summary>
/// Encapsulates a list of media entries. /// Encapsulates a list of media entries.
/// </summary> /// </summary>
/// This class is necessary because we want to replace auto-serialization of MediaEntry with something more /// This class is necessary because we want to replace auto-serialization of MediaEntry with something more
/// OSD like and less vulnerable to change. /// OSD like and less vulnerable to change.
public class MediaList : List<MediaEntry>, IXmlSerializable public class MediaList : List<MediaEntry>, IXmlSerializable
{ {
public const string MEDIA_TEXTURE_TYPE = "sl"; public const string MEDIA_TEXTURE_TYPE = "sl";
public MediaList() : base() {} public MediaList() : base() {}
public MediaList(IEnumerable<MediaEntry> collection) : base(collection) {} public MediaList(IEnumerable<MediaEntry> collection) : base(collection) {}
public MediaList(int capacity) : base(capacity) {} public MediaList(int capacity) : base(capacity) {}
public XmlSchema GetSchema() public XmlSchema GetSchema()
{ {
return null; return null;
} }
public string ToXml() public string ToXml()
{ {
lock (this) lock (this)
@ -1245,78 +1245,78 @@ namespace OpenSim.Framework
using (StringWriter sw = new StringWriter()) using (StringWriter sw = new StringWriter())
{ {
using (XmlTextWriter xtw = new XmlTextWriter(sw)) using (XmlTextWriter xtw = new XmlTextWriter(sw))
{ {
xtw.WriteStartElement("OSMedia"); xtw.WriteStartElement("OSMedia");
xtw.WriteAttributeString("type", MEDIA_TEXTURE_TYPE); xtw.WriteAttributeString("type", MEDIA_TEXTURE_TYPE);
xtw.WriteAttributeString("version", "0.1"); xtw.WriteAttributeString("version", "0.1");
OSDArray meArray = new OSDArray(); OSDArray meArray = new OSDArray();
foreach (MediaEntry me in this) foreach (MediaEntry me in this)
{ {
OSD osd = (null == me ? new OSD() : me.GetOSD()); OSD osd = (null == me ? new OSD() : me.GetOSD());
meArray.Add(osd); meArray.Add(osd);
} }
xtw.WriteStartElement("OSData"); xtw.WriteStartElement("OSData");
xtw.WriteRaw(OSDParser.SerializeLLSDXmlString(meArray)); xtw.WriteRaw(OSDParser.SerializeLLSDXmlString(meArray));
xtw.WriteEndElement(); xtw.WriteEndElement();
xtw.WriteEndElement(); xtw.WriteEndElement();
xtw.Flush(); xtw.Flush();
return sw.ToString(); return sw.ToString();
} }
} }
} }
} }
public void WriteXml(XmlWriter writer) public void WriteXml(XmlWriter writer)
{ {
writer.WriteRaw(ToXml()); writer.WriteRaw(ToXml());
} }
public static MediaList FromXml(string rawXml) public static MediaList FromXml(string rawXml)
{ {
MediaList ml = new MediaList(); MediaList ml = new MediaList();
ml.ReadXml(rawXml); ml.ReadXml(rawXml);
return ml; return ml;
} }
public void ReadXml(string rawXml) public void ReadXml(string rawXml)
{ {
using (StringReader sr = new StringReader(rawXml)) using (StringReader sr = new StringReader(rawXml))
{ {
using (XmlTextReader xtr = new XmlTextReader(sr)) using (XmlTextReader xtr = new XmlTextReader(sr))
{ {
xtr.MoveToContent(); xtr.MoveToContent();
string type = xtr.GetAttribute("type"); string type = xtr.GetAttribute("type");
//m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type); //m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type);
if (type != MEDIA_TEXTURE_TYPE) if (type != MEDIA_TEXTURE_TYPE)
return; return;
xtr.ReadStartElement("OSMedia"); xtr.ReadStartElement("OSMedia");
OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml()); OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml());
foreach (OSD osdMe in osdMeArray) foreach (OSD osdMe in osdMeArray)
{ {
MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry()); MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry());
Add(me); Add(me);
} }
xtr.ReadEndElement(); xtr.ReadEndElement();
} }
} }
} }
public void ReadXml(XmlReader reader) public void ReadXml(XmlReader reader)
{ {
if (reader.IsEmptyElement) if (reader.IsEmptyElement)
return; return;
ReadXml(reader.ReadInnerXml()); ReadXml(reader.ReadInnerXml());
} }
} }
} }
} }

View File

@ -98,9 +98,9 @@ namespace OpenSim.Framework
[Serializable] [Serializable]
public class SimpleRegionInfo public class SimpleRegionInfo
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// The port by which http communication occurs with the region (most noticeably, CAPS communication) /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
/// </summary> /// </summary>
@ -345,7 +345,7 @@ namespace OpenSim.Framework
public string proxyUrl = ""; public string proxyUrl = "";
public int ProxyOffset = 0; public int ProxyOffset = 0;
public string regionSecret = UUID.Random().ToString(); public string regionSecret = UUID.Random().ToString();
public string osSecret; public string osSecret;
public UUID lastMapUUID = UUID.Zero; public UUID lastMapUUID = UUID.Zero;
@ -700,7 +700,7 @@ namespace OpenSim.Framework
RegionID = new UUID(regionUUID); RegionID = new UUID(regionUUID);
originRegionID = RegionID; // What IS this?! originRegionID = RegionID; // What IS this?!
RegionName = name; RegionName = name;
string location = config.GetString("Location", String.Empty); string location = config.GetString("Location", String.Empty);
@ -721,7 +721,7 @@ namespace OpenSim.Framework
// Internal IP // Internal IP
IPAddress address; IPAddress address;
if (config.Contains("InternalAddress")) if (config.Contains("InternalAddress"))
{ {
address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty)); address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty));
@ -775,7 +775,7 @@ namespace OpenSim.Framework
{ {
m_externalHostName = Util.GetLocalHost().ToString(); m_externalHostName = Util.GetLocalHost().ToString();
m_log.InfoFormat( m_log.InfoFormat(
"[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}", "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}",
m_externalHostName, name); m_externalHostName, name);
} }
else else
@ -910,16 +910,16 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true); "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true);
configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Maximum size for physical prims", m_physPrimMax.ToString(), true); "Maximum size for physical prims", m_physPrimMax.ToString(), true);
configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
"Clamp prims to max size", m_clampPrimSize.ToString(), true); "Clamp prims to max size", m_clampPrimSize.ToString(), true);
configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Max objects this sim will hold", m_objectCapacity.ToString(), true); "Max objects this sim will hold", m_objectCapacity.ToString(), true);
configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID, configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
"Scope ID for this region", ScopeID.ToString(), true); "Scope ID for this region", ScopeID.ToString(), true);
@ -957,16 +957,16 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Maximum size for nonphysical prims", "0", true); "Maximum size for nonphysical prims", "0", true);
configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Maximum size for physical prims", "0", true); "Maximum size for physical prims", "0", true);
configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
"Clamp prims to max size", "false", true); "Clamp prims to max size", "false", true);
configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Max objects this sim will hold", "0", true); "Max objects this sim will hold", "0", true);

View File

@ -46,7 +46,7 @@ namespace OpenSim.Framework
case AssetType.Texture: case AssetType.Texture:
return "image/x-j2c"; return "image/x-j2c";
case AssetType.Sound: case AssetType.Sound:
return "application/ogg"; return "audio/ogg";
case AssetType.CallingCard: case AssetType.CallingCard:
return "application/vnd.ll.callingcard"; return "application/vnd.ll.callingcard";
case AssetType.Landmark: case AssetType.Landmark:
@ -98,8 +98,6 @@ namespace OpenSim.Framework
return "application/vnd.ll.outfitfolder"; return "application/vnd.ll.outfitfolder";
case AssetType.MyOutfitsFolder: case AssetType.MyOutfitsFolder:
return "application/vnd.ll.myoutfitsfolder"; return "application/vnd.ll.myoutfitsfolder";
case AssetType.InboxFolder:
return "application/vnd.ll.inboxfolder";
case AssetType.Unknown: case AssetType.Unknown:
default: default:
return "application/octet-stream"; return "application/octet-stream";
@ -128,7 +126,7 @@ namespace OpenSim.Framework
case InventoryType.Object: case InventoryType.Object:
return "application/vnd.ll.primitive"; return "application/vnd.ll.primitive";
case InventoryType.Sound: case InventoryType.Sound:
return "application/ogg"; return "audio/ogg";
case InventoryType.Snapshot: case InventoryType.Snapshot:
case InventoryType.Texture: case InventoryType.Texture:
return "image/x-j2c"; return "image/x-j2c";
@ -147,6 +145,7 @@ namespace OpenSim.Framework
case "image/jp2": case "image/jp2":
return (sbyte)AssetType.Texture; return (sbyte)AssetType.Texture;
case "application/ogg": case "application/ogg":
case "audio/ogg":
return (sbyte)AssetType.Sound; return (sbyte)AssetType.Sound;
case "application/vnd.ll.callingcard": case "application/vnd.ll.callingcard":
case "application/x-metaverse-callingcard": case "application/x-metaverse-callingcard":
@ -209,8 +208,6 @@ namespace OpenSim.Framework
return (sbyte)AssetType.OutfitFolder; return (sbyte)AssetType.OutfitFolder;
case "application/vnd.ll.myoutfitsfolder": case "application/vnd.ll.myoutfitsfolder":
return (sbyte)AssetType.MyOutfitsFolder; return (sbyte)AssetType.MyOutfitsFolder;
case "application/vnd.ll.inboxfolder":
return (sbyte)AssetType.InboxFolder;
case "application/octet-stream": case "application/octet-stream":
default: default:
return (sbyte)AssetType.Unknown; return (sbyte)AssetType.Unknown;
@ -227,6 +224,7 @@ namespace OpenSim.Framework
case "image/jpeg": case "image/jpeg":
return (sbyte)InventoryType.Texture; return (sbyte)InventoryType.Texture;
case "application/ogg": case "application/ogg":
case "audio/ogg":
case "audio/x-wav": case "audio/x-wav":
return (sbyte)InventoryType.Sound; return (sbyte)InventoryType.Sound;
case "application/vnd.ll.callingcard": case "application/vnd.ll.callingcard":

View File

@ -157,9 +157,9 @@ namespace OpenSim.Framework.Serialization
public static string CreateOarObjectFilename(string objectName, UUID uuid, Vector3 pos) public static string CreateOarObjectFilename(string objectName, UUID uuid, Vector3 pos)
{ {
return string.Format( return string.Format(
OAR_OBJECT_FILENAME_TEMPLATE, objectName, OAR_OBJECT_FILENAME_TEMPLATE, objectName,
Math.Round(pos.X), Math.Round(pos.Y), Math.Round(pos.Z), Math.Round(pos.X), Math.Round(pos.Y), Math.Round(pos.Z),
uuid); uuid);
} }
/// <summary> /// <summary>
@ -171,9 +171,9 @@ namespace OpenSim.Framework.Serialization
/// <returns></returns> /// <returns></returns>
public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos) public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos)
{ {
return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos); return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos);
} }
/// <summary> /// <summary>
/// Extract a plain path from an IAR path /// Extract a plain path from an IAR path
/// </summary> /// </summary>
@ -184,18 +184,18 @@ namespace OpenSim.Framework.Serialization
List<string> plainDirs = new List<string>(); List<string> plainDirs = new List<string>();
string[] iarDirs = iarPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); string[] iarDirs = iarPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string iarDir in iarDirs) foreach (string iarDir in iarDirs)
{ {
if (!iarDir.Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR)) if (!iarDir.Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR))
plainDirs.Add(iarDir); plainDirs.Add(iarDir);
int i = iarDir.LastIndexOf(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR); int i = iarDir.LastIndexOf(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
plainDirs.Add(iarDir.Remove(i)); plainDirs.Add(iarDir.Remove(i));
} }
return string.Join("/", plainDirs.ToArray()); return string.Join("/", plainDirs.ToArray());
} }
} }
} }

View File

@ -51,7 +51,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); private HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
private volatile int NotSocketErrors = 0; private volatile int NotSocketErrors = 0;
public volatile bool HTTPDRunning = false; public volatile bool HTTPDRunning = false;
@ -160,7 +160,7 @@ namespace OpenSim.Framework.Servers.HttpServer
m_rpcHandlers[method] = handler; m_rpcHandlers[method] = handler;
m_rpcHandlersKeepAlive[method] = keepAlive; // default m_rpcHandlersKeepAlive[method] = keepAlive; // default
} }
return true; return true;
} }
@ -182,7 +182,7 @@ namespace OpenSim.Framework.Servers.HttpServer
public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler)
{ {
//m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName);
lock (m_HTTPHandlers) lock (m_HTTPHandlers)
{ {
if (!m_HTTPHandlers.ContainsKey(methodName)) if (!m_HTTPHandlers.ContainsKey(methodName))
@ -204,14 +204,14 @@ namespace OpenSim.Framework.Servers.HttpServer
if (!m_pollHandlers.ContainsKey(methodName)) if (!m_pollHandlers.ContainsKey(methodName))
{ {
m_pollHandlers.Add(methodName,args); m_pollHandlers.Add(methodName,args);
pollHandlerResult = true; pollHandlerResult = true;
} }
} }
if (pollHandlerResult) if (pollHandlerResult)
return AddHTTPHandler(methodName, handler); return AddHTTPHandler(methodName, handler);
return false; return false;
} }
// Note that the agent string is provided simply to differentiate // Note that the agent string is provided simply to differentiate
@ -257,51 +257,51 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
IHttpClientContext context = (IHttpClientContext)source; IHttpClientContext context = (IHttpClientContext)source;
IHttpRequest request = args.Request; IHttpRequest request = args.Request;
PollServiceEventArgs psEvArgs; PollServiceEventArgs psEvArgs;
if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs)) if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs))
{ {
PollServiceHttpRequest psreq = new PollServiceHttpRequest(psEvArgs, context, request); PollServiceHttpRequest psreq = new PollServiceHttpRequest(psEvArgs, context, request);
if (psEvArgs.Request != null) if (psEvArgs.Request != null)
{ {
OSHttpRequest req = new OSHttpRequest(context, request); OSHttpRequest req = new OSHttpRequest(context, request);
Stream requestStream = req.InputStream; Stream requestStream = req.InputStream;
Encoding encoding = Encoding.UTF8; Encoding encoding = Encoding.UTF8;
StreamReader reader = new StreamReader(requestStream, encoding); StreamReader reader = new StreamReader(requestStream, encoding);
string requestBody = reader.ReadToEnd(); string requestBody = reader.ReadToEnd();
Hashtable keysvals = new Hashtable(); Hashtable keysvals = new Hashtable();
Hashtable headervals = new Hashtable(); Hashtable headervals = new Hashtable();
string[] querystringkeys = req.QueryString.AllKeys; string[] querystringkeys = req.QueryString.AllKeys;
string[] rHeaders = req.Headers.AllKeys; string[] rHeaders = req.Headers.AllKeys;
keysvals.Add("body", requestBody); keysvals.Add("body", requestBody);
keysvals.Add("uri", req.RawUrl); keysvals.Add("uri", req.RawUrl);
keysvals.Add("content-type", req.ContentType); keysvals.Add("content-type", req.ContentType);
keysvals.Add("http-method", req.HttpMethod); keysvals.Add("http-method", req.HttpMethod);
foreach (string queryname in querystringkeys) foreach (string queryname in querystringkeys)
{ {
keysvals.Add(queryname, req.QueryString[queryname]); keysvals.Add(queryname, req.QueryString[queryname]);
} }
foreach (string headername in rHeaders) foreach (string headername in rHeaders)
{ {
headervals[headername] = req.Headers[headername]; headervals[headername] = req.Headers[headername];
} }
keysvals.Add("headers", headervals); keysvals.Add("headers", headervals);
keysvals.Add("querystringkeys", querystringkeys); keysvals.Add("querystringkeys", querystringkeys);
psEvArgs.Request(psreq.RequestID, keysvals); psEvArgs.Request(psreq.RequestID, keysvals);
} }
m_PollServiceManager.Enqueue(psreq); m_PollServiceManager.Enqueue(psreq);
} }
else else
@ -348,10 +348,10 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
try try
{ {
// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); // m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
// This is the REST agent interface. We require an agent to properly identify // This is the REST agent interface. We require an agent to properly identify
// itself. If the REST handler recognizes the prefix it will attempt to // itself. If the REST handler recognizes the prefix it will attempt to
// satisfy the request. If it is not recognizable, and no damage has occurred // satisfy the request. If it is not recognizable, and no damage has occurred
@ -456,7 +456,7 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
request.InputStream.Close(); request.InputStream.Close();
// HTTP IN support. The script engine taes it from here // HTTP IN support. The script engine taes it from here
// Nothing to worry about for us. // Nothing to worry about for us.
// //
@ -540,7 +540,7 @@ namespace OpenSim.Framework.Servers.HttpServer
HandleLLSDRequests(request, response); HandleLLSDRequests(request, response);
return; return;
} }
// m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl); // m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl);
if (DoWeHaveAHTTPHandler(request.RawUrl)) if (DoWeHaveAHTTPHandler(request.RawUrl))
{ {
@ -594,7 +594,7 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
} }
} }
if (String.IsNullOrEmpty(bestMatch)) if (String.IsNullOrEmpty(bestMatch))
{ {
streamHandler = null; streamHandler = null;
@ -641,7 +641,7 @@ namespace OpenSim.Framework.Servers.HttpServer
private bool TryGetHTTPHandler(string handlerKey, out GenericHTTPMethod HTTPHandler) private bool TryGetHTTPHandler(string handlerKey, out GenericHTTPMethod HTTPHandler)
{ {
// m_log.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey); // m_log.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey);
string bestMatch = null; string bestMatch = null;
lock (m_HTTPHandlers) lock (m_HTTPHandlers)
@ -727,14 +727,14 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
xmlRprcRequest.Params.Add(request.RemoteIPEndPoint); // Param[1] xmlRprcRequest.Params.Add(request.RemoteIPEndPoint); // Param[1]
XmlRpcResponse xmlRpcResponse; XmlRpcResponse xmlRpcResponse;
XmlRpcMethod method; XmlRpcMethod method;
bool methodWasFound; bool methodWasFound;
lock (m_rpcHandlers) lock (m_rpcHandlers)
{ {
methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method); methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method);
} }
if (methodWasFound) if (methodWasFound)
{ {
xmlRprcRequest.Params.Add(request.Url); // Param[2] xmlRprcRequest.Params.Add(request.Url); // Param[2]
@ -766,10 +766,10 @@ namespace OpenSim.Framework.Servers.HttpServer
else else
{ {
xmlRpcResponse = new XmlRpcResponse(); xmlRpcResponse = new XmlRpcResponse();
// Code set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php // Code set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
xmlRpcResponse.SetFault( xmlRpcResponse.SetFault(
XmlRpcErrorCodes.SERVER_ERROR_METHOD, XmlRpcErrorCodes.SERVER_ERROR_METHOD,
String.Format("Requested method [{0}] not found", methodName)); String.Format("Requested method [{0}] not found", methodName));
} }
@ -786,11 +786,11 @@ namespace OpenSim.Framework.Servers.HttpServer
response.KeepAlive = false; response.KeepAlive = false;
m_log.ErrorFormat("[BASE HTTP SERVER]: Handler not found for http request {0}", request.RawUrl); m_log.ErrorFormat("[BASE HTTP SERVER]: Handler not found for http request {0}", request.RawUrl);
response.SendChunked = false; response.SendChunked = false;
response.ContentLength64 = buf.Length; response.ContentLength64 = buf.Length;
response.ContentEncoding = Encoding.UTF8; response.ContentEncoding = Encoding.UTF8;
try try
{ {
response.OutputStream.Write(buf, 0, buf.Length); response.OutputStream.Write(buf, 0, buf.Length);
@ -872,13 +872,13 @@ namespace OpenSim.Framework.Servers.HttpServer
OSD llsdRequest = null; OSD llsdRequest = null;
OSD llsdResponse = null; OSD llsdResponse = null;
bool LegacyLLSDLoginLibOMV = (requestBody.Contains("passwd") && requestBody.Contains("mac") && requestBody.Contains("viewer_digest")); bool LegacyLLSDLoginLibOMV = (requestBody.Contains("passwd") && requestBody.Contains("mac") && requestBody.Contains("viewer_digest"));
if (requestBody.Length == 0) if (requestBody.Length == 0)
// Get Request // Get Request
{ {
requestBody = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><llsd><map><key>request</key><string>get</string></map></llsd>"; requestBody = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><llsd><map><key>request</key><string>get</string></map></llsd>";
} }
try try
{ {
@ -1090,7 +1090,7 @@ namespace OpenSim.Framework.Servers.HttpServer
string bestMatch = null; string bestMatch = null;
//m_log.DebugFormat("[BASE HTTP HANDLER]: Checking if we have an HTTP handler for {0}", searchquery); //m_log.DebugFormat("[BASE HTTP HANDLER]: Checking if we have an HTTP handler for {0}", searchquery);
lock (m_HTTPHandlers) lock (m_HTTPHandlers)
{ {
foreach (string pattern in m_HTTPHandlers.Keys) foreach (string pattern in m_HTTPHandlers.Keys)
@ -1156,7 +1156,7 @@ namespace OpenSim.Framework.Servers.HttpServer
// You have to specifically register for '/' and to get it, you must specificaly request it // You have to specifically register for '/' and to get it, you must specificaly request it
// //
if (pattern == "/" && searchquery == "/" || pattern != "/") if (pattern == "/" && searchquery == "/" || pattern != "/")
bestMatch = pattern; bestMatch = pattern;
} }
} }
} }
@ -1236,11 +1236,11 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response) public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[BASE HTTP SERVER]: HandleHTTPRequest for request to {0}, method {1}", // "[BASE HTTP SERVER]: HandleHTTPRequest for request to {0}, method {1}",
// request.RawUrl, request.HttpMethod); // request.RawUrl, request.HttpMethod);
switch (request.HttpMethod) switch (request.HttpMethod)
{ {
case "OPTIONS": case "OPTIONS":
@ -1256,7 +1256,7 @@ namespace OpenSim.Framework.Servers.HttpServer
private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response) private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response)
{ {
// m_log.DebugFormat("[BASE HTTP SERVER]: HandleContentVerbs for request to {0}", request.RawUrl); // m_log.DebugFormat("[BASE HTTP SERVER]: HandleContentVerbs for request to {0}", request.RawUrl);
// This is a test. There's a workable alternative.. as this way sucks. // This is a test. There's a workable alternative.. as this way sucks.
// We'd like to put this into a text file parhaps that's easily editable. // We'd like to put this into a text file parhaps that's easily editable.
// //
@ -1391,7 +1391,7 @@ namespace OpenSim.Framework.Servers.HttpServer
// m_log.DebugFormat( // m_log.DebugFormat(
// "[BASE HTTP HANDLER]: TryGetHTTPHandlerPathBased() looking for HTTP handler to match {0}", searchquery); // "[BASE HTTP HANDLER]: TryGetHTTPHandlerPathBased() looking for HTTP handler to match {0}", searchquery);
lock (m_HTTPHandlers) lock (m_HTTPHandlers)
{ {
foreach (string pattern in m_HTTPHandlers.Keys) foreach (string pattern in m_HTTPHandlers.Keys)
@ -1452,7 +1452,7 @@ namespace OpenSim.Framework.Servers.HttpServer
//Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this
//and should check for NullReferenceExceptions //and should check for NullReferenceExceptions
if (string.IsNullOrEmpty(contentType)) if (string.IsNullOrEmpty(contentType))
{ {
contentType = "text/html"; contentType = "text/html";
@ -1472,8 +1472,8 @@ namespace OpenSim.Framework.Servers.HttpServer
byte[] buffer; byte[] buffer;
if (!(contentType.Contains("image") if (!(contentType.Contains("image")
|| contentType.Contains("x-shockwave-flash") || contentType.Contains("x-shockwave-flash")
|| contentType.Contains("application/x-oar"))) || contentType.Contains("application/x-oar")))
{ {
// Text // Text
@ -1504,7 +1504,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
response.OutputStream.Flush(); response.OutputStream.Flush();
response.Send(); response.Send();
//if (!response.KeepAlive && response.ReuseContext) //if (!response.KeepAlive && response.ReuseContext)
// response.FreeContext(); // response.FreeContext();
} }
@ -1611,11 +1611,11 @@ namespace OpenSim.Framework.Servers.HttpServer
m_httpListener2 = CoolHTTPListener.Create(m_listenIPAddress, (int)m_port); m_httpListener2 = CoolHTTPListener.Create(m_listenIPAddress, (int)m_port);
m_httpListener2.ExceptionThrown += httpServerException; m_httpListener2.ExceptionThrown += httpServerException;
m_httpListener2.LogWriter = httpserverlog; m_httpListener2.LogWriter = httpserverlog;
// Uncomment this line in addition to those in HttpServerLogWriter // Uncomment this line in addition to those in HttpServerLogWriter
// if you want more detailed trace information from the HttpServer // if you want more detailed trace information from the HttpServer
//m_httpListener2.UseTraceLogs = true; //m_httpListener2.UseTraceLogs = true;
//m_httpListener2.DisconnectHandler = httpServerDisconnectMonitor; //m_httpListener2.DisconnectHandler = httpServerDisconnectMonitor;
} }
else else
@ -1643,8 +1643,8 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
m_log.Error("[BASE HTTP SERVER]: Error - " + e.Message); m_log.Error("[BASE HTTP SERVER]: Error - " + e.Message);
m_log.Error("[BASE HTTP SERVER]: Tip: Do you have permission to listen on port " + m_port + ", " + m_sslport + "?"); m_log.Error("[BASE HTTP SERVER]: Tip: Do you have permission to listen on port " + m_port + ", " + m_sslport + "?");
// We want this exception to halt the entire server since in current configurations we aren't too // We want this exception to halt the entire server since in current configurations we aren't too
// useful without inbound HTTP. // useful without inbound HTTP.
throw e; throw e;
} }
@ -1656,7 +1656,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
case SocketError.NotSocket: case SocketError.NotSocket:
NotSocketErrors++; NotSocketErrors++;
break; break;
} }
} }
@ -1686,12 +1686,11 @@ namespace OpenSim.Framework.Servers.HttpServer
m_httpListener2.LogWriter = null; m_httpListener2.LogWriter = null;
m_httpListener2.RequestReceived -= OnRequest; m_httpListener2.RequestReceived -= OnRequest;
m_httpListener2.Stop(); m_httpListener2.Stop();
} }
catch (NullReferenceException) catch (NullReferenceException)
{ {
m_log.Warn("[BASE HTTP SERVER]: Null Reference when stopping HttpServer."); m_log.Warn("[BASE HTTP SERVER]: Null Reference when stopping HttpServer.");
} }
} }
public void RemoveStreamHandler(string httpMethod, string path) public void RemoveStreamHandler(string httpMethod, string path)
@ -1712,7 +1711,7 @@ namespace OpenSim.Framework.Servers.HttpServer
m_HTTPHandlers.Remove(path); m_HTTPHandlers.Remove(path);
return; return;
} }
m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path)); m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path));
} }
} }
@ -1728,7 +1727,6 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
RemoveHTTPHandler(httpMethod, path); RemoveHTTPHandler(httpMethod, path);
} }
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
@ -1759,7 +1757,6 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
} }
public bool RemoveLLSDHandler(string path, LLSDMethod handler) public bool RemoveLLSDHandler(string path, LLSDMethod handler)
{ {
try try
@ -1833,7 +1830,7 @@ namespace OpenSim.Framework.Servers.HttpServer
oresp = osresp; oresp = osresp;
} }
} }
/// <summary> /// <summary>
/// Relays HttpServer log messages to our own logging mechanism. /// Relays HttpServer log messages to our own logging mechanism.
/// </summary> /// </summary>
@ -1852,7 +1849,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
case LogPrio.Trace: case LogPrio.Trace:
m_log.DebugFormat("[{0}]: {1}", source, message); m_log.DebugFormat("[{0}]: {1}", source, message);
break; break;
case LogPrio.Debug: case LogPrio.Debug:
m_log.DebugFormat("[{0}]: {1}", source, message); m_log.DebugFormat("[{0}]: {1}", source, message);
break; break;
@ -1872,8 +1869,8 @@ namespace OpenSim.Framework.Servers.HttpServer
break; break;
} }
*/ */
return; return;
} }
} }
} }

View File

@ -49,7 +49,7 @@ namespace OpenSim
public static string GetVersionString(string versionNumber, Flavour flavour) public static string GetVersionString(string versionNumber, Flavour flavour)
{ {
string versionString = "OpenSim " + versionNumber + " (" + flavour + ")"; string versionString = "OpenSim " + versionNumber + " " + flavour;
return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); return versionString.PadRight(VERSIONINFO_VERSION_LENGTH);
} }

View File

@ -348,15 +348,15 @@ namespace OpenSim.Framework
/// <param name="partID">The new part ID to which this item belongs</param> /// <param name="partID">The new part ID to which this item belongs</param>
public void ResetIDs(UUID partID) public void ResetIDs(UUID partID)
{ {
_oldID = _itemID; OldItemID = ItemID;
_itemID = UUID.Random(); ItemID = UUID.Random();
_parentPartID = partID; ParentPartID = partID;
_parentID = partID; ParentID = partID;
} }
public TaskInventoryItem() public TaskInventoryItem()
{ {
_creationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
} }
} }
} }

View File

@ -225,7 +225,7 @@ namespace OpenSim
} }
} }
MainConsole.Instance = null; MainConsole.Instance = null;
} }
*/ */
configSource.Alias.AddAlias("On", true); configSource.Alias.AddAlias("On", true);
configSource.Alias.AddAlias("Off", false); configSource.Alias.AddAlias("Off", false);

View File

@ -345,10 +345,6 @@ namespace OpenSim
m_configSettings.StorageDll = startupConfig.GetString("storage_plugin"); m_configSettings.StorageDll = startupConfig.GetString("storage_plugin");
m_configSettings.StorageConnectionString
= startupConfig.GetString("storage_connection_string");
m_configSettings.EstateConnectionString
= startupConfig.GetString("estate_connection_string", m_configSettings.StorageConnectionString);
m_configSettings.ClientstackDll m_configSettings.ClientstackDll
= startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
} }

View File

@ -152,7 +152,7 @@ namespace OpenSim
RegisterConsoleCommands(); RegisterConsoleCommands();
base.StartupSpecific(); base.StartupSpecific();
MainServer.Instance.AddStreamHandler(new OpenSim.SimStatusHandler()); MainServer.Instance.AddStreamHandler(new OpenSim.SimStatusHandler());
MainServer.Instance.AddStreamHandler(new OpenSim.XSimStatusHandler(this)); MainServer.Instance.AddStreamHandler(new OpenSim.XSimStatusHandler(this));
if (userStatsURI != String.Empty) if (userStatsURI != String.Empty)
@ -192,7 +192,7 @@ namespace OpenSim
// Hook up to the watchdog timer // Hook up to the watchdog timer
Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler; Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler;
PrintFileToConsole("startuplogo.txt"); PrintFileToConsole("startuplogo.txt");
// For now, start at the 'root' level by default // For now, start at the 'root' level by default
if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
@ -218,8 +218,8 @@ namespace OpenSim
m_console.Commands.AddCommand("region", false, "debug packet", m_console.Commands.AddCommand("region", false, "debug packet",
"debug packet <level>", "debug packet <level>",
"Turn on packet debugging", "Turn on packet debugging",
"If level > 255 then all incoming and outgoing packets are logged.\n" "If level > 255 then all incoming and outgoing packets are logged.\n"
+ "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n"
+ "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n"
+ "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n"
@ -316,7 +316,7 @@ namespace OpenSim
m_console.Commands.AddCommand("region", false, "create region", m_console.Commands.AddCommand("region", false, "create region",
"create region [\"region name\"] <region_file.ini>", "create region [\"region name\"] <region_file.ini>",
"Create a new region.", "Create a new region.",
"The settings for \"region name\" are read from <region_file.ini>." "The settings for \"region name\" are read from <region_file.ini> in your Regions directory."
+ " If \"region name\" does not exist in <region_file.ini>, it will be added." + Environment.NewLine + " If \"region name\" does not exist in <region_file.ini>, it will be added." + Environment.NewLine
+ "Without \"region name\", the first region found in <region_file.ini> will be created." + Environment.NewLine + "Without \"region name\", the first region found in <region_file.ini> will be created." + Environment.NewLine
+ "If <region_file.ini> does not exist, it will be created.", + "If <region_file.ini> does not exist, it will be created.",
@ -552,19 +552,20 @@ namespace OpenSim
regionFile = Path.Combine(regionsDir, regionFile); regionFile = Path.Combine(regionsDir, regionFile);
} }
RegionInfo regInfo; RegionInfo regInfo;
if (isXml) if (isXml)
{ {
regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source); regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source);
} }
else else
{ {
regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName); regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName);
} }
IScene scene; IScene scene;
PopulateRegionEstateInfo(regInfo); PopulateRegionEstateInfo(regInfo);
CreateRegion(regInfo, true, out scene); CreateRegion(regInfo, true, out scene);
regInfo.EstateSettings.Save(); regInfo.EstateSettings.Save();
} }
/// <summary> /// <summary>
@ -942,7 +943,7 @@ namespace OpenSim
delegate(Scene scene) delegate(Scene scene)
{ {
MainConsole.Instance.Output(String.Format( MainConsole.Instance.Output(String.Format(
"Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}", "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}",
scene.RegionInfo.RegionName, scene.RegionInfo.RegionName,
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocX,
scene.RegionInfo.RegionLocY, scene.RegionInfo.RegionLocY,

View File

@ -45,6 +45,7 @@ using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
using OpenSim.Server.Base;
namespace OpenSim namespace OpenSim
{ {
@ -195,6 +196,24 @@ namespace OpenSim
m_permsModules = new List<string>(permissionModules.Split(',')); m_permsModules = new List<string>(permissionModules.Split(','));
} }
// Load the simulation data service
IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"];
if (simDataConfig == null)
throw new Exception("Configuration file is missing the [SimulationDataStore] section");
string module = simDataConfig.GetString("LocalServiceModule", String.Empty);
if (String.IsNullOrEmpty(module))
throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section");
m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { m_config.Source });
// Load the estate data service
IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"];
if (estateDataConfig == null)
throw new Exception("Configuration file is missing the [EstateDataStore] section");
module = estateDataConfig.GetString("LocalServiceModule", String.Empty);
if (String.IsNullOrEmpty(module))
throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section");
m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { m_config.Source });
base.StartupSpecific(); base.StartupSpecific();
m_stats = StatsManager.StartCollectingSimExtraStats(); m_stats = StatsManager.StartCollectingSimExtraStats();
@ -612,7 +631,7 @@ namespace OpenSim
regionInfo.InternalEndPoint.Port = (int) port; regionInfo.InternalEndPoint.Port = (int) port;
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager);
if (m_autoCreateClientStack) if (m_autoCreateClientStack)
{ {
@ -628,30 +647,19 @@ namespace OpenSim
return scene; return scene;
} }
protected override StorageManager CreateStorageManager()
{
return
CreateStorageManager(m_configSettings.StorageConnectionString, m_configSettings.EstateConnectionString);
}
protected StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring)
{
return new StorageManager(m_configSettings.StorageDll, connectionstring, estateconnectionstring);
}
protected override ClientStackManager CreateClientStackManager() protected override ClientStackManager CreateClientStackManager()
{ {
return new ClientStackManager(m_configSettings.ClientstackDll); return new ClientStackManager(m_configSettings.ClientstackDll);
} }
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService,
AgentCircuitManager circuitManager) IEstateDataService estateDataService, AgentCircuitManager circuitManager)
{ {
SceneCommunicationService sceneGridService = new SceneCommunicationService(); SceneCommunicationService sceneGridService = new SceneCommunicationService();
return new Scene( return new Scene(
regionInfo, circuitManager, sceneGridService, regionInfo, circuitManager, sceneGridService,
storageManager, m_moduleLoader, false, m_configSettings.PhysicalPrim, simDataService, estateDataService, m_moduleLoader, false, m_configSettings.PhysicalPrim,
m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
} }
@ -868,21 +876,23 @@ namespace OpenSim
/// </param> /// </param>
public void PopulateRegionEstateInfo(RegionInfo regInfo) public void PopulateRegionEstateInfo(RegionInfo regInfo)
{ {
if (m_storageManager.EstateDataStore != null) IEstateDataService estateDataService = EstateDataService;
if (estateDataService != null)
{ {
regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, false); regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, false);
} }
if (regInfo.EstateSettings.EstateID == 0) // No record at all if (regInfo.EstateSettings.EstateID == 0) // No record at all
{ {
MainConsole.Instance.Output("Your region is not part of an estate."); MainConsole.Instance.Output("Your region is not part of an estate.");
while (true) while (true)
{ {
string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() {"yes", "no"}); string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() { "yes", "no" });
if (response == "no") if (response == "no")
{ {
// Create a new estate // Create a new estate
regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, true); regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true);
regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
//regInfo.EstateSettings.Save(); //regInfo.EstateSettings.Save();
@ -894,7 +904,7 @@ namespace OpenSim
if (response == "None") if (response == "None")
continue; continue;
List<int> estateIDs = m_storageManager.EstateDataStore.GetEstates(response); List<int> estateIDs = estateDataService.GetEstates(response);
if (estateIDs.Count < 1) if (estateIDs.Count < 1)
{ {
MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again");
@ -903,9 +913,9 @@ namespace OpenSim
int estateID = estateIDs[0]; int estateID = estateIDs[0];
regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID); regInfo.EstateSettings = estateDataService.LoadEstateSettings(estateID);
if (m_storageManager.EstateDataStore.LinkRegion(regInfo.RegionID, estateID)) if (estateDataService.LinkRegion(regInfo.RegionID, estateID))
break; break;
MainConsole.Instance.Output("Joining the estate failed. Please try again."); MainConsole.Instance.Output("Joining the estate failed. Please try again.");

View File

@ -63,7 +63,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details. /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details.
/// </value> /// </value>
protected int m_debugPacketLevel = 0; protected int m_debugPacketLevel = 0;
#region Events #region Events
public event GenericMessage OnGenericMessage; public event GenericMessage OnGenericMessage;
@ -288,7 +288,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event MuteListEntryRemove OnRemoveMuteListEntry; public event MuteListEntryRemove OnRemoveMuteListEntry;
public event GodlikeMessage onGodlikeMessage; public event GodlikeMessage onGodlikeMessage;
public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
#endregion Events #endregion Events
@ -330,12 +329,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// ownerless phantom. /// ownerless phantom.
/// ///
/// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
/// ///
/// </value> /// </value>
protected HashSet<uint> m_killRecord; protected HashSet<uint> m_killRecord;
// protected HashSet<uint> m_attachmentsSent; // protected HashSet<uint> m_attachmentsSent;
private int m_moneyBalance; private int m_moneyBalance;
private bool m_deliverPackets = true; private bool m_deliverPackets = true;
private int m_animationSequenceNumber = 1; private int m_animationSequenceNumber = 1;
@ -395,22 +394,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public string ActiveGroupName { get { return m_activeGroupName; } } public string ActiveGroupName { get { return m_activeGroupName; } }
public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
/// <summary> /// <summary>
/// First name of the agent/avatar represented by the client /// First name of the agent/avatar represented by the client
/// </summary> /// </summary>
public string FirstName { get { return m_firstName; } } public string FirstName { get { return m_firstName; } }
/// <summary> /// <summary>
/// Last name of the agent/avatar represented by the client /// Last name of the agent/avatar represented by the client
/// </summary> /// </summary>
public string LastName { get { return m_lastName; } } public string LastName { get { return m_lastName; } }
/// <summary> /// <summary>
/// Full name of the client (first name and last name) /// Full name of the client (first name and last name)
/// </summary> /// </summary>
public string Name { get { return FirstName + " " + LastName; } } public string Name { get { return FirstName + " " + LastName; } }
public uint CircuitCode { get { return m_circuitCode; } } public uint CircuitCode { get { return m_circuitCode; } }
public int MoneyBalance { get { return m_moneyBalance; } } public int MoneyBalance { get { return m_moneyBalance; } }
public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } }
@ -453,7 +452,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); m_entityUpdates = new PriorityQueue(m_scene.Entities.Count);
m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
m_killRecord = new HashSet<uint>(); m_killRecord = new HashSet<uint>();
// m_attachmentsSent = new HashSet<uint>(); // m_attachmentsSent = new HashSet<uint>();
m_assetService = m_scene.RequestModuleInterface<IAssetService>(); m_assetService = m_scene.RequestModuleInterface<IAssetService>();
m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
@ -679,7 +678,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Make sure that we see any exception caused by the asynchronous operation. // Make sure that we see any exception caused by the asynchronous operation.
m_log.Error( m_log.Error(
string.Format("[LLCLIENTVIEW]: Caught exception while processing {0}", packetObject.Pack), e); string.Format("[LLCLIENTVIEW]: Caught exception while processing {0}", packetObject.Pack), e);
} }
} }
#endregion Packet Handling #endregion Packet Handling
@ -890,7 +889,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
foreach (GroupActiveProposals Proposal in Proposals) foreach (GroupActiveProposals Proposal in Proposals)
{ {
GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket();
GAPIRP.AgentData.AgentID = AgentId; GAPIRP.AgentData.AgentID = AgentId;
GAPIRP.AgentData.GroupID = groupID; GAPIRP.AgentData.GroupID = groupID;
GAPIRP.TransactionData.TransactionID = transactionID; GAPIRP.TransactionData.TransactionID = transactionID;
@ -914,7 +913,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (Proposals.Length == 0) if (Proposals.Length == 0)
{ {
GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket();
GAPIRP.AgentData.AgentID = AgentId; GAPIRP.AgentData.AgentID = AgentId;
GAPIRP.AgentData.GroupID = groupID; GAPIRP.AgentData.GroupID = groupID;
GAPIRP.TransactionData.TransactionID = transactionID; GAPIRP.TransactionData.TransactionID = transactionID;
@ -969,7 +968,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (Votes.Length == 0) if (Votes.Length == 0)
{ {
GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket(); GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket();
GVHIRP.AgentData.AgentID = AgentId; GVHIRP.AgentData.AgentID = AgentId;
GVHIRP.AgentData.GroupID = groupID; GVHIRP.AgentData.GroupID = groupID;
GVHIRP.TransactionData.TransactionID = transactionID; GVHIRP.TransactionData.TransactionID = transactionID;
@ -993,7 +992,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(GVHIRP, ThrottleOutPacketType.Task); OutPacket(GVHIRP, ThrottleOutPacketType.Task);
} }
} }
public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt) public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
{ {
GroupAccountDetailsReplyPacket GADRP = new GroupAccountDetailsReplyPacket(); GroupAccountDetailsReplyPacket GADRP = new GroupAccountDetailsReplyPacket();
@ -1012,13 +1011,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
GADRP.HistoryData[0] = History; GADRP.HistoryData[0] = History;
OutPacket(GADRP, ThrottleOutPacketType.Task); OutPacket(GADRP, ThrottleOutPacketType.Task);
} }
public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier) public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier)
{ {
GroupAccountSummaryReplyPacket GASRP = GroupAccountSummaryReplyPacket GASRP =
(GroupAccountSummaryReplyPacket)PacketPool.Instance.GetPacket( (GroupAccountSummaryReplyPacket)PacketPool.Instance.GetPacket(
PacketType.GroupAccountSummaryReply); PacketType.GroupAccountSummaryReply);
GASRP.AgentData = new GroupAccountSummaryReplyPacket.AgentDataBlock(); GASRP.AgentData = new GroupAccountSummaryReplyPacket.AgentDataBlock();
GASRP.AgentData.AgentID = sender.AgentId; GASRP.AgentData.AgentID = sender.AgentId;
GASRP.AgentData.GroupID = groupID; GASRP.AgentData.GroupID = groupID;
@ -1045,13 +1044,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
GASRP.MoneyData.LightTaxEstimate = 0; GASRP.MoneyData.LightTaxEstimate = 0;
OutPacket(GASRP, ThrottleOutPacketType.Task); OutPacket(GASRP, ThrottleOutPacketType.Task);
} }
public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt) public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
{ {
GroupAccountTransactionsReplyPacket GATRP = GroupAccountTransactionsReplyPacket GATRP =
(GroupAccountTransactionsReplyPacket)PacketPool.Instance.GetPacket( (GroupAccountTransactionsReplyPacket)PacketPool.Instance.GetPacket(
PacketType.GroupAccountTransactionsReply); PacketType.GroupAccountTransactionsReply);
GATRP.AgentData = new GroupAccountTransactionsReplyPacket.AgentDataBlock(); GATRP.AgentData = new GroupAccountTransactionsReplyPacket.AgentDataBlock();
GATRP.AgentData.AgentID = sender.AgentId; GATRP.AgentData.AgentID = sender.AgentId;
GATRP.AgentData.GroupID = groupID; GATRP.AgentData.GroupID = groupID;
@ -1520,7 +1519,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendKillObject(ulong regionHandle, uint localID) public void SendKillObject(ulong regionHandle, uint localID)
{ {
// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle);
KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject);
// TODO: don't create new blocks if recycling an old packet // TODO: don't create new blocks if recycling an old packet
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
@ -3488,9 +3487,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence); objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
OutPacket(objupdate, ThrottleOutPacketType.Task); OutPacket(objupdate, ThrottleOutPacketType.Task);
// We need to record the avatar local id since the root prim of an attachment points to this. // We need to record the avatar local id since the root prim of an attachment points to this.
// m_attachmentsSent.Add(avatar.LocalId); // m_attachmentsSent.Add(avatar.LocalId);
} }
public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations)
@ -3538,7 +3537,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Primitive Packet/Data Sending Methods #region Primitive Packet/Data Sending Methods
/// <summary> /// <summary>
/// Generate one of the object update packets based on PrimUpdateFlags /// Generate one of the object update packets based on PrimUpdateFlags
/// and broadcast the packet to clients /// and broadcast the packet to clients
/// </summary> /// </summary>
public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
@ -3555,14 +3554,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
double priority = m_prioritizer.GetUpdatePriority(this, entity); double priority = m_prioritizer.GetUpdatePriority(this, entity);
lock (m_entityUpdates.SyncRoot) lock (m_entityUpdates.SyncRoot)
m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId); m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId);
} }
private void ProcessEntityUpdates(int maxUpdates) private void ProcessEntityUpdates(int maxUpdates)
{ {
Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>();
Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
int updatesThisCall = 0; int updatesThisCall = 0;
@ -3660,28 +3659,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// string text = sop.Text; // string text = sop.Text;
// if (text.IndexOf("\n") >= 0) // if (text.IndexOf("\n") >= 0)
// text = text.Remove(text.IndexOf("\n")); // text = text.Remove(text.IndexOf("\n"));
// //
// if (m_attachmentsSent.Contains(sop.ParentID)) // if (m_attachmentsSent.Contains(sop.ParentID))
// { // {
//// m_log.DebugFormat( //// m_log.DebugFormat(
//// "[CLIENT]: Sending full info about attached prim {0} text {1}", //// "[CLIENT]: Sending full info about attached prim {0} text {1}",
//// sop.LocalId, text); //// sop.LocalId, text);
// //
// objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId)); // objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId));
// //
// m_attachmentsSent.Add(sop.LocalId); // m_attachmentsSent.Add(sop.LocalId);
// } // }
// else // else
// { // {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", // "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet",
// sop.LocalId, text, sop.ParentID); // sop.LocalId, text, sop.ParentID);
// //
// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId); // m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId);
// } // }
// } // }
// else // else
// { // {
objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
// } // }
} }
@ -3995,7 +3994,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_propertiesPacketTimer.Stop(); m_propertiesPacketTimer.Stop();
return; return;
} }
m_propertiesPacketTimer.Stop(); m_propertiesPacketTimer.Stop();
m_propertiesPacketTimer.Start(); m_propertiesPacketTimer.Start();
} }
@ -4229,7 +4228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
{ {
ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage();
updateMessage.AABBMax = landData.AABBMax; updateMessage.AABBMax = landData.AABBMax;
updateMessage.AABBMin = landData.AABBMin; updateMessage.AABBMin = landData.AABBMin;
@ -4273,7 +4272,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updateMessage.PassHours = landData.PassHours; updateMessage.PassHours = landData.PassHours;
updateMessage.PassPrice = landData.PassPrice; updateMessage.PassPrice = landData.PassPrice;
updateMessage.PublicCount = 0; //TODO: Unimplemented updateMessage.PublicCount = 0; //TODO: Unimplemented
updateMessage.RegionPushOverride = (regionFlags & (uint)RegionFlags.RestrictPushObject) > 0; updateMessage.RegionPushOverride = (regionFlags & (uint)RegionFlags.RestrictPushObject) > 0;
updateMessage.RegionDenyAnonymous = (regionFlags & (uint)RegionFlags.DenyAnonymous) > 0; updateMessage.RegionDenyAnonymous = (regionFlags & (uint)RegionFlags.DenyAnonymous) > 0;
@ -4303,13 +4302,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updateMessage.UserLocation = landData.UserLocation; updateMessage.UserLocation = landData.UserLocation;
updateMessage.UserLookAt = landData.UserLookAt; updateMessage.UserLookAt = landData.UserLookAt;
updateMessage.MediaType = landData.MediaType; updateMessage.MediaType = landData.MediaType;
updateMessage.MediaDesc = landData.MediaDescription; updateMessage.MediaDesc = landData.MediaDescription;
updateMessage.MediaWidth = landData.MediaWidth; updateMessage.MediaWidth = landData.MediaWidth;
updateMessage.MediaHeight = landData.MediaHeight; updateMessage.MediaHeight = landData.MediaHeight;
updateMessage.MediaLoop = landData.MediaLoop; updateMessage.MediaLoop = landData.MediaLoop;
updateMessage.ObscureMusic = landData.ObscureMusic; updateMessage.ObscureMusic = landData.ObscureMusic;
updateMessage.ObscureMedia = landData.ObscureMedia; updateMessage.ObscureMedia = landData.ObscureMedia;
try try
{ {
@ -4318,8 +4317,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
eq.ParcelProperties(updateMessage, this.AgentId); eq.ParcelProperties(updateMessage, this.AgentId);
} else { } else {
m_log.Warn("No EQ Interface when sending parcel data."); m_log.Warn("No EQ Interface when sending parcel data.");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -4692,9 +4691,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
// m_log.DebugFormat( // m_log.DebugFormat(
// "[LLCLIENTVIEW]: Constructing client update for part {0} {1} with flags {2}, localId {3}", // "[LLCLIENTVIEW]: Constructing client update for part {0} {1} with flags {2}, localId {3}",
// data.Name, update.FullID, flags, update.ID); // data.Name, update.FullID, flags, update.ID);
update.UpdateFlags = (uint)flags; update.UpdateFlags = (uint)flags;
#endregion PrimFlags #endregion PrimFlags
@ -4827,11 +4826,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale); AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale);
AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation); AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation);
AddLocalPacketHandler(PacketType.ObjectFlagUpdate, HandleObjectFlagUpdate); AddLocalPacketHandler(PacketType.ObjectFlagUpdate, HandleObjectFlagUpdate);
// Handle ObjectImage (TextureEntry) updates synchronously, since when updating multiple prim faces at once, // Handle ObjectImage (TextureEntry) updates synchronously, since when updating multiple prim faces at once,
// some clients will send out a separate ObjectImage packet for each face // some clients will send out a separate ObjectImage packet for each face
AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage, false); AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage, false);
AddLocalPacketHandler(PacketType.ObjectGrab, HandleObjectGrab, false); AddLocalPacketHandler(PacketType.ObjectGrab, HandleObjectGrab, false);
AddLocalPacketHandler(PacketType.ObjectGrabUpdate, HandleObjectGrabUpdate, false); AddLocalPacketHandler(PacketType.ObjectGrabUpdate, HandleObjectGrabUpdate, false);
AddLocalPacketHandler(PacketType.ObjectDeGrab, HandleObjectDeGrab); AddLocalPacketHandler(PacketType.ObjectDeGrab, HandleObjectDeGrab);
@ -5088,12 +5087,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return false; return false;
} }
private bool HandleParcelGodMarkAsContent(IClientAPI client, Packet Packet) private bool HandleParcelGodMarkAsContent(IClientAPI client, Packet Packet)
{ {
ParcelGodMarkAsContentPacket ParcelGodMarkAsContent = ParcelGodMarkAsContentPacket ParcelGodMarkAsContent =
(ParcelGodMarkAsContentPacket)Packet; (ParcelGodMarkAsContentPacket)Packet;
ParcelGodMark ParcelGodMarkAsContentHandler = OnParcelGodMark; ParcelGodMark ParcelGodMarkAsContentHandler = OnParcelGodMark;
if (ParcelGodMarkAsContentHandler != null) if (ParcelGodMarkAsContentHandler != null)
{ {
@ -5104,11 +5103,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleFreezeUser(IClientAPI client, Packet Packet) private bool HandleFreezeUser(IClientAPI client, Packet Packet)
{ {
FreezeUserPacket FreezeUser = (FreezeUserPacket)Packet; FreezeUserPacket FreezeUser = (FreezeUserPacket)Packet;
FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUser; FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUser;
if (FreezeUserHandler != null) if (FreezeUserHandler != null)
{ {
@ -5120,12 +5119,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleEjectUser(IClientAPI client, Packet Packet) private bool HandleEjectUser(IClientAPI client, Packet Packet)
{ {
EjectUserPacket EjectUser = EjectUserPacket EjectUser =
(EjectUserPacket)Packet; (EjectUserPacket)Packet;
EjectUserUpdate EjectUserHandler = OnParcelEjectUser; EjectUserUpdate EjectUserHandler = OnParcelEjectUser;
if (EjectUserHandler != null) if (EjectUserHandler != null)
{ {
@ -5137,12 +5136,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleParcelBuyPass(IClientAPI client, Packet Packet) private bool HandleParcelBuyPass(IClientAPI client, Packet Packet)
{ {
ParcelBuyPassPacket ParcelBuyPass = ParcelBuyPassPacket ParcelBuyPass =
(ParcelBuyPassPacket)Packet; (ParcelBuyPassPacket)Packet;
ParcelBuyPass ParcelBuyPassHandler = OnParcelBuyPass; ParcelBuyPass ParcelBuyPassHandler = OnParcelBuyPass;
if (ParcelBuyPassHandler != null) if (ParcelBuyPassHandler != null)
{ {
@ -5153,7 +5152,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleParcelBuyRequest(IClientAPI sender, Packet Pack) private bool HandleParcelBuyRequest(IClientAPI sender, Packet Pack)
{ {
ParcelBuyPacket parcel = (ParcelBuyPacket)Pack; ParcelBuyPacket parcel = (ParcelBuyPacket)Pack;
@ -5375,7 +5374,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
//m_log.DebugFormat("[CLIENT]: Received ScriptDialogReply from {0}", rdialog.Data.ObjectID); //m_log.DebugFormat("[CLIENT]: Received ScriptDialogReply from {0}", rdialog.Data.ObjectID);
#region Packet Session and User Check #region Packet Session and User Check
if (m_checkPackets) if (m_checkPackets)
{ {
@ -5521,12 +5520,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return true; return true;
} }
private bool HandleFindAgent(IClientAPI client, Packet Packet) private bool HandleFindAgent(IClientAPI client, Packet Packet)
{ {
FindAgentPacket FindAgent = FindAgentPacket FindAgent =
(FindAgentPacket)Packet; (FindAgentPacket)Packet;
FindAgentUpdate FindAgentHandler = OnFindAgent; FindAgentUpdate FindAgentHandler = OnFindAgent;
if (FindAgentHandler != null) if (FindAgentHandler != null)
{ {
@ -5535,12 +5534,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleTrackAgent(IClientAPI client, Packet Packet) private bool HandleTrackAgent(IClientAPI client, Packet Packet)
{ {
TrackAgentPacket TrackAgent = TrackAgentPacket TrackAgent =
(TrackAgentPacket)Packet; (TrackAgentPacket)Packet;
TrackAgentUpdate TrackAgentHandler = OnTrackAgent; TrackAgentUpdate TrackAgentHandler = OnTrackAgent;
if (TrackAgentHandler != null) if (TrackAgentHandler != null)
{ {
@ -5551,7 +5550,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandlerRezObject(IClientAPI sender, Packet Pack) private bool HandlerRezObject(IClientAPI sender, Packet Pack)
{ {
RezObjectPacket rezPacket = (RezObjectPacket)Pack; RezObjectPacket rezPacket = (RezObjectPacket)Pack;
@ -7207,19 +7206,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
UUID requestID = new UUID(transfer.TransferInfo.Params, 80); UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
// m_log.DebugFormat( // m_log.DebugFormat(
// "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}", // "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}",
// requestID, itemID, taskID, Name); // requestID, itemID, taskID, Name);
if (!(((Scene)m_scene).Permissions.BypassPermissions())) if (!(((Scene)m_scene).Permissions.BypassPermissions()))
{ {
if (taskID != UUID.Zero) // Prim if (taskID != UUID.Zero) // Prim
{ {
SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID); SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID);
if (part == null) if (part == null)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist", "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist",
Name, requestID, itemID, taskID); Name, requestID, itemID, taskID);
return true; return true;
} }
@ -7228,11 +7227,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (tii == null) if (tii == null)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist", "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist",
Name, requestID, itemID, taskID); Name, requestID, itemID, taskID);
return true; return true;
} }
if (tii.Type == (int)AssetType.LSLText) if (tii.Type == (int)AssetType.LSLText)
{ {
if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId)) if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId))
@ -7251,41 +7250,41 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}", "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}",
Name, requestID, itemID, taskID, part.OwnerID); Name, requestID, itemID, taskID, part.OwnerID);
return true; return true;
} }
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set", "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set",
Name, requestID, itemID, taskID); Name, requestID, itemID, taskID);
return true; return true;
} }
if (tii.OwnerID != AgentId) if (tii.OwnerID != AgentId)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}", "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}",
Name, requestID, itemID, taskID, tii.OwnerID); Name, requestID, itemID, taskID, tii.OwnerID);
return true; return true;
} }
if (( if ((
tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
!= ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer", "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer",
Name, requestID, itemID, taskID); Name, requestID, itemID, taskID);
return true; return true;
} }
if (tii.AssetID != requestID) if (tii.AssetID != requestID)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}", "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}",
Name, requestID, itemID, taskID, tii.AssetID); Name, requestID, itemID, taskID, tii.AssetID);
return true; return true;
} }
} }
@ -7889,7 +7888,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
newTaskItem, updatetask.UpdateData.LocalID); newTaskItem, updatetask.UpdateData.LocalID);
} }
} }
} }
return true; return true;
} }
@ -8884,7 +8883,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// return true; // return true;
} }
private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack) private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack)
{ {
RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData; RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData;
@ -8905,7 +8904,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return true; return true;
} }
private bool HandleEstateCovenantRequest(IClientAPI sender, Packet Pack) private bool HandleEstateCovenantRequest(IClientAPI sender, Packet Pack)
{ {
@ -8942,7 +8941,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return true; return true;
} }
private bool HandleGodUpdateRegionInfoUpdate(IClientAPI client, Packet Packet) private bool HandleGodUpdateRegionInfoUpdate(IClientAPI client, Packet Packet)
{ {
GodUpdateRegionInfoPacket GodUpdateRegionInfo = GodUpdateRegionInfoPacket GodUpdateRegionInfo =
@ -8962,7 +8961,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleSimWideDeletes(IClientAPI client, Packet Packet) private bool HandleSimWideDeletes(IClientAPI client, Packet Packet)
{ {
SimWideDeletesPacket SimWideDeletesRequest = SimWideDeletesPacket SimWideDeletesRequest =
@ -8975,7 +8974,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleGodlikeMessage(IClientAPI client, Packet Packet) private bool HandleGodlikeMessage(IClientAPI client, Packet Packet)
{ {
GodlikeMessagePacket GodlikeMessage = GodlikeMessagePacket GodlikeMessage =
@ -8992,7 +8991,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleSaveStatePacket(IClientAPI client, Packet Packet) private bool HandleSaveStatePacket(IClientAPI client, Packet Packet)
{ {
StateSavePacket SaveStateMessage = StateSavePacket SaveStateMessage =
@ -9005,7 +9004,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleGodKickUser(IClientAPI sender, Packet Pack) private bool HandleGodKickUser(IClientAPI sender, Packet Pack)
{ {
GodKickUserPacket gkupack = (GodKickUserPacket)Pack; GodKickUserPacket gkupack = (GodKickUserPacket)Pack;
@ -9143,7 +9142,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return true; return true;
} }
#endregion Economy/Transaction Packets #endregion Economy/Transaction Packets
#region Script Packets #region Script Packets
@ -9356,7 +9355,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return true; return true;
} }
private bool HandleUpdateMuteListEntry(IClientAPI client, Packet Packet) private bool HandleUpdateMuteListEntry(IClientAPI client, Packet Packet)
{ {
UpdateMuteListEntryPacket UpdateMuteListEntry = UpdateMuteListEntryPacket UpdateMuteListEntry =
@ -9372,7 +9371,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleRemoveMuteListEntry(IClientAPI client, Packet Packet) private bool HandleRemoveMuteListEntry(IClientAPI client, Packet Packet)
{ {
RemoveMuteListEntryPacket RemoveMuteListEntry = RemoveMuteListEntryPacket RemoveMuteListEntry =
@ -9388,7 +9387,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleUserReport(IClientAPI client, Packet Packet) private bool HandleUserReport(IClientAPI client, Packet Packet)
{ {
UserReportPacket UserReport = UserReportPacket UserReport =
@ -9413,7 +9412,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleSendPostcard(IClientAPI client, Packet packet) private bool HandleSendPostcard(IClientAPI client, Packet packet)
{ {
// SendPostcardPacket SendPostcard = // SendPostcardPacket SendPostcard =
@ -9726,7 +9725,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return true; return true;
} }
private bool HandleGroupVoteHistoryRequest(IClientAPI client, Packet Packet) private bool HandleGroupVoteHistoryRequest(IClientAPI client, Packet Packet)
{ {
GroupVoteHistoryRequestPacket GroupVoteHistoryRequest = GroupVoteHistoryRequestPacket GroupVoteHistoryRequest =
@ -9739,7 +9738,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleGroupActiveProposalsRequest(IClientAPI client, Packet Packet) private bool HandleGroupActiveProposalsRequest(IClientAPI client, Packet Packet)
{ {
GroupActiveProposalsRequestPacket GroupActiveProposalsRequest = GroupActiveProposalsRequestPacket GroupActiveProposalsRequest =
@ -9752,7 +9751,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleGroupAccountDetailsRequest(IClientAPI client, Packet Packet) private bool HandleGroupAccountDetailsRequest(IClientAPI client, Packet Packet)
{ {
GroupAccountDetailsRequestPacket GroupAccountDetailsRequest = GroupAccountDetailsRequestPacket GroupAccountDetailsRequest =
@ -9765,7 +9764,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleGroupAccountSummaryRequest(IClientAPI client, Packet Packet) private bool HandleGroupAccountSummaryRequest(IClientAPI client, Packet Packet)
{ {
GroupAccountSummaryRequestPacket GroupAccountSummaryRequest = GroupAccountSummaryRequestPacket GroupAccountSummaryRequest =
@ -9778,7 +9777,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleGroupTransactionsDetailsRequest(IClientAPI client, Packet Packet) private bool HandleGroupTransactionsDetailsRequest(IClientAPI client, Packet Packet)
{ {
GroupAccountTransactionsRequestPacket GroupAccountTransactionsRequest = GroupAccountTransactionsRequestPacket GroupAccountTransactionsRequest =
@ -9791,7 +9790,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return false; return false;
} }
private bool HandleGroupTitlesRequest(IClientAPI sender, Packet Pack) private bool HandleGroupTitlesRequest(IClientAPI sender, Packet Pack)
{ {
GroupTitlesRequestPacket groupTitlesRequest = GroupTitlesRequestPacket groupTitlesRequest =
@ -11239,26 +11238,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_debugPacketLevel > 0) if (m_debugPacketLevel > 0)
{ {
bool outputPacket = true; bool outputPacket = true;
if (m_debugPacketLevel <= 255 if (m_debugPacketLevel <= 255
&& (packet.Type == PacketType.SimStats || packet.Type == PacketType.SimulatorViewerTimeMessage)) && (packet.Type == PacketType.SimStats || packet.Type == PacketType.SimulatorViewerTimeMessage))
outputPacket = false; outputPacket = false;
if (m_debugPacketLevel <= 200 if (m_debugPacketLevel <= 200
&& && (packet.Type == PacketType.ImagePacket
(packet.Type == PacketType.ImagePacket
|| packet.Type == PacketType.ImageData || packet.Type == PacketType.ImageData
|| packet.Type == PacketType.LayerData || packet.Type == PacketType.LayerData
|| packet.Type == PacketType.CoarseLocationUpdate)) || packet.Type == PacketType.CoarseLocationUpdate))
outputPacket = false; outputPacket = false;
if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.AvatarAnimation || packet.Type == PacketType.ViewerEffect)) if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.AvatarAnimation || packet.Type == PacketType.ViewerEffect))
outputPacket = false; outputPacket = false;
if (outputPacket) if (outputPacket)
m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type); m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type);
} }
m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting);
} }
@ -11348,16 +11346,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_debugPacketLevel > 0) if (m_debugPacketLevel > 0)
{ {
bool outputPacket = true; bool outputPacket = true;
if (m_debugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate) if (m_debugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate)
outputPacket = false; outputPacket = false;
if (m_debugPacketLevel <= 200 && packet.Type == PacketType.RequestImage) if (m_debugPacketLevel <= 200 && packet.Type == PacketType.RequestImage)
outputPacket = false; outputPacket = false;
if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation)) if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation))
outputPacket = false; outputPacket = false;
if (outputPacket) if (outputPacket)
m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type); m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type);
} }
@ -11623,12 +11621,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
UUID requestID = UUID.Zero; UUID requestID = UUID.Zero;
byte source = (byte)SourceType.Asset; byte source = (byte)SourceType.Asset;
if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
{ {
requestID = new UUID(transferRequest.TransferInfo.Params, 0); requestID = new UUID(transferRequest.TransferInfo.Params, 0);
} }
else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
{ {
requestID = new UUID(transferRequest.TransferInfo.Params, 80); requestID = new UUID(transferRequest.TransferInfo.Params, 80);
source = (byte)SourceType.SimInventoryItem; source = (byte)SourceType.SimInventoryItem;
@ -11874,7 +11872,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public PacketMethod method; public PacketMethod method;
public bool Async; public bool Async;
} }
public class AsyncPacketProcess public class AsyncPacketProcess
{ {
public bool result = false; public bool result = false;
@ -11943,8 +11941,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName); dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName);
dialog.Data.LastName = Util.StringToBytes256(ownerLastName); dialog.Data.LastName = Util.StringToBytes256(ownerLastName);
dialog.Data.Message = Util.StringToBytes256(message); dialog.Data.Message = Util.StringToBytes256(message);
ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1]; ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1];
buttons[0] = new ScriptDialogPacket.ButtonsBlock(); buttons[0] = new ScriptDialogPacket.ButtonsBlock();
buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!"); buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!");
@ -11958,7 +11955,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
ScenePresence presence = p as ScenePresence; ScenePresence presence = p as ScenePresence;
// It turns out to get the agent to stop flying, you have to feed it stop flying velocities // It turns out to get the agent to stop flying, you have to feed it stop flying velocities
// There's no explicit message to send the client to tell it to stop flying.. it relies on the // There's no explicit message to send the client to tell it to stop flying.. it relies on the
// velocity, collision plane and avatar height // velocity, collision plane and avatar height
// Add 1/6 the avatar's height to it's position so it doesn't shoot into the air // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air
@ -11975,7 +11972,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// attach a suitable collision plane regardless of the actual situation to force the LLClient to land. // attach a suitable collision plane regardless of the actual situation to force the LLClient to land.
// Collision plane below the avatar's position a 6th of the avatar's height is suitable. // Collision plane below the avatar's position a 6th of the avatar's height is suitable.
// Mind you, that this method doesn't get called if the avatar's velocity magnitude is greater then a // Mind you, that this method doesn't get called if the avatar's velocity magnitude is greater then a
// certain amount.. because the LLClient wouldn't land in that situation anyway. // certain amount.. because the LLClient wouldn't land in that situation anyway.
// why are we still testing for this really old height value default??? // why are we still testing for this really old height value default???

View File

@ -36,6 +36,7 @@ using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework; using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
@ -48,28 +49,16 @@ namespace OpenSim.Region.ClientStack
protected Dictionary<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>(); protected Dictionary<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>();
protected NetworkServersInfo m_networkServersInfo; protected NetworkServersInfo m_networkServersInfo;
public NetworkServersInfo NetServersInfo
{
get { return m_networkServersInfo; }
}
protected uint m_httpServerPort; protected uint m_httpServerPort;
protected ISimulationDataService m_simulationDataService;
protected StorageManager m_storageManager; protected IEstateDataService m_estateDataService;
public StorageManager StorageManager
{
get { return m_storageManager; }
}
protected ClientStackManager m_clientStackManager; protected ClientStackManager m_clientStackManager;
public SceneManager SceneManager
{
get { return m_sceneManager; }
}
protected SceneManager m_sceneManager = new SceneManager(); protected SceneManager m_sceneManager = new SceneManager();
public SceneManager SceneManager { get { return m_sceneManager; } }
public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } }
public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } }
public IEstateDataService EstateDataService { get { return m_estateDataService; } }
protected abstract void Initialize(); protected abstract void Initialize();
@ -83,15 +72,11 @@ namespace OpenSim.Region.ClientStack
/// <returns></returns> /// <returns></returns>
protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier); protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier);
protected abstract StorageManager CreateStorageManager();
protected abstract ClientStackManager CreateClientStackManager(); protected abstract ClientStackManager CreateClientStackManager();
protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager);
AgentCircuitManager circuitManager);
protected override void StartupSpecific() protected override void StartupSpecific()
{ {
m_storageManager = CreateStorageManager();
m_clientStackManager = CreateClientStackManager(); m_clientStackManager = CreateClientStackManager();
Initialize(); Initialize();

View File

@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
protected Scene m_scene = null; protected Scene m_scene = null;
public string Name { get { return "Attachments Module"; } } public string Name { get { return "Attachments Module"; } }
public Type ReplaceableInterface { get { return null; } } public Type ReplaceableInterface { get { return null; } }
public void Initialise(IConfigSource source) {} public void Initialise(IConfigSource source) {}
@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory; client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory;
client.OnObjectAttach += AttachObject; client.OnObjectAttach += AttachObject;
client.OnObjectDetach += DetachObject; client.OnObjectDetach += DetachObject;
client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory; client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory;
} }
public void UnsubscribeFromClientEvents(IClientAPI client) public void UnsubscribeFromClientEvents(IClientAPI client)
@ -90,7 +90,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory; client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory;
client.OnObjectAttach -= AttachObject; client.OnObjectAttach -= AttachObject;
client.OnObjectDetach -= DetachObject; client.OnObjectDetach -= DetachObject;
client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory; client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory;
} }
/// <summary> /// <summary>
@ -174,12 +174,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
UUID itemID = UUID.Zero; UUID itemID = UUID.Zero;
if (sp != null) if (sp != null)
{ {
foreach(SceneObjectGroup grp in sp.GetAttachments(AttachmentPt)) foreach (SceneObjectGroup grp in sp.GetAttachments(AttachmentPt))
{ {
itemID = grp.GetFromItemID(); itemID = grp.GetFromItemID();
if (itemID != UUID.Zero) if (itemID != UUID.Zero)
DetachSingleAttachmentToInv(itemID, remoteClient); DetachSingleAttachmentToInv(itemID, remoteClient);
} }
} }
if (group.GetFromItemID() == UUID.Zero) if (group.GetFromItemID() == UUID.Zero)
@ -232,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public UUID RezSingleAttachmentFromInventory( public UUID RezSingleAttachmentFromInventory(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc)
{ {
SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc);
if (updateInventoryStatus) if (updateInventoryStatus)
@ -248,8 +248,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (null == att) if (null == att)
return UUID.Zero; return UUID.Zero;
else else
return att.UUID; return att.UUID;
} }
protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc)
@ -311,7 +311,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
} }
return null; return null;
} }
public UUID SetAttachmentInventoryStatus( public UUID SetAttachmentInventoryStatus(
SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
@ -456,7 +456,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// We can NOT use the dictionries here, as we are looking // We can NOT use the dictionries here, as we are looking
// for an entity by the fromAssetID, which is NOT the prim UUID // for an entity by the fromAssetID, which is NOT the prim UUID
List<EntityBase> detachEntities = m_scene.GetEntities(); EntityBase[] detachEntities = m_scene.GetEntities();
SceneObjectGroup group; SceneObjectGroup group;
foreach (EntityBase entity in detachEntities) foreach (EntityBase entity in detachEntities)
@ -495,7 +495,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
sog.RootPart.IsAttachment = false; sog.RootPart.IsAttachment = false;
sog.AbsolutePosition = sog.RootPart.AttachedPos; sog.AbsolutePosition = sog.RootPart.AttachedPos;
UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID); UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID);
sog.SetAttachmentPoint(attachmentPoint); sog.SetAttachmentPoint(attachmentPoint);
} }
/// <summary> /// <summary>
@ -622,7 +622,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// In case it is later dropped again, don't let // In case it is later dropped again, don't let
// it get cleaned up // it get cleaned up
so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
so.HasGroupChanged = false; so.HasGroupChanged = false;
} }
} }
} }

View File

@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
try try
{ {
deadAvatar.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true); deadAvatar.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true);
if(killingAvatar != null) if (killingAvatar != null)
killingAvatar.ControllingClient.SendAlertMessage("You fragged " + deadAvatar.Firstname + " " + deadAvatar.Lastname); killingAvatar.ControllingClient.SendAlertMessage("You fragged " + deadAvatar.Firstname + " " + deadAvatar.Lastname);
} }
catch (InvalidOperationException) catch (InvalidOperationException)
@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
} }
private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID)
{ {
try try
{ {
ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);

View File

@ -54,7 +54,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
public UUID PrincipalID; public UUID PrincipalID;
public FriendInfo[] Friends; public FriendInfo[] Friends;
public int Refcount; public int Refcount;
public UUID RegionID;
public bool IsFriend(string friend) public bool IsFriend(string friend)
{ {
@ -68,6 +67,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
} }
} }
private static readonly FriendInfo[] EMPTY_FRIENDS = new FriendInfo[0];
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected List<Scene> m_Scenes = new List<Scene>(); protected List<Scene> m_Scenes = new List<Scene>();
@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected Dictionary<UUID, UserFriendData> m_Friends = protected Dictionary<UUID, UserFriendData> m_Friends =
new Dictionary<UUID, UserFriendData>(); new Dictionary<UUID, UserFriendData>();
protected List<UUID> m_NeedsListOfFriends = new List<UUID>(); protected HashSet<UUID> m_NeedsListOfFriends = new HashSet<UUID>();
protected IPresenceService PresenceService protected IPresenceService PresenceService
{ {
@ -146,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// Instantiate the request handler // Instantiate the request handler
IHttpServer server = MainServer.GetHttpServer((uint)mPort); IHttpServer server = MainServer.GetHttpServer((uint)mPort);
server.AddStreamHandler(new FriendsRequestHandler(this)); server.AddStreamHandler(new FriendsRequestHandler(this));
} }
if (m_FriendsService == null) if (m_FriendsService == null)
@ -173,7 +172,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnClientClosed += OnClientClosed; scene.EventManager.OnClientClosed += OnClientClosed;
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
scene.EventManager.OnClientLogin += OnClientLogin; scene.EventManager.OnClientLogin += OnClientLogin;
} }
@ -198,17 +196,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
public uint GetFriendPerms(UUID principalID, UUID friendID) public uint GetFriendPerms(UUID principalID, UUID friendID)
{ {
if (!m_Friends.ContainsKey(principalID)) FriendInfo[] friends = GetFriends(principalID);
return 0; foreach (FriendInfo fi in friends)
UserFriendData data = m_Friends[principalID];
string searchFor = friendID.ToString();
foreach (FriendInfo fi in data.Friends)
{ {
if (fi.Friend == searchFor) if (fi.Friend == friendID.ToString())
return (uint)fi.TheirFlags; return (uint)fi.TheirFlags;
} }
return 0; return 0;
} }
@ -218,73 +212,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.OnApproveFriendRequest += OnApproveFriendRequest; client.OnApproveFriendRequest += OnApproveFriendRequest;
client.OnDenyFriendRequest += OnDenyFriendRequest; client.OnDenyFriendRequest += OnDenyFriendRequest;
client.OnTerminateFriendship += OnTerminateFriendship; client.OnTerminateFriendship += OnTerminateFriendship;
client.OnGrantUserRights += OnGrantUserRights; client.OnGrantUserRights += OnGrantUserRights;
lock (m_Friends) // Asynchronously fetch the friends list or increment the refcount for the existing
{ // friends list
if (m_Friends.ContainsKey(client.AgentId)) Util.FireAndForget(
delegate(object o)
{ {
m_Friends[client.AgentId].Refcount++; lock (m_Friends)
return; {
UserFriendData friendsData;
if (m_Friends.TryGetValue(client.AgentId, out friendsData))
{
friendsData.Refcount++;
}
else
{
friendsData = new UserFriendData();
friendsData.PrincipalID = client.AgentId;
friendsData.Friends = FriendsService.GetFriends(client.AgentId);
friendsData.Refcount = 1;
m_Friends[client.AgentId] = friendsData;
}
}
} }
);
UserFriendData newFriends = new UserFriendData();
newFriends.PrincipalID = client.AgentId;
newFriends.Friends = m_FriendsService.GetFriends(client.AgentId);
newFriends.Refcount = 1;
newFriends.RegionID = UUID.Zero;
m_Friends.Add(client.AgentId, newFriends);
}
} }
private void OnClientClosed(UUID agentID, Scene scene) private void OnClientClosed(UUID agentID, Scene scene)
{ {
ScenePresence sp = scene.GetScenePresence(agentID); ScenePresence sp = scene.GetScenePresence(agentID);
if (sp != null && !sp.IsChildAgent) if (sp != null && !sp.IsChildAgent)
{
// do this for root agents closing out // do this for root agents closing out
StatusChange(agentID, false); StatusChange(agentID, false);
}
lock (m_Friends) lock (m_Friends)
if (m_Friends.ContainsKey(agentID)) {
UserFriendData friendsData;
if (m_Friends.TryGetValue(agentID, out friendsData))
{ {
if (m_Friends[agentID].Refcount == 1) friendsData.Refcount--;
if (friendsData.Refcount <= 0)
m_Friends.Remove(agentID); m_Friends.Remove(agentID);
else
m_Friends[agentID].Refcount--;
} }
}
} }
private void OnMakeRootAgent(ScenePresence sp) private void OnMakeRootAgent(ScenePresence sp)
{ {
UUID agentID = sp.ControllingClient.AgentId; UUID agentID = sp.ControllingClient.AgentId;
UpdateFriendsCache(agentID);
if (m_Friends.ContainsKey(agentID))
{
// This is probably an overkill, but just
// to make sure we have the latest and greatest
// friends list -- always pull OnMakeRoot
m_Friends[agentID].Friends =
m_FriendsService.GetFriends(agentID);
m_Friends[agentID].RegionID =
sp.ControllingClient.Scene.RegionInfo.RegionID;
}
}
private void OnMakeChildAgent(ScenePresence sp)
{
UUID agentID = sp.ControllingClient.AgentId;
if (m_Friends.ContainsKey(agentID))
{
if (m_Friends[agentID].RegionID == sp.ControllingClient.Scene.RegionInfo.RegionID)
m_Friends[agentID].RegionID = UUID.Zero;
}
} }
private void OnClientLogin(IClientAPI client) private void OnClientLogin(IClientAPI client)
@ -296,75 +276,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// Register that we need to send the list of online friends to this user // Register that we need to send the list of online friends to this user
lock (m_NeedsListOfFriends) lock (m_NeedsListOfFriends)
if (!m_NeedsListOfFriends.Contains(agentID)) m_NeedsListOfFriends.Add(agentID);
{
m_NeedsListOfFriends.Add(agentID);
}
} }
public void SendFriendsOnlineIfNeeded(IClientAPI client) public void SendFriendsOnlineIfNeeded(IClientAPI client)
{ {
UUID agentID = client.AgentId; UUID agentID = client.AgentId;
if (m_NeedsListOfFriends.Contains(agentID))
// Check if the online friends list is needed
lock (m_NeedsListOfFriends)
{ {
if (!m_Friends.ContainsKey(agentID)) if (!m_NeedsListOfFriends.Remove(agentID))
{
m_log.DebugFormat("[FRIENDS MODULE]: agent {0} not found in local cache", agentID);
return; return;
} }
// // Send the friends online
// Send the friends online List<UUID> online = GetOnlineFriends(agentID);
// if (online.Count > 0)
List<UUID> online = GetOnlineFriends(agentID); {
if (online.Count > 0) m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count);
{ client.SendAgentOnline(online.ToArray());
m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count); }
client.SendAgentOnline(online.ToArray());
}
// // Send outstanding friendship offers
// Send outstanding friendship offers List<string> outstanding = new List<string>();
// FriendInfo[] friends = GetFriends(agentID);
if (m_Friends.ContainsKey(agentID)) foreach (FriendInfo fi in friends)
{ {
List<string> outstanding = new List<string>(); if (fi.TheirFlags == -1)
outstanding.Add(fi.Friend);
}
foreach (FriendInfo fi in m_Friends[agentID].Friends) GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, String.Empty, agentID, (byte)InstantMessageDialog.FriendshipOffered,
if (fi.TheirFlags == -1) "Will you be my friend?", true, Vector3.Zero);
outstanding.Add(fi.Friend);
GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, "", agentID, (byte)InstantMessageDialog.FriendshipOffered, "Will you be my friend?", true, Vector3.Zero); foreach (string fid in outstanding)
foreach (string fid in outstanding) {
{ UUID fromAgentID;
try if (!UUID.TryParse(fid, out fromAgentID))
{ continue;
im.fromAgentID = new Guid(fid);
}
catch
{
continue;
}
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID)); UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID);
im.fromAgentName = account.FirstName + " " + account.LastName; PresenceInfo presence = PresenceService.GetAgent(fromAgentID);
PresenceInfo presence = null; im.fromAgentID = fromAgentID.Guid;
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid }); im.fromAgentName = account.FirstName + " " + account.LastName;
if (presences != null && presences.Length > 0) im.offline = (byte)((presence == null) ? 1 : 0);
presence = presences[0]; im.imSessionID = im.fromAgentID;
if (presence != null)
im.offline = 0;
im.imSessionID = im.fromAgentID; // Finally
LocalFriendshipOffered(agentID, im);
// Finally
LocalFriendshipOffered(agentID, im);
}
}
lock (m_NeedsListOfFriends)
m_NeedsListOfFriends.Remove(agentID);
} }
} }
@ -373,44 +334,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
List<string> friendList = new List<string>(); List<string> friendList = new List<string>();
List<UUID> online = new List<UUID>(); List<UUID> online = new List<UUID>();
foreach (FriendInfo fi in m_Friends[userID].Friends) FriendInfo[] friends = GetFriends(userID);
foreach (FriendInfo fi in friends)
{ {
if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1)) if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1))
friendList.Add(fi.Friend); friendList.Add(fi.Friend);
} }
if (friendList.Count == 0) if (friendList.Count > 0)
// no friends whatsoever {
return online; PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
foreach (PresenceInfo pi in presence)
PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); {
UUID presenceID;
foreach (PresenceInfo pi in presence) if (UUID.TryParse(pi.UserID, out presenceID))
online.Add(new UUID(pi.UserID)); online.Add(presenceID);
//m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID); }
}
return online; return online;
} }
// /// <summary>
// Find the client for a ID /// Find the client for a ID
// /// </summary>
public IClientAPI LocateClientObject(UUID agentID) public IClientAPI LocateClientObject(UUID agentID)
{ {
Scene scene = GetClientScene(agentID); Scene scene = GetClientScene(agentID);
if (scene == null) if (scene != null)
return null; {
ScenePresence presence = scene.GetScenePresence(agentID);
if (presence != null)
return presence.ControllingClient;
}
ScenePresence presence = scene.GetScenePresence(agentID); return null;
if (presence == null)
return null;
return presence.ControllingClient;
} }
// /// <summary>
// Find the scene for an agent /// Find the scene for an agent
// /// </summary>
private Scene GetClientScene(UUID agentId) private Scene GetClientScene(UUID agentId)
{ {
lock (m_Scenes) lock (m_Scenes)
@ -418,13 +381,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
foreach (Scene scene in m_Scenes) foreach (Scene scene in m_Scenes)
{ {
ScenePresence presence = scene.GetScenePresence(agentId); ScenePresence presence = scene.GetScenePresence(agentId);
if (presence != null) if (presence != null && !presence.IsChildAgent)
{ return scene;
if (!presence.IsChildAgent)
return scene;
}
} }
} }
return null; return null;
} }
@ -435,35 +396,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
/// <param name="online"></param> /// <param name="online"></param>
private void StatusChange(UUID agentID, bool online) private void StatusChange(UUID agentID, bool online)
{ {
//m_log.DebugFormat("[FRIENDS]: StatusChange {0}", online); FriendInfo[] friends = GetFriends(agentID);
if (m_Friends.ContainsKey(agentID)) if (friends.Length > 0)
{ {
//m_log.DebugFormat("[FRIENDS]: # of friends: {0}", m_Friends[agentID].Friends.Length);
List<FriendInfo> friendList = new List<FriendInfo>(); List<FriendInfo> friendList = new List<FriendInfo>();
foreach (FriendInfo fi in m_Friends[agentID].Friends) foreach (FriendInfo fi in friends)
{ {
if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1)) if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1))
friendList.Add(fi); friendList.Add(fi);
} }
Util.FireAndForget(delegate Util.FireAndForget(
{ delegate
foreach (FriendInfo fi in friendList)
{ {
//m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID); foreach (FriendInfo fi in friendList)
// Notify about this user status {
StatusNotify(fi, agentID, online); //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID);
// Notify about this user status
StatusNotify(fi, agentID, online);
}
} }
}); );
} }
else
m_log.WarnFormat("[FRIENDS]: {0} not found in cache", agentID);
} }
private void StatusNotify(FriendInfo friend, UUID userID, bool online) private void StatusNotify(FriendInfo friend, UUID userID, bool online)
{ {
UUID friendID = UUID.Zero; UUID friendID;
if (UUID.TryParse(friend.Friend, out friendID)) if (UUID.TryParse(friend.Friend, out friendID))
{ {
// Try local // Try local
@ -471,35 +430,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return; return;
// The friend is not here [as root]. Let's forward. // The friend is not here [as root]. Let's forward.
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSessions != null && friendSessions.Length > 0) if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check
{ {
PresenceInfo friendSession = null; GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
foreach (PresenceInfo pinfo in friendSessions) //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
{
friendSession = pinfo;
break;
}
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
//m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
}
} }
// Friend is not online. Ignore.
} }
else else
{
m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend); m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend);
}
} }
private void OnInstantMessage(IClientAPI client, GridInstantMessage im) private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
{ {
if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered) if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered)
{ {
// we got a friendship offer // we got a friendship offer
UUID principalID = new UUID(im.fromAgentID); UUID principalID = new UUID(im.fromAgentID);
UUID friendID = new UUID(im.toAgentID); UUID friendID = new UUID(im.toAgentID);
@ -529,15 +477,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return; return;
// The prospective friend is not here [as root]. Let's forward. // The prospective friend is not here [as root]. Let's forward.
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSessions != null && friendSessions.Length > 0) if (friendSession != null)
{ {
PresenceInfo friendSession = friendSessions[0]; GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
if (friendSession != null) m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
}
} }
// If the prospective friend is not online, he'll get the message upon login. // If the prospective friend is not online, he'll get the message upon login.
} }
@ -548,9 +492,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
FriendsService.StoreFriend(agentID, friendID.ToString(), 1); FriendsService.StoreFriend(agentID, friendID.ToString(), 1);
FriendsService.StoreFriend(friendID, agentID.ToString(), 1); FriendsService.StoreFriend(friendID, agentID.ToString(), 1);
// update the local cache
m_Friends[agentID].Friends = FriendsService.GetFriends(agentID);
// Update the local cache
UpdateFriendsCache(agentID);
// //
// Notify the friend // Notify the friend
@ -564,16 +508,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
} }
// The friend is not here // The friend is not here
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSessions != null && friendSessions.Length > 0) if (friendSession != null)
{ {
PresenceInfo friendSession = friendSessions[0]; GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
if (friendSession != null) m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
{ client.SendAgentOnline(new UUID[] { friendID });
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
client.SendAgentOnline(new UUID[] { friendID });
}
} }
} }
@ -592,18 +532,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalFriendshipDenied(agentID, client.Name, friendID)) if (LocalFriendshipDenied(agentID, client.Name, friendID))
return; return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSessions != null && friendSessions.Length > 0) if (friendSession != null)
{ {
PresenceInfo friendSession = friendSessions[0]; GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
if (friendSession != null) if (region != null)
{ m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); else
if (region != null) m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
else
m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
}
} }
} }
@ -613,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
FriendsService.Delete(exfriendID, agentID.ToString()); FriendsService.Delete(exfriendID, agentID.ToString());
// Update local cache // Update local cache
m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); UpdateFriendsCache(agentID);
client.SendTerminateFriend(exfriendID); client.SendTerminateFriend(exfriendID);
@ -625,30 +561,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalFriendshipTerminated(exfriendID)) if (LocalFriendshipTerminated(exfriendID))
return; return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() }); PresenceInfo friendSession = PresenceService.GetAgent(exfriendID);
if (friendSessions != null && friendSessions.Length > 0) if (friendSession != null)
{ {
PresenceInfo friendSession = friendSessions[0]; GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
if (friendSession != null) m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
}
} }
} }
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
{ {
if (!m_Friends.ContainsKey(remoteClient.AgentId)) FriendInfo[] friends = GetFriends(remoteClient.AgentId);
if (friends.Length == 0)
return; return;
m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target); m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target);
// Let's find the friend in this user's friend list // Let's find the friend in this user's friend list
UserFriendData fd = m_Friends[remoteClient.AgentId];
FriendInfo friend = null; FriendInfo friend = null;
foreach (FriendInfo fi in fd.Friends) foreach (FriendInfo fi in friends)
{
if (fi.Friend == target.ToString()) if (fi.Friend == target.ToString())
friend = fi; friend = fi;
}
if (friend != null) // Found it if (friend != null) // Found it
{ {
@ -670,17 +604,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalGrantRights(requester, target, myFlags, rights)) if (LocalGrantRights(requester, target, myFlags, rights))
return; return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); PresenceInfo friendSession = PresenceService.GetAgent(target);
if (friendSessions != null && friendSessions.Length > 0) if (friendSession != null)
{ {
PresenceInfo friendSession = friendSessions[0]; GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
if (friendSession != null) // TODO: You might want to send the delta to save the lookup
{ // on the other end!!
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
// TODO: You might want to send the delta to save the lookup
// on the other end!!
m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
}
} }
} }
} }
@ -709,8 +639,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID,
(byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero);
friendClient.SendInstantMessage(im); friendClient.SendInstantMessage(im);
// update the local cache
m_Friends[friendID].Friends = FriendsService.GetFriends(friendID); // Update the local cache
UpdateFriendsCache(friendID);
// we're done // we're done
return true; return true;
} }
@ -724,7 +656,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (friendClient != null) if (friendClient != null)
{ {
// the prospective friend in this sim as root agent // the prospective friend in this sim as root agent
GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID,
(byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero); (byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero);
friendClient.SendInstantMessage(im); friendClient.SendInstantMessage(im);
@ -743,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// the friend in this sim as root agent // the friend in this sim as root agent
friendClient.SendTerminateFriend(exfriendID); friendClient.SendTerminateFriend(exfriendID);
// update local cache // update local cache
m_Friends[exfriendID].Friends = FriendsService.GetFriends(exfriendID); UpdateFriendsCache(exfriendID);
// we're done // we're done
return true; return true;
} }
@ -772,11 +703,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
} }
// update local cache // Update local cache
//m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID); lock (m_Friends)
foreach (FriendInfo finfo in m_Friends[friendID].Friends) {
if (finfo.Friend == userID.ToString()) FriendInfo[] friends = GetFriends(friendID);
finfo.TheirFlags = rights; foreach (FriendInfo finfo in friends)
{
if (finfo.Friend == userID.ToString())
finfo.TheirFlags = rights;
}
}
return true; return true;
} }
@ -802,7 +738,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return false; return false;
} }
#endregion #endregion
private FriendInfo[] GetFriends(UUID agentID)
{
UserFriendData friendsData;
lock (m_Friends)
{
if (m_Friends.TryGetValue(agentID, out friendsData))
return friendsData.Friends;
}
return EMPTY_FRIENDS;
}
private void UpdateFriendsCache(UUID agentID)
{
lock (m_Friends)
{
UserFriendData friendsData;
if (m_Friends.TryGetValue(agentID, out friendsData))
friendsData.Friends = FriendsService.GetFriends(agentID);
}
}
} }
} }

View File

@ -58,13 +58,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
public void SubscribeToClientEvents(IClientAPI client) public void SubscribeToClientEvents(IClientAPI client)
{ {
client.OnGodKickUser += KickUser; client.OnGodKickUser += KickUser;
client.OnRequestGodlikePowers += RequestGodlikePowers; client.OnRequestGodlikePowers += RequestGodlikePowers;
} }
public void UnsubscribeFromClientEvents(IClientAPI client) public void UnsubscribeFromClientEvents(IClientAPI client)
{ {
client.OnGodKickUser -= KickUser; client.OnGodKickUser -= KickUser;
client.OnRequestGodlikePowers -= RequestGodlikePowers; client.OnRequestGodlikePowers -= RequestGodlikePowers;
} }
public void RequestGodlikePowers( public void RequestGodlikePowers(

View File

@ -138,8 +138,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (scene.Entities.ContainsKey(toAgentID) && if (scene.Entities.ContainsKey(toAgentID) &&
scene.Entities[toAgentID] is ScenePresence) scene.Entities[toAgentID] is ScenePresence)
{ {
// m_log.DebugFormat("[INSTANT MESSAGE]: Looking for {0} in {1}", toAgentID.ToString(), scene.RegionInfo.RegionName); // m_log.DebugFormat(
// Local message // "[INSTANT MESSAGE]: Looking for root agent {0} in {1}",
// toAgentID.ToString(), scene.RegionInfo.RegionName);
ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
if (!user.IsChildAgent) if (!user.IsChildAgent)
{ {
@ -495,9 +497,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (lookupAgent) if (lookupAgent)
{ {
// Non-cached user agent lookup. // Non-cached user agent lookup.
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); upd = PresenceService.GetAgent(toAgentID);
if (presences != null && presences.Length > 0)
upd = presences[0];
if (upd != null) if (upd != null)
{ {

View File

@ -179,14 +179,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
m_log.DebugFormat( m_log.DebugFormat(
"[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
successfulAssetRestores, failedAssetRestores); successfulAssetRestores, failedAssetRestores);
m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores); m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
return loadedNodes; return loadedNodes;
} }
finally finally
{ {
m_loadStream.Close(); m_loadStream.Close();
} }
} }
public void Close() public void Close()
@ -201,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// <param name="iarPath">The item archive path to replicate</param> /// <param name="iarPath">The item archive path to replicate</param>
/// <param name="rootDestinationFolder">The root folder for the inventory load</param> /// <param name="rootDestinationFolder">The root folder for the inventory load</param>
/// <param name="resolvedFolders"> /// <param name="resolvedFolders">
/// The folders that we have resolved so far for a given archive path. /// The folders that we have resolved so far for a given archive path.
/// This method will add more folders if necessary /// This method will add more folders if necessary
/// </param> /// </param>
/// <param name="loadedNodes"> /// <param name="loadedNodes">
@ -246,17 +246,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// The root folder for the inventory load /// The root folder for the inventory load
/// </param> /// </param>
/// <param name="resolvedFolders"> /// <param name="resolvedFolders">
/// The folders that we have resolved so far for a given archive path. /// The folders that we have resolved so far for a given archive path.
/// </param> /// </param>
/// <returns> /// <returns>
/// The folder in the user's inventory that matches best the archive path given. If no such folder was found /// The folder in the user's inventory that matches best the archive path given. If no such folder was found
/// then the passed in root destination folder is returned. /// then the passed in root destination folder is returned.
/// </returns> /// </returns>
protected InventoryFolderBase ResolveDestinationFolder( protected InventoryFolderBase ResolveDestinationFolder(
InventoryFolderBase rootDestFolder, InventoryFolderBase rootDestFolder,
ref string archivePath, ref string archivePath,
Dictionary <string, InventoryFolderBase> resolvedFolders) Dictionary <string, InventoryFolderBase> resolvedFolders)
{ {
// string originalArchivePath = archivePath; // string originalArchivePath = archivePath;
while (archivePath.Length > 0) while (archivePath.Length > 0)
@ -370,7 +370,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (0 == i) if (0 == i)
loadedNodes.Add(destFolder); loadedNodes.Add(destFolder);
} }
} }
/// <summary> /// <summary>

View File

@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
{ {
Exception reportedException = null; Exception reportedException = null;
bool succeeded = true; bool succeeded = true;
try try
{ {
@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
finally finally
{ {
m_saveStream.Close(); m_saveStream.Close();
} }
m_module.TriggerInventoryArchiveSaved( m_module.TriggerInventoryArchiveSaved(
m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
@ -270,7 +270,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{ {
// We couldn't find the path indicated // We couldn't find the path indicated
string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
Exception e = new InventoryArchiverException(errorMessage); Exception e = new InventoryArchiverException(errorMessage);
m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e); m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e);
throw e; throw e;
} }
@ -283,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
"[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}",
inventoryFolder.Name, inventoryFolder.Name,
inventoryFolder.ID, inventoryFolder.ID,
m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath ); m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath);
//recurse through all dirs getting dirs and files //recurse through all dirs getting dirs and files
SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly); SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly);
@ -301,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
//SaveUsers(); //SaveUsers();
new AssetsRequest( new AssetsRequest(
new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute(); new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute();
} }
catch (Exception) catch (Exception)
{ {

View File

@ -33,7 +33,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// Signals an inventory archiving problem /// Signals an inventory archiving problem
/// </summary> /// </summary>
public class InventoryArchiverException : Exception public class InventoryArchiverException : Exception
{ {
public InventoryArchiverException(string message) : base(message) {} public InventoryArchiverException(string message) : base(message) {}
public InventoryArchiverException(string message, Exception e) : base(message, e) {} public InventoryArchiverException(string message, Exception e) : base(message, e) {}
} }

View File

@ -91,12 +91,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
scene.AddCommand( scene.AddCommand(
this, "load iar", this, "load iar",
"load iar <first> <last> <inventory path> <password> [<IAR path>]", "load iar <first> <last> <inventory path> <password> [<IAR path>]",
//"load iar [--merge] <first> <last> <inventory path> <password> [<IAR path>]", //"load iar [--merge] <first> <last> <inventory path> <password> [<IAR path>]",
"Load user inventory archive (IAR).", "Load user inventory archive (IAR).",
//"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones" //"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
//+ "<first> is user's first name." + Environment.NewLine //+ "<first> is user's first name." + Environment.NewLine
"<first> is user's first name." + Environment.NewLine "<first> is user's first name." + Environment.NewLine
+ "<last> is user's last name." + Environment.NewLine + "<last> is user's last name." + Environment.NewLine
+ "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine + "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine
+ "<password> is the user's password." + Environment.NewLine + "<password> is the user's password." + Environment.NewLine
@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (CheckPresence(userInfo.PrincipalID)) if (CheckPresence(userInfo.PrincipalID))
{ {
InventoryArchiveReadRequest request; InventoryArchiveReadRequest request;
bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
try try
{ {
@ -286,10 +286,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (CheckPresence(userInfo.PrincipalID)) if (CheckPresence(userInfo.PrincipalID))
{ {
InventoryArchiveReadRequest request; InventoryArchiveReadRequest request;
bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
try try
{ {
request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge); request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge);
} }
catch (EntryPointNotFoundException e) catch (EntryPointNotFoundException e)
@ -325,20 +325,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams) protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
{ {
try try
{ {
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
Dictionary<string, object> options = new Dictionary<string, object>(); Dictionary<string, object> options = new Dictionary<string, object>();
OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
List<string> mainParams = optionSet.Parse(cmdparams); List<string> mainParams = optionSet.Parse(cmdparams);
if (mainParams.Count < 6) if (mainParams.Count < 6)
{ {
m_log.Error( m_log.Error(
"[INVENTORY ARCHIVER]: usage is load iar [--merge] <first name> <last name> <inventory path> <user password> [<load file path>]"); "[INVENTORY ARCHIVER]: usage is load iar [--merge] <first name> <last name> <inventory path> <user password> [<load file path>]");
return; return;
} }
string firstName = mainParams[2]; string firstName = mainParams[2];
string lastName = mainParams[3]; string lastName = mainParams[3];
@ -353,7 +353,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
m_log.InfoFormat( m_log.InfoFormat(
"[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
loadPath, firstName, lastName); loadPath, firstName, lastName);
} }
catch (InventoryArchiverException e) catch (InventoryArchiverException e)
{ {
@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
"[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
savePath, invPath, firstName, lastName); savePath, invPath, firstName, lastName);
ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>()); ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
} }
catch (InventoryArchiverException e) catch (InventoryArchiverException e)
{ {
@ -398,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
} }
lock (m_pendingConsoleSaves) lock (m_pendingConsoleSaves)
m_pendingConsoleSaves.Add(id); m_pendingConsoleSaves.Add(id);
} }
private void SaveInvConsoleCommandCompleted( private void SaveInvConsoleCommandCompleted(

View File

@ -58,18 +58,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
/// <summary> /// <summary>
/// Stream of data representing a common IAR that can be reused in load tests. /// Stream of data representing a common IAR that can be reused in load tests.
/// </summary> /// </summary>
protected MemoryStream m_iarStream; protected MemoryStream m_iarStream;
protected UserAccount m_ua1 protected UserAccount m_ua1
= new UserAccount { = new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
FirstName = "Mr", FirstName = "Mr",
LastName = "Tiddles" }; LastName = "Tiddles" };
protected UserAccount m_ua2 protected UserAccount m_ua2
= new UserAccount { = new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
FirstName = "Lord", FirstName = "Lord",
LastName = "Lucan" }; LastName = "Lucan" };
string m_item1Name = "b.lsl"; string m_item1Name = "b.lsl";
private void SaveCompleted( private void SaveCompleted(
@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
} }
protected void ConstructDefaultIarForTestLoad() protected void ConstructDefaultIarForTestLoad()
{ {
string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random()); string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random());
MemoryStream archiveWriteStream = new MemoryStream(); MemoryStream archiveWriteStream = new MemoryStream();
@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string item1FileName string item1FileName
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
tar.Close(); tar.Close();
m_iarStream = new MemoryStream(archiveWriteStream.ToArray()); m_iarStream = new MemoryStream(archiveWriteStream.ToArray());
} }
@ -341,7 +341,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// Assert.That(gotObject2File, Is.True, "No object2 file in archive"); // Assert.That(gotObject2File, Is.True, "No object2 file in archive");
// TODO: Test presence of more files and contents of files. // TODO: Test presence of more files and contents of files.
} }
/// <summary> /// <summary>
/// Test that things work when the load path specified starts with a slash /// Test that things work when the load path specified starts with a slash
@ -349,22 +349,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
[Test] [Test]
public void TestLoadIarPathStartsWithSlash() public void TestLoadIarPathStartsWithSlash()
{ {
TestHelper.InMethod(); TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
SerialiserModule serialiserModule = new SerialiserModule(); SerialiserModule serialiserModule = new SerialiserModule();
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
Scene scene = SceneSetupHelpers.SetupScene("inventory"); Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password"); UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password");
archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream); archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream);
InventoryItemBase foundItem1 InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath( = InventoryArchiveUtils.FindItemByPath(
scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name); scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name);
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()"); Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
} }
/// <summary> /// <summary>
@ -376,7 +376,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
[Test] [Test]
public void TestLoadIarV0_1ExistingUsers() public void TestLoadIarV0_1ExistingUsers()
{ {
TestHelper.InMethod(); TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure(); //log4net.Config.XmlConfigurator.Configure();
SerialiserModule serialiserModule = new SerialiserModule(); SerialiserModule serialiserModule = new SerialiserModule();
@ -386,9 +386,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Scene scene = SceneSetupHelpers.SetupScene("inventory"); Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream);
@ -450,7 +450,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string userFirstName = "Jock"; string userFirstName = "Jock";
string userLastName = "Stirrup"; string userLastName = "Stirrup";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood"); UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
// Create asset // Create asset
SceneObjectGroup object1; SceneObjectGroup object1;
@ -524,7 +524,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
[Test] [Test]
public void TestLoadIarV0_1AbsentUsers() public void TestLoadIarV0_1AbsentUsers()
{ {
TestHelper.InMethod(); TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure(); //log4net.Config.XmlConfigurator.Configure();
string userFirstName = "Charlie"; string userFirstName = "Charlie";
@ -562,7 +562,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Scene scene = SceneSetupHelpers.SetupScene("inventory"); Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood"); UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood");
archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream);
@ -680,8 +680,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random()); string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random());
string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random()); string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random());
string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName }); string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName }); string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
{ {
// Test replication of path1 // Test replication of path1
@ -694,7 +694,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name); = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
Assert.That(folder1Candidates.Count, Is.EqualTo(1)); Assert.That(folder1Candidates.Count, Is.EqualTo(1));
InventoryFolderBase folder1 = folder1Candidates[0]; InventoryFolderBase folder1 = folder1Candidates[0];
List<InventoryFolderBase> folder2aCandidates List<InventoryFolderBase> folder2aCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName); = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
@ -715,11 +715,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
List<InventoryFolderBase> folder2aCandidates List<InventoryFolderBase> folder2aCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName); = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
List<InventoryFolderBase> folder2bCandidates List<InventoryFolderBase> folder2bCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName); = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName);
Assert.That(folder2bCandidates.Count, Is.EqualTo(1)); Assert.That(folder2bCandidates.Count, Is.EqualTo(1));
} }
} }
@ -741,7 +741,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryFolderBase folder1 InventoryFolderBase folder1
= UserInventoryTestUtils.CreateInventoryFolder( = UserInventoryTestUtils.CreateInventoryFolder(
scene.InventoryService, ua1.PrincipalID, folder1ExistingName); scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
@ -772,7 +772,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
List<InventoryFolderBase> folder2PostCandidates List<InventoryFolderBase> folder2PostCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b"); = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
} }
/// <summary> /// <summary>
/// Test replication of a partly existing archive path to the user's inventory. This should create /// Test replication of a partly existing archive path to the user's inventory. This should create
@ -792,7 +792,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryFolderBase folder1 InventoryFolderBase folder1
= UserInventoryTestUtils.CreateInventoryFolder( = UserInventoryTestUtils.CreateInventoryFolder(
scene.InventoryService, ua1.PrincipalID, folder1ExistingName); scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
@ -812,6 +812,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
List<InventoryFolderBase> folder2PostCandidates List<InventoryFolderBase> folder2PostCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b"); = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b");
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
} }
} }
} }

View File

@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
{ {
if (!queues.ContainsKey(agentId)) if (!queues.ContainsKey(agentId))
{ {
/* /*
m_log.DebugFormat( m_log.DebugFormat(
"[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
agentId, m_scene.RegionInfo.RegionName); agentId, m_scene.RegionInfo.RegionName);
@ -701,7 +701,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID) public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID)
{ {
OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage); OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage);
Enqueue(item, avatarID); Enqueue(item, avatarID);
} }

View File

@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
} }
// private static byte[] uintToByteArray(uint uIntValue) // private static byte[] uintToByteArray(uint uIntValue)
// { // {
// byte[] result = new byte[4]; // byte[] result = new byte[4];
// Utils.UIntToBytesBig(uIntValue, result, 0); // Utils.UIntToBytesBig(uIntValue, result, 0);
// return result; // return result;
@ -386,14 +386,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
return placesReply; return placesReply;
} }
public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage) public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage)
{ {
OSDMap message = new OSDMap(); OSDMap message = new OSDMap();
message.Add("message", OSD.FromString("ParcelProperties")); message.Add("message", OSD.FromString("ParcelProperties"));
OSD message_body = parcelPropertiesMessage.Serialize(); OSD message_body = parcelPropertiesMessage.Serialize();
message.Add("body", message_body); message.Add("body", message_body);
return message; return message;
} }
} }
} }

View File

@ -629,7 +629,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
rootPart.Name = item.Name; rootPart.Name = item.Name;
rootPart.Description = item.Description; rootPart.Description = item.Description;
List<SceneObjectPart> partList = null; List<SceneObjectPart> partList = null;
lock (group.Children) lock (group.Children)
partList = new List<SceneObjectPart>(group.Children.Values); partList = new List<SceneObjectPart>(group.Children.Values);

View File

@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
protected bool m_collectStats; protected bool m_collectStats;
protected Scene m_scene = null; protected Scene m_scene = null;
public string Name { get { return "Binary Statistics Logging Module"; } } public string Name { get { return "Binary Statistics Logging Module"; } }
public Type ReplaceableInterface { get { return null; } } public Type ReplaceableInterface { get { return null; } }
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
catch catch
{ {
// if it doesn't work, we don't collect anything // if it doesn't work, we don't collect anything
} }
} }
public void AddRegion(Scene scene) public void AddRegion(Scene scene)
@ -94,12 +94,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
{ {
if (m_collectStats) if (m_collectStats)
m_scene.StatsReporter.OnSendStatsResult += LogSimStats; m_scene.StatsReporter.OnSendStatsResult += LogSimStats;
} }
public void Close() public void Close()
{ {
} }
public class StatLogger public class StatLogger
{ {
@ -164,6 +164,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
} }
} }
return; return;
} }
} }
} }

View File

@ -115,6 +115,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid
m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService);
new UserAgentServerConnector(m_Config, MainServer.Instance); new UserAgentServerConnector(m_Config, MainServer.Instance);
new HeloServiceInConnector(m_Config, MainServer.Instance, "HeloService");
} }
scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper); scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper);
} }

View File

@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Services.Connectors; using OpenSim.Services.Connectors;
using OpenSim.Services.Connectors.SimianGrid;
using OpenMetaverse; using OpenMetaverse;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
@ -538,12 +539,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
else else
{ {
// We're instantiating this class explicitly, but this won't // Still not as flexible as I would like this to be,
// work in general, because the remote grid may be running // but good enough for now
// an inventory server that has a different protocol. string connectorType = new HeloServicesConnector(url).Helo();
// Eventually we will want a piece of protocol asking m_log.DebugFormat("[HG INVENTORY SERVICE]: HELO returned {0}", connectorType);
// the remote server about its kind. Definitely cool thing to do! if (connectorType == "opensim-simian")
connector = new RemoteXInventoryServicesConnector(url); connector = new SimianInventoryServiceConnector(url);
else
connector = new RemoteXInventoryServicesConnector(url);
m_connectors.Add(url, connector); m_connectors.Add(url, connector);
} }
} }

View File

@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return folders[type]; return folders[type];
} }
m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID); m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID);
return null; return null;
} }

View File

@ -220,7 +220,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}", // "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}",
// item.Name, item.Owner, item.Folder); // item.Name, item.Owner, item.Folder);
return m_InventoryService.AddItem(item); return m_InventoryService.AddItem(item);
} }

View File

@ -227,7 +227,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
public bool AddItem(InventoryItemBase item) public bool AddItem(InventoryItemBase item)
{ {
if (item == null) if (item == null)
return false; return false;
return m_RemoteConnector.AddItem(item); return m_RemoteConnector.AddItem(item);
} }

View File

@ -36,6 +36,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{ {
public class UserAccountCache public class UserAccountCache
{ {
private const double CACHE_EXPIRATION_SECONDS = 120.0;
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
@ -51,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
public void Cache(UUID userID, UserAccount account) public void Cache(UUID userID, UserAccount account)
{ {
// Cache even null accounts // Cache even null accounts
m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
if (account != null) if (account != null)
m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromMinutes(2.0d)); m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
// m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); // m_log.DebugFormat("[USER CACHE]: cached user {0}", userID);
} }

View File

@ -33,7 +33,7 @@ using OpenSim.Framework.Serialization;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.World.Archiver namespace OpenSim.Region.CoreModules.World.Archiver
{ {
/// <summary> /// <summary>
/// Helper methods for archive manipulation /// Helper methods for archive manipulation
/// </summary> /// </summary>
@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
public static string CreateObjectFilename(SceneObjectGroup sog) public static string CreateObjectFilename(SceneObjectGroup sog)
{ {
return ArchiveConstants.CreateOarObjectFilename(sog.Name, sog.UUID, sog.AbsolutePosition); return ArchiveConstants.CreateOarObjectFilename(sog.Name, sog.UUID, sog.AbsolutePosition);
} }
/// <summary> /// <summary>
/// Create the path used to store an object in an OpenSim Archive. /// Create the path used to store an object in an OpenSim Archive.
@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
public static string CreateObjectPath(SceneObjectGroup sog) public static string CreateObjectPath(SceneObjectGroup sog)
{ {
return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition); return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition);
} }
/// <summary> /// <summary>
/// Resolve path to a working FileStream /// Resolve path to a working FileStream
@ -123,6 +123,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// return new BufferedStream(file, (int) response.ContentLength); // return new BufferedStream(file, (int) response.ContentLength);
return new BufferedStream(file, 1000000); return new BufferedStream(file, 1000000);
} }
} }
} }

View File

@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{ {
Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>(); Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>();
List<EntityBase> entities = m_scene.GetEntities(); EntityBase[] entities = m_scene.GetEntities();
List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
/* /*

View File

@ -48,6 +48,7 @@ using OpenSim.Tests.Common.Setup;
using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader;
using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter;
using RegionSettings = OpenSim.Framework.RegionSettings;
namespace OpenSim.Region.CoreModules.World.Archiver.Tests namespace OpenSim.Region.CoreModules.World.Archiver.Tests
{ {
@ -135,7 +136,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
SceneObjectPart part2 = CreateSceneObjectPart2(); SceneObjectPart part2 = CreateSceneObjectPart2();
AssetNotecard nc = new AssetNotecard("Hello World!"); AssetNotecard nc = new AssetNotecard();
nc.BodyText = "Hello World!";
nc.Encode();
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset AssetBase ncAsset
@ -215,7 +218,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
public void TestLoadOarV0_2() public void TestLoadOarV0_2()
{ {
TestHelper.InMethod(); TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
MemoryStream archiveWriteStream = new MemoryStream(); MemoryStream archiveWriteStream = new MemoryStream();
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);

View File

@ -72,12 +72,12 @@ namespace OpenSim.Region.CoreModules.World.Land
#pragma warning restore 0429 #pragma warning restore 0429
/// <value> /// <value>
/// Local land ids at specified region co-ordinates (region size / 4) /// Local land ids at specified region co-ordinates (region size / 4)
/// </value> /// </value>
private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax]; private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax];
/// <value> /// <value>
/// Land objects keyed by local id /// Land objects keyed by local id
/// </value> /// </value>
private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
@ -94,8 +94,8 @@ namespace OpenSim.Region.CoreModules.World.Land
#region INonSharedRegionModule Members #region INonSharedRegionModule Members
public Type ReplaceableInterface public Type ReplaceableInterface
{ {
get { return null; } get { return null; }
} }
@ -200,7 +200,7 @@ namespace OpenSim.Region.CoreModules.World.Land
Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition));
forcedPosition = null; forcedPosition = null;
} }
//if we are far away, teleport //if we are far away, teleport
else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) > 3) else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) > 3)
{ {
Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition));
@ -329,8 +329,6 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
} }
private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position)
{ {
if (m_scene.Permissions.IsGod(avatar.UUID)) return; if (m_scene.Permissions.IsGod(avatar.UUID)) return;
@ -344,7 +342,6 @@ namespace OpenSim.Region.CoreModules.World.Land
{ {
avatar.ControllingClient.SendAlertMessage( avatar.ControllingClient.SendAlertMessage(
"You are not allowed on this parcel because the land owner has restricted access."); "You are not allowed on this parcel because the land owner has restricted access.");
} }
public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
@ -456,7 +453,7 @@ namespace OpenSim.Region.CoreModules.World.Land
if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT &&
clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
{ {
EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID, EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID,
m_scene.RegionInfo.RegionID); m_scene.RegionInfo.RegionID);
//They are going under the safety line! //They are going under the safety line!
if (!parcel.IsBannedFromLand(clientAvatar.UUID)) if (!parcel.IsBannedFromLand(clientAvatar.UUID))
@ -660,7 +657,7 @@ namespace OpenSim.Region.CoreModules.World.Land
if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0) if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0)
return null; return null;
try try
{ {
x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0)); x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0));
@ -675,7 +672,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{ {
return null; return null;
} }
lock (m_landList) lock (m_landList)
{ {
// Corner case. If an autoreturn happens during sim startup // Corner case. If an autoreturn happens during sim startup
@ -695,7 +692,7 @@ namespace OpenSim.Region.CoreModules.World.Land
// they happen every time at border crossings // they happen every time at border crossings
throw new Exception("Error: Parcel not found at point " + x + ", " + y); throw new Exception("Error: Parcel not found at point " + x + ", " + y);
} }
lock (m_landIDList) lock (m_landIDList)
{ {
try try
@ -749,7 +746,6 @@ namespace OpenSim.Region.CoreModules.World.Land
public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj) public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj)
{ {
lock (m_landList) lock (m_landList)
{ {
foreach (LandObject p in m_landList.Values) foreach (LandObject p in m_landList.Values)
@ -802,7 +798,8 @@ namespace OpenSim.Region.CoreModules.World.Land
public void EventManagerOnParcelPrimCountUpdate() public void EventManagerOnParcelPrimCountUpdate()
{ {
ResetAllLandPrimCounts(); ResetAllLandPrimCounts();
foreach (EntityBase obj in m_scene.Entities) EntityBase[] entities = m_scene.Entities.GetEntities();
foreach (EntityBase obj in entities)
{ {
if (obj != null) if (obj != null)
{ {
@ -943,7 +940,7 @@ namespace OpenSim.Region.CoreModules.World.Land
return; return;
} }
} }
lock (m_landList) lock (m_landList)
{ {
foreach (ILandObject slaveLandObject in selectedLandObjects) foreach (ILandObject slaveLandObject in selectedLandObjects)
@ -1089,7 +1086,6 @@ namespace OpenSim.Region.CoreModules.World.Land
temp.Add(currentParcel); temp.Add(currentParcel);
} }
} }
} }
} }
@ -1132,7 +1128,7 @@ namespace OpenSim.Region.CoreModules.World.Land
join(west, south, east, north, remote_client.AgentId); join(west, south, east, north, remote_client.AgentId);
} }
public void ClientOnParcelSelectObjects(int local_id, int request_type, public void ClientOnParcelSelectObjects(int local_id, int request_type,
List<UUID> returnIDs, IClientAPI remote_client) List<UUID> returnIDs, IClientAPI remote_client)
{ {
m_landList[local_id].SendForceObjectSelect(local_id, request_type, returnIDs, remote_client); m_landList[local_id].SendForceObjectSelect(local_id, request_type, returnIDs, remote_client);
@ -1382,31 +1378,31 @@ namespace OpenSim.Region.CoreModules.World.Land
{ {
return RemoteParcelRequest(request, path, param, agentID, caps); return RemoteParcelRequest(request, path, param, agentID, caps);
})); }));
UUID parcelCapID = UUID.Random(); UUID parcelCapID = UUID.Random();
caps.RegisterHandler("ParcelPropertiesUpdate", caps.RegisterHandler("ParcelPropertiesUpdate",
new RestStreamHandler("POST", "/CAPS/" + parcelCapID, new RestStreamHandler("POST", "/CAPS/" + parcelCapID,
delegate(string request, string path, string param, delegate(string request, string path, string param,
OSHttpRequest httpRequest, OSHttpResponse httpResponse) OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{ {
return ProcessPropertiesUpdate(request, path, param, agentID, caps); return ProcessPropertiesUpdate(request, path, param, agentID, caps);
})); }));
} }
private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
{ {
IClientAPI client; IClientAPI client;
if ( ! m_scene.TryGetClient(agentID, out client) ) { if (! m_scene.TryGetClient(agentID, out client)) {
m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString() ); m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString());
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
} }
ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage();
OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request);
properties.Deserialize(args); ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage();
OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request);
LandUpdateArgs land_update = new LandUpdateArgs();
int parcelID = properties.LocalID; properties.Deserialize(args);
land_update.AuthBuyerID = properties.AuthBuyerID;
LandUpdateArgs land_update = new LandUpdateArgs();
int parcelID = properties.LocalID;
land_update.AuthBuyerID = properties.AuthBuyerID;
land_update.Category = properties.Category; land_update.Category = properties.Category;
land_update.Desc = properties.Desc; land_update.Desc = properties.Desc;
land_update.GroupID = properties.GroupID; land_update.GroupID = properties.GroupID;
@ -1423,15 +1419,15 @@ namespace OpenSim.Region.CoreModules.World.Land
land_update.SnapshotID = properties.SnapshotID; land_update.SnapshotID = properties.SnapshotID;
land_update.UserLocation = properties.UserLocation; land_update.UserLocation = properties.UserLocation;
land_update.UserLookAt = properties.UserLookAt; land_update.UserLookAt = properties.UserLookAt;
land_update.MediaDescription = properties.MediaDesc; land_update.MediaDescription = properties.MediaDesc;
land_update.MediaType = properties.MediaType; land_update.MediaType = properties.MediaType;
land_update.MediaWidth = properties.MediaWidth; land_update.MediaWidth = properties.MediaWidth;
land_update.MediaHeight = properties.MediaHeight; land_update.MediaHeight = properties.MediaHeight;
land_update.MediaLoop = properties.MediaLoop; land_update.MediaLoop = properties.MediaLoop;
land_update.ObscureMusic = properties.ObscureMusic; land_update.ObscureMusic = properties.ObscureMusic;
land_update.ObscureMedia = properties.ObscureMedia; land_update.ObscureMedia = properties.ObscureMedia;
ILandObject land; ILandObject land;
lock (m_landList) lock (m_landList)
{ {
m_landList.TryGetValue(parcelID, out land); m_landList.TryGetValue(parcelID, out land);
@ -1439,15 +1435,15 @@ namespace OpenSim.Region.CoreModules.World.Land
if (land != null) if (land != null)
{ {
land.UpdateLandProperties(land_update, client); land.UpdateLandProperties(land_update, client);
m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client); m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client);
} }
else else
{ {
m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
} }
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
} }
// we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the
// "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to. // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to.
// So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x
@ -1524,19 +1520,19 @@ namespace OpenSim.Region.CoreModules.World.Land
if (parcelID == UUID.Zero) if (parcelID == UUID.Zero)
return; return;
ExtendedLandData data = ExtendedLandData data =
(ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(), (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(),
delegate(string id) delegate(string id)
{ {
UUID parcel = UUID.Zero; UUID parcel = UUID.Zero;
UUID.TryParse(id, out parcel); UUID.TryParse(id, out parcel);
// assume we've got the parcelID we just computed in RemoteParcelRequest // assume we've got the parcelID we just computed in RemoteParcelRequest
ExtendedLandData extLandData = new ExtendedLandData(); ExtendedLandData extLandData = new ExtendedLandData();
Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
out extLandData.X, out extLandData.Y); out extLandData.X, out extLandData.Y);
m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
extLandData.RegionHandle, extLandData.X, extLandData.Y); extLandData.RegionHandle, extLandData.X, extLandData.Y);
// for this region or for somewhere else? // for this region or for somewhere else?
if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle) if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle)
{ {

View File

@ -229,13 +229,13 @@ namespace OpenSim.Region.CoreModules.World.Land
newData.SnapshotID = args.SnapshotID; newData.SnapshotID = args.SnapshotID;
newData.UserLocation = args.UserLocation; newData.UserLocation = args.UserLocation;
newData.UserLookAt = args.UserLookAt; newData.UserLookAt = args.UserLookAt;
newData.MediaType = args.MediaType; newData.MediaType = args.MediaType;
newData.MediaDescription = args.MediaDescription; newData.MediaDescription = args.MediaDescription;
newData.MediaWidth = args.MediaWidth; newData.MediaWidth = args.MediaWidth;
newData.MediaHeight = args.MediaHeight; newData.MediaHeight = args.MediaHeight;
newData.MediaLoop = args.MediaLoop; newData.MediaLoop = args.MediaLoop;
newData.ObscureMusic = args.ObscureMusic; newData.ObscureMusic = args.ObscureMusic;
newData.ObscureMedia = args.ObscureMedia; newData.ObscureMedia = args.ObscureMedia;
m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);

View File

@ -54,11 +54,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap
{ {
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")]
public class MoapModule : INonSharedRegionModule, IMoapModule public class MoapModule : INonSharedRegionModule, IMoapModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string Name { get { return "MoapModule"; } } public string Name { get { return "MoapModule"; } }
public Type ReplaceableInterface { get { return null; } } public Type ReplaceableInterface { get { return null; } }
/// <summary> /// <summary>
/// Is this module enabled? /// Is this module enabled?
@ -78,17 +78,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap
/// <summary> /// <summary>
/// Track the ObjectMedia capabilities given to users keyed by agent. Lock m_omCapUsers to manipulate. /// Track the ObjectMedia capabilities given to users keyed by agent. Lock m_omCapUsers to manipulate.
/// </summary> /// </summary>
protected Dictionary<UUID, string> m_omCapUrls = new Dictionary<UUID, string>(); protected Dictionary<UUID, string> m_omCapUrls = new Dictionary<UUID, string>();
/// <summary> /// <summary>
/// Track the ObjectMediaUpdate capabilities given to users keyed by path /// Track the ObjectMediaUpdate capabilities given to users keyed by path
/// </summary> /// </summary>
protected Dictionary<string, UUID> m_omuCapUsers = new Dictionary<string, UUID>(); protected Dictionary<string, UUID> m_omuCapUsers = new Dictionary<string, UUID>();
/// <summary> /// <summary>
/// Track the ObjectMediaUpdate capabilities given to users keyed by agent. Lock m_omuCapUsers to manipulate /// Track the ObjectMediaUpdate capabilities given to users keyed by agent. Lock m_omuCapUsers to manipulate
/// </summary> /// </summary>
protected Dictionary<UUID, string> m_omuCapUrls = new Dictionary<UUID, string>(); protected Dictionary<UUID, string> m_omuCapUrls = new Dictionary<UUID, string>();
public void Initialise(IConfigSource configSource) public void Initialise(IConfigSource configSource)
{ {
@ -129,7 +129,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps; m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps;
m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy; m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy;
} }
public void OnRegisterCaps(UUID agentID, Caps caps) public void OnRegisterCaps(UUID agentID, Caps caps)
{ {
@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
caps.RegisterHandler( caps.RegisterHandler(
"ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage)); "ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage));
} }
} }
public void OnDeregisterCaps(UUID agentID, Caps caps) public void OnDeregisterCaps(UUID agentID, Caps caps)
{ {
@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
} }
protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed) protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed)
{ {
if (original.Shape.Media != null) if (original.Shape.Media != null)
{ {
PrimitiveBaseShape.MediaList dupeMedia = new PrimitiveBaseShape.MediaList(); PrimitiveBaseShape.MediaList dupeMedia = new PrimitiveBaseShape.MediaList();
@ -195,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
} }
copy.Shape.Media = dupeMedia; copy.Shape.Media = dupeMedia;
} }
} }
public MediaEntry GetMediaEntry(SceneObjectPart part, int face) public MediaEntry GetMediaEntry(SceneObjectPart part, int face)
@ -211,9 +211,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
me = null; me = null;
} }
else else
{ {
lock (media) lock (media)
me = media[face]; me = media[face];
// TODO: Really need a proper copy constructor down in libopenmetaverse // TODO: Really need a proper copy constructor down in libopenmetaverse
if (me != null) if (me != null)
@ -227,17 +227,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap
public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me) public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
{ {
CheckFaceParam(part, face); CheckFaceParam(part, face);
if (null == part.Shape.Media) if (null == part.Shape.Media)
part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]); part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]);
lock (part.Shape.Media) lock (part.Shape.Media)
part.Shape.Media[face] = me; part.Shape.Media[face] = me;
UpdateMediaUrl(part, UUID.Zero); UpdateMediaUrl(part, UUID.Zero);
part.ScheduleFullUpdate(); part.ScheduleFullUpdate();
part.TriggerScriptChangedEvent(Changed.MEDIA); part.TriggerScriptChangedEvent(Changed.MEDIA);
} }
public void ClearMediaEntry(SceneObjectPart part, int face) public void ClearMediaEntry(SceneObjectPart part, int face)
@ -256,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
/// <returns></returns> /// <returns></returns>
protected string HandleObjectMediaMessage( protected string HandleObjectMediaMessage(
string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{ {
// m_log.DebugFormat("[MOAP]: Got ObjectMedia path [{0}], raw request [{1}]", path, request); // m_log.DebugFormat("[MOAP]: Got ObjectMedia path [{0}], raw request [{1}]", path, request);
OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request);
@ -266,12 +266,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap
if (omm.Request is ObjectMediaRequest) if (omm.Request is ObjectMediaRequest)
return HandleObjectMediaRequest(omm.Request as ObjectMediaRequest); return HandleObjectMediaRequest(omm.Request as ObjectMediaRequest);
else if (omm.Request is ObjectMediaUpdate) else if (omm.Request is ObjectMediaUpdate)
return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate); return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate);
throw new Exception( throw new Exception(
string.Format( string.Format(
"[MOAP]: ObjectMediaMessage has unrecognized ObjectMediaBlock of {0}", "[MOAP]: ObjectMediaMessage has unrecognized ObjectMediaBlock of {0}",
omm.Request.GetType())); omm.Request.GetType()));
} }
/// <summary> /// <summary>
@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
/// </summary> /// </summary>
/// <param name="omr"></param> /// <param name="omr"></param>
/// <returns></returns> /// <returns></returns>
protected string HandleObjectMediaRequest(ObjectMediaRequest omr) protected string HandleObjectMediaRequest(ObjectMediaRequest omr)
{ {
UUID primId = omr.PrimID; UUID primId = omr.PrimID;
@ -318,7 +318,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
/// <param name="path">Path on which this request was made</param> /// <param name="path">Path on which this request was made</param>
/// <param name="omu">/param> /// <param name="omu">/param>
/// <returns></returns> /// <returns></returns>
protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu) protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu)
{ {
UUID primId = omu.PrimID; UUID primId = omu.PrimID;
@ -330,9 +330,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
"[MOAP]: Received an UPDATE ObjectMediaRequest for prim {0} but this doesn't exist in region {1}", "[MOAP]: Received an UPDATE ObjectMediaRequest for prim {0} but this doesn't exist in region {1}",
primId, m_scene.RegionInfo.RegionName); primId, m_scene.RegionInfo.RegionName);
return string.Empty; return string.Empty;
} }
// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); // m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId);
// for (int i = 0; i < omu.FaceMedia.Length; i++) // for (int i = 0; i < omu.FaceMedia.Length; i++)
// { // {
@ -374,14 +374,14 @@ namespace OpenSim.Region.CoreModules.Media.Moap
part.Shape.Textures = te; part.Shape.Textures = te;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[MOAP]: Media flags for face {0} is {1}", // "[MOAP]: Media flags for face {0} is {1}",
// i, part.Shape.Textures.FaceTextures[i].MediaFlags); // i, part.Shape.Textures.FaceTextures[i].MediaFlags);
} }
} }
} }
else else
{ {
// We need to go through the media textures one at a time to make sure that we have permission // We need to go through the media textures one at a time to make sure that we have permission
// to change them // to change them
// FIXME: Race condition here since some other texture entry manipulator may overwrite/get // FIXME: Race condition here since some other texture entry manipulator may overwrite/get
// overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry // overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry
@ -391,18 +391,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap
lock (media) lock (media)
{ {
for (int i = 0; i < media.Count; i++) for (int i = 0; i < media.Count; i++)
{ {
if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i)) if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i))
{ {
media[i] = omu.FaceMedia[i]; media[i] = omu.FaceMedia[i];
// When a face is cleared this is done by setting the MediaFlags in the TextureEntry via a normal // When a face is cleared this is done by setting the MediaFlags in the TextureEntry via a normal
// texture update, so we don't need to worry about clearing MediaFlags here. // texture update, so we don't need to worry about clearing MediaFlags here.
if (null == media[i]) if (null == media[i])
continue; continue;
Primitive.TextureEntryFace face = te.CreateFace((uint)i); Primitive.TextureEntryFace face = te.CreateFace((uint)i);
face.MediaFlags = true; face.MediaFlags = true;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[MOAP]: Media flags for face {0} is {1}", // "[MOAP]: Media flags for face {0} is {1}",
@ -414,11 +414,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap
part.Shape.Textures = te; part.Shape.Textures = te;
// for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++) // for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++)
// m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]); // m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]);
} }
UpdateMediaUrl(part, agentId); UpdateMediaUrl(part, agentId);
// Arguably, we could avoid sending a full update to the avatar that just changed the texture. // Arguably, we could avoid sending a full update to the avatar that just changed the texture.
part.ScheduleFullUpdate(); part.ScheduleFullUpdate();
@ -439,16 +439,16 @@ namespace OpenSim.Region.CoreModules.Media.Moap
/// <returns></returns> /// <returns></returns>
protected string HandleObjectMediaNavigateMessage( protected string HandleObjectMediaNavigateMessage(
string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{ {
// m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request [{0}]", request); // m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request [{0}]", request);
OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request);
ObjectMediaNavigateMessage omn = new ObjectMediaNavigateMessage(); ObjectMediaNavigateMessage omn = new ObjectMediaNavigateMessage();
omn.Deserialize(osd); omn.Deserialize(osd);
UUID primId = omn.PrimID; UUID primId = omn.PrimID;
SceneObjectPart part = m_scene.GetSceneObjectPart(primId); SceneObjectPart part = m_scene.GetSceneObjectPart(primId);
if (null == part) if (null == part)
{ {
@ -456,12 +456,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap
"[MOAP]: Received an ObjectMediaNavigateMessage for prim {0} but this doesn't exist in region {1}", "[MOAP]: Received an ObjectMediaNavigateMessage for prim {0} but this doesn't exist in region {1}",
primId, m_scene.RegionInfo.RegionName); primId, m_scene.RegionInfo.RegionName);
return string.Empty; return string.Empty;
} }
UUID agentId = default(UUID); UUID agentId = default(UUID);
lock (m_omuCapUsers) lock (m_omuCapUsers)
agentId = m_omuCapUsers[path]; agentId = m_omuCapUsers[path];
if (!m_scene.Permissions.CanInteractWithPrimMedia(agentId, part.UUID, omn.Face)) if (!m_scene.Permissions.CanInteractWithPrimMedia(agentId, part.UUID, omn.Face))
return string.Empty; return string.Empty;
@ -484,7 +484,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
return string.Empty; return string.Empty;
if (me.EnableWhiteList) if (me.EnableWhiteList)
{ {
if (!CheckUrlAgainstWhitelist(omn.URL, me.WhiteList)) if (!CheckUrlAgainstWhitelist(omn.URL, me.WhiteList))
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
@ -493,18 +493,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap
return string.Empty; return string.Empty;
} }
} }
me.CurrentURL = omn.URL; me.CurrentURL = omn.URL;
UpdateMediaUrl(part, agentId); UpdateMediaUrl(part, agentId);
part.ScheduleFullUpdate(); part.ScheduleFullUpdate();
part.TriggerScriptChangedEvent(Changed.MEDIA); part.TriggerScriptChangedEvent(Changed.MEDIA);
return OSDParser.SerializeLLSDXmlString(new OSD()); return OSDParser.SerializeLLSDXmlString(new OSD());
} }
/// <summary> /// <summary>
/// Check that the face number is valid for the given prim. /// Check that the face number is valid for the given prim.
@ -519,7 +519,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
int maxFaces = part.GetNumberOfSides() - 1; int maxFaces = part.GetNumberOfSides() - 1;
if (face > maxFaces) if (face > maxFaces)
throw new ArgumentException( throw new ArgumentException(
string.Format("Face argument was {0} but max is {1}", face, maxFaces)); string.Format("Face argument was {0} but max is {1}", face, maxFaces));
} }
/// <summary> /// <summary>
@ -542,9 +542,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
string rawVersion = part.MediaUrl.Substring(5, 10); string rawVersion = part.MediaUrl.Substring(5, 10);
int version = int.Parse(rawVersion); int version = int.Parse(rawVersion);
part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, updateId); part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, updateId);
} }
// m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID); // m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID);
} }
/// <summary> /// <summary>
@ -554,7 +554,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
/// <param name="whitelist"></param> /// <param name="whitelist"></param>
/// <returns>true if the url matches an entry on the whitelist, false otherwise</returns> /// <returns>true if the url matches an entry on the whitelist, false otherwise</returns>
protected bool CheckUrlAgainstWhitelist(string rawUrl, string[] whitelist) protected bool CheckUrlAgainstWhitelist(string rawUrl, string[] whitelist)
{ {
Uri url = new Uri(rawUrl); Uri url = new Uri(rawUrl);
foreach (string origWlUrl in whitelist) foreach (string origWlUrl in whitelist)
@ -575,7 +575,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
if (url.Host.Contains(wlUrl)) if (url.Host.Contains(wlUrl))
{ {
// m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl); // m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl);
return true; return true;
} }
} }
else else
@ -588,7 +588,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
return true; return true;
} }
} }
} }
return false; return false;
} }

View File

@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
protected Scene m_scene = null; protected Scene m_scene = null;
protected IDialogModule m_dialogModule; protected IDialogModule m_dialogModule;
public string Name { get { return "Object BuySell Module"; } } public string Name { get { return "Object BuySell Module"; } }
public Type ReplaceableInterface { get { return null; } } public Type ReplaceableInterface { get { return null; } }
public void Initialise(IConfigSource source) {} public void Initialise(IConfigSource source) {}
@ -78,8 +78,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
public void SubscribeToClientEvents(IClientAPI client) public void SubscribeToClientEvents(IClientAPI client)
{ {
client.OnObjectSaleInfo += ObjectSaleInfo; client.OnObjectSaleInfo += ObjectSaleInfo;
} }
protected void ObjectSaleInfo( protected void ObjectSaleInfo(
IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice) IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice)
@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
part.ParentGroup.HasGroupChanged = true; part.ParentGroup.HasGroupChanged = true;
part.GetProperties(client); part.GetProperties(client);
} }
public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType) public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType)
{ {
@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
} }
else else
{ {
if (m_dialogModule != null) if (m_dialogModule != null)
m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable"); m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable");
return false; return false;
} }
@ -261,6 +261,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
} }
return true; return true;
} }
} }
} }

View File

@ -397,13 +397,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
if (m_groupsModule == null) if (m_groupsModule == null)
m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work"); m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work");
m_moapModule = m_scene.RequestModuleInterface<IMoapModule>(); m_moapModule = m_scene.RequestModuleInterface<IMoapModule>();
// This log line will be commented out when no longer required for debugging // This log line will be commented out when no longer required for debugging
// if (m_moapModule == null) // if (m_moapModule == null)
// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work"); // m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work");
} }
public void Close() public void Close()
@ -1906,7 +1906,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
} }
private bool CanControlPrimMedia(UUID agentID, UUID primID, int face) private bool CanControlPrimMedia(UUID agentID, UUID primID, int face)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}", // "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}",
// agentID, primID, face); // agentID, primID, face);
@ -1918,7 +1918,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (null == part) if (null == part)
return false; return false;
MediaEntry me = m_moapModule.GetMediaEntry(part, face); MediaEntry me = m_moapModule.GetMediaEntry(part, face);
// If there is no existing media entry then it can be controlled (in this context, created). // If there is no existing media entry then it can be controlled (in this context, created).
if (null == me) if (null == me)
@ -1929,7 +1929,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// agentID, primID, face, me.ControlPermissions); // agentID, primID, face, me.ControlPermissions);
return GenericPrimMediaPermission(part, agentID, me.ControlPermissions); return GenericPrimMediaPermission(part, agentID, me.ControlPermissions);
} }
private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face) private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face)
{ {
@ -1952,15 +1952,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// m_log.DebugFormat( // m_log.DebugFormat(
// "[PERMISSIONS]: Checking CanInteractWithPrimMedia for {0} on {1} face {2} with interact permissions {3}", // "[PERMISSIONS]: Checking CanInteractWithPrimMedia for {0} on {1} face {2} with interact permissions {3}",
// agentID, primID, face, me.InteractPermissions); // agentID, primID, face, me.InteractPermissions);
return GenericPrimMediaPermission(part, agentID, me.InteractPermissions); return GenericPrimMediaPermission(part, agentID, me.InteractPermissions);
} }
private bool GenericPrimMediaPermission(SceneObjectPart part, UUID agentID, MediaPermission perms) private bool GenericPrimMediaPermission(SceneObjectPart part, UUID agentID, MediaPermission perms)
{ {
// if (IsAdministrator(agentID)) // if (IsAdministrator(agentID))
// return true; // return true;
if ((perms & MediaPermission.Anyone) == MediaPermission.Anyone) if ((perms & MediaPermission.Anyone) == MediaPermission.Anyone)
return true; return true;
@ -1969,15 +1969,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
{ {
if (agentID == part.OwnerID) if (agentID == part.OwnerID)
return true; return true;
} }
if ((perms & MediaPermission.Group) == MediaPermission.Group) if ((perms & MediaPermission.Group) == MediaPermission.Group)
{ {
if (IsGroupMember(part.GroupID, agentID, 0)) if (IsGroupMember(part.GroupID, agentID, 0))
return true; return true;
} }
return false; return false;
} }
} }
} }

View File

@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
{ {
string xmlstream = "<scene>"; string xmlstream = "<scene>";
List<EntityBase> EntityList = scene.GetEntities(); EntityBase[] EntityList = scene.GetEntities();
List<string> EntityXml = new List<string>(); List<string> EntityXml = new List<string>();
foreach (EntityBase ent in EntityList) foreach (EntityBase ent in EntityList)

View File

@ -165,12 +165,12 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
return SceneXmlLoader.SaveGroupToXml2(grp); return SceneXmlLoader.SaveGroupToXml2(grp);
} }
public void SavePrimListToXml2(List<EntityBase> entityList, string fileName) public void SavePrimListToXml2(EntityBase[] entityList, string fileName)
{ {
SceneXmlLoader.SavePrimListToXml2(entityList, fileName); SceneXmlLoader.SavePrimListToXml2(entityList, fileName);
} }
public void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max) public void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max)
{ {
SceneXmlLoader.SavePrimListToXml2(entityList, stream, min, max); SceneXmlLoader.SavePrimListToXml2(entityList, stream, min, max);
} }

View File

@ -816,7 +816,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
{ {
//m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY);
client.SendLayerData(patchX, patchY, m_scene.Heightmap.GetFloatsSerialised()); client.SendLayerData(patchX, patchY, m_scene.Heightmap.GetFloatsSerialised());
} }
private void StoreUndoState() private void StoreUndoState()
{ {

View File

@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules
{ {
if (m_ready) if (m_ready)
{ {
if(m_scene.GetRootAgentCount() > 0) if (m_scene.GetRootAgentCount() > 0)
{ {
// Ask wind plugin to generate a LL wind array to be cached locally // Ask wind plugin to generate a LL wind array to be cached locally
// Try not to update this too often, as it may involve array copies // Try not to update this too often, as it may involve array copies

View File

@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
double[,] hm = whichScene.Heightmap.GetDoubles(); double[,] hm = whichScene.Heightmap.GetDoubles();
tc = Environment.TickCount; tc = Environment.TickCount;
m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
List<EntityBase> objs = whichScene.GetEntities(); EntityBase[] objs = whichScene.GetEntities();
Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>(); Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>();
//SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>(); //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>();
List<float> z_sortheights = new List<float>(); List<float> z_sortheights = new List<float>();
@ -228,7 +228,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
SceneObjectGroup mapdot = (SceneObjectGroup)obj; SceneObjectGroup mapdot = (SceneObjectGroup)obj;
Color mapdotspot = Color.Gray; // Default color when prim color is white Color mapdotspot = Color.Gray; // Default color when prim color is white
// Loop over prim in group // Loop over prim in group
List<SceneObjectPart> partList = null; List<SceneObjectPart> partList = null;
lock (mapdot.Children) lock (mapdot.Children)
partList = new List<SceneObjectPart>(mapdot.Children.Values); partList = new List<SceneObjectPart>(mapdot.Children.Values);

View File

@ -307,7 +307,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
lock (m_rootAgents) lock (m_rootAgents)
{ {
m_rootAgents.Remove(AgentId); m_rootAgents.Remove(AgentId);
if(m_rootAgents.Count == 0) if (m_rootAgents.Count == 0)
StopThread(); StopThread();
} }
} }

View File

@ -101,7 +101,8 @@ namespace OpenSim.Region.DataSnapshot.Providers
XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "objectdata", ""); XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "objectdata", "");
XmlNode node; XmlNode node;
foreach (EntityBase entity in m_scene.Entities) EntityBase[] entities = m_scene.Entities.GetEntities();
foreach (EntityBase entity in entities)
{ {
// only objects, not avatars // only objects, not avatars
if (entity is SceneObjectGroup) if (entity is SceneObjectGroup)

View File

@ -56,7 +56,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="rot"></param> /// <param name="rot"></param>
/// <param name="attachPos"></param> /// <param name="attachPos"></param>
/// <param name="silent"></param> /// <param name="silent"></param>
/// <returns>true if the object was successfully attached, false otherwise</returns> /// <returns>true if the object was successfully attached, false otherwise</returns>
bool AttachObject( bool AttachObject(
IClientAPI remoteClient, SceneObjectGroup grp, uint AttachmentPt, bool silent); IClientAPI remoteClient, SceneObjectGroup grp, uint AttachmentPt, bool silent);

View File

@ -202,7 +202,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// Backup the inventory to the given data store /// Backup the inventory to the given data store
/// </summary> /// </summary>
/// <param name="datastore"></param> /// <param name="datastore"></param>
void ProcessInventoryBackup(IRegionDataStore datastore); void ProcessInventoryBackup(ISimulationDataService datastore);
uint MaskEffectivePermissions(); uint MaskEffectivePermissions();

View File

@ -0,0 +1,45 @@
/*
* 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 OpenSim.Framework;
using OpenMetaverse;
namespace OpenSim.Region.Framework.Interfaces
{
public interface IEstateDataService
{
EstateSettings LoadEstateSettings(UUID regionID, bool create);
EstateSettings LoadEstateSettings(int estateID);
void StoreEstateSettings(EstateSettings es);
List<int> GetEstates(string search);
bool LinkRegion(UUID regionID, int estateID);
List<UUID> GetRegions(int estateID);
bool DeleteEstate(int estateID);
}
}

View File

@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// Get a group /// Get a group
/// </summary> /// </summary>
/// <param name="GroupID">ID of the group</param> /// <param name="GroupID">ID of the group</param>
/// <returns>The group's data. Null if there is no such group.</returns> /// <returns>The group's data. Null if there is no such group.</returns>
GroupRecord GetGroupRecord(UUID GroupID); GroupRecord GetGroupRecord(UUID GroupID);
void ActivateGroup(IClientAPI remoteClient, UUID groupID); void ActivateGroup(IClientAPI remoteClient, UUID groupID);
@ -74,14 +74,14 @@ namespace OpenSim.Region.Framework.Interfaces
List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID); List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID);
List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID); List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID);
GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID); GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID);
GroupMembershipData[] GetMembershipData(UUID UserID); GroupMembershipData[] GetMembershipData(UUID UserID);
GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID); GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID);
void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish);
void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile); void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile);
void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID); void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID);
GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID); GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID);
string GetGroupTitle(UUID avatarID); string GetGroupTitle(UUID avatarID);

View File

@ -43,14 +43,14 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="reportedException">Contains the exception generated if the save did not succeed</param> /// <param name="reportedException">Contains the exception generated if the save did not succeed</param>
public delegate void InventoryArchiveSaved( public delegate void InventoryArchiveSaved(
Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException); Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException);
public interface IInventoryArchiverModule public interface IInventoryArchiverModule
{ {
/// <summary> /// <summary>
/// Fired when an archive inventory save has been completed. /// Fired when an archive inventory save has been completed.
/// </summary> /// </summary>
event InventoryArchiveSaved OnInventoryArchiveSaved; event InventoryArchiveSaved OnInventoryArchiveSaved;
/// <summary> /// <summary>
/// Dearchive a user's inventory folder from the given stream /// Dearchive a user's inventory folder from the given stream
/// </summary> /// </summary>
@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="loadStream">The stream from which the inventory archive will be loaded</param> /// <param name="loadStream">The stream from which the inventory archive will be loaded</param>
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns> /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream); bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream);
/// <summary> /// <summary>
/// Dearchive a user's inventory folder from the given stream /// Dearchive a user's inventory folder from the given stream
/// </summary> /// </summary>
@ -72,8 +72,8 @@ namespace OpenSim.Region.Framework.Interfaces
/// the loaded IAR with existing folders where possible.</param> /// the loaded IAR with existing folders where possible.</param>
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns> /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
bool DearchiveInventory( bool DearchiveInventory(
string firstName, string lastName, string invPath, string pass, Stream loadStream, string firstName, string lastName, string invPath, string pass, Stream loadStream,
Dictionary<string, object> options); Dictionary<string, object> options);
/// <summary> /// <summary>
/// Archive a user's inventory folder to the given stream /// Archive a user's inventory folder to the given stream
@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="saveStream">The stream to which the inventory archive will be saved</param> /// <param name="saveStream">The stream to which the inventory archive will be saved</param>
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns> /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream); bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream);
/// <summary> /// <summary>
/// Archive a user's inventory folder to the given stream /// Archive a user's inventory folder to the given stream
/// </summary> /// </summary>
@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="options">Archiving options. Currently, there are none.</param> /// <param name="options">Archiving options. Currently, there are none.</param>
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns> /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
bool ArchiveInventory( bool ArchiveInventory(
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
Dictionary<string, object> options); Dictionary<string, object> options);
} }
} }

View File

@ -63,5 +63,5 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="part"></param> /// <param name="part"></param>
/// <param name="face">/param> /// <param name="face">/param>
void ClearMediaEntry(SceneObjectPart part, int face); void ClearMediaEntry(SceneObjectPart part, int face);
} }
} }

View File

@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// </summary> /// </summary>
/// <param name="entityList"></param> /// <param name="entityList"></param>
/// <param name="fileName"></param> /// <param name="fileName"></param>
void SavePrimListToXml2(List<EntityBase> entityList, string fileName); void SavePrimListToXml2(EntityBase[] entityList, string fileName);
/// <summary> /// <summary>
/// Save a set of prims in the xml2 format, optionally specifying a bounding box for which /// Save a set of prims in the xml2 format, optionally specifying a bounding box for which
@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="stream"></param> /// <param name="stream"></param>
/// <param name="min"></param> /// <param name="min"></param>
/// <param name="max"></param> /// <param name="max"></param>
void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max); void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max);
void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName); void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName);

View File

@ -0,0 +1,98 @@
/*
* 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 OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Framework.Interfaces
{
public interface ISimulationDataService
{
/// <summary>
/// Stores all object's details apart from inventory
/// </summary>
/// <param name="obj"></param>
/// <param name="regionUUID"></param>
void StoreObject(SceneObjectGroup obj, UUID regionUUID);
/// <summary>
/// Entirely removes the object, including inventory
/// </summary>
/// <param name="uuid"></param>
/// <param name="regionUUID"></param>
/// <returns></returns>
void RemoveObject(UUID uuid, UUID regionUUID);
/// <summary>
/// Store a prim's inventory
/// </summary>
/// <returns></returns>
void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items);
/// <summary>
/// Load persisted objects from region storage.
/// </summary>
/// <param name="regionUUID">the Region UUID</param>
/// <returns>List of loaded groups</returns>
List<SceneObjectGroup> LoadObjects(UUID regionUUID);
/// <summary>
/// Store a terrain revision in region storage
/// </summary>
/// <param name="ter">HeightField data</param>
/// <param name="regionID">region UUID</param>
void StoreTerrain(double[,] terrain, UUID regionID);
/// <summary>
/// Load the latest terrain revision from region storage
/// </summary>
/// <param name="regionID">the region UUID</param>
/// <returns>Heightfield data</returns>
double[,] LoadTerrain(UUID regionID);
void StoreLandObject(ILandObject Parcel);
/// <summary>
/// <list type="bullet">
/// <item>delete from land where UUID=globalID</item>
/// <item>delete from landaccesslist where LandUUID=globalID</item>
/// </list>
/// </summary>
/// <param name="globalID"></param>
void RemoveLandObject(UUID globalID);
List<LandData> LoadLandObjects(UUID regionUUID);
void StoreRegionSettings(RegionSettings rs);
RegionSettings LoadRegionSettings(UUID regionUUID);
RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID);
void StoreRegionWindlightSettings(RegionLightShareData wl);
}
}

View File

@ -32,7 +32,7 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
{ {
public interface IRegionDataStore public interface ISimulationDataStore
{ {
/// <summary> /// <summary>
/// Initialises the data storage engine /// Initialises the data storage engine

View File

@ -31,7 +31,7 @@ namespace OpenSim.Region.Framework.Interfaces
{ {
/// <summary> /// <summary>
/// Generate a map tile for the scene. a terrain texture for this scene /// Generate a map tile for the scene. a terrain texture for this scene
/// </summary> /// </summary>
void GenerateMaptile(); void GenerateMaptile();
} }
} }

View File

@ -34,227 +34,89 @@ using OpenMetaverse;
namespace OpenSim.Region.Framework.Scenes namespace OpenSim.Region.Framework.Scenes
{ {
public class EntityManager : IEnumerable<EntityBase> public class EntityManager
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly Dictionary<UUID,EntityBase> m_eb_uuid = new Dictionary<UUID, EntityBase>(); private readonly DoubleDictionary<UUID, uint, EntityBase> m_entities = new DoubleDictionary<UUID, uint, EntityBase>();
private readonly Dictionary<uint, EntityBase> m_eb_localID = new Dictionary<uint, EntityBase>();
//private readonly Dictionary<UUID, ScenePresence> m_pres_uuid = new Dictionary<UUID, ScenePresence>();
private System.Threading.ReaderWriterLockSlim m_lock = new System.Threading.ReaderWriterLockSlim();
[Obsolete("Use Add() instead.")] public int Count
public void Add(UUID id, EntityBase eb)
{ {
Add(eb); get { return m_entities.Count; }
} }
public void Add(EntityBase entity) public void Add(EntityBase entity)
{ {
m_lock.EnterWriteLock(); m_entities.Add(entity.UUID, entity.LocalId, entity);
try
{
try
{
m_eb_uuid.Add(entity.UUID, entity);
m_eb_localID.Add(entity.LocalId, entity);
}
catch(Exception e)
{
m_log.ErrorFormat("Add Entity failed: {0}", e.Message);
}
}
finally
{
m_lock.ExitWriteLock();
}
}
public void InsertOrReplace(EntityBase entity)
{
m_lock.EnterWriteLock();
try
{
try
{
m_eb_uuid[entity.UUID] = entity;
m_eb_localID[entity.LocalId] = entity;
}
catch(Exception e)
{
m_log.ErrorFormat("Insert or Replace Entity failed: {0}", e.Message);
}
}
finally
{
m_lock.ExitWriteLock();
}
} }
public void Clear() public void Clear()
{ {
m_lock.EnterWriteLock(); m_entities.Clear();
try
{
m_eb_uuid.Clear();
m_eb_localID.Clear();
}
finally
{
m_lock.ExitWriteLock();
}
}
public int Count
{
get
{
return m_eb_uuid.Count;
}
} }
public bool ContainsKey(UUID id) public bool ContainsKey(UUID id)
{ {
try return m_entities.ContainsKey(id);
{
return m_eb_uuid.ContainsKey(id);
}
catch
{
return false;
}
} }
public bool ContainsKey(uint localID) public bool ContainsKey(uint localID)
{ {
try return m_entities.ContainsKey(localID);
{
return m_eb_localID.ContainsKey(localID);
}
catch
{
return false;
}
} }
public bool Remove(uint localID) public bool Remove(uint localID)
{ {
m_lock.EnterWriteLock(); return m_entities.Remove(localID);
try
{
try
{
bool a = false;
EntityBase entity;
if (m_eb_localID.TryGetValue(localID, out entity))
a = m_eb_uuid.Remove(entity.UUID);
bool b = m_eb_localID.Remove(localID);
return a && b;
}
catch (Exception e)
{
m_log.ErrorFormat("Remove Entity failed for {0}", localID, e);
return false;
}
}
finally
{
m_lock.ExitWriteLock();
}
} }
public bool Remove(UUID id) public bool Remove(UUID id)
{ {
m_lock.EnterWriteLock(); return m_entities.Remove(id);
try
{
try
{
bool a = false;
EntityBase entity;
if (m_eb_uuid.TryGetValue(id, out entity))
a = m_eb_localID.Remove(entity.LocalId);
bool b = m_eb_uuid.Remove(id);
return a && b;
}
catch (Exception e)
{
m_log.ErrorFormat("Remove Entity failed for {0}", id, e);
return false;
}
}
finally
{
m_lock.ExitWriteLock();
}
} }
public List<EntityBase> GetAllByType<T>() public EntityBase[] GetAllByType<T>()
{ {
List<EntityBase> tmp = new List<EntityBase>(); List<EntityBase> tmp = new List<EntityBase>();
m_lock.EnterReadLock(); m_entities.ForEach(
try delegate(EntityBase entity)
{
try
{ {
foreach (KeyValuePair<UUID, EntityBase> pair in m_eb_uuid) if (entity is T)
{ tmp.Add(entity);
if (pair.Value is T)
{
tmp.Add(pair.Value);
}
}
} }
catch (Exception e) );
{
m_log.ErrorFormat("GetAllByType failed for {0}", e);
tmp = null;
}
}
finally
{
m_lock.ExitReadLock();
}
return tmp; return tmp.ToArray();
} }
public List<EntityBase> GetEntities() public EntityBase[] GetEntities()
{ {
m_lock.EnterReadLock(); List<EntityBase> tmp = new List<EntityBase>(m_entities.Count);
try m_entities.ForEach(delegate(EntityBase entity) { tmp.Add(entity); });
{ return tmp.ToArray();
return new List<EntityBase>(m_eb_uuid.Values); }
}
finally public void ForEach(Action<EntityBase> action)
{ {
m_lock.ExitReadLock(); m_entities.ForEach(action);
} }
public EntityBase Find(Predicate<EntityBase> predicate)
{
return m_entities.FindValue(predicate);
} }
public EntityBase this[UUID id] public EntityBase this[UUID id]
{ {
get get
{ {
m_lock.EnterReadLock(); EntityBase entity;
try m_entities.TryGetValue(id, out entity);
{ return entity;
EntityBase entity;
if (m_eb_uuid.TryGetValue(id, out entity))
return entity;
else
return null;
}
finally
{
m_lock.ExitReadLock();
}
} }
set set
{ {
InsertOrReplace(value); Add(value);
} }
} }
@ -262,65 +124,24 @@ namespace OpenSim.Region.Framework.Scenes
{ {
get get
{ {
m_lock.EnterReadLock(); EntityBase entity;
try m_entities.TryGetValue(localID, out entity);
{ return entity;
EntityBase entity;
if (m_eb_localID.TryGetValue(localID, out entity))
return entity;
else
return null;
}
finally
{
m_lock.ExitReadLock();
}
} }
set set
{ {
InsertOrReplace(value); Add(value);
} }
} }
public bool TryGetValue(UUID key, out EntityBase obj) public bool TryGetValue(UUID key, out EntityBase obj)
{ {
m_lock.EnterReadLock(); return m_entities.TryGetValue(key, out obj);
try
{
return m_eb_uuid.TryGetValue(key, out obj);
}
finally
{
m_lock.ExitReadLock();
}
} }
public bool TryGetValue(uint key, out EntityBase obj) public bool TryGetValue(uint key, out EntityBase obj)
{ {
m_lock.EnterReadLock(); return m_entities.TryGetValue(key, out obj);
try
{
return m_eb_localID.TryGetValue(key, out obj);
}
finally
{
m_lock.ExitReadLock();
}
} }
/// <summary>
/// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that.
/// </summary>
/// <returns></returns>
public IEnumerator<EntityBase> GetEnumerator()
{
return GetEntities().GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
} }
} }

View File

@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes
public event OnTerrainUpdateDelegate OnTerrainUpdate; public event OnTerrainUpdateDelegate OnTerrainUpdate;
public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup); public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup);
public event OnBackupDelegate OnBackup; public event OnBackupDelegate OnBackup;
@ -336,7 +336,7 @@ namespace OpenSim.Region.Framework.Scenes
/// If the object is being attached, then the avatarID will be present. If the object is being detached then /// If the object is being attached, then the avatarID will be present. If the object is being detached then
/// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical).
public delegate void Attach(uint localID, UUID itemID, UUID avatarID); public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
public event Attach OnAttach; public event Attach OnAttach;
/// <summary> /// <summary>
/// Called immediately after an object is loaded from storage. /// Called immediately after an object is loaded from storage.
@ -348,7 +348,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Called immediately before an object is saved to storage. /// Called immediately before an object is saved to storage.
/// </summary> /// </summary>
/// <param name="persistingSo"> /// <param name="persistingSo">
/// The scene object being persisted. /// The scene object being persisted.
/// This is actually a copy of the original scene object so changes made here will be saved to storage but will not be kept in memory. /// This is actually a copy of the original scene object so changes made here will be saved to storage but will not be kept in memory.
/// </param> /// </param>
/// <param name="originalSo"> /// <param name="originalSo">
@ -367,7 +367,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed);
public delegate void RegionUp(GridRegion region); public delegate void RegionUp(GridRegion region);
public event RegionUp OnRegionUp; public event RegionUp OnRegionUp;
public class MoneyTransferArgs : EventArgs public class MoneyTransferArgs : EventArgs
{ {
@ -688,7 +688,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public void TriggerOnBackup(IRegionDataStore dstore, bool forced) public void TriggerOnBackup(ISimulationDataService dstore, bool forced)
{ {
OnBackupDelegate handlerOnAttach = OnBackup; OnBackupDelegate handlerOnAttach = OnBackup;
if (handlerOnAttach != null) if (handlerOnAttach != null)
@ -2087,7 +2087,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
} }
public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo) public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo)
{ {
@ -2129,7 +2129,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
} }
public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
int local_id, IClientAPI remote_client) int local_id, IClientAPI remote_client)
@ -2151,6 +2151,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
} }
} }
} }

View File

@ -1,3 +1,30 @@
/*
* 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;
using System.Collections.Generic; using System.Collections.Generic;
using log4net; using log4net;
@ -35,7 +62,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// This is added to the priority of all child prims, to make sure that the root prim update is sent to the /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the
/// viewer before child prim updates. /// viewer before child prim updates.
/// The adjustment is added to child prims and subtracted from root prims, so the gap ends up /// The adjustment is added to child prims and subtracted from root prims, so the gap ends up
/// being double. We do it both ways so that there is a still a priority delta even if the priority is already /// being double. We do it both ways so that there is a still a priority delta even if the priority is already
/// double.MinValue or double.MaxValue. /// double.MinValue or double.MaxValue.
@ -123,9 +150,9 @@ namespace OpenSim.Region.Framework.Scenes
if (entity is SceneObjectPart) if (entity is SceneObjectPart)
{ {
// Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
// before its scheduled update was triggered // before its scheduled update was triggered
//entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
} }
else else
{ {
@ -152,15 +179,10 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 entityPos = entity.AbsolutePosition; Vector3 entityPos = entity.AbsolutePosition;
if (entity is SceneObjectPart) if (entity is SceneObjectPart)
{ {
SceneObjectGroup group = m_scene.GetGroupByPrim(entity.LocalId); // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
if (group == null) // before its scheduled update was triggered
{ //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
entityPos = entity.AbsolutePosition; entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
}
else
{
entityPos = group.AbsolutePosition;
}
} }
else else
{ {

View File

@ -58,7 +58,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
foreach (EntityBase group in Entities) EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase group in entities)
{ {
if (group is SceneObjectGroup) if (group is SceneObjectGroup)
{ {
@ -132,7 +133,7 @@ namespace OpenSim.Region.Framework.Scenes
item.Owner, item.Name, item.ID); item.Owner, item.Name, item.ID);
return false; return false;
} }
} }
/// <summary> /// <summary>
@ -1987,7 +1988,7 @@ namespace OpenSim.Region.Framework.Scenes
return null; return null;
if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos)) if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos))
return null; return null;
if (!Permissions.BypassPermissions()) if (!Permissions.BypassPermissions())
{ {
@ -2065,7 +2066,7 @@ namespace OpenSim.Region.Framework.Scenes
List<SceneObjectPart> partList = null; List<SceneObjectPart> partList = null;
lock (sog.Children) lock (sog.Children)
partList = new List<SceneObjectPart>(sog.Children.Values); partList = new List<SceneObjectPart>(sog.Children.Values);
foreach (SceneObjectPart child in partList) foreach (SceneObjectPart child in partList)
child.Inventory.ChangeInventoryOwner(ownerID); child.Inventory.ChangeInventoryOwner(ownerID);
@ -2080,7 +2081,7 @@ namespace OpenSim.Region.Framework.Scenes
List<SceneObjectPart> partList = null; List<SceneObjectPart> partList = null;
lock (sog.Children) lock (sog.Children)
partList = new List<SceneObjectPart>(sog.Children.Values); partList = new List<SceneObjectPart>(sog.Children.Values);
foreach (SceneObjectPart child in partList) foreach (SceneObjectPart child in partList)
{ {
@ -2090,7 +2091,7 @@ namespace OpenSim.Region.Framework.Scenes
sog.SetOwnerId(groupID); sog.SetOwnerId(groupID);
sog.ApplyNextOwnerPermissions(); sog.ApplyNextOwnerPermissions();
} }
} }
foreach (uint localID in localIDs) foreach (uint localID in localIDs)

View File

@ -116,9 +116,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
public void RequestPrim(uint primLocalID, IClientAPI remoteClient) public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
{ {
List<EntityBase> EntityList = GetEntities(); EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
foreach (EntityBase ent in EntityList)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
@ -138,9 +137,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
public void SelectPrim(uint primLocalID, IClientAPI remoteClient) public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
{ {
List<EntityBase> EntityList = GetEntities(); EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
foreach (EntityBase ent in EntityList)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
@ -166,7 +164,7 @@ namespace OpenSim.Region.Framework.Scenes
List<SceneObjectPart> partList = null; List<SceneObjectPart> partList = null;
lock (sog.Children) lock (sog.Children)
partList = new List<SceneObjectPart>(sog.Children.Values); partList = new List<SceneObjectPart>(sog.Children.Values);
foreach (SceneObjectPart part in partList) foreach (SceneObjectPart part in partList)
{ {
@ -259,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
{ {
List<EntityBase> EntityList = GetEntities(); EntityBase[] EntityList = GetEntities();
SurfaceTouchEventArgs surfaceArg = null; SurfaceTouchEventArgs surfaceArg = null;
if (surfaceArgs != null && surfaceArgs.Count > 0) if (surfaceArgs != null && surfaceArgs.Count > 0)
@ -303,7 +301,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
{ {
List<EntityBase> EntityList = GetEntities(); EntityBase[] EntityList = GetEntities();
SurfaceTouchEventArgs surfaceArg = null; SurfaceTouchEventArgs surfaceArg = null;
if (surfaceArgs != null && surfaceArgs.Count > 0) if (surfaceArgs != null && surfaceArgs.Count > 0)
@ -343,7 +341,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
{ {
List<EntityBase> EntityList = GetEntities(); EntityBase[] EntityList = GetEntities();
SurfaceTouchEventArgs surfaceArg = null; SurfaceTouchEventArgs surfaceArg = null;
if (surfaceArgs != null && surfaceArgs.Count > 0) if (surfaceArgs != null && surfaceArgs.Count > 0)

View File

@ -997,6 +997,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
return true; return true;
} }
} }
} }

View File

@ -57,55 +57,21 @@ namespace OpenSim.Region.Framework.Scenes
public partial class Scene : SceneBase public partial class Scene : SceneBase
{ {
public delegate void SynchronizeSceneHandler(Scene scene);
public SynchronizeSceneHandler SynchronizeScene = null;
/* Used by the loadbalancer plugin on GForge */
protected int m_splitRegionID = 0;
public int SplitRegionID
{
get { return m_splitRegionID; }
set { m_splitRegionID = value; }
}
private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L;
private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L;
public delegate void SynchronizeSceneHandler(Scene scene);
#region Fields #region Fields
protected Timer m_restartWaitTimer = new Timer(); public SynchronizeSceneHandler SynchronizeScene;
public SimStatsReporter StatsReporter; public SimStatsReporter StatsReporter;
protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
private volatile int m_bordersLocked = 0;
public bool BordersLocked
{
get { return m_bordersLocked == 1; }
set
{
if (value == true)
m_bordersLocked = 1;
else
m_bordersLocked = 0;
}
}
public List<Border> NorthBorders = new List<Border>(); public List<Border> NorthBorders = new List<Border>();
public List<Border> EastBorders = new List<Border>(); public List<Border> EastBorders = new List<Border>();
public List<Border> SouthBorders = new List<Border>(); public List<Border> SouthBorders = new List<Border>();
public List<Border> WestBorders = new List<Border>(); public List<Border> WestBorders = new List<Border>();
/// <value> /// <summary>Are we applying physics to any of the prims in this scene?</summary>
/// The scene graph for this scene
/// </value>
/// TODO: Possibly stop other classes being able to manipulate this directly.
private SceneGraph m_sceneGraph;
/// <summary>
/// Are we applying physics to any of the prims in this scene?
/// </summary>
public bool m_physicalPrim; public bool m_physicalPrim;
public float m_maxNonphys = 256; public float m_maxNonphys = 256;
public float m_maxPhys = 10; public float m_maxPhys = 10;
@ -119,25 +85,131 @@ namespace OpenSim.Region.Framework.Scenes
// root agents when ACL denies access to root agent // root agents when ACL denies access to root agent
public bool m_strictAccessControl = true; public bool m_strictAccessControl = true;
public int MaxUndoCount = 5; public int MaxUndoCount = 5;
public bool LoginsDisabled = true;
public bool LoadingPrims;
public IXfer XferManager;
// the minimum time that must elapse before a changed object will be considered for persisted
public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L;
// the maximum time that must elapse before a changed object will be considered for persisted
public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L;
protected int m_splitRegionID;
protected Timer m_restartWaitTimer = new Timer();
protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
protected string m_simulatorVersion = "OpenSimulator Server";
protected ModuleLoader m_moduleLoader;
protected AgentCircuitManager m_authenticateHandler;
protected SceneCommunicationService m_sceneGridService;
protected ISnmpModule m_snmpService = null;
protected ISimulationDataService m_SimulationDataService;
protected IEstateDataService m_EstateDataService;
protected IAssetService m_AssetService;
protected IAuthorizationService m_AuthorizationService;
protected IInventoryService m_InventoryService;
protected IGridService m_GridService;
protected ILibraryService m_LibraryService;
protected ISimulationService m_simulationService;
protected IAuthenticationService m_AuthenticationService;
protected IPresenceService m_PresenceService;
protected IUserAccountService m_UserAccountService;
protected IAvatarService m_AvatarService;
protected IGridUserService m_GridUserService;
protected IXMLRPC m_xmlrpcModule;
protected IWorldComm m_worldCommModule;
protected IAvatarFactory m_AvatarFactory;
protected IConfigSource m_config;
protected IRegionSerialiserModule m_serialiser;
protected IDialogModule m_dialogModule;
protected IEntityTransferModule m_teleportModule;
protected ICapabilitiesModule m_capsModule;
// Central Update Loop
protected int m_fps = 10;
protected uint m_frame;
protected float m_timespan = 0.089f;
protected DateTime m_lastupdate = DateTime.UtcNow;
// TODO: Possibly stop other classes being able to manipulate this directly.
private SceneGraph m_sceneGraph;
private volatile int m_bordersLocked;
private int m_RestartTimerCounter; private int m_RestartTimerCounter;
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
private int m_incrementsof15seconds; private int m_incrementsof15seconds;
private volatile bool m_backingup; private volatile bool m_backingup;
private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>();
private Object m_heartbeatLock = new Object();
protected string m_simulatorVersion = "OpenSimulator Server"; private int m_update_physics = 1;
private int m_update_entitymovement = 1;
private int m_update_objects = 1; // Update objects which have scheduled themselves for updates
private int m_update_presences = 1; // Update scene presence movements
private int m_update_events = 1;
private int m_update_backup = 200;
private int m_update_terrain = 50;
private int m_update_land = 1;
private int m_update_coarse_locations = 50;
protected ModuleLoader m_moduleLoader; private int frameMS;
protected StorageManager m_storageManager; private int physicsMS2;
protected AgentCircuitManager m_authenticateHandler; private int physicsMS;
private int otherMS;
private int tempOnRezMS;
private int eventMS;
private int backupMS;
private int terrainMS;
private int landMS;
private int lastCompletedFrame;
protected SceneCommunicationService m_sceneGridService;
public bool LoginsDisabled = true;
public bool LoadingPrims = false;
public bool CombineRegions = false; public bool CombineRegions = false;
private bool m_physics_enabled = true;
private bool m_scripts_enabled = true;
private string m_defaultScriptEngine;
private int m_LastLogin;
private Thread HeartbeatThread;
private volatile bool shuttingdown;
private int m_lastUpdate;
private bool m_firstHeartbeat = true;
private object m_deleting_scene_object = new object();
private object m_cleaningAttachments = new object();
private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
private bool m_reprioritizationEnabled = true;
private double m_reprioritizationInterval = 5000.0;
private double m_rootReprioritizationDistance = 10.0;
private double m_childReprioritizationDistance = 20.0;
private Timer m_mapGenerationTimer = new Timer();
private bool m_generateMaptiles;
#endregion Fields
#region Properties
/* Used by the loadbalancer plugin on GForge */
public int SplitRegionID
{
get { return m_splitRegionID; }
set { m_splitRegionID = value; }
}
public bool BordersLocked
{
get { return m_bordersLocked == 1; }
set
{
if (value == true)
m_bordersLocked = 1;
else
m_bordersLocked = 0;
}
}
public new float TimeDilation public new float TimeDilation
{ {
get { return m_sceneGraph.PhysicsScene.TimeDilation; } get { return m_sceneGraph.PhysicsScene.TimeDilation; }
@ -148,9 +220,6 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_sceneGridService; } get { return m_sceneGridService; }
} }
public IXfer XferManager;
protected ISnmpModule m_snmpService = null;
public ISnmpModule SnmpService public ISnmpModule SnmpService
{ {
get get
@ -164,10 +233,41 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected IAssetService m_AssetService; public ISimulationDataService SimulationDataService
protected IAuthorizationService m_AuthorizationService; {
get
{
if (m_SimulationDataService == null)
{
m_SimulationDataService = RequestModuleInterface<ISimulationDataService>();
private Object m_heartbeatLock = new Object(); if (m_SimulationDataService == null)
{
throw new Exception("No ISimulationDataService available.");
}
}
return m_SimulationDataService;
}
}
public IEstateDataService EstateDataService
{
get
{
if (m_EstateDataService == null)
{
m_EstateDataService = RequestModuleInterface<IEstateDataService>();
if (m_EstateDataService == null)
{
throw new Exception("No IEstateDataService available.");
}
}
return m_EstateDataService;
}
}
public IAssetService AssetService public IAssetService AssetService
{ {
@ -206,8 +306,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected IInventoryService m_InventoryService;
public IInventoryService InventoryService public IInventoryService InventoryService
{ {
get get
@ -226,8 +324,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected IGridService m_GridService;
public IGridService GridService public IGridService GridService
{ {
get get
@ -246,8 +342,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected ILibraryService m_LibraryService;
public ILibraryService LibraryService public ILibraryService LibraryService
{ {
get get
@ -259,7 +353,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected ISimulationService m_simulationService;
public ISimulationService SimulationService public ISimulationService SimulationService
{ {
get get
@ -270,7 +363,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected IAuthenticationService m_AuthenticationService;
public IAuthenticationService AuthenticationService public IAuthenticationService AuthenticationService
{ {
get get
@ -281,7 +373,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected IPresenceService m_PresenceService;
public IPresenceService PresenceService public IPresenceService PresenceService
{ {
get get
@ -291,7 +382,7 @@ namespace OpenSim.Region.Framework.Scenes
return m_PresenceService; return m_PresenceService;
} }
} }
protected IUserAccountService m_UserAccountService;
public IUserAccountService UserAccountService public IUserAccountService UserAccountService
{ {
get get
@ -302,8 +393,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected OpenSim.Services.Interfaces.IAvatarService m_AvatarService; public IAvatarService AvatarService
public OpenSim.Services.Interfaces.IAvatarService AvatarService
{ {
get get
{ {
@ -313,7 +403,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected IGridUserService m_GridUserService;
public IGridUserService GridUserService public IGridUserService GridUserService
{ {
get get
@ -324,58 +413,18 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected IXMLRPC m_xmlrpcModule;
protected IWorldComm m_worldCommModule;
public IAttachmentsModule AttachmentsModule { get; set; } public IAttachmentsModule AttachmentsModule { get; set; }
protected IAvatarFactory m_AvatarFactory;
public IAvatarFactory AvatarFactory public IAvatarFactory AvatarFactory
{ {
get { return m_AvatarFactory; } get { return m_AvatarFactory; }
} }
protected IConfigSource m_config;
protected IRegionSerialiserModule m_serialiser;
protected IDialogModule m_dialogModule;
protected IEntityTransferModule m_teleportModule;
protected ICapabilitiesModule m_capsModule;
public ICapabilitiesModule CapsModule public ICapabilitiesModule CapsModule
{ {
get { return m_capsModule; } get { return m_capsModule; }
} }
protected override IConfigSource GetConfig()
{
return m_config;
}
// Central Update Loop
protected int m_fps = 10;
protected uint m_frame;
protected float m_timespan = 0.089f;
protected DateTime m_lastupdate = DateTime.UtcNow;
private int m_update_physics = 1;
private int m_update_entitymovement = 1;
private int m_update_objects = 1; // Update objects which have scheduled themselves for updates
private int m_update_presences = 1; // Update scene presence movements
private int m_update_events = 1;
private int m_update_backup = 200;
private int m_update_terrain = 50;
private int m_update_land = 1;
private int m_update_coarse_locations = 50;
private int frameMS;
private int physicsMS2;
private int physicsMS;
private int otherMS;
private int tempOnRezMS;
private int eventMS;
private int backupMS;
private int terrainMS;
private int landMS;
private int lastCompletedFrame;
public int MonitorFrameTime { get { return frameMS; } } public int MonitorFrameTime { get { return frameMS; } }
public int MonitorPhysicsUpdateTime { get { return physicsMS; } } public int MonitorPhysicsUpdateTime { get { return physicsMS; } }
public int MonitorPhysicsSyncTime { get { return physicsMS2; } } public int MonitorPhysicsSyncTime { get { return physicsMS2; } }
@ -387,37 +436,6 @@ namespace OpenSim.Region.Framework.Scenes
public int MonitorLandTime { get { return landMS; } } public int MonitorLandTime { get { return landMS; } }
public int MonitorLastFrameTick { get { return lastCompletedFrame; } } public int MonitorLastFrameTick { get { return lastCompletedFrame; } }
private bool m_physics_enabled = true;
private bool m_scripts_enabled = true;
private string m_defaultScriptEngine;
private int m_LastLogin;
private Thread HeartbeatThread;
private volatile bool shuttingdown;
private int m_lastUpdate;
private bool m_firstHeartbeat = true;
private object m_deleting_scene_object = new object();
private object m_cleaningAttachments = new object();
// the minimum time that must elapse before a changed object will be considered for persisted
public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L;
// the maximum time that must elapse before a changed object will be considered for persisted
public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L;
private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
private bool m_reprioritizationEnabled = true;
private double m_reprioritizationInterval = 5000.0;
private double m_rootReprioritizationDistance = 10.0;
private double m_childReprioritizationDistance = 20.0;
private Timer m_mapGenerationTimer = new Timer();
bool m_generateMaptiles = false;
#endregion
#region Properties
public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } } public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } }
public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } } public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } }
public double ReprioritizationInterval { get { return m_reprioritizationInterval; } } public double ReprioritizationInterval { get { return m_reprioritizationInterval; } }
@ -497,13 +515,13 @@ namespace OpenSim.Region.Framework.Scenes
set { m_sceneGraph.RestorePresences = value; } set { m_sceneGraph.RestorePresences = value; }
} }
#endregion #endregion Properties
#region Constructors #region Constructors
public Scene(RegionInfo regInfo, AgentCircuitManager authen, public Scene(RegionInfo regInfo, AgentCircuitManager authen,
SceneCommunicationService sceneGridService, SceneCommunicationService sceneGridService,
StorageManager storeManager, ISimulationDataService simDataService, IEstateDataService estateDataService,
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim,
bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion)
{ {
@ -539,7 +557,8 @@ namespace OpenSim.Region.Framework.Scenes
m_moduleLoader = moduleLoader; m_moduleLoader = moduleLoader;
m_authenticateHandler = authen; m_authenticateHandler = authen;
m_sceneGridService = sceneGridService; m_sceneGridService = sceneGridService;
m_storageManager = storeManager; m_SimulationDataService = simDataService;
m_EstateDataService = estateDataService;
m_regInfo = regInfo; m_regInfo = regInfo;
m_regionHandle = m_regInfo.RegionHandle; m_regionHandle = m_regInfo.RegionHandle;
m_regionName = m_regInfo.RegionName; m_regionName = m_regInfo.RegionName;
@ -558,13 +577,11 @@ namespace OpenSim.Region.Framework.Scenes
#region Region Settings #region Region Settings
// Load region settings // Load region settings
m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(m_regInfo.RegionID);
m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(m_regInfo.RegionID);
if (m_storageManager.EstateDataStore != null) m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID);
{ if (estateDataService != null)
m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
}
#endregion Region Settings #endregion Region Settings
@ -574,9 +591,9 @@ namespace OpenSim.Region.Framework.Scenes
//Bind Storage Manager functions to some land manager functions for this scene //Bind Storage Manager functions to some land manager functions for this scene
EventManager.OnLandObjectAdded += EventManager.OnLandObjectAdded +=
new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject); new EventManager.LandObjectAdded(simDataService.StoreLandObject);
EventManager.OnLandObjectRemoved += EventManager.OnLandObjectRemoved +=
new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject); new EventManager.LandObjectRemoved(simDataService.RemoveLandObject);
m_sceneGraph = new SceneGraph(this, m_regInfo); m_sceneGraph = new SceneGraph(this, m_regInfo);
@ -1062,29 +1079,30 @@ namespace OpenSim.Region.Framework.Scenes
if (ScriptEngine) if (ScriptEngine)
{ {
m_log.Info("Stopping all Scripts in Scene"); m_log.Info("Stopping all Scripts in Scene");
foreach (EntityBase ent in Entities)
EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase ent in entities)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ ((SceneObjectGroup)ent).RemoveScriptInstances(false);
((SceneObjectGroup) ent).RemoveScriptInstances(false);
}
} }
} }
else else
{ {
m_log.Info("Starting all Scripts in Scene"); m_log.Info("Starting all Scripts in Scene");
lock (Entities)
EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase ent in entities)
{ {
foreach (EntityBase ent in Entities) if (ent is SceneObjectGroup)
{ {
if (ent is SceneObjectGroup) SceneObjectGroup sog = (SceneObjectGroup)ent;
{ sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0); sog.ResumeScripts();
((SceneObjectGroup)ent).ResumeScripts();
}
} }
} }
} }
m_scripts_enabled = !ScriptEngine; m_scripts_enabled = !ScriptEngine;
m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine");
} }
@ -1131,12 +1149,12 @@ namespace OpenSim.Region.Framework.Scenes
shuttingdown = true; shuttingdown = true;
m_log.Debug("[SCENE]: Persisting changed objects"); m_log.Debug("[SCENE]: Persisting changed objects");
List<EntityBase> entities = GetEntities(); EntityBase[] entities = GetEntities();
foreach (EntityBase entity in entities) foreach (EntityBase entity in entities)
{ {
if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged)
{ {
((SceneObjectGroup)entity).ProcessBackup(m_storageManager.DataStore, false); ((SceneObjectGroup)entity).ProcessBackup(SimulationDataService, false);
} }
} }
@ -1192,8 +1210,9 @@ namespace OpenSim.Region.Framework.Scenes
while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
{ {
MainConsole.Instance.Output("The current estate has no owner set."); MainConsole.Instance.Output("The current estate has no owner set.");
string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test"); List<char> excluded = new List<char>(new char[1]{' '});
string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User"); string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);
@ -1577,7 +1596,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
lock (m_returns) lock (m_returns)
{ {
EventManager.TriggerOnBackup(m_storageManager.DataStore, forced); EventManager.TriggerOnBackup(SimulationDataService, forced);
m_backingup = false; m_backingup = false;
foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns)
@ -1618,7 +1637,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (group != null) if (group != null)
{ {
group.ProcessBackup(m_storageManager.DataStore, true); group.ProcessBackup(SimulationDataService, true);
} }
} }
@ -1660,20 +1679,19 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void SaveTerrain() public void SaveTerrain()
{ {
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
} }
public void StoreWindlightProfile(RegionLightShareData wl) public void StoreWindlightProfile(RegionLightShareData wl)
{ {
m_regInfo.WindlightSettings = wl; m_regInfo.WindlightSettings = wl;
wl.Save(); SimulationDataService.StoreRegionWindlightSettings(wl);
m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
m_eventManager.TriggerOnSaveNewWindlightProfile(); m_eventManager.TriggerOnSaveNewWindlightProfile();
} }
public void LoadWindlightProfile() public void LoadWindlightProfile()
{ {
m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(RegionInfo.RegionID); m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID);
m_eventManager.TriggerOnSaveNewWindlightProfile(); m_eventManager.TriggerOnSaveNewWindlightProfile();
} }
@ -1684,13 +1702,13 @@ namespace OpenSim.Region.Framework.Scenes
{ {
try try
{ {
double[,] map = m_storageManager.DataStore.LoadTerrain(RegionInfo.RegionID); double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID);
if (map == null) if (map == null)
{ {
m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain."); m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain.");
Heightmap = new TerrainChannel(); Heightmap = new TerrainChannel();
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
} }
else else
{ {
@ -1707,7 +1725,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
Heightmap = new TerrainChannel(); Heightmap = new TerrainChannel();
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
} }
} }
catch (Exception e) catch (Exception e)
@ -1754,7 +1772,7 @@ namespace OpenSim.Region.Framework.Scenes
public void loadAllLandObjectsFromStorage(UUID regionID) public void loadAllLandObjectsFromStorage(UUID regionID)
{ {
m_log.Info("[SCENE]: Loading land objects from storage"); m_log.Info("[SCENE]: Loading land objects from storage");
List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(regionID); List<LandData> landData = SimulationDataService.LoadLandObjects(regionID);
if (LandChannel != null) if (LandChannel != null)
{ {
@ -1785,7 +1803,7 @@ namespace OpenSim.Region.Framework.Scenes
LoadingPrims = true; LoadingPrims = true;
m_log.Info("[SCENE]: Loading objects from datastore"); m_log.Info("[SCENE]: Loading objects from datastore");
List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID); List<SceneObjectGroup> PrimsFromDB = SimulationDataService.LoadObjects(regionID);
m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count + " objects from the datastore"); m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count + " objects from the datastore");
@ -1978,7 +1996,7 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.ScheduleGroupForFullUpdate(); sceneObject.ScheduleGroupForFullUpdate();
return sceneObject; return sceneObject;
} }
/// <summary> /// <summary>
/// Add an object into the scene that has come from storage /// Add an object into the scene that has come from storage
@ -2074,7 +2092,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns> /// <returns></returns>
public bool AddNewSceneObject( public bool AddNewSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
{ {
return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel); return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel);
} }
@ -2094,8 +2112,7 @@ namespace OpenSim.Region.Framework.Scenes
List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>();
lock (Entities) lock (Entities)
{ {
ICollection<EntityBase> entities = new List<EntityBase>(Entities); EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase e in entities) foreach (EntityBase e in entities)
{ {
if (e is SceneObjectGroup) if (e is SceneObjectGroup)
@ -2190,12 +2207,12 @@ namespace OpenSim.Region.Framework.Scenes
// group has recently been delinked from another group but that this change has not been persisted // group has recently been delinked from another group but that this change has not been persisted
// to the DB. // to the DB.
ForceSceneObjectBackup(so); ForceSceneObjectBackup(so);
so.DetachFromBackup(); so.DetachFromBackup();
m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID); SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID);
} }
// We need to keep track of this state in case this group is still queued for further backup. // We need to keep track of this state in case this group is still queued for further backup.
so.IsDeleted = true; so.IsDeleted = true;
return true; return true;
} }
@ -2482,7 +2499,7 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence sp = GetScenePresence(userID); ScenePresence sp = GetScenePresence(userID);
if (sp != null && AttachmentsModule != null) if (sp != null && AttachmentsModule != null)
{ {
uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID);
AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt); AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt);
} }
@ -2531,7 +2548,7 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.RootPart.AddFlag(PrimFlags.Phantom); sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
// Don't sent a full update here because this will cause full updates to be sent twice for // Don't sent a full update here because this will cause full updates to be sent twice for
// attachments on region crossings, resulting in viewer glitches. // attachments on region crossings, resulting in viewer glitches.
AddRestoredSceneObject(sceneObject, false, false, false); AddRestoredSceneObject(sceneObject, false, false, false);
// Handle attachment special case // Handle attachment special case
@ -2788,7 +2805,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
public virtual void SubscribeToClientPrimEvents(IClientAPI client) public virtual void SubscribeToClientPrimEvents(IClientAPI client)
{ {
client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition;
client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition;
client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation;
@ -2824,7 +2841,7 @@ namespace OpenSim.Region.Framework.Scenes
client.OnUndo += m_sceneGraph.HandleUndo; client.OnUndo += m_sceneGraph.HandleUndo;
client.OnRedo += m_sceneGraph.HandleRedo; client.OnRedo += m_sceneGraph.HandleRedo;
client.OnObjectDescription += m_sceneGraph.PrimDescription; client.OnObjectDescription += m_sceneGraph.PrimDescription;
client.OnObjectDrop += m_sceneGraph.DropObject; client.OnObjectDrop += m_sceneGraph.DropObject;
client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable;
client.OnObjectOwner += ObjectOwner; client.OnObjectOwner += ObjectOwner;
} }
@ -3804,7 +3821,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
{ {
ScenePresence presence = GetScenePresence(agentID); ScenePresence presence = GetScenePresence(agentID);
if(presence != null) if (presence != null)
{ {
try try
{ {
@ -4083,6 +4100,11 @@ namespace OpenSim.Region.Framework.Scenes
#region Other Methods #region Other Methods
protected override IConfigSource GetConfig()
{
return m_config;
}
#endregion #endregion
public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set)
@ -4107,9 +4129,8 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void ForceClientUpdate() public void ForceClientUpdate()
{ {
List<EntityBase> EntityList = GetEntities(); EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
foreach (EntityBase ent in EntityList)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
@ -4127,9 +4148,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'"); m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'");
List<EntityBase> EntityList = GetEntities(); EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
foreach (EntityBase ent in EntityList)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
@ -4498,7 +4518,7 @@ namespace OpenSim.Region.Framework.Scenes
/// will not affect the original list of objects in the scene. /// will not affect the original list of objects in the scene.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<EntityBase> GetEntities() public EntityBase[] GetEntities()
{ {
return m_sceneGraph.GetEntities(); return m_sceneGraph.GetEntities();
} }
@ -4532,9 +4552,8 @@ namespace OpenSim.Region.Framework.Scenes
public void CleanTempObjects() public void CleanTempObjects()
{ {
List<EntityBase> objs = GetEntities(); EntityBase[] entities = GetEntities();
foreach (EntityBase obj in entities)
foreach (EntityBase obj in objs)
{ {
if (obj is SceneObjectGroup) if (obj is SceneObjectGroup)
{ {
@ -4554,7 +4573,7 @@ namespace OpenSim.Region.Framework.Scenes
public void DeleteFromStorage(UUID uuid) public void DeleteFromStorage(UUID uuid)
{ {
m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID); SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID);
} }
public int GetHealth() public int GetHealth()
@ -4963,17 +4982,21 @@ namespace OpenSim.Region.Framework.Scenes
public List<UUID> GetEstateRegions(int estateID) public List<UUID> GetEstateRegions(int estateID)
{ {
if (m_storageManager.EstateDataStore == null) IEstateDataService estateDataService = EstateDataService;
return new List<UUID>(); if (estateDataService == null)
return new List<UUID>(0);
return m_storageManager.EstateDataStore.GetRegions(estateID); return estateDataService.GetRegions(estateID);
} }
public void ReloadEstateData() public void ReloadEstateData()
{ {
m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); IEstateDataService estateDataService = EstateDataService;
if (estateDataService != null)
TriggerEstateSunUpdate(); {
m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
TriggerEstateSunUpdate();
}
} }
public void TriggerEstateSunUpdate() public void TriggerEstateSunUpdate()

View File

@ -521,7 +521,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="shorthelp"></param> /// <param name="shorthelp"></param>
/// <param name="longhelp"></param> /// <param name="longhelp"></param>
/// <param name="descriptivehelp"></param> /// <param name="descriptivehelp"></param>
/// <param name="callback"></param> /// <param name="callback"></param>
public void AddCommand( public void AddCommand(
object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
{ {

View File

@ -81,10 +81,7 @@ namespace OpenSim.Region.Framework.Scenes
protected Dictionary<UUID, ScenePresence> m_scenePresenceMap = new Dictionary<UUID, ScenePresence>(); protected Dictionary<UUID, ScenePresence> m_scenePresenceMap = new Dictionary<UUID, ScenePresence>();
protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>(); protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>();
// SceneObjects is not currently populated or used.
//public Dictionary<UUID, SceneObjectGroup> SceneObjects;
protected internal EntityManager Entities = new EntityManager(); protected internal EntityManager Entities = new EntityManager();
// protected internal Dictionary<UUID, EntityBase> Entities = new Dictionary<UUID, EntityBase>();
protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>(); protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>();
protected RegionInfo m_regInfo; protected RegionInfo m_regInfo;
@ -323,7 +320,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="pos">Position of the object</param> /// <param name="pos">Position of the object</param>
/// <param name="rot">Rotation of the object</param> /// <param name="rot">Rotation of the object</param>
/// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param>
/// <returns></returns> /// <returns></returns>
public bool AddNewSceneObject( public bool AddNewSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
{ {
@ -347,7 +344,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
return true; return true;
} }
/// <summary> /// <summary>
/// Add an object to the scene. This will both update the scene, and send information about the /// Add an object to the scene. This will both update the scene, and send information about the
@ -370,69 +367,58 @@ namespace OpenSim.Region.Framework.Scenes
if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
return false; return false;
lock (sceneObject) if (Entities.ContainsKey(sceneObject.UUID))
{ return false;
if (Entities.ContainsKey(sceneObject.UUID))
{
// m_log.WarnFormat(
// "[SCENE GRAPH]: Scene object {0} {1} was already in region {2} on add request",
// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
return false;
}
// m_log.DebugFormat(
// "[SCENE GRAPH]: Adding object {0} {1} to region {2}",
// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
lock (sceneObject.Children)
{
if (m_parentScene.m_clampPrimSize)
{
foreach (SceneObjectPart part in sceneObject.Children.Values)
{
Vector3 scale = part.Shape.Scale;
if (scale.X > m_parentScene.m_maxNonphys)
scale.X = m_parentScene.m_maxNonphys;
if (scale.Y > m_parentScene.m_maxNonphys)
scale.Y = m_parentScene.m_maxNonphys;
if (scale.Z > m_parentScene.m_maxNonphys)
scale.Z = m_parentScene.m_maxNonphys;
part.Shape.Scale = scale;
}
}
m_numPrim += sceneObject.Children.Count;
}
sceneObject.AttachToScene(m_parentScene);
if (sendClientUpdates) List<SceneObjectPart> children;
sceneObject.ScheduleGroupForFullUpdate(); lock (sceneObject.Children)
children = new List<SceneObjectPart>(sceneObject.Children.Values);
Entities.Add(sceneObject);
if (attachToBackup) // Clamp child prim sizes and add child prims to the m_numPrim count
sceneObject.AttachToBackup(); if (m_parentScene.m_clampPrimSize)
{
foreach (SceneObjectPart part in children)
{
Vector3 scale = part.Shape.Scale;
if (OnObjectCreate != null) if (scale.X > m_parentScene.m_maxNonphys)
OnObjectCreate(sceneObject); scale.X = m_parentScene.m_maxNonphys;
if (scale.Y > m_parentScene.m_maxNonphys)
lock (SceneObjectGroupsByFullID) scale.Y = m_parentScene.m_maxNonphys;
{ if (scale.Z > m_parentScene.m_maxNonphys)
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; scale.Z = m_parentScene.m_maxNonphys;
foreach (SceneObjectPart part in sceneObject.Children.Values)
SceneObjectGroupsByFullID[part.UUID] = sceneObject; part.Shape.Scale = scale;
}
lock (SceneObjectGroupsByLocalID)
{
SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
foreach (SceneObjectPart part in sceneObject.Children.Values)
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
} }
} }
m_numPrim += children.Count;
sceneObject.AttachToScene(m_parentScene);
if (sendClientUpdates)
sceneObject.ScheduleGroupForFullUpdate();
Entities.Add(sceneObject);
if (attachToBackup)
sceneObject.AttachToBackup();
if (OnObjectCreate != null)
OnObjectCreate(sceneObject);
lock (SceneObjectGroupsByFullID)
{
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
foreach (SceneObjectPart part in children)
SceneObjectGroupsByFullID[part.UUID] = sceneObject;
}
lock (SceneObjectGroupsByLocalID)
{
SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
foreach (SceneObjectPart part in children)
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
}
return true; return true;
} }
@ -443,42 +429,38 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>true if the object was deleted, false if there was no object to delete</returns> /// <returns>true if the object was deleted, false if there was no object to delete</returns>
public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
{ {
if (Entities.ContainsKey(uuid)) EntityBase entity;
if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup)
return false;
SceneObjectGroup grp = (SceneObjectGroup)entity;
if (!resultOfObjectLinked)
{ {
SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid]; m_numPrim -= grp.PrimCount;
if (!resultOfObjectLinked) if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
{ RemovePhysicalPrim(grp.PrimCount);
m_numPrim -= grp.PrimCount;
if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
RemovePhysicalPrim(grp.PrimCount);
}
if (OnObjectRemove != null)
OnObjectRemove(Entities[uuid]);
lock (SceneObjectGroupsByFullID)
{
foreach (SceneObjectPart part in grp.Children.Values)
SceneObjectGroupsByFullID.Remove(part.UUID);
SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
}
lock (SceneObjectGroupsByLocalID)
{
foreach (SceneObjectPart part in grp.Children.Values)
SceneObjectGroupsByLocalID.Remove(part.LocalId);
SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
}
Entities.Remove(uuid);
//SceneObjectGroup part;
//((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
return true;
} }
return false; if (OnObjectRemove != null)
OnObjectRemove(Entities[uuid]);
lock (SceneObjectGroupsByFullID)
{
foreach (SceneObjectPart part in grp.Children.Values)
SceneObjectGroupsByFullID.Remove(part.UUID);
SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
}
lock (SceneObjectGroupsByLocalID)
{
foreach (SceneObjectPart part in grp.Children.Values)
SceneObjectGroupsByLocalID.Remove(part.LocalId);
SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
}
return Entities.Remove(uuid);
} }
/// <summary> /// <summary>
@ -490,9 +472,7 @@ namespace OpenSim.Region.Framework.Scenes
protected internal void AddToUpdateList(SceneObjectGroup obj) protected internal void AddToUpdateList(SceneObjectGroup obj)
{ {
lock (m_updateList) lock (m_updateList)
{
m_updateList[obj.UUID] = obj; m_updateList[obj.UUID] = obj;
}
} }
public void FireAttachToBackup(SceneObjectGroup obj) public void FireAttachToBackup(SceneObjectGroup obj)
@ -526,34 +506,39 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (!Monitor.TryEnter(m_updateLock)) if (!Monitor.TryEnter(m_updateLock))
return; return;
try
List<SceneObjectGroup> updates;
// Some updates add more updates to the updateList.
// Get the current list of updates and clear the list before iterating
lock (m_updateList)
{ {
updates = new List<SceneObjectGroup>(m_updateList.Values); List<SceneObjectGroup> updates;
m_updateList.Clear();
}
// Go through all updates // Some updates add more updates to the updateList.
for (int i = 0; i < updates.Count; i++) // Get the current list of updates and clear the list before iterating
{ lock (m_updateList)
SceneObjectGroup sog = updates[i];
// Don't abort the whole update if one entity happens to give us an exception.
try
{ {
sog.Update(); updates = new List<SceneObjectGroup>(m_updateList.Values);
m_updateList.Clear();
} }
catch (Exception e)
// Go through all updates
for (int i = 0; i < updates.Count; i++)
{ {
m_log.ErrorFormat( SceneObjectGroup sog = updates[i];
"[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e);
// Don't abort the whole update if one entity happens to give us an exception.
try
{
sog.Update();
}
catch (Exception e)
{
m_log.ErrorFormat(
"[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e);
}
} }
} }
Monitor.Exit(m_updateLock); finally
{
Monitor.Exit(m_updateLock);
}
} }
protected internal void AddPhysicalPrim(int number) protected internal void AddPhysicalPrim(int number)
@ -920,38 +905,38 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>null if no scene object group containing that prim is found</returns> /// <returns>null if no scene object group containing that prim is found</returns>
public SceneObjectGroup GetGroupByPrim(uint localID) public SceneObjectGroup GetGroupByPrim(uint localID)
{ {
if (Entities.ContainsKey(localID)) EntityBase entity;
return Entities[localID] as SceneObjectGroup; if (Entities.TryGetValue(localID, out entity))
return entity as SceneObjectGroup;
//m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
SceneObjectGroup sog; SceneObjectGroup sog;
lock (SceneObjectGroupsByLocalID) lock (SceneObjectGroupsByLocalID)
SceneObjectGroupsByLocalID.TryGetValue(localID, out sog);
if (sog != null)
{ {
if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog)) if (sog.HasChildPrim(localID))
{ return sog;
if (sog.HasChildPrim(localID)) SceneObjectGroupsByLocalID.Remove(localID);
return sog;
SceneObjectGroupsByLocalID.Remove(localID);
}
} }
List<EntityBase> EntityList = GetEntities(); EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in EntityList) foreach (EntityBase ent in entityList)
{ {
//m_log.DebugFormat("Looking at entity {0}", ent.UUID); //m_log.DebugFormat("Looking at entity {0}", ent.UUID);
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
if (((SceneObjectGroup)ent).HasChildPrim(localID)) sog = (SceneObjectGroup)ent;
if (sog.HasChildPrim(localID))
{ {
sog = (SceneObjectGroup)ent;
lock (SceneObjectGroupsByLocalID) lock (SceneObjectGroupsByLocalID)
{
SceneObjectGroupsByLocalID[localID] = sog; SceneObjectGroupsByLocalID[localID] = sog;
}
return sog; return sog;
} }
} }
} }
return null; return null;
} }
@ -964,36 +949,35 @@ namespace OpenSim.Region.Framework.Scenes
{ {
SceneObjectGroup sog; SceneObjectGroup sog;
lock (SceneObjectGroupsByFullID) lock (SceneObjectGroupsByFullID)
SceneObjectGroupsByFullID.TryGetValue(fullID, out sog);
if (sog != null)
{ {
if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) lock (sog.Children)
{ {
lock (sog.Children) if (sog.Children.ContainsKey(fullID))
{ return sog;
if (sog.Children.ContainsKey(fullID))
return sog;
}
SceneObjectGroupsByFullID.Remove(fullID);
} }
lock (SceneObjectGroupsByFullID)
SceneObjectGroupsByFullID.Remove(fullID);
} }
List<EntityBase> EntityList = GetEntities(); EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
foreach (EntityBase ent in EntityList)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
if (((SceneObjectGroup)ent).HasChildPrim(fullID)) sog = (SceneObjectGroup)ent;
if (sog.HasChildPrim(fullID))
{ {
sog = (SceneObjectGroup)ent;
lock (SceneObjectGroupsByFullID) lock (SceneObjectGroupsByFullID)
{
SceneObjectGroupsByFullID[fullID] = sog; SceneObjectGroupsByFullID[fullID] = sog;
}
return sog; return sog;
} }
} }
} }
return null; return null;
} }
@ -1002,7 +986,7 @@ namespace OpenSim.Region.Framework.Scenes
// Primitive Ray Tracing // Primitive Ray Tracing
float closestDistance = 280f; float closestDistance = 280f;
EntityIntersection result = new EntityIntersection(); EntityIntersection result = new EntityIntersection();
List<EntityBase> EntityList = GetEntities(); EntityBase[] EntityList = GetEntities();
foreach (EntityBase ent in EntityList) foreach (EntityBase ent in EntityList)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
@ -1040,23 +1024,28 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>null if the part was not found</returns> /// <returns>null if the part was not found</returns>
protected internal SceneObjectPart GetSceneObjectPart(string name) protected internal SceneObjectPart GetSceneObjectPart(string name)
{ {
List<EntityBase> EntityList = GetEntities(); SceneObjectPart sop = null;
// FIXME: use a dictionary here Entities.Find(
foreach (EntityBase ent in EntityList) delegate(EntityBase entity)
{
if (ent is SceneObjectGroup)
{ {
foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts()) if (entity is SceneObjectGroup)
{ {
if (p.Name == name) foreach (SceneObjectPart p in ((SceneObjectGroup)entity).GetParts())
{ {
return p; if (p.Name == name)
{
sop = p;
return true;
}
} }
} }
return false;
} }
} );
return null;
return sop;
} }
/// <summary> /// <summary>
@ -1077,7 +1066,7 @@ namespace OpenSim.Region.Framework.Scenes
/// it /// it
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
protected internal List<EntityBase> GetEntities() protected internal EntityBase[] GetEntities()
{ {
return Entities.GetEntities(); return Entities.GetEntities();
} }
@ -1086,7 +1075,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
Dictionary<uint, float> topScripts = new Dictionary<uint, float>(); Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
List<EntityBase> EntityList = GetEntities(); EntityBase[] EntityList = GetEntities();
int limit = 0; int limit = 0;
foreach (EntityBase ent in EntityList) foreach (EntityBase ent in EntityList)
{ {
@ -1140,7 +1129,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="action"></param> /// <param name="action"></param>
protected internal void ForEachSOG(Action<SceneObjectGroup> action) protected internal void ForEachSOG(Action<SceneObjectGroup> action)
{ {
List<EntityBase> objlist = Entities.GetAllByType<SceneObjectGroup>(); EntityBase[] objlist = Entities.GetAllByType<SceneObjectGroup>();
foreach (EntityBase ent in objlist) foreach (EntityBase ent in objlist)
{ {
SceneObjectGroup obj = (SceneObjectGroup)ent; SceneObjectGroup obj = (SceneObjectGroup)ent;
@ -1353,7 +1342,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(localID); SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null) if (group != null)
{ {
if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
{ {
if (m_parentScene.AttachmentsModule != null) if (m_parentScene.AttachmentsModule != null)
@ -1798,8 +1787,8 @@ namespace OpenSim.Region.Framework.Scenes
UUID objid = UUID.Zero; UUID objid = UUID.Zero;
SceneObjectPart obj = null; SceneObjectPart obj = null;
List<EntityBase> EntityList = GetEntities(); EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in EntityList) foreach (EntityBase ent in entityList)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {

View File

@ -1326,7 +1326,7 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = detachedpos; AbsolutePosition = detachedpos;
m_rootPart.AttachedAvatar = UUID.Zero; m_rootPart.AttachedAvatar = UUID.Zero;
//Anakin Lohner bug #3839 //Anakin Lohner bug #3839
lock (m_parts) lock (m_parts)
{ {
foreach (SceneObjectPart p in m_parts.Values) foreach (SceneObjectPart p in m_parts.Values)
@ -1556,7 +1556,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
/// <summary> /// <summary>
/// Delete this group from its scene. /// Delete this group from its scene.
/// </summary> /// </summary>
/// ///
/// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood
@ -1731,12 +1731,12 @@ namespace OpenSim.Region.Framework.Scenes
/// Processes backup. /// Processes backup.
/// </summary> /// </summary>
/// <param name="datastore"></param> /// <param name="datastore"></param>
public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup) public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup)
{ {
if (!m_isBackedUp) if (!m_isBackedUp)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); // "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID);
return; return;
} }
@ -1748,7 +1748,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
// Since this is the top of the section of call stack for backing up a particular scene object, don't let // Since this is the top of the section of call stack for backing up a particular scene object, don't let
// any exception propogate upwards. // any exception propogate upwards.
try try
{ {
if (!m_scene.ShuttingDown || // if shutting down then there will be nothing to handle the return so leave till next restart if (!m_scene.ShuttingDown || // if shutting down then there will be nothing to handle the return so leave till next restart
@ -1944,7 +1944,6 @@ namespace OpenSim.Region.Framework.Scenes
part.PhysActor.LocalID = part.LocalId; part.PhysActor.LocalID = part.LocalId;
part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
} }
} }
if (userExposed) if (userExposed)
{ {
@ -1954,7 +1953,6 @@ namespace OpenSim.Region.Framework.Scenes
ScheduleGroupForFullUpdate(); ScheduleGroupForFullUpdate();
} }
} }
finally finally
{ {
@ -2515,16 +2513,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>null if a child part with the primID was not found</returns> /// <returns>null if a child part with the primID was not found</returns>
public SceneObjectPart GetChildPart(UUID primID) public SceneObjectPart GetChildPart(UUID primID)
{ {
SceneObjectPart childPart = null; SceneObjectPart childPart;
lock (m_parts) lock (m_parts)
{ m_parts.TryGetValue(primID, out childPart);
if (m_parts.ContainsKey(primID))
{
childPart = m_parts[primID];
}
}
return childPart; return childPart;
} }

View File

@ -508,7 +508,14 @@ namespace OpenSim.Region.Framework.Scenes
public UUID UUID public UUID UUID
{ {
get { return m_uuid; } get { return m_uuid; }
set { m_uuid = value; } set
{
m_uuid = value;
// This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part
if (Inventory != null)
Inventory.ResetInventoryIDs();
}
} }
public uint LocalId public uint LocalId
@ -1027,12 +1034,12 @@ namespace OpenSim.Region.Framework.Scenes
return m_mediaUrl; return m_mediaUrl;
} }
set set
{ {
m_mediaUrl = value; m_mediaUrl = value;
if (ParentGroup != null) if (ParentGroup != null)
ParentGroup.HasGroupChanged = true; ParentGroup.HasGroupChanged = true;
} }
} }
@ -1045,7 +1052,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat("[SOP]: Setting CreateSelected to {0} for {1} {2}", value, Name, UUID); // m_log.DebugFormat("[SOP]: Setting CreateSelected to {0} for {1} {2}", value, Name, UUID);
m_createSelected = value; m_createSelected = value;
} }
} }
#endregion #endregion
@ -1207,7 +1214,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Property flags. See OpenMetaverse.PrimFlags /// Property flags. See OpenMetaverse.PrimFlags
/// </summary> /// </summary>
/// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge /// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge
public PrimFlags Flags public PrimFlags Flags
{ {
@ -1372,7 +1379,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Tell the scene presence that it should send updates for this part to its client /// Tell the scene presence that it should send updates for this part to its client
/// </summary> /// </summary>
public void AddFullUpdateToAvatar(ScenePresence presence) public void AddFullUpdateToAvatar(ScenePresence presence)
{ {
presence.SceneViewer.QueuePartForUpdate(this); presence.SceneViewer.QueuePartForUpdate(this);
@ -1431,7 +1438,7 @@ namespace OpenSim.Region.Framework.Scenes
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
{ {
if(!sp.IsChildAgent) if (!sp.IsChildAgent)
sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume);
}); });
} }
@ -1683,7 +1690,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID); // m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID);
return dupe; return dupe;
} }
protected void AssetReceived(string id, Object sender, AssetBase asset) protected void AssetReceived(string id, Object sender, AssetBase asset)
@ -1993,10 +2000,10 @@ namespace OpenSim.Region.Framework.Scenes
} }
public uint GetEffectiveObjectFlags() public uint GetEffectiveObjectFlags()
{ {
// Commenting this section of code out since it doesn't actually do anything, as enums are handled by // Commenting this section of code out since it doesn't actually do anything, as enums are handled by
// value rather than reference // value rather than reference
// PrimFlags f = _flags; // PrimFlags f = _flags;
// if (m_parentGroup == null || m_parentGroup.RootPart == this) // if (m_parentGroup == null || m_parentGroup.RootPart == this)
// f &= ~(PrimFlags.Touch | PrimFlags.Money); // f &= ~(PrimFlags.Touch | PrimFlags.Money);
@ -2793,7 +2800,6 @@ namespace OpenSim.Region.Framework.Scenes
UUID = UUID.Random(); UUID = UUID.Random();
LinkNum = linkNum; LinkNum = linkNum;
LocalId = 0; LocalId = 0;
Inventory.ResetInventoryIDs();
} }
/// <summary> /// <summary>
@ -4756,7 +4762,7 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup == null || ParentGroup.IsDeleted) if (ParentGroup == null || ParentGroup.IsDeleted)
return; return;
if (IsAttachment && ParentGroup.RootPart != this) if (IsAttachment && ParentGroup.RootPart != this)
return; return;
// Causes this thread to dig into the Client Thread Data. // Causes this thread to dig into the Client Thread Data.

Some files were not shown because too many files have changed in this diff Show More