diff --git a/.nant/local.include b/.nant/local.include index 114c12d28f..2591aba963 100644 --- a/.nant/local.include +++ b/.nant/local.include @@ -1,8 +1,59 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + +--> @@ -296,17 +347,3 @@ - - - - - - - - - - - - - - diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs index b15b3375ab..4333ef14eb 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs @@ -123,10 +123,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests private void DoMove(RequestData rdata) { - if (rdata.Parameters.Length >= 6) + if (rdata.Parameters.Length < 6) + { + Rest.Log.WarnFormat("{0} Move: No movement information provided", MsgId); + rdata.Fail(Rest.HttpStatusCodeBadRequest, "no movement information provided"); + } + else { string[] names = rdata.Parameters[PARM_MOVE_AVATAR].Split(Rest.CA_SPACE); - ScenePresence avatar = null; + ScenePresence presence = null; Scene scene = null; if (names.Length != 2) @@ -141,21 +146,19 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests // The first parameter should be an avatar name, look for the // avatar in the known regions first. - foreach (Scene cs in Rest.main.SceneManager.Scenes) + Rest.main.SceneManager.ForEachScene(delegate(Scene s) { - foreach (ScenePresence presence in cs.GetAvatars()) + s.ForEachScenePresence(delegate(ScenePresence sp) { - if (presence.Firstname == names[0] && - presence.Lastname == names[1]) + if (sp.Firstname == names[0] && sp.Lastname == names[1]) { - scene = cs; - avatar = presence; - break; + scene = s; + presence = sp; } - } - } + }); + }); - if (avatar != null) + if (presence != null) { Rest.Log.DebugFormat("{0} Move : Avatar {1} located in region {2}", MsgId, rdata.Parameters[PARM_MOVE_AVATAR], scene.RegionInfo.RegionName); @@ -166,14 +169,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests float y = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Y]); float z = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Z]); Vector3 vector = new Vector3(x,y,z); - avatar.DoAutoPilot(0,vector,avatar.ControllingClient); + presence.DoAutoPilot(0,vector,presence.ControllingClient); } catch (Exception e) { rdata.Fail(Rest.HttpStatusCodeBadRequest, String.Format("invalid parameters: {0}", e.Message)); } - } else { @@ -183,12 +185,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests rdata.Complete(); rdata.Respond("OK"); - - } - else - { - Rest.Log.WarnFormat("{0} Move: No movement information provided", MsgId); - rdata.Fail(Rest.HttpStatusCodeBadRequest, "no movement information provided"); } } diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs index ed18207216..dea166d2ec 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs @@ -192,7 +192,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions protected string RegionStats(OSHttpResponse httpResponse, Scene scene) { - int users = scene.GetAvatars().Count; + int users = scene.GetRootAgentCount(); int objects = scene.Entities.Count - users; RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs index 734b6685d2..279db4cbe4 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs @@ -117,7 +117,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions rxw.WriteString(s.RegionInfo.InternalEndPoint.ToString()); rxw.WriteEndAttribute(); - int users = s.GetAvatars().Count; + int users = s.GetRootAgentCount(); rxw.WriteStartAttribute(String.Empty, "avatars", String.Empty); rxw.WriteValue(users); rxw.WriteEndAttribute(); diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs index 6f6f076e68..474f706ed3 100644 --- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs +++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs @@ -83,7 +83,7 @@ namespace OpenSim.Data.MSSQL /// /// region ID. /// - public EstateSettings LoadEstateSettings(UUID regionID) + public EstateSettings LoadEstateSettings(UUID regionID, bool create) { EstateSettings es = new EstateSettings(); @@ -127,7 +127,7 @@ namespace OpenSim.Data.MSSQL } - if (insertEstate) + if (insertEstate && create) { List names = new List(FieldList); @@ -173,25 +173,6 @@ namespace OpenSim.Data.MSSQL } } - // Munge and transfer the ban list - - sql = string.Format("insert into estateban select {0}, bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = @UUID", es.EstateID); - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - - cmd.Parameters.Add(_Database.CreateParameter("@UUID", regionID)); - try - { - conn.Open(); - cmd.ExecuteNonQuery(); - } - catch (Exception) - { - _Log.Debug("[ESTATE DB]: Error setting up estateban from regionban"); - } - } - //TODO check if this is needed?? es.Save(); } @@ -365,6 +346,31 @@ namespace OpenSim.Data.MSSQL } } } + + public EstateSettings LoadEstateSettings(int estateID) + { + return new EstateSettings(); + } + + public List GetEstates(string search) + { + return new List(); + } + + public bool LinkRegion(UUID regionID, int estateID) + { + return false; + } + + public List GetRegions(int estateID) + { + return new List(); + } + + public bool DeleteEstate(int estateID) + { + return false; + } #endregion } } diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index 2eae2d82b2..d0c02f0647 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs @@ -121,111 +121,110 @@ namespace OpenSim.Data.MySQL } } - public EstateSettings LoadEstateSettings(UUID regionID) + public EstateSettings LoadEstateSettings(UUID regionID, bool create) { - EstateSettings es = new EstateSettings(); - es.OnSave += StoreEstateSettings; - string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) + " from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = ?RegionID"; - bool migration = true; + using (MySqlCommand cmd = new MySqlCommand()) + { + cmd.CommandText = sql; + cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); + + return DoLoad(cmd, regionID, create); + } + } + + private EstateSettings DoLoad(MySqlCommand cmd, UUID regionID, bool create) + { + EstateSettings es = new EstateSettings(); + es.OnSave += StoreEstateSettings; using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) { dbcon.Open(); - using (MySqlCommand cmd = dbcon.CreateCommand()) + cmd.Connection = dbcon; + + bool found = false; + + using (IDataReader r = cmd.ExecuteReader()) { - cmd.CommandText = sql; - cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); - - using (IDataReader r = cmd.ExecuteReader()) + if (r.Read()) { - if (r.Read()) + found = true; + + foreach (string name in FieldList) { - migration = false; - - foreach (string name in FieldList) + if (m_FieldMap[name].GetValue(es) is bool) { - if (m_FieldMap[name].GetValue(es) is bool) - { - int v = Convert.ToInt32(r[name]); - if (v != 0) - m_FieldMap[name].SetValue(es, true); - else - m_FieldMap[name].SetValue(es, false); - } - else if (m_FieldMap[name].GetValue(es) is UUID) - { - UUID uuid = UUID.Zero; - - UUID.TryParse(r[name].ToString(), out uuid); - m_FieldMap[name].SetValue(es, uuid); - } + int v = Convert.ToInt32(r[name]); + if (v != 0) + m_FieldMap[name].SetValue(es, true); else - { - m_FieldMap[name].SetValue(es, r[name]); - } + m_FieldMap[name].SetValue(es, false); + } + else if (m_FieldMap[name].GetValue(es) is UUID) + { + UUID uuid = UUID.Zero; + + UUID.TryParse(r[name].ToString(), out uuid); + m_FieldMap[name].SetValue(es, uuid); + } + else + { + m_FieldMap[name].SetValue(es, r[name]); } } } } - if (migration) + if (!found && create) { // Migration case List names = new List(FieldList); names.Remove("EstateID"); - sql = "insert into estate_settings (" + String.Join(",", names.ToArray()) + ") values ( ?" + String.Join(", ?", names.ToArray()) + ")"; + string sql = "insert into estate_settings (" + String.Join(",", names.ToArray()) + ") values ( ?" + String.Join(", ?", names.ToArray()) + ")"; - using (MySqlCommand cmd = dbcon.CreateCommand()) + using (MySqlCommand cmd2 = dbcon.CreateCommand()) { - cmd.CommandText = sql; - cmd.Parameters.Clear(); + cmd2.CommandText = sql; + cmd2.Parameters.Clear(); foreach (string name in FieldList) { if (m_FieldMap[name].GetValue(es) is bool) { if ((bool)m_FieldMap[name].GetValue(es)) - cmd.Parameters.AddWithValue("?" + name, "1"); + cmd2.Parameters.AddWithValue("?" + name, "1"); else - cmd.Parameters.AddWithValue("?" + name, "0"); + cmd2.Parameters.AddWithValue("?" + name, "0"); } else { - cmd.Parameters.AddWithValue("?" + name, m_FieldMap[name].GetValue(es).ToString()); + cmd2.Parameters.AddWithValue("?" + name, m_FieldMap[name].GetValue(es).ToString()); } } - cmd.ExecuteNonQuery(); + cmd2.ExecuteNonQuery(); - cmd.CommandText = "select LAST_INSERT_ID() as id"; - cmd.Parameters.Clear(); + cmd2.CommandText = "select LAST_INSERT_ID() as id"; + cmd2.Parameters.Clear(); - using (IDataReader r = cmd.ExecuteReader()) + using (IDataReader r = cmd2.ExecuteReader()) { r.Read(); es.EstateID = Convert.ToUInt32(r["id"]); } - cmd.CommandText = "insert into estate_map values (?RegionID, ?EstateID)"; - cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); - cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); + cmd2.CommandText = "insert into estate_map values (?RegionID, ?EstateID)"; + cmd2.Parameters.AddWithValue("?RegionID", regionID.ToString()); + cmd2.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); // This will throw on dupe key - try { cmd.ExecuteNonQuery(); } - catch (Exception) { } - - // Munge and transfer the ban list - cmd.Parameters.Clear(); - cmd.CommandText = "insert into estateban select " + es.EstateID.ToString() + ", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = ?UUID"; - cmd.Parameters.AddWithValue("?UUID", regionID.ToString()); - - try { cmd.ExecuteNonQuery(); } + try { cmd2.ExecuteNonQuery(); } catch (Exception) { } es.Save(); @@ -398,5 +397,89 @@ namespace OpenSim.Data.MySQL return uuids.ToArray(); } + + public EstateSettings LoadEstateSettings(int estateID) + { + using (MySqlCommand cmd = new MySqlCommand()) + { + string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) + " from estate_settings where EstateID = ?EstateID"; + + cmd.CommandText = sql; + cmd.Parameters.AddWithValue("?EstateID", estateID); + + return DoLoad(cmd, UUID.Zero, false); + } + } + + public List GetEstates(string search) + { + List result = new List(); + + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "select estateID from estate_settings where EstateName = ?EstateName"; + cmd.Parameters.AddWithValue("?EstateName", search); + + using (IDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + result.Add(Convert.ToInt32(reader["EstateID"])); + } + reader.Close(); + } + } + + + dbcon.Close(); + } + + return result; + } + + public bool LinkRegion(UUID regionID, int estateID) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + try + { + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "insert into estate_map values (?RegionID, ?EstateID)"; + cmd.Parameters.AddWithValue("?RegionID", regionID); + cmd.Parameters.AddWithValue("?EstateID", estateID); + + int ret = cmd.ExecuteNonQuery(); + dbcon.Close(); + + return (ret != 0); + } + } + catch (MySqlException ex) + { + m_log.Error("[REGION DB]: LinkRegion failed: " + ex.Message); + } + + dbcon.Close(); + } + + return false; + } + + public List GetRegions(int estateID) + { + return new List(); + } + + public bool DeleteEstate(int estateID) + { + return false; + } } } diff --git a/OpenSim/Data/MySQL/Resources/032_RegionStore.sql b/OpenSim/Data/MySQL/Resources/032_RegionStore.sql index b10ffcf139..02ac1f5ea6 100644 --- a/OpenSim/Data/MySQL/Resources/032_RegionStore.sql +++ b/OpenSim/Data/MySQL/Resources/032_RegionStore.sql @@ -67,4 +67,5 @@ CREATE TABLE `regionwindlight` ( PRIMARY KEY (`region_id`) ); -COMMIT; \ No newline at end of file +ALTER TABLE estate_settings AUTO_INCREMENT = 100; +COMMIT; diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs index 5b9898c3c8..30ad747d25 100644 --- a/OpenSim/Data/Null/NullRegionData.cs +++ b/OpenSim/Data/Null/NullRegionData.cs @@ -40,7 +40,7 @@ namespace OpenSim.Data.Null { private static NullRegionData Instance = null; - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); Dictionary m_regionData = new Dictionary(); @@ -192,4 +192,4 @@ namespace OpenSim.Data.Null return ret; } } -} +} \ No newline at end of file diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index 1be99eedab..bd6b776f80 100644 --- a/OpenSim/Data/SQLite/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs @@ -80,11 +80,8 @@ namespace OpenSim.Data.SQLite get { return new List(m_FieldMap.Keys).ToArray(); } } - public EstateSettings LoadEstateSettings(UUID regionID) + public EstateSettings LoadEstateSettings(UUID regionID, bool create) { - EstateSettings es = new EstateSettings(); - es.OnSave += StoreEstateSettings; - string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = :RegionID"; SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); @@ -92,6 +89,14 @@ namespace OpenSim.Data.SQLite cmd.CommandText = sql; cmd.Parameters.Add(":RegionID", regionID.ToString()); + return DoLoad(cmd, regionID, create); + } + + private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID, bool create) + { + EstateSettings es = new EstateSettings(); + es.OnSave += StoreEstateSettings; + IDataReader r = cmd.ExecuteReader(); if (r.Read()) @@ -120,17 +125,15 @@ namespace OpenSim.Data.SQLite } r.Close(); } - else + else if (create) { - // Migration case - // r.Close(); List names = new List(FieldList); names.Remove("EstateID"); - sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")"; + string sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")"; cmd.CommandText = sql; cmd.Parameters.Clear(); @@ -176,20 +179,6 @@ namespace OpenSim.Data.SQLite { } - // Munge and transfer the ban list - // - cmd.Parameters.Clear(); - cmd.CommandText = "insert into estateban select "+es.EstateID.ToString()+", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = :UUID"; - cmd.Parameters.Add(":UUID", regionID.ToString()); - - try - { - cmd.ExecuteNonQuery(); - } - catch (Exception) - { - } - es.Save(); } @@ -336,5 +325,63 @@ namespace OpenSim.Data.SQLite return uuids.ToArray(); } + + public EstateSettings LoadEstateSettings(int estateID) + { + string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID"; + + SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); + + cmd.CommandText = sql; + cmd.Parameters.Add(":EstateID", estateID.ToString()); + + return DoLoad(cmd, UUID.Zero, false); + } + + public List GetEstates(string search) + { + List result = new List(); + + string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName"; + + SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); + + cmd.CommandText = sql; + cmd.Parameters.Add(":EstateName", search); + + IDataReader r = cmd.ExecuteReader(); + + while (r.Read()) + { + result.Add(Convert.ToInt32(r["EstateID"])); + } + r.Close(); + + return result; + } + + public bool LinkRegion(UUID regionID, int estateID) + { + SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); + + cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; + cmd.Parameters.Add(":RegionID", regionID.ToString()); + cmd.Parameters.Add(":EstateID", estateID.ToString()); + + if (cmd.ExecuteNonQuery() == 0) + return false; + + return true; + } + + public List GetRegions(int estateID) + { + return new List(); + } + + public bool DeleteEstate(int estateID) + { + return false; + } } } diff --git a/OpenSim/Data/Tests/BasicEstateTest.cs b/OpenSim/Data/Tests/BasicEstateTest.cs index 907bb382c6..d14d405256 100644 --- a/OpenSim/Data/Tests/BasicEstateTest.cs +++ b/OpenSim/Data/Tests/BasicEstateTest.cs @@ -158,7 +158,7 @@ namespace OpenSim.Data.Tests public void T012_EstateSettingsRandomStorage() { // Letting estate store generate rows to database for us - EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); + EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); new PropertyScrambler() .DontScramble(x=>x.EstateID) .Scramble(originalSettings); @@ -167,7 +167,7 @@ namespace OpenSim.Data.Tests db.StoreEstateSettings(originalSettings); // Loading settings to another instance variable. - EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); + EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true); // Checking that loaded values are correct. Assert.That(loadedSettings, Constraints.PropertyCompareConstraint(originalSettings)); @@ -177,7 +177,7 @@ namespace OpenSim.Data.Tests public void T020_EstateSettingsManagerList() { // Letting estate store generate rows to database for us - EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); + EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); originalSettings.EstateManagers = new UUID[] { MANAGER_ID_1, MANAGER_ID_2 }; @@ -185,7 +185,7 @@ namespace OpenSim.Data.Tests db.StoreEstateSettings(originalSettings); // Loading settings to another instance variable. - EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); + EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true); Assert.AreEqual(2, loadedSettings.EstateManagers.Length); Assert.AreEqual(MANAGER_ID_1, loadedSettings.EstateManagers[0]); @@ -196,7 +196,7 @@ namespace OpenSim.Data.Tests public void T021_EstateSettingsUserList() { // Letting estate store generate rows to database for us - EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); + EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); originalSettings.EstateAccess = new UUID[] { USER_ID_1, USER_ID_2 }; @@ -204,7 +204,7 @@ namespace OpenSim.Data.Tests db.StoreEstateSettings(originalSettings); // Loading settings to another instance variable. - EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); + EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true); Assert.AreEqual(2, loadedSettings.EstateAccess.Length); Assert.AreEqual(USER_ID_1, loadedSettings.EstateAccess[0]); @@ -215,7 +215,7 @@ namespace OpenSim.Data.Tests public void T022_EstateSettingsGroupList() { // Letting estate store generate rows to database for us - EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); + EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); originalSettings.EstateGroups = new UUID[] { GROUP_ID_1, GROUP_ID_2 }; @@ -223,7 +223,7 @@ namespace OpenSim.Data.Tests db.StoreEstateSettings(originalSettings); // Loading settings to another instance variable. - EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); + EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true); Assert.AreEqual(2, loadedSettings.EstateAccess.Length); Assert.AreEqual(GROUP_ID_1, loadedSettings.EstateGroups[0]); @@ -234,7 +234,7 @@ namespace OpenSim.Data.Tests public void T022_EstateSettingsBanList() { // Letting estate store generate rows to database for us - EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); + EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); EstateBan estateBan1 = new EstateBan(); estateBan1.BannedUserID = DataTestUtil.UUID_MIN; @@ -248,7 +248,7 @@ namespace OpenSim.Data.Tests db.StoreEstateSettings(originalSettings); // Loading settings to another instance variable. - EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); + EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true); Assert.AreEqual(2, loadedSettings.EstateBans.Length); Assert.AreEqual(DataTestUtil.UUID_MIN, loadedSettings.EstateBans[0].BannedUserID); @@ -290,7 +290,7 @@ namespace OpenSim.Data.Tests { // Letting estate store generate rows to database for us - EstateSettings originalSettings = db.LoadEstateSettings(regionId); + EstateSettings originalSettings = db.LoadEstateSettings(regionId, true); SetEstateSettings( originalSettings, @@ -347,7 +347,7 @@ namespace OpenSim.Data.Tests db.StoreEstateSettings(originalSettings); // Loading settings to another instance variable. - EstateSettings loadedSettings = db.LoadEstateSettings(regionId); + EstateSettings loadedSettings = db.LoadEstateSettings(regionId, true); // Checking that loaded values are correct. ValidateEstateSettings( diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index b4b5808ad3..2a495b0e8c 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -35,7 +35,6 @@ namespace OpenSim.Framework public class EstateSettings { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly ConfigurationMember configMember; public delegate void SaveDelegate(EstateSettings rs); @@ -43,7 +42,7 @@ namespace OpenSim.Framework // Only the client uses these // - private uint m_EstateID = 100; + private uint m_EstateID = 0; public uint EstateID { @@ -51,7 +50,7 @@ namespace OpenSim.Framework set { m_EstateID = value; } } - private string m_EstateName; + private string m_EstateName = "My Estate"; public string EstateName { @@ -59,7 +58,7 @@ namespace OpenSim.Framework set { m_EstateName = value; } } - private uint m_ParentEstateID = 100; + private uint m_ParentEstateID = 1; public uint ParentEstateID { @@ -67,7 +66,7 @@ namespace OpenSim.Framework set { m_ParentEstateID = value; } } - private float m_BillableFactor; + private float m_BillableFactor = 0.0f; public float BillableFactor { @@ -75,7 +74,7 @@ namespace OpenSim.Framework set { m_BillableFactor = value; } } - private int m_PricePerMeter; + private int m_PricePerMeter = 1; public int PricePerMeter { @@ -83,7 +82,7 @@ namespace OpenSim.Framework set { m_PricePerMeter = value; } } - private int m_RedirectGridX; + private int m_RedirectGridX = 0; public int RedirectGridX { @@ -91,7 +90,7 @@ namespace OpenSim.Framework set { m_RedirectGridX = value; } } - private int m_RedirectGridY; + private int m_RedirectGridY = 0; public int RedirectGridY { @@ -273,25 +272,6 @@ namespace OpenSim.Framework public EstateSettings() { - if (configMember == null) - { - try - { - // Load legacy defaults - // - configMember = - new ConfigurationMember(Path.Combine(Util.configDir(), - "estate_settings.xml"), "ESTATE SETTINGS", - loadConfigurationOptions, - handleIncomingConfiguration, true); - - l_EstateManagers.Clear(); - configMember.performConfigurationRetrieve(); - } - catch (Exception) - { - } - } } public void Save() @@ -393,165 +373,5 @@ namespace OpenSim.Framework return l_EstateAccess.Contains(user); } - - public void loadConfigurationOptions() - { - configMember.addConfigurationOption("billable_factor", - ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, - String.Empty, "0.0", true); - -// configMember.addConfigurationOption("estate_id", -// ConfigurationOption.ConfigurationTypes.TYPE_UINT32, -// String.Empty, "100", true); - -// configMember.addConfigurationOption("parent_estate_id", -// ConfigurationOption.ConfigurationTypes.TYPE_UINT32, -// String.Empty, "1", true); - - configMember.addConfigurationOption("redirect_grid_x", - ConfigurationOption.ConfigurationTypes.TYPE_INT32, - String.Empty, "0", true); - - configMember.addConfigurationOption("redirect_grid_y", - ConfigurationOption.ConfigurationTypes.TYPE_INT32, - String.Empty, "0", true); - - configMember.addConfigurationOption("price_per_meter", - ConfigurationOption.ConfigurationTypes.TYPE_UINT32, - String.Empty, "1", true); - - configMember.addConfigurationOption("estate_name", - ConfigurationOption.ConfigurationTypes.TYPE_STRING, - String.Empty, "My Estate", true); - - configMember.addConfigurationOption("estate_manager_0", - ConfigurationOption.ConfigurationTypes.TYPE_UUID, - String.Empty, "00000000-0000-0000-0000-000000000000", true); - - configMember.addConfigurationOption("estate_manager_1", - ConfigurationOption.ConfigurationTypes.TYPE_UUID, - String.Empty, "00000000-0000-0000-0000-000000000000", true); - - configMember.addConfigurationOption("estate_manager_2", - ConfigurationOption.ConfigurationTypes.TYPE_UUID, - String.Empty, "00000000-0000-0000-0000-000000000000", true); - - configMember.addConfigurationOption("estate_manager_3", - ConfigurationOption.ConfigurationTypes.TYPE_UUID, - String.Empty, "00000000-0000-0000-0000-000000000000", true); - - configMember.addConfigurationOption("estate_manager_4", - ConfigurationOption.ConfigurationTypes.TYPE_UUID, - String.Empty, "00000000-0000-0000-0000-000000000000", true); - - configMember.addConfigurationOption("estate_manager_5", - ConfigurationOption.ConfigurationTypes.TYPE_UUID, - String.Empty, "00000000-0000-0000-0000-000000000000", true); - - configMember.addConfigurationOption("estate_manager_6", - ConfigurationOption.ConfigurationTypes.TYPE_UUID, - String.Empty, "00000000-0000-0000-0000-000000000000", true); - - configMember.addConfigurationOption("estate_manager_7", - ConfigurationOption.ConfigurationTypes.TYPE_UUID, - String.Empty, "00000000-0000-0000-0000-000000000000", true); - - configMember.addConfigurationOption("estate_manager_8", - ConfigurationOption.ConfigurationTypes.TYPE_UUID, - String.Empty, "00000000-0000-0000-0000-000000000000", true); - - configMember.addConfigurationOption("estate_manager_9", - ConfigurationOption.ConfigurationTypes.TYPE_UUID, - String.Empty, "00000000-0000-0000-0000-000000000000", true); - - configMember.addConfigurationOption("region_flags", - ConfigurationOption.ConfigurationTypes.TYPE_UINT32, - String.Empty, "336723974", true); - } - - public bool handleIncomingConfiguration(string configuration_key, object configuration_result) - { - switch (configuration_key) - { - case "region_flags": - RegionFlags flags = (RegionFlags)(uint)configuration_result; - if ((flags & (RegionFlags)(1<<29)) != 0) - m_AllowVoice = true; - if ((flags & RegionFlags.AllowDirectTeleport) != 0) - m_AllowDirectTeleport = true; - if ((flags & RegionFlags.DenyAnonymous) != 0) - m_DenyAnonymous = true; - if ((flags & RegionFlags.DenyIdentified) != 0) - m_DenyIdentified = true; - if ((flags & RegionFlags.DenyTransacted) != 0) - m_DenyTransacted = true; - if ((flags & RegionFlags.AbuseEmailToEstateOwner) != 0) - m_AbuseEmailToEstateOwner = true; - if ((flags & RegionFlags.BlockDwell) != 0) - m_BlockDwell = true; - if ((flags & RegionFlags.EstateSkipScripts) != 0) - m_EstateSkipScripts = true; - if ((flags & RegionFlags.ResetHomeOnTeleport) != 0) - m_ResetHomeOnTeleport = true; - if ((flags & RegionFlags.TaxFree) != 0) - m_TaxFree = true; - if ((flags & RegionFlags.PublicAllowed) != 0) - m_PublicAccess = true; - break; - case "billable_factor": - m_BillableFactor = (float) configuration_result; - break; -// case "estate_id": -// m_EstateID = (uint) configuration_result; -// break; -// case "parent_estate_id": -// m_ParentEstateID = (uint) configuration_result; -// break; - case "redirect_grid_x": - m_RedirectGridX = (int) configuration_result; - break; - case "redirect_grid_y": - m_RedirectGridY = (int) configuration_result; - break; - case "price_per_meter": - m_PricePerMeter = Convert.ToInt32(configuration_result); - break; - case "estate_name": - m_EstateName = (string) configuration_result; - break; - case "estate_manager_0": - AddEstateManager((UUID)configuration_result); - break; - case "estate_manager_1": - AddEstateManager((UUID)configuration_result); - break; - case "estate_manager_2": - AddEstateManager((UUID)configuration_result); - break; - case "estate_manager_3": - AddEstateManager((UUID)configuration_result); - break; - case "estate_manager_4": - AddEstateManager((UUID)configuration_result); - break; - case "estate_manager_5": - AddEstateManager((UUID)configuration_result); - break; - case "estate_manager_6": - AddEstateManager((UUID)configuration_result); - break; - case "estate_manager_7": - AddEstateManager((UUID)configuration_result); - break; - case "estate_manager_8": - AddEstateManager((UUID)configuration_result); - break; - case "estate_manager_9": - AddEstateManager((UUID)configuration_result); - break; - } - - return true; - } } } diff --git a/OpenSim/Framework/GroupData.cs b/OpenSim/Framework/GroupData.cs index e3b86265d6..815946cac1 100644 --- a/OpenSim/Framework/GroupData.cs +++ b/OpenSim/Framework/GroupData.cs @@ -48,7 +48,6 @@ namespace OpenSim.Framework public class GroupMembershipData { // Group base data - // public UUID GroupID; public string GroupName; public bool AllowPublish = true; @@ -61,7 +60,6 @@ namespace OpenSim.Framework public bool ShowInList = true; // Per user data - // public bool AcceptNotices = true; public int Contribution = 0; public ulong GroupPowers = 0; diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index 86d63f88a8..19ab409098 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -91,7 +91,7 @@ namespace OpenSim.Framework /// bool PresenceChildStatus(UUID agentId); - bool TryGetAvatar(UUID agentID, out object scenePresence); + bool TryGetScenePresence(UUID agentID, out object scenePresence); T RequestModuleInterface(); T[] RequestModuleInterfaces(); diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs index 84cc05eb74..1f5f2088fc 100644 --- a/OpenSim/Framework/MainServer.cs +++ b/OpenSim/Framework/MainServer.cs @@ -25,13 +25,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using OpenSim.Framework.Servers.HttpServer; using System.Collections.Generic; +using System.Reflection; +using log4net; +using OpenSim.Framework.Servers.HttpServer; namespace OpenSim.Framework { public class MainServer { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static BaseHttpServer instance = null; private static Dictionary m_Servers = new Dictionary(); @@ -53,6 +57,8 @@ namespace OpenSim.Framework return m_Servers[port]; m_Servers[port] = new BaseHttpServer(port); + + m_log.InfoFormat("[MAIN HTTP SERVER]: Starting main http server on port {0}", port); m_Servers[port].Start(); return m_Servers[port]; diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 350c041f7d..a6e00c2251 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -310,7 +310,7 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (Exception e) { - m_log.ErrorFormat("[BASE HTTP SERVER]: OnRequest() failed with {0} {1}", e.Message, e.StackTrace); + m_log.Error(string.Format("[BASE HTTP SERVER]: OnRequest() failed with "), e); } } @@ -1580,7 +1580,6 @@ namespace OpenSim.Framework.Servers.HttpServer public void Start() { - m_log.Info("[BASE HTTP SERVER]: Starting up HTTP Server"); StartHTTP(); } @@ -1588,7 +1587,6 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - m_log.Debug("[BASE HTTP SERVER]: Spawned main thread OK"); //m_httpListener = new HttpListener(); NotSocketErrors = 0; if (!m_ssl) diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index f618047245..cd2f384d10 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.6.8CM"; + private const string VERSION_NUMBER = "0.7CM"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour { diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 16e44aff44..2843e202be 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -263,8 +263,12 @@ namespace OpenSim.Framework foreach (string key in parameters.Keys) { - foreach (string value in parameters.GetValues(key)) - items.Add(String.Concat(key, "=", HttpUtility.UrlEncode(value ?? String.Empty))); + string[] values = parameters.GetValues(key); + if (values != null) + { + foreach (string value in values) + items.Add(String.Concat(key, "=", HttpUtility.UrlEncode(value ?? String.Empty))); + } } return String.Join("&", items.ToArray()); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 8cd47fb932..0762ed0dc1 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -40,7 +40,6 @@ using OpenMetaverse.Packets; using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Framework.Client; - using OpenSim.Framework.Statistics; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -353,6 +352,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected PriorityQueue m_avatarTerseUpdates; private PriorityQueue m_primTerseUpdates; private PriorityQueue m_primFullUpdates; + + /// + /// List used in construction of data blocks for an object update packet. This is to stop us having to + /// continually recreate it. + /// + protected List m_fullUpdateDataBlocksBuilder; + + /// + /// Maintain a record of all the objects killed. This allows us to stop an update being sent from the + /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an + /// ownerless phantom. + /// + /// All manipulation of this set has to occur under a m_primFullUpdate.SyncRoot lock + /// + /// + protected HashSet m_killRecord; + private int m_moneyBalance; private int m_animationSequenceNumber = 1; private bool m_SendLogoutPacketWhenClosing = true; @@ -449,6 +465,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_avatarTerseUpdates = new PriorityQueue(); m_primTerseUpdates = new PriorityQueue(); m_primFullUpdates = new PriorityQueue(m_scene.Entities.Count); + m_fullUpdateDataBlocksBuilder = new List(); + m_killRecord = new HashSet(); m_assetService = m_scene.RequestModuleInterface(); m_hyperAssets = m_scene.RequestModuleInterface(); @@ -1474,7 +1492,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP kill.ObjectData[0].ID = localID; kill.Header.Reliable = true; kill.Header.Zerocoded = true; - OutPacket(kill, ThrottleOutPacketType.State); + + lock (m_primFullUpdates.SyncRoot) + { + m_killRecord.Add(localID); + OutPacket(kill, ThrottleOutPacketType.State); + } } /// @@ -3521,21 +3544,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (count == 0) return; - outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[count]; + m_fullUpdateDataBlocksBuilder.Clear(); + for (int i = 0; i < count; i++) { - outPacket.ObjectData[i] = m_primFullUpdates.Dequeue(); + ObjectUpdatePacket.ObjectDataBlock block = m_primFullUpdates.Dequeue(); + if (!m_killRecord.Contains(block.ID)) + { + m_fullUpdateDataBlocksBuilder.Add(block); + // string text = Util.FieldToString(outPacket.ObjectData[i].Text); // if (text.IndexOf("\n") >= 0) // text = text.Remove(text.IndexOf("\n")); // m_log.DebugFormat( // "[CLIENT]: Sending full info about prim {0} text {1} to client {2}", // outPacket.ObjectData[i].ID, text, Name); + } +// else +// { +// m_log.WarnFormat( +// "[CLIENT]: Preventing full update for {0} after kill to {1}", block.ID, Name); +// } } - } - OutPacket(outPacket, ThrottleOutPacketType.State); + outPacket.ObjectData = m_fullUpdateDataBlocksBuilder.ToArray(); + + OutPacket(outPacket, ThrottleOutPacketType.State); + } } public void SendPrimTerseUpdate(SendPrimitiveTerseData data) @@ -5965,7 +6001,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP || avSetStartLocationRequestPacket.StartLocationData.LocationPos.Y == 255.5f) { ScenePresence avatar = null; - if (((Scene)m_scene).TryGetAvatar(AgentId, out avatar)) + if (((Scene)m_scene).TryGetScenePresence(AgentId, out avatar)) { if (avSetStartLocationRequestPacket.StartLocationData.LocationPos.X == 255.5f) { diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 0ec87e598c..e683821d95 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -98,10 +98,10 @@ namespace OpenSim.Region.ClientStack if (m_networkServersInfo.HttpUsesSSL && (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort)) { - m_log.Error("[HTTP]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports"); + m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports"); } - m_log.Info("[REGION]: Starting HTTP server"); + m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0}", m_httpServerPort); m_httpServer.Start(); MainServer.Instance = m_httpServer; @@ -129,4 +129,4 @@ namespace OpenSim.Region.ClientStack return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index f54e41abee..23828efea5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // Save avatar attachment information ScenePresence presence; - if (m_scene.AvatarFactory != null && m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) + if (m_scene.AvatarFactory != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) { m_log.Info( "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId @@ -255,7 +255,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments AttachmentPt = att.RootPart.AttachmentPoint; ScenePresence presence; - if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) + if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) { InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); item = m_scene.InventoryService.GetItem(item); @@ -299,7 +299,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } ScenePresence presence; - if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) + if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) { // XXYY!! InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); @@ -314,7 +314,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient) { ScenePresence presence; - if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) + if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) { presence.Appearance.DetachAttachment(itemID); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 71b30625b4..f57099912c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -388,7 +388,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver try { - if (m_aScene.AuthenticationService.Authenticate(account.PrincipalID, pass, 1) != string.Empty) + string encpass = Util.Md5Hash(pass); + if (m_aScene.AuthenticationService.Authenticate(account.PrincipalID, encpass, 1) != string.Empty) { return account; } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 09552a8aec..714244290d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -358,7 +358,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer { ScenePresence presence; - if (s.TryGetAvatar(agentID, out presence)) + if (s.TryGetScenePresence(agentID, out presence)) { // If the agent is in this scene, then we // are being called twice in a single diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs index 63a93aa026..c011776ff9 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs +++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs @@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps responsedata["str_response_string"] = "Request wasn't what was expected"; ScenePresence avatar; - if (!m_scene.TryGetAvatar(AgentId, out avatar)) + if (!m_scene.TryGetScenePresence(AgentId, out avatar)) return responsedata; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 25f5154389..93aeb9440f 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -190,7 +190,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (account == null) // foreign { ScenePresence sp = null; - if (m_Scene.TryGetAvatar(userID, out sp)) + if (m_Scene.TryGetScenePresence(userID, out sp)) { AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index 8cf4619782..e95d2f8fef 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -1206,7 +1206,7 @@ namespace OpenSim.Region.CoreModules.InterGrid { Scene homeScene = GetRootScene(); ScenePresence avatar = null; - if (homeScene.TryGetAvatar(avatarId,out avatar)) + if (homeScene.TryGetScenePresence(avatarId,out avatar)) { KillAUser ku = new KillAUser(avatar,mod); Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true); diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs index 27b64bffc0..40ffcb4a70 100644 --- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs @@ -131,8 +131,8 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC { // Start http server // Attach xmlrpc handlers - m_log.Info("[REMOTE_DATA]: " + - "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); + m_log.Info("[XML RPC MODULE]: " + + "Starting up XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); BaseHttpServer httpServer = new BaseHttpServer((uint) m_remoteDataPort); httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); httpServer.Start(); @@ -192,7 +192,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC // This should no longer happen, but the check is reasonable anyway if (null == m_openChannels) { - m_log.Warn("[RemoteDataReply] Attempt to open channel before initialization is complete"); + m_log.Warn("[XML RPC MODULE]: Attempt to open channel before initialization is complete"); return newChannel; } @@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC } else { - m_log.Warn("[RemoteDataReply]: Channel or message_id not found"); + m_log.Warn("[XML RPC MODULE]: Channel or message_id not found"); } } @@ -340,7 +340,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC } else { - m_log.Error("UNABLE TO REMOVE COMPLETED REQUEST"); + m_log.Error("[XML RPC MODULE]: UNABLE TO REMOVE COMPLETED REQUEST"); } } } @@ -728,4 +728,4 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC return ReqID; } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index c6312e05cd..54508ccfa8 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -502,7 +502,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory private UUID GetSessionID(UUID userID) { ScenePresence sp = null; - if (m_Scene.TryGetAvatar(userID, out sp)) + if (m_Scene.TryGetScenePresence(userID, out sp)) { return sp.ControllingClient.SessionId; } @@ -521,7 +521,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory if (account == null) // foreign user { ScenePresence sp = null; - m_Scene.TryGetAvatar(userID, out sp); + m_Scene.TryGetScenePresence(userID, out sp); if (sp != null) { AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index 3c3534f5dc..5e06580cce 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs @@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory ScenePresence sp = null; foreach (Scene s in m_Scenes) { - s.TryGetAvatar(clientID, out sp); + s.TryGetScenePresence(clientID, out sp); if ((sp != null) && !sp.IsChildAgent && (s != scene)) { m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping system folders in cache", diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs index e98df286fc..7a75a89f4c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs @@ -88,7 +88,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence Vector3 position = new Vector3(128, 128, 0); Vector3 lookat = new Vector3(0, 1, 0); - if (client.Scene.TryGetAvatar(client.AgentId, out sp)) + if (client.Scene.TryGetScenePresence(client.AgentId, out sp)) { if (sp is ScenePresence) { diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 464d922f38..91d40ab54a 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -468,26 +468,20 @@ namespace OpenSim.Region.CoreModules.World.Estate private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) { - // Get a fresh list that will not change as people get teleported away - List presences = m_scene.GetScenePresences(); - - foreach(ScenePresence p in presences) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - if (p.UUID != senderID) + if (sp.UUID != senderID) { + ScenePresence p = m_scene.GetScenePresence(sp.UUID); // make sure they are still there, we could be working down a long list - ScenePresence s = m_scene.GetScenePresence(p.UUID); - if (s != null) + // Also make sure they are actually in the region + if (p != null && !p.IsChildAgent) { - // Also make sure they are actually in the region - if (!s.IsChildAgent) - { - s.ControllingClient.SendTeleportLocationStart(); - m_scene.TeleportClientHome(s.UUID, s.ControllingClient); - } + p.ControllingClient.SendTeleportLocationStart(); + m_scene.TeleportClientHome(p.UUID, p.ControllingClient); } } - } + }); } private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID) { @@ -765,12 +759,11 @@ namespace OpenSim.Region.CoreModules.World.Estate public void sendRegionInfoPacketToAll() { - List avatars = m_scene.GetAvatars(); - - for (int i = 0; i < avatars.Count; i++) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - HandleRegionInfoRequest(avatars[i].ControllingClient); - } + if (!sp.IsChildAgent) + HandleRegionInfoRequest(sp.ControllingClient); + }); } public void sendRegionHandshake(IClientAPI remoteClient) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index bf856c86bb..b6afac64e4 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -199,9 +199,9 @@ namespace OpenSim.Region.CoreModules.World.Land forcedPosition = null; } //if we are far away, teleport - else if (Vector3.Distance(clientAvatar.AbsolutePosition,forcedPosition.Value) > 3) + else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) > 3) { - Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}",forcedPosition.Value,clientAvatar.AbsolutePosition)); + Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); clientAvatar.Teleport(forcedPosition.Value); forcedPosition = null; } @@ -382,30 +382,27 @@ namespace OpenSim.Region.CoreModules.World.Land } } - public void SendOutNearestBanLine(IClientAPI avatar) + public void SendOutNearestBanLine(IClientAPI client) { - List avatars = m_scene.GetAvatars(); - foreach (ScenePresence presence in avatars) + ScenePresence sp = m_scene.GetScenePresence(client.AgentId); + if (sp == null || sp.IsChildAgent) + return; + + List checkLandParcels = ParcelsNearPoint(sp.AbsolutePosition); + foreach (ILandObject checkBan in checkLandParcels) { - if (presence.UUID == avatar.AgentId) + if (checkBan.IsBannedFromLand(client.AgentId)) { - List checkLandParcels = ParcelsNearPoint(presence.AbsolutePosition); - foreach (ILandObject checkBan in checkLandParcels) - { - if (checkBan.IsBannedFromLand(avatar.AgentId)) - { - checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar); - return; //Only send one - } - if (checkBan.IsRestrictedFromLand(avatar.AgentId)) - { - checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar); - return; //Only send one - } - } - return; + checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, client); + return; //Only send one + } + if (checkBan.IsRestrictedFromLand(client.AgentId)) + { + checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, client); + return; //Only send one } } + return; } public void SendLandUpdate(ScenePresence avatar, bool force) diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 331f183e1d..aca551479f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -332,36 +332,38 @@ namespace OpenSim.Region.CoreModules.World.Land public void SendLandUpdateToAvatarsOverMe(bool snap_selection) { - List avatars = m_scene.GetAvatars(); - ILandObject over = null; - for (int i = 0; i < avatars.Count; i++) + m_scene.ForEachScenePresence(delegate(ScenePresence avatar) { + if (avatar.IsChildAgent) + return; + + ILandObject over = null; try { over = - m_scene.LandChannel.GetLandObject(Util.Clamp((int)Math.Round(avatars[i].AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)), - Util.Clamp((int)Math.Round(avatars[i].AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1))); + m_scene.LandChannel.GetLandObject(Util.Clamp((int)Math.Round(avatar.AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)), + Util.Clamp((int)Math.Round(avatar.AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1))); } catch (Exception) { - m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatars[i].AbsolutePosition.X) + " y: " + - Math.Round(avatars[i].AbsolutePosition.Y)); + m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " + + Math.Round(avatar.AbsolutePosition.Y)); } if (over != null) { if (over.LandData.LocalID == LandData.LocalID) { - if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && + if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && m_scene.RegionInfo.RegionSettings.AllowDamage) - avatars[i].Invulnerable = false; + avatar.Invulnerable = false; else - avatars[i].Invulnerable = true; + avatar.Invulnerable = true; - SendLandUpdateToClient(snap_selection, avatars[i].ControllingClient); + SendLandUpdateToClient(snap_selection, avatar.ControllingClient); } } - } + }); } #endregion diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 4dbdb015d0..0f830e12a1 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -1324,9 +1324,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions // Group voodoo // - if (land.LandData.IsGroupOwned) + if (l.LandData.IsGroupOwned) { - powers = (GroupPowers)client.GetGroupPowers(land.LandData.GroupID); + powers = (GroupPowers)client.GetGroupPowers(l.LandData.GroupID); // Not a group member, or no rights at all // if (powers == (GroupPowers)0) diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index 1f5a4ffad4..a52fea46fc 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -62,40 +62,46 @@ namespace OpenSim.Region.CoreModules.World.Sound public virtual void PlayAttachedSound( UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) { - foreach (ScenePresence p in m_scene.GetAvatars()) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - double dis = Util.GetDistanceTo(p.AbsolutePosition, position); + if (sp.IsChildAgent) + return; + + double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); if (dis > 100.0) // Max audio distance - continue; - + return; + // Scale by distance if (radius == 0) gain = (float)((double)gain * ((100.0 - dis) / 100.0)); else gain = (float)((double)gain * ((radius - dis) / radius)); - - p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); - } + + sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); + }); } public virtual void TriggerSound( UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) { - foreach (ScenePresence p in m_scene.GetAvatars()) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - double dis = Util.GetDistanceTo(p.AbsolutePosition, position); + if (sp.IsChildAgent) + return; + + double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); if (dis > 100.0) // Max audio distance - continue; - + return; + // Scale by distance if (radius == 0) gain = (float)((double)gain * ((100.0 - dis) / 100.0)); else gain = (float)((double)gain * ((radius - dis) / radius)); - - p.ControllingClient.SendTriggeredSound( + + sp.ControllingClient.SendTriggeredSound( soundId, ownerID, objectID, parentID, handle, position, (float)gain); - } + }); } } } diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index 0712a7fabc..a6dc2ec79a 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs @@ -509,14 +509,13 @@ namespace OpenSim.Region.CoreModules private void SunUpdateToAllClients() { - List avatars = m_scene.GetAvatars(); - foreach (ScenePresence avatar in avatars) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - if (!avatar.IsChildAgent) + if (!sp.IsChildAgent) { - SunToClient(avatar.ControllingClient); + SunToClient(sp.ControllingClient); } - } + }); } #region ISunModule Members diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index 3283c1ffa7..9736b73adf 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs @@ -425,9 +425,7 @@ namespace OpenSim.Region.CoreModules { if (m_ready) { - List avatars = m_scene.GetAvatars(); - - if (avatars.Count > 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 @@ -437,11 +435,11 @@ namespace OpenSim.Region.CoreModules m_frameLastUpdateClientArray = m_frame; } - foreach (ScenePresence avatar in avatars) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - if (!avatar.IsChildAgent) - avatar.ControllingClient.SendWindData(windSpeeds); - } + if (!sp.IsChildAgent) + sp.ControllingClient.SendWindData(windSpeeds); + }); } } } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index b63d014923..2b0e83f52f 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // this is here because CAPS map requests work even beyond the 10,000 limit. ScenePresence avatarPresence = null; - m_scene.TryGetAvatar(agentID, out avatarPresence); + m_scene.TryGetScenePresence(agentID, out avatarPresence); if (avatarPresence != null) { @@ -304,25 +304,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap /// AgentID that logged out private void ClientLoggedOut(UUID AgentId, Scene scene) { - List presences = m_scene.GetAvatars(); - int rootcount = 0; - for (int i=0;i avatars = m_scene.GetAvatars(); int tc = Environment.TickCount; List mapitems = new List(); mapItemReply mapitem = new mapItemReply(); - if (avatars.Count == 0 || avatars.Count == 1) + if (m_scene.GetRootAgentCount() <= 1) { mapitem = new mapItemReply(); mapitem.x = (uint)(xstart + 1); @@ -392,21 +377,21 @@ namespace OpenSim.Region.CoreModules.World.WorldMap } else { - foreach (ScenePresence av in avatars) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { // Don't send a green dot for yourself - if (av.UUID != remoteClient.AgentId) + if (!sp.IsChildAgent && sp.UUID != remoteClient.AgentId) { mapitem = new mapItemReply(); - mapitem.x = (uint)(xstart + av.AbsolutePosition.X); - mapitem.y = (uint)(ystart + av.AbsolutePosition.Y); + mapitem.x = (uint)(xstart + sp.AbsolutePosition.X); + mapitem.y = (uint)(ystart + sp.AbsolutePosition.Y); mapitem.id = UUID.Zero; mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); mapitem.Extra = 1; mapitem.Extra2 = 0; mapitems.Add(mapitem); } - } + }); } remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); } @@ -504,7 +489,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (mrs.agentID != UUID.Zero) { ScenePresence av = null; - m_scene.TryGetAvatar(mrs.agentID, out av); + m_scene.TryGetScenePresence(mrs.agentID, out av); if (av != null) { if (response.ContainsKey(mrs.itemtype.ToString())) @@ -981,51 +966,35 @@ namespace OpenSim.Region.CoreModules.World.WorldMap Utils.LongToUInts(m_scene.RegionInfo.RegionHandle,out xstart,out ystart); OSDMap responsemap = new OSDMap(); - List avatars = m_scene.GetAvatars(); - OSDArray responsearr = new OSDArray(avatars.Count); - OSDMap responsemapdata = new OSDMap(); int tc = Environment.TickCount; - /* - foreach (ScenePresence av in avatars) + if (m_scene.GetRootAgentCount() == 0) { - responsemapdata = new OSDMap(); - responsemapdata["X"] = OSD.FromInteger((int)(xstart + av.AbsolutePosition.X)); - responsemapdata["Y"] = OSD.FromInteger((int)(ystart + av.AbsolutePosition.Y)); - responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); - responsemapdata["Name"] = OSD.FromString("TH"); - responsemapdata["Extra"] = OSD.FromInteger(0); - responsemapdata["Extra2"] = OSD.FromInteger(0); - responsearr.Add(responsemapdata); - } - responsemap["1"] = responsearr; - */ - if (avatars.Count == 0) - { - responsemapdata = new OSDMap(); + OSDMap responsemapdata = new OSDMap(); responsemapdata["X"] = OSD.FromInteger((int)(xstart + 1)); responsemapdata["Y"] = OSD.FromInteger((int)(ystart + 1)); responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); responsemapdata["Name"] = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString())); responsemapdata["Extra"] = OSD.FromInteger(0); responsemapdata["Extra2"] = OSD.FromInteger(0); + OSDArray responsearr = new OSDArray(); responsearr.Add(responsemapdata); responsemap["6"] = responsearr; } else { - responsearr = new OSDArray(avatars.Count); - foreach (ScenePresence av in avatars) + OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount()); + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - responsemapdata = new OSDMap(); - responsemapdata["X"] = OSD.FromInteger((int)(xstart + av.AbsolutePosition.X)); - responsemapdata["Y"] = OSD.FromInteger((int)(ystart + av.AbsolutePosition.Y)); + OSDMap responsemapdata = new OSDMap(); + responsemapdata["X"] = OSD.FromInteger((int)(xstart + sp.AbsolutePosition.X)); + responsemapdata["Y"] = OSD.FromInteger((int)(ystart + sp.AbsolutePosition.Y)); responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); responsemapdata["Name"] = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString())); responsemapdata["Extra"] = OSD.FromInteger(1); responsemapdata["Extra2"] = OSD.FromInteger(0); responsearr.Add(responsemapdata); - } + }); responsemap["6"] = responsearr; } return responsemap; @@ -1107,25 +1076,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap private void MakeChildAgent(ScenePresence avatar) { - List presences = m_scene.GetAvatars(); - int rootcount = 0; - for (int i = 0; i < presences.Count; i++) - { - if (presences[i] != null) - { - if (!presences[i].IsChildAgent) - rootcount++; - } - } - if (rootcount <= 1) - StopThread(); - lock (m_rootAgents) { - if (m_rootAgents.Contains(avatar.UUID)) - { - m_rootAgents.Remove(avatar.UUID); - } + m_rootAgents.Remove(avatar.UUID); + if (m_rootAgents.Count == 0) + StopThread(); } } diff --git a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs index e1d5bdc0b2..6da41db45a 100644 --- a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs +++ b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs @@ -88,12 +88,12 @@ namespace OpenSim.Region.Examples.SimpleModule m_scene.AgentCrossing(m_character.AgentId, Vector3.Zero, false); } - List avatars = m_scene.GetAvatars(); - foreach (ScenePresence avatar in avatars) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - avatar.AbsolutePosition = - new Vector3((float)Util.RandomClass.Next(100, 200), (float)Util.RandomClass.Next(30, 200), 2); - } + if (!sp.IsChildAgent) + sp.AbsolutePosition = + new Vector3((float)Util.RandomClass.Next(100, 200), (float)Util.RandomClass.Next(30, 200), 2); + }); } // private void AddComplexObjects(RegionInfo regionInfo, Vector3 pos) diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs index 668ff98f7b..87c7a05f6d 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System.Collections.Generic; using OpenMetaverse; using OpenSim.Framework; @@ -34,7 +35,12 @@ namespace OpenSim.Region.Framework.Interfaces { void Initialise(string connectstring); - EstateSettings LoadEstateSettings(UUID regionID); + EstateSettings LoadEstateSettings(UUID regionID, bool create); + EstateSettings LoadEstateSettings(int estateID); void StoreEstateSettings(EstateSettings es); + List GetEstates(string search); + bool LinkRegion(UUID regionID, int estateID); + List GetRegions(int estateID); + bool DeleteEstate(int estateID); } } diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs index 8980b2deec..2c091e753f 100644 --- a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs @@ -37,21 +37,51 @@ namespace OpenSim.Region.Framework.Interfaces { event NewGroupNotice OnNewGroupNotice; + /// + /// Create a group + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The UUID of the created group + UUID CreateGroup( + IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, + bool openEnrollment, bool allowPublish, bool maturePublish); + + /// + /// Get a group + /// + /// Name of the group + /// The group's data. Null if there is no such group. + GroupRecord GetGroupRecord(string name); + + /// + /// Get a group + /// + /// ID of the group + /// The group's data. Null if there is no such group. + GroupRecord GetGroupRecord(UUID GroupID); + void ActivateGroup(IClientAPI remoteClient, UUID groupID); List GroupTitlesRequest(IClientAPI remoteClient, UUID groupID); List GroupMembersRequest(IClientAPI remoteClient, UUID groupID); List GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID); List 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); - UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); + void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID); GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID); string GetGroupTitle(UUID avatarID); @@ -64,7 +94,6 @@ namespace OpenSim.Region.Framework.Interfaces void LeaveGroupRequest(IClientAPI remoteClient, UUID GroupID); void EjectGroupMemberRequest(IClientAPI remoteClient, UUID GroupID, UUID EjecteeID); void InviteGroupRequest(IClientAPI remoteClient, UUID GroupID, UUID InviteeID, UUID RoleID); - GroupRecord GetGroupRecord(UUID GroupID); void NotifyChange(UUID GroupID); } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index cadb85810b..1875c48da5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -132,7 +132,7 @@ namespace OpenSim.Region.Framework.Scenes { ScenePresence avatar; - if (TryGetAvatar(avatarId, out avatar)) + if (TryGetScenePresence(avatarId, out avatar)) { IInventoryAccessModule invAccess = RequestModuleInterface(); if (invAccess != null) @@ -230,7 +230,7 @@ namespace OpenSim.Region.Framework.Scenes { ScenePresence avatar; - if (TryGetAvatar(avatarId, out avatar)) + if (TryGetScenePresence(avatarId, out avatar)) { return CapsUpdateTaskInventoryScriptAsset( avatar.ControllingClient, itemId, primId, isScriptRunning, data); @@ -683,7 +683,7 @@ namespace OpenSim.Region.Framework.Scenes if (transactionID == UUID.Zero) { ScenePresence presence; - if (TryGetAvatar(remoteClient.AgentId, out presence)) + if (TryGetScenePresence(remoteClient.AgentId, out presence)) { byte[] data = null; @@ -945,7 +945,7 @@ namespace OpenSim.Region.Framework.Scenes { ScenePresence avatar; - if (TryGetAvatar(avatarId, out avatar)) + if (TryGetScenePresence(avatarId, out avatar)) { return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId); } @@ -1059,7 +1059,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence avatar; - if (TryGetAvatar(srcTaskItem.OwnerID, out avatar)) + if (TryGetScenePresence(srcTaskItem.OwnerID, out avatar)) { destPart.GetProperties(avatar.ControllingClient); } @@ -1087,7 +1087,7 @@ namespace OpenSim.Region.Framework.Scenes } ScenePresence avatar = null; - if (TryGetAvatar(destID, out avatar)) + if (TryGetScenePresence(destID, out avatar)) { //profile.SendInventoryDecendents(avatar.ControllingClient, // profile.RootFolder.ID, true, false); @@ -1424,7 +1424,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence avatar; - if (TryGetAvatar(srcTaskItem.OwnerID, out avatar)) + if (TryGetScenePresence(srcTaskItem.OwnerID, out avatar)) { destPart.GetProperties(avatar.ControllingClient); } @@ -1865,7 +1865,7 @@ namespace OpenSim.Region.Framework.Scenes UUID inventoryID = part.ParentGroup.GetFromItemID(); ScenePresence presence; - if (TryGetAvatar(remoteClient.AgentId, out presence)) + if (TryGetScenePresence(remoteClient.AgentId, out presence)) { if (!Permissions.CanRezObject(part.ParentGroup.Children.Count, remoteClient.AgentId, presence.AbsolutePosition)) return; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b2c8dfdcab..2b6f80ba45 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -606,7 +606,46 @@ namespace OpenSim.Region.Framework.Scenes if (m_storageManager.EstateDataStore != null) { - m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID); + m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); + if (m_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() {"yes", "no"}); + if (response == "no") + { + // Create a new estate + m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, true); + + m_regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", m_regInfo.EstateSettings.EstateName); + m_regInfo.EstateSettings.Save(); + break; + } + else + { + response = MainConsole.Instance.CmdPrompt("Estate name to join", "None"); + if (response == "None") + continue; + + List estateIDs = m_storageManager.EstateDataStore.GetEstates(response); + if (estateIDs.Count < 1) + { + MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); + continue; + } + + int estateID = estateIDs[0]; + + m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID); + + if (m_storageManager.EstateDataStore.LinkRegion(m_regInfo.RegionID, estateID)) + break; + + MainConsole.Instance.Output("Joining the estate failed. Please try again."); + } + } + } } //Bind Storage Manager functions to some land manager functions for this scene @@ -1229,6 +1268,84 @@ namespace OpenSim.Region.Framework.Scenes m_dialogModule = RequestModuleInterface(); m_capsModule = RequestModuleInterface(); m_teleportModule = RequestModuleInterface(); + + // Shoving this in here for now, because we have the needed + // interfaces at this point + // + // TODO: Find a better place for this + // + 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"); + + UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); + + if (account == null) + { + // Create a new account + account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty); + if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0)) + { + account.ServiceURLs = new Dictionary(); + account.ServiceURLs["HomeURI"] = string.Empty; + account.ServiceURLs["GatekeeperURI"] = string.Empty; + account.ServiceURLs["InventoryServerURI"] = string.Empty; + account.ServiceURLs["AssetServerURI"] = string.Empty; + } + + if (UserAccountService.StoreUserAccount(account)) + { + string password = MainConsole.Instance.PasswdPrompt("Password"); + string email = MainConsole.Instance.CmdPrompt("Email", ""); + + account.Email = email; + UserAccountService.StoreUserAccount(account); + + bool success = false; + success = AuthenticationService.SetPassword(account.PrincipalID, password); + if (!success) + m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.", + first, last); + + GridRegion home = null; + if (GridService != null) + { + List defaultRegions = GridService.GetDefaultRegions(UUID.Zero); + if (defaultRegions != null && defaultRegions.Count >= 1) + home = defaultRegions[0]; + + if (PresenceService != null && home != null) + PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); + else + m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.", + first, last); + + } + else + m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.", + first, last); + + if (InventoryService != null) + success = InventoryService.CreateUserInventory(account.PrincipalID); + if (!success) + m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.", + first, last); + + + m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", first, last); + + m_regInfo.EstateSettings.EstateOwner = account.PrincipalID; + m_regInfo.EstateSettings.Save(); + } + } + else + { + m_regInfo.EstateSettings.EstateOwner = account.PrincipalID; + m_regInfo.EstateSettings.Save(); + } + } } #endregion @@ -3296,7 +3413,7 @@ namespace OpenSim.Region.Framework.Scenes } } - ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID); + ScenePresence sp = GetScenePresence(agent.AgentID); if (sp != null) { m_log.DebugFormat( @@ -3594,8 +3711,7 @@ namespace OpenSim.Region.Framework.Scenes /// message to display to the user. Reason for being logged off public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) { - ScenePresence loggingOffUser = null; - loggingOffUser = GetScenePresence(AvatarID); + ScenePresence loggingOffUser = GetScenePresence(AvatarID); if (loggingOffUser != null) { UUID localRegionSecret = UUID.Zero; @@ -3631,8 +3747,8 @@ namespace OpenSim.Region.Framework.Scenes /// public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) { - ScenePresence presence; - if(m_sceneGraph.TryGetAvatar(agentID, out presence)) + ScenePresence presence = GetScenePresence(agentID); + if(presence != null) { try { @@ -3806,8 +3922,8 @@ namespace OpenSim.Region.Framework.Scenes public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags) { - ScenePresence sp; - if(m_sceneGraph.TryGetAvatar(remoteClient.AgentId, out sp)) + ScenePresence sp = GetScenePresence(remoteClient.AgentId); + if (sp != null) { uint regionX = m_regInfo.RegionLocX; uint regionY = m_regInfo.RegionLocY; @@ -3985,17 +4101,17 @@ namespace OpenSim.Region.Framework.Scenes m_log.ErrorFormat("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World"); - foreach (ScenePresence scenePresence in GetAvatars()) + ForEachScenePresence(delegate(ScenePresence sp) { m_log.ErrorFormat("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", - scenePresence.Firstname, - scenePresence.Lastname, - scenePresence.UUID, - scenePresence.ControllingClient.AgentId, + sp.Firstname, + sp.Lastname, + sp.UUID, + sp.ControllingClient.AgentId, "Unknown", "Unknown", RegionInfo.RegionName); - } + }); break; } @@ -4161,72 +4277,42 @@ namespace OpenSim.Region.Framework.Scenes m_sceneGraph.RemovePhysicalPrim(num); } - //The idea is to have a group of method that return a list of avatars meeting some requirement - // ie it could be all m_scenePresences within a certain range of the calling prim/avatar. - // - // GetAvatars returns a new list of all root agent presences in the scene - // GetScenePresences returns a new list of all presences in the scene or a filter may be passed. - // GetScenePresence returns the presence with matching UUID or first/last name. - // ForEachScenePresence requests the Scene to run a delegate function against all presences. - - /// - /// Return a list of all avatars in this region. - /// This list is a new object, so it can be iterated over without locking. - /// - /// - public List GetAvatars() + public int GetRootAgentCount() { - return m_sceneGraph.GetAvatars(); + return m_sceneGraph.GetRootAgentCount(); + } + + public int GetChildAgentCount() + { + return m_sceneGraph.GetChildAgentCount(); } /// - /// Return a list of all ScenePresences in this region. This returns child agents as well as root agents. - /// This list is a new object, so it can be iterated over without locking. + /// Request a scene presence by UUID. Fast, indexed lookup. /// - /// - public List GetScenePresences() + /// + /// null if the presence was not found + public ScenePresence GetScenePresence(UUID agentID) { - return m_sceneGraph.GetScenePresences(); + return m_sceneGraph.GetScenePresence(agentID); } /// - /// Request a filtered list of ScenePresences in this region. - /// This list is a new object, so it can be iterated over without locking. - /// - /// - /// - public List GetScenePresences(FilterAvatarList filter) - { - return m_sceneGraph.GetScenePresences(filter); - } - - /// - /// Request a scene presence by UUID - /// - /// - /// - public ScenePresence GetScenePresence(UUID avatarID) - { - return m_sceneGraph.GetScenePresence(avatarID); - } - - /// - /// Request the ScenePresence in this region by first/last name. - /// Should normally only be a single match, but first is always returned + /// Request the scene presence by name. /// /// /// - /// + /// null if the presence was not found public ScenePresence GetScenePresence(string firstName, string lastName) { return m_sceneGraph.GetScenePresence(firstName, lastName); } /// - /// Request the ScenePresence in this region by localID. + /// Request the scene presence by localID. /// /// - /// + /// null if the presence was not found public ScenePresence GetScenePresence(uint localID) { return m_sceneGraph.GetScenePresence(localID); @@ -4318,9 +4404,9 @@ namespace OpenSim.Region.Framework.Scenes return m_sceneGraph.GetGroupByPrim(localID); } - public override bool TryGetAvatar(UUID avatarId, out ScenePresence avatar) + public override bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) { - return m_sceneGraph.TryGetAvatar(avatarId, out avatar); + return m_sceneGraph.TryGetScenePresence(avatarId, out avatar); } public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 74476edd3e..3218dadc24 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -190,11 +190,11 @@ namespace OpenSim.Region.Framework.Scenes /// public abstract void RemoveClient(UUID agentID); - public bool TryGetAvatar(UUID agentID, out object scenePresence) + public bool TryGetScenePresence(UUID agentID, out object scenePresence) { scenePresence = null; ScenePresence sp = null; - if (TryGetAvatar(agentID, out sp)) + if (TryGetScenePresence(agentID, out sp)) { scenePresence = sp; return true; @@ -203,7 +203,7 @@ namespace OpenSim.Region.Framework.Scenes return false; } - public abstract bool TryGetAvatar(UUID agentID, out ScenePresence scenePresence); + public abstract bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence); #endregion diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 19298d2274..3a1962c8b4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -723,116 +723,84 @@ namespace OpenSim.Region.Framework.Scenes return null; } - // The idea is to have a group of method that return a list of avatars meeting some requirement - // ie it could be all m_scenePresences within a certain range of the calling prim/avatar. - // - // GetAvatars returns a new list of all root agent presences in the scene - // GetScenePresences returns a new list of all presences in the scene or a filter may be passed. - // GetScenePresence returns the presence with matching UUID or the first presence matching the passed filter. - // ForEachScenePresence requests the Scene to run a delegate function against all presences. - /// - /// Request a list of all avatars in this region (no child agents) - /// This list is a new object, so it can be iterated over without locking. - /// - /// - public List GetAvatars() - { - return GetScenePresences(delegate(ScenePresence scenePresence) - { - return !scenePresence.IsChildAgent; - }); - } - - /// - /// Request a list of m_scenePresences in this World - /// Returns a copy so it can be iterated without a lock. + /// Request a copy of m_scenePresences in this World /// There is no guarantee that presences will remain in the scene after the list is returned. + /// This list should remain private to SceneGraph. Callers wishing to iterate should instead + /// pass a delegate to ForEachScenePresence. /// /// - protected internal List GetScenePresences() + private List GetScenePresences() { - List result; lock (m_scenePresences) - { - result = new List(m_scenePresenceArray.Length); - result.AddRange(m_scenePresenceArray); - } - return result; + return new List(m_scenePresenceArray); } /// - /// Request a filtered list of m_scenePresences in this World - /// Returns a copy so it can be iterated without a lock. - /// There is no guarantee that presences will remain in the scene after the list is returned. - /// - /// - protected internal List GetScenePresences(FilterAvatarList filter) - { - List result = new List(); - // Check each ScenePresence against the filter - ForEachScenePresence(delegate(ScenePresence presence) - { - if (filter(presence)) - result.Add(presence); - }); - return result; - } - - /// - /// Request the ScenePresence in this region matching filter. - /// Only the first match is returned. - /// - /// - /// - /// - protected internal ScenePresence GetScenePresence(FilterAvatarList filter) - { - ScenePresence result = null; - // Get all of the ScenePresences - List presences = GetScenePresences(); - foreach (ScenePresence presence in presences) - { - if (filter(presence)) - { - result = presence; - break; - } - } - return result; - } - - protected internal ScenePresence GetScenePresence(string firstName, string lastName) - { - return GetScenePresence(delegate(ScenePresence presence) - { - return(presence.Firstname == firstName && presence.Lastname == lastName); - }); - } - - /// - /// Request a scene presence by UUID + /// Request a scene presence by UUID. Fast, indexed lookup. /// /// - /// null if the agent was not found + /// null if the presence was not found protected internal ScenePresence GetScenePresence(UUID agentID) { ScenePresence sp; - TryGetAvatar(agentID, out sp); + lock (m_scenePresences) + { + m_scenePresences.TryGetValue(agentID, out sp); + } return sp; } /// - /// Request the ScenePresence in this region by localID. + /// Request the scene presence by name. + /// + /// + /// + /// null if the presence was not found + protected internal ScenePresence GetScenePresence(string firstName, string lastName) + { + foreach (ScenePresence presence in GetScenePresences()) + { + if (presence.Firstname == firstName && presence.Lastname == lastName) + return presence; + } + return null; + } + + /// + /// Request the scene presence by localID. /// /// - /// + /// null if the presence was not found protected internal ScenePresence GetScenePresence(uint localID) { - return GetScenePresence(delegate(ScenePresence presence) + foreach (ScenePresence presence in GetScenePresences()) + if (presence.LocalId == localID) + return presence; + return null; + } + + protected internal bool TryGetScenePresence(UUID agentID, out ScenePresence avatar) + { + lock (m_scenePresences) { - return (presence.LocalId == localID); - }); + m_scenePresences.TryGetValue(agentID, out avatar); + } + return (avatar != null); + } + + protected internal bool TryGetAvatarByName(string name, out ScenePresence avatar) + { + avatar = null; + foreach (ScenePresence presence in GetScenePresences()) + { + if (String.Compare(name, presence.ControllingClient.Name, true) == 0) + { + avatar = presence; + break; + } + } + return (avatar != null); } /// @@ -986,24 +954,6 @@ namespace OpenSim.Region.Framework.Scenes return group.GetChildPart(fullID); } - protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar) - { - lock (m_scenePresences) - { - m_scenePresences.TryGetValue(avatarId, out avatar); - } - return (avatar != null); - } - - protected internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) - { - avatar = GetScenePresence(delegate(ScenePresence presence) - { - return (String.Compare(avatarName, presence.ControllingClient.Name, true) == 0); - }); - return (avatar != null); - } - /// /// Returns a list of the entities in the scene. This is a new list so no locking is required to iterate over /// it @@ -1066,6 +1016,10 @@ namespace OpenSim.Region.Framework.Scenes return UUID.Zero; } + /// + /// Performs action on all scene object groups. + /// + /// protected internal void ForEachSOG(Action action) { List objlist = new List(SceneObjectGroupsByFullID.Values); @@ -1085,23 +1039,41 @@ namespace OpenSim.Region.Framework.Scenes /// - /// Performs action on all scene presences. + /// Performs action on all scene presences. This can ultimately run the actions in parallel but + /// any delegates passed in will need to implement their own locking on data they reference and + /// modify outside of the scope of the delegate. /// /// public void ForEachScenePresence(Action action) { - List presences = GetScenePresences(); - try - { - foreach(ScenePresence presence in presences) + // Once all callers have their delegates configured for parallelism, we can unleash this + /* + Action protectedAction = new Action(delegate(ScenePresence sp) { - action(presence); - } - } - catch (Exception e) + try + { + action(sp); + } + catch (Exception e) + { + m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); + m_log.Info("[BUG] Stack Trace: " + e.StackTrace); + } + }); + Parallel.ForEach(GetScenePresences(), protectedAction); + */ + // For now, perform actiona serially + foreach (ScenePresence sp in GetScenePresences()) { - m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); - m_log.Info("[BUG] Stack Trace: " + e.StackTrace); + try + { + action(sp); + } + catch (Exception e) + { + m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); + m_log.Info("[BUG] Stack Trace: " + e.StackTrace); + } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index a9555322e3..3b8473469e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs @@ -454,8 +454,10 @@ namespace OpenSim.Region.Framework.Scenes ForEachCurrentScene(delegate(Scene scene) { - List scenePresences = scene.GetScenePresences(); - presences.AddRange(scenePresences); + scene.ForEachScenePresence(delegate(ScenePresence sp) + { + presences.Add(sp); + }); }); return presences; @@ -484,11 +486,11 @@ namespace OpenSim.Region.Framework.Scenes ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); } - public bool TryGetAvatar(UUID avatarId, out ScenePresence avatar) + public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) { foreach (Scene scene in m_localScenes) { - if (scene.TryGetAvatar(avatarId, out avatar)) + if (scene.TryGetScenePresence(avatarId, out avatar)) { return true; } @@ -503,7 +505,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence avatar = null; foreach (Scene mScene in m_localScenes) { - if (mScene.TryGetAvatar(avatarId, out avatar)) + if (mScene.TryGetScenePresence(avatarId, out avatar)) { scene = mScene; return true; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 539f2b1cb9..4b2641c7e3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -682,7 +682,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_parentGroup != null) // TODO can there be a SOP without a SOG? { ScenePresence avatar; - if (m_parentGroup.Scene.TryGetAvatar(m_sitTargetAvatar, out avatar)) + if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar)) { avatar.ParentPosition = GetWorldPosition(); } @@ -1332,11 +1332,11 @@ namespace OpenSim.Region.Framework.Scenes if (volume < 0) volume = 0; - List avatarts = m_parentGroup.Scene.GetAvatars(); - foreach (ScenePresence p in avatarts) + m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) { - p.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); - } + if(!sp.IsChildAgent) + sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); + }); } /// @@ -2626,12 +2626,13 @@ namespace OpenSim.Region.Framework.Scenes TaskInventory.LockItemsForRead(false); } - List avatarts = m_parentGroup.Scene.GetAvatars(); - foreach (ScenePresence p in avatarts) + m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) { - if (!(Util.GetDistanceTo(p.AbsolutePosition, AbsolutePosition) >= 100)) - p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); - } + if (sp.IsChildAgent) + return; + if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100)) + sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); + }); } public void RemFlag(PrimFlags flag) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1e530e1c2f..5c546161ed 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2598,35 +2598,33 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos); List CoarseLocations = new List(); List AvatarUUIDs = new List(); - List avatars = m_scene.GetAvatars(); - for (int i = 0; i < avatars.Count; i++) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - // Requested by LibOMV. Send Course Location on self. - //if (avatars[i] != this) - //{ - if (avatars[i].ParentID != 0) + if (sp.IsChildAgent) + return; + + if (sp.ParentID != 0) + { + // sitting avatar + SceneObjectPart sop = m_scene.GetSceneObjectPart(sp.ParentID); + if (sop != null) { - // sitting avatar - SceneObjectPart sop = m_scene.GetSceneObjectPart(avatars[i].ParentID); - if (sop != null) - { - CoarseLocations.Add(sop.AbsolutePosition + avatars[i].m_pos); - AvatarUUIDs.Add(avatars[i].UUID); - } - else - { - // we can't find the parent.. ! arg! - CoarseLocations.Add(avatars[i].m_pos); - AvatarUUIDs.Add(avatars[i].UUID); - } + CoarseLocations.Add(sop.AbsolutePosition + sp.m_pos); + AvatarUUIDs.Add(sp.UUID); } else { - CoarseLocations.Add(avatars[i].m_pos); - AvatarUUIDs.Add(avatars[i].UUID); + // we can't find the parent.. ! arg! + CoarseLocations.Add(sp.m_pos); + AvatarUUIDs.Add(sp.UUID); } - //} - } + } + else + { + CoarseLocations.Add(sp.m_pos); + AvatarUUIDs.Add(sp.UUID); + } + }); m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); @@ -2700,13 +2698,15 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos); m_perfMonMS = Util.EnvironmentTickCount(); // only send update from root agents to other clients; children are only "listening posts" - List avatars = m_scene.GetAvatars(); - foreach (ScenePresence avatar in avatars) + int count = 0; + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - SendFullUpdateToOtherClient(avatar); - - } - m_scene.StatsReporter.AddAgentUpdates(avatars.Count); + if (sp.IsChildAgent) + return; + SendFullUpdateToOtherClient(sp); + ++count; + }); + m_scene.StatsReporter.AddAgentUpdates(count); m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); Animator.SendAnimPack(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs index 840039ca2a..dd9f8f6654 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs @@ -66,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests throw new NotImplementedException(); } - public override bool TryGetAvatar(UUID agentID, out ScenePresence scenePresence) + public override bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence) { throw new NotImplementedException(); } diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs index c86499336c..2fcc477dc2 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs @@ -318,9 +318,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge { Scene scene = client.Scene as Scene; m_log.DebugFormat("[Concierge]: {0} logs off from {1}", client.Name, scene.RegionInfo.RegionName); - List avs = scene.GetAvatars(); - AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, client.Name, scene.RegionInfo.RegionName, avs.Count)); - UpdateBroker(scene, avs); + AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, client.Name, scene.RegionInfo.RegionName, scene.GetRootAgentCount())); + UpdateBroker(scene); } } @@ -331,11 +330,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge { Scene scene = agent.Scene; m_log.DebugFormat("[Concierge]: {0} enters {1}", agent.Name, scene.RegionInfo.RegionName); - List avs = scene.GetAvatars(); WelcomeAvatar(agent, scene); AnnounceToAgentsRegion(scene, String.Format(m_announceEntering, agent.Name, - scene.RegionInfo.RegionName, avs.Count)); - UpdateBroker(scene, avs); + scene.RegionInfo.RegionName, scene.GetRootAgentCount())); + UpdateBroker(scene); } } @@ -346,10 +344,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge { Scene scene = agent.Scene; m_log.DebugFormat("[Concierge]: {0} leaves {1}", agent.Name, scene.RegionInfo.RegionName); - List avs = scene.GetAvatars(); AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, agent.Name, - scene.RegionInfo.RegionName, avs.Count)); - UpdateBroker(scene, avs); + scene.RegionInfo.RegionName, scene.GetRootAgentCount())); + UpdateBroker(scene); } } @@ -368,7 +365,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge } } - protected void UpdateBroker(IScene scene, List avatars) + protected void UpdateBroker(Scene scene) { if (String.IsNullOrEmpty(m_brokerURI)) return; @@ -377,24 +374,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge // create XML sniplet StringBuilder list = new StringBuilder(); - if (0 == avatars.Count) - { - list.Append(String.Format("", - scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, + list.Append(String.Format("\n", + scene.GetRootAgentCount(), scene.RegionInfo.RegionName, + scene.RegionInfo.RegionID, DateTime.UtcNow.ToString("s"))); - } - else + scene.ForEachScenePresence(delegate(ScenePresence sp) { - list.Append(String.Format("\n", - avatars.Count, scene.RegionInfo.RegionName, - scene.RegionInfo.RegionID, - DateTime.UtcNow.ToString("s"))); - foreach (ScenePresence av in avatars) + if (!sp.IsChildAgent) { - list.Append(String.Format(" \n", av.Name, av.UUID)); + list.Append(String.Format(" \n", sp.Name, sp.UUID)); + list.Append(""); } - list.Append(""); - } + }); string payload = list.ToString(); // post via REST to broker @@ -529,7 +520,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge // protected void AnnounceToAgentsRegion(Scene scene, string msg) // { // ScenePresence agent = null; - // if ((client.Scene is Scene) && (client.Scene as Scene).TryGetAvatar(client.AgentId, out agent)) + // if ((client.Scene is Scene) && (client.Scene as Scene).TryGetScenePresence(client.AgentId, out agent)) // AnnounceToAgentsRegion(agent, msg); // else // m_log.DebugFormat("[Concierge]: could not find an agent for client {0}", client.Name); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 68e6497026..61c51e077d 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -328,17 +328,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } */ - void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart) { if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups) { - if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})", System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart); + if (m_debugEnabled) + m_log.DebugFormat( + "[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})", + System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart); // TODO: This currently ignores pretty much all the query flags including Mature and sort order - remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(GetClientGroupRequestID(remoteClient), queryText).ToArray()); - } - + remoteClient.SendDirGroupsReply( + queryID, m_groupData.FindGroups(GetClientGroupRequestID(remoteClient), queryText).ToArray()); + } } private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) @@ -363,7 +365,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups SendScenePresenceUpdate(dataForAgentID, activeGroupTitle); } - private void HandleUUIDGroupNameRequest(UUID GroupID,IClientAPI remoteClient) + private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); @@ -593,6 +595,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return m_groupData.GetGroupRecord(null, GroupID, null); } + public GroupRecord GetGroupRecord(string name) + { + return m_groupData.GetGroupRecord(null, UUID.Zero, name); + } + public void ActivateGroup(IClientAPI remoteClient, UUID groupID) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); @@ -652,7 +659,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID); return data; - } public List GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID) @@ -662,8 +668,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID); return data; - - } public GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID) @@ -712,7 +716,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID) { - if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); + if (m_debugEnabled) + m_log.DebugFormat( + "[GROUPS]: {0} called with groupID={1}, agentID={2}", + System.Reflection.MethodBase.GetCurrentMethod().Name, groupID, agentID); return m_groupData.GetAgentGroupMembership(null, agentID, groupID); } @@ -746,7 +753,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return UUID.Zero; } // is there is a money module present ? - IMoneyModule money=remoteClient.Scene.RequestModuleInterface(); + IMoneyModule money = remoteClient.Scene.RequestModuleInterface(); if (money != null) { // do the transaction, that is if the agent has got sufficient funds @@ -1166,8 +1173,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups else { string domain = string.Empty; //m_sceneList[0].CommsManager.NetworkServersInfo.UserURL; - if (account.ServiceURLs["HomeURI"] != null) - domain = account.ServiceURLs["HomeURI"].ToString(); + object homeUriObj; + if (account.ServiceURLs.TryGetValue("HomeURI", out homeUriObj) && homeUriObj != null) + domain = homeUriObj.ToString(); // They're a local user, use this: info.RequestID.UserServiceURL = domain; } diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs index 9e0fa2de4a..621ab28565 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs @@ -55,7 +55,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups GroupInviteInfo GetAgentToGroupInvite(GroupRequestID requestID, UUID inviteID); void RemoveAgentToGroupInvite(GroupRequestID requestID, UUID inviteID); - void AddAgentToGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID); void RemoveAgentFromGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID); List GetAgentGroupRoles(GroupRequestID requestID, UUID AgentID, UUID GroupID); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 964d0bbbf1..24ae4f7975 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -47,9 +47,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | GroupPowers.Accountable | @@ -354,11 +352,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; return MemberGroupProfile; - } - - public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) { Hashtable param = new Hashtable(); @@ -470,7 +465,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups XmlRpcCall(requestID, "groups.removeAgentFromGroupRole", param); } - public List FindGroups(GroupRequestID requestID, string search) { Hashtable param = new Hashtable(); @@ -531,7 +525,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return HashTableToGroupMembershipData(respData); } - public List GetAgentGroupMemberships(GroupRequestID requestID, UUID AgentID) { Hashtable param = new Hashtable(); @@ -778,7 +771,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) { - GroupRecord group = new GroupRecord(); group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); group.GroupName = groupProfile["Name"].ToString(); @@ -797,6 +789,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return group; } + private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) { GroupMembershipData data = new GroupMembershipData(); @@ -829,6 +822,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups data.MembershipFee = int.Parse((string)respData["MembershipFee"]); data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); data.ShowInList = ((string)respData["ShowInList"] == "1"); + return data; } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 6e742f1ece..ab0be77715 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -110,7 +110,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC if (m_avatars.ContainsKey(agentID)) { ScenePresence sp; - scene.TryGetAvatar(agentID, out sp); + scene.TryGetScenePresence(agentID, out sp); sp.DoAutoPilot(0, pos, m_avatars[agentID]); } } @@ -165,7 +165,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC p_scene.AddNewClient(npcAvatar); ScenePresence sp; - if (p_scene.TryGetAvatar(npcAvatar.AgentId, out sp)) + if (p_scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) { AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene); diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 0b8771c3ad..b42d3bfb32 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -625,36 +625,37 @@ namespace OpenSim.Region.RegionCombinerModule return; } - List avatars = connectiondata.RegionScene.GetAvatars(); List CoarseLocations = new List(); List AvatarUUIDs = new List(); - for (int i = 0; i < avatars.Count; i++) + connectiondata.RegionScene.ForEachScenePresence(delegate(ScenePresence sp) { - if (avatars[i].UUID != presence.UUID) + if (sp.IsChildAgent) + return; + if (sp.UUID != presence.UUID) { - if (avatars[i].ParentID != 0) + if (sp.ParentID != 0) { // sitting avatar - SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(avatars[i].ParentID); + SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(sp.ParentID); if (sop != null) { - CoarseLocations.Add(sop.AbsolutePosition + avatars[i].AbsolutePosition); - AvatarUUIDs.Add(avatars[i].UUID); + CoarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition); + AvatarUUIDs.Add(sp.UUID); } else { // we can't find the parent.. ! arg! - CoarseLocations.Add(avatars[i].AbsolutePosition); - AvatarUUIDs.Add(avatars[i].UUID); + CoarseLocations.Add(sp.AbsolutePosition); + AvatarUUIDs.Add(sp.UUID); } } else { - CoarseLocations.Add(avatars[i].AbsolutePosition); - AvatarUUIDs.Add(avatars[i].UUID); + CoarseLocations.Add(sp.AbsolutePosition); + AvatarUUIDs.Add(sp.UUID); } } - } + }); DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0c373b9108..3f630f4b18 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5293,7 +5293,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGetRegionAgentCount() { m_host.AddScriptLPS(1); - return new LSL_Integer(World.GetAvatars().Count); + return new LSL_Integer(World.GetRootAgentCount()); } public LSL_Vector llGetRegionCorner() @@ -9096,17 +9096,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api landObject.SetMediaUrl(url); // now send to all (non-child) agents - List agents = World.GetAvatars(); - foreach (ScenePresence agent in agents) + World.ForEachScenePresence(delegate(ScenePresence sp) { - agent.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, - landData.MediaID, - landData.MediaAutoScale, - mediaType, - description, - width, height, - loop); - } + if (!sp.IsChildAgent) + { + sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, + landData.MediaID, + landData.MediaAutoScale, + mediaType, + description, + width, height, + loop); + } + }); } else if (!presence.IsChildAgent) { @@ -9127,13 +9129,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence == null) { // send to all (non-child) agents - List agents = World.GetAvatars(); - foreach (ScenePresence agent in agents) + World.ForEachScenePresence(delegate(ScenePresence sp) { - agent.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this? - (ParcelMediaCommandEnum)commandToSend, - time); - } + if (!sp.IsChildAgent) + { + sp.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this? + (ParcelMediaCommandEnum)commandToSend, + time); + } + }); } else if (!presence.IsChildAgent) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 845834e3d1..9474bab829 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -697,10 +697,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.None, "osGetAgents"); LSL_List result = new LSL_List(); - foreach (ScenePresence avatar in World.GetAvatars()) + World.ForEachScenePresence(delegate(ScenePresence sp) { - result.Add(avatar.Name); - } + if (!sp.IsChildAgent) + result.Add(sp.Name); + }); return result; } @@ -1989,19 +1990,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) { - foreach (ScenePresence presence in World.GetAvatars()) + World.ForEachScenePresence(delegate(ScenePresence sp) { - if ((presence.Firstname == FirstName) && - presence.Lastname == SurName) + if (!sp.IsChildAgent && + sp.Firstname == FirstName && + sp.Lastname == SurName) { // kick client... if (alert != null) - presence.ControllingClient.Kick(alert); + sp.ControllingClient.Kick(alert); // ...and close on our side - presence.Scene.IncomingCloseAgent(presence.UUID); + sp.Scene.IncomingCloseAgent(sp.UUID); } - } + }); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 829fbb7fd2..2296379da7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -404,70 +404,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins private List doAgentSensor(SenseRepeatClass ts) { - List presences; List sensedEntities = new List(); - // If this is an avatar sense by key try to get them directly - // rather than getting a list to scan through - if (ts.keyID != UUID.Zero) - { - ScenePresence p = m_CmdManager.m_ScriptEngine.World.GetScenePresence(ts.keyID); - if (p == null) - return sensedEntities; - presences = new List(); - presences.Add(p); - } - else - { - presences = new List(m_CmdManager.m_ScriptEngine.World.GetScenePresences()); - } - // If nobody about quit fast - if (presences.Count == 0) + if(m_CmdManager.m_ScriptEngine.World.GetRootAgentCount() == 0) return sensedEntities; SceneObjectPart SensePoint = ts.host; - Vector3 fromRegionPos = SensePoint.AbsolutePosition; - Quaternion q = SensePoint.RotationOffset; LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); - bool attached = (SensePoint.AttachmentPoint != 0); - bool nameSearch = (ts.name != null && ts.name != ""); Vector3 toRegionPos; double dis; - for (int i = 0; i < presences.Count; i++) + Action senseEntity = new Action(delegate(ScenePresence presence) { - ScenePresence presence = presences[i]; - bool keep = true; + if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0) + return; + + // if the object the script is in is attached and the avatar is the owner + // then this one is not wanted + if (attached && presence.UUID == SensePoint.OwnerID) + return; - if (presence.IsDeleted) - continue; - - if (presence.IsChildAgent) - keep = false; toRegionPos = presence.AbsolutePosition; - dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos)); // are they in range - if (keep && dis <= ts.range) + if (dis <= ts.range) { - // if the object the script is in is attached and the avatar is the owner - // then this one is not wanted - if (attached && presence.UUID == SensePoint.OwnerID) - keep = false; - - // check the name if needed - if (keep && nameSearch && ts.name != presence.Name) - keep = false; - // Are they in the required angle of view - if (keep && ts.arc < Math.PI) + if (ts.arc < Math.PI) { // not omni-directional. Can you see it ? // vec forward_dir = llRot2Fwd(llGetRot()) @@ -488,26 +458,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins catch { } - if (ang_obj > ts.arc) keep = false; + if (ang_obj <= ts.arc) + { + sensedEntities.Add(new SensedEntity(dis, presence.UUID)); + } } } - else - { - keep = false; - } + }); - // Do not report gods, not even minor ones - if (keep && presence.GodLevel > 0.0) - keep = false; - - if (keep) // add to list with distance - { - sensedEntities.Add(new SensedEntity(dis, presence.UUID)); - } - - // If this is a search by name and we have just found it then no more to do - if (nameSearch && ts.name == presence.Name) + // If this is an avatar sense by key try to get them directly + // rather than getting a list to scan through + if (ts.keyID != UUID.Zero) + { + ScenePresence sp; + // Try direct lookup by UUID + if(!m_CmdManager.m_ScriptEngine.World.TryGetScenePresence(ts.keyID, out sp)) return sensedEntities; + senseEntity(sp); + } + else if (ts.name != null && ts.name != "") + { + ScenePresence sp; + // Try lookup by name will return if/when found + if (!m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp)) + return sensedEntities; + senseEntity(sp); + } + else + { + m_CmdManager.m_ScriptEngine.World.ForEachScenePresence(senseEntity); } return sensedEntities; } diff --git a/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs b/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs index a567413ec8..dcbd7173d9 100644 --- a/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs +++ b/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs @@ -68,17 +68,15 @@ namespace OpenSim.Region.UserStatistics HTMLUtil.OL_O(ref output, ""); foreach (Scene scene in all_scenes) { - List avatarInScene = scene.GetScenePresences(); - HTMLUtil.LI_O(ref output, String.Empty); output.Append(scene.RegionInfo.RegionName); HTMLUtil.OL_O(ref output, String.Empty); - foreach (ScenePresence av in avatarInScene) + scene.ForEachScenePresence(delegate(ScenePresence av) { - Dictionary queues = new Dictionary(); + Dictionary queues = new Dictionary(); if (av.ControllingClient is IStatsCollector) { - IStatsCollector isClient = (IStatsCollector) av.ControllingClient; + IStatsCollector isClient = (IStatsCollector)av.ControllingClient; queues = decodeQueueReport(isClient.Report()); } HTMLUtil.LI_O(ref output, String.Empty); @@ -92,8 +90,8 @@ namespace OpenSim.Region.UserStatistics else { output.Append(string.Format("
Position: <{0},{1},{2}>", (int)av.AbsolutePosition.X, - (int) av.AbsolutePosition.Y, - (int) av.AbsolutePosition.Z)); + (int)av.AbsolutePosition.Y, + (int)av.AbsolutePosition.Z)); } Dictionary throttles = DecodeClientThrottles(av.ControllingClient.GetThrottlesPacked(1)); @@ -124,7 +122,7 @@ namespace OpenSim.Region.UserStatistics HTMLUtil.UL_C(ref output); HTMLUtil.LI_C(ref output); - } + }); HTMLUtil.OL_C(ref output); } HTMLUtil.OL_C(ref output); diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 77184a498a..9e4593e19e 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -71,6 +71,8 @@ namespace OpenSim.Server.Base return m_Servers[port]; m_Servers[port] = new BaseHttpServer(port); + + m_Log.InfoFormat("[SERVER]: Starting new HTTP server on port {0}", port); m_Servers[port].Start(); return m_Servers[port]; @@ -109,6 +111,7 @@ namespace OpenSim.Server.Base protected override void Initialise() { + m_Log.InfoFormat("[SERVER]: Starting HTTP server on port {0}", m_HttpServer.Port); m_HttpServer.Start(); if (MainConsole.Instance is RemoteConsole) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index c5fbc9e841..27434ad0de 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -90,14 +90,14 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig gridConfig = source.Configs["AssetService"]; if (gridConfig == null) { - m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); + m_log.Error("[SIMIAN ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); throw new Exception("Asset connector init error"); } string serviceUrl = gridConfig.GetString("AssetServerURI"); if (String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[ASSET CONNECTOR]: No AssetServerURI in section AssetService"); + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI in section AssetService"); throw new Exception("Asset connector init error"); } @@ -162,7 +162,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } catch (Exception ex) { - m_log.Warn("[ASSET CONNECTOR]: Asset GET from " + url + " failed: " + ex.Message); + m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset GET from " + url + " failed: " + ex.Message); return null; } } @@ -220,7 +220,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } catch (Exception ex) { - m_log.Warn("[ASSET CONNECTOR]: Asset GET from " + url + " failed: " + ex.Message); + m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset GET from " + url + " failed: " + ex.Message); } return metadata; @@ -356,7 +356,7 @@ namespace OpenSim.Services.Connectors.SimianGrid errorMessage = ex.Message; } - m_log.WarnFormat("[ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}", + m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}", asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage); return null; } @@ -374,7 +374,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (asset == null) { - m_log.Warn("[ASSET CONNECTOR]: Failed to fetch asset " + id + " for updating"); + m_log.Warn("[SIMIAN ASSET CONNECTOR]: Failed to fetch asset " + id + " for updating"); return false; } @@ -400,7 +400,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (response["Success"].AsBoolean()) return true; else - m_log.Warn("[ASSET CONNECTOR]: Failed to delete asset " + id + " from the asset service"); + m_log.Warn("[SIMIAN ASSET CONNECTOR]: Failed to delete asset " + id + " from the asset service"); return false; } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index cc53d6ca0f..e78429d29b 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs @@ -78,14 +78,14 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig assetConfig = source.Configs["AuthenticationService"]; if (assetConfig == null) { - m_log.Error("[AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini"); + m_log.Error("[SIMIAN AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini"); throw new Exception("Authentication connector init error"); } string serviceURI = assetConfig.GetString("AuthenticationServerURI"); if (String.IsNullOrEmpty(serviceURI)) { - m_log.Error("[AUTH CONNECTOR]: No Server URI named in section AuthenticationService"); + m_log.Error("[SIMIAN AUTH CONNECTOR]: No Server URI named in section AuthenticationService"); throw new Exception("Authentication connector init error"); } @@ -114,17 +114,17 @@ namespace OpenSim.Services.Connectors.SimianGrid { string credential = identity["Credential"].AsString(); - if (password == credential || Utils.MD5String(password) == credential) + if (password == credential || "$1$" + Utils.MD5String(password) == credential) return Authorize(principalID); } } } - m_log.Warn("[AUTH CONNECTOR]: Authentication failed for " + principalID); + m_log.Warn("[SIMIAN AUTH CONNECTOR]: Authentication failed for " + principalID); } else { - m_log.Warn("[AUTH CONNECTOR]: Failed to retrieve identities for " + principalID + ": " + + m_log.Warn("[SIMIAN AUTH CONNECTOR]: Failed to retrieve identities for " + principalID + ": " + response["Message"].AsString()); } @@ -146,7 +146,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[AUTH CONNECTOR]: Could not verify session for " + principalID + ": " + + m_log.Warn("[SIMIAN AUTH CONNECTOR]: Could not verify session for " + principalID + ": " + response["Message"].AsString()); } @@ -168,7 +168,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[AUTH CONNECTOR]: Failed to remove session for " + principalID + ": " + + m_log.Warn("[SIMIAN AUTH CONNECTOR]: Failed to remove session for " + principalID + ": " + response["Message"].AsString()); } @@ -177,9 +177,46 @@ namespace OpenSim.Services.Connectors.SimianGrid public bool SetPassword(UUID principalID, string passwd) { - // TODO: Use GetIdentities to find the md5hash identity for principalID - // and then update it with AddIdentity - m_log.Error("[AUTH CONNECTOR]: Changing passwords is not implemented yet"); + // Fetch the user name first + NameValueCollection requestArgs = new NameValueCollection + { + { "RequestMethod", "GetUser" }, + { "UserID", principalID.ToString() } + }; + + OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); + if (response["Success"].AsBoolean() && response["User"] is OSDMap) + { + OSDMap userMap = (OSDMap)response["User"]; + string identifier = userMap["Name"].AsString(); + + if (!String.IsNullOrEmpty(identifier)) + { + // Add/update the md5hash identity + requestArgs = new NameValueCollection + { + { "RequestMethod", "AddIdentity" }, + { "Identifier", identifier }, + { "Credential", "$1$" + Utils.MD5String(passwd) }, + { "Type", "md5hash" }, + { "UserID", principalID.ToString() } + }; + + response = WebUtil.PostToService(m_serverUrl, requestArgs); + bool success = response["Success"].AsBoolean(); + + if (!success) + m_log.WarnFormat("[SIMIAN AUTH CONNECTOR]: Failed to set password for {0} ({1})", identifier, principalID); + + return success; + } + } + else + { + m_log.Warn("[SIMIAN AUTH CONNECTOR]: Failed to retrieve identities for " + principalID + ": " + + response["Message"].AsString()); + } + return false; } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index 00f9f36f6a..a47f32cf7d 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs @@ -83,14 +83,14 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig gridConfig = source.Configs["AvatarService"]; if (gridConfig == null) { - m_log.Error("[AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini"); + m_log.Error("[SIMIAN AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini"); throw new Exception("Avatar connector init error"); } string serviceUrl = gridConfig.GetString("AvatarServerURI"); if (String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[AVATAR CONNECTOR]: No AvatarServerURI in section AvatarService"); + m_log.Error("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI in section AvatarService"); throw new Exception("Avatar connector init error"); } @@ -156,14 +156,14 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[AVATAR CONNECTOR]: Failed to get user appearance for " + userID + + m_log.Warn("[SIMIAN AVATAR CONNECTOR]: Failed to get user appearance for " + userID + ", LLAppearance is missing or invalid"); return null; } } else { - m_log.Warn("[AVATAR CONNECTOR]: Failed to get user appearance for " + userID + ": " + + m_log.Warn("[SIMIAN AVATAR CONNECTOR]: Failed to get user appearance for " + userID + ": " + response["Message"].AsString()); } @@ -172,7 +172,7 @@ namespace OpenSim.Services.Connectors.SimianGrid public bool SetAvatar(UUID userID, AvatarData avatar) { - m_log.Debug("[AVATAR CONNECTOR]: SetAvatar called for " + userID); + m_log.Debug("[SIMIAN AVATAR CONNECTOR]: SetAvatar called for " + userID); if (avatar.AvatarType == 1) // LLAvatar { @@ -228,32 +228,32 @@ namespace OpenSim.Services.Connectors.SimianGrid bool success = response["Success"].AsBoolean(); if (!success) - m_log.Warn("[AVATAR CONNECTOR]: Failed saving appearance for " + userID + ": " + response["Message"].AsString()); + m_log.Warn("[SIMIAN AVATAR CONNECTOR]: Failed saving appearance for " + userID + ": " + response["Message"].AsString()); return success; } else { - m_log.Error("[AVATAR CONNECTOR]: Can't save appearance for " + userID + ". Unhandled avatar type " + avatar.AvatarType); + m_log.Error("[SIMIAN AVATAR CONNECTOR]: Can't save appearance for " + userID + ". Unhandled avatar type " + avatar.AvatarType); return false; } } public bool ResetAvatar(UUID userID) { - m_log.Error("[AVATAR CONNECTOR]: ResetAvatar called for " + userID + ", implement this"); + m_log.Error("[SIMIAN AVATAR CONNECTOR]: ResetAvatar called for " + userID + ", implement this"); return false; } public bool SetItems(UUID userID, string[] names, string[] values) { - m_log.Error("[AVATAR CONNECTOR]: SetItems called for " + userID + " with " + names.Length + " names and " + values.Length + " values, implement this"); + m_log.Error("[SIMIAN AVATAR CONNECTOR]: SetItems called for " + userID + " with " + names.Length + " names and " + values.Length + " values, implement this"); return false; } public bool RemoveItems(UUID userID, string[] names) { - m_log.Error("[AVATAR CONNECTOR]: RemoveItems called for " + userID + " with " + names.Length + " names, implement this"); + m_log.Error("[SIMIAN AVATAR CONNECTOR]: RemoveItems called for " + userID + " with " + names.Length + " names, implement this"); return false; } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs index 89eb72d143..89f3594a94 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs @@ -89,14 +89,14 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig assetConfig = source.Configs["FriendsService"]; if (assetConfig == null) { - m_log.Error("[FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini"); + m_log.Error("[SIMIAN FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini"); throw new Exception("Friends connector init error"); } string serviceURI = assetConfig.GetString("FriendsServerURI"); if (String.IsNullOrEmpty(serviceURI)) { - m_log.Error("[FRIENDS CONNECTOR]: No Server URI named in section FriendsService"); + m_log.Error("[SIMIAN FRIENDS CONNECTOR]: No Server URI named in section FriendsService"); throw new Exception("Friends connector init error"); } @@ -169,7 +169,7 @@ namespace OpenSim.Services.Connectors.SimianGrid bool success = response["Success"].AsBoolean(); if (!success) - m_log.Error("[FRIENDS CONNECTOR]: Failed to store friend " + friend + " for user " + principalID + ": " + response["Message"].AsString()); + m_log.Error("[SIMIAN FRIENDS CONNECTOR]: Failed to store friend " + friend + " for user " + principalID + ": " + response["Message"].AsString()); return success; } @@ -188,7 +188,7 @@ namespace OpenSim.Services.Connectors.SimianGrid bool success = response["Success"].AsBoolean(); if (!success) - m_log.Error("[FRIENDS CONNECTOR]: Failed to remove friend " + friend + " for user " + principalID + ": " + response["Message"].AsString()); + m_log.Error("[SIMIAN FRIENDS CONNECTOR]: Failed to remove friend " + friend + " for user " + principalID + ": " + response["Message"].AsString()); return success; } @@ -211,7 +211,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[FRIENDS CONNECTOR]: Failed to retrieve friends for user " + ownerID + ": " + response["Message"].AsString()); + m_log.Warn("[SIMIAN FRIENDS CONNECTOR]: Failed to retrieve friends for user " + ownerID + ": " + response["Message"].AsString()); return new OSDArray(0); } } @@ -232,7 +232,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[FRIENDS CONNECTOR]: Failed to retrieve reverse friends for user " + ownerID + ": " + response["Message"].AsString()); + m_log.Warn("[SIMIAN FRIENDS CONNECTOR]: Failed to retrieve reverse friends for user " + ownerID + ": " + response["Message"].AsString()); return new OSDArray(0); } } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 071a481611..3a612267c5 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -85,14 +85,14 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig gridConfig = source.Configs["GridService"]; if (gridConfig == null) { - m_log.Error("[GRID CONNECTOR]: GridService missing from OpenSim.ini"); + m_log.Error("[SIMIAN GRID CONNECTOR]: GridService missing from OpenSim.ini"); throw new Exception("Grid connector init error"); } string serviceUrl = gridConfig.GetString("GridServerURI"); if (String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[GRID CONNECTOR]: No Server URI named in section GridService"); + m_log.Error("[SIMIAN GRID CONNECTOR]: No Server URI named in section GridService"); throw new Exception("Grid connector init error"); } @@ -155,7 +155,7 @@ namespace OpenSim.Services.Connectors.SimianGrid bool success = response["Success"].AsBoolean(); if (!success) - m_log.Warn("[GRID CONNECTOR]: Region deregistration for " + regionID + " failed: " + response["Message"].AsString()); + m_log.Warn("[SIMIAN GRID CONNECTOR]: Region deregistration for " + regionID + " failed: " + response["Message"].AsString()); return success; } @@ -181,7 +181,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } } - m_log.Debug("[GRID CONNECTOR]: Found " + regions.Count + " neighbors for region " + regionID); + m_log.Debug("[SIMIAN GRID CONNECTOR]: Found " + regions.Count + " neighbors for region " + regionID); return regions; } @@ -203,7 +203,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[GRID CONNECTOR]: Grid service did not find a match for region " + regionID); + m_log.Warn("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region " + regionID); return null; } } @@ -228,7 +228,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - //m_log.InfoFormat("[GRID CONNECTOR]: Grid service did not find a match for region at {0},{1}", + //m_log.InfoFormat("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region at {0},{1}", // x / Constants.RegionSize, y / Constants.RegionSize); return null; } @@ -238,7 +238,7 @@ namespace OpenSim.Services.Connectors.SimianGrid { List regions = GetRegionsByName(scopeID, regionName, 1); - m_log.Debug("[GRID CONNECTOR]: Got " + regions.Count + " matches for region name " + regionName); + m_log.Debug("[SIMIAN GRID CONNECTOR]: Got " + regions.Count + " matches for region name " + regionName); if (regions.Count > 0) return regions[0]; @@ -349,7 +349,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[GRID CONNECTOR]: Grid service did not find a match for region " + regionID + " during region flags check"); + m_log.Warn("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region " + regionID + " during region flags check"); return -1; } } @@ -374,7 +374,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[GRID CONNECTOR]: Grid service did not find a match for region at " + position); + m_log.Warn("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region at " + position); return null; } } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 67f8e80452..56e74755bb 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -97,14 +97,14 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig gridConfig = source.Configs["InventoryService"]; if (gridConfig == null) { - m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); + m_log.Error("[SIMIAN INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); throw new Exception("Inventory connector init error"); } string serviceUrl = gridConfig.GetString("InventoryServerURI"); if (String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[INVENTORY CONNECTOR]: No Server URI named in section InventoryService"); + m_log.Error("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section InventoryService"); throw new Exception("Inventory connector init error"); } @@ -117,11 +117,11 @@ namespace OpenSim.Services.Connectors.SimianGrid if (!String.IsNullOrEmpty(serviceUrl)) m_userServerUrl = serviceUrl; else - m_log.Info("[INVENTORY CONNECTOR]: No Server URI named in section UserAccountService"); + m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section UserAccountService"); } else { - m_log.Warn("[INVENTORY CONNECTOR]: UserAccountService missing from OpenSim.ini"); + m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: UserAccountService missing from OpenSim.ini"); } } } @@ -143,7 +143,7 @@ namespace OpenSim.Services.Connectors.SimianGrid bool success = response["Success"].AsBoolean(); if (!success) - m_log.Warn("[INVENTORY CONNECTOR]: Inventory creation for " + userID + " failed: " + response["Message"].AsString()); + m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Inventory creation for " + userID + " failed: " + response["Message"].AsString()); return success; } @@ -173,7 +173,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[INVENTORY CONNECTOR]: Failed to retrieve inventory skeleton for " + userID + ": " + + m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Failed to retrieve inventory skeleton for " + userID + ": " + response["Message"].AsString()); return new List(0); } @@ -187,7 +187,7 @@ namespace OpenSim.Services.Connectors.SimianGrid [Obsolete] public InventoryCollection GetUserInventory(UUID userID) { - m_log.Error("[INVENTORY CONNECTOR]: Obsolete GetUserInventory called for " + userID); + m_log.Error("[SIMIAN INVENTORY CONNECTOR]: Obsolete GetUserInventory called for " + userID); InventoryCollection inventory = new InventoryCollection(); inventory.UserID = userID; @@ -206,7 +206,7 @@ namespace OpenSim.Services.Connectors.SimianGrid [Obsolete] public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) { - m_log.Error("[INVENTORY CONNECTOR]: Obsolete GetUserInventory called for " + userID); + m_log.Error("[SIMIAN INVENTORY CONNECTOR]: Obsolete GetUserInventory called for " + userID); callback(new List(0), new List(0)); } @@ -273,7 +273,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[INVENTORY CONNECTOR]: Default folder not found for content type " + contentType); + m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Default folder not found for content type " + contentType + ": " + response["Message"].AsString()); return GetRootFolder(userID); } } @@ -311,7 +311,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } } - m_log.Warn("[INVENTORY CONNECTOR]: Item " + item.ID + " owned by " + item.Owner + " not found"); + m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + item.ID + " owned by " + item.Owner + " not found"); return null; } @@ -376,7 +376,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[INVENTORY CONNECTOR]: Error fetching folder " + folderID + " content for " + userID + ": " + + m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Error fetching folder " + folderID + " content for " + userID + ": " + response["Message"].AsString()); inventory.Folders = new List(0); inventory.Items = new List(0); @@ -414,7 +414,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[INVENTORY CONNECTOR]: Error fetching folder " + folderID + " for " + userID + ": " + + m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Error fetching folder " + folderID + " for " + userID + ": " + response["Message"].AsString()); return new List(0); } @@ -442,7 +442,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (!success) { - m_log.Warn("[INVENTORY CONNECTOR]: Error creating folder " + folder.Name + " for " + folder.Owner + ": " + + m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Error creating folder " + folder.Name + " for " + folder.Owner + ": " + response["Message"].AsString()); } @@ -506,7 +506,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (!success) { - m_log.Warn("[INVENTORY CONNECTOR]: Error removing item " + itemID + " for " + userID + ": " + + m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Error removing item " + itemID + " for " + userID + ": " + response["Message"].AsString()); allSuccess = false; } @@ -534,7 +534,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (!success) { - m_log.Warn("[INVENTORY CONNECTOR]: Error purging folder " + folder.ID + " for " + folder.Owner + ": " + + m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Error purging folder " + folder.ID + " for " + folder.Owner + ": " + response["Message"].AsString()); } @@ -562,7 +562,7 @@ namespace OpenSim.Services.Connectors.SimianGrid UpdateGesture(item.Owner, item.ID, item.Flags == 1); if (item.BasePermissions == 0) - m_log.WarnFormat("[INVENTORY CONNECTOR]: Adding inventory item {0} ({1}) with no base permissions", item.Name, item.ID); + m_log.WarnFormat("[SIMIAN INVENTORY CONNECTOR]: Adding inventory item {0} ({1}) with no base permissions", item.Name, item.ID); OSDMap permissions = new OSDMap { @@ -601,7 +601,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (!success) { - m_log.Warn("[INVENTORY CONNECTOR]: Error creating item " + item.Name + " for " + item.Owner + ": " + + m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Error creating item " + item.Name + " for " + item.Owner + ": " + response["Message"].AsString()); } @@ -785,7 +785,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (invItem.BasePermissions == 0) { - m_log.InfoFormat("[INVENTORY CONNECTOR]: Forcing item permissions to full for item {0} ({1})", + m_log.InfoFormat("[SIMIAN INVENTORY CONNECTOR]: Forcing item permissions to full for item {0} ({1})", invItem.Name, invItem.ID); invItem.BasePermissions = (uint)PermissionMask.All; invItem.CurrentPermissions = (uint)PermissionMask.All; @@ -820,7 +820,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (!success) { - m_log.Warn("[INVENTORY CONNECTOR]: Failed to move " + items.Count + " items to " + + m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Failed to move " + items.Count + " items to " + destFolderID + ": " + response["Message"].AsString()); } @@ -863,12 +863,12 @@ namespace OpenSim.Services.Connectors.SimianGrid if (gestures != null && gestures is OSDArray) return (OSDArray)gestures; else - m_log.Error("[INVENTORY CONNECTOR]: Unrecognized active gestures data for " + userID); + m_log.Error("[SIMIAN INVENTORY CONNECTOR]: Unrecognized active gestures data for " + userID); } } else { - m_log.Warn("[INVENTORY CONNECTOR]: Failed to fetch active gestures for " + userID + ": " + + m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Failed to fetch active gestures for " + userID + ": " + response["Message"].AsString()); } @@ -887,7 +887,7 @@ namespace OpenSim.Services.Connectors.SimianGrid OSDMap response = WebUtil.PostToService(m_userServerUrl, requestArgs); if (!response["Success"].AsBoolean()) { - m_log.Warn("[INVENTORY CONNECTOR]: Failed to save active gestures for " + userID + ": " + + m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Failed to save active gestures for " + userID + ": " + response["Message"].AsString()); } } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index 5e0f7c25e6..696be94ce9 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs @@ -109,14 +109,14 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig gridConfig = source.Configs["PresenceService"]; if (gridConfig == null) { - m_log.Error("[PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini"); + m_log.Error("[SIMIAN PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini"); throw new Exception("Presence connector init error"); } string serviceUrl = gridConfig.GetString("PresenceServerURI"); if (String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[PRESENCE CONNECTOR]: No PresenceServerURI in section PresenceService"); + m_log.Error("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI in section PresenceService"); throw new Exception("Presence connector init error"); } @@ -128,7 +128,7 @@ namespace OpenSim.Services.Connectors.SimianGrid public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID) { - m_log.ErrorFormat("[PRESENCE CONNECTOR]: Login requested, UserID={0}, SessionID={1}, SecureSessionID={2}", + m_log.ErrorFormat("[SIMIAN PRESENCE CONNECTOR]: Login requested, UserID={0}, SessionID={1}, SecureSessionID={2}", userID, sessionID, secureSessionID); NameValueCollection requestArgs = new NameValueCollection @@ -146,14 +146,14 @@ namespace OpenSim.Services.Connectors.SimianGrid bool success = response["Success"].AsBoolean(); if (!success) - m_log.Warn("[PRESENCE CONNECTOR]: Failed to login agent " + userID + ": " + response["Message"].AsString()); + m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to login agent " + userID + ": " + response["Message"].AsString()); return success; } public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookAt) { - m_log.InfoFormat("[PRESENCE CONNECTOR]: Logout requested for agent with sessionID " + sessionID); + m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for agent with sessionID " + sessionID); NameValueCollection requestArgs = new NameValueCollection { @@ -165,14 +165,14 @@ namespace OpenSim.Services.Connectors.SimianGrid bool success = response["Success"].AsBoolean(); if (!success) - m_log.Warn("[PRESENCE CONNECTOR]: Failed to logout agent with sessionID " + sessionID + ": " + response["Message"].AsString()); + m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to logout agent with sessionID " + sessionID + ": " + response["Message"].AsString()); return success; } public bool LogoutRegionAgents(UUID regionID) { - m_log.InfoFormat("[PRESENCE CONNECTOR]: Logout requested for all agents in region " + regionID); + m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for all agents in region " + regionID); NameValueCollection requestArgs = new NameValueCollection { @@ -184,14 +184,14 @@ namespace OpenSim.Services.Connectors.SimianGrid bool success = response["Success"].AsBoolean(); if (!success) - m_log.Warn("[PRESENCE CONNECTOR]: Failed to logout agents from region " + regionID + ": " + response["Message"].AsString()); + m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to logout agents from region " + regionID + ": " + response["Message"].AsString()); return success; } public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) { - //m_log.DebugFormat("[PRESENCE CONNECTOR]: Updating session data for agent with sessionID " + sessionID); + //m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Updating session data for agent with sessionID " + sessionID); NameValueCollection requestArgs = new NameValueCollection { @@ -206,14 +206,14 @@ namespace OpenSim.Services.Connectors.SimianGrid bool success = response["Success"].AsBoolean(); if (!success) - m_log.Warn("[PRESENCE CONNECTOR]: Failed to update agent session " + sessionID + ": " + response["Message"].AsString()); + m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to update agent session " + sessionID + ": " + response["Message"].AsString()); return success; } public PresenceInfo GetAgent(UUID sessionID) { - m_log.DebugFormat("[PRESENCE CONNECTOR]: Requesting session data for agent with sessionID " + sessionID); + m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent with sessionID " + sessionID); NameValueCollection requestArgs = new NameValueCollection { @@ -225,7 +225,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (sessionResponse["Success"].AsBoolean()) { UUID userID = sessionResponse["UserID"].AsUUID(); - m_log.DebugFormat("[PRESENCE CONNECTOR]: Requesting user data for " + userID); + m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID); requestArgs = new NameValueCollection { @@ -237,11 +237,11 @@ namespace OpenSim.Services.Connectors.SimianGrid if (userResponse["Success"].AsBoolean()) return ResponseToPresenceInfo(sessionResponse, userResponse); else - m_log.Warn("[PRESENCE CONNECTOR]: Failed to retrieve user data for " + userID + ": " + userResponse["Message"].AsString()); + m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for " + userID + ": " + userResponse["Message"].AsString()); } else { - m_log.Warn("[PRESENCE CONNECTOR]: Failed to retrieve session " + sessionID + ": " + sessionResponse["Message"].AsString()); + m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session " + sessionID + ": " + sessionResponse["Message"].AsString()); } return null; @@ -263,7 +263,7 @@ namespace OpenSim.Services.Connectors.SimianGrid public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt) { - m_log.DebugFormat("[PRESENCE CONNECTOR]: Setting home location for user " + userID); + m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Setting home location for user " + userID); NameValueCollection requestArgs = new NameValueCollection { @@ -276,7 +276,7 @@ namespace OpenSim.Services.Connectors.SimianGrid bool success = response["Success"].AsBoolean(); if (!success) - m_log.Warn("[PRESENCE CONNECTOR]: Failed to set home location for " + userID + ": " + response["Message"].AsString()); + m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to set home location for " + userID + ": " + response["Message"].AsString()); return success; } @@ -301,7 +301,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private void SignificantClientMovementHandler(IClientAPI client) { ScenePresence sp; - if (client.Scene is Scene && ((Scene)client.Scene).TryGetAvatar(client.AgentId, out sp)) + if (client.Scene is Scene && ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out sp)) ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); } @@ -312,7 +312,7 @@ namespace OpenSim.Services.Connectors.SimianGrid client.OnConnectionClosed -= LogoutHandler; object obj; - if (client.Scene.TryGetAvatar(client.AgentId, out obj) && obj is ScenePresence) + if (client.Scene.TryGetScenePresence(client.AgentId, out obj) && obj is ScenePresence) { // The avatar is still in the scene, we can get the exact logout position ScenePresence sp = (ScenePresence)obj; @@ -335,7 +335,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private OSDMap GetUserData(UUID userID) { - m_log.DebugFormat("[PRESENCE CONNECTOR]: Requesting user data for " + userID); + m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID); NameValueCollection requestArgs = new NameValueCollection { @@ -347,14 +347,14 @@ namespace OpenSim.Services.Connectors.SimianGrid if (response["Success"].AsBoolean() && response["User"] is OSDMap) return response; else - m_log.Warn("[PRESENCE CONNECTOR]: Failed to retrieve user data for " + userID + ": " + response["Message"].AsString()); + m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for " + userID + ": " + response["Message"].AsString()); return null; } private OSDMap GetSessionData(UUID sessionID) { - m_log.DebugFormat("[PRESENCE CONNECTOR]: Requesting session data for session " + sessionID); + m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID); NameValueCollection requestArgs = new NameValueCollection { @@ -366,7 +366,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (response["Success"].AsBoolean()) return response; else - m_log.Warn("[PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID); + m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID); return null; } @@ -378,7 +378,7 @@ namespace OpenSim.Services.Connectors.SimianGrid OSDMap userResponse = GetUserData(userID); if (userResponse != null) { - m_log.DebugFormat("[PRESENCE CONNECTOR]: Requesting sessions for " + userID); + m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting sessions for " + userID); NameValueCollection requestArgs = new NameValueCollection { @@ -395,7 +395,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[PRESENCE CONNECTOR]: Failed to retrieve sessions for " + userID + ": " + response["Message"].AsString()); + m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve sessions for " + userID + ": " + response["Message"].AsString()); } } @@ -428,7 +428,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[PRESENCE CONNECTOR]: Failed to retrieve presence information for session " + sessionID + + m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve presence information for session " + sessionID + " while saving last location: " + response["Message"].AsString()); } @@ -448,7 +448,7 @@ namespace OpenSim.Services.Connectors.SimianGrid bool success = response["Success"].AsBoolean(); if (!success) - m_log.Warn("[PRESENCE CONNECTOR]: Failed to set last location for " + userID + ": " + response["Message"].AsString()); + m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to set last location for " + userID + ": " + response["Message"].AsString()); return success; } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs index 0a36ae5902..fbf4648155 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs @@ -93,14 +93,14 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig gridConfig = source.Configs["UserAccountService"]; if (gridConfig == null) { - m_log.Error("[PROFILES]: UserAccountService missing from OpenSim.ini"); + m_log.Error("[SIMIAN PROFILES]: UserAccountService missing from OpenSim.ini"); throw new Exception("Profiles init error"); } string serviceUrl = gridConfig.GetString("UserAccountServerURI"); if (String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[PROFILES]: No UserAccountServerURI in section UserAccountService"); + m_log.Error("[SIMIAN PROFILES]: No UserAccountServerURI in section UserAccountService"); throw new Exception("Profiles init error"); } @@ -153,7 +153,7 @@ namespace OpenSim.Services.Connectors.SimianGrid UUID targetAvatarID; if (args.Count < 1 || !UUID.TryParse(args[0], out targetAvatarID)) { - m_log.Error("[PROFILES]: Unrecognized arguments for " + method); + m_log.Error("[SIMIAN PROFILES]: Unrecognized arguments for " + method); return; } @@ -193,7 +193,7 @@ namespace OpenSim.Services.Connectors.SimianGrid UUID targetAvatarID; if (args.Count < 1 || !UUID.TryParse(args[0], out targetAvatarID)) { - m_log.Error("[PROFILES]: Unrecognized arguments for " + method); + m_log.Error("[SIMIAN PROFILES]: Unrecognized arguments for " + method); return; } @@ -211,7 +211,7 @@ namespace OpenSim.Services.Connectors.SimianGrid UUID pickID; if (args.Count < 2 || !UUID.TryParse(args[0], out avatarID) || !UUID.TryParse(args[1], out pickID)) { - m_log.Error("[PROFILES]: Unrecognized arguments for " + method); + m_log.Error("[SIMIAN PROFILES]: Unrecognized arguments for " + method); return; } @@ -244,7 +244,7 @@ namespace OpenSim.Services.Connectors.SimianGrid UUID targetAvatarID; if (args.Count < 1 || !UUID.TryParse(args[0], out targetAvatarID)) { - m_log.Error("[PROFILES]: Unrecognized arguments for " + method); + m_log.Error("[SIMIAN PROFILES]: Unrecognized arguments for " + method); return; } @@ -305,7 +305,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[PROFILES]: Failed to fetch profile information for " + client.Name + ", returning default values"); + m_log.Warn("[SIMIAN PROFILES]: Failed to fetch profile information for " + client.Name + ", returning default values"); client.SendAvatarProperties(avatarID, String.Empty, "1/1/1970", Utils.EmptyBytes, String.Empty, (uint)flags, UUID.Zero, UUID.Zero, String.Empty, UUID.Zero); } @@ -342,7 +342,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private void UserInfoRequestHandler(IClientAPI client) { - m_log.Error("[PROFILES]: UserInfoRequestHandler"); + m_log.Error("[SIMIAN PROFILES]: UserInfoRequestHandler"); // Fetch this user's e-mail address NameValueCollection requestArgs = new NameValueCollection @@ -355,14 +355,14 @@ namespace OpenSim.Services.Connectors.SimianGrid string email = response["Email"].AsString(); if (!response["Success"].AsBoolean()) - m_log.Warn("[PROFILES]: GetUser failed during a user info request for " + client.Name); + m_log.Warn("[SIMIAN PROFILES]: GetUser failed during a user info request for " + client.Name); client.SendUserInfoReply(false, true, email); } private void UpdateUserInfoHandler(bool imViaEmail, bool visible, IClientAPI client) { - m_log.Info("[PROFILES]: Ignoring user info update from " + client.Name); + m_log.Info("[SIMIAN PROFILES]: Ignoring user info update from " + client.Name); } #endregion Profiles @@ -380,7 +380,7 @@ namespace OpenSim.Services.Connectors.SimianGrid UserAccount admin = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, UUID.Zero); if (admin != null) { - m_log.InfoFormat("[PROFILES]: Setting estate {0} (ID: {1}) owner to {2}", estate.EstateName, + m_log.InfoFormat("[SIMIAN PROFILES]: Setting estate {0} (ID: {1}) owner to {2}", estate.EstateName, estate.EstateID, admin.Name); estate.EstateOwner = admin.PrincipalID; @@ -388,7 +388,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.WarnFormat("[PROFILES]: Estate {0} (ID: {1}) does not have an owner", estate.EstateName, estate.EstateID); + m_log.WarnFormat("[SIMIAN PROFILES]: Estate {0} (ID: {1}) does not have an owner", estate.EstateName, estate.EstateID); } } } @@ -406,7 +406,7 @@ namespace OpenSim.Services.Connectors.SimianGrid bool success = response["Success"].AsBoolean(); if (!success) - m_log.WarnFormat("[PROFILES]: Failed to add user data with key {0} for {1}: {2}", key, userID, response["Message"].AsString()); + m_log.WarnFormat("[SIMIAN PROFILES]: Failed to add user data with key {0} for {1}: {2}", key, userID, response["Message"].AsString()); return success; } @@ -426,7 +426,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Error("[PROFILES]: Failed to fetch user data for " + userID + ": " + response["Message"].AsString()); + m_log.Error("[SIMIAN PROFILES]: Failed to fetch user data for " + userID + ": " + response["Message"].AsString()); } return null; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 491a9a25d8..874f1a2fdd 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -82,14 +82,14 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig assetConfig = source.Configs["UserAccountService"]; if (assetConfig == null) { - m_log.Error("[ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini"); + m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini"); throw new Exception("User account connector init error"); } string serviceURI = assetConfig.GetString("UserAccountServerURI"); if (String.IsNullOrEmpty(serviceURI)) { - m_log.Error("[ACCOUNT CONNECTOR]: No UserAccountServerURI in section UserAccountService, skipping SimianUserAccountServiceConnector"); + m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI in section UserAccountService, skipping SimianUserAccountServiceConnector"); throw new Exception("User account connector init error"); } @@ -140,7 +140,7 @@ namespace OpenSim.Services.Connectors.SimianGrid { List accounts = new List(); - m_log.DebugFormat("[ACCOUNT CONNECTOR]: Searching for user accounts with name query " + query); + m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Searching for user accounts with name query " + query); NameValueCollection requestArgs = new NameValueCollection { @@ -163,12 +163,12 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[ACCOUNT CONNECTOR]: Account search failed, response data was in an invalid format"); + m_log.Warn("[SIMIAN ACCOUNT CONNECTOR]: Account search failed, response data was in an invalid format"); } } else { - m_log.Warn("[ACCOUNT CONNECTOR]: Failed to search for account data by name " + query); + m_log.Warn("[SIMIAN ACCOUNT CONNECTOR]: Failed to search for account data by name " + query); } return accounts; @@ -176,7 +176,7 @@ namespace OpenSim.Services.Connectors.SimianGrid public bool StoreUserAccount(UserAccount data) { - m_log.InfoFormat("[ACCOUNT CONNECTOR]: Storing user account for " + data.Name); + m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name); NameValueCollection requestArgs = new NameValueCollection { @@ -191,7 +191,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (response["Success"].AsBoolean()) { - m_log.InfoFormat("[ACCOUNT CONNECTOR]: Storing user account data for " + data.Name); + m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account data for " + data.Name); requestArgs = new NameValueCollection { @@ -212,14 +212,14 @@ namespace OpenSim.Services.Connectors.SimianGrid } else { - m_log.Warn("[ACCOUNT CONNECTOR]: Failed to store user account data for " + data.Name + ": " + response["Message"].AsString()); + m_log.Warn("[SIMIAN ACCOUNT CONNECTOR]: Failed to store user account data for " + data.Name + ": " + response["Message"].AsString()); } return success; } else { - m_log.Warn("[ACCOUNT CONNECTOR]: Failed to store user account for " + data.Name + ": " + response["Message"].AsString()); + m_log.Warn("[SIMIAN ACCOUNT CONNECTOR]: Failed to store user account for " + data.Name + ": " + response["Message"].AsString()); } return false; @@ -233,7 +233,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private UserAccount GetUser(NameValueCollection requestArgs) { string lookupValue = (requestArgs.Count > 1) ? requestArgs[1] : "(Unknown)"; - m_log.DebugFormat("[ACCOUNT CONNECTOR]: Looking up user account with query: " + lookupValue); + m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Looking up user account with query: " + lookupValue); OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); if (response["Success"].AsBoolean()) @@ -242,11 +242,11 @@ namespace OpenSim.Services.Connectors.SimianGrid if (user != null) return ResponseToUserAccount(user); else - m_log.Warn("[ACCOUNT CONNECTOR]: Account search failed, response data was in an invalid format"); + m_log.Warn("[SIMIAN ACCOUNT CONNECTOR]: Account search failed, response data was in an invalid format"); } else { - m_log.Warn("[ACCOUNT CONNECTOR]: Failed to lookup user account with query: " + lookupValue); + m_log.Warn("[SIMIAN ACCOUNT CONNECTOR]: Failed to lookup user account with query: " + lookupValue); } return null; diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs index a45bf8c79b..befd14e02a 100644 --- a/OpenSim/Services/Interfaces/IUserAccountService.cs +++ b/OpenSim/Services/Interfaces/IUserAccountService.cs @@ -150,10 +150,10 @@ namespace OpenSim.Services.Interfaces List GetUserAccounts(UUID scopeID, string query); /// - /// Store the data given, wich replaces the sotred data, therefore must be complete. + /// Store the data given, wich replaces the stored data, therefore must be complete. /// /// /// bool StoreUserAccount(UserAccount data); } -} \ No newline at end of file +} diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 1eaf4d4158..7b25274b47 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -339,9 +339,16 @@ namespace OpenSim.Services.LLLoginService where = "safe"; } else - m_log.WarnFormat( - "[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations.", + { + m_log.WarnFormat("[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations. Attempting to find random region", account.FirstName, account.LastName); + defaults = m_GridService.GetRegionsByName(account.ScopeID, "", 1); + if (defaults != null && defaults.Count > 0) + { + region = defaults[0]; + where = "safe"; + } + } } return region; @@ -364,6 +371,17 @@ namespace OpenSim.Services.LLLoginService region = defaults[0]; where = "safe"; } + else + { + m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); + defaults = m_GridService.GetRegionsByName(account.ScopeID, "", 1); + if (defaults != null && defaults.Count > 0) + { + region = defaults[0]; + where = "safe"; + } + } + } else { @@ -396,7 +414,6 @@ namespace OpenSim.Services.LLLoginService { if (!regionName.Contains("@")) { - List regions = m_GridService.GetRegionsByName(account.ScopeID, regionName, 1); if ((regions == null) || (regions != null && regions.Count == 0)) { @@ -429,6 +446,7 @@ namespace OpenSim.Services.LLLoginService return null; } // Valid specification of a remote grid + regionName = parts[0]; string domainLocator = parts[1]; parts = domainLocator.Split(new char[] {':'}); @@ -436,6 +454,7 @@ namespace OpenSim.Services.LLLoginService uint port = 0; if (parts.Length > 1) UInt32.TryParse(parts[1], out port); + GridRegion region = FindForeignRegion(domainName, port, regionName, out gatekeeper); return region; } diff --git a/bin/Mono.Security.dll b/bin/Mono.Security.dll deleted file mode 100644 index c027c19f73..0000000000 Binary files a/bin/Mono.Security.dll and /dev/null differ diff --git a/bin/OpenMetaverse.Http.dll b/bin/OpenMetaverse.Http.dll deleted file mode 100644 index dbbe4d30bd..0000000000 Binary files a/bin/OpenMetaverse.Http.dll and /dev/null differ diff --git a/bin/OpenMetaverse.StructuredData.dll b/bin/OpenMetaverse.StructuredData.dll index 0e571d83f9..f4992a21ea 100644 Binary files a/bin/OpenMetaverse.StructuredData.dll and b/bin/OpenMetaverse.StructuredData.dll differ diff --git a/bin/OpenMetaverse.dll b/bin/OpenMetaverse.dll index a35b5aea3f..8751bfc71e 100644 Binary files a/bin/OpenMetaverse.dll and b/bin/OpenMetaverse.dll differ diff --git a/bin/OpenMetaverseTypes.dll b/bin/OpenMetaverseTypes.dll index c5efaf4baa..6c6440ea5b 100644 Binary files a/bin/OpenMetaverseTypes.dll and b/bin/OpenMetaverseTypes.dll differ