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
// 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)
{
UUID userID = UUID.Zero;
@ -784,7 +784,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
}
// 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.EstateOwner = userID;
@ -794,10 +794,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
else
{
int estateID = estateIDs[0];
region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(estateID);
if (!m_application.StorageManager.EstateDataStore.LinkRegion(region.RegionID, estateID))
region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(estateID);
if (!m_application.EstateDataService.LinkRegion(region.RegionID, estateID))
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));
//
//
// }
/// <summary>
@ -449,7 +449,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// rdata.userAppearance = new AvatarAppearance();
// rdata.userAppearance.Owner = old.Owner;
// adata = new AvatarData(rdata.userAppearance);
//
//
// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
//
// 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.Text;
using OpenMetaverse;
@ -17,7 +44,7 @@ namespace OpenSim.Data
/// <returns></returns>
public static UUID FromDB(object id)
{
if( (id == null) || (id == DBNull.Value))
if ((id == null) || (id == DBNull.Value))
return UUID.Zero;
if (id.GetType() == typeof(Guid))

View File

@ -40,15 +40,4 @@ namespace OpenSim.Data
void Initialise(string connect);
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>
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
public MSSQLEstateStore()
{
}
public MSSQLEstateStore(string connectionString)
{
Initialise(connectionString);
}
/// <summary>
/// Initialises the estatedata class.
/// </summary>

View File

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

View File

@ -122,7 +122,7 @@ namespace OpenSim.Data
int ver = FindVersion(_conn, "migrations");
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)");
InsertVersion("migrations", 1);
}
@ -288,7 +288,7 @@ namespace OpenSim.Data
SortedList<int, string[]> migrations = new SortedList<int, string[]>();
string[] names = _assem.GetManifestResourceNames();
if( names.Length == 0 ) // should never happen
if (names.Length == 0) // should never happen
return migrations;
Array.Sort(names); // we want all the migrations ordered
@ -297,7 +297,7 @@ namespace OpenSim.Data
Match m = null;
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
* 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( nLastVerFound <= after )
if (nLastVerFound <= after)
goto scan_old_style;
}
@ -329,7 +329,7 @@ namespace OpenSim.Data
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();
}
@ -345,7 +345,7 @@ namespace OpenSim.Data
string sLine = resourceReader.ReadLine();
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;
if (sLine.Trim().Equals(":GO", StringComparison.InvariantCultureIgnoreCase))
@ -392,7 +392,7 @@ scan_old_style:
if (m.Success)
{
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))
{

View File

@ -216,9 +216,6 @@ namespace OpenSim.Data.MySQL
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)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))

View File

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

View File

@ -286,7 +286,7 @@ namespace OpenSim.Data.MySQL
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.
// ( 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();
// Be a bit safer in parsing these because the

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -43,7 +43,7 @@ namespace OpenSim.Data.SQLiteLegacy
/// <summary>
/// A RegionData Interface to the SQLite database
/// </summary>
public class SQLiteRegionData : IRegionDataStore
public class SQLiteSimulationData : ISimulationDataStore
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -69,6 +69,15 @@ namespace OpenSim.Data.SQLiteLegacy
private String m_connectionString;
public SQLiteSimulationData()
{
}
public SQLiteSimulationData(string connectionString)
{
Initialise(connectionString);
}
// Temporary attribute while this is experimental
/***********************************************************************
@ -78,7 +87,6 @@ namespace OpenSim.Data.SQLiteLegacy
**********************************************************************/
/// <summary>
/// See IRegionDataStore
/// <list type="bullet">
/// <item>Initialises RegionData Interface</item>
/// <item>Loads and initialises a new SQLite connection and maintains it.</item>
@ -1888,7 +1896,6 @@ namespace OpenSim.Data.SQLiteLegacy
}
/// <summary>
/// see IRegionDatastore
/// </summary>
/// <param name="primID"></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.Collections.Generic;
using log4net.Config;
@ -41,13 +68,13 @@ namespace OpenSim.Data.Tests
{
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?
}
/// <summary>
/// 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.
/// </summary>
/// <param name="service">The service being tested</param>
@ -118,12 +145,12 @@ namespace OpenSim.Data.Tests
{
if (m_service != null)
{
if( m_service is IDisposable)
if (m_service is IDisposable)
((IDisposable)m_service).Dispose();
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);
}
@ -204,7 +231,7 @@ namespace OpenSim.Data.Tests
lst += ", " + s;
}
string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst);
string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst);
try
{
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.Linq;
using System.Text;

View File

@ -61,17 +61,17 @@ namespace OpenSim.Data.Tests
#else
[TestFixture(Description = "Region store tests (SQLite)")]
public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteRegionData>
public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteSimulationData>
{
}
[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)")]
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>
where TConn : DbConnection, new()
where TRegStore : class, IRegionDataStore, new()
where TRegStore : class, ISimulationDataStore, new()
{
bool m_rebuildDB;
public IRegionDataStore db;
public ISimulationDataStore db;
public UUID zero = UUID.Zero;
public UUID region1 = UUID.Random();
public UUID region2 = UUID.Random();
@ -122,7 +122,7 @@ namespace OpenSim.Data.Tests
protected override void InitService(object service)
{
ClearDB();
db = (IRegionDataStore)service;
db = (ISimulationDataStore)service;
db.Initialise(m_connStr);
}

View File

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

View File

@ -124,22 +124,6 @@ namespace OpenSim.Framework
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;
public string LibrariesXMLFile
{

View File

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

View File

@ -89,6 +89,57 @@ namespace OpenSim.Framework.Console
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
public string CmdPrompt(string prompt, string defaultresponse, List<string> options)

View File

@ -38,7 +38,7 @@ namespace OpenSim.Framework.Console
{
/// <summary>
/// A console that uses cursor control and color
/// </summary>
/// </summary>
public class LocalConsole : CommandConsole
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -100,8 +100,8 @@ namespace OpenSim.Framework.Console
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
// 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.
// 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.
int left = System.Console.CursorLeft;
if (left < 0)
@ -121,7 +121,7 @@ namespace OpenSim.Framework.Console
{
top = 0;
}
else
else
{
int bh = System.Console.BufferHeight;
@ -133,7 +133,7 @@ namespace OpenSim.Framework.Console
System.Console.CursorTop = top;
return top;
}
}
/// <summary>
/// Set the cursor column.
@ -145,12 +145,12 @@ namespace OpenSim.Framework.Console
/// </param>
/// <returns>
/// The new cursor column.
/// </returns>
/// </returns>
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
// 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.
// 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.
int top = System.Console.CursorTop;
if (top < 0)
@ -214,7 +214,7 @@ namespace OpenSim.Framework.Console
System.Console.Write("{0}", prompt);
SetCursorTop(new_y);
SetCursorLeft(new_x);
SetCursorLeft(new_x);
}
}
@ -461,7 +461,8 @@ namespace OpenSim.Framework.Console
SetCursorLeft(0);
y = SetCursorTop(y);
System.Console.WriteLine("{0}{1}", prompt, cmdline);
System.Console.WriteLine();
//Show();
lock (cmdline)
{
@ -486,7 +487,7 @@ namespace OpenSim.Framework.Console
}
}
AddToHistory(cmdline.ToString());
//AddToHistory(cmdline.ToString());
return cmdline.ToString();
default:
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.Collections.Generic;
using System.Text;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -46,7 +46,7 @@ namespace OpenSim.Framework
case AssetType.Texture:
return "image/x-j2c";
case AssetType.Sound:
return "application/ogg";
return "audio/ogg";
case AssetType.CallingCard:
return "application/vnd.ll.callingcard";
case AssetType.Landmark:
@ -98,8 +98,6 @@ namespace OpenSim.Framework
return "application/vnd.ll.outfitfolder";
case AssetType.MyOutfitsFolder:
return "application/vnd.ll.myoutfitsfolder";
case AssetType.InboxFolder:
return "application/vnd.ll.inboxfolder";
case AssetType.Unknown:
default:
return "application/octet-stream";
@ -128,7 +126,7 @@ namespace OpenSim.Framework
case InventoryType.Object:
return "application/vnd.ll.primitive";
case InventoryType.Sound:
return "application/ogg";
return "audio/ogg";
case InventoryType.Snapshot:
case InventoryType.Texture:
return "image/x-j2c";
@ -147,6 +145,7 @@ namespace OpenSim.Framework
case "image/jp2":
return (sbyte)AssetType.Texture;
case "application/ogg":
case "audio/ogg":
return (sbyte)AssetType.Sound;
case "application/vnd.ll.callingcard":
case "application/x-metaverse-callingcard":
@ -209,8 +208,6 @@ namespace OpenSim.Framework
return (sbyte)AssetType.OutfitFolder;
case "application/vnd.ll.myoutfitsfolder":
return (sbyte)AssetType.MyOutfitsFolder;
case "application/vnd.ll.inboxfolder":
return (sbyte)AssetType.InboxFolder;
case "application/octet-stream":
default:
return (sbyte)AssetType.Unknown;
@ -227,6 +224,7 @@ namespace OpenSim.Framework
case "image/jpeg":
return (sbyte)InventoryType.Texture;
case "application/ogg":
case "audio/ogg":
case "audio/x-wav":
return (sbyte)InventoryType.Sound;
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)
{
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),
uuid);
uuid);
}
/// <summary>
@ -171,9 +171,9 @@ namespace OpenSim.Framework.Serialization
/// <returns></returns>
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>
/// Extract a plain path from an IAR path
/// </summary>
@ -184,18 +184,18 @@ namespace OpenSim.Framework.Serialization
List<string> plainDirs = new List<string>();
string[] iarDirs = iarPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string iarDir in iarDirs)
{
if (!iarDir.Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR))
plainDirs.Add(iarDir);
int i = iarDir.LastIndexOf(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
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 HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
private volatile int NotSocketErrors = 0;
public volatile bool HTTPDRunning = false;
@ -160,7 +160,7 @@ namespace OpenSim.Framework.Servers.HttpServer
m_rpcHandlers[method] = handler;
m_rpcHandlersKeepAlive[method] = keepAlive; // default
}
return true;
}
@ -182,7 +182,7 @@ namespace OpenSim.Framework.Servers.HttpServer
public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler)
{
//m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName);
lock (m_HTTPHandlers)
{
if (!m_HTTPHandlers.ContainsKey(methodName))
@ -204,14 +204,14 @@ namespace OpenSim.Framework.Servers.HttpServer
if (!m_pollHandlers.ContainsKey(methodName))
{
m_pollHandlers.Add(methodName,args);
pollHandlerResult = true;
pollHandlerResult = true;
}
}
if (pollHandlerResult)
return AddHTTPHandler(methodName, handler);
return false;
return false;
}
// Note that the agent string is provided simply to differentiate
@ -257,51 +257,51 @@ namespace OpenSim.Framework.Servers.HttpServer
{
IHttpClientContext context = (IHttpClientContext)source;
IHttpRequest request = args.Request;
PollServiceEventArgs psEvArgs;
if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs))
{
PollServiceHttpRequest psreq = new PollServiceHttpRequest(psEvArgs, context, request);
if (psEvArgs.Request != null)
{
OSHttpRequest req = new OSHttpRequest(context, request);
Stream requestStream = req.InputStream;
Encoding encoding = Encoding.UTF8;
StreamReader reader = new StreamReader(requestStream, encoding);
string requestBody = reader.ReadToEnd();
Hashtable keysvals = new Hashtable();
Hashtable headervals = new Hashtable();
string[] querystringkeys = req.QueryString.AllKeys;
string[] rHeaders = req.Headers.AllKeys;
keysvals.Add("body", requestBody);
keysvals.Add("uri", req.RawUrl);
keysvals.Add("content-type", req.ContentType);
keysvals.Add("http-method", req.HttpMethod);
foreach (string queryname in querystringkeys)
{
keysvals.Add(queryname, req.QueryString[queryname]);
}
foreach (string headername in rHeaders)
{
headervals[headername] = req.Headers[headername];
}
keysvals.Add("headers", headervals);
keysvals.Add("querystringkeys", querystringkeys);
psEvArgs.Request(psreq.RequestID, keysvals);
}
m_PollServiceManager.Enqueue(psreq);
}
else
@ -348,10 +348,10 @@ namespace OpenSim.Framework.Servers.HttpServer
{
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);
// 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
// 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();
// HTTP IN support. The script engine taes it from here
// Nothing to worry about for us.
//
@ -540,7 +540,7 @@ namespace OpenSim.Framework.Servers.HttpServer
HandleLLSDRequests(request, response);
return;
}
// m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl);
if (DoWeHaveAHTTPHandler(request.RawUrl))
{
@ -594,7 +594,7 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
}
if (String.IsNullOrEmpty(bestMatch))
{
streamHandler = null;
@ -641,7 +641,7 @@ namespace OpenSim.Framework.Servers.HttpServer
private bool TryGetHTTPHandler(string handlerKey, out GenericHTTPMethod HTTPHandler)
{
// m_log.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey);
string bestMatch = null;
lock (m_HTTPHandlers)
@ -727,14 +727,14 @@ namespace OpenSim.Framework.Servers.HttpServer
{
xmlRprcRequest.Params.Add(request.RemoteIPEndPoint); // Param[1]
XmlRpcResponse xmlRpcResponse;
XmlRpcMethod method;
bool methodWasFound;
lock (m_rpcHandlers)
{
methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method);
}
if (methodWasFound)
{
xmlRprcRequest.Params.Add(request.Url); // Param[2]
@ -766,10 +766,10 @@ namespace OpenSim.Framework.Servers.HttpServer
else
{
xmlRpcResponse = new XmlRpcResponse();
// Code set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
xmlRpcResponse.SetFault(
XmlRpcErrorCodes.SERVER_ERROR_METHOD,
XmlRpcErrorCodes.SERVER_ERROR_METHOD,
String.Format("Requested method [{0}] not found", methodName));
}
@ -786,11 +786,11 @@ namespace OpenSim.Framework.Servers.HttpServer
response.KeepAlive = false;
m_log.ErrorFormat("[BASE HTTP SERVER]: Handler not found for http request {0}", request.RawUrl);
response.SendChunked = false;
response.ContentLength64 = buf.Length;
response.ContentEncoding = Encoding.UTF8;
try
{
response.OutputStream.Write(buf, 0, buf.Length);
@ -872,13 +872,13 @@ namespace OpenSim.Framework.Servers.HttpServer
OSD llsdRequest = null;
OSD llsdResponse = null;
bool LegacyLLSDLoginLibOMV = (requestBody.Contains("passwd") && requestBody.Contains("mac") && requestBody.Contains("viewer_digest"));
if (requestBody.Length == 0)
// 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
{
@ -1090,7 +1090,7 @@ namespace OpenSim.Framework.Servers.HttpServer
string bestMatch = null;
//m_log.DebugFormat("[BASE HTTP HANDLER]: Checking if we have an HTTP handler for {0}", searchquery);
lock (m_HTTPHandlers)
{
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
//
if (pattern == "/" && searchquery == "/" || pattern != "/")
bestMatch = pattern;
bestMatch = pattern;
}
}
}
@ -1236,11 +1236,11 @@ namespace OpenSim.Framework.Servers.HttpServer
}
public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response)
{
{
// 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);
switch (request.HttpMethod)
{
case "OPTIONS":
@ -1256,7 +1256,7 @@ namespace OpenSim.Framework.Servers.HttpServer
private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response)
{
// 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.
// 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(
// "[BASE HTTP HANDLER]: TryGetHTTPHandlerPathBased() looking for HTTP handler to match {0}", searchquery);
lock (m_HTTPHandlers)
{
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
//and should check for NullReferenceExceptions
if (string.IsNullOrEmpty(contentType))
{
contentType = "text/html";
@ -1472,8 +1472,8 @@ namespace OpenSim.Framework.Servers.HttpServer
byte[] buffer;
if (!(contentType.Contains("image")
|| contentType.Contains("x-shockwave-flash")
if (!(contentType.Contains("image")
|| contentType.Contains("x-shockwave-flash")
|| contentType.Contains("application/x-oar")))
{
// Text
@ -1504,7 +1504,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
response.OutputStream.Flush();
response.Send();
//if (!response.KeepAlive && response.ReuseContext)
// response.FreeContext();
}
@ -1611,11 +1611,11 @@ namespace OpenSim.Framework.Servers.HttpServer
m_httpListener2 = CoolHTTPListener.Create(m_listenIPAddress, (int)m_port);
m_httpListener2.ExceptionThrown += httpServerException;
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
//m_httpListener2.UseTraceLogs = true;
//m_httpListener2.DisconnectHandler = httpServerDisconnectMonitor;
}
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]: 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.
throw e;
}
@ -1656,7 +1656,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
case SocketError.NotSocket:
NotSocketErrors++;
break;
}
}
@ -1686,12 +1686,11 @@ namespace OpenSim.Framework.Servers.HttpServer
m_httpListener2.LogWriter = null;
m_httpListener2.RequestReceived -= OnRequest;
m_httpListener2.Stop();
}
}
catch (NullReferenceException)
{
m_log.Warn("[BASE HTTP SERVER]: Null Reference when stopping HttpServer.");
}
}
public void RemoveStreamHandler(string httpMethod, string path)
@ -1712,7 +1711,7 @@ namespace OpenSim.Framework.Servers.HttpServer
m_HTTPHandlers.Remove(path);
return;
}
m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path));
}
}
@ -1728,7 +1727,6 @@ namespace OpenSim.Framework.Servers.HttpServer
}
RemoveHTTPHandler(httpMethod, path);
}
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
@ -1759,7 +1757,6 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
public bool RemoveLLSDHandler(string path, LLSDMethod handler)
{
try
@ -1833,7 +1830,7 @@ namespace OpenSim.Framework.Servers.HttpServer
oresp = osresp;
}
}
/// <summary>
/// Relays HttpServer log messages to our own logging mechanism.
/// </summary>
@ -1852,7 +1849,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
case LogPrio.Trace:
m_log.DebugFormat("[{0}]: {1}", source, message);
break;
break;
case LogPrio.Debug:
m_log.DebugFormat("[{0}]: {1}", source, message);
break;
@ -1872,8 +1869,8 @@ namespace OpenSim.Framework.Servers.HttpServer
break;
}
*/
return;
}
}
}
}

View File

@ -49,7 +49,7 @@ namespace OpenSim
public static string GetVersionString(string versionNumber, Flavour flavour)
{
string versionString = "OpenSim " + versionNumber + " (" + flavour + ")";
string versionString = "OpenSim " + versionNumber + " " + flavour;
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>
public void ResetIDs(UUID partID)
{
_oldID = _itemID;
_itemID = UUID.Random();
_parentPartID = partID;
_parentID = partID;
OldItemID = ItemID;
ItemID = UUID.Random();
ParentPartID = partID;
ParentID = partID;
}
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;
}
}
*/
configSource.Alias.AddAlias("On", true);
configSource.Alias.AddAlias("Off", false);

View File

@ -345,10 +345,6 @@ namespace OpenSim
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
= startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
}

View File

@ -152,7 +152,7 @@ namespace OpenSim
RegisterConsoleCommands();
base.StartupSpecific();
MainServer.Instance.AddStreamHandler(new OpenSim.SimStatusHandler());
MainServer.Instance.AddStreamHandler(new OpenSim.XSimStatusHandler(this));
if (userStatsURI != String.Empty)
@ -192,7 +192,7 @@ namespace OpenSim
// Hook up to the watchdog timer
Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler;
PrintFileToConsole("startuplogo.txt");
PrintFileToConsole("startuplogo.txt");
// For now, start at the 'root' level by default
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",
"debug packet <level>",
"Turn on packet debugging",
"If level > 255 then all incoming and outgoing packets are logged.\n"
"Turn on packet debugging",
"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 <= 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"
@ -316,7 +316,7 @@ namespace OpenSim
m_console.Commands.AddCommand("region", false, "create region",
"create region [\"region name\"] <region_file.ini>",
"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
+ "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.",
@ -552,19 +552,20 @@ namespace OpenSim
regionFile = Path.Combine(regionsDir, regionFile);
}
RegionInfo regInfo;
RegionInfo regInfo;
if (isXml)
{
regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source);
regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source);
}
else
{
regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName);
regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName);
}
IScene scene;
PopulateRegionEstateInfo(regInfo);
CreateRegion(regInfo, true, out scene);
regInfo.EstateSettings.Save();
PopulateRegionEstateInfo(regInfo);
CreateRegion(regInfo, true, out scene);
regInfo.EstateSettings.Save();
}
/// <summary>
@ -942,7 +943,7 @@ namespace OpenSim
delegate(Scene scene)
{
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.RegionLocX,
scene.RegionInfo.RegionLocY,

View File

@ -45,6 +45,7 @@ using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Physics.Manager;
using OpenSim.Server.Base;
namespace OpenSim
{
@ -195,6 +196,24 @@ namespace OpenSim
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();
m_stats = StatsManager.StartCollectingSimExtraStats();
@ -612,7 +631,7 @@ namespace OpenSim
regionInfo.InternalEndPoint.Port = (int) port;
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager);
if (m_autoCreateClientStack)
{
@ -628,30 +647,19 @@ namespace OpenSim
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()
{
return new ClientStackManager(m_configSettings.ClientstackDll);
}
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
AgentCircuitManager circuitManager)
protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService,
IEstateDataService estateDataService, AgentCircuitManager circuitManager)
{
SceneCommunicationService sceneGridService = new SceneCommunicationService();
return new Scene(
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);
}
@ -868,21 +876,23 @@ namespace OpenSim
/// </param>
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
{
MainConsole.Instance.Output("Your region is not part of an estate.");
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")
{
// 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.Save();
@ -894,7 +904,7 @@ namespace OpenSim
if (response == "None")
continue;
List<int> estateIDs = m_storageManager.EstateDataStore.GetEstates(response);
List<int> estateIDs = estateDataService.GetEstates(response);
if (estateIDs.Count < 1)
{
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];
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;
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.
/// </value>
protected int m_debugPacketLevel = 0;
#region Events
public event GenericMessage OnGenericMessage;
@ -288,7 +288,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event MuteListEntryRemove OnRemoveMuteListEntry;
public event GodlikeMessage onGodlikeMessage;
public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
#endregion Events
@ -330,12 +329,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// ownerless phantom.
///
/// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
///
///
/// </value>
protected HashSet<uint> m_killRecord;
// protected HashSet<uint> m_attachmentsSent;
// protected HashSet<uint> m_attachmentsSent;
private int m_moneyBalance;
private bool m_deliverPackets = true;
private int m_animationSequenceNumber = 1;
@ -395,22 +394,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public string ActiveGroupName { get { return m_activeGroupName; } }
public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
/// <summary>
/// First name of the agent/avatar represented by the client
/// </summary>
public string FirstName { get { return m_firstName; } }
/// <summary>
/// Last name of the agent/avatar represented by the client
/// </summary>
public string LastName { get { return m_lastName; } }
/// <summary>
/// Full name of the client (first name and last name)
/// </summary>
public string Name { get { return FirstName + " " + LastName; } }
public uint CircuitCode { get { return m_circuitCode; } }
public int MoneyBalance { get { return m_moneyBalance; } }
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_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
m_killRecord = new HashSet<uint>();
// m_attachmentsSent = new HashSet<uint>();
// m_attachmentsSent = new HashSet<uint>();
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
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.
m_log.Error(
string.Format("[LLCLIENTVIEW]: Caught exception while processing {0}", packetObject.Pack), e);
}
}
}
#endregion Packet Handling
@ -890,7 +889,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
foreach (GroupActiveProposals Proposal in Proposals)
{
GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket();
GAPIRP.AgentData.AgentID = AgentId;
GAPIRP.AgentData.GroupID = groupID;
GAPIRP.TransactionData.TransactionID = transactionID;
@ -914,7 +913,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (Proposals.Length == 0)
{
GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket();
GAPIRP.AgentData.AgentID = AgentId;
GAPIRP.AgentData.GroupID = groupID;
GAPIRP.TransactionData.TransactionID = transactionID;
@ -969,7 +968,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (Votes.Length == 0)
{
GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket();
GVHIRP.AgentData.AgentID = AgentId;
GVHIRP.AgentData.GroupID = groupID;
GVHIRP.TransactionData.TransactionID = transactionID;
@ -993,7 +992,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(GVHIRP, ThrottleOutPacketType.Task);
}
}
public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
{
GroupAccountDetailsReplyPacket GADRP = new GroupAccountDetailsReplyPacket();
@ -1012,13 +1011,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
GADRP.HistoryData[0] = History;
OutPacket(GADRP, ThrottleOutPacketType.Task);
}
public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier)
{
GroupAccountSummaryReplyPacket GASRP =
(GroupAccountSummaryReplyPacket)PacketPool.Instance.GetPacket(
PacketType.GroupAccountSummaryReply);
GASRP.AgentData = new GroupAccountSummaryReplyPacket.AgentDataBlock();
GASRP.AgentData.AgentID = sender.AgentId;
GASRP.AgentData.GroupID = groupID;
@ -1045,13 +1044,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
GASRP.MoneyData.LightTaxEstimate = 0;
OutPacket(GASRP, ThrottleOutPacketType.Task);
}
public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
{
GroupAccountTransactionsReplyPacket GATRP =
(GroupAccountTransactionsReplyPacket)PacketPool.Instance.GetPacket(
PacketType.GroupAccountTransactionsReply);
GATRP.AgentData = new GroupAccountTransactionsReplyPacket.AgentDataBlock();
GATRP.AgentData.AgentID = sender.AgentId;
GATRP.AgentData.GroupID = groupID;
@ -1520,7 +1519,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendKillObject(ulong regionHandle, uint localID)
{
// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle);
KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject);
// TODO: don't create new blocks if recycling an old packet
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
@ -3488,9 +3487,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
OutPacket(objupdate, ThrottleOutPacketType.Task);
// 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)
@ -3538,7 +3537,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Primitive Packet/Data Sending Methods
/// <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
/// </summary>
public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
@ -3555,14 +3554,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
double priority = m_prioritizer.GetUpdatePriority(this, entity);
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)
{
Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>();
Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>();
OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
int updatesThisCall = 0;
@ -3660,28 +3659,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// string text = sop.Text;
// if (text.IndexOf("\n") >= 0)
// text = text.Remove(text.IndexOf("\n"));
//
//
// if (m_attachmentsSent.Contains(sop.ParentID))
// {
//// m_log.DebugFormat(
//// "[CLIENT]: Sending full info about attached prim {0} text {1}",
//// sop.LocalId, text);
//
//
// objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId));
//
//
// m_attachmentsSent.Add(sop.LocalId);
// }
// else
// {
// 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);
//
// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId);
//
// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId);
// }
// }
// else
// {
// {
objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
// }
}
@ -3995,7 +3994,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_propertiesPacketTimer.Stop();
return;
}
m_propertiesPacketTimer.Stop();
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)
{
ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage();
ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage();
updateMessage.AABBMax = landData.AABBMax;
updateMessage.AABBMin = landData.AABBMin;
@ -4273,7 +4272,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updateMessage.PassHours = landData.PassHours;
updateMessage.PassPrice = landData.PassPrice;
updateMessage.PublicCount = 0; //TODO: Unimplemented
updateMessage.RegionPushOverride = (regionFlags & (uint)RegionFlags.RestrictPushObject) > 0;
updateMessage.RegionDenyAnonymous = (regionFlags & (uint)RegionFlags.DenyAnonymous) > 0;
@ -4303,13 +4302,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updateMessage.UserLocation = landData.UserLocation;
updateMessage.UserLookAt = landData.UserLookAt;
updateMessage.MediaType = landData.MediaType;
updateMessage.MediaDesc = landData.MediaDescription;
updateMessage.MediaWidth = landData.MediaWidth;
updateMessage.MediaHeight = landData.MediaHeight;
updateMessage.MediaLoop = landData.MediaLoop;
updateMessage.ObscureMusic = landData.ObscureMusic;
updateMessage.ObscureMedia = landData.ObscureMedia;
updateMessage.MediaType = landData.MediaType;
updateMessage.MediaDesc = landData.MediaDescription;
updateMessage.MediaWidth = landData.MediaWidth;
updateMessage.MediaHeight = landData.MediaHeight;
updateMessage.MediaLoop = landData.MediaLoop;
updateMessage.ObscureMusic = landData.ObscureMusic;
updateMessage.ObscureMedia = landData.ObscureMedia;
try
{
@ -4318,8 +4317,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
eq.ParcelProperties(updateMessage, this.AgentId);
} else {
m_log.Warn("No EQ Interface when sending parcel data.");
}
m_log.Warn("No EQ Interface when sending parcel data.");
}
}
catch (Exception ex)
{
@ -4692,9 +4691,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
// 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);
update.UpdateFlags = (uint)flags;
#endregion PrimFlags
@ -4827,11 +4826,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale);
AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation);
AddLocalPacketHandler(PacketType.ObjectFlagUpdate, HandleObjectFlagUpdate);
// 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
AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage, false);
AddLocalPacketHandler(PacketType.ObjectGrab, HandleObjectGrab, false);
AddLocalPacketHandler(PacketType.ObjectGrabUpdate, HandleObjectGrabUpdate, false);
AddLocalPacketHandler(PacketType.ObjectDeGrab, HandleObjectDeGrab);
@ -5088,12 +5087,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return false;
}
private bool HandleParcelGodMarkAsContent(IClientAPI client, Packet Packet)
{
ParcelGodMarkAsContentPacket ParcelGodMarkAsContent =
(ParcelGodMarkAsContentPacket)Packet;
ParcelGodMark ParcelGodMarkAsContentHandler = OnParcelGodMark;
if (ParcelGodMarkAsContentHandler != null)
{
@ -5104,11 +5103,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleFreezeUser(IClientAPI client, Packet Packet)
{
FreezeUserPacket FreezeUser = (FreezeUserPacket)Packet;
FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUser;
if (FreezeUserHandler != null)
{
@ -5120,12 +5119,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleEjectUser(IClientAPI client, Packet Packet)
{
EjectUserPacket EjectUser =
(EjectUserPacket)Packet;
EjectUserUpdate EjectUserHandler = OnParcelEjectUser;
if (EjectUserHandler != null)
{
@ -5137,12 +5136,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleParcelBuyPass(IClientAPI client, Packet Packet)
{
ParcelBuyPassPacket ParcelBuyPass =
(ParcelBuyPassPacket)Packet;
ParcelBuyPass ParcelBuyPassHandler = OnParcelBuyPass;
if (ParcelBuyPassHandler != null)
{
@ -5153,7 +5152,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleParcelBuyRequest(IClientAPI sender, Packet Pack)
{
ParcelBuyPacket parcel = (ParcelBuyPacket)Pack;
@ -5375,7 +5374,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
//m_log.DebugFormat("[CLIENT]: Received ScriptDialogReply from {0}", rdialog.Data.ObjectID);
#region Packet Session and User Check
if (m_checkPackets)
{
@ -5521,12 +5520,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return true;
}
private bool HandleFindAgent(IClientAPI client, Packet Packet)
{
FindAgentPacket FindAgent =
(FindAgentPacket)Packet;
FindAgentUpdate FindAgentHandler = OnFindAgent;
if (FindAgentHandler != null)
{
@ -5535,12 +5534,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleTrackAgent(IClientAPI client, Packet Packet)
{
TrackAgentPacket TrackAgent =
(TrackAgentPacket)Packet;
TrackAgentUpdate TrackAgentHandler = OnTrackAgent;
if (TrackAgentHandler != null)
{
@ -5551,7 +5550,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandlerRezObject(IClientAPI sender, Packet Pack)
{
RezObjectPacket rezPacket = (RezObjectPacket)Pack;
@ -7207,19 +7206,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
// 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);
if (!(((Scene)m_scene).Permissions.BypassPermissions()))
{
if (taskID != UUID.Zero) // Prim
{
SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID);
if (part == null)
{
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);
return true;
}
@ -7228,11 +7227,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (tii == null)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist",
Name, requestID, itemID, taskID);
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist",
Name, requestID, itemID, taskID);
return true;
}
}
if (tii.Type == (int)AssetType.LSLText)
{
if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId))
@ -7251,41 +7250,41 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
m_log.WarnFormat(
"[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;
}
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set",
Name, requestID, itemID, taskID);
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set",
Name, requestID, itemID, taskID);
return true;
}
if (tii.OwnerID != AgentId)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}",
Name, requestID, itemID, taskID, tii.OwnerID);
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}",
Name, requestID, itemID, taskID, tii.OwnerID);
return true;
}
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))
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer",
Name, requestID, itemID, taskID);
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer",
Name, requestID, itemID, taskID);
return true;
}
if (tii.AssetID != requestID)
{
m_log.WarnFormat(
"[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);
"[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);
return true;
}
}
@ -7889,7 +7888,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
newTaskItem, updatetask.UpdateData.LocalID);
}
}
}
}
return true;
}
@ -8884,7 +8883,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// return true;
}
private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack)
{
RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData;
@ -8905,7 +8904,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return true;
}
private bool HandleEstateCovenantRequest(IClientAPI sender, Packet Pack)
{
@ -8942,7 +8941,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return true;
}
private bool HandleGodUpdateRegionInfoUpdate(IClientAPI client, Packet Packet)
{
GodUpdateRegionInfoPacket GodUpdateRegionInfo =
@ -8962,7 +8961,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleSimWideDeletes(IClientAPI client, Packet Packet)
{
SimWideDeletesPacket SimWideDeletesRequest =
@ -8975,7 +8974,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleGodlikeMessage(IClientAPI client, Packet Packet)
{
GodlikeMessagePacket GodlikeMessage =
@ -8992,7 +8991,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleSaveStatePacket(IClientAPI client, Packet Packet)
{
StateSavePacket SaveStateMessage =
@ -9005,7 +9004,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleGodKickUser(IClientAPI sender, Packet Pack)
{
GodKickUserPacket gkupack = (GodKickUserPacket)Pack;
@ -9143,7 +9142,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return true;
}
#endregion Economy/Transaction Packets
#region Script Packets
@ -9356,7 +9355,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return true;
}
private bool HandleUpdateMuteListEntry(IClientAPI client, Packet Packet)
{
UpdateMuteListEntryPacket UpdateMuteListEntry =
@ -9372,7 +9371,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleRemoveMuteListEntry(IClientAPI client, Packet Packet)
{
RemoveMuteListEntryPacket RemoveMuteListEntry =
@ -9388,7 +9387,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleUserReport(IClientAPI client, Packet Packet)
{
UserReportPacket UserReport =
@ -9413,7 +9412,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleSendPostcard(IClientAPI client, Packet packet)
{
// SendPostcardPacket SendPostcard =
@ -9726,7 +9725,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return true;
}
private bool HandleGroupVoteHistoryRequest(IClientAPI client, Packet Packet)
{
GroupVoteHistoryRequestPacket GroupVoteHistoryRequest =
@ -9739,7 +9738,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleGroupActiveProposalsRequest(IClientAPI client, Packet Packet)
{
GroupActiveProposalsRequestPacket GroupActiveProposalsRequest =
@ -9752,7 +9751,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleGroupAccountDetailsRequest(IClientAPI client, Packet Packet)
{
GroupAccountDetailsRequestPacket GroupAccountDetailsRequest =
@ -9765,7 +9764,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleGroupAccountSummaryRequest(IClientAPI client, Packet Packet)
{
GroupAccountSummaryRequestPacket GroupAccountSummaryRequest =
@ -9778,7 +9777,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleGroupTransactionsDetailsRequest(IClientAPI client, Packet Packet)
{
GroupAccountTransactionsRequestPacket GroupAccountTransactionsRequest =
@ -9791,7 +9790,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return false;
}
private bool HandleGroupTitlesRequest(IClientAPI sender, Packet Pack)
{
GroupTitlesRequestPacket groupTitlesRequest =
@ -11239,26 +11238,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_debugPacketLevel > 0)
{
bool outputPacket = true;
if (m_debugPacketLevel <= 255
if (m_debugPacketLevel <= 255
&& (packet.Type == PacketType.SimStats || packet.Type == PacketType.SimulatorViewerTimeMessage))
outputPacket = false;
if (m_debugPacketLevel <= 200
&&
(packet.Type == PacketType.ImagePacket
if (m_debugPacketLevel <= 200
&& (packet.Type == PacketType.ImagePacket
|| packet.Type == PacketType.ImageData
|| packet.Type == PacketType.LayerData
|| packet.Type == PacketType.CoarseLocationUpdate))
|| packet.Type == PacketType.CoarseLocationUpdate))
outputPacket = false;
if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.AvatarAnimation || packet.Type == PacketType.ViewerEffect))
outputPacket = false;
outputPacket = false;
if (outputPacket)
m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type);
}
m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting);
}
@ -11348,16 +11346,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_debugPacketLevel > 0)
{
bool outputPacket = true;
if (m_debugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate)
outputPacket = false;
if (m_debugPacketLevel <= 200 && packet.Type == PacketType.RequestImage)
outputPacket = false;
if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation))
outputPacket = false;
if (outputPacket)
m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type);
}
@ -11623,12 +11621,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
UUID requestID = UUID.Zero;
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);
}
else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
{
requestID = new UUID(transferRequest.TransferInfo.Params, 80);
source = (byte)SourceType.SimInventoryItem;
@ -11874,7 +11872,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public PacketMethod method;
public bool Async;
}
public class AsyncPacketProcess
{
public bool result = false;
@ -11943,8 +11941,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName);
dialog.Data.LastName = Util.StringToBytes256(ownerLastName);
dialog.Data.Message = Util.StringToBytes256(message);
ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1];
buttons[0] = new ScriptDialogPacket.ButtonsBlock();
buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!");
@ -11958,7 +11955,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
ScenePresence presence = p as ScenePresence;
// 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
// 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.
// 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.
// 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.HttpServer;
using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Physics.Manager;
@ -48,28 +49,16 @@ namespace OpenSim.Region.ClientStack
protected Dictionary<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>();
protected NetworkServersInfo m_networkServersInfo;
public NetworkServersInfo NetServersInfo
{
get { return m_networkServersInfo; }
}
protected uint m_httpServerPort;
protected StorageManager m_storageManager;
public StorageManager StorageManager
{
get { return m_storageManager; }
}
protected ISimulationDataService m_simulationDataService;
protected IEstateDataService m_estateDataService;
protected ClientStackManager m_clientStackManager;
public SceneManager SceneManager
{
get { return m_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();
@ -83,15 +72,11 @@ namespace OpenSim.Region.ClientStack
/// <returns></returns>
protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier);
protected abstract StorageManager CreateStorageManager();
protected abstract ClientStackManager CreateClientStackManager();
protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
AgentCircuitManager circuitManager);
protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager);
protected override void StartupSpecific()
{
m_storageManager = CreateStorageManager();
m_clientStackManager = CreateClientStackManager();
Initialize();

View File

@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
protected Scene m_scene = null;
public string Name { get { return "Attachments Module"; } }
public Type ReplaceableInterface { get { return null; } }
public string Name { get { return "Attachments Module"; } }
public Type ReplaceableInterface { get { return null; } }
public void Initialise(IConfigSource source) {}
@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory;
client.OnObjectAttach += AttachObject;
client.OnObjectDetach += DetachObject;
client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory;
client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory;
}
public void UnsubscribeFromClientEvents(IClientAPI client)
@ -90,7 +90,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory;
client.OnObjectAttach -= AttachObject;
client.OnObjectDetach -= DetachObject;
client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory;
client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory;
}
/// <summary>
@ -174,12 +174,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
UUID itemID = UUID.Zero;
if (sp != null)
{
foreach(SceneObjectGroup grp in sp.GetAttachments(AttachmentPt))
foreach (SceneObjectGroup grp in sp.GetAttachments(AttachmentPt))
{
itemID = grp.GetFromItemID();
if (itemID != UUID.Zero)
DetachSingleAttachmentToInv(itemID, remoteClient);
}
}
}
if (group.GetFromItemID() == UUID.Zero)
@ -232,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public UUID RezSingleAttachmentFromInventory(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc)
{
{
SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc);
if (updateInventoryStatus)
@ -248,8 +248,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (null == att)
return UUID.Zero;
else
return att.UUID;
}
return att.UUID;
}
protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc)
@ -311,7 +311,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
}
return null;
}
}
public UUID SetAttachmentInventoryStatus(
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
// 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;
foreach (EntityBase entity in detachEntities)
@ -495,7 +495,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
sog.RootPart.IsAttachment = false;
sog.AbsolutePosition = sog.RootPart.AttachedPos;
UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID);
sog.SetAttachmentPoint(attachmentPoint);
sog.SetAttachmentPoint(attachmentPoint);
}
/// <summary>
@ -622,7 +622,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// In case it is later dropped again, don't let
// it get cleaned up
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
{
deadAvatar.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true);
if(killingAvatar != null)
if (killingAvatar != null)
killingAvatar.ControllingClient.SendAlertMessage("You fragged " + deadAvatar.Firstname + " " + deadAvatar.Lastname);
}
catch (InvalidOperationException)
@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
}
private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID)
{
{
try
{
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 FriendInfo[] Friends;
public int Refcount;
public UUID RegionID;
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);
protected List<Scene> m_Scenes = new List<Scene>();
@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected Dictionary<UUID, UserFriendData> m_Friends =
new Dictionary<UUID, UserFriendData>();
protected List<UUID> m_NeedsListOfFriends = new List<UUID>();
protected HashSet<UUID> m_NeedsListOfFriends = new HashSet<UUID>();
protected IPresenceService PresenceService
{
@ -146,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// Instantiate the request handler
IHttpServer server = MainServer.GetHttpServer((uint)mPort);
server.AddStreamHandler(new FriendsRequestHandler(this));
}
if (m_FriendsService == null)
@ -173,7 +172,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnClientClosed += OnClientClosed;
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
scene.EventManager.OnClientLogin += OnClientLogin;
}
@ -198,17 +196,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
public uint GetFriendPerms(UUID principalID, UUID friendID)
{
if (!m_Friends.ContainsKey(principalID))
return 0;
UserFriendData data = m_Friends[principalID];
string searchFor = friendID.ToString();
foreach (FriendInfo fi in data.Friends)
FriendInfo[] friends = GetFriends(principalID);
foreach (FriendInfo fi in friends)
{
if (fi.Friend == searchFor)
if (fi.Friend == friendID.ToString())
return (uint)fi.TheirFlags;
}
return 0;
}
@ -218,73 +212,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.OnApproveFriendRequest += OnApproveFriendRequest;
client.OnDenyFriendRequest += OnDenyFriendRequest;
client.OnTerminateFriendship += OnTerminateFriendship;
client.OnGrantUserRights += OnGrantUserRights;
lock (m_Friends)
{
if (m_Friends.ContainsKey(client.AgentId))
// Asynchronously fetch the friends list or increment the refcount for the existing
// friends list
Util.FireAndForget(
delegate(object o)
{
m_Friends[client.AgentId].Refcount++;
return;
lock (m_Friends)
{
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)
{
ScenePresence sp = scene.GetScenePresence(agentID);
if (sp != null && !sp.IsChildAgent)
{
// do this for root agents closing out
StatusChange(agentID, false);
}
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);
else
m_Friends[agentID].Refcount--;
}
}
}
private void OnMakeRootAgent(ScenePresence sp)
{
UUID agentID = sp.ControllingClient.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;
}
UpdateFriendsCache(agentID);
}
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
lock (m_NeedsListOfFriends)
if (!m_NeedsListOfFriends.Contains(agentID))
{
m_NeedsListOfFriends.Add(agentID);
}
m_NeedsListOfFriends.Add(agentID);
}
public void SendFriendsOnlineIfNeeded(IClientAPI client)
{
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))
{
m_log.DebugFormat("[FRIENDS MODULE]: agent {0} not found in local cache", agentID);
if (!m_NeedsListOfFriends.Remove(agentID))
return;
}
}
//
// Send the friends online
//
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());
}
// Send the friends online
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());
}
//
// Send outstanding friendship offers
//
if (m_Friends.ContainsKey(agentID))
{
List<string> outstanding = new List<string>();
// Send outstanding friendship offers
List<string> outstanding = new List<string>();
FriendInfo[] friends = GetFriends(agentID);
foreach (FriendInfo fi in friends)
{
if (fi.TheirFlags == -1)
outstanding.Add(fi.Friend);
}
foreach (FriendInfo fi in m_Friends[agentID].Friends)
if (fi.TheirFlags == -1)
outstanding.Add(fi.Friend);
GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, String.Empty, agentID, (byte)InstantMessageDialog.FriendshipOffered,
"Will you be my friend?", true, Vector3.Zero);
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)
{
try
{
im.fromAgentID = new Guid(fid);
}
catch
{
continue;
}
foreach (string fid in outstanding)
{
UUID fromAgentID;
if (!UUID.TryParse(fid, out fromAgentID))
continue;
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID));
im.fromAgentName = account.FirstName + " " + account.LastName;
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID);
PresenceInfo presence = PresenceService.GetAgent(fromAgentID);
PresenceInfo presence = null;
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
if (presences != null && presences.Length > 0)
presence = presences[0];
if (presence != null)
im.offline = 0;
im.fromAgentID = fromAgentID.Guid;
im.fromAgentName = account.FirstName + " " + account.LastName;
im.offline = (byte)((presence == null) ? 1 : 0);
im.imSessionID = im.fromAgentID;
im.imSessionID = im.fromAgentID;
// Finally
LocalFriendshipOffered(agentID, im);
}
}
lock (m_NeedsListOfFriends)
m_NeedsListOfFriends.Remove(agentID);
// Finally
LocalFriendshipOffered(agentID, im);
}
}
@ -373,44 +334,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
List<string> friendList = new List<string>();
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))
friendList.Add(fi.Friend);
}
if (friendList.Count == 0)
// no friends whatsoever
return online;
PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
foreach (PresenceInfo pi in presence)
online.Add(new UUID(pi.UserID));
//m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID);
if (friendList.Count > 0)
{
PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
foreach (PresenceInfo pi in presence)
{
UUID presenceID;
if (UUID.TryParse(pi.UserID, out presenceID))
online.Add(presenceID);
}
}
return online;
}
//
// Find the client for a ID
//
/// <summary>
/// Find the client for a ID
/// </summary>
public IClientAPI LocateClientObject(UUID agentID)
{
Scene scene = GetClientScene(agentID);
if (scene == null)
return null;
if (scene != null)
{
ScenePresence presence = scene.GetScenePresence(agentID);
if (presence != null)
return presence.ControllingClient;
}
ScenePresence presence = scene.GetScenePresence(agentID);
if (presence == null)
return null;
return presence.ControllingClient;
return null;
}
//
// Find the scene for an agent
//
/// <summary>
/// Find the scene for an agent
/// </summary>
private Scene GetClientScene(UUID agentId)
{
lock (m_Scenes)
@ -418,13 +381,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
foreach (Scene scene in m_Scenes)
{
ScenePresence presence = scene.GetScenePresence(agentId);
if (presence != null)
{
if (!presence.IsChildAgent)
return scene;
}
if (presence != null && !presence.IsChildAgent)
return scene;
}
}
return null;
}
@ -435,35 +396,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
/// <param name="online"></param>
private void StatusChange(UUID agentID, bool online)
{
//m_log.DebugFormat("[FRIENDS]: StatusChange {0}", online);
if (m_Friends.ContainsKey(agentID))
FriendInfo[] friends = GetFriends(agentID);
if (friends.Length > 0)
{
//m_log.DebugFormat("[FRIENDS]: # of friends: {0}", m_Friends[agentID].Friends.Length);
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))
friendList.Add(fi);
}
Util.FireAndForget(delegate
{
foreach (FriendInfo fi in friendList)
Util.FireAndForget(
delegate
{
//m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID);
// Notify about this user status
StatusNotify(fi, agentID, online);
foreach (FriendInfo fi in friendList)
{
//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)
{
UUID friendID = UUID.Zero;
UUID friendID;
if (UUID.TryParse(friend.Friend, out friendID))
{
// Try local
@ -471,35 +430,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return;
// The friend is not here [as root]. Let's forward.
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check
{
PresenceInfo friendSession = null;
foreach (PresenceInfo pinfo in friendSessions)
if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad
{
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);
}
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
{
m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend);
}
}
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
UUID principalID = new UUID(im.fromAgentID);
UUID friendID = new UUID(im.toAgentID);
@ -529,15 +477,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return;
// The prospective friend is not here [as root]. Let's forward.
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSession != null)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
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.
}
@ -548,9 +492,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
FriendsService.StoreFriend(agentID, friendID.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
@ -564,16 +508,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
// The friend is not here
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSession != null)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
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))
return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSession != null)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
if (region != null)
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
else
m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
}
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
if (region != null)
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());
// Update local cache
m_Friends[agentID].Friends = FriendsService.GetFriends(agentID);
UpdateFriendsCache(agentID);
client.SendTerminateFriend(exfriendID);
@ -625,30 +561,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalFriendshipTerminated(exfriendID))
return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
PresenceInfo friendSession = PresenceService.GetAgent(exfriendID);
if (friendSession != null)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
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)
{
if (!m_Friends.ContainsKey(remoteClient.AgentId))
FriendInfo[] friends = GetFriends(remoteClient.AgentId);
if (friends.Length == 0)
return;
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
UserFriendData fd = m_Friends[remoteClient.AgentId];
FriendInfo friend = null;
foreach (FriendInfo fi in fd.Friends)
foreach (FriendInfo fi in friends)
{
if (fi.Friend == target.ToString())
friend = fi;
}
if (friend != null) // Found it
{
@ -670,17 +604,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalGrantRights(requester, target, myFlags, rights))
return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
PresenceInfo friendSession = PresenceService.GetAgent(target);
if (friendSession != null)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
// TODO: You might want to send the delta to save the lookup
// on the other end!!
m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
}
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
// 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,
(byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero);
friendClient.SendInstantMessage(im);
// update the local cache
m_Friends[friendID].Friends = FriendsService.GetFriends(friendID);
// Update the local cache
UpdateFriendsCache(friendID);
// we're done
return true;
}
@ -724,7 +656,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (friendClient != null)
{
// the prospective friend in this sim as root agent
GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID,
(byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero);
friendClient.SendInstantMessage(im);
@ -743,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// the friend in this sim as root agent
friendClient.SendTerminateFriend(exfriendID);
// update local cache
m_Friends[exfriendID].Friends = FriendsService.GetFriends(exfriendID);
UpdateFriendsCache(exfriendID);
// we're done
return true;
}
@ -772,11 +703,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
// update local cache
//m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID);
foreach (FriendInfo finfo in m_Friends[friendID].Friends)
if (finfo.Friend == userID.ToString())
finfo.TheirFlags = rights;
// Update local cache
lock (m_Friends)
{
FriendInfo[] friends = GetFriends(friendID);
foreach (FriendInfo finfo in friends)
{
if (finfo.Friend == userID.ToString())
finfo.TheirFlags = rights;
}
}
return true;
}
@ -802,7 +738,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return false;
}
#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)
{
client.OnGodKickUser += KickUser;
client.OnRequestGodlikePowers += RequestGodlikePowers;
}
client.OnRequestGodlikePowers += RequestGodlikePowers;
}
public void UnsubscribeFromClientEvents(IClientAPI client)
{
client.OnGodKickUser -= KickUser;
client.OnRequestGodlikePowers -= RequestGodlikePowers;
client.OnRequestGodlikePowers -= RequestGodlikePowers;
}
public void RequestGodlikePowers(

View File

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

View File

@ -179,14 +179,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
m_log.DebugFormat(
"[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
successfulAssetRestores, failedAssetRestores);
m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
return loadedNodes;
}
finally
{
m_loadStream.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="rootDestinationFolder">The root folder for the inventory load</param>
/// <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
/// </param>
/// <param name="loadedNodes">
@ -246,17 +246,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// The root folder for the inventory load
/// </param>
/// <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>
/// <returns>
/// 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.
/// </returns>
/// </returns>
protected InventoryFolderBase ResolveDestinationFolder(
InventoryFolderBase rootDestFolder,
ref string archivePath,
InventoryFolderBase rootDestFolder,
ref string archivePath,
Dictionary <string, InventoryFolderBase> resolvedFolders)
{
{
// string originalArchivePath = archivePath;
while (archivePath.Length > 0)
@ -370,7 +370,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (0 == i)
loadedNodes.Add(destFolder);
}
}
}
/// <summary>

View File

@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
{
Exception reportedException = null;
bool succeeded = true;
bool succeeded = true;
try
{
@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
finally
{
m_saveStream.Close();
}
}
m_module.TriggerInventoryArchiveSaved(
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
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);
throw e;
}
@ -283,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
"[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}",
inventoryFolder.Name,
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
SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly);
@ -301,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
//SaveUsers();
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)
{

View File

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

View File

@ -91,12 +91,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
scene.AddCommand(
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 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"
//+ "<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
+ "<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
@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (CheckPresence(userInfo.PrincipalID))
{
InventoryArchiveReadRequest request;
bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
try
{
@ -286,10 +286,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (CheckPresence(userInfo.PrincipalID))
{
InventoryArchiveReadRequest request;
bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
try
{
{
request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge);
}
catch (EntryPointNotFoundException e)
@ -325,20 +325,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
{
try
{
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
Dictionary<string, object> options = new Dictionary<string, object>();
{
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
Dictionary<string, object> options = new Dictionary<string, object>();
OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
List<string> mainParams = optionSet.Parse(cmdparams);
if (mainParams.Count < 6)
{
m_log.Error(
"[INVENTORY ARCHIVER]: usage is load iar [--merge] <first name> <last name> <inventory path> <user password> [<load file path>]");
return;
}
}
string firstName = mainParams[2];
string lastName = mainParams[3];
@ -353,7 +353,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
m_log.InfoFormat(
"[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
loadPath, firstName, lastName);
loadPath, firstName, lastName);
}
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}",
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)
{
@ -398,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
lock (m_pendingConsoleSaves)
m_pendingConsoleSaves.Add(id);
m_pendingConsoleSaves.Add(id);
}
private void SaveInvConsoleCommandCompleted(

View File

@ -58,18 +58,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
/// <summary>
/// Stream of data representing a common IAR that can be reused in load tests.
/// </summary>
protected MemoryStream m_iarStream;
protected MemoryStream m_iarStream;
protected UserAccount m_ua1
= new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
FirstName = "Mr",
LastName = "Tiddles" };
LastName = "Tiddles" };
protected UserAccount m_ua2
= new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
FirstName = "Lord",
LastName = "Lucan" };
LastName = "Lucan" };
string m_item1Name = "b.lsl";
private void SaveCompleted(
@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
}
protected void ConstructDefaultIarForTestLoad()
{
{
string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random());
MemoryStream archiveWriteStream = new MemoryStream();
@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string item1FileName
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
tar.Close();
tar.Close();
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");
// TODO: Test presence of more files and contents of files.
}
}
/// <summary>
/// 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]
public void TestLoadIarPathStartsWithSlash()
{
TestHelper.InMethod();
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
SerialiserModule serialiserModule = new SerialiserModule();
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
Scene scene = SceneSetupHelpers.SetupScene("inventory");
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
Scene scene = SceneSetupHelpers.SetupScene("inventory");
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);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(
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>
@ -376,7 +376,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
[Test]
public void TestLoadIarV0_1ExistingUsers()
{
TestHelper.InMethod();
TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure();
SerialiserModule serialiserModule = new SerialiserModule();
@ -386,9 +386,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
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 userLastName = "Stirrup";
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
SceneObjectGroup object1;
@ -524,7 +524,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
[Test]
public void TestLoadIarV0_1AbsentUsers()
{
TestHelper.InMethod();
TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure();
string userFirstName = "Charlie";
@ -562,7 +562,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Scene scene = SceneSetupHelpers.SetupScene("inventory");
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);
@ -680,8 +680,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random());
string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random());
string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
{
// Test replication of path1
@ -694,7 +694,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
Assert.That(folder1Candidates.Count, Is.EqualTo(1));
InventoryFolderBase folder1 = folder1Candidates[0];
InventoryFolderBase folder1 = folder1Candidates[0];
List<InventoryFolderBase> folder2aCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
@ -715,11 +715,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
List<InventoryFolderBase> folder2aCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
List<InventoryFolderBase> folder2bCandidates
= 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
= UserInventoryTestUtils.CreateInventoryFolder(
scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
@ -772,7 +772,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
List<InventoryFolderBase> folder2PostCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
}
}
/// <summary>
/// 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
= UserInventoryTestUtils.CreateInventoryFolder(
scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
@ -812,6 +812,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
List<InventoryFolderBase> folder2PostCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b");
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
}
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
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;
}

View File

@ -220,7 +220,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{
// m_log.DebugFormat(
// "[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);
}

View File

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

View File

@ -36,6 +36,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{
public class UserAccountCache
{
private const double CACHE_EXPIRATION_SECONDS = 120.0;
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
@ -51,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
public void Cache(UUID userID, UserAccount account)
{
// 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)
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);
}

View File

@ -33,7 +33,7 @@ using OpenSim.Framework.Serialization;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.World.Archiver
{
{
/// <summary>
/// Helper methods for archive manipulation
/// </summary>
@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
public static string CreateObjectFilename(SceneObjectGroup sog)
{
return ArchiveConstants.CreateOarObjectFilename(sog.Name, sog.UUID, sog.AbsolutePosition);
}
}
/// <summary>
/// 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)
{
return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition);
}
}
/// <summary>
/// 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, 1000000);
}
}
}
}

View File

@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{
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>();
/*

View File

@ -48,6 +48,7 @@ using OpenSim.Tests.Common.Setup;
using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader;
using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter;
using RegionSettings = OpenSim.Framework.RegionSettings;
namespace OpenSim.Region.CoreModules.World.Archiver.Tests
{
@ -135,7 +136,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
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 ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset
@ -215,7 +218,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
public void TestLoadOarV0_2()
{
TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure();
// log4net.Config.XmlConfigurator.Configure();
MemoryStream archiveWriteStream = new MemoryStream();
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);

View File

@ -72,12 +72,12 @@ namespace OpenSim.Region.CoreModules.World.Land
#pragma warning restore 0429
/// <value>
/// Local land ids at specified region co-ordinates (region size / 4)
/// Local land ids at specified region co-ordinates (region size / 4)
/// </value>
private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax];
/// <value>
/// Land objects keyed by local id
/// Land objects keyed by local id
/// </value>
private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
@ -94,8 +94,8 @@ namespace OpenSim.Region.CoreModules.World.Land
#region INonSharedRegionModule Members
public Type ReplaceableInterface
{
public Type ReplaceableInterface
{
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));
forcedPosition = null;
}
//if we are far away, teleport
//if we are far away, teleport
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));
@ -329,8 +329,6 @@ namespace OpenSim.Region.CoreModules.World.Land
}
}
private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position)
{
if (m_scene.Permissions.IsGod(avatar.UUID)) return;
@ -344,7 +342,6 @@ namespace OpenSim.Region.CoreModules.World.Land
{
avatar.ControllingClient.SendAlertMessage(
"You are not allowed on this parcel because the land owner has restricted access.");
}
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 &&
clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
{
EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID,
EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID,
m_scene.RegionInfo.RegionID);
//They are going under the safety line!
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)
return null;
try
{
x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0));
@ -675,7 +672,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{
return null;
}
lock (m_landList)
{
// 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
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
}
lock (m_landIDList)
{
try
@ -749,7 +746,6 @@ namespace OpenSim.Region.CoreModules.World.Land
public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj)
{
lock (m_landList)
{
foreach (LandObject p in m_landList.Values)
@ -802,7 +798,8 @@ namespace OpenSim.Region.CoreModules.World.Land
public void EventManagerOnParcelPrimCountUpdate()
{
ResetAllLandPrimCounts();
foreach (EntityBase obj in m_scene.Entities)
EntityBase[] entities = m_scene.Entities.GetEntities();
foreach (EntityBase obj in entities)
{
if (obj != null)
{
@ -943,7 +940,7 @@ namespace OpenSim.Region.CoreModules.World.Land
return;
}
}
lock (m_landList)
{
foreach (ILandObject slaveLandObject in selectedLandObjects)
@ -1089,7 +1086,6 @@ namespace OpenSim.Region.CoreModules.World.Land
temp.Add(currentParcel);
}
}
}
}
@ -1132,7 +1128,7 @@ namespace OpenSim.Region.CoreModules.World.Land
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)
{
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);
}));
UUID parcelCapID = UUID.Random();
caps.RegisterHandler("ParcelPropertiesUpdate",
new RestStreamHandler("POST", "/CAPS/" + parcelCapID,
delegate(string request, string path, string param,
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
return ProcessPropertiesUpdate(request, path, param, agentID, caps);
}));
UUID parcelCapID = UUID.Random();
caps.RegisterHandler("ParcelPropertiesUpdate",
new RestStreamHandler("POST", "/CAPS/" + parcelCapID,
delegate(string request, string path, string param,
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
return ProcessPropertiesUpdate(request, path, param, agentID, caps);
}));
}
private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
{
IClientAPI client;
if ( ! m_scene.TryGetClient(agentID, out client) ) {
m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString() );
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
}
ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage();
OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request);
private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
{
IClientAPI client;
if (! m_scene.TryGetClient(agentID, out client)) {
m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString());
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
}
properties.Deserialize(args);
LandUpdateArgs land_update = new LandUpdateArgs();
int parcelID = properties.LocalID;
land_update.AuthBuyerID = properties.AuthBuyerID;
ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage();
OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request);
properties.Deserialize(args);
LandUpdateArgs land_update = new LandUpdateArgs();
int parcelID = properties.LocalID;
land_update.AuthBuyerID = properties.AuthBuyerID;
land_update.Category = properties.Category;
land_update.Desc = properties.Desc;
land_update.GroupID = properties.GroupID;
@ -1423,15 +1419,15 @@ namespace OpenSim.Region.CoreModules.World.Land
land_update.SnapshotID = properties.SnapshotID;
land_update.UserLocation = properties.UserLocation;
land_update.UserLookAt = properties.UserLookAt;
land_update.MediaDescription = properties.MediaDesc;
land_update.MediaType = properties.MediaType;
land_update.MediaWidth = properties.MediaWidth;
land_update.MediaHeight = properties.MediaHeight;
land_update.MediaLoop = properties.MediaLoop;
land_update.ObscureMusic = properties.ObscureMusic;
land_update.ObscureMedia = properties.ObscureMedia;
ILandObject land;
land_update.MediaDescription = properties.MediaDesc;
land_update.MediaType = properties.MediaType;
land_update.MediaWidth = properties.MediaWidth;
land_update.MediaHeight = properties.MediaHeight;
land_update.MediaLoop = properties.MediaLoop;
land_update.ObscureMusic = properties.ObscureMusic;
land_update.ObscureMedia = properties.ObscureMedia;
ILandObject land;
lock (m_landList)
{
m_landList.TryGetValue(parcelID, out land);
@ -1439,15 +1435,15 @@ namespace OpenSim.Region.CoreModules.World.Land
if (land != null)
{
land.UpdateLandProperties(land_update, client);
land.UpdateLandProperties(land_update, client);
m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client);
}
}
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());
}
}
// 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.
// 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)
return;
ExtendedLandData data =
(ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(),
delegate(string id)
ExtendedLandData data =
(ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(),
delegate(string id)
{
UUID parcel = UUID.Zero;
UUID.TryParse(id, out parcel);
// assume we've got the parcelID we just computed in RemoteParcelRequest
ExtendedLandData extLandData = new ExtendedLandData();
Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
out extLandData.X, out extLandData.Y);
m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
extLandData.RegionHandle, extLandData.X, extLandData.Y);
// for this region or for somewhere else?
if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle)
{

View File

@ -229,13 +229,13 @@ namespace OpenSim.Region.CoreModules.World.Land
newData.SnapshotID = args.SnapshotID;
newData.UserLocation = args.UserLocation;
newData.UserLookAt = args.UserLookAt;
newData.MediaType = args.MediaType;
newData.MediaDescription = args.MediaDescription;
newData.MediaWidth = args.MediaWidth;
newData.MediaHeight = args.MediaHeight;
newData.MediaLoop = args.MediaLoop;
newData.ObscureMusic = args.ObscureMusic;
newData.ObscureMedia = args.ObscureMedia;
newData.MediaType = args.MediaType;
newData.MediaDescription = args.MediaDescription;
newData.MediaWidth = args.MediaWidth;
newData.MediaHeight = args.MediaHeight;
newData.MediaLoop = args.MediaLoop;
newData.ObscureMusic = args.ObscureMusic;
newData.ObscureMedia = args.ObscureMedia;
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")]
public class MoapModule : INonSharedRegionModule, IMoapModule
{
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string Name { get { return "MoapModule"; } }
public Type ReplaceableInterface { get { return null; } }
public string Name { get { return "MoapModule"; } }
public Type ReplaceableInterface { get { return null; } }
/// <summary>
/// Is this module enabled?
@ -78,17 +78,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap
/// <summary>
/// Track the ObjectMedia capabilities given to users keyed by agent. Lock m_omCapUsers to manipulate.
/// </summary>
protected Dictionary<UUID, string> m_omCapUrls = new Dictionary<UUID, string>();
protected Dictionary<UUID, string> m_omCapUrls = new Dictionary<UUID, string>();
/// <summary>
/// Track the ObjectMediaUpdate capabilities given to users keyed by path
/// </summary>
/// </summary>
protected Dictionary<string, UUID> m_omuCapUsers = new Dictionary<string, UUID>();
/// <summary>
/// Track the ObjectMediaUpdate capabilities given to users keyed by agent. Lock m_omuCapUsers to manipulate
/// </summary>
protected Dictionary<UUID, string> m_omuCapUrls = new Dictionary<UUID, string>();
/// </summary>
protected Dictionary<UUID, string> m_omuCapUrls = new Dictionary<UUID, string>();
public void Initialise(IConfigSource configSource)
{
@ -129,7 +129,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps;
m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy;
}
}
public void OnRegisterCaps(UUID agentID, Caps caps)
{
@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
caps.RegisterHandler(
"ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage));
}
}
}
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)
{
{
if (original.Shape.Media != null)
{
PrimitiveBaseShape.MediaList dupeMedia = new PrimitiveBaseShape.MediaList();
@ -195,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
}
copy.Shape.Media = dupeMedia;
}
}
}
public MediaEntry GetMediaEntry(SceneObjectPart part, int face)
@ -211,9 +211,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
me = null;
}
else
{
{
lock (media)
me = media[face];
me = media[face];
// TODO: Really need a proper copy constructor down in libopenmetaverse
if (me != null)
@ -227,17 +227,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap
public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
{
CheckFaceParam(part, face);
CheckFaceParam(part, face);
if (null == part.Shape.Media)
part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]);
lock (part.Shape.Media)
lock (part.Shape.Media)
part.Shape.Media[face] = me;
UpdateMediaUrl(part, UUID.Zero);
UpdateMediaUrl(part, UUID.Zero);
part.ScheduleFullUpdate();
part.TriggerScriptChangedEvent(Changed.MEDIA);
part.TriggerScriptChangedEvent(Changed.MEDIA);
}
public void ClearMediaEntry(SceneObjectPart part, int face)
@ -256,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
/// <returns></returns>
protected string HandleObjectMediaMessage(
string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
{
// m_log.DebugFormat("[MOAP]: Got ObjectMedia path [{0}], raw request [{1}]", path, request);
OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request);
@ -266,12 +266,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap
if (omm.Request is ObjectMediaRequest)
return HandleObjectMediaRequest(omm.Request as ObjectMediaRequest);
else if (omm.Request is ObjectMediaUpdate)
return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate);
return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate);
throw new Exception(
string.Format(
"[MOAP]: ObjectMediaMessage has unrecognized ObjectMediaBlock of {0}",
omm.Request.GetType()));
omm.Request.GetType()));
}
/// <summary>
@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
/// </summary>
/// <param name="omr"></param>
/// <returns></returns>
protected string HandleObjectMediaRequest(ObjectMediaRequest omr)
protected string HandleObjectMediaRequest(ObjectMediaRequest omr)
{
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="omu">/param>
/// <returns></returns>
protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu)
protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu)
{
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}",
primId, m_scene.RegionInfo.RegionName);
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++)
// {
@ -374,14 +374,14 @@ namespace OpenSim.Region.CoreModules.Media.Moap
part.Shape.Textures = te;
// m_log.DebugFormat(
// "[MOAP]: Media flags for face {0} is {1}",
// i, part.Shape.Textures.FaceTextures[i].MediaFlags);
// i, part.Shape.Textures.FaceTextures[i].MediaFlags);
}
}
}
else
{
{
// 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
// overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry
@ -391,18 +391,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap
lock (media)
{
for (int i = 0; i < media.Count; i++)
{
{
if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i))
{
{
media[i] = omu.FaceMedia[i];
// 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.
if (null == media[i])
continue;
continue;
Primitive.TextureEntryFace face = te.CreateFace((uint)i);
face.MediaFlags = true;
face.MediaFlags = true;
// m_log.DebugFormat(
// "[MOAP]: Media flags for face {0} is {1}",
@ -414,11 +414,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap
part.Shape.Textures = te;
// 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]);
// 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]);
}
UpdateMediaUrl(part, agentId);
UpdateMediaUrl(part, agentId);
// Arguably, we could avoid sending a full update to the avatar that just changed the texture.
part.ScheduleFullUpdate();
@ -439,16 +439,16 @@ namespace OpenSim.Region.CoreModules.Media.Moap
/// <returns></returns>
protected string HandleObjectMediaNavigateMessage(
string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
{
// m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request [{0}]", request);
OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request);
ObjectMediaNavigateMessage omn = new ObjectMediaNavigateMessage();
omn.Deserialize(osd);
omn.Deserialize(osd);
UUID primId = omn.PrimID;
SceneObjectPart part = m_scene.GetSceneObjectPart(primId);
SceneObjectPart part = m_scene.GetSceneObjectPart(primId);
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}",
primId, m_scene.RegionInfo.RegionName);
return string.Empty;
}
}
UUID agentId = default(UUID);
lock (m_omuCapUsers)
agentId = m_omuCapUsers[path];
agentId = m_omuCapUsers[path];
if (!m_scene.Permissions.CanInteractWithPrimMedia(agentId, part.UUID, omn.Face))
return string.Empty;
@ -484,7 +484,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
return string.Empty;
if (me.EnableWhiteList)
{
{
if (!CheckUrlAgainstWhitelist(omn.URL, me.WhiteList))
{
// m_log.DebugFormat(
@ -493,18 +493,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap
return string.Empty;
}
}
}
me.CurrentURL = omn.URL;
UpdateMediaUrl(part, agentId);
part.ScheduleFullUpdate();
part.ScheduleFullUpdate();
part.TriggerScriptChangedEvent(Changed.MEDIA);
return OSDParser.SerializeLLSDXmlString(new OSD());
}
}
/// <summary>
/// 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;
if (face > maxFaces)
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>
@ -542,9 +542,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
string rawVersion = part.MediaUrl.Substring(5, 10);
int version = int.Parse(rawVersion);
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>
@ -554,7 +554,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
/// <param name="whitelist"></param>
/// <returns>true if the url matches an entry on the whitelist, false otherwise</returns>
protected bool CheckUrlAgainstWhitelist(string rawUrl, string[] whitelist)
{
{
Uri url = new Uri(rawUrl);
foreach (string origWlUrl in whitelist)
@ -575,7 +575,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
if (url.Host.Contains(wlUrl))
{
// m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl);
return true;
return true;
}
}
else
@ -588,7 +588,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
return true;
}
}
}
}
return false;
}

View File

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

View File

@ -397,13 +397,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
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>();
// This log line will be commented out when no longer required for debugging
// 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()
@ -1906,7 +1906,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
private bool CanControlPrimMedia(UUID agentID, UUID primID, int face)
{
{
// m_log.DebugFormat(
// "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}",
// agentID, primID, face);
@ -1918,7 +1918,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (null == part)
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 (null == me)
@ -1929,7 +1929,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// agentID, primID, face, me.ControlPermissions);
return GenericPrimMediaPermission(part, agentID, me.ControlPermissions);
}
}
private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face)
{
@ -1952,15 +1952,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// m_log.DebugFormat(
// "[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);
}
}
private bool GenericPrimMediaPermission(SceneObjectPart part, UUID agentID, MediaPermission perms)
{
// if (IsAdministrator(agentID))
// return true;
// return true;
if ((perms & MediaPermission.Anyone) == MediaPermission.Anyone)
return true;
@ -1969,15 +1969,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
{
if (agentID == part.OwnerID)
return true;
}
}
if ((perms & MediaPermission.Group) == MediaPermission.Group)
{
if (IsGroupMember(part.GroupID, agentID, 0))
return true;
}
}
return false;
return false;
}
}
}

View File

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

View File

@ -165,12 +165,12 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
return SceneXmlLoader.SaveGroupToXml2(grp);
}
public void SavePrimListToXml2(List<EntityBase> entityList, string fileName)
public void SavePrimListToXml2(EntityBase[] entityList, string 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);
}

View File

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

View File

@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules
{
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
// 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();
tc = Environment.TickCount;
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>();
//SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>();
List<float> z_sortheights = new List<float>();
@ -228,7 +228,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
SceneObjectGroup mapdot = (SceneObjectGroup)obj;
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;
lock (mapdot.Children)
partList = new List<SceneObjectPart>(mapdot.Children.Values);

View File

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

View File

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

View File

@ -56,7 +56,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="rot"></param>
/// <param name="attachPos"></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(
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
/// </summary>
/// <param name="datastore"></param>
void ProcessInventoryBackup(IRegionDataStore datastore);
void ProcessInventoryBackup(ISimulationDataService datastore);
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
/// </summary>
/// <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);
void ActivateGroup(IClientAPI remoteClient, UUID groupID);
@ -74,14 +74,14 @@ namespace OpenSim.Region.Framework.Interfaces
List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID);
List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID);
GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID);
GroupMembershipData[] GetMembershipData(UUID UserID);
GroupMembershipData[] GetMembershipData(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 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);
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>
public delegate void InventoryArchiveSaved(
Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException);
public interface IInventoryArchiverModule
{
/// <summary>
/// Fired when an archive inventory save has been completed.
/// </summary>
event InventoryArchiveSaved OnInventoryArchiveSaved;
/// <summary>
/// Dearchive a user's inventory folder from the given stream
/// </summary>
@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <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>
bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream);
/// <summary>
/// Dearchive a user's inventory folder from the given stream
/// </summary>
@ -72,8 +72,8 @@ namespace OpenSim.Region.Framework.Interfaces
/// the loaded IAR with existing folders where possible.</param>
/// <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,
Dictionary<string, object> options);
string firstName, string lastName, string invPath, string pass, Stream loadStream,
Dictionary<string, object> options);
/// <summary>
/// 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>
/// <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);
/// <summary>
/// Archive a user's inventory folder to the given stream
/// </summary>
@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="options">Archiving options. Currently, there are none.</param>
/// <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,
Dictionary<string, object> options);
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
Dictionary<string, object> options);
}
}

View File

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

View File

@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// </summary>
/// <param name="entityList"></param>
/// <param name="fileName"></param>
void SavePrimListToXml2(List<EntityBase> entityList, string fileName);
void SavePrimListToXml2(EntityBase[] entityList, string fileName);
/// <summary>
/// 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="min"></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);

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
{
public interface IRegionDataStore
public interface ISimulationDataStore
{
/// <summary>
/// Initialises the data storage engine

View File

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

View File

@ -34,227 +34,89 @@ using OpenMetaverse;
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 readonly Dictionary<UUID,EntityBase> m_eb_uuid = new Dictionary<UUID, 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();
private readonly DoubleDictionary<UUID, uint, EntityBase> m_entities = new DoubleDictionary<UUID, uint, EntityBase>();
[Obsolete("Use Add() instead.")]
public void Add(UUID id, EntityBase eb)
public int Count
{
Add(eb);
get { return m_entities.Count; }
}
public void Add(EntityBase entity)
{
m_lock.EnterWriteLock();
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();
}
m_entities.Add(entity.UUID, entity.LocalId, entity);
}
public void Clear()
{
m_lock.EnterWriteLock();
try
{
m_eb_uuid.Clear();
m_eb_localID.Clear();
}
finally
{
m_lock.ExitWriteLock();
}
}
public int Count
{
get
{
return m_eb_uuid.Count;
}
m_entities.Clear();
}
public bool ContainsKey(UUID id)
{
try
{
return m_eb_uuid.ContainsKey(id);
}
catch
{
return false;
}
return m_entities.ContainsKey(id);
}
public bool ContainsKey(uint localID)
{
try
{
return m_eb_localID.ContainsKey(localID);
}
catch
{
return false;
}
return m_entities.ContainsKey(localID);
}
public bool Remove(uint localID)
{
m_lock.EnterWriteLock();
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();
}
return m_entities.Remove(localID);
}
public bool Remove(UUID id)
{
m_lock.EnterWriteLock();
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();
}
return m_entities.Remove(id);
}
public List<EntityBase> GetAllByType<T>()
public EntityBase[] GetAllByType<T>()
{
List<EntityBase> tmp = new List<EntityBase>();
m_lock.EnterReadLock();
try
{
try
m_entities.ForEach(
delegate(EntityBase entity)
{
foreach (KeyValuePair<UUID, EntityBase> pair in m_eb_uuid)
{
if (pair.Value is T)
{
tmp.Add(pair.Value);
}
}
if (entity is T)
tmp.Add(entity);
}
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();
try
{
return new List<EntityBase>(m_eb_uuid.Values);
}
finally
{
m_lock.ExitReadLock();
}
List<EntityBase> tmp = new List<EntityBase>(m_entities.Count);
m_entities.ForEach(delegate(EntityBase entity) { tmp.Add(entity); });
return tmp.ToArray();
}
public void ForEach(Action<EntityBase> action)
{
m_entities.ForEach(action);
}
public EntityBase Find(Predicate<EntityBase> predicate)
{
return m_entities.FindValue(predicate);
}
public EntityBase this[UUID id]
{
get
{
m_lock.EnterReadLock();
try
{
EntityBase entity;
if (m_eb_uuid.TryGetValue(id, out entity))
return entity;
else
return null;
}
finally
{
m_lock.ExitReadLock();
}
EntityBase entity;
m_entities.TryGetValue(id, out entity);
return entity;
}
set
{
InsertOrReplace(value);
Add(value);
}
}
@ -262,65 +124,24 @@ namespace OpenSim.Region.Framework.Scenes
{
get
{
m_lock.EnterReadLock();
try
{
EntityBase entity;
if (m_eb_localID.TryGetValue(localID, out entity))
return entity;
else
return null;
}
finally
{
m_lock.ExitReadLock();
}
EntityBase entity;
m_entities.TryGetValue(localID, out entity);
return entity;
}
set
{
InsertOrReplace(value);
Add(value);
}
}
public bool TryGetValue(UUID key, out EntityBase obj)
{
m_lock.EnterReadLock();
try
{
return m_eb_uuid.TryGetValue(key, out obj);
}
finally
{
m_lock.ExitReadLock();
}
return m_entities.TryGetValue(key, out obj);
}
public bool TryGetValue(uint key, out EntityBase obj)
{
m_lock.EnterReadLock();
try
{
return m_eb_localID.TryGetValue(key, out obj);
}
finally
{
m_lock.ExitReadLock();
}
return m_entities.TryGetValue(key, out obj);
}
/// <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 delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup);
public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup);
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
/// 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 event Attach OnAttach;
public event Attach OnAttach;
/// <summary>
/// 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.
/// </summary>
/// <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.
/// </param>
/// <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 RegionUp(GridRegion region);
public event RegionUp OnRegionUp;
public event RegionUp OnRegionUp;
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;
if (handlerOnAttach != null)
@ -2087,7 +2087,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
}
}
public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo)
{
@ -2129,7 +2129,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
}
}
public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
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.Collections.Generic;
using log4net;
@ -35,7 +62,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// 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
/// 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.
@ -123,9 +150,9 @@ namespace OpenSim.Region.Framework.Scenes
if (entity is SceneObjectPart)
{
// 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 = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
}
else
{
@ -152,15 +179,10 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 entityPos = entity.AbsolutePosition;
if (entity is SceneObjectPart)
{
SceneObjectGroup group = m_scene.GetGroupByPrim(entity.LocalId);
if (group == null)
{
entityPos = entity.AbsolutePosition;
}
else
{
entityPos = group.AbsolutePosition;
}
// Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
// before its scheduled update was triggered
//entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
}
else
{

View File

@ -58,7 +58,8 @@ namespace OpenSim.Region.Framework.Scenes
{
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)
{
@ -132,7 +133,7 @@ namespace OpenSim.Region.Framework.Scenes
item.Owner, item.Name, item.ID);
return false;
}
}
}
/// <summary>
@ -1987,7 +1988,7 @@ namespace OpenSim.Region.Framework.Scenes
return null;
if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos))
return null;
return null;
if (!Permissions.BypassPermissions())
{
@ -2065,7 +2066,7 @@ namespace OpenSim.Region.Framework.Scenes
List<SceneObjectPart> partList = null;
lock (sog.Children)
partList = new List<SceneObjectPart>(sog.Children.Values);
partList = new List<SceneObjectPart>(sog.Children.Values);
foreach (SceneObjectPart child in partList)
child.Inventory.ChangeInventoryOwner(ownerID);
@ -2080,7 +2081,7 @@ namespace OpenSim.Region.Framework.Scenes
List<SceneObjectPart> partList = null;
lock (sog.Children)
partList = new List<SceneObjectPart>(sog.Children.Values);
partList = new List<SceneObjectPart>(sog.Children.Values);
foreach (SceneObjectPart child in partList)
{
@ -2090,7 +2091,7 @@ namespace OpenSim.Region.Framework.Scenes
sog.SetOwnerId(groupID);
sog.ApplyNextOwnerPermissions();
}
}
}
foreach (uint localID in localIDs)

View File

@ -116,9 +116,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param>
public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
{
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
@ -138,9 +137,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param>
public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
{
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
@ -166,7 +164,7 @@ namespace OpenSim.Region.Framework.Scenes
List<SceneObjectPart> partList = null;
lock (sog.Children)
partList = new List<SceneObjectPart>(sog.Children.Values);
partList = new List<SceneObjectPart>(sog.Children.Values);
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)
{
List<EntityBase> EntityList = GetEntities();
EntityBase[] EntityList = GetEntities();
SurfaceTouchEventArgs surfaceArg = null;
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)
{
List<EntityBase> EntityList = GetEntities();
EntityBase[] EntityList = GetEntities();
SurfaceTouchEventArgs surfaceArg = null;
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)
{
List<EntityBase> EntityList = GetEntities();
EntityBase[] EntityList = GetEntities();
SurfaceTouchEventArgs surfaceArg = null;
if (surfaceArgs != null && surfaceArgs.Count > 0)

View File

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

View File

@ -57,55 +57,21 @@ namespace OpenSim.Region.Framework.Scenes
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_MAX_TIME_FOR_PERSISTENCE = 600L;
public delegate void SynchronizeSceneHandler(Scene scene);
#region Fields
protected Timer m_restartWaitTimer = new Timer();
public SynchronizeSceneHandler SynchronizeScene;
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> EastBorders = new List<Border>();
public List<Border> SouthBorders = new List<Border>();
public List<Border> WestBorders = new List<Border>();
/// <value>
/// 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>
/// <summary>Are we applying physics to any of the prims in this scene?</summary>
public bool m_physicalPrim;
public float m_maxNonphys = 256;
public float m_maxPhys = 10;
@ -119,25 +85,131 @@ namespace OpenSim.Region.Framework.Scenes
// root agents when ACL denies access to root agent
public bool m_strictAccessControl = true;
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 readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
private int m_incrementsof15seconds;
private volatile bool m_backingup;
private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
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;
protected StorageManager m_storageManager;
protected AgentCircuitManager m_authenticateHandler;
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;
protected SceneCommunicationService m_sceneGridService;
public bool LoginsDisabled = true;
public bool LoadingPrims = 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
{
get { return m_sceneGraph.PhysicsScene.TimeDilation; }
@ -148,9 +220,6 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_sceneGridService; }
}
public IXfer XferManager;
protected ISnmpModule m_snmpService = null;
public ISnmpModule SnmpService
{
get
@ -164,10 +233,41 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected IAssetService m_AssetService;
protected IAuthorizationService m_AuthorizationService;
public ISimulationDataService SimulationDataService
{
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
{
@ -206,8 +306,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected IInventoryService m_InventoryService;
public IInventoryService InventoryService
{
get
@ -226,8 +324,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected IGridService m_GridService;
public IGridService GridService
{
get
@ -246,8 +342,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected ILibraryService m_LibraryService;
public ILibraryService LibraryService
{
get
@ -259,7 +353,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected ISimulationService m_simulationService;
public ISimulationService SimulationService
{
get
@ -270,7 +363,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected IAuthenticationService m_AuthenticationService;
public IAuthenticationService AuthenticationService
{
get
@ -281,7 +373,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected IPresenceService m_PresenceService;
public IPresenceService PresenceService
{
get
@ -291,7 +382,7 @@ namespace OpenSim.Region.Framework.Scenes
return m_PresenceService;
}
}
protected IUserAccountService m_UserAccountService;
public IUserAccountService UserAccountService
{
get
@ -302,8 +393,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected OpenSim.Services.Interfaces.IAvatarService m_AvatarService;
public OpenSim.Services.Interfaces.IAvatarService AvatarService
public IAvatarService AvatarService
{
get
{
@ -313,7 +403,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected IGridUserService m_GridUserService;
public IGridUserService GridUserService
{
get
@ -324,58 +413,18 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected IXMLRPC m_xmlrpcModule;
protected IWorldComm m_worldCommModule;
public IAttachmentsModule AttachmentsModule { get; set; }
protected IAvatarFactory m_AvatarFactory;
public IAvatarFactory 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
{
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 MonitorPhysicsUpdateTime { get { return physicsMS; } }
public int MonitorPhysicsSyncTime { get { return physicsMS2; } }
@ -387,37 +436,6 @@ namespace OpenSim.Region.Framework.Scenes
public int MonitorLandTime { get { return landMS; } }
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 bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } }
public double ReprioritizationInterval { get { return m_reprioritizationInterval; } }
@ -497,13 +515,13 @@ namespace OpenSim.Region.Framework.Scenes
set { m_sceneGraph.RestorePresences = value; }
}
#endregion
#endregion Properties
#region Constructors
public Scene(RegionInfo regInfo, AgentCircuitManager authen,
SceneCommunicationService sceneGridService,
StorageManager storeManager,
ISimulationDataService simDataService, IEstateDataService estateDataService,
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim,
bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion)
{
@ -539,7 +557,8 @@ namespace OpenSim.Region.Framework.Scenes
m_moduleLoader = moduleLoader;
m_authenticateHandler = authen;
m_sceneGridService = sceneGridService;
m_storageManager = storeManager;
m_SimulationDataService = simDataService;
m_EstateDataService = estateDataService;
m_regInfo = regInfo;
m_regionHandle = m_regInfo.RegionHandle;
m_regionName = m_regInfo.RegionName;
@ -558,13 +577,11 @@ namespace OpenSim.Region.Framework.Scenes
#region Region Settings
// Load region settings
m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID);
m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(m_regInfo.RegionID);
m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(m_regInfo.RegionID);
if (m_storageManager.EstateDataStore != null)
{
m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
}
m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID);
if (estateDataService != null)
m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
#endregion Region Settings
@ -574,9 +591,9 @@ namespace OpenSim.Region.Framework.Scenes
//Bind Storage Manager functions to some land manager functions for this scene
EventManager.OnLandObjectAdded +=
new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject);
new EventManager.LandObjectAdded(simDataService.StoreLandObject);
EventManager.OnLandObjectRemoved +=
new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject);
new EventManager.LandObjectRemoved(simDataService.RemoveLandObject);
m_sceneGraph = new SceneGraph(this, m_regInfo);
@ -1062,29 +1079,30 @@ namespace OpenSim.Region.Framework.Scenes
if (ScriptEngine)
{
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)
{
((SceneObjectGroup) ent).RemoveScriptInstances(false);
}
((SceneObjectGroup)ent).RemoveScriptInstances(false);
}
}
else
{
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)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0);
((SceneObjectGroup)ent).ResumeScripts();
}
SceneObjectGroup sog = (SceneObjectGroup)ent;
sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
sog.ResumeScripts();
}
}
}
m_scripts_enabled = !ScriptEngine;
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;
m_log.Debug("[SCENE]: Persisting changed objects");
List<EntityBase> entities = GetEntities();
EntityBase[] entities = GetEntities();
foreach (EntityBase entity in entities)
{
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)
{
MainConsole.Instance.Output("The current estate has no owner set.");
string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test");
string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User");
List<char> excluded = new List<char>(new char[1]{' '});
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);
@ -1577,7 +1596,7 @@ namespace OpenSim.Region.Framework.Scenes
{
lock (m_returns)
{
EventManager.TriggerOnBackup(m_storageManager.DataStore, forced);
EventManager.TriggerOnBackup(SimulationDataService, forced);
m_backingup = false;
foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns)
@ -1618,7 +1637,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (group != null)
{
group.ProcessBackup(m_storageManager.DataStore, true);
group.ProcessBackup(SimulationDataService, true);
}
}
@ -1660,20 +1679,19 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void SaveTerrain()
{
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
}
public void StoreWindlightProfile(RegionLightShareData wl)
{
m_regInfo.WindlightSettings = wl;
wl.Save();
m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
SimulationDataService.StoreRegionWindlightSettings(wl);
m_eventManager.TriggerOnSaveNewWindlightProfile();
}
public void LoadWindlightProfile()
{
m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(RegionInfo.RegionID);
m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID);
m_eventManager.TriggerOnSaveNewWindlightProfile();
}
@ -1684,13 +1702,13 @@ namespace OpenSim.Region.Framework.Scenes
{
try
{
double[,] map = m_storageManager.DataStore.LoadTerrain(RegionInfo.RegionID);
double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID);
if (map == null)
{
m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain.");
Heightmap = new TerrainChannel();
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
}
else
{
@ -1707,7 +1725,7 @@ namespace OpenSim.Region.Framework.Scenes
{
Heightmap = new TerrainChannel();
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
}
}
catch (Exception e)
@ -1754,7 +1772,7 @@ namespace OpenSim.Region.Framework.Scenes
public void loadAllLandObjectsFromStorage(UUID regionID)
{
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)
{
@ -1785,7 +1803,7 @@ namespace OpenSim.Region.Framework.Scenes
LoadingPrims = true;
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");
@ -1978,7 +1996,7 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.ScheduleGroupForFullUpdate();
return sceneObject;
}
}
/// <summary>
/// Add an object into the scene that has come from storage
@ -2074,7 +2092,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns>
public bool AddNewSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 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>();
lock (Entities)
{
ICollection<EntityBase> entities = new List<EntityBase>(Entities);
EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase e in entities)
{
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
// to the DB.
ForceSceneObjectBackup(so);
so.DetachFromBackup();
m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID);
so.DetachFromBackup();
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.
so.IsDeleted = true;
so.IsDeleted = true;
return true;
}
@ -2482,7 +2499,7 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence sp = GetScenePresence(userID);
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);
}
@ -2531,7 +2548,7 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
// 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);
// Handle attachment special case
@ -2788,7 +2805,7 @@ namespace OpenSim.Region.Framework.Scenes
}
public virtual void SubscribeToClientPrimEvents(IClientAPI client)
{
{
client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition;
client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition;
client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation;
@ -2824,7 +2841,7 @@ namespace OpenSim.Region.Framework.Scenes
client.OnUndo += m_sceneGraph.HandleUndo;
client.OnRedo += m_sceneGraph.HandleRedo;
client.OnObjectDescription += m_sceneGraph.PrimDescription;
client.OnObjectDrop += m_sceneGraph.DropObject;
client.OnObjectDrop += m_sceneGraph.DropObject;
client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable;
client.OnObjectOwner += ObjectOwner;
}
@ -3804,7 +3821,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
{
ScenePresence presence = GetScenePresence(agentID);
if(presence != null)
if (presence != null)
{
try
{
@ -4083,6 +4100,11 @@ namespace OpenSim.Region.Framework.Scenes
#region Other Methods
protected override IConfigSource GetConfig()
{
return m_config;
}
#endregion
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>
public void ForceClientUpdate()
{
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
@ -4127,9 +4148,8 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'");
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
@ -4498,7 +4518,7 @@ namespace OpenSim.Region.Framework.Scenes
/// will not affect the original list of objects in the scene.
/// </summary>
/// <returns></returns>
public List<EntityBase> GetEntities()
public EntityBase[] GetEntities()
{
return m_sceneGraph.GetEntities();
}
@ -4532,9 +4552,8 @@ namespace OpenSim.Region.Framework.Scenes
public void CleanTempObjects()
{
List<EntityBase> objs = GetEntities();
foreach (EntityBase obj in objs)
EntityBase[] entities = GetEntities();
foreach (EntityBase obj in entities)
{
if (obj is SceneObjectGroup)
{
@ -4554,7 +4573,7 @@ namespace OpenSim.Region.Framework.Scenes
public void DeleteFromStorage(UUID uuid)
{
m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID);
SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID);
}
public int GetHealth()
@ -4963,17 +4982,21 @@ namespace OpenSim.Region.Framework.Scenes
public List<UUID> GetEstateRegions(int estateID)
{
if (m_storageManager.EstateDataStore == null)
return new List<UUID>();
IEstateDataService estateDataService = EstateDataService;
if (estateDataService == null)
return new List<UUID>(0);
return m_storageManager.EstateDataStore.GetRegions(estateID);
return estateDataService.GetRegions(estateID);
}
public void ReloadEstateData()
{
m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
TriggerEstateSunUpdate();
IEstateDataService estateDataService = EstateDataService;
if (estateDataService != null)
{
m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
TriggerEstateSunUpdate();
}
}
public void TriggerEstateSunUpdate()

View File

@ -521,7 +521,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="shorthelp"></param>
/// <param name="longhelp"></param>
/// <param name="descriptivehelp"></param>
/// <param name="callback"></param>
/// <param name="callback"></param>
public void AddCommand(
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 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 Dictionary<UUID, EntityBase> Entities = new Dictionary<UUID, EntityBase>();
protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>();
protected RegionInfo m_regInfo;
@ -323,7 +320,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="pos">Position 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>
/// <returns></returns>
/// <returns></returns>
public bool AddNewSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
{
@ -347,7 +344,7 @@ namespace OpenSim.Region.Framework.Scenes
}
return true;
}
}
/// <summary>
/// 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)
return false;
lock (sceneObject)
{
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 (Entities.ContainsKey(sceneObject.UUID))
return false;
if (sendClientUpdates)
sceneObject.ScheduleGroupForFullUpdate();
Entities.Add(sceneObject);
List<SceneObjectPart> children;
lock (sceneObject.Children)
children = new List<SceneObjectPart>(sceneObject.Children.Values);
if (attachToBackup)
sceneObject.AttachToBackup();
// Clamp child prim sizes and add child prims to the m_numPrim count
if (m_parentScene.m_clampPrimSize)
{
foreach (SceneObjectPart part in children)
{
Vector3 scale = part.Shape.Scale;
if (OnObjectCreate != null)
OnObjectCreate(sceneObject);
lock (SceneObjectGroupsByFullID)
{
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
foreach (SceneObjectPart part in sceneObject.Children.Values)
SceneObjectGroupsByFullID[part.UUID] = sceneObject;
}
lock (SceneObjectGroupsByLocalID)
{
SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
foreach (SceneObjectPart part in sceneObject.Children.Values)
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
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 += 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;
}
@ -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>
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)
{
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;
if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
RemovePhysicalPrim(grp.PrimCount);
}
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>
@ -490,9 +472,7 @@ namespace OpenSim.Region.Framework.Scenes
protected internal void AddToUpdateList(SceneObjectGroup obj)
{
lock (m_updateList)
{
m_updateList[obj.UUID] = obj;
}
}
public void FireAttachToBackup(SceneObjectGroup obj)
@ -526,34 +506,39 @@ namespace OpenSim.Region.Framework.Scenes
{
if (!Monitor.TryEnter(m_updateLock))
return;
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)
try
{
updates = new List<SceneObjectGroup>(m_updateList.Values);
m_updateList.Clear();
}
List<SceneObjectGroup> updates;
// Go through all updates
for (int i = 0; i < updates.Count; i++)
{
SceneObjectGroup sog = updates[i];
// Don't abort the whole update if one entity happens to give us an exception.
try
// Some updates add more updates to the updateList.
// Get the current list of updates and clear the list before iterating
lock (m_updateList)
{
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(
"[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e);
SceneObjectGroup sog = updates[i];
// 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)
@ -920,38 +905,38 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>null if no scene object group containing that prim is found</returns>
public SceneObjectGroup GetGroupByPrim(uint localID)
{
if (Entities.ContainsKey(localID))
return Entities[localID] as SceneObjectGroup;
EntityBase entity;
if (Entities.TryGetValue(localID, out entity))
return entity as SceneObjectGroup;
//m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
SceneObjectGroup sog;
lock (SceneObjectGroupsByLocalID)
SceneObjectGroupsByLocalID.TryGetValue(localID, out sog);
if (sog != null)
{
if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog))
{
if (sog.HasChildPrim(localID))
return sog;
SceneObjectGroupsByLocalID.Remove(localID);
}
if (sog.HasChildPrim(localID))
return sog;
SceneObjectGroupsByLocalID.Remove(localID);
}
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
{
//m_log.DebugFormat("Looking at entity {0}", ent.UUID);
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).HasChildPrim(localID))
sog = (SceneObjectGroup)ent;
if (sog.HasChildPrim(localID))
{
sog = (SceneObjectGroup)ent;
lock (SceneObjectGroupsByLocalID)
{
SceneObjectGroupsByLocalID[localID] = sog;
}
return sog;
}
}
}
return null;
}
@ -964,36 +949,35 @@ namespace OpenSim.Region.Framework.Scenes
{
SceneObjectGroup sog;
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;
}
SceneObjectGroupsByFullID.Remove(fullID);
if (sog.Children.ContainsKey(fullID))
return sog;
}
lock (SceneObjectGroupsByFullID)
SceneObjectGroupsByFullID.Remove(fullID);
}
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).HasChildPrim(fullID))
sog = (SceneObjectGroup)ent;
if (sog.HasChildPrim(fullID))
{
sog = (SceneObjectGroup)ent;
lock (SceneObjectGroupsByFullID)
{
SceneObjectGroupsByFullID[fullID] = sog;
}
return sog;
}
}
}
return null;
}
@ -1002,7 +986,7 @@ namespace OpenSim.Region.Framework.Scenes
// Primitive Ray Tracing
float closestDistance = 280f;
EntityIntersection result = new EntityIntersection();
List<EntityBase> EntityList = GetEntities();
EntityBase[] EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
{
if (ent is SceneObjectGroup)
@ -1040,23 +1024,28 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>null if the part was not found</returns>
protected internal SceneObjectPart GetSceneObjectPart(string name)
{
List<EntityBase> EntityList = GetEntities();
SceneObjectPart sop = null;
// FIXME: use a dictionary here
foreach (EntityBase ent in EntityList)
{
if (ent is SceneObjectGroup)
Entities.Find(
delegate(EntityBase entity)
{
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>
@ -1077,7 +1066,7 @@ namespace OpenSim.Region.Framework.Scenes
/// it
/// </summary>
/// <returns></returns>
protected internal List<EntityBase> GetEntities()
protected internal EntityBase[] GetEntities()
{
return Entities.GetEntities();
}
@ -1086,7 +1075,7 @@ namespace OpenSim.Region.Framework.Scenes
{
Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
List<EntityBase> EntityList = GetEntities();
EntityBase[] EntityList = GetEntities();
int limit = 0;
foreach (EntityBase ent in EntityList)
{
@ -1140,7 +1129,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="action"></param>
protected internal void ForEachSOG(Action<SceneObjectGroup> action)
{
List<EntityBase> objlist = Entities.GetAllByType<SceneObjectGroup>();
EntityBase[] objlist = Entities.GetAllByType<SceneObjectGroup>();
foreach (EntityBase ent in objlist)
{
SceneObjectGroup obj = (SceneObjectGroup)ent;
@ -1353,7 +1342,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
{
if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
{
if (m_parentScene.AttachmentsModule != null)
@ -1798,8 +1787,8 @@ namespace OpenSim.Region.Framework.Scenes
UUID objid = UUID.Zero;
SceneObjectPart obj = null;
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{

View File

@ -1326,7 +1326,7 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = detachedpos;
m_rootPart.AttachedAvatar = UUID.Zero;
//Anakin Lohner bug #3839
//Anakin Lohner bug #3839
lock (m_parts)
{
foreach (SceneObjectPart p in m_parts.Values)
@ -1556,7 +1556,7 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
/// Delete this group from its scene.
/// Delete this group from its scene.
/// </summary>
///
/// 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.
/// </summary>
/// <param name="datastore"></param>
public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup)
public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup)
{
if (!m_isBackedUp)
{
// 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;
}
@ -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
// any exception propogate upwards.
// any exception propogate upwards.
try
{
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.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
}
}
if (userExposed)
{
@ -1954,7 +1953,6 @@ namespace OpenSim.Region.Framework.Scenes
ScheduleGroupForFullUpdate();
}
}
finally
{
@ -2515,16 +2513,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>null if a child part with the primID was not found</returns>
public SceneObjectPart GetChildPart(UUID primID)
{
SceneObjectPart childPart = null;
SceneObjectPart childPart;
lock (m_parts)
{
if (m_parts.ContainsKey(primID))
{
childPart = m_parts[primID];
}
}
m_parts.TryGetValue(primID, out childPart);
return childPart;
}

View File

@ -508,7 +508,14 @@ namespace OpenSim.Region.Framework.Scenes
public UUID 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
@ -1027,12 +1034,12 @@ namespace OpenSim.Region.Framework.Scenes
return m_mediaUrl;
}
set
{
set
{
m_mediaUrl = value;
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_createSelected = value;
}
}
}
#endregion
@ -1207,7 +1214,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Property flags. See OpenMetaverse.PrimFlags
/// </summary>
/// </summary>
/// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge
public PrimFlags Flags
{
@ -1372,7 +1379,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Tell the scene presence that it should send updates for this part to its client
/// </summary>
/// </summary>
public void AddFullUpdateToAvatar(ScenePresence presence)
{
presence.SceneViewer.QueuePartForUpdate(this);
@ -1431,7 +1438,7 @@ namespace OpenSim.Region.Framework.Scenes
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
{
if(!sp.IsChildAgent)
if (!sp.IsChildAgent)
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);
return dupe;
return dupe;
}
protected void AssetReceived(string id, Object sender, AssetBase asset)
@ -1993,10 +2000,10 @@ namespace OpenSim.Region.Framework.Scenes
}
public uint GetEffectiveObjectFlags()
{
{
// Commenting this section of code out since it doesn't actually do anything, as enums are handled by
// value rather than reference
// PrimFlags f = _flags;
// PrimFlags f = _flags;
// if (m_parentGroup == null || m_parentGroup.RootPart == this)
// f &= ~(PrimFlags.Touch | PrimFlags.Money);
@ -2793,7 +2800,6 @@ namespace OpenSim.Region.Framework.Scenes
UUID = UUID.Random();
LinkNum = linkNum;
LocalId = 0;
Inventory.ResetInventoryIDs();
}
/// <summary>
@ -4756,7 +4762,7 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup == null || ParentGroup.IsDeleted)
return;
if (IsAttachment && ParentGroup.RootPart != this)
if (IsAttachment && ParentGroup.RootPart != this)
return;
// 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