aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/IAssetData.cs11
-rw-r--r--OpenSim/Data/IInventoryData.cs11
-rw-r--r--OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs6
-rw-r--r--OpenSim/Data/MySQL/MySQLLegacyRegionData.cs8
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs3
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs3
-rw-r--r--OpenSim/Framework/LandData.cs14
-rw-r--r--OpenSim/Framework/SLUtil.cs10
-rw-r--r--OpenSim/Framework/Serialization/External/LandDataSerializer.cs5
-rw-r--r--OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs109
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs2
-rw-r--r--OpenSim/Framework/TaskInventoryItem.cs10
-rw-r--r--OpenSim/Framework/Util.cs18
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs12
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs17
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs428
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs15
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs2
-rw-r--r--OpenSim/Region/DataSnapshot/LandSnapshot.cs7
-rw-r--r--OpenSim/Region/DataSnapshot/ObjectSnapshot.cs3
-rw-r--r--OpenSim/Region/Framework/Interfaces/IDwellModule.cs37
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/EntityBase.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/EntityManager.cs206
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs30
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs84
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs304
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs58
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneViewer.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs83
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs10
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs2
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs2
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs2
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs79
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs26
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs4
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs19
-rw-r--r--OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs23
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs75
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs43
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs13
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs55
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs19
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs22
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs20
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs27
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs27
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs74
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs16
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs38
-rw-r--r--OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs203
-rw-r--r--OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs2
-rw-r--r--OpenSim/Tests/Common/Mock/TestScene.cs8
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs2
-rw-r--r--OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs2
-rw-r--r--bin/Robust.HG.ini.example6
-rw-r--r--bin/config-include/HyperSimianGrid.ini12
-rw-r--r--bin/config-include/SimianGrid.ini16
84 files changed, 1501 insertions, 1046 deletions
diff --git a/OpenSim/Data/IAssetData.cs b/OpenSim/Data/IAssetData.cs
index 90d5eeb..f31b215c 100644
--- a/OpenSim/Data/IAssetData.cs
+++ b/OpenSim/Data/IAssetData.cs
@@ -40,15 +40,4 @@ namespace OpenSim.Data
40 void Initialise(string connect); 40 void Initialise(string connect);
41 bool Delete(string id); 41 bool Delete(string id);
42 } 42 }
43
44 public class AssetDataInitialiser : PluginInitialiserBase
45 {
46 private string connect;
47 public AssetDataInitialiser (string s) { connect = s; }
48 public override void Initialise (IPlugin plugin)
49 {
50 IAssetDataPlugin p = plugin as IAssetDataPlugin;
51 p.Initialise (connect);
52 }
53 }
54} 43}
diff --git a/OpenSim/Data/IInventoryData.cs b/OpenSim/Data/IInventoryData.cs
index 90f74b7..74d5d37 100644
--- a/OpenSim/Data/IInventoryData.cs
+++ b/OpenSim/Data/IInventoryData.cs
@@ -155,15 +155,4 @@ namespace OpenSim.Data
155 /// </returns> 155 /// </returns>
156 List<InventoryItemBase> fetchActiveGestures(UUID avatarID); 156 List<InventoryItemBase> fetchActiveGestures(UUID avatarID);
157 } 157 }
158
159 public class InventoryDataInitialiser : PluginInitialiserBase
160 {
161 private string connect;
162 public InventoryDataInitialiser (string s) { connect = s; }
163 public override void Initialise (IPlugin plugin)
164 {
165 IInventoryDataPlugin p = plugin as IInventoryDataPlugin;
166 p.Initialise (connect);
167 }
168 }
169} 158}
diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
index 7ff8737..77b8a10 100644
--- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
@@ -638,9 +638,9 @@ ELSE
638 638
639 //Insert new values 639 //Insert new values
640 string sql = @"INSERT INTO [land] 640 string sql = @"INSERT INTO [land]
641([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime],[Dwell]) 641([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime])
642VALUES 642VALUES
643(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime,@Dwell)"; 643(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime)";
644 644
645 using (SqlConnection conn = new SqlConnection(m_connectionString)) 645 using (SqlConnection conn = new SqlConnection(m_connectionString))
646 using (SqlCommand cmd = new SqlCommand(sql, conn)) 646 using (SqlCommand cmd = new SqlCommand(sql, conn))
@@ -954,7 +954,6 @@ VALUES
954 newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); 954 newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]);
955 955
956 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); 956 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
957 newData.Dwell = Convert.ToInt32(row["Dwell"]);
958 957
959 try 958 try
960 { 959 {
@@ -1357,7 +1356,6 @@ VALUES
1357 parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z)); 1356 parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z));
1358 parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID)); 1357 parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID));
1359 parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime)); 1358 parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime));
1360 parameters.Add(_Database.CreateParameter("Dwell", land.Dwell));
1361 1359
1362 return parameters.ToArray(); 1360 return parameters.ToArray();
1363 } 1361 }
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
index 04446ce..a39e68d 100644
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
@@ -247,6 +247,8 @@ namespace OpenSim.Data.MySQL
247 247
248 public void RemoveObject(UUID obj, UUID regionUUID) 248 public void RemoveObject(UUID obj, UUID regionUUID)
249 { 249 {
250// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID);
251
250 List<UUID> uuids = new List<UUID>(); 252 List<UUID> uuids = new List<UUID>();
251 253
252 // Formerly, this used to check the region UUID. 254 // Formerly, this used to check the region UUID.
@@ -677,7 +679,7 @@ namespace OpenSim.Data.MySQL
677 "MusicURL, PassHours, PassPrice, SnapshotUUID, " + 679 "MusicURL, PassHours, PassPrice, SnapshotUUID, " +
678 "UserLocationX, UserLocationY, UserLocationZ, " + 680 "UserLocationX, UserLocationY, UserLocationZ, " +
679 "UserLookAtX, UserLookAtY, UserLookAtZ, " + 681 "UserLookAtX, UserLookAtY, UserLookAtZ, " +
680 "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + 682 "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " +
681 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + 683 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
682 "?UUID, ?RegionUUID, " + 684 "?UUID, ?RegionUUID, " +
683 "?LocalLandID, ?Bitmap, ?Name, ?Description, " + 685 "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
@@ -688,7 +690,7 @@ namespace OpenSim.Data.MySQL
688 "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " + 690 "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " +
689 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + 691 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
690 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + 692 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
691 "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ 693 "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+
692 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; 694 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
693 695
694 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); 696 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
@@ -1329,7 +1331,6 @@ namespace OpenSim.Data.MySQL
1329 UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer); 1331 UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer);
1330 UUID.TryParse((string)row["SnapshotUUID"], out snapshotID); 1332 UUID.TryParse((string)row["SnapshotUUID"], out snapshotID);
1331 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); 1333 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
1332 newData.Dwell = Convert.ToInt32(row["Dwell"]);
1333 1334
1334 newData.AuthBuyerID = authedbuyer; 1335 newData.AuthBuyerID = authedbuyer;
1335 newData.SnapshotID = snapshotID; 1336 newData.SnapshotID = snapshotID;
@@ -1660,7 +1661,6 @@ namespace OpenSim.Data.MySQL
1660 cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z); 1661 cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z);
1661 cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID); 1662 cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID);
1662 cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime); 1663 cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime);
1663 cmd.Parameters.AddWithValue("Dwell", land.Dwell);
1664 cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription); 1664 cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription);
1665 cmd.Parameters.AddWithValue("MediaType", land.MediaType); 1665 cmd.Parameters.AddWithValue("MediaType", land.MediaType);
1666 cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth); 1666 cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth);
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 8432e74..88699a7 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -1111,7 +1111,6 @@ namespace OpenSim.Data.SQLite
1111 createCol(land, "UserLookAtZ", typeof (Double)); 1111 createCol(land, "UserLookAtZ", typeof (Double));
1112 createCol(land, "AuthbuyerID", typeof(String)); 1112 createCol(land, "AuthbuyerID", typeof(String));
1113 createCol(land, "OtherCleanTime", typeof(Int32)); 1113 createCol(land, "OtherCleanTime", typeof(Int32));
1114 createCol(land, "Dwell", typeof(Int32));
1115 1114
1116 land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; 1115 land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
1117 1116
@@ -1449,7 +1448,6 @@ namespace OpenSim.Data.SQLite
1449 UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); 1448 UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
1450 1449
1451 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); 1450 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
1452 newData.Dwell = Convert.ToInt32(row["Dwell"]);
1453 1451
1454 return newData; 1452 return newData;
1455 } 1453 }
@@ -1761,7 +1759,6 @@ namespace OpenSim.Data.SQLite
1761 row["UserLookAtZ"] = land.UserLookAt.Z; 1759 row["UserLookAtZ"] = land.UserLookAt.Z;
1762 row["AuthbuyerID"] = land.AuthBuyerID.ToString(); 1760 row["AuthbuyerID"] = land.AuthBuyerID.ToString();
1763 row["OtherCleanTime"] = land.OtherCleanTime; 1761 row["OtherCleanTime"] = land.OtherCleanTime;
1764 row["Dwell"] = land.Dwell;
1765 row["MediaType"] = land.MediaType; 1762 row["MediaType"] = land.MediaType;
1766 row["MediaDescription"] = land.MediaDescription; 1763 row["MediaDescription"] = land.MediaDescription;
1767 row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); 1764 row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
index 289fd94..b5ce4c0 100644
--- a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
@@ -1069,7 +1069,6 @@ namespace OpenSim.Data.SQLiteLegacy
1069 createCol(land, "UserLookAtZ", typeof (Double)); 1069 createCol(land, "UserLookAtZ", typeof (Double));
1070 createCol(land, "AuthbuyerID", typeof(String)); 1070 createCol(land, "AuthbuyerID", typeof(String));
1071 createCol(land, "OtherCleanTime", typeof(Int32)); 1071 createCol(land, "OtherCleanTime", typeof(Int32));
1072 createCol(land, "Dwell", typeof(Int32));
1073 1072
1074 land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; 1073 land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
1075 1074
@@ -1400,7 +1399,6 @@ namespace OpenSim.Data.SQLiteLegacy
1400 UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); 1399 UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
1401 1400
1402 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); 1401 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
1403 newData.Dwell = Convert.ToInt32(row["Dwell"]);
1404 1402
1405 return newData; 1403 return newData;
1406 } 1404 }
@@ -1711,7 +1709,6 @@ namespace OpenSim.Data.SQLiteLegacy
1711 row["UserLookAtZ"] = land.UserLookAt.Z; 1709 row["UserLookAtZ"] = land.UserLookAt.Z;
1712 row["AuthbuyerID"] = land.AuthBuyerID.ToString(); 1710 row["AuthbuyerID"] = land.AuthBuyerID.ToString();
1713 row["OtherCleanTime"] = land.OtherCleanTime; 1711 row["OtherCleanTime"] = land.OtherCleanTime;
1714 row["Dwell"] = land.Dwell;
1715 } 1712 }
1716 1713
1717 /// <summary> 1714 /// <summary>
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs
index f263e67..8d3266b 100644
--- a/OpenSim/Framework/LandData.cs
+++ b/OpenSim/Framework/LandData.cs
@@ -88,7 +88,6 @@ namespace OpenSim.Framework
88 private UUID _snapshotID = UUID.Zero; 88 private UUID _snapshotID = UUID.Zero;
89 private Vector3 _userLocation = new Vector3(); 89 private Vector3 _userLocation = new Vector3();
90 private Vector3 _userLookAt = new Vector3(); 90 private Vector3 _userLookAt = new Vector3();
91 private int _dwell = 0;
92 private int _otherCleanTime = 0; 91 private int _otherCleanTime = 0;
93 private string _mediaType = "none/none"; 92 private string _mediaType = "none/none";
94 private string _mediaDescription = ""; 93 private string _mediaDescription = "";
@@ -620,18 +619,6 @@ namespace OpenSim.Framework
620 } 619 }
621 620
622 /// <summary> 621 /// <summary>
623 /// Deprecated idea. Number of visitors ~= free money
624 /// </summary>
625 public int Dwell {
626 get {
627 return _dwell;
628 }
629 set {
630 _dwell = value;
631 }
632 }
633
634 /// <summary>
635 /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own 622 /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own
636 /// the parcel and isn't set to the same 'group' as the parcel. 623 /// the parcel and isn't set to the same 'group' as the parcel.
637 /// </summary> 624 /// </summary>
@@ -703,7 +690,6 @@ namespace OpenSim.Framework
703 landData._userLocation = _userLocation; 690 landData._userLocation = _userLocation;
704 landData._userLookAt = _userLookAt; 691 landData._userLookAt = _userLookAt;
705 landData._otherCleanTime = _otherCleanTime; 692 landData._otherCleanTime = _otherCleanTime;
706 landData._dwell = _dwell;
707 landData._mediaType = _mediaType; 693 landData._mediaType = _mediaType;
708 landData._mediaDescription = _mediaDescription; 694 landData._mediaDescription = _mediaDescription;
709 landData._mediaWidth = _mediaWidth; 695 landData._mediaWidth = _mediaWidth;
diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs
index a489806..9941a7f 100644
--- a/OpenSim/Framework/SLUtil.cs
+++ b/OpenSim/Framework/SLUtil.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Framework
46 case AssetType.Texture: 46 case AssetType.Texture:
47 return "image/x-j2c"; 47 return "image/x-j2c";
48 case AssetType.Sound: 48 case AssetType.Sound:
49 return "application/ogg"; 49 return "audio/ogg";
50 case AssetType.CallingCard: 50 case AssetType.CallingCard:
51 return "application/vnd.ll.callingcard"; 51 return "application/vnd.ll.callingcard";
52 case AssetType.Landmark: 52 case AssetType.Landmark:
@@ -98,8 +98,6 @@ namespace OpenSim.Framework
98 return "application/vnd.ll.outfitfolder"; 98 return "application/vnd.ll.outfitfolder";
99 case AssetType.MyOutfitsFolder: 99 case AssetType.MyOutfitsFolder:
100 return "application/vnd.ll.myoutfitsfolder"; 100 return "application/vnd.ll.myoutfitsfolder";
101 case AssetType.InboxFolder:
102 return "application/vnd.ll.inboxfolder";
103 case AssetType.Unknown: 101 case AssetType.Unknown:
104 default: 102 default:
105 return "application/octet-stream"; 103 return "application/octet-stream";
@@ -128,7 +126,7 @@ namespace OpenSim.Framework
128 case InventoryType.Object: 126 case InventoryType.Object:
129 return "application/vnd.ll.primitive"; 127 return "application/vnd.ll.primitive";
130 case InventoryType.Sound: 128 case InventoryType.Sound:
131 return "application/ogg"; 129 return "audio/ogg";
132 case InventoryType.Snapshot: 130 case InventoryType.Snapshot:
133 case InventoryType.Texture: 131 case InventoryType.Texture:
134 return "image/x-j2c"; 132 return "image/x-j2c";
@@ -147,6 +145,7 @@ namespace OpenSim.Framework
147 case "image/jp2": 145 case "image/jp2":
148 return (sbyte)AssetType.Texture; 146 return (sbyte)AssetType.Texture;
149 case "application/ogg": 147 case "application/ogg":
148 case "audio/ogg":
150 return (sbyte)AssetType.Sound; 149 return (sbyte)AssetType.Sound;
151 case "application/vnd.ll.callingcard": 150 case "application/vnd.ll.callingcard":
152 case "application/x-metaverse-callingcard": 151 case "application/x-metaverse-callingcard":
@@ -209,8 +208,6 @@ namespace OpenSim.Framework
209 return (sbyte)AssetType.OutfitFolder; 208 return (sbyte)AssetType.OutfitFolder;
210 case "application/vnd.ll.myoutfitsfolder": 209 case "application/vnd.ll.myoutfitsfolder":
211 return (sbyte)AssetType.MyOutfitsFolder; 210 return (sbyte)AssetType.MyOutfitsFolder;
212 case "application/vnd.ll.inboxfolder":
213 return (sbyte)AssetType.InboxFolder;
214 case "application/octet-stream": 211 case "application/octet-stream":
215 default: 212 default:
216 return (sbyte)AssetType.Unknown; 213 return (sbyte)AssetType.Unknown;
@@ -227,6 +224,7 @@ namespace OpenSim.Framework
227 case "image/jpeg": 224 case "image/jpeg":
228 return (sbyte)InventoryType.Texture; 225 return (sbyte)InventoryType.Texture;
229 case "application/ogg": 226 case "application/ogg":
227 case "audio/ogg":
230 case "audio/x-wav": 228 case "audio/x-wav":
231 return (sbyte)InventoryType.Sound; 229 return (sbyte)InventoryType.Sound;
232 case "application/vnd.ll.callingcard": 230 case "application/vnd.ll.callingcard":
diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
index ff0afc8..fc0387b 100644
--- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
@@ -118,7 +118,8 @@ namespace OpenSim.Framework.Serialization.External
118 landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID")); 118 landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID"));
119 landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation")); 119 landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation"));
120 landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt")); 120 landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt"));
121 landData.Dwell = Convert.ToInt32( xtr.ReadElementString("Dwell")); 121 // No longer used here
122 xtr.ReadElementString("Dwell");
122 landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime")); 123 landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime"));
123 124
124 xtr.ReadEndElement(); 125 xtr.ReadEndElement();
@@ -177,7 +178,7 @@ namespace OpenSim.Framework.Serialization.External
177 xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString()); 178 xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString());
178 xtw.WriteElementString("UserLocation", landData.UserLocation.ToString()); 179 xtw.WriteElementString("UserLocation", landData.UserLocation.ToString());
179 xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString()); 180 xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString());
180 xtw.WriteElementString("Dwell", Convert.ToString(landData.Dwell)); 181 xtw.WriteElementString("Dwell", "0");
181 xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime)); 182 xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime));
182 183
183 xtw.WriteEndElement(); 184 xtw.WriteEndElement();
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
index b2c1c54..41ece86 100644
--- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
+++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
@@ -57,80 +57,73 @@ namespace OpenSim.Framework.Servers.HttpServer
57 { 57 {
58 WebRequest request = WebRequest.Create(requestUrl); 58 WebRequest request = WebRequest.Create(requestUrl);
59 request.Method = verb; 59 request.Method = verb;
60 string respstring = String.Empty;
60 61
61 if ((verb == "POST") || (verb == "PUT")) 62 using (MemoryStream buffer = new MemoryStream())
62 { 63 {
63 request.ContentType = "text/www-form-urlencoded"; 64 if ((verb == "POST") || (verb == "PUT"))
64
65 MemoryStream buffer = new MemoryStream();
66 int length = 0;
67 using (StreamWriter writer = new StreamWriter(buffer))
68 { 65 {
69 writer.Write(obj); 66 request.ContentType = "text/www-form-urlencoded";
70 writer.Flush();
71 }
72 67
73 length = (int)obj.Length; 68 int length = 0;
74 request.ContentLength = length; 69 using (StreamWriter writer = new StreamWriter(buffer))
70 {
71 writer.Write(obj);
72 writer.Flush();
73 }
75 74
76 Stream requestStream = null; 75 length = (int)obj.Length;
77 try 76 request.ContentLength = length;
78 {
79 requestStream = request.GetRequestStream();
80 requestStream.Write(buffer.ToArray(), 0, length);
81 }
82 catch (Exception e)
83 {
84 m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl);
85 }
86 finally
87 {
88 // If this is closed, it will be disposed internally,
89 // but the above write is asynchronous and may hit after
90 // we're through here. So the thread handling that will
91 // throw and put us back into the catch above. Isn't
92 // .NET great?
93 //if (requestStream != null)
94 // requestStream.Close();
95 // Let's not close this
96 //buffer.Close();
97 77
78 Stream requestStream = null;
79 try
80 {
81 requestStream = request.GetRequestStream();
82 requestStream.Write(buffer.ToArray(), 0, length);
83 }
84 catch (Exception e)
85 {
86 m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl);
87 }
88 finally
89 {
90 if (requestStream != null)
91 requestStream.Close();
92 }
98 } 93 }
99 }
100
101 string respstring = String.Empty;
102 94
103 try 95 try
104 {
105 using (WebResponse resp = request.GetResponse())
106 { 96 {
107 if (resp.ContentLength > 0) 97 using (WebResponse resp = request.GetResponse())
108 { 98 {
109 Stream respStream = null; 99 if (resp.ContentLength != 0)
110 try
111 { 100 {
112 respStream = resp.GetResponseStream(); 101 Stream respStream = null;
113 using (StreamReader reader = new StreamReader(respStream)) 102 try
114 { 103 {
115 respstring = reader.ReadToEnd(); 104 respStream = resp.GetResponseStream();
105 using (StreamReader reader = new StreamReader(respStream))
106 {
107 respstring = reader.ReadToEnd();
108 }
109 }
110 catch (Exception e)
111 {
112 m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString());
113 }
114 finally
115 {
116 if (respStream != null)
117 respStream.Close();
116 } 118 }
117 }
118 catch (Exception e)
119 {
120 m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString());
121 }
122 finally
123 {
124 if (respStream != null)
125 respStream.Close();
126 } 119 }
127 } 120 }
128 } 121 }
129 } 122 catch (System.InvalidOperationException)
130 catch (System.InvalidOperationException) 123 {
131 { 124 // This is what happens when there is invalid XML
132 // This is what happens when there is invalid XML 125 m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request");
133 m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); 126 }
134 } 127 }
135 return respstring; 128 return respstring;
136 } 129 }
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index 100bf1f..c88e0d1 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -49,7 +49,7 @@ namespace OpenSim
49 49
50 public static string GetVersionString(string versionNumber, Flavour flavour) 50 public static string GetVersionString(string versionNumber, Flavour flavour)
51 { 51 {
52 string versionString = "OpenSim " + versionNumber + " (" + flavour + ")"; 52 string versionString = "OpenSim " + versionNumber + " " + flavour;
53 return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); 53 return versionString.PadRight(VERSIONINFO_VERSION_LENGTH);
54 } 54 }
55 55
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs
index 2cb7895..df5b936 100644
--- a/OpenSim/Framework/TaskInventoryItem.cs
+++ b/OpenSim/Framework/TaskInventoryItem.cs
@@ -348,15 +348,15 @@ namespace OpenSim.Framework
348 /// <param name="partID">The new part ID to which this item belongs</param> 348 /// <param name="partID">The new part ID to which this item belongs</param>
349 public void ResetIDs(UUID partID) 349 public void ResetIDs(UUID partID)
350 { 350 {
351 _oldID = _itemID; 351 OldItemID = ItemID;
352 _itemID = UUID.Random(); 352 ItemID = UUID.Random();
353 _parentPartID = partID; 353 ParentPartID = partID;
354 _parentID = partID; 354 ParentID = partID;
355 } 355 }
356 356
357 public TaskInventoryItem() 357 public TaskInventoryItem()
358 { 358 {
359 _creationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 359 CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
360 } 360 }
361 } 361 }
362} 362}
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 2ac4eb1..e7a7f49 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1521,7 +1521,23 @@ namespace OpenSim.Framework
1521 return null; 1521 return null;
1522 } 1522 }
1523 1523
1524 1524 public static string GetCallerIP(Hashtable req)
1525 {
1526 if (req.ContainsKey("headers"))
1527 {
1528 try
1529 {
1530 Hashtable headers = (Hashtable)req["headers"];
1531 if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null)
1532 return headers["remote_addr"].ToString();
1533 }
1534 catch (Exception e)
1535 {
1536 m_log.WarnFormat("[UTIL]: exception in GetCallerIP: {0}", e.Message);
1537 }
1538 }
1539 return string.Empty;
1540 }
1525 1541
1526 } 1542 }
1527} 1543}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 3d4269f..cdf8cb1 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2668,6 +2668,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2668 2668
2669 public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y) 2669 public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y)
2670 { 2670 {
2671 float dwell = 0.0f;
2672 IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
2673 if (dwellModule != null)
2674 dwell = dwellModule.GetDwell(land.GlobalID);
2671 ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); 2675 ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply);
2672 reply.AgentData.AgentID = m_agentId; 2676 reply.AgentData.AgentID = m_agentId;
2673 reply.Data.ParcelID = parcelID; 2677 reply.Data.ParcelID = parcelID;
@@ -2692,7 +2696,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2692 reply.Data.GlobalZ = pos.Z; 2696 reply.Data.GlobalZ = pos.Z;
2693 reply.Data.SimName = Utils.StringToBytes(info.RegionName); 2697 reply.Data.SimName = Utils.StringToBytes(info.RegionName);
2694 reply.Data.SnapshotID = land.SnapshotID; 2698 reply.Data.SnapshotID = land.SnapshotID;
2695 reply.Data.Dwell = land.Dwell; 2699 reply.Data.Dwell = dwell;
2696 reply.Data.SalePrice = land.SalePrice; 2700 reply.Data.SalePrice = land.SalePrice;
2697 reply.Data.AuctionID = (int)land.AuctionID; 2701 reply.Data.AuctionID = (int)land.AuctionID;
2698 2702
@@ -3525,9 +3529,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3525 3529
3526 private void ProcessEntityUpdates(int maxUpdates) 3530 private void ProcessEntityUpdates(int maxUpdates)
3527 { 3531 {
3528 Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); 3532 OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
3529 Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); 3533 OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>();
3530 Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); 3534 OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
3531 3535
3532 if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; 3536 if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
3533 int updatesThisCall = 0; 3537 int updatesThisCall = 0;
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 6555b54..7270304 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -264,8 +264,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
264 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) 264 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
265 tainted = true; 265 tainted = true;
266 266
267 AttachObject(remoteClient, objatt, AttachmentPt, false); 267 // This will throw if the attachment fails
268 //objatt.ScheduleGroupForFullUpdate(); 268 try
269 {
270 AttachObject(remoteClient, objatt, AttachmentPt, false);
271 }
272 catch
273 {
274 // Make sure the object doesn't stick around and bail
275 m_scene.DeleteSceneObject(objatt, false);
276 return null;
277 }
269 278
270 if (tainted) 279 if (tainted)
271 objatt.HasGroupChanged = true; 280 objatt.HasGroupChanged = true;
@@ -427,7 +436,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
427 436
428 // We can NOT use the dictionries here, as we are looking 437 // We can NOT use the dictionries here, as we are looking
429 // for an entity by the fromAssetID, which is NOT the prim UUID 438 // for an entity by the fromAssetID, which is NOT the prim UUID
430 List<EntityBase> detachEntities = m_scene.GetEntities(); 439 EntityBase[] detachEntities = m_scene.GetEntities();
431 SceneObjectGroup group; 440 SceneObjectGroup group;
432 441
433 foreach (EntityBase entity in detachEntities) 442 foreach (EntityBase entity in detachEntities)
@@ -594,4 +603,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
594 so.HasGroupChanged = false; 603 so.HasGroupChanged = false;
595 } 604 }
596 } 605 }
597} \ No newline at end of file 606}
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 6f044cb..4e4eee9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -54,7 +54,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
54 public UUID PrincipalID; 54 public UUID PrincipalID;
55 public FriendInfo[] Friends; 55 public FriendInfo[] Friends;
56 public int Refcount; 56 public int Refcount;
57 public UUID RegionID;
58 57
59 public bool IsFriend(string friend) 58 public bool IsFriend(string friend)
60 { 59 {
@@ -67,7 +66,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
67 return false; 66 return false;
68 } 67 }
69 } 68 }
70 69
70 private static readonly FriendInfo[] EMPTY_FRIENDS = new FriendInfo[0];
71 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 71 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
72 72
73 protected List<Scene> m_Scenes = new List<Scene>(); 73 protected List<Scene> m_Scenes = new List<Scene>();
@@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
79 protected Dictionary<UUID, UserFriendData> m_Friends = 79 protected Dictionary<UUID, UserFriendData> m_Friends =
80 new Dictionary<UUID, UserFriendData>(); 80 new Dictionary<UUID, UserFriendData>();
81 81
82 protected List<UUID> m_NeedsListOfFriends = new List<UUID>(); 82 protected HashSet<UUID> m_NeedsListOfFriends = new HashSet<UUID>();
83 83
84 protected IPresenceService PresenceService 84 protected IPresenceService PresenceService
85 { 85 {
@@ -146,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
146 // Instantiate the request handler 146 // Instantiate the request handler
147 IHttpServer server = MainServer.GetHttpServer((uint)mPort); 147 IHttpServer server = MainServer.GetHttpServer((uint)mPort);
148 server.AddStreamHandler(new FriendsRequestHandler(this)); 148 server.AddStreamHandler(new FriendsRequestHandler(this));
149
150 } 149 }
151 150
152 if (m_FriendsService == null) 151 if (m_FriendsService == null)
@@ -173,7 +172,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
173 scene.EventManager.OnNewClient += OnNewClient; 172 scene.EventManager.OnNewClient += OnNewClient;
174 scene.EventManager.OnClientClosed += OnClientClosed; 173 scene.EventManager.OnClientClosed += OnClientClosed;
175 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; 174 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
176 scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
177 scene.EventManager.OnClientLogin += OnClientLogin; 175 scene.EventManager.OnClientLogin += OnClientLogin;
178 } 176 }
179 177
@@ -198,16 +196,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
198 196
199 public uint GetFriendPerms(UUID principalID, UUID friendID) 197 public uint GetFriendPerms(UUID principalID, UUID friendID)
200 { 198 {
201 if (!m_Friends.ContainsKey(principalID)) 199 FriendInfo[] friends = GetFriends(principalID);
202 return 0; 200 foreach (FriendInfo fi in friends)
203
204 UserFriendData data = m_Friends[principalID];
205
206 foreach (FriendInfo fi in data.Friends)
207 { 201 {
208 if (fi.Friend == friendID.ToString()) 202 if (fi.Friend == friendID.ToString())
209 return (uint)fi.TheirFlags; 203 return (uint)fi.TheirFlags;
210 } 204 }
205
211 return 0; 206 return 0;
212 } 207 }
213 208
@@ -217,73 +212,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
217 client.OnApproveFriendRequest += OnApproveFriendRequest; 212 client.OnApproveFriendRequest += OnApproveFriendRequest;
218 client.OnDenyFriendRequest += OnDenyFriendRequest; 213 client.OnDenyFriendRequest += OnDenyFriendRequest;
219 client.OnTerminateFriendship += OnTerminateFriendship; 214 client.OnTerminateFriendship += OnTerminateFriendship;
220
221 client.OnGrantUserRights += OnGrantUserRights; 215 client.OnGrantUserRights += OnGrantUserRights;
222 216
223 lock (m_Friends) 217 // Asynchronously fetch the friends list or increment the refcount for the existing
224 { 218 // friends list
225 if (m_Friends.ContainsKey(client.AgentId)) 219 Util.FireAndForget(
220 delegate(object o)
226 { 221 {
227 m_Friends[client.AgentId].Refcount++; 222 lock (m_Friends)
228 return; 223 {
229 } 224 UserFriendData friendsData;
230 225 if (m_Friends.TryGetValue(client.AgentId, out friendsData))
231 UserFriendData newFriends = new UserFriendData(); 226 {
232 227 friendsData.Refcount++;
233 newFriends.PrincipalID = client.AgentId; 228 }
234 newFriends.Friends = m_FriendsService.GetFriends(client.AgentId); 229 else
235 newFriends.Refcount = 1; 230 {
236 newFriends.RegionID = UUID.Zero; 231 friendsData = new UserFriendData();
232 friendsData.PrincipalID = client.AgentId;
233 friendsData.Friends = FriendsService.GetFriends(client.AgentId);
234 friendsData.Refcount = 1;
237 235
238 m_Friends.Add(client.AgentId, newFriends); 236 m_Friends[client.AgentId] = friendsData;
239 } 237 }
240 238 }
239 }
240 );
241 } 241 }
242 242
243 private void OnClientClosed(UUID agentID, Scene scene) 243 private void OnClientClosed(UUID agentID, Scene scene)
244 { 244 {
245 ScenePresence sp = scene.GetScenePresence(agentID); 245 ScenePresence sp = scene.GetScenePresence(agentID);
246 if (sp != null && !sp.IsChildAgent) 246 if (sp != null && !sp.IsChildAgent)
247 {
247 // do this for root agents closing out 248 // do this for root agents closing out
248 StatusChange(agentID, false); 249 StatusChange(agentID, false);
250 }
249 251
250 lock (m_Friends) 252 lock (m_Friends)
251 if (m_Friends.ContainsKey(agentID)) 253 {
254 UserFriendData friendsData;
255 if (m_Friends.TryGetValue(agentID, out friendsData))
252 { 256 {
253 if (m_Friends[agentID].Refcount == 1) 257 friendsData.Refcount--;
258 if (friendsData.Refcount <= 0)
254 m_Friends.Remove(agentID); 259 m_Friends.Remove(agentID);
255 else
256 m_Friends[agentID].Refcount--;
257 } 260 }
261 }
258 } 262 }
259 263
260 private void OnMakeRootAgent(ScenePresence sp) 264 private void OnMakeRootAgent(ScenePresence sp)
261 { 265 {
262 UUID agentID = sp.ControllingClient.AgentId; 266 UUID agentID = sp.ControllingClient.AgentId;
263 267 UpdateFriendsCache(agentID);
264 if (m_Friends.ContainsKey(agentID))
265 {
266 // This is probably an overkill, but just
267 // to make sure we have the latest and greatest
268 // friends list -- always pull OnMakeRoot
269 m_Friends[agentID].Friends =
270 m_FriendsService.GetFriends(agentID);
271
272 m_Friends[agentID].RegionID =
273 sp.ControllingClient.Scene.RegionInfo.RegionID;
274 }
275 }
276
277
278 private void OnMakeChildAgent(ScenePresence sp)
279 {
280 UUID agentID = sp.ControllingClient.AgentId;
281
282 if (m_Friends.ContainsKey(agentID))
283 {
284 if (m_Friends[agentID].RegionID == sp.ControllingClient.Scene.RegionInfo.RegionID)
285 m_Friends[agentID].RegionID = UUID.Zero;
286 }
287 } 268 }
288 269
289 private void OnClientLogin(IClientAPI client) 270 private void OnClientLogin(IClientAPI client)
@@ -295,75 +276,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
295 276
296 // Register that we need to send the list of online friends to this user 277 // Register that we need to send the list of online friends to this user
297 lock (m_NeedsListOfFriends) 278 lock (m_NeedsListOfFriends)
298 if (!m_NeedsListOfFriends.Contains(agentID)) 279 m_NeedsListOfFriends.Add(agentID);
299 {
300 m_NeedsListOfFriends.Add(agentID);
301 }
302 } 280 }
303 281
304 public void SendFriendsOnlineIfNeeded(IClientAPI client) 282 public void SendFriendsOnlineIfNeeded(IClientAPI client)
305 { 283 {
306 UUID agentID = client.AgentId; 284 UUID agentID = client.AgentId;
307 if (m_NeedsListOfFriends.Contains(agentID)) 285
286 // Check if the online friends list is needed
287 lock (m_NeedsListOfFriends)
308 { 288 {
309 if (!m_Friends.ContainsKey(agentID)) 289 if (!m_NeedsListOfFriends.Remove(agentID))
310 {
311 m_log.DebugFormat("[FRIENDS MODULE]: agent {0} not found in local cache", agentID);
312 return; 290 return;
313 } 291 }
314
315 //
316 // Send the friends online
317 //
318 List<UUID> online = GetOnlineFriends(agentID);
319 if (online.Count > 0)
320 {
321 m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count);
322 client.SendAgentOnline(online.ToArray());
323 }
324
325 //
326 // Send outstanding friendship offers
327 //
328 if (m_Friends.ContainsKey(agentID))
329 {
330 List<string> outstanding = new List<string>();
331 292
332 foreach (FriendInfo fi in m_Friends[agentID].Friends) 293 // Send the friends online
333 if (fi.TheirFlags == -1) 294 List<UUID> online = GetOnlineFriends(agentID);
334 outstanding.Add(fi.Friend); 295 if (online.Count > 0)
296 {
297 m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count);
298 client.SendAgentOnline(online.ToArray());
299 }
335 300
336 GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, "", agentID, (byte)InstantMessageDialog.FriendshipOffered, "Will you be my friend?", true, Vector3.Zero); 301 // Send outstanding friendship offers
337 foreach (string fid in outstanding) 302 List<string> outstanding = new List<string>();
338 { 303 FriendInfo[] friends = GetFriends(agentID);
339 try 304 foreach (FriendInfo fi in friends)
340 { 305 {
341 im.fromAgentID = new Guid(fid); 306 if (fi.TheirFlags == -1)
342 } 307 outstanding.Add(fi.Friend);
343 catch 308 }
344 {
345 continue;
346 }
347 309
348 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID)); 310 GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, String.Empty, agentID, (byte)InstantMessageDialog.FriendshipOffered,
349 im.fromAgentName = account.FirstName + " " + account.LastName; 311 "Will you be my friend?", true, Vector3.Zero);
350 312
351 PresenceInfo presence = null; 313 foreach (string fid in outstanding)
352 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid }); 314 {
353 if (presences != null && presences.Length > 0) 315 UUID fromAgentID;
354 presence = presences[0]; 316 if (!UUID.TryParse(fid, out fromAgentID))
355 if (presence != null) 317 continue;
356 im.offline = 0;
357 318
358 im.imSessionID = im.fromAgentID; 319 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID);
320 PresenceInfo presence = PresenceService.GetAgent(fromAgentID);
359 321
360 // Finally 322 im.fromAgentID = fromAgentID.Guid;
361 LocalFriendshipOffered(agentID, im); 323 im.fromAgentName = account.FirstName + " " + account.LastName;
362 } 324 im.offline = (byte)((presence == null) ? 1 : 0);
363 } 325 im.imSessionID = im.fromAgentID;
364 326
365 lock (m_NeedsListOfFriends) 327 // Finally
366 m_NeedsListOfFriends.Remove(agentID); 328 LocalFriendshipOffered(agentID, im);
367 } 329 }
368 } 330 }
369 331
@@ -372,44 +334,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
372 List<string> friendList = new List<string>(); 334 List<string> friendList = new List<string>();
373 List<UUID> online = new List<UUID>(); 335 List<UUID> online = new List<UUID>();
374 336
375 foreach (FriendInfo fi in m_Friends[userID].Friends) 337 FriendInfo[] friends = GetFriends(userID);
338 foreach (FriendInfo fi in friends)
376 { 339 {
377 if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1)) 340 if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1))
378 friendList.Add(fi.Friend); 341 friendList.Add(fi.Friend);
379 } 342 }
380 343
381 if (friendList.Count == 0) 344 if (friendList.Count > 0)
382 // no friends whatsoever 345 {
383 return online; 346 PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
384 347 foreach (PresenceInfo pi in presence)
385 PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); 348 {
386 349 UUID presenceID;
387 foreach (PresenceInfo pi in presence) 350 if (UUID.TryParse(pi.UserID, out presenceID))
388 online.Add(new UUID(pi.UserID)); 351 online.Add(presenceID);
389 //m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID); 352 }
353 }
390 354
391 return online; 355 return online;
392 } 356 }
393 357
394 // 358 /// <summary>
395 // Find the client for a ID 359 /// Find the client for a ID
396 // 360 /// </summary>
397 public IClientAPI LocateClientObject(UUID agentID) 361 public IClientAPI LocateClientObject(UUID agentID)
398 { 362 {
399 Scene scene = GetClientScene(agentID); 363 Scene scene = GetClientScene(agentID);
400 if (scene == null) 364 if (scene != null)
401 return null; 365 {
402 366 ScenePresence presence = scene.GetScenePresence(agentID);
403 ScenePresence presence = scene.GetScenePresence(agentID); 367 if (presence != null)
404 if (presence == null) 368 return presence.ControllingClient;
405 return null; 369 }
406 370
407 return presence.ControllingClient; 371 return null;
408 } 372 }
409 373
410 // 374 /// <summary>
411 // Find the scene for an agent 375 /// Find the scene for an agent
412 // 376 /// </summary>
413 private Scene GetClientScene(UUID agentId) 377 private Scene GetClientScene(UUID agentId)
414 { 378 {
415 lock (m_Scenes) 379 lock (m_Scenes)
@@ -417,13 +381,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
417 foreach (Scene scene in m_Scenes) 381 foreach (Scene scene in m_Scenes)
418 { 382 {
419 ScenePresence presence = scene.GetScenePresence(agentId); 383 ScenePresence presence = scene.GetScenePresence(agentId);
420 if (presence != null) 384 if (presence != null && !presence.IsChildAgent)
421 { 385 return scene;
422 if (!presence.IsChildAgent)
423 return scene;
424 }
425 } 386 }
426 } 387 }
388
427 return null; 389 return null;
428 } 390 }
429 391
@@ -434,35 +396,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
434 /// <param name="online"></param> 396 /// <param name="online"></param>
435 private void StatusChange(UUID agentID, bool online) 397 private void StatusChange(UUID agentID, bool online)
436 { 398 {
437 //m_log.DebugFormat("[FRIENDS]: StatusChange {0}", online); 399 FriendInfo[] friends = GetFriends(agentID);
438 if (m_Friends.ContainsKey(agentID)) 400 if (friends.Length > 0)
439 { 401 {
440 //m_log.DebugFormat("[FRIENDS]: # of friends: {0}", m_Friends[agentID].Friends.Length);
441 List<FriendInfo> friendList = new List<FriendInfo>(); 402 List<FriendInfo> friendList = new List<FriendInfo>();
442 foreach (FriendInfo fi in m_Friends[agentID].Friends) 403 foreach (FriendInfo fi in friends)
443 { 404 {
444 if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1)) 405 if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1))
445 friendList.Add(fi); 406 friendList.Add(fi);
446 } 407 }
447 408
448 Util.FireAndForget(delegate 409 Util.FireAndForget(
449 { 410 delegate
450 foreach (FriendInfo fi in friendList)
451 { 411 {
452 //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID); 412 foreach (FriendInfo fi in friendList)
453 // Notify about this user status 413 {
454 StatusNotify(fi, agentID, online); 414 //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID);
415 // Notify about this user status
416 StatusNotify(fi, agentID, online);
417 }
455 } 418 }
456 }); 419 );
457 } 420 }
458 else
459 m_log.WarnFormat("[FRIENDS]: {0} not found in cache", agentID);
460 } 421 }
461 422
462 private void StatusNotify(FriendInfo friend, UUID userID, bool online) 423 private void StatusNotify(FriendInfo friend, UUID userID, bool online)
463 { 424 {
464 UUID friendID = UUID.Zero; 425 UUID friendID;
465
466 if (UUID.TryParse(friend.Friend, out friendID)) 426 if (UUID.TryParse(friend.Friend, out friendID))
467 { 427 {
468 // Try local 428 // Try local
@@ -470,34 +430,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
470 return; 430 return;
471 431
472 // The friend is not here [as root]. Let's forward. 432 // The friend is not here [as root]. Let's forward.
473 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 433 PresenceInfo friendSession = PresenceService.GetAgent(friendID);
474 if (friendSessions != null && friendSessions.Length > 0) 434 if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check
475 { 435 {
476 PresenceInfo friendSession = null; 436 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
477 foreach (PresenceInfo pinfo in friendSessions) 437 //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
478 if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad 438 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
479 {
480 friendSession = pinfo;
481 break;
482 }
483
484 if (friendSession != null)
485 {
486 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
487 //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
488 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
489 }
490 } 439 }
491
492 // Friend is not online. Ignore.
493 } 440 }
494 else 441 else
442 {
495 m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend); 443 m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend);
444 }
496 } 445 }
497 446
498 private void OnInstantMessage(IClientAPI client, GridInstantMessage im) 447 private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
499 { 448 {
500 if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered) 449 if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered)
501 { 450 {
502 // we got a friendship offer 451 // we got a friendship offer
503 UUID principalID = new UUID(im.fromAgentID); 452 UUID principalID = new UUID(im.fromAgentID);
@@ -528,15 +477,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
528 return; 477 return;
529 478
530 // The prospective friend is not here [as root]. Let's forward. 479 // The prospective friend is not here [as root]. Let's forward.
531 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 480 PresenceInfo friendSession = PresenceService.GetAgent(friendID);
532 if (friendSessions != null && friendSessions.Length > 0) 481 if (friendSession != null)
533 { 482 {
534 PresenceInfo friendSession = friendSessions[0]; 483 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
535 if (friendSession != null) 484 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
536 {
537 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
538 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
539 }
540 } 485 }
541 // If the prospective friend is not online, he'll get the message upon login. 486 // If the prospective friend is not online, he'll get the message upon login.
542 } 487 }
@@ -547,9 +492,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
547 492
548 FriendsService.StoreFriend(agentID, friendID.ToString(), 1); 493 FriendsService.StoreFriend(agentID, friendID.ToString(), 1);
549 FriendsService.StoreFriend(friendID, agentID.ToString(), 1); 494 FriendsService.StoreFriend(friendID, agentID.ToString(), 1);
550 // update the local cache
551 m_Friends[agentID].Friends = FriendsService.GetFriends(agentID);
552 495
496 // Update the local cache
497 UpdateFriendsCache(agentID);
553 498
554 // 499 //
555 // Notify the friend 500 // Notify the friend
@@ -563,16 +508,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
563 } 508 }
564 509
565 // The friend is not here 510 // The friend is not here
566 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 511 PresenceInfo friendSession = PresenceService.GetAgent(friendID);
567 if (friendSessions != null && friendSessions.Length > 0) 512 if (friendSession != null)
568 { 513 {
569 PresenceInfo friendSession = friendSessions[0]; 514 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
570 if (friendSession != null) 515 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
571 { 516 client.SendAgentOnline(new UUID[] { friendID });
572 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
573 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
574 client.SendAgentOnline(new UUID[] { friendID });
575 }
576 } 517 }
577 } 518 }
578 519
@@ -591,18 +532,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
591 if (LocalFriendshipDenied(agentID, client.Name, friendID)) 532 if (LocalFriendshipDenied(agentID, client.Name, friendID))
592 return; 533 return;
593 534
594 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 535 PresenceInfo friendSession = PresenceService.GetAgent(friendID);
595 if (friendSessions != null && friendSessions.Length > 0) 536 if (friendSession != null)
596 { 537 {
597 PresenceInfo friendSession = friendSessions[0]; 538 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
598 if (friendSession != null) 539 if (region != null)
599 { 540 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
600 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 541 else
601 if (region != null) 542 m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
602 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
603 else
604 m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
605 }
606 } 543 }
607 } 544 }
608 545
@@ -612,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
612 FriendsService.Delete(exfriendID, agentID.ToString()); 549 FriendsService.Delete(exfriendID, agentID.ToString());
613 550
614 // Update local cache 551 // Update local cache
615 m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); 552 UpdateFriendsCache(agentID);
616 553
617 client.SendTerminateFriend(exfriendID); 554 client.SendTerminateFriend(exfriendID);
618 555
@@ -624,30 +561,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
624 if (LocalFriendshipTerminated(exfriendID)) 561 if (LocalFriendshipTerminated(exfriendID))
625 return; 562 return;
626 563
627 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() }); 564 PresenceInfo friendSession = PresenceService.GetAgent(exfriendID);
628 if (friendSessions != null && friendSessions.Length > 0) 565 if (friendSession != null)
629 { 566 {
630 PresenceInfo friendSession = friendSessions[0]; 567 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
631 if (friendSession != null) 568 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
632 {
633 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
634 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
635 }
636 } 569 }
637 } 570 }
638 571
639 private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) 572 private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
640 { 573 {
641 if (!m_Friends.ContainsKey(remoteClient.AgentId)) 574 FriendInfo[] friends = GetFriends(remoteClient.AgentId);
575 if (friends.Length == 0)
642 return; 576 return;
643 577
644 m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target); 578 m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target);
645 // Let's find the friend in this user's friend list 579 // Let's find the friend in this user's friend list
646 UserFriendData fd = m_Friends[remoteClient.AgentId];
647 FriendInfo friend = null; 580 FriendInfo friend = null;
648 foreach (FriendInfo fi in fd.Friends) 581 foreach (FriendInfo fi in friends)
582 {
649 if (fi.Friend == target.ToString()) 583 if (fi.Friend == target.ToString())
650 friend = fi; 584 friend = fi;
585 }
651 586
652 if (friend != null) // Found it 587 if (friend != null) // Found it
653 { 588 {
@@ -669,17 +604,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
669 if (LocalGrantRights(requester, target, myFlags, rights)) 604 if (LocalGrantRights(requester, target, myFlags, rights))
670 return; 605 return;
671 606
672 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); 607 PresenceInfo friendSession = PresenceService.GetAgent(target);
673 if (friendSessions != null && friendSessions.Length > 0) 608 if (friendSession != null)
674 { 609 {
675 PresenceInfo friendSession = friendSessions[0]; 610 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
676 if (friendSession != null) 611 // TODO: You might want to send the delta to save the lookup
677 { 612 // on the other end!!
678 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 613 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
679 // TODO: You might want to send the delta to save the lookup
680 // on the other end!!
681 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
682 }
683 } 614 }
684 } 615 }
685 } 616 }
@@ -708,8 +639,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
708 GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, 639 GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID,
709 (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); 640 (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero);
710 friendClient.SendInstantMessage(im); 641 friendClient.SendInstantMessage(im);
711 // update the local cache 642
712 m_Friends[friendID].Friends = FriendsService.GetFriends(friendID); 643 // Update the local cache
644 UpdateFriendsCache(friendID);
645
713 // we're done 646 // we're done
714 return true; 647 return true;
715 } 648 }
@@ -723,7 +656,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
723 if (friendClient != null) 656 if (friendClient != null)
724 { 657 {
725 // the prospective friend in this sim as root agent 658 // the prospective friend in this sim as root agent
726
727 GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, 659 GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID,
728 (byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero); 660 (byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero);
729 friendClient.SendInstantMessage(im); 661 friendClient.SendInstantMessage(im);
@@ -742,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
742 // the friend in this sim as root agent 674 // the friend in this sim as root agent
743 friendClient.SendTerminateFriend(exfriendID); 675 friendClient.SendTerminateFriend(exfriendID);
744 // update local cache 676 // update local cache
745 m_Friends[exfriendID].Friends = FriendsService.GetFriends(exfriendID); 677 UpdateFriendsCache(exfriendID);
746 // we're done 678 // we're done
747 return true; 679 return true;
748 } 680 }
@@ -771,11 +703,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
771 703
772 } 704 }
773 705
774 // update local cache 706 // Update local cache
775 //m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID); 707 lock (m_Friends)
776 foreach (FriendInfo finfo in m_Friends[friendID].Friends) 708 {
777 if (finfo.Friend == userID.ToString()) 709 FriendInfo[] friends = GetFriends(friendID);
778 finfo.TheirFlags = rights; 710 foreach (FriendInfo finfo in friends)
711 {
712 if (finfo.Friend == userID.ToString())
713 finfo.TheirFlags = rights;
714 }
715 }
779 716
780 return true; 717 return true;
781 } 718 }
@@ -801,7 +738,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
801 738
802 return false; 739 return false;
803 } 740 }
741
804 #endregion 742 #endregion
805 743
744 private FriendInfo[] GetFriends(UUID agentID)
745 {
746 UserFriendData friendsData;
747
748 lock (m_Friends)
749 {
750 if (m_Friends.TryGetValue(agentID, out friendsData))
751 return friendsData.Friends;
752 }
753
754 return EMPTY_FRIENDS;
755 }
756
757 private void UpdateFriendsCache(UUID agentID)
758 {
759 lock (m_Friends)
760 {
761 UserFriendData friendsData;
762 if (m_Friends.TryGetValue(agentID, out friendsData))
763 friendsData.Friends = FriendsService.GetFriends(agentID);
764 }
765 }
806 } 766 }
807} 767}
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 730cc77..13bae2e 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -498,9 +498,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
498 if (lookupAgent) 498 if (lookupAgent)
499 { 499 {
500 // Non-cached user agent lookup. 500 // Non-cached user agent lookup.
501 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); 501 upd = PresenceService.GetAgent(toAgentID);
502 if (presences != null && presences.Length > 0)
503 upd = presences[0];
504 502
505 if (upd != null) 503 if (upd != null)
506 { 504 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
index 235914a..2f96bcb 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
@@ -115,6 +115,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid
115 m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); 115 m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService);
116 116
117 new UserAgentServerConnector(m_Config, MainServer.Instance); 117 new UserAgentServerConnector(m_Config, MainServer.Instance);
118 new HeloServiceInConnector(m_Config, MainServer.Instance, "HeloService");
118 } 119 }
119 scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper); 120 scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper);
120 } 121 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 5b4fecb..39410b5 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39using OpenSim.Services.Connectors; 39using OpenSim.Services.Connectors;
40using OpenSim.Services.Connectors.SimianGrid;
40using OpenMetaverse; 41using OpenMetaverse;
41 42
42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory 43namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
@@ -538,12 +539,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
538 } 539 }
539 else 540 else
540 { 541 {
541 // We're instantiating this class explicitly, but this won't 542 // Still not as flexible as I would like this to be,
542 // work in general, because the remote grid may be running 543 // but good enough for now
543 // an inventory server that has a different protocol. 544 string connectorType = new HeloServicesConnector(url).Helo();
544 // Eventually we will want a piece of protocol asking 545 m_log.DebugFormat("[HG INVENTORY SERVICE]: HELO returned {0}", connectorType);
545 // the remote server about its kind. Definitely cool thing to do! 546 if (connectorType == "opensim-simian")
546 connector = new RemoteXInventoryServicesConnector(url); 547 connector = new SimianInventoryServiceConnector(url);
548 else
549 connector = new RemoteXInventoryServicesConnector(url);
547 m_connectors.Add(url, connector); 550 m_connectors.Add(url, connector);
548 } 551 }
549 } 552 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
index e1bc243..7c12b8c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
@@ -36,6 +36,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
36{ 36{
37 public class UserAccountCache 37 public class UserAccountCache
38 { 38 {
39 private const double CACHE_EXPIRATION_SECONDS = 120.0;
40
39 private static readonly ILog m_log = 41 private static readonly ILog m_log =
40 LogManager.GetLogger( 42 LogManager.GetLogger(
41 MethodBase.GetCurrentMethod().DeclaringType); 43 MethodBase.GetCurrentMethod().DeclaringType);
@@ -51,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
51 public void Cache(UUID userID, UserAccount account) 53 public void Cache(UUID userID, UserAccount account)
52 { 54 {
53 // Cache even null accounts 55 // Cache even null accounts
54 m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 56 m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
55 if (account != null) 57 if (account != null)
56 m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 58 m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
57 59
58 m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); 60 m_log.DebugFormat("[USER CACHE]: cached user {0}", userID);
59 } 61 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index b25636f..283b33b 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
102 { 102 {
103 Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>(); 103 Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>();
104 104
105 List<EntityBase> entities = m_scene.GetEntities(); 105 EntityBase[] entities = m_scene.GetEntities();
106 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); 106 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
107 107
108 /* 108 /*
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 58698ee..3342164 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -48,6 +48,7 @@ using OpenSim.Tests.Common.Setup;
48using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; 48using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
49using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; 49using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader;
50using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; 50using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter;
51using RegionSettings = OpenSim.Framework.RegionSettings;
51 52
52namespace OpenSim.Region.CoreModules.World.Archiver.Tests 53namespace OpenSim.Region.CoreModules.World.Archiver.Tests
53{ 54{
@@ -135,7 +136,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
135 136
136 SceneObjectPart part2 = CreateSceneObjectPart2(); 137 SceneObjectPart part2 = CreateSceneObjectPart2();
137 138
138 AssetNotecard nc = new AssetNotecard("Hello World!"); 139 AssetNotecard nc = new AssetNotecard();
140 nc.BodyText = "Hello World!";
141 nc.Encode();
139 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); 142 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
140 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); 143 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
141 AssetBase ncAsset 144 AssetBase ncAsset
@@ -215,7 +218,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
215 public void TestLoadOarV0_2() 218 public void TestLoadOarV0_2()
216 { 219 {
217 TestHelper.InMethod(); 220 TestHelper.InMethod();
218 //log4net.Config.XmlConfigurator.Configure(); 221// log4net.Config.XmlConfigurator.Configure();
219 222
220 MemoryStream archiveWriteStream = new MemoryStream(); 223 MemoryStream archiveWriteStream = new MemoryStream();
221 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); 224 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 3e79ec0..ea71fd9 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -163,7 +163,6 @@ namespace OpenSim.Region.CoreModules.World.Land
163 client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; 163 client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner;
164 client.OnParcelReclaim += ClientOnParcelReclaim; 164 client.OnParcelReclaim += ClientOnParcelReclaim;
165 client.OnParcelInfoRequest += ClientOnParcelInfoRequest; 165 client.OnParcelInfoRequest += ClientOnParcelInfoRequest;
166 client.OnParcelDwellRequest += ClientOnParcelDwellRequest;
167 client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; 166 client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup;
168 client.OnPreAgentUpdate += ClientOnPreAgentUpdate; 167 client.OnPreAgentUpdate += ClientOnPreAgentUpdate;
169 168
@@ -795,7 +794,8 @@ namespace OpenSim.Region.CoreModules.World.Land
795 public void EventManagerOnParcelPrimCountUpdate() 794 public void EventManagerOnParcelPrimCountUpdate()
796 { 795 {
797 ResetAllLandPrimCounts(); 796 ResetAllLandPrimCounts();
798 foreach (EntityBase obj in m_scene.Entities) 797 EntityBase[] entities = m_scene.Entities.GetEntities();
798 foreach (EntityBase obj in entities)
799 { 799 {
800 if (obj != null) 800 if (obj != null)
801 { 801 {
@@ -1104,7 +1104,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1104 m_landList.TryGetValue(localID, out land); 1104 m_landList.TryGetValue(localID, out land);
1105 } 1105 }
1106 1106
1107 if (land != null) land.UpdateLandProperties(args, remote_client); 1107 if (land != null)
1108 {
1109 land.UpdateLandProperties(args, remote_client);
1110 m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(args, localID, remote_client);
1111 }
1108 } 1112 }
1109 1113
1110 public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) 1114 public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client)
@@ -1409,9 +1413,13 @@ namespace OpenSim.Region.CoreModules.World.Land
1409 m_landList.TryGetValue(parcelID, out land); 1413 m_landList.TryGetValue(parcelID, out land);
1410 } 1414 }
1411 1415
1412 if (land != null) { 1416 if (land != null)
1417 {
1413 land.UpdateLandProperties(land_update, client); 1418 land.UpdateLandProperties(land_update, client);
1414 } else { 1419 m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client);
1420 }
1421 else
1422 {
1415 m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); 1423 m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
1416 } 1424 }
1417 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); 1425 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
@@ -1487,18 +1495,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1487 1495
1488 #endregion 1496 #endregion
1489 1497
1490 private void ClientOnParcelDwellRequest(int localID, IClientAPI remoteClient)
1491 {
1492 ILandObject selectedParcel = null;
1493 lock (m_landList)
1494 {
1495 if (!m_landList.TryGetValue(localID, out selectedParcel))
1496 return;
1497 }
1498
1499 remoteClient.SendParcelDwellReply(localID, selectedParcel.LandData.GlobalID, selectedParcel.LandData.Dwell);
1500 }
1501
1502 private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID) 1498 private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID)
1503 { 1499 {
1504 if (parcelID == UUID.Zero) 1500 if (parcelID == UUID.Zero)
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs
index bef7fe4..5067ebd 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
80 { 80 {
81 string xmlstream = "<scene>"; 81 string xmlstream = "<scene>";
82 82
83 List<EntityBase> EntityList = scene.GetEntities(); 83 EntityBase[] EntityList = scene.GetEntities();
84 List<string> EntityXml = new List<string>(); 84 List<string> EntityXml = new List<string>();
85 85
86 foreach (EntityBase ent in EntityList) 86 foreach (EntityBase ent in EntityList)
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
index 58e4261..98fe493 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
@@ -165,12 +165,12 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
165 return SceneXmlLoader.SaveGroupToXml2(grp); 165 return SceneXmlLoader.SaveGroupToXml2(grp);
166 } 166 }
167 167
168 public void SavePrimListToXml2(List<EntityBase> entityList, string fileName) 168 public void SavePrimListToXml2(EntityBase[] entityList, string fileName)
169 { 169 {
170 SceneXmlLoader.SavePrimListToXml2(entityList, fileName); 170 SceneXmlLoader.SavePrimListToXml2(entityList, fileName);
171 } 171 }
172 172
173 public void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max) 173 public void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max)
174 { 174 {
175 SceneXmlLoader.SavePrimListToXml2(entityList, stream, min, max); 175 SceneXmlLoader.SavePrimListToXml2(entityList, stream, min, max);
176 } 176 }
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
index 57eff8a..1d9c2bd 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
@@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
212 double[,] hm = whichScene.Heightmap.GetDoubles(); 212 double[,] hm = whichScene.Heightmap.GetDoubles();
213 tc = Environment.TickCount; 213 tc = Environment.TickCount;
214 m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); 214 m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
215 List<EntityBase> objs = whichScene.GetEntities(); 215 EntityBase[] objs = whichScene.GetEntities();
216 Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>(); 216 Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>();
217 //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>(); 217 //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>();
218 List<float> z_sortheights = new List<float>(); 218 List<float> z_sortheights = new List<float>();
diff --git a/OpenSim/Region/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/DataSnapshot/LandSnapshot.cs
index 64d29f2..b8c90cd 100644
--- a/OpenSim/Region/DataSnapshot/LandSnapshot.cs
+++ b/OpenSim/Region/DataSnapshot/LandSnapshot.cs
@@ -123,6 +123,8 @@ namespace OpenSim.Region.DataSnapshot.Providers
123 ILandChannel landChannel = m_scene.LandChannel; 123 ILandChannel landChannel = m_scene.LandChannel;
124 List<ILandObject> parcels = landChannel.AllParcels(); 124 List<ILandObject> parcels = landChannel.AllParcels();
125 125
126 IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
127
126 XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", ""); 128 XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", "");
127 if (parcels != null) 129 if (parcels != null)
128 { 130 {
@@ -208,7 +210,10 @@ namespace OpenSim.Region.DataSnapshot.Providers
208 xmlparcel.AppendChild(infouuid); 210 xmlparcel.AppendChild(infouuid);
209 211
210 XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", ""); 212 XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", "");
211 dwell.InnerText = parcel.Dwell.ToString(); 213 if (dwellModule != null)
214 dwell.InnerText = dwellModule.GetDwell(parcel.GlobalID).ToString();
215 else
216 dwell.InnerText = "0";
212 xmlparcel.AppendChild(dwell); 217 xmlparcel.AppendChild(dwell);
213 218
214 //TODO: figure how to figure out teleport system landData.landingType 219 //TODO: figure how to figure out teleport system landData.landingType
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
index 3c39f9e..5e75cae 100644
--- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
+++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
@@ -101,7 +101,8 @@ namespace OpenSim.Region.DataSnapshot.Providers
101 XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "objectdata", ""); 101 XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "objectdata", "");
102 XmlNode node; 102 XmlNode node;
103 103
104 foreach (EntityBase entity in m_scene.Entities) 104 EntityBase[] entities = m_scene.Entities.GetEntities();
105 foreach (EntityBase entity in entities)
105 { 106 {
106 // only objects, not avatars 107 // only objects, not avatars
107 if (entity is SceneObjectGroup) 108 if (entity is SceneObjectGroup)
diff --git a/OpenSim/Region/Framework/Interfaces/IDwellModule.cs b/OpenSim/Region/Framework/Interfaces/IDwellModule.cs
new file mode 100644
index 0000000..db50439
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/IDwellModule.cs
@@ -0,0 +1,37 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using OpenSim.Framework;
30
31namespace OpenSim.Region.Framework.Interfaces
32{
33 public interface IDwellModule
34 {
35 int GetDwell(UUID parcelID);
36 }
37}
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs
index e7562a5..18758c8 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs
@@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Interfaces
90 /// </summary> 90 /// </summary>
91 /// <param name="entityList"></param> 91 /// <param name="entityList"></param>
92 /// <param name="fileName"></param> 92 /// <param name="fileName"></param>
93 void SavePrimListToXml2(List<EntityBase> entityList, string fileName); 93 void SavePrimListToXml2(EntityBase[] entityList, string fileName);
94 94
95 /// <summary> 95 /// <summary>
96 /// Save a set of prims in the xml2 format, optionally specifying a bounding box for which 96 /// Save a set of prims in the xml2 format, optionally specifying a bounding box for which
@@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Interfaces
101 /// <param name="stream"></param> 101 /// <param name="stream"></param>
102 /// <param name="min"></param> 102 /// <param name="min"></param>
103 /// <param name="max"></param> 103 /// <param name="max"></param>
104 void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max); 104 void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max);
105 105
106 void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName); 106 void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName);
107 107
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
index 241cac0..916148b 100644
--- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -111,11 +111,11 @@ namespace OpenSim.Region.Framework.Scenes
111 111
112 private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) 112 private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e)
113 { 113 {
114 m_log.Debug("[SCENE]: Starting send to inventory loop"); 114 m_log.Debug("[ASYNC DELETER]: Starting send to inventory loop");
115 115
116 while (InventoryDeQueueAndDelete()) 116 while (InventoryDeQueueAndDelete())
117 { 117 {
118 //m_log.Debug("[SCENE]: Sent item successfully to inventory, continuing..."); 118 //m_log.Debug("[ASYNC DELETER]: Sent item successfully to inventory, continuing...");
119 } 119 }
120 } 120 }
121 121
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Framework.Scenes
137 x = m_inventoryDeletes.Dequeue(); 137 x = m_inventoryDeletes.Dequeue();
138 138
139 m_log.DebugFormat( 139 m_log.DebugFormat(
140 "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); 140 "[ASYNC DELETER]: Sending object to user's inventory, {0} item(s) remaining.", left);
141 141
142 try 142 try
143 { 143 {
@@ -152,7 +152,8 @@ namespace OpenSim.Region.Framework.Scenes
152 } 152 }
153 catch (Exception e) 153 catch (Exception e)
154 { 154 {
155 m_log.DebugFormat("Exception background sending object: " + e); 155 m_log.ErrorFormat(
156 "[ASYNC DELETER]: Exception background sending object: {0}{1}", e.Message, e.StackTrace);
156 } 157 }
157 158
158 return true; 159 return true;
@@ -164,12 +165,16 @@ namespace OpenSim.Region.Framework.Scenes
164 // We can't put the object group details in here since the root part may have disappeared (which is where these sit). 165 // We can't put the object group details in here since the root part may have disappeared (which is where these sit).
165 // FIXME: This needs to be fixed. 166 // FIXME: This needs to be fixed.
166 m_log.ErrorFormat( 167 m_log.ErrorFormat(
167 "[SCENE]: Queued sending of scene object to agent {0} {1} failed: {2}", 168 "[ASYNC DELETER]: Queued sending of scene object to agent {0} {1} failed: {2} {3}",
168 (x != null ? x.remoteClient.Name : "unavailable"), (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"), e.ToString()); 169 (x != null ? x.remoteClient.Name : "unavailable"),
170 (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"),
171 e.Message,
172 e.StackTrace);
169 } 173 }
170 174
171 m_log.Debug("[SCENE]: No objects left in inventory send queue."); 175 m_log.Debug("[ASYNC DELETER]: No objects left in inventory send queue.");
176
172 return false; 177 return false;
173 } 178 }
174 } 179 }
175} 180} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/EntityBase.cs b/OpenSim/Region/Framework/Scenes/EntityBase.cs
index e183f9d..6fd38e5 100644
--- a/OpenSim/Region/Framework/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Framework/Scenes/EntityBase.cs
@@ -69,6 +69,7 @@ namespace OpenSim.Region.Framework.Scenes
69 public bool IsDeleted 69 public bool IsDeleted
70 { 70 {
71 get { return m_isDeleted; } 71 get { return m_isDeleted; }
72 set { m_isDeleted = value; }
72 } 73 }
73 protected bool m_isDeleted; 74 protected bool m_isDeleted;
74 75
diff --git a/OpenSim/Region/Framework/Scenes/EntityManager.cs b/OpenSim/Region/Framework/Scenes/EntityManager.cs
index 099fcce..0defa93 100644
--- a/OpenSim/Region/Framework/Scenes/EntityManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EntityManager.cs
@@ -34,187 +34,89 @@ using OpenMetaverse;
34 34
35namespace OpenSim.Region.Framework.Scenes 35namespace OpenSim.Region.Framework.Scenes
36{ 36{
37 public class EntityManager : IEnumerable<EntityBase> 37 public class EntityManager
38 { 38 {
39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 private readonly Dictionary<UUID,EntityBase> m_eb_uuid = new Dictionary<UUID, EntityBase>(); 40 private readonly DoubleDictionary<UUID, uint, EntityBase> m_entities = new DoubleDictionary<UUID, uint, EntityBase>();
41 private readonly Dictionary<uint, EntityBase> m_eb_localID = new Dictionary<uint, EntityBase>();
42 //private readonly Dictionary<UUID, ScenePresence> m_pres_uuid = new Dictionary<UUID, ScenePresence>();
43 private readonly Object m_lock = new Object();
44 41
45 [Obsolete("Use Add() instead.")] 42 public int Count
46 public void Add(UUID id, EntityBase eb)
47 { 43 {
48 Add(eb); 44 get { return m_entities.Count; }
49 } 45 }
50 46
51 public void Add(EntityBase entity) 47 public void Add(EntityBase entity)
52 { 48 {
53 lock (m_lock) 49 m_entities.Add(entity.UUID, entity.LocalId, entity);
54 {
55 try
56 {
57 m_eb_uuid.Add(entity.UUID, entity);
58 m_eb_localID.Add(entity.LocalId, entity);
59 }
60 catch(Exception e)
61 {
62 m_log.ErrorFormat("Add Entity failed: {0}", e.Message);
63 }
64 }
65 }
66
67 public void InsertOrReplace(EntityBase entity)
68 {
69 lock (m_lock)
70 {
71 try
72 {
73 m_eb_uuid[entity.UUID] = entity;
74 m_eb_localID[entity.LocalId] = entity;
75 }
76 catch(Exception e)
77 {
78 m_log.ErrorFormat("Insert or Replace Entity failed: {0}", e.Message);
79 }
80 }
81 } 50 }
82 51
83 public void Clear() 52 public void Clear()
84 { 53 {
85 lock (m_lock) 54 m_entities.Clear();
86 {
87 m_eb_uuid.Clear();
88 m_eb_localID.Clear();
89 }
90 }
91
92 public int Count
93 {
94 get
95 {
96 return m_eb_uuid.Count;
97 }
98 } 55 }
99 56
100 public bool ContainsKey(UUID id) 57 public bool ContainsKey(UUID id)
101 { 58 {
102 try 59 return m_entities.ContainsKey(id);
103 {
104 return m_eb_uuid.ContainsKey(id);
105 }
106 catch
107 {
108 return false;
109 }
110 } 60 }
111 61
112 public bool ContainsKey(uint localID) 62 public bool ContainsKey(uint localID)
113 { 63 {
114 try 64 return m_entities.ContainsKey(localID);
115 {
116 return m_eb_localID.ContainsKey(localID);
117 }
118 catch
119 {
120 return false;
121 }
122 } 65 }
123 66
124 public bool Remove(uint localID) 67 public bool Remove(uint localID)
125 { 68 {
126 lock (m_lock) 69 return m_entities.Remove(localID);
127 {
128 try
129 {
130 bool a = false;
131 EntityBase entity;
132 if (m_eb_localID.TryGetValue(localID, out entity))
133 a = m_eb_uuid.Remove(entity.UUID);
134
135 bool b = m_eb_localID.Remove(localID);
136 return a && b;
137 }
138 catch (Exception e)
139 {
140 m_log.ErrorFormat("Remove Entity failed for {0}", localID, e);
141 return false;
142 }
143 }
144 } 70 }
145 71
146 public bool Remove(UUID id) 72 public bool Remove(UUID id)
147 { 73 {
148 lock (m_lock) 74 return m_entities.Remove(id);
149 {
150 try
151 {
152 bool a = false;
153 EntityBase entity;
154 if (m_eb_uuid.TryGetValue(id, out entity))
155 a = m_eb_localID.Remove(entity.LocalId);
156
157 bool b = m_eb_uuid.Remove(id);
158 return a && b;
159 }
160 catch (Exception e)
161 {
162 m_log.ErrorFormat("Remove Entity failed for {0}", id, e);
163 return false;
164 }
165 }
166 } 75 }
167 76
168 public List<EntityBase> GetAllByType<T>() 77 public EntityBase[] GetAllByType<T>()
169 { 78 {
170 List<EntityBase> tmp = new List<EntityBase>(); 79 List<EntityBase> tmp = new List<EntityBase>();
171 80
172 lock (m_lock) 81 m_entities.ForEach(
173 { 82 delegate(EntityBase entity)
174 try
175 {
176 foreach (KeyValuePair<UUID, EntityBase> pair in m_eb_uuid)
177 {
178 if (pair.Value is T)
179 {
180 tmp.Add(pair.Value);
181 }
182 }
183 }
184 catch (Exception e)
185 { 83 {
186 m_log.ErrorFormat("GetAllByType failed for {0}", e); 84 if (entity is T)
187 tmp = null; 85 tmp.Add(entity);
188 } 86 }
189 } 87 );
190 88
191 return tmp; 89 return tmp.ToArray();
192 } 90 }
193 91
194 public List<EntityBase> GetEntities() 92 public EntityBase[] GetEntities()
195 { 93 {
196 lock (m_lock) 94 List<EntityBase> tmp = new List<EntityBase>(m_entities.Count);
197 { 95 m_entities.ForEach(delegate(EntityBase entity) { tmp.Add(entity); });
198 return new List<EntityBase>(m_eb_uuid.Values); 96 return tmp.ToArray();
199 } 97 }
98
99 public void ForEach(Action<EntityBase> action)
100 {
101 m_entities.ForEach(action);
102 }
103
104 public EntityBase Find(Predicate<EntityBase> predicate)
105 {
106 return m_entities.FindValue(predicate);
200 } 107 }
201 108
202 public EntityBase this[UUID id] 109 public EntityBase this[UUID id]
203 { 110 {
204 get 111 get
205 { 112 {
206 lock (m_lock) 113 EntityBase entity;
207 { 114 m_entities.TryGetValue(id, out entity);
208 EntityBase entity; 115 return entity;
209 if (m_eb_uuid.TryGetValue(id, out entity))
210 return entity;
211 else
212 return null;
213 }
214 } 116 }
215 set 117 set
216 { 118 {
217 InsertOrReplace(value); 119 Add(value);
218 } 120 }
219 } 121 }
220 122
@@ -222,50 +124,24 @@ namespace OpenSim.Region.Framework.Scenes
222 { 124 {
223 get 125 get
224 { 126 {
225 lock (m_lock) 127 EntityBase entity;
226 { 128 m_entities.TryGetValue(localID, out entity);
227 EntityBase entity; 129 return entity;
228 if (m_eb_localID.TryGetValue(localID, out entity))
229 return entity;
230 else
231 return null;
232 }
233 } 130 }
234 set 131 set
235 { 132 {
236 InsertOrReplace(value); 133 Add(value);
237 } 134 }
238 } 135 }
239 136
240 public bool TryGetValue(UUID key, out EntityBase obj) 137 public bool TryGetValue(UUID key, out EntityBase obj)
241 { 138 {
242 lock (m_lock) 139 return m_entities.TryGetValue(key, out obj);
243 {
244 return m_eb_uuid.TryGetValue(key, out obj);
245 }
246 } 140 }
247 141
248 public bool TryGetValue(uint key, out EntityBase obj) 142 public bool TryGetValue(uint key, out EntityBase obj)
249 { 143 {
250 lock (m_lock) 144 return m_entities.TryGetValue(key, out obj);
251 {
252 return m_eb_localID.TryGetValue(key, out obj);
253 }
254 }
255
256 /// <summary>
257 /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that.
258 /// </summary>
259 /// <returns></returns>
260 public IEnumerator<EntityBase> GetEnumerator()
261 {
262 return GetEntities().GetEnumerator();
263 } 145 }
264
265 IEnumerator IEnumerable.GetEnumerator()
266 {
267 return GetEnumerator();
268 }
269
270 } 146 }
271} 147}
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 0ae3146..c434e4f 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -109,6 +109,8 @@ namespace OpenSim.Region.Framework.Scenes
109 109
110 public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; 110 public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
111 111
112 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
113
112 /// <summary> 114 /// <summary>
113 /// Fired when an object is touched/grabbed. 115 /// Fired when an object is touched/grabbed.
114 /// </summary> 116 /// </summary>
@@ -682,7 +684,7 @@ namespace OpenSim.Region.Framework.Scenes
682 } 684 }
683 } 685 }
684 686
685 public void TriggerOnBackup(IRegionDataStore dstore) 687 public void TriggerOnBackup(IRegionDataStore dstore, bool forced)
686 { 688 {
687 OnBackupDelegate handlerOnAttach = OnBackup; 689 OnBackupDelegate handlerOnAttach = OnBackup;
688 if (handlerOnAttach != null) 690 if (handlerOnAttach != null)
@@ -691,7 +693,7 @@ namespace OpenSim.Region.Framework.Scenes
691 { 693 {
692 try 694 try
693 { 695 {
694 d(dstore, false); 696 d(dstore, forced);
695 } 697 }
696 catch (Exception e) 698 catch (Exception e)
697 { 699 {
@@ -2104,5 +2106,27 @@ namespace OpenSim.Region.Framework.Scenes
2104 } 2106 }
2105 } 2107 }
2106 } 2108 }
2109
2110 public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
2111 int local_id, IClientAPI remote_client)
2112 {
2113 ParcelPropertiesUpdateRequest handler = OnParcelPropertiesUpdateRequest;
2114 if (handler != null)
2115 {
2116 foreach (ParcelPropertiesUpdateRequest d in handler.GetInvocationList())
2117 {
2118 try
2119 {
2120 d(args, local_id, remote_client);
2121 }
2122 catch (Exception e)
2123 {
2124 m_log.ErrorFormat(
2125 "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}",
2126 e.Message, e.StackTrace);
2127 }
2128 }
2129 }
2130 }
2107 } 2131 }
2108} \ No newline at end of file 2132}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4e871d9..a439eb9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -58,7 +58,8 @@ namespace OpenSim.Region.Framework.Scenes
58 { 58 {
59 m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); 59 m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
60 60
61 foreach (EntityBase group in Entities) 61 EntityBase[] entities = Entities.GetEntities();
62 foreach (EntityBase group in entities)
62 { 63 {
63 if (group is SceneObjectGroup) 64 if (group is SceneObjectGroup)
64 { 65 {
@@ -1720,7 +1721,7 @@ namespace OpenSim.Region.Framework.Scenes
1720 public virtual void DeRezObject(IClientAPI remoteClient, uint localID, 1721 public virtual void DeRezObject(IClientAPI remoteClient, uint localID,
1721 UUID groupID, DeRezAction action, UUID destinationID) 1722 UUID groupID, DeRezAction action, UUID destinationID)
1722 { 1723 {
1723 DeRezObjects(remoteClient, new List<uint>() { localID} , groupID, action, destinationID); 1724 DeRezObjects(remoteClient, new List<uint>() { localID }, groupID, action, destinationID);
1724 } 1725 }
1725 1726
1726 public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs, 1727 public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs,
@@ -1757,11 +1758,6 @@ namespace OpenSim.Region.Framework.Scenes
1757 deleteIDs.Add(localID); 1758 deleteIDs.Add(localID);
1758 deleteGroups.Add(grp); 1759 deleteGroups.Add(grp);
1759 1760
1760 // Force a database backup/update on this SceneObjectGroup
1761 // So that we know the database is upto date,
1762 // for when deleting the object from it
1763 ForceSceneObjectBackup(grp);
1764
1765 if (remoteClient == null) 1761 if (remoteClient == null)
1766 { 1762 {
1767 // Autoreturn has a null client. Nothing else does. So 1763 // Autoreturn has a null client. Nothing else does. So
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index c511774..2f69476 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -116,9 +116,8 @@ namespace OpenSim.Region.Framework.Scenes
116 /// <param name="remoteClient"></param> 116 /// <param name="remoteClient"></param>
117 public void RequestPrim(uint primLocalID, IClientAPI remoteClient) 117 public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
118 { 118 {
119 List<EntityBase> EntityList = GetEntities(); 119 EntityBase[] entityList = GetEntities();
120 120 foreach (EntityBase ent in entityList)
121 foreach (EntityBase ent in EntityList)
122 { 121 {
123 if (ent is SceneObjectGroup) 122 if (ent is SceneObjectGroup)
124 { 123 {
@@ -138,9 +137,8 @@ namespace OpenSim.Region.Framework.Scenes
138 /// <param name="remoteClient"></param> 137 /// <param name="remoteClient"></param>
139 public void SelectPrim(uint primLocalID, IClientAPI remoteClient) 138 public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
140 { 139 {
141 List<EntityBase> EntityList = GetEntities(); 140 EntityBase[] entityList = GetEntities();
142 141 foreach (EntityBase ent in entityList)
143 foreach (EntityBase ent in EntityList)
144 { 142 {
145 if (ent is SceneObjectGroup) 143 if (ent is SceneObjectGroup)
146 { 144 {
@@ -259,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes
259 257
260 public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 258 public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
261 { 259 {
262 List<EntityBase> EntityList = GetEntities(); 260 EntityBase[] EntityList = GetEntities();
263 261
264 SurfaceTouchEventArgs surfaceArg = null; 262 SurfaceTouchEventArgs surfaceArg = null;
265 if (surfaceArgs != null && surfaceArgs.Count > 0) 263 if (surfaceArgs != null && surfaceArgs.Count > 0)
@@ -303,7 +301,7 @@ namespace OpenSim.Region.Framework.Scenes
303 301
304 public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 302 public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
305 { 303 {
306 List<EntityBase> EntityList = GetEntities(); 304 EntityBase[] EntityList = GetEntities();
307 305
308 SurfaceTouchEventArgs surfaceArg = null; 306 SurfaceTouchEventArgs surfaceArg = null;
309 if (surfaceArgs != null && surfaceArgs.Count > 0) 307 if (surfaceArgs != null && surfaceArgs.Count > 0)
@@ -343,7 +341,7 @@ namespace OpenSim.Region.Framework.Scenes
343 341
344 public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 342 public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
345 { 343 {
346 List<EntityBase> EntityList = GetEntities(); 344 EntityBase[] EntityList = GetEntities();
347 345
348 SurfaceTouchEventArgs surfaceArg = null; 346 SurfaceTouchEventArgs surfaceArg = null;
349 if (surfaceArgs != null && surfaceArgs.Count > 0) 347 if (surfaceArgs != null && surfaceArgs.Count > 0)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 56ac2c2..7ce95a7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1029,29 +1029,30 @@ namespace OpenSim.Region.Framework.Scenes
1029 if (ScriptEngine) 1029 if (ScriptEngine)
1030 { 1030 {
1031 m_log.Info("Stopping all Scripts in Scene"); 1031 m_log.Info("Stopping all Scripts in Scene");
1032 foreach (EntityBase ent in Entities) 1032
1033 EntityBase[] entities = Entities.GetEntities();
1034 foreach (EntityBase ent in entities)
1033 { 1035 {
1034 if (ent is SceneObjectGroup) 1036 if (ent is SceneObjectGroup)
1035 { 1037 ((SceneObjectGroup)ent).RemoveScriptInstances(false);
1036 ((SceneObjectGroup) ent).RemoveScriptInstances(false);
1037 }
1038 } 1038 }
1039 } 1039 }
1040 else 1040 else
1041 { 1041 {
1042 m_log.Info("Starting all Scripts in Scene"); 1042 m_log.Info("Starting all Scripts in Scene");
1043 lock (Entities) 1043
1044 EntityBase[] entities = Entities.GetEntities();
1045 foreach (EntityBase ent in entities)
1044 { 1046 {
1045 foreach (EntityBase ent in Entities) 1047 if (ent is SceneObjectGroup)
1046 { 1048 {
1047 if (ent is SceneObjectGroup) 1049 SceneObjectGroup sog = (SceneObjectGroup)ent;
1048 { 1050 sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
1049 ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0); 1051 sog.ResumeScripts();
1050 ((SceneObjectGroup)ent).ResumeScripts();
1051 }
1052 } 1052 }
1053 } 1053 }
1054 } 1054 }
1055
1055 m_scripts_enabled = !ScriptEngine; 1056 m_scripts_enabled = !ScriptEngine;
1056 m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); 1057 m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine");
1057 } 1058 }
@@ -1098,7 +1099,7 @@ namespace OpenSim.Region.Framework.Scenes
1098 shuttingdown = true; 1099 shuttingdown = true;
1099 1100
1100 m_log.Debug("[SCENE]: Persisting changed objects"); 1101 m_log.Debug("[SCENE]: Persisting changed objects");
1101 List<EntityBase> entities = GetEntities(); 1102 EntityBase[] entities = GetEntities();
1102 foreach (EntityBase entity in entities) 1103 foreach (EntityBase entity in entities)
1103 { 1104 {
1104 if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) 1105 if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged)
@@ -1528,18 +1529,22 @@ namespace OpenSim.Region.Framework.Scenes
1528 /// </summary> 1529 /// </summary>
1529 private void BackupWaitCallback(object o) 1530 private void BackupWaitCallback(object o)
1530 { 1531 {
1531 Backup(); 1532 Backup(false);
1532 } 1533 }
1533 1534
1534 /// <summary> 1535 /// <summary>
1535 /// Backup the scene. This acts as the main method of the backup thread. 1536 /// Backup the scene. This acts as the main method of the backup thread.
1536 /// </summary> 1537 /// </summary>
1538 /// <param name="forced">
1539 /// If true, then any changes that have not yet been persisted are persisted. If false,
1540 /// then the persistence decision is left to the backup code (in some situations, such as object persistence,
1541 /// it's much more efficient to backup multiple changes at once rather than every single one).
1537 /// <returns></returns> 1542 /// <returns></returns>
1538 public void Backup() 1543 public void Backup(bool forced)
1539 { 1544 {
1540 lock (m_returns) 1545 lock (m_returns)
1541 { 1546 {
1542 EventManager.TriggerOnBackup(m_storageManager.DataStore); 1547 EventManager.TriggerOnBackup(m_storageManager.DataStore, forced);
1543 m_backingup = false; 1548 m_backingup = false;
1544 1549
1545 foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) 1550 foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns)
@@ -2033,8 +2038,7 @@ namespace OpenSim.Region.Framework.Scenes
2033 { 2038 {
2034 lock (Entities) 2039 lock (Entities)
2035 { 2040 {
2036 ICollection<EntityBase> entities = new List<EntityBase>(Entities); 2041 EntityBase[] entities = Entities.GetEntities();
2037
2038 foreach (EntityBase e in entities) 2042 foreach (EntityBase e in entities)
2039 { 2043 {
2040 if (e is SceneObjectGroup) 2044 if (e is SceneObjectGroup)
@@ -2088,7 +2092,7 @@ namespace OpenSim.Region.Framework.Scenes
2088// rootPart.PhysActor = null; 2092// rootPart.PhysActor = null;
2089// } 2093// }
2090 2094
2091 if (UnlinkSceneObject(group.UUID, false)) 2095 if (UnlinkSceneObject(group, false))
2092 { 2096 {
2093 EventManager.TriggerObjectBeingRemovedFromScene(group); 2097 EventManager.TriggerObjectBeingRemovedFromScene(group);
2094 EventManager.TriggerParcelPrimCountTainted(); 2098 EventManager.TriggerParcelPrimCountTainted();
@@ -2103,18 +2107,25 @@ namespace OpenSim.Region.Framework.Scenes
2103 /// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the 2107 /// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the
2104 /// object itself is not destroyed. 2108 /// object itself is not destroyed.
2105 /// </summary> 2109 /// </summary>
2106 /// <param name="uuid">Id of object.</param> 2110 /// <param name="so">The scene object.</param>
2111 /// <param name="softDelete">If true, only deletes from scene, but keeps the object in the database.</param>
2107 /// <returns>true if the object was in the scene, false if it was not</returns> 2112 /// <returns>true if the object was in the scene, false if it was not</returns>
2108 /// <param name="softDelete">If true, only deletes from scene, but keeps object in database.</param> 2113 public bool UnlinkSceneObject(SceneObjectGroup so, bool softDelete)
2109 public bool UnlinkSceneObject(UUID uuid, bool softDelete)
2110 { 2114 {
2111 if (m_sceneGraph.DeleteSceneObject(uuid, softDelete)) 2115 if (m_sceneGraph.DeleteSceneObject(so.UUID, softDelete))
2112 { 2116 {
2113 if (!softDelete) 2117 if (!softDelete)
2114 { 2118 {
2115 m_storageManager.DataStore.RemoveObject(uuid, 2119 // Force a database update so that the scene object group ID is accurate. It's possible that the
2116 m_regInfo.RegionID); 2120 // group has recently been delinked from another group but that this change has not been persisted
2121 // to the DB.
2122 ForceSceneObjectBackup(so);
2123 so.DetachFromBackup();
2124 m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID);
2117 } 2125 }
2126
2127 // We need to keep track of this state in case this group is still queued for further backup.
2128 so.IsDeleted = true;
2118 2129
2119 return true; 2130 return true;
2120 } 2131 }
@@ -2145,7 +2156,7 @@ namespace OpenSim.Region.Framework.Scenes
2145 } 2156 }
2146 catch (Exception) 2157 catch (Exception)
2147 { 2158 {
2148 m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border."); 2159 m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border.");
2149 } 2160 }
2150 return; 2161 return;
2151 } 2162 }
@@ -2162,7 +2173,7 @@ namespace OpenSim.Region.Framework.Scenes
2162 } 2173 }
2163 catch (Exception) 2174 catch (Exception)
2164 { 2175 {
2165 m_log.Warn("[DATABASE]: exception when trying to return the prim that crossed the border."); 2176 m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border.");
2166 } 2177 }
2167 return; 2178 return;
2168 } 2179 }
@@ -2643,6 +2654,8 @@ namespace OpenSim.Region.Framework.Scenes
2643 try 2654 try
2644 { 2655 {
2645 ScenePresence sp = GetScenePresence(agentID); 2656 ScenePresence sp = GetScenePresence(agentID);
2657 PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
2658
2646 if (sp != null) 2659 if (sp != null)
2647 sp.ControllingClient.Close(); 2660 sp.ControllingClient.Close();
2648 2661
@@ -3964,9 +3977,8 @@ namespace OpenSim.Region.Framework.Scenes
3964 /// </summary> 3977 /// </summary>
3965 public void ForceClientUpdate() 3978 public void ForceClientUpdate()
3966 { 3979 {
3967 List<EntityBase> EntityList = GetEntities(); 3980 EntityBase[] entityList = GetEntities();
3968 3981 foreach (EntityBase ent in entityList)
3969 foreach (EntityBase ent in EntityList)
3970 { 3982 {
3971 if (ent is SceneObjectGroup) 3983 if (ent is SceneObjectGroup)
3972 { 3984 {
@@ -3984,9 +3996,8 @@ namespace OpenSim.Region.Framework.Scenes
3984 { 3996 {
3985 m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'"); 3997 m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'");
3986 3998
3987 List<EntityBase> EntityList = GetEntities(); 3999 EntityBase[] entityList = GetEntities();
3988 4000 foreach (EntityBase ent in entityList)
3989 foreach (EntityBase ent in EntityList)
3990 { 4001 {
3991 if (ent is SceneObjectGroup) 4002 if (ent is SceneObjectGroup)
3992 { 4003 {
@@ -4355,7 +4366,7 @@ namespace OpenSim.Region.Framework.Scenes
4355 /// will not affect the original list of objects in the scene. 4366 /// will not affect the original list of objects in the scene.
4356 /// </summary> 4367 /// </summary>
4357 /// <returns></returns> 4368 /// <returns></returns>
4358 public List<EntityBase> GetEntities() 4369 public EntityBase[] GetEntities()
4359 { 4370 {
4360 return m_sceneGraph.GetEntities(); 4371 return m_sceneGraph.GetEntities();
4361 } 4372 }
@@ -4389,9 +4400,8 @@ namespace OpenSim.Region.Framework.Scenes
4389 4400
4390 public void CleanTempObjects() 4401 public void CleanTempObjects()
4391 { 4402 {
4392 List<EntityBase> objs = GetEntities(); 4403 EntityBase[] entities = GetEntities();
4393 4404 foreach (EntityBase obj in entities)
4394 foreach (EntityBase obj in objs)
4395 { 4405 {
4396 if (obj is SceneObjectGroup) 4406 if (obj is SceneObjectGroup)
4397 { 4407 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index e7175c5..f779a6d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -72,10 +72,7 @@ namespace OpenSim.Region.Framework.Scenes
72 protected Dictionary<UUID, ScenePresence> m_scenePresenceMap = new Dictionary<UUID, ScenePresence>(); 72 protected Dictionary<UUID, ScenePresence> m_scenePresenceMap = new Dictionary<UUID, ScenePresence>();
73 protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>(); 73 protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>();
74 74
75 // SceneObjects is not currently populated or used.
76 //public Dictionary<UUID, SceneObjectGroup> SceneObjects;
77 protected internal EntityManager Entities = new EntityManager(); 75 protected internal EntityManager Entities = new EntityManager();
78// protected internal Dictionary<UUID, EntityBase> Entities = new Dictionary<UUID, EntityBase>();
79 protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>(); 76 protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>();
80 77
81 protected RegionInfo m_regInfo; 78 protected RegionInfo m_regInfo;
@@ -348,68 +345,57 @@ namespace OpenSim.Region.Framework.Scenes
348 if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) 345 if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
349 return false; 346 return false;
350 347
351 lock (sceneObject) 348 if (Entities.ContainsKey(sceneObject.UUID))
352 { 349 return false;
353 if (Entities.ContainsKey(sceneObject.UUID)) 350
354 { 351 List<SceneObjectPart> children;
355// m_log.WarnFormat( 352 lock (sceneObject.Children)
356// "[SCENE GRAPH]: Scene object {0} {1} was already in region {2} on add request", 353 children = new List<SceneObjectPart>(sceneObject.Children.Values);
357// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); 354
358 return false; 355 // Clamp child prim sizes and add child prims to the m_numPrim count
359 } 356 if (m_parentScene.m_clampPrimSize)
360 357 {
361// m_log.DebugFormat( 358 foreach (SceneObjectPart part in children)
362// "[SCENE GRAPH]: Adding object {0} {1} to region {2}",
363// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
364
365 lock (sceneObject.Children)
366 { 359 {
367 if (m_parentScene.m_clampPrimSize) 360 Vector3 scale = part.Shape.Scale;
368 { 361
369 foreach (SceneObjectPart part in sceneObject.Children.Values) 362 if (scale.X > m_parentScene.m_maxNonphys)
370 { 363 scale.X = m_parentScene.m_maxNonphys;
371 Vector3 scale = part.Shape.Scale; 364 if (scale.Y > m_parentScene.m_maxNonphys)
372 365 scale.Y = m_parentScene.m_maxNonphys;
373 if (scale.X > m_parentScene.m_maxNonphys) 366 if (scale.Z > m_parentScene.m_maxNonphys)
374 scale.X = m_parentScene.m_maxNonphys; 367 scale.Z = m_parentScene.m_maxNonphys;
375 if (scale.Y > m_parentScene.m_maxNonphys) 368
376 scale.Y = m_parentScene.m_maxNonphys; 369 part.Shape.Scale = scale;
377 if (scale.Z > m_parentScene.m_maxNonphys)
378 scale.Z = m_parentScene.m_maxNonphys;
379
380 part.Shape.Scale = scale;
381 }
382 }
383
384 m_numPrim += sceneObject.Children.Count;
385 } 370 }
386 371 }
387 sceneObject.AttachToScene(m_parentScene); 372 m_numPrim += children.Count;
388 373
389 if (sendClientUpdates) 374 sceneObject.AttachToScene(m_parentScene);
390 sceneObject.ScheduleGroupForFullUpdate();
391
392 Entities.Add(sceneObject);
393 375
394 if (attachToBackup) 376 if (sendClientUpdates)
395 sceneObject.AttachToBackup(); 377 sceneObject.ScheduleGroupForFullUpdate();
396 378
397 if (OnObjectCreate != null) 379 Entities.Add(sceneObject);
398 OnObjectCreate(sceneObject); 380
399 381 if (attachToBackup)
400 lock (SceneObjectGroupsByFullID) 382 sceneObject.AttachToBackup();
401 { 383
402 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; 384 if (OnObjectCreate != null)
403 foreach (SceneObjectPart part in sceneObject.Children.Values) 385 OnObjectCreate(sceneObject);
404 SceneObjectGroupsByFullID[part.UUID] = sceneObject; 386
405 } 387 lock (SceneObjectGroupsByFullID)
406 388 {
407 lock (SceneObjectGroupsByLocalID) 389 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
408 { 390 foreach (SceneObjectPart part in children)
409 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; 391 SceneObjectGroupsByFullID[part.UUID] = sceneObject;
410 foreach (SceneObjectPart part in sceneObject.Children.Values) 392 }
411 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; 393
412 } 394 lock (SceneObjectGroupsByLocalID)
395 {
396 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
397 foreach (SceneObjectPart part in children)
398 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
413 } 399 }
414 400
415 return true; 401 return true;
@@ -421,42 +407,38 @@ namespace OpenSim.Region.Framework.Scenes
421 /// <returns>true if the object was deleted, false if there was no object to delete</returns> 407 /// <returns>true if the object was deleted, false if there was no object to delete</returns>
422 public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) 408 public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
423 { 409 {
424 if (Entities.ContainsKey(uuid)) 410 EntityBase entity;
425 { 411 if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup)
426 SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid]; 412 return false;
427 413
428 if (!resultOfObjectLinked) 414 SceneObjectGroup grp = (SceneObjectGroup)entity;
429 {
430 m_numPrim -= grp.PrimCount;
431 415
432 if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) 416 if (!resultOfObjectLinked)
433 RemovePhysicalPrim(grp.PrimCount); 417 {
434 } 418 m_numPrim -= grp.PrimCount;
435 419
436 if (OnObjectRemove != null) 420 if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
437 OnObjectRemove(Entities[uuid]); 421 RemovePhysicalPrim(grp.PrimCount);
422 }
438 423
439 lock (SceneObjectGroupsByFullID) 424 if (OnObjectRemove != null)
440 { 425 OnObjectRemove(Entities[uuid]);
441 foreach (SceneObjectPart part in grp.Children.Values)
442 SceneObjectGroupsByFullID.Remove(part.UUID);
443 SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
444 }
445 lock (SceneObjectGroupsByLocalID)
446 {
447 foreach (SceneObjectPart part in grp.Children.Values)
448 SceneObjectGroupsByLocalID.Remove(part.LocalId);
449 SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
450 }
451 426
452 Entities.Remove(uuid); 427 lock (SceneObjectGroupsByFullID)
453 //SceneObjectGroup part; 428 {
454 //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) 429 foreach (SceneObjectPart part in grp.Children.Values)
430 SceneObjectGroupsByFullID.Remove(part.UUID);
431 SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
432 }
455 433
456 return true; 434 lock (SceneObjectGroupsByLocalID)
435 {
436 foreach (SceneObjectPart part in grp.Children.Values)
437 SceneObjectGroupsByLocalID.Remove(part.LocalId);
438 SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
457 } 439 }
458 440
459 return false; 441 return Entities.Remove(uuid);
460 } 442 }
461 443
462 /// <summary> 444 /// <summary>
@@ -468,9 +450,7 @@ namespace OpenSim.Region.Framework.Scenes
468 protected internal void AddToUpdateList(SceneObjectGroup obj) 450 protected internal void AddToUpdateList(SceneObjectGroup obj)
469 { 451 {
470 lock (m_updateList) 452 lock (m_updateList)
471 {
472 m_updateList[obj.UUID] = obj; 453 m_updateList[obj.UUID] = obj;
473 }
474 } 454 }
475 455
476 /// <summary> 456 /// <summary>
@@ -480,34 +460,39 @@ namespace OpenSim.Region.Framework.Scenes
480 { 460 {
481 if (!Monitor.TryEnter(m_updateLock)) 461 if (!Monitor.TryEnter(m_updateLock))
482 return; 462 return;
483 463 try
484 List<SceneObjectGroup> updates;
485
486 // Some updates add more updates to the updateList.
487 // Get the current list of updates and clear the list before iterating
488 lock (m_updateList)
489 {
490 updates = new List<SceneObjectGroup>(m_updateList.Values);
491 m_updateList.Clear();
492 }
493
494 // Go through all updates
495 for (int i = 0; i < updates.Count; i++)
496 { 464 {
497 SceneObjectGroup sog = updates[i]; 465 List<SceneObjectGroup> updates;
498 466
499 // Don't abort the whole update if one entity happens to give us an exception. 467 // Some updates add more updates to the updateList.
500 try 468 // Get the current list of updates and clear the list before iterating
469 lock (m_updateList)
501 { 470 {
502 sog.Update(); 471 updates = new List<SceneObjectGroup>(m_updateList.Values);
472 m_updateList.Clear();
503 } 473 }
504 catch (Exception e) 474
475 // Go through all updates
476 for (int i = 0; i < updates.Count; i++)
505 { 477 {
506 m_log.ErrorFormat( 478 SceneObjectGroup sog = updates[i];
507 "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e); 479
480 // Don't abort the whole update if one entity happens to give us an exception.
481 try
482 {
483 sog.Update();
484 }
485 catch (Exception e)
486 {
487 m_log.ErrorFormat(
488 "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e);
489 }
508 } 490 }
509 } 491 }
510 Monitor.Exit(m_updateLock); 492 finally
493 {
494 Monitor.Exit(m_updateLock);
495 }
511 } 496 }
512 497
513 protected internal void AddPhysicalPrim(int number) 498 protected internal void AddPhysicalPrim(int number)
@@ -864,38 +849,38 @@ namespace OpenSim.Region.Framework.Scenes
864 /// <returns>null if no scene object group containing that prim is found</returns> 849 /// <returns>null if no scene object group containing that prim is found</returns>
865 public SceneObjectGroup GetGroupByPrim(uint localID) 850 public SceneObjectGroup GetGroupByPrim(uint localID)
866 { 851 {
867 if (Entities.ContainsKey(localID)) 852 EntityBase entity;
868 return Entities[localID] as SceneObjectGroup; 853 if (Entities.TryGetValue(localID, out entity))
854 return entity as SceneObjectGroup;
869 855
870 //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); 856 //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
871 SceneObjectGroup sog; 857 SceneObjectGroup sog;
872 lock (SceneObjectGroupsByLocalID) 858 lock (SceneObjectGroupsByLocalID)
859 SceneObjectGroupsByLocalID.TryGetValue(localID, out sog);
860
861 if (sog != null)
873 { 862 {
874 if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog)) 863 if (sog.HasChildPrim(localID))
875 { 864 return sog;
876 if (sog.HasChildPrim(localID)) 865 SceneObjectGroupsByLocalID.Remove(localID);
877 return sog;
878 SceneObjectGroupsByLocalID.Remove(localID);
879 }
880 } 866 }
881 867
882 List<EntityBase> EntityList = GetEntities(); 868 EntityBase[] entityList = GetEntities();
883 foreach (EntityBase ent in EntityList) 869 foreach (EntityBase ent in entityList)
884 { 870 {
885 //m_log.DebugFormat("Looking at entity {0}", ent.UUID); 871 //m_log.DebugFormat("Looking at entity {0}", ent.UUID);
886 if (ent is SceneObjectGroup) 872 if (ent is SceneObjectGroup)
887 { 873 {
888 if (((SceneObjectGroup)ent).HasChildPrim(localID)) 874 sog = (SceneObjectGroup)ent;
875 if (sog.HasChildPrim(localID))
889 { 876 {
890 sog = (SceneObjectGroup)ent;
891 lock (SceneObjectGroupsByLocalID) 877 lock (SceneObjectGroupsByLocalID)
892 {
893 SceneObjectGroupsByLocalID[localID] = sog; 878 SceneObjectGroupsByLocalID[localID] = sog;
894 }
895 return sog; 879 return sog;
896 } 880 }
897 } 881 }
898 } 882 }
883
899 return null; 884 return null;
900 } 885 }
901 886
@@ -908,36 +893,35 @@ namespace OpenSim.Region.Framework.Scenes
908 { 893 {
909 SceneObjectGroup sog; 894 SceneObjectGroup sog;
910 lock (SceneObjectGroupsByFullID) 895 lock (SceneObjectGroupsByFullID)
896 SceneObjectGroupsByFullID.TryGetValue(fullID, out sog);
897
898 if (sog != null)
911 { 899 {
912 if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) 900 lock (sog.Children)
913 { 901 {
914 lock (sog.Children) 902 if (sog.Children.ContainsKey(fullID))
915 { 903 return sog;
916 if (sog.Children.ContainsKey(fullID))
917 return sog;
918 }
919
920 SceneObjectGroupsByFullID.Remove(fullID);
921 } 904 }
922 }
923 905
924 List<EntityBase> EntityList = GetEntities(); 906 lock (SceneObjectGroupsByFullID)
907 SceneObjectGroupsByFullID.Remove(fullID);
908 }
925 909
926 foreach (EntityBase ent in EntityList) 910 EntityBase[] entityList = GetEntities();
911 foreach (EntityBase ent in entityList)
927 { 912 {
928 if (ent is SceneObjectGroup) 913 if (ent is SceneObjectGroup)
929 { 914 {
930 if (((SceneObjectGroup)ent).HasChildPrim(fullID)) 915 sog = (SceneObjectGroup)ent;
916 if (sog.HasChildPrim(fullID))
931 { 917 {
932 sog = (SceneObjectGroup)ent;
933 lock (SceneObjectGroupsByFullID) 918 lock (SceneObjectGroupsByFullID)
934 {
935 SceneObjectGroupsByFullID[fullID] = sog; 919 SceneObjectGroupsByFullID[fullID] = sog;
936 }
937 return sog; 920 return sog;
938 } 921 }
939 } 922 }
940 } 923 }
924
941 return null; 925 return null;
942 } 926 }
943 927
@@ -946,7 +930,7 @@ namespace OpenSim.Region.Framework.Scenes
946 // Primitive Ray Tracing 930 // Primitive Ray Tracing
947 float closestDistance = 280f; 931 float closestDistance = 280f;
948 EntityIntersection result = new EntityIntersection(); 932 EntityIntersection result = new EntityIntersection();
949 List<EntityBase> EntityList = GetEntities(); 933 EntityBase[] EntityList = GetEntities();
950 foreach (EntityBase ent in EntityList) 934 foreach (EntityBase ent in EntityList)
951 { 935 {
952 if (ent is SceneObjectGroup) 936 if (ent is SceneObjectGroup)
@@ -984,23 +968,28 @@ namespace OpenSim.Region.Framework.Scenes
984 /// <returns>null if the part was not found</returns> 968 /// <returns>null if the part was not found</returns>
985 protected internal SceneObjectPart GetSceneObjectPart(string name) 969 protected internal SceneObjectPart GetSceneObjectPart(string name)
986 { 970 {
987 List<EntityBase> EntityList = GetEntities(); 971 SceneObjectPart sop = null;
988 972
989 // FIXME: use a dictionary here 973 Entities.Find(
990 foreach (EntityBase ent in EntityList) 974 delegate(EntityBase entity)
991 {
992 if (ent is SceneObjectGroup)
993 { 975 {
994 foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts()) 976 if (entity is SceneObjectGroup)
995 { 977 {
996 if (p.Name == name) 978 foreach (SceneObjectPart p in ((SceneObjectGroup)entity).GetParts())
997 { 979 {
998 return p; 980 if (p.Name == name)
981 {
982 sop = p;
983 return true;
984 }
999 } 985 }
1000 } 986 }
987
988 return false;
1001 } 989 }
1002 } 990 );
1003 return null; 991
992 return sop;
1004 } 993 }
1005 994
1006 /// <summary> 995 /// <summary>
@@ -1021,7 +1010,7 @@ namespace OpenSim.Region.Framework.Scenes
1021 /// it 1010 /// it
1022 /// </summary> 1011 /// </summary>
1023 /// <returns></returns> 1012 /// <returns></returns>
1024 protected internal List<EntityBase> GetEntities() 1013 protected internal EntityBase[] GetEntities()
1025 { 1014 {
1026 return Entities.GetEntities(); 1015 return Entities.GetEntities();
1027 } 1016 }
@@ -1030,7 +1019,7 @@ namespace OpenSim.Region.Framework.Scenes
1030 { 1019 {
1031 Dictionary<uint, float> topScripts = new Dictionary<uint, float>(); 1020 Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
1032 1021
1033 List<EntityBase> EntityList = GetEntities(); 1022 EntityBase[] EntityList = GetEntities();
1034 int limit = 0; 1023 int limit = 0;
1035 foreach (EntityBase ent in EntityList) 1024 foreach (EntityBase ent in EntityList)
1036 { 1025 {
@@ -1632,6 +1621,11 @@ namespace OpenSim.Region.Framework.Scenes
1632 // Unlink all child parts from their groups 1621 // Unlink all child parts from their groups
1633 // 1622 //
1634 child.ParentGroup.DelinkFromGroup(child, true); 1623 child.ParentGroup.DelinkFromGroup(child, true);
1624
1625 // These are not in affected groups and will not be
1626 // handled further. Do the honors here.
1627 child.ParentGroup.HasGroupChanged = true;
1628 child.ParentGroup.ScheduleGroupForFullUpdate();
1635 } 1629 }
1636 1630
1637 foreach (SceneObjectPart root in rootParts) 1631 foreach (SceneObjectPart root in rootParts)
@@ -1721,8 +1715,8 @@ namespace OpenSim.Region.Framework.Scenes
1721 UUID objid = UUID.Zero; 1715 UUID objid = UUID.Zero;
1722 SceneObjectPart obj = null; 1716 SceneObjectPart obj = null;
1723 1717
1724 List<EntityBase> EntityList = GetEntities(); 1718 EntityBase[] entityList = GetEntities();
1725 foreach (EntityBase ent in EntityList) 1719 foreach (EntityBase ent in entityList)
1726 { 1720 {
1727 if (ent is SceneObjectGroup) 1721 if (ent is SceneObjectGroup)
1728 { 1722 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index 3b84734..86ba2aa 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -300,7 +300,7 @@ namespace OpenSim.Region.Framework.Scenes
300 300
301 public void BackupCurrentScene() 301 public void BackupCurrentScene()
302 { 302 {
303 ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); }); 303 ForEachCurrentScene(delegate(Scene scene) { scene.Backup(true); });
304 } 304 }
305 305
306 public bool TrySetCurrentScene(string regionName) 306 public bool TrySetCurrentScene(string regionName)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 64a6dd5..ba5e33c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1226,16 +1226,16 @@ namespace OpenSim.Region.Framework.Scenes
1226 } 1226 }
1227 1227
1228 /// <summary> 1228 /// <summary>
1229 /// Delete this group from its scene and tell all the scene presences about that deletion. 1229 /// Delete this group from its scene.
1230 /// </summary> 1230 /// </summary>
1231 /// <param name="silent">Broadcast deletions to all clients.</param> 1231 ///
1232 /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood
1233 /// up and all avatars receive notification of its removal. Removal of the scene object from database backup
1234 /// must be handled by the caller.
1235 ///
1236 /// <param name="silent">If true then deletion is not broadcast to clients</param>
1232 public void DeleteGroup(bool silent) 1237 public void DeleteGroup(bool silent)
1233 { 1238 {
1234 // We need to keep track of this state in case this group is still queued for backup.
1235 m_isDeleted = true;
1236
1237 DetachFromBackup();
1238
1239 lock (m_parts) 1239 lock (m_parts)
1240 { 1240 {
1241 foreach (SceneObjectPart part in m_parts.Values) 1241 foreach (SceneObjectPart part in m_parts.Values)
@@ -1381,14 +1381,21 @@ namespace OpenSim.Region.Framework.Scenes
1381 public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup) 1381 public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup)
1382 { 1382 {
1383 if (!m_isBackedUp) 1383 if (!m_isBackedUp)
1384 {
1385// m_log.DebugFormat(
1386// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID);
1384 return; 1387 return;
1385 1388 }
1386 // Since this is the top of the section of call stack for backing up a particular scene object, don't let
1387 // any exception propogate upwards.
1388 1389
1389 if (IsDeleted || UUID == UUID.Zero) 1390 if (IsDeleted || UUID == UUID.Zero)
1391 {
1392// m_log.DebugFormat(
1393// "[WATER WARS]: Ignoring backup of {0} {1} since object is marked as already deleted", Name, UUID);
1390 return; 1394 return;
1395 }
1391 1396
1397 // Since this is the top of the section of call stack for backing up a particular scene object, don't let
1398 // any exception propogate upwards.
1392 try 1399 try
1393 { 1400 {
1394 if (!m_scene.ShuttingDown) // if shutting down then there will be nothing to handle the return so leave till next restart 1401 if (!m_scene.ShuttingDown) // if shutting down then there will be nothing to handle the return so leave till next restart
@@ -1421,7 +1428,7 @@ namespace OpenSim.Region.Framework.Scenes
1421 if (HasGroupChanged) 1428 if (HasGroupChanged)
1422 { 1429 {
1423 // don't backup while it's selected or you're asking for changes mid stream. 1430 // don't backup while it's selected or you're asking for changes mid stream.
1424 if ((isTimeToPersist()) || (forcedBackup)) 1431 if (isTimeToPersist() || forcedBackup)
1425 { 1432 {
1426 m_log.DebugFormat( 1433 m_log.DebugFormat(
1427 "[SCENE]: Storing {0}, {1} in {2}", 1434 "[SCENE]: Storing {0}, {1} in {2}",
@@ -1444,19 +1451,19 @@ namespace OpenSim.Region.Framework.Scenes
1444 1451
1445 backup_group = null; 1452 backup_group = null;
1446 } 1453 }
1447 // else 1454// else
1448 // { 1455// {
1449 // m_log.DebugFormat( 1456// m_log.DebugFormat(
1450 // "[SCENE]: Did not update persistence of object {0} {1}, selected = {2}", 1457// "[SCENE]: Did not update persistence of object {0} {1}, selected = {2}",
1451 // Name, UUID, IsSelected); 1458// Name, UUID, IsSelected);
1452 // } 1459// }
1453 } 1460 }
1454 } 1461 }
1455 catch (Exception e) 1462 catch (Exception e)
1456 { 1463 {
1457 m_log.ErrorFormat( 1464 m_log.ErrorFormat(
1458 "[SCENE]: Storing of {0}, {1} in {2} failed with exception {3}\n\t{4}", 1465 "[SCENE]: Storing of {0}, {1} in {2} failed with exception {3}{4}",
1459 Name, UUID, m_scene.RegionInfo.RegionName, e, e.StackTrace); 1466 Name, UUID, m_scene.RegionInfo.RegionName, e.Message, e.StackTrace);
1460 } 1467 }
1461 } 1468 }
1462 1469
@@ -2084,16 +2091,9 @@ namespace OpenSim.Region.Framework.Scenes
2084 /// <returns>null if a child part with the primID was not found</returns> 2091 /// <returns>null if a child part with the primID was not found</returns>
2085 public SceneObjectPart GetChildPart(UUID primID) 2092 public SceneObjectPart GetChildPart(UUID primID)
2086 { 2093 {
2087 SceneObjectPart childPart = null; 2094 SceneObjectPart childPart;
2088
2089 lock (m_parts) 2095 lock (m_parts)
2090 { 2096 m_parts.TryGetValue(primID, out childPart);
2091 if (m_parts.ContainsKey(primID))
2092 {
2093 childPart = m_parts[primID];
2094 }
2095 }
2096
2097 return childPart; 2097 return childPart;
2098 } 2098 }
2099 2099
@@ -2246,7 +2246,7 @@ namespace OpenSim.Region.Framework.Scenes
2246 } 2246 }
2247 } 2247 }
2248 2248
2249 m_scene.UnlinkSceneObject(objectGroup.UUID, true); 2249 m_scene.UnlinkSceneObject(objectGroup, true);
2250 objectGroup.m_isDeleted = true; 2250 objectGroup.m_isDeleted = true;
2251 2251
2252 lock (objectGroup.m_parts) 2252 lock (objectGroup.m_parts)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 3ed74e1..3753dcb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -494,7 +494,14 @@ namespace OpenSim.Region.Framework.Scenes
494 public UUID UUID 494 public UUID UUID
495 { 495 {
496 get { return m_uuid; } 496 get { return m_uuid; }
497 set { m_uuid = value; } 497 set
498 {
499 m_uuid = value;
500
501 // This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part
502 if (Inventory != null)
503 Inventory.ResetInventoryIDs();
504 }
498 } 505 }
499 506
500 public uint LocalId 507 public uint LocalId
@@ -2756,7 +2763,6 @@ namespace OpenSim.Region.Framework.Scenes
2756 UUID = UUID.Random(); 2763 UUID = UUID.Random();
2757 LinkNum = linkNum; 2764 LinkNum = linkNum;
2758 LocalId = 0; 2765 LocalId = 0;
2759 Inventory.ResetInventoryIDs();
2760 } 2766 }
2761 2767
2762 /// <summary> 2768 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index ca089a1..87c4860 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -119,6 +119,9 @@ namespace OpenSim.Region.Framework.Scenes
119 /// <param name="linkNum">Link number for the part</param> 119 /// <param name="linkNum">Link number for the part</param>
120 public void ResetInventoryIDs() 120 public void ResetInventoryIDs()
121 { 121 {
122 if (null == m_part || null == m_part.ParentGroup)
123 return;
124
122 lock (m_items) 125 lock (m_items)
123 { 126 {
124 if (0 == m_items.Count) 127 if (0 == m_items.Count)
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
index f478a4a..7aa5a93 100644
--- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
@@ -75,7 +75,8 @@ namespace OpenSim.Region.Framework.Scenes
75 75
76 lock(m_pendingObjects) 76 lock(m_pendingObjects)
77 { 77 {
78 foreach (EntityBase e in m_presence.Scene.Entities) 78 EntityBase[] entities = m_presence.Scene.Entities.GetEntities();
79 foreach (EntityBase e in entities)
79 { 80 {
80 if (e != null && e is SceneObjectGroup) 81 if (e != null && e is SceneObjectGroup)
81 m_pendingObjects.Enqueue((SceneObjectGroup)e); 82 m_pendingObjects.Enqueue((SceneObjectGroup)e);
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
index b6677f0..5494549 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
@@ -84,9 +84,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
84 int primCount = 0; 84 int primCount = 0;
85 stream.WriteLine("<scene>\n"); 85 stream.WriteLine("<scene>\n");
86 86
87 List<EntityBase> EntityList = scene.GetEntities(); 87 EntityBase[] entityList = scene.GetEntities();
88 88 foreach (EntityBase ent in entityList)
89 foreach (EntityBase ent in EntityList)
90 { 89 {
91 if (ent is SceneObjectGroup) 90 if (ent is SceneObjectGroup)
92 { 91 {
@@ -204,16 +203,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
204 203
205 public static void SavePrimsToXml2(Scene scene, string fileName) 204 public static void SavePrimsToXml2(Scene scene, string fileName)
206 { 205 {
207 List<EntityBase> EntityList = scene.GetEntities(); 206 EntityBase[] entityList = scene.GetEntities();
208 207 SavePrimListToXml2(entityList, fileName);
209 SavePrimListToXml2(EntityList, fileName);
210 } 208 }
211 209
212 public static void SavePrimsToXml2(Scene scene, TextWriter stream, Vector3 min, Vector3 max) 210 public static void SavePrimsToXml2(Scene scene, TextWriter stream, Vector3 min, Vector3 max)
213 { 211 {
214 List<EntityBase> EntityList = scene.GetEntities(); 212 EntityBase[] entityList = scene.GetEntities();
215 213 SavePrimListToXml2(entityList, stream, min, max);
216 SavePrimListToXml2(EntityList, stream, min, max);
217 } 214 }
218 215
219 public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName) 216 public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName)
@@ -222,7 +219,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
222 "[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}", 219 "[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}",
223 primName, scene.RegionInfo.RegionName, fileName); 220 primName, scene.RegionInfo.RegionName, fileName);
224 221
225 List<EntityBase> entityList = scene.GetEntities(); 222 EntityBase[] entityList = scene.GetEntities();
226 List<EntityBase> primList = new List<EntityBase>(); 223 List<EntityBase> primList = new List<EntityBase>();
227 224
228 foreach (EntityBase ent in entityList) 225 foreach (EntityBase ent in entityList)
@@ -236,10 +233,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
236 } 233 }
237 } 234 }
238 235
239 SavePrimListToXml2(primList, fileName); 236 SavePrimListToXml2(primList.ToArray(), fileName);
240 } 237 }
241 238
242 public static void SavePrimListToXml2(List<EntityBase> entityList, string fileName) 239 public static void SavePrimListToXml2(EntityBase[] entityList, string fileName)
243 { 240 {
244 FileStream file = new FileStream(fileName, FileMode.Create); 241 FileStream file = new FileStream(fileName, FileMode.Create);
245 try 242 try
@@ -260,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
260 } 257 }
261 } 258 }
262 259
263 public static void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max) 260 public static void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max)
264 { 261 {
265 int primCount = 0; 262 int primCount = 0;
266 stream.WriteLine("<scene>\n"); 263 stream.WriteLine("<scene>\n");
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
index e140cd5..3a0dd00 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
@@ -28,20 +28,21 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using NUnit.Framework;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
33 34using OpenSim.Tests.Common;
34using NUnit.Framework;
35 35
36namespace OpenSim.Region.Framework.Scenes.Tests 36namespace OpenSim.Region.Framework.Scenes.Tests
37{ 37{
38 [TestFixture] 38 [TestFixture]
39 public class BorderTests 39 public class BorderTests
40 { 40 {
41
42 [Test] 41 [Test]
43 public void TestCross() 42 public void TestCross()
44 { 43 {
44 TestHelper.InMethod();
45
45 List<Border> testborders = new List<Border>(); 46 List<Border> testborders = new List<Border>();
46 47
47 Border NorthBorder = new Border(); 48 Border NorthBorder = new Border();
@@ -75,8 +76,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
75 position = new Vector3(200,280,21); 76 position = new Vector3(200,280,21);
76 Assert.That(NorthBorder.TestCross(position)); 77 Assert.That(NorthBorder.TestCross(position));
77 78
78
79
80 // Test automatic border crossing 79 // Test automatic border crossing
81 // by setting the border crossing aabb to be the whole region 80 // by setting the border crossing aabb to be the whole region
82 position = new Vector3(25,25,21); // safely within one 256m region 81 position = new Vector3(25,25,21); // safely within one 256m region
@@ -95,12 +94,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
95 94
96 WestBorder.BorderLine = new Vector3(0, 256, 255); // automatic border cross in the region 95 WestBorder.BorderLine = new Vector3(0, 256, 255); // automatic border cross in the region
97 Assert.That(WestBorder.TestCross(position)); 96 Assert.That(WestBorder.TestCross(position));
98
99 } 97 }
100 98
101 [Test] 99 [Test]
102 public void TestCrossSquare512() 100 public void TestCrossSquare512()
103 { 101 {
102 TestHelper.InMethod();
103
104 List<Border> testborders = new List<Border>(); 104 List<Border> testborders = new List<Border>();
105 105
106 Border NorthBorder = new Border(); 106 Border NorthBorder = new Border();
@@ -174,12 +174,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
174 Assert.That(!b.TestCross(position)); 174 Assert.That(!b.TestCross(position));
175 175
176 } 176 }
177
178 } 177 }
179 178
180 [Test] 179 [Test]
181 public void TestCrossRectangle512x256() 180 public void TestCrossRectangle512x256()
182 { 181 {
182 TestHelper.InMethod();
183
183 List<Border> testborders = new List<Border>(); 184 List<Border> testborders = new List<Border>();
184 185
185 Border NorthBorder = new Border(); 186 Border NorthBorder = new Border();
@@ -258,6 +259,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
258 [Test] 259 [Test]
259 public void TestCrossOdd512x512w256hole() 260 public void TestCrossOdd512x512w256hole()
260 { 261 {
262 TestHelper.InMethod();
263
261 List<Border> testborders = new List<Border>(); 264 List<Border> testborders = new List<Border>();
262 // 512____ 265 // 512____
263 // | | 266 // | |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
index 3e2a2af..b3c3e22 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
@@ -53,7 +53,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
53 public void T010_AddObjects() 53 public void T010_AddObjects()
54 { 54 {
55 TestHelper.InMethod(); 55 TestHelper.InMethod();
56 // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
57 56
58 random = new Random(); 57 random = new Random();
59 SceneObjectGroup found; 58 SceneObjectGroup found;
@@ -89,7 +88,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
89 public void T011_ThreadAddRemoveTest() 88 public void T011_ThreadAddRemoveTest()
90 { 89 {
91 TestHelper.InMethod(); 90 TestHelper.InMethod();
92 // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
93 91
94 // This test adds and removes with mutiple threads, attempting to break the 92 // This test adds and removes with mutiple threads, attempting to break the
95 // uuid and localid dictionary coherence. 93 // uuid and localid dictionary coherence.
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index 0b7608d..e3ef263 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -26,13 +26,13 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using NUnit.Framework; 31using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers; 32using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 33using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
35
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Tests.Common; 37using OpenSim.Tests.Common;
38using OpenSim.Tests.Common.Mock; 38using OpenSim.Tests.Common.Mock;
@@ -260,5 +260,86 @@ namespace OpenSim.Region.Framework.Scenes.Tests
260 && (part4.RotationOffset.W - compareQuaternion.W < 0.00003), 260 && (part4.RotationOffset.W - compareQuaternion.W < 0.00003),
261 "Badness 3"); 261 "Badness 3");
262 } 262 }
263
264 /// <summary>
265 /// Test that a new scene object which is already linked is correctly persisted to the persistence layer.
266 /// </summary>
267 [Test]
268 public void TestNewSceneObjectLinkPersistence()
269 {
270 TestHelper.InMethod();
271 //log4net.Config.XmlConfigurator.Configure();
272
273 TestScene scene = SceneSetupHelpers.SetupScene();
274
275 string rootPartName = "rootpart";
276 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
277 string linkPartName = "linkpart";
278 UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000");
279
280 SceneObjectPart rootPart
281 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
282 { Name = rootPartName, UUID = rootPartUuid };
283 SceneObjectPart linkPart
284 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
285 { Name = linkPartName, UUID = linkPartUuid };
286
287 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
288 sog.AddPart(linkPart);
289 scene.AddNewSceneObject(sog, true);
290
291 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked
292 // scene backup thread.
293 scene.Backup(true);
294
295 List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID);
296
297 Assert.That(storedObjects.Count, Is.EqualTo(1));
298 Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2));
299 Assert.That(storedObjects[0].Children.ContainsKey(rootPartUuid));
300 Assert.That(storedObjects[0].Children.ContainsKey(linkPartUuid));
301 }
302
303 /// <summary>
304 /// Test that a delink of a previously linked object is correctly persisted to the database
305 /// </summary>
306 [Test]
307 public void TestDelinkPersistence()
308 {
309 TestHelper.InMethod();
310 //log4net.Config.XmlConfigurator.Configure();
311
312 TestScene scene = SceneSetupHelpers.SetupScene();
313
314 string rootPartName = "rootpart";
315 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
316 string linkPartName = "linkpart";
317 UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000");
318
319 SceneObjectPart rootPart
320 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
321 { Name = rootPartName, UUID = rootPartUuid };
322 SceneObjectPart linkPart
323 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
324 { Name = linkPartName, UUID = linkPartUuid };
325
326 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
327 sog.AddPart(linkPart);
328 scene.AddNewSceneObject(sog, true);
329
330 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked
331 // scene backup thread.
332 scene.Backup(true);
333
334 // These changes should occur immediately without waiting for a backup pass
335 SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
336 scene.DeleteSceneObject(groupToDelete, false);
337
338 List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID);
339
340 Assert.That(storedObjects.Count, Is.EqualTo(1));
341 Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1));
342 Assert.That(storedObjects[0].Children.ContainsKey(rootPartUuid));
343 }
263 } 344 }
264} 345}
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index e39a362..ab5968c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -173,6 +173,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
173 173
174 Assert.That(neighbours.Count, Is.EqualTo(2)); 174 Assert.That(neighbours.Count, Is.EqualTo(2));
175 } 175 }
176
176 public void fixNullPresence() 177 public void fixNullPresence()
177 { 178 {
178 string firstName = "testfirstname"; 179 string firstName = "testfirstname";
@@ -389,8 +390,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
389 390
390 public static string GetRandomCapsObjectPath() 391 public static string GetRandomCapsObjectPath()
391 { 392 {
392 TestHelper.InMethod();
393
394 UUID caps = UUID.Random(); 393 UUID caps = UUID.Random();
395 string capsPath = caps.ToString(); 394 string capsPath = caps.ToString();
396 capsPath = capsPath.Remove(capsPath.Length - 4, 4); 395 capsPath = capsPath.Remove(capsPath.Length - 4, 4);
@@ -429,4 +428,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
429 return name.ToString(); 428 return name.ToString();
430 } 429 }
431 } 430 }
432} 431} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index da8199d..5e491c2 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -75,7 +75,9 @@ namespace OpenSim.Region.Framework.Tests
75 75
76 protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) 76 protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part)
77 { 77 {
78 AssetNotecard nc = new AssetNotecard("Hello World!"); 78 AssetNotecard nc = new AssetNotecard();
79 nc.BodyText = "Hello World!";
80 nc.Encode();
79 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); 81 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
80 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); 82 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
81 AssetBase ncAsset 83 AssetBase ncAsset
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 6793ef6..159af79 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -375,8 +375,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
375 375
376 private void IRC_SendNamesReply() 376 private void IRC_SendNamesReply()
377 { 377 {
378 List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>(); 378 EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>();
379
380 foreach (EntityBase user in users) 379 foreach (EntityBase user in users)
381 { 380 {
382 SendServerCommand("353 " + m_nick + " = " + IrcRegionName + " :" + user.Name.Replace(" ", "")); 381 SendServerCommand("353 " + m_nick + " = " + IrcRegionName + " :" + user.Name.Replace(" ", ""));
@@ -386,8 +385,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
386 385
387 private void IRC_SendWhoReply() 386 private void IRC_SendWhoReply()
388 { 387 {
389 List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>(); 388 EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>();
390
391 foreach (EntityBase user in users) 389 foreach (EntityBase user in users)
392 { 390 {
393 /*SendServerCommand(String.Format("352 {0} {1} {2} {3} {4} {5} :0 {6}", IrcRegionName, 391 /*SendServerCommand(String.Format("352 {0} {1} {2} {3} {4} {5} :0 {6}", IrcRegionName,
@@ -415,11 +413,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
415 413
416 private void IRC_SendReplyUsers() 414 private void IRC_SendReplyUsers()
417 { 415 {
418 List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>(); 416 EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>();
419 417
420 SendServerCommand("392 :UserID Terminal Host"); 418 SendServerCommand("392 :UserID Terminal Host");
421 419
422 if (users.Count == 0) 420 if (users.Length == 0)
423 { 421 {
424 SendServerCommand("395 :Nobody logged in"); 422 SendServerCommand("395 :Nobody logged in");
425 return; 423 return;
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs
index de1e01c..d21b652 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs
@@ -111,7 +111,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
111 } 111 }
112 112
113 // Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash 113 // Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash
114 public System.Collections.ArrayList CheckForMissingEntities(System.Collections.Generic.List<EntityBase> currList) 114 public System.Collections.ArrayList CheckForMissingEntities(EntityBase[] currList)
115 { 115 {
116 System.Collections.ArrayList missingList = new System.Collections.ArrayList(); 116 System.Collections.ArrayList missingList = new System.Collections.ArrayList();
117 SceneObjectGroup temp = null; 117 SceneObjectGroup temp = null;
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
index e5fcb54..fd59138 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
@@ -300,7 +300,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
300 } 300 }
301 } 301 }
302 m_log.Info("[CMMODEL]: Scheduling a backup of new scene object groups to backup."); 302 m_log.Info("[CMMODEL]: Scheduling a backup of new scene object groups to backup.");
303 scene.Backup(); 303 scene.Backup(true);
304 } 304 }
305 305
306 /// <summary> 306 /// <summary>
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
index 2730eee..49d20e1 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
@@ -127,7 +127,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
127 /// </summary> 127 /// </summary>
128 public void FindDifferences() 128 public void FindDifferences()
129 { 129 {
130 System.Collections.Generic.List<EntityBase> sceneEntityList = m_Entity.Scene.GetEntities(); 130 List<EntityBase> sceneEntityList = new List<EntityBase>(m_Entity.Scene.GetEntities());
131 DiffersFromSceneGroup = false; 131 DiffersFromSceneGroup = false;
132 // if group is not contained in scene's list 132 // if group is not contained in scene's list
133 if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID)) 133 if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID))
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
index 6ba5ccf..140264b 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
@@ -41,12 +41,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
41 private readonly Scene m_scene; 41 private readonly Scene m_scene;
42 private readonly IEnumerator<EntityBase> m_sogEnum; 42 private readonly IEnumerator<EntityBase> m_sogEnum;
43 private readonly ISecurityCredential m_security; 43 private readonly ISecurityCredential m_security;
44 private readonly List<EntityBase> m_entities;
44 45
45 public IObjEnum(Scene scene, ISecurityCredential security) 46 public IObjEnum(Scene scene, ISecurityCredential security)
46 { 47 {
47 m_scene = scene; 48 m_scene = scene;
48 m_security = security; 49 m_security = security;
49 m_sogEnum = m_scene.Entities.GetAllByType<SceneObjectGroup>().GetEnumerator(); 50 m_entities = new List<EntityBase>(m_scene.Entities.GetEntities());
51 m_sogEnum = m_entities.GetEnumerator();
50 } 52 }
51 53
52 public void Dispose() 54 public void Dispose()
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
index 45bb005..f2324d2 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
@@ -205,10 +205,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
205 { 205 {
206 get 206 get
207 { 207 {
208 List<EntityBase> ents = m_internalScene.Entities.GetAllByType<ScenePresence>(); 208 EntityBase[] ents = m_internalScene.Entities.GetAllByType<ScenePresence>();
209 IAvatar[] rets = new IAvatar[ents.Count]; 209 IAvatar[] rets = new IAvatar[ents.Length];
210 210
211 for (int i = 0; i < ents.Count; i++) 211 for (int i = 0; i < ents.Length; i++)
212 { 212 {
213 EntityBase ent = ents[i]; 213 EntityBase ent = ents[i];
214 rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security); 214 rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security);
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index 672109b..122ad40 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -133,7 +133,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
133 m_firstEmptyCompileQueue = false; 133 m_firstEmptyCompileQueue = false;
134 m_oarFileLoading = false; 134 m_oarFileLoading = false;
135 135
136 m_scene.Backup(); 136 m_scene.Backup(false);
137 137
138 c.From = "RegionReady"; 138 c.From = "RegionReady";
139 if (m_lastOarLoadedOk) 139 if (m_lastOarLoadedOk)
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
index 3ed338b..421da36 100644
--- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
@@ -568,8 +568,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
568 { 568 {
569 m_copse = new List<Copse>(); 569 m_copse = new List<Copse>();
570 570
571 List<EntityBase> objs = m_scene.GetEntities(); 571 EntityBase[] objs = m_scene.GetEntities();
572
573 foreach (EntityBase obj in objs) 572 foreach (EntityBase obj in objs)
574 { 573 {
575 if (obj is SceneObjectGroup) 574 if (obj is SceneObjectGroup)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b51b410..a9c5d10 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3971,9 +3971,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3971 } 3971 }
3972 3972
3973 3973
3974 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); 3974 pinfo = World.PresenceService.GetAgent(uuid);
3975 if (pinfos != null && pinfos.Length > 0)
3976 pinfo = pinfos[0];
3977 3975
3978 ce = new UserInfoCacheEntry(); 3976 ce = new UserInfoCacheEntry();
3979 ce.time = Util.EnvironmentTickCount(); 3977 ce.time = Util.EnvironmentTickCount();
@@ -3991,11 +3989,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3991 3989
3992 if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) 3990 if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000)
3993 { 3991 {
3994 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); 3992 pinfo = World.PresenceService.GetAgent(uuid);
3995 if (pinfos != null && pinfos.Length > 0)
3996 pinfo = pinfos[0];
3997 else
3998 pinfo = null;
3999 3993
4000 ce.time = Util.EnvironmentTickCount(); 3994 ce.time = Util.EnvironmentTickCount();
4001 ce.pinfo = pinfo; 3995 ce.pinfo = pinfo;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 5c2abd5..2b67e84 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -286,7 +286,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
286 } 286 }
287 else 287 else
288 { 288 {
289 Entities = m_CmdManager.m_ScriptEngine.World.GetEntities(); 289 Entities = new List<EntityBase>(m_CmdManager.m_ScriptEngine.World.GetEntities());
290 } 290 }
291 SceneObjectPart SensePoint = ts.host; 291 SceneObjectPart SensePoint = ts.host;
292 292
diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
new file mode 100644
index 0000000..39baa32
--- /dev/null
+++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
@@ -0,0 +1,79 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Net;
32using System.Reflection;
33using Nini.Config;
34using log4net;
35using OpenSim.Server.Base;
36using OpenSim.Services.Interfaces;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Server.Handlers.Base;
39
40namespace OpenSim.Server.Handlers.Hypergrid
41{
42 public class HeloServiceInConnector : ServiceConnector
43 {
44 public HeloServiceInConnector(IConfigSource config, IHttpServer server, string configName) :
45 base(config, server, configName)
46 {
47 server.AddStreamHandler(new HeloServerGetHandler("opensim-robust"));
48 }
49 }
50
51 public class HeloServerGetHandler : BaseStreamHandler
52 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54
55 private string m_HandlersType;
56
57 public HeloServerGetHandler(string handlersType) :
58 base("GET", "/helo")
59 {
60 m_HandlersType = handlersType;
61 }
62
63 public override byte[] Handle(string path, Stream requestData,
64 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
65 {
66 return OKResponse(httpResponse);
67 }
68
69 private byte[] OKResponse(OSHttpResponse httpResponse)
70 {
71 m_log.Debug("[HELO]: hi, I was called");
72 httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType);
73 httpResponse.StatusCode = (int)HttpStatusCode.OK;
74 httpResponse.StatusDescription = "OK";
75 return new byte[0];
76 }
77
78 }
79}
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
index e50481a..d10d6fc 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
@@ -54,9 +54,12 @@ namespace OpenSim.Server.Handlers.Hypergrid
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 private IUserAgentService m_UserAgentService; 55 private IUserAgentService m_UserAgentService;
56 56
57 public HomeAgentHandler(IUserAgentService userAgentService) 57 private string m_LoginServerIP;
58
59 public HomeAgentHandler(IUserAgentService userAgentService, string loginServerIP)
58 { 60 {
59 m_UserAgentService = userAgentService; 61 m_UserAgentService = userAgentService;
62 m_LoginServerIP = loginServerIP;
60 } 63 }
61 64
62 public Hashtable Handler(Hashtable request) 65 public Hashtable Handler(Hashtable request)
@@ -120,6 +123,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
120 string regionname = string.Empty; 123 string regionname = string.Empty;
121 string gatekeeper_host = string.Empty; 124 string gatekeeper_host = string.Empty;
122 int gatekeeper_port = 0; 125 int gatekeeper_port = 0;
126 IPEndPoint client_ipaddress = null;
123 127
124 if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null) 128 if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null)
125 gatekeeper_host = args["gatekeeper_host"].AsString(); 129 gatekeeper_host = args["gatekeeper_host"].AsString();
@@ -144,6 +148,24 @@ namespace OpenSim.Server.Handlers.Hypergrid
144 if (args.ContainsKey("destination_name") && args["destination_name"] != null) 148 if (args.ContainsKey("destination_name") && args["destination_name"] != null)
145 regionname = args["destination_name"].ToString(); 149 regionname = args["destination_name"].ToString();
146 150
151 if (args.ContainsKey("client_ip") && args["client_ip"] != null)
152 {
153 string ip_str = args["client_ip"].ToString();
154 try
155 {
156 string callerIP = Util.GetCallerIP(request);
157 // Verify if this caller has authority to send the client IP
158 if (callerIP == m_LoginServerIP)
159 client_ipaddress = new IPEndPoint(IPAddress.Parse(ip_str), 0);
160 else
161 m_log.WarnFormat("[HOME AGENT HANDLER]: Unauthorized machine {0} tried to set client ip to {1}", callerIP, ip_str);
162 }
163 catch
164 {
165 m_log.DebugFormat("[HOME AGENT HANDLER]: Exception parsing client ip address from {0}", ip_str);
166 }
167 }
168
147 GridRegion destination = new GridRegion(); 169 GridRegion destination = new GridRegion();
148 destination.RegionID = uuid; 170 destination.RegionID = uuid;
149 destination.RegionLocX = x; 171 destination.RegionLocX = x;
@@ -166,7 +188,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
166 OSDMap resp = new OSDMap(2); 188 OSDMap resp = new OSDMap(2);
167 string reason = String.Empty; 189 string reason = String.Empty;
168 190
169 bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, out reason); 191 bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, client_ipaddress, out reason);
170 192
171 resp["reason"] = OSD.FromString(reason); 193 resp["reason"] = OSD.FromString(reason);
172 resp["success"] = OSD.FromBoolean(result); 194 resp["success"] = OSD.FromBoolean(result);
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
index 6b1152b..70157d5 100644
--- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
@@ -66,13 +66,15 @@ namespace OpenSim.Server.Handlers.Hypergrid
66 if (m_HomeUsersService == null) 66 if (m_HomeUsersService == null)
67 throw new Exception("UserAgent server connector cannot proceed because of missing service"); 67 throw new Exception("UserAgent server connector cannot proceed because of missing service");
68 68
69 string loginServerIP = gridConfig.GetString("LoginServerIP", "127.0.0.1");
70
69 server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false); 71 server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false);
70 server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false); 72 server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false);
71 server.AddXmlRPCHandler("verify_agent", VerifyAgent, false); 73 server.AddXmlRPCHandler("verify_agent", VerifyAgent, false);
72 server.AddXmlRPCHandler("verify_client", VerifyClient, false); 74 server.AddXmlRPCHandler("verify_client", VerifyClient, false);
73 server.AddXmlRPCHandler("logout_agent", LogoutAgent, false); 75 server.AddXmlRPCHandler("logout_agent", LogoutAgent, false);
74 76
75 server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService).Handler); 77 server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP).Handler);
76 } 78 }
77 79
78 public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient) 80 public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient)
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 392927a..2997430 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -179,7 +179,7 @@ namespace OpenSim.Server.Handlers.Simulation
179 resp["reason"] = OSD.FromString(reason); 179 resp["reason"] = OSD.FromString(reason);
180 resp["success"] = OSD.FromBoolean(result); 180 resp["success"] = OSD.FromBoolean(result);
181 // Let's also send out the IP address of the caller back to the caller (HG 1.5) 181 // Let's also send out the IP address of the caller back to the caller (HG 1.5)
182 resp["your_ip"] = OSD.FromString(GetCallerIP(request)); 182 resp["your_ip"] = OSD.FromString(Util.GetCallerIP(request));
183 183
184 // TODO: add reason if not String.Empty? 184 // TODO: add reason if not String.Empty?
185 responsedata["int_response_code"] = HttpStatusCode.OK; 185 responsedata["int_response_code"] = HttpStatusCode.OK;
@@ -355,23 +355,6 @@ namespace OpenSim.Server.Handlers.Simulation
355 m_SimulationService.ReleaseAgent(regionID, id, ""); 355 m_SimulationService.ReleaseAgent(regionID, id, "");
356 } 356 }
357 357
358 private string GetCallerIP(Hashtable req)
359 {
360 if (req.ContainsKey("headers"))
361 {
362 try
363 {
364 Hashtable headers = (Hashtable)req["headers"];
365 if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null)
366 return headers["remote_addr"].ToString();
367 }
368 catch (Exception e)
369 {
370 m_log.WarnFormat("[AGENT HANDLER]: exception in GetCallerIP: {0}", e.Message);
371 }
372 }
373 return string.Empty;
374 }
375 } 358 }
376 359
377} 360}
diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
index 34df54a..5c31639 100644
--- a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
@@ -32,6 +32,8 @@ using System.Collections.Generic;
32using System.Reflection; 32using System.Reflection;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
35using OpenSim.Services.Connectors.Hypergrid;
36using OpenSim.Services.Connectors.SimianGrid;
35 37
36namespace OpenSim.Services.Connectors 38namespace OpenSim.Services.Connectors
37{ 39{
@@ -41,7 +43,7 @@ namespace OpenSim.Services.Connectors
41 LogManager.GetLogger( 43 LogManager.GetLogger(
42 MethodBase.GetCurrentMethod().DeclaringType); 44 MethodBase.GetCurrentMethod().DeclaringType);
43 45
44 private Dictionary<string, AssetServicesConnector> m_connectors = new Dictionary<string, AssetServicesConnector>(); 46 private Dictionary<string, IAssetService> m_connectors = new Dictionary<string, IAssetService>();
45 47
46 public HGAssetServiceConnector(IConfigSource source) 48 public HGAssetServiceConnector(IConfigSource source)
47 { 49 {
@@ -81,7 +83,7 @@ namespace OpenSim.Services.Connectors
81 83
82 private IAssetService GetConnector(string url) 84 private IAssetService GetConnector(string url)
83 { 85 {
84 AssetServicesConnector connector = null; 86 IAssetService connector = null;
85 lock (m_connectors) 87 lock (m_connectors)
86 { 88 {
87 if (m_connectors.ContainsKey(url)) 89 if (m_connectors.ContainsKey(url))
@@ -90,12 +92,17 @@ namespace OpenSim.Services.Connectors
90 } 92 }
91 else 93 else
92 { 94 {
93 // We're instantiating this class explicitly, but this won't 95 // Still not as flexible as I would like this to be,
94 // work in general, because the remote grid may be running 96 // but good enough for now
95 // an asset server that has a different protocol. 97 string connectorType = new HeloServicesConnector(url).Helo();
96 // Eventually we will want a piece of protocol asking 98 m_log.DebugFormat("[HG ASSET SERVICE]: HELO returned {0}", connectorType);
97 // the remote server about its kind. Definitely cool thing to do! 99 if (connectorType == "opensim-simian")
98 connector = new AssetServicesConnector(url); 100 {
101 connector = new SimianAssetServiceConnector(url);
102 }
103 else
104 connector = new AssetServicesConnector(url);
105
99 m_connectors.Add(url, connector); 106 m_connectors.Add(url, connector);
100 } 107 }
101 } 108 }
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
new file mode 100644
index 0000000..7b166c1
--- /dev/null
+++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
@@ -0,0 +1,75 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using log4net;
29using System;
30using System.Net;
31using System.Reflection;
32using Nini.Config;
33
34namespace OpenSim.Services.Connectors
35{
36 public class HeloServicesConnector
37 {
38 private static readonly ILog m_log =
39 LogManager.GetLogger(
40 MethodBase.GetCurrentMethod().DeclaringType);
41
42 private string m_ServerURI = String.Empty;
43
44 public HeloServicesConnector()
45 {
46 }
47
48 public HeloServicesConnector(string serverURI)
49 {
50 m_ServerURI = serverURI.TrimEnd('/');
51 }
52
53
54 public virtual string Helo()
55 {
56 HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo");
57
58 try
59 {
60 WebResponse response = req.GetResponse();
61 if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null
62 return string.Empty;
63 return response.Headers.Get("X-Handlers-Provided");
64 }
65 catch (Exception e)
66 {
67 m_log.DebugFormat("[HELO SERVICE]: Unable to perform HELO request to {0}: {1}", m_ServerURI, e.Message);
68 }
69
70 // fail
71 return string.Empty;
72 }
73
74 }
75}
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 7fa086a..6d3c64a 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -66,20 +66,34 @@ namespace OpenSim.Services.Connectors.Hypergrid
66 { 66 {
67 m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message); 67 m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message);
68 } 68 }
69 m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL);
69 } 70 }
70 71
71 public UserAgentServiceConnector(IConfigSource config) 72 public UserAgentServiceConnector(IConfigSource config)
72 { 73 {
73 } 74 IConfig serviceConfig = config.Configs["UserAgentService"];
75 if (serviceConfig == null)
76 {
77 m_log.Error("[USER AGENT CONNECTOR]: UserAgentService missing from ini");
78 throw new Exception("UserAgent connector init error");
79 }
74 80
75 public bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint ipaddress, out string reason) 81 string serviceURI = serviceConfig.GetString("UserAgentServerURI",
76 { 82 String.Empty);
77 // not available over remote calls 83
78 reason = "Method not available over remote calls"; 84 if (serviceURI == String.Empty)
79 return false; 85 {
86 m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService");
87 throw new Exception("UserAgent connector init error");
88 }
89 m_ServerURL = serviceURI;
90
91 m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL);
80 } 92 }
81 93
82 public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) 94
95 // The Login service calls this interface with a non-null [client] ipaddress
96 public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress, out string reason)
83 { 97 {
84 reason = String.Empty; 98 reason = String.Empty;
85 99
@@ -90,7 +104,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
90 return false; 104 return false;
91 } 105 }
92 106
93 string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/"; 107 string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/";
94 108
95 Console.WriteLine(" >>> LoginAgentToGrid <<< " + uri); 109 Console.WriteLine(" >>> LoginAgentToGrid <<< " + uri);
96 110
@@ -102,7 +116,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
102 //AgentCreateRequest.Headers.Add("Authorization", authKey); 116 //AgentCreateRequest.Headers.Add("Authorization", authKey);
103 117
104 // Fill it in 118 // Fill it in
105 OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination); 119 OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination, ipaddress);
106 120
107 string strBuffer = ""; 121 string strBuffer = "";
108 byte[] buffer = new byte[1]; 122 byte[] buffer = new byte[1];
@@ -199,7 +213,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
199 213
200 } 214 }
201 215
202 protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination) 216
217 // The simulators call this interface
218 public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason)
219 {
220 return LoginAgentToGrid(aCircuit, gatekeeper, destination, null, out reason);
221 }
222
223 protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress)
203 { 224 {
204 OSDMap args = null; 225 OSDMap args = null;
205 try 226 try
@@ -217,6 +238,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
217 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); 238 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
218 args["destination_name"] = OSD.FromString(destination.RegionName); 239 args["destination_name"] = OSD.FromString(destination.RegionName);
219 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); 240 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
241 if (ipaddress != null)
242 args["client_ip"] = OSD.FromString(ipaddress.Address.ToString());
220 243
221 return args; 244 return args;
222 } 245 }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
index a871d07..67a06f3 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
@@ -26,11 +26,9 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
30using System.Reflection; 29using System.Reflection;
31using OpenSim.Framework; 30using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes; 31using OpenSim.Region.Framework.Scenes;
33using OpenSim.Services.Interfaces;
34using OpenMetaverse; 32using OpenMetaverse;
35using log4net; 33using log4net;
36 34
@@ -71,7 +69,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
71 public void OnMakeRootAgent(ScenePresence sp) 69 public void OnMakeRootAgent(ScenePresence sp)
72 { 70 {
73 m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); 71 m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
74 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); 72 Util.FireAndForget(delegate(object o)
73 {
74 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
75 });
75 } 76 }
76 77
77 public void OnNewClient(IClientAPI client) 78 public void OnNewClient(IClientAPI client)
@@ -107,7 +108,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
107 108
108 void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID) 109 void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID)
109 { 110 {
110 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); 111 // Asynchronously update the position stored in the session table for this agent
112 Util.FireAndForget(delegate(object o)
113 {
114 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
115 });
111 } 116 }
112 } 117 }
113} 118}
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 3a4f84f..30d3147 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
55 55
56 private string m_serverUrl = String.Empty; 56 private string m_serverUrl = String.Empty;
57 private IImprovedAssetCache m_cache; 57 private IImprovedAssetCache m_cache;
58 private bool m_Enabled = false;
58 59
59 #region ISharedRegionModule 60 #region ISharedRegionModule
60 61
@@ -73,18 +74,34 @@ namespace OpenSim.Services.Connectors.SimianGrid
73 74
74 public SimianAssetServiceConnector() { } 75 public SimianAssetServiceConnector() { }
75 public string Name { get { return "SimianAssetServiceConnector"; } } 76 public string Name { get { return "SimianAssetServiceConnector"; } }
76 public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IAssetService>(this); } } 77 public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IAssetService>(this); } }
77 public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IAssetService>(this); } } 78 public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IAssetService>(this); } }
78 79
79 #endregion ISharedRegionModule 80 #endregion ISharedRegionModule
80 81
81 public SimianAssetServiceConnector(IConfigSource source) 82 public SimianAssetServiceConnector(IConfigSource source)
82 { 83 {
83 Initialise(source); 84 CommonInit(source);
85 }
86
87 public SimianAssetServiceConnector(string url)
88 {
89 m_serverUrl = url;
84 } 90 }
85 91
86 public void Initialise(IConfigSource source) 92 public void Initialise(IConfigSource source)
87 { 93 {
94 IConfig moduleConfig = source.Configs["Modules"];
95 if (moduleConfig != null)
96 {
97 string name = moduleConfig.GetString("AssetServices", "");
98 if (name == Name)
99 CommonInit(source);
100 }
101 }
102
103 private void CommonInit(IConfigSource source)
104 {
88 IConfig gridConfig = source.Configs["AssetService"]; 105 IConfig gridConfig = source.Configs["AssetService"];
89 if (gridConfig != null) 106 if (gridConfig != null)
90 { 107 {
@@ -99,12 +116,20 @@ namespace OpenSim.Services.Connectors.SimianGrid
99 116
100 if (String.IsNullOrEmpty(m_serverUrl)) 117 if (String.IsNullOrEmpty(m_serverUrl))
101 m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector"); 118 m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector");
119 else
120 m_Enabled = true;
102 } 121 }
103 122
104 #region IAssetService 123 #region IAssetService
105 124
106 public AssetBase Get(string id) 125 public AssetBase Get(string id)
107 { 126 {
127 if (String.IsNullOrEmpty(m_serverUrl))
128 {
129 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
130 throw new InvalidOperationException();
131 }
132
108 // Cache fetch 133 // Cache fetch
109 if (m_cache != null) 134 if (m_cache != null)
110 { 135 {
@@ -131,6 +156,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
131 /// <returns></returns> 156 /// <returns></returns>
132 public AssetMetadata GetMetadata(string id) 157 public AssetMetadata GetMetadata(string id)
133 { 158 {
159 if (String.IsNullOrEmpty(m_serverUrl))
160 {
161 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
162 throw new InvalidOperationException();
163 }
164
134 AssetMetadata metadata = null; 165 AssetMetadata metadata = null;
135 166
136 // Cache fetch 167 // Cache fetch
@@ -202,6 +233,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
202 /// <returns>True if the id was parseable, false otherwise</returns> 233 /// <returns>True if the id was parseable, false otherwise</returns>
203 public bool Get(string id, Object sender, AssetRetrieved handler) 234 public bool Get(string id, Object sender, AssetRetrieved handler)
204 { 235 {
236 if (String.IsNullOrEmpty(m_serverUrl))
237 {
238 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
239 throw new InvalidOperationException();
240 }
241
205 // Cache fetch 242 // Cache fetch
206 if (m_cache != null) 243 if (m_cache != null)
207 { 244 {
@@ -232,6 +269,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
232 /// <returns></returns> 269 /// <returns></returns>
233 public string Store(AssetBase asset) 270 public string Store(AssetBase asset)
234 { 271 {
272 if (String.IsNullOrEmpty(m_serverUrl))
273 {
274 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
275 throw new InvalidOperationException();
276 }
277
235 bool storedInCache = false; 278 bool storedInCache = false;
236 string errorMessage = null; 279 string errorMessage = null;
237 280
@@ -364,6 +407,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
364 /// <returns></returns> 407 /// <returns></returns>
365 public bool Delete(string id) 408 public bool Delete(string id)
366 { 409 {
410 if (String.IsNullOrEmpty(m_serverUrl))
411 {
412 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
413 throw new InvalidOperationException();
414 }
415
367 //string errorMessage = String.Empty; 416 //string errorMessage = String.Empty;
368 string url = m_serverUrl + id; 417 string url = m_serverUrl + id;
369 418
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
index f1c2575..51a09f8 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
@@ -51,6 +51,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
51 MethodBase.GetCurrentMethod().DeclaringType); 51 MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 private string m_serverUrl = String.Empty; 53 private string m_serverUrl = String.Empty;
54 private bool m_Enabled = false;
54 55
55 #region ISharedRegionModule 56 #region ISharedRegionModule
56 57
@@ -61,18 +62,29 @@ namespace OpenSim.Services.Connectors.SimianGrid
61 62
62 public SimianAuthenticationServiceConnector() { } 63 public SimianAuthenticationServiceConnector() { }
63 public string Name { get { return "SimianAuthenticationServiceConnector"; } } 64 public string Name { get { return "SimianAuthenticationServiceConnector"; } }
64 public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IAuthenticationService>(this); } } 65 public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IAuthenticationService>(this); } }
65 public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IAuthenticationService>(this); } } 66 public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IAuthenticationService>(this); } }
66 67
67 #endregion ISharedRegionModule 68 #endregion ISharedRegionModule
68 69
69 public SimianAuthenticationServiceConnector(IConfigSource source) 70 public SimianAuthenticationServiceConnector(IConfigSource source)
70 { 71 {
71 Initialise(source); 72 CommonInit(source);
72 } 73 }
73 74
74 public void Initialise(IConfigSource source) 75 public void Initialise(IConfigSource source)
75 { 76 {
77 IConfig moduleConfig = source.Configs["Modules"];
78 if (moduleConfig != null)
79 {
80 string name = moduleConfig.GetString("AuthenticationServices", "");
81 if (name == Name)
82 CommonInit(source);
83 }
84 }
85
86 private void CommonInit(IConfigSource source)
87 {
76 IConfig gridConfig = source.Configs["AuthenticationService"]; 88 IConfig gridConfig = source.Configs["AuthenticationService"];
77 if (gridConfig != null) 89 if (gridConfig != null)
78 { 90 {
@@ -82,6 +94,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
82 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) 94 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
83 serviceUrl = serviceUrl + '/'; 95 serviceUrl = serviceUrl + '/';
84 m_serverUrl = serviceUrl; 96 m_serverUrl = serviceUrl;
97 m_Enabled = true;
85 } 98 }
86 } 99 }
87 100
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
index c2e20a3..4d0d53e 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
@@ -28,8 +28,6 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.IO;
32using System.Net;
33using System.Reflection; 31using System.Reflection;
34using log4net; 32using log4net;
35using Mono.Addins; 33using Mono.Addins;
@@ -37,7 +35,6 @@ using Nini.Config;
37using OpenSim.Framework; 35using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
40using OpenSim.Server.Base;
41using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
42using OpenMetaverse; 39using OpenMetaverse;
43using OpenMetaverse.StructuredData; 40using OpenMetaverse.StructuredData;
@@ -56,6 +53,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
56// private static string ZeroID = UUID.Zero.ToString(); 53// private static string ZeroID = UUID.Zero.ToString();
57 54
58 private string m_serverUrl = String.Empty; 55 private string m_serverUrl = String.Empty;
56 private bool m_Enabled = false;
59 57
60 #region ISharedRegionModule 58 #region ISharedRegionModule
61 59
@@ -66,18 +64,29 @@ namespace OpenSim.Services.Connectors.SimianGrid
66 64
67 public SimianAvatarServiceConnector() { } 65 public SimianAvatarServiceConnector() { }
68 public string Name { get { return "SimianAvatarServiceConnector"; } } 66 public string Name { get { return "SimianAvatarServiceConnector"; } }
69 public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IAvatarService>(this); } } 67 public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IAvatarService>(this); } }
70 public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IAvatarService>(this); } } 68 public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IAvatarService>(this); } }
71 69
72 #endregion ISharedRegionModule 70 #endregion ISharedRegionModule
73 71
74 public SimianAvatarServiceConnector(IConfigSource source) 72 public SimianAvatarServiceConnector(IConfigSource source)
75 { 73 {
76 Initialise(source); 74 CommonInit(source);
77 } 75 }
78 76
79 public void Initialise(IConfigSource source) 77 public void Initialise(IConfigSource source)
80 { 78 {
79 IConfig moduleConfig = source.Configs["Modules"];
80 if (moduleConfig != null)
81 {
82 string name = moduleConfig.GetString("AvatarServices", "");
83 if (name == Name)
84 CommonInit(source);
85 }
86 }
87
88 private void CommonInit(IConfigSource source)
89 {
81 IConfig gridConfig = source.Configs["AvatarService"]; 90 IConfig gridConfig = source.Configs["AvatarService"];
82 if (gridConfig != null) 91 if (gridConfig != null)
83 { 92 {
@@ -87,6 +96,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
87 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) 96 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
88 serviceUrl = serviceUrl + '/'; 97 serviceUrl = serviceUrl + '/';
89 m_serverUrl = serviceUrl; 98 m_serverUrl = serviceUrl;
99 m_Enabled = true;
90 } 100 }
91 } 101 }
92 102
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
index 1afb1e1..6f2d735 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
@@ -30,13 +30,10 @@ using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Addins;
34using Nini.Config; 33using Nini.Config;
35using OpenMetaverse; 34using OpenMetaverse;
36using OpenMetaverse.StructuredData; 35using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 36using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
41 38
42using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; 39using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
@@ -46,8 +43,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
46 /// <summary> 43 /// <summary>
47 /// Stores and retrieves friend lists from the SimianGrid backend 44 /// Stores and retrieves friend lists from the SimianGrid backend
48 /// </summary> 45 /// </summary>
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 46 public class SimianFriendsServiceConnector : IFriendsService
50 public class SimianFriendsServiceConnector : IFriendsService, ISharedRegionModule
51 { 47 {
52 private static readonly ILog m_log = 48 private static readonly ILog m_log =
53 LogManager.GetLogger( 49 LogManager.GetLogger(
@@ -55,20 +51,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
55 51
56 private string m_serverUrl = String.Empty; 52 private string m_serverUrl = String.Empty;
57 53
58 #region ISharedRegionModule
59
60 public Type ReplaceableInterface { get { return null; } }
61 public void RegionLoaded(Scene scene) { }
62 public void PostInitialise() { }
63 public void Close() { }
64
65 public SimianFriendsServiceConnector() { }
66 public string Name { get { return "SimianFriendsServiceConnector"; } }
67 public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IFriendsService>(this); } }
68 public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IFriendsService>(this); } }
69
70 #endregion ISharedRegionModule
71
72 public SimianFriendsServiceConnector(IConfigSource source) 54 public SimianFriendsServiceConnector(IConfigSource source)
73 { 55 {
74 Initialise(source); 56 Initialise(source);
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 9d67ccb..4409d5c 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -60,6 +60,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
60 60
61 private string m_serverUrl = String.Empty; 61 private string m_serverUrl = String.Empty;
62 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); 62 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
63 private bool m_Enabled = false;
63 64
64 #region ISharedRegionModule 65 #region ISharedRegionModule
65 66
@@ -72,32 +73,47 @@ namespace OpenSim.Services.Connectors.SimianGrid
72 public string Name { get { return "SimianGridServiceConnector"; } } 73 public string Name { get { return "SimianGridServiceConnector"; } }
73 public void AddRegion(Scene scene) 74 public void AddRegion(Scene scene)
74 { 75 {
76 if (!m_Enabled)
77 return;
78
75 // Every shared region module has to maintain an indepedent list of 79 // Every shared region module has to maintain an indepedent list of
76 // currently running regions 80 // currently running regions
77 lock (m_scenes) 81 lock (m_scenes)
78 m_scenes[scene.RegionInfo.RegionID] = scene; 82 m_scenes[scene.RegionInfo.RegionID] = scene;
79 83
80 if (!String.IsNullOrEmpty(m_serverUrl)) 84 scene.RegisterModuleInterface<IGridService>(this);
81 scene.RegisterModuleInterface<IGridService>(this);
82 } 85 }
83 public void RemoveRegion(Scene scene) 86 public void RemoveRegion(Scene scene)
84 { 87 {
88 if (!m_Enabled)
89 return;
90
85 lock (m_scenes) 91 lock (m_scenes)
86 m_scenes.Remove(scene.RegionInfo.RegionID); 92 m_scenes.Remove(scene.RegionInfo.RegionID);
87 93
88 if (!String.IsNullOrEmpty(m_serverUrl)) 94 scene.UnregisterModuleInterface<IGridService>(this);
89 scene.UnregisterModuleInterface<IGridService>(this);
90 } 95 }
91 96
92 #endregion ISharedRegionModule 97 #endregion ISharedRegionModule
93 98
94 public SimianGridServiceConnector(IConfigSource source) 99 public SimianGridServiceConnector(IConfigSource source)
95 { 100 {
96 Initialise(source); 101 CommonInit(source);
97 } 102 }
98 103
99 public void Initialise(IConfigSource source) 104 public void Initialise(IConfigSource source)
100 { 105 {
106 IConfig moduleConfig = source.Configs["Modules"];
107 if (moduleConfig != null)
108 {
109 string name = moduleConfig.GetString("GridServices", "");
110 if (name == Name)
111 CommonInit(source);
112 }
113 }
114
115 private void CommonInit(IConfigSource source)
116 {
101 IConfig gridConfig = source.Configs["GridService"]; 117 IConfig gridConfig = source.Configs["GridService"];
102 if (gridConfig != null) 118 if (gridConfig != null)
103 { 119 {
@@ -107,6 +123,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
107 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) 123 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
108 serviceUrl = serviceUrl + '/'; 124 serviceUrl = serviceUrl + '/';
109 m_serverUrl = serviceUrl; 125 m_serverUrl = serviceUrl;
126 m_Enabled = true;
110 } 127 }
111 } 128 }
112 129
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index 63aaad7..21ad4ab 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -37,7 +37,6 @@ using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Server.Base;
41using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
42 41
43namespace OpenSim.Services.Connectors.SimianGrid 42namespace OpenSim.Services.Connectors.SimianGrid
@@ -70,6 +69,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
70 private string m_serverUrl = String.Empty; 69 private string m_serverUrl = String.Empty;
71 private string m_userServerUrl = String.Empty; 70 private string m_userServerUrl = String.Empty;
72// private object m_gestureSyncRoot = new object(); 71// private object m_gestureSyncRoot = new object();
72 private bool m_Enabled = false;
73 73
74 #region ISharedRegionModule 74 #region ISharedRegionModule
75 75
@@ -80,18 +80,34 @@ namespace OpenSim.Services.Connectors.SimianGrid
80 80
81 public SimianInventoryServiceConnector() { } 81 public SimianInventoryServiceConnector() { }
82 public string Name { get { return "SimianInventoryServiceConnector"; } } 82 public string Name { get { return "SimianInventoryServiceConnector"; } }
83 public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IInventoryService>(this); } } 83 public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IInventoryService>(this); } }
84 public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IInventoryService>(this); } } 84 public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IInventoryService>(this); } }
85 85
86 #endregion ISharedRegionModule 86 #endregion ISharedRegionModule
87 87
88 public SimianInventoryServiceConnector(IConfigSource source) 88 public SimianInventoryServiceConnector(IConfigSource source)
89 { 89 {
90 Initialise(source); 90 CommonInit(source);
91 }
92
93 public SimianInventoryServiceConnector(string url)
94 {
95 m_serverUrl = url;
91 } 96 }
92 97
93 public void Initialise(IConfigSource source) 98 public void Initialise(IConfigSource source)
94 { 99 {
100 IConfig moduleConfig = source.Configs["Modules"];
101 if (moduleConfig != null)
102 {
103 string name = moduleConfig.GetString("InventoryServices", "");
104 if (name == Name)
105 CommonInit(source);
106 }
107 }
108
109 private void CommonInit(IConfigSource source)
110 {
95 IConfig gridConfig = source.Configs["InventoryService"]; 111 IConfig gridConfig = source.Configs["InventoryService"];
96 if (gridConfig != null) 112 if (gridConfig != null)
97 { 113 {
@@ -107,7 +123,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
107 { 123 {
108 serviceUrl = gridConfig.GetString("UserAccountServerURI"); 124 serviceUrl = gridConfig.GetString("UserAccountServerURI");
109 if (!String.IsNullOrEmpty(serviceUrl)) 125 if (!String.IsNullOrEmpty(serviceUrl))
126 {
110 m_userServerUrl = serviceUrl; 127 m_userServerUrl = serviceUrl;
128 m_Enabled = true;
129 }
111 } 130 }
112 } 131 }
113 } 132 }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
index 778f3f4..a344594 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
@@ -28,17 +28,14 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.Net;
32using System.Reflection; 31using System.Reflection;
33using log4net; 32using log4net;
34using Mono.Addins; 33using Mono.Addins;
35using Nini.Config; 34using Nini.Config;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
41using OpenSim.Server.Base;
42using OpenMetaverse; 39using OpenMetaverse;
43using OpenMetaverse.StructuredData; 40using OpenMetaverse.StructuredData;
44 41
@@ -59,6 +56,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
59 56
60 private string m_serverUrl = String.Empty; 57 private string m_serverUrl = String.Empty;
61 private SimianActivityDetector m_activityDetector; 58 private SimianActivityDetector m_activityDetector;
59 private bool m_Enabled = false;
62 60
63 #region ISharedRegionModule 61 #region ISharedRegionModule
64 62
@@ -71,7 +69,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
71 public string Name { get { return "SimianPresenceServiceConnector"; } } 69 public string Name { get { return "SimianPresenceServiceConnector"; } }
72 public void AddRegion(Scene scene) 70 public void AddRegion(Scene scene)
73 { 71 {
74 if (!String.IsNullOrEmpty(m_serverUrl)) 72 if (m_Enabled)
75 { 73 {
76 scene.RegisterModuleInterface<IPresenceService>(this); 74 scene.RegisterModuleInterface<IPresenceService>(this);
77 scene.RegisterModuleInterface<IGridUserService>(this); 75 scene.RegisterModuleInterface<IGridUserService>(this);
@@ -83,7 +81,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
83 } 81 }
84 public void RemoveRegion(Scene scene) 82 public void RemoveRegion(Scene scene)
85 { 83 {
86 if (!String.IsNullOrEmpty(m_serverUrl)) 84 if (m_Enabled)
87 { 85 {
88 scene.UnregisterModuleInterface<IPresenceService>(this); 86 scene.UnregisterModuleInterface<IPresenceService>(this);
89 scene.UnregisterModuleInterface<IGridUserService>(this); 87 scene.UnregisterModuleInterface<IGridUserService>(this);
@@ -98,11 +96,22 @@ namespace OpenSim.Services.Connectors.SimianGrid
98 96
99 public SimianPresenceServiceConnector(IConfigSource source) 97 public SimianPresenceServiceConnector(IConfigSource source)
100 { 98 {
101 Initialise(source); 99 CommonInit(source);
102 } 100 }
103 101
104 public void Initialise(IConfigSource source) 102 public void Initialise(IConfigSource source)
105 { 103 {
104 IConfig moduleConfig = source.Configs["Modules"];
105 if (moduleConfig != null)
106 {
107 string name = moduleConfig.GetString("PresenceServices", "");
108 if (name == Name)
109 CommonInit(source);
110 }
111 }
112
113 private void CommonInit(IConfigSource source)
114 {
106 IConfig gridConfig = source.Configs["PresenceService"]; 115 IConfig gridConfig = source.Configs["PresenceService"];
107 if (gridConfig != null) 116 if (gridConfig != null)
108 { 117 {
@@ -112,6 +121,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
112 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) 121 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
113 serviceUrl = serviceUrl + '/'; 122 serviceUrl = serviceUrl + '/';
114 m_serverUrl = serviceUrl; 123 m_serverUrl = serviceUrl;
124 m_Enabled = true;
115 } 125 }
116 } 126 }
117 127
@@ -345,25 +355,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
345 return null; 355 return null;
346 } 356 }
347 357
348// private OSDMap GetSessionData(UUID sessionID)
349// {
350// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID);
351//
352// NameValueCollection requestArgs = new NameValueCollection
353// {
354// { "RequestMethod", "GetSession" },
355// { "SessionID", sessionID.ToString() }
356// };
357//
358// OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
359// if (response["Success"].AsBoolean())
360// return response;
361// else
362// m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID);
363//
364// return null;
365// }
366
367 private List<PresenceInfo> GetSessions(UUID userID) 358 private List<PresenceInfo> GetSessions(UUID userID)
368 { 359 {
369 List<PresenceInfo> presences = new List<PresenceInfo>(1); 360 List<PresenceInfo> presences = new List<PresenceInfo>(1);
@@ -416,39 +407,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
416 return success; 407 return success;
417 } 408 }
418 409
419 ///// <summary>
420 ///// Fetch the last known avatar location with GetSession and persist it
421 ///// as user data with AddUserData
422 ///// </summary>
423 //private bool SetLastLocation(UUID sessionID)
424 //{
425 // NameValueCollection requestArgs = new NameValueCollection
426 // {
427 // { "RequestMethod", "GetSession" },
428 // { "SessionID", sessionID.ToString() }
429 // };
430
431 // OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
432 // bool success = response["Success"].AsBoolean();
433
434 // if (success)
435 // {
436 // UUID userID = response["UserID"].AsUUID();
437 // UUID sceneID = response["SceneID"].AsUUID();
438 // Vector3 position = response["ScenePosition"].AsVector3();
439 // Vector3 lookAt = response["SceneLookAt"].AsVector3();
440
441 // return SetLastLocation(userID, sceneID, position, lookAt);
442 // }
443 // else
444 // {
445 // m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve presence information for session " + sessionID +
446 // " while saving last location: " + response["Message"].AsString());
447 // }
448
449 // return success;
450 //}
451
452 private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse, OSDMap userResponse) 410 private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse, OSDMap userResponse)
453 { 411 {
454 if (sessionResponse == null) 412 if (sessionResponse == null)
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
index a817d7c..b7e8538 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
@@ -67,6 +67,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
67 MethodBase.GetCurrentMethod().DeclaringType); 67 MethodBase.GetCurrentMethod().DeclaringType);
68 68
69 private string m_serverUrl = String.Empty; 69 private string m_serverUrl = String.Empty;
70 private bool m_Enabled = false;
70 71
71 #region INonSharedRegionModule 72 #region INonSharedRegionModule
72 73
@@ -76,8 +77,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
76 77
77 public SimianProfiles() { } 78 public SimianProfiles() { }
78 public string Name { get { return "SimianProfiles"; } } 79 public string Name { get { return "SimianProfiles"; } }
79 public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { CheckEstateManager(scene); scene.EventManager.OnClientConnect += ClientConnectHandler; } } 80 public void AddRegion(Scene scene) { if (m_Enabled) { CheckEstateManager(scene); scene.EventManager.OnClientConnect += ClientConnectHandler; } }
80 public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.EventManager.OnClientConnect -= ClientConnectHandler; } } 81 public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.EventManager.OnClientConnect -= ClientConnectHandler; } }
81 82
82 #endregion INonSharedRegionModule 83 #endregion INonSharedRegionModule
83 84
@@ -88,6 +89,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
88 89
89 public void Initialise(IConfigSource source) 90 public void Initialise(IConfigSource source)
90 { 91 {
92 IConfig profileConfig = source.Configs["Profile"];
93 if (profileConfig == null)
94 return;
95
96 if (profileConfig.GetString("Module", String.Empty) != Name)
97 return;
98
91 IConfig gridConfig = source.Configs["UserAccountService"]; 99 IConfig gridConfig = source.Configs["UserAccountService"];
92 if (gridConfig != null) 100 if (gridConfig != null)
93 { 101 {
@@ -283,8 +291,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
283 // Check if the user is online 291 // Check if the user is online
284 if (client.Scene is Scene) 292 if (client.Scene is Scene)
285 { 293 {
286 OpenSim.Services.Interfaces.PresenceInfo[] presences = ((Scene)client.Scene).PresenceService.GetAgents(new string[] { avatarID.ToString() }); 294 OpenSim.Services.Interfaces.PresenceInfo presence = ((Scene)client.Scene).PresenceService.GetAgent(avatarID);
287 if (presences != null && presences.Length > 0) 295 if (presence != null)
288 flags |= ProfileFlags.Online; 296 flags |= ProfileFlags.Online;
289 } 297 }
290 298
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 4c8662f..ddd2322 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -28,7 +28,6 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.IO;
32using System.Reflection; 31using System.Reflection;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
@@ -49,12 +48,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
50 public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule 49 public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule
51 { 50 {
51 private const double CACHE_EXPIRATION_SECONDS = 120.0;
52
52 private static readonly ILog m_log = 53 private static readonly ILog m_log =
53 LogManager.GetLogger( 54 LogManager.GetLogger(
54 MethodBase.GetCurrentMethod().DeclaringType); 55 MethodBase.GetCurrentMethod().DeclaringType);
55 56
56 private string m_serverUrl = String.Empty; 57 private string m_serverUrl = String.Empty;
57 private ExpiringCache<UUID, UserAccount> m_accountCache; 58 private ExpiringCache<UUID, UserAccount> m_accountCache = new ExpiringCache<UUID,UserAccount>();
59 private bool m_Enabled;
58 60
59 #region ISharedRegionModule 61 #region ISharedRegionModule
60 62
@@ -65,18 +67,29 @@ namespace OpenSim.Services.Connectors.SimianGrid
65 67
66 public SimianUserAccountServiceConnector() { } 68 public SimianUserAccountServiceConnector() { }
67 public string Name { get { return "SimianUserAccountServiceConnector"; } } 69 public string Name { get { return "SimianUserAccountServiceConnector"; } }
68 public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IUserAccountService>(this); } } 70 public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IUserAccountService>(this); } }
69 public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IUserAccountService>(this); } } 71 public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IUserAccountService>(this); } }
70 72
71 #endregion ISharedRegionModule 73 #endregion ISharedRegionModule
72 74
73 public SimianUserAccountServiceConnector(IConfigSource source) 75 public SimianUserAccountServiceConnector(IConfigSource source)
74 { 76 {
75 Initialise(source); 77 CommonInit(source);
76 } 78 }
77 79
78 public void Initialise(IConfigSource source) 80 public void Initialise(IConfigSource source)
79 { 81 {
82 IConfig moduleConfig = source.Configs["Modules"];
83 if (moduleConfig != null)
84 {
85 string name = moduleConfig.GetString("UserAccountServices", "");
86 if (name == Name)
87 CommonInit(source);
88 }
89 }
90
91 private void CommonInit(IConfigSource source)
92 {
80 IConfig gridConfig = source.Configs["UserAccountService"]; 93 IConfig gridConfig = source.Configs["UserAccountService"];
81 if (gridConfig != null) 94 if (gridConfig != null)
82 { 95 {
@@ -86,6 +99,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
86 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) 99 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
87 serviceUrl = serviceUrl + '/'; 100 serviceUrl = serviceUrl + '/';
88 m_serverUrl = serviceUrl; 101 m_serverUrl = serviceUrl;
102 m_Enabled = true;
89 } 103 }
90 } 104 }
91 105
@@ -128,7 +142,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
128 { "UserID", userID.ToString() } 142 { "UserID", userID.ToString() }
129 }; 143 };
130 144
131 return GetUser(requestArgs); 145 account = GetUser(requestArgs);
146
147 if (account == null)
148 {
149 // Store null responses too, to avoid repeated lookups for missing accounts
150 m_accountCache.AddOrUpdate(userID, null, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
151 }
152
153 return account;
132 } 154 }
133 155
134 public List<UserAccount> GetUserAccounts(UUID scopeID, string query) 156 public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
@@ -203,7 +225,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
203 if (success) 225 if (success)
204 { 226 {
205 // Cache the user account info 227 // Cache the user account info
206 m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 228 m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
207 } 229 }
208 else 230 else
209 { 231 {
@@ -268,7 +290,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
268 GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); 290 GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName);
269 291
270 // Cache the user account info 292 // Cache the user account info
271 m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 293 m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
272 294
273 return account; 295 return account;
274 } 296 }
diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
new file mode 100644
index 0000000..2a055cc
--- /dev/null
+++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
@@ -0,0 +1,203 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Reflection;
29using System.Collections.Generic;
30using log4net;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes;
35
36namespace OpenSim.Data.Null
37{
38 /// <summary>
39 /// Mock region data plugin. This obeys the api contract for persistence but stores everything in memory, so that
40 /// tests can check correct persistence.
41 /// </summary>
42 public class NullDataStore : IRegionDataStore
43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45
46 protected Dictionary<UUID, RegionSettings> m_regionSettings = new Dictionary<UUID, RegionSettings>();
47 protected Dictionary<UUID, SceneObjectPart> m_sceneObjectParts = new Dictionary<UUID, SceneObjectPart>();
48 protected Dictionary<UUID, ICollection<TaskInventoryItem>> m_primItems
49 = new Dictionary<UUID, ICollection<TaskInventoryItem>>();
50 protected Dictionary<UUID, double[,]> m_terrains = new Dictionary<UUID, double[,]>();
51 protected Dictionary<UUID, LandData> m_landData = new Dictionary<UUID, LandData>();
52
53 public void Initialise(string dbfile)
54 {
55 return;
56 }
57
58 public void Dispose()
59 {
60 }
61
62 public void StoreRegionSettings(RegionSettings rs)
63 {
64 m_regionSettings[rs.RegionUUID] = rs;
65 }
66
67 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
68 {
69 //This connector doesn't support the windlight module yet
70 //Return default LL windlight settings
71 return new RegionLightShareData();
72 }
73
74 public void StoreRegionWindlightSettings(RegionLightShareData wl)
75 {
76 //This connector doesn't support the windlight module yet
77 }
78
79 public RegionSettings LoadRegionSettings(UUID regionUUID)
80 {
81 RegionSettings rs = null;
82 m_regionSettings.TryGetValue(regionUUID, out rs);
83 return rs;
84 }
85
86 public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
87 {
88 // We can't simply store groups here because on delinking, OpenSim will not update the original group
89 // directly. Rather, the newly delinked parts will be updated to be in their own scene object group
90 // Therefore, we need to store parts rather than groups.
91 foreach (SceneObjectPart prim in obj.Children.Values)
92 {
93 m_log.DebugFormat(
94 "[MOCK REGION DATA PLUGIN]: Storing part {0} {1} in object {2} {3} in region {4}",
95 prim.Name, prim.UUID, obj.Name, obj.UUID, regionUUID);
96
97 m_sceneObjectParts[prim.UUID] = prim;
98 }
99 }
100
101 public void RemoveObject(UUID obj, UUID regionUUID)
102 {
103 // All parts belonging to the object with the uuid are removed.
104 List<SceneObjectPart> parts = new List<SceneObjectPart>(m_sceneObjectParts.Values);
105 foreach (SceneObjectPart part in parts)
106 {
107 if (part.ParentGroup.UUID == obj)
108 {
109 m_log.DebugFormat(
110 "[MOCK REGION DATA PLUGIN]: Removing part {0} {1} as part of object {2} from {3}",
111 part.Name, part.UUID, obj, regionUUID);
112 m_sceneObjectParts.Remove(part.UUID);
113 }
114 }
115 }
116
117 // see IRegionDatastore
118 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
119 {
120 m_primItems[primID] = items;
121 }
122
123 public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
124 {
125 Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>();
126
127 // Create all of the SOGs from the root prims first
128 foreach (SceneObjectPart prim in m_sceneObjectParts.Values)
129 {
130 if (prim.IsRoot)
131 {
132 m_log.DebugFormat(
133 "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID);
134 objects[prim.UUID] = new SceneObjectGroup(prim);
135 }
136 }
137
138 // Add all of the children objects to the SOGs
139 foreach (SceneObjectPart prim in m_sceneObjectParts.Values)
140 {
141 SceneObjectGroup sog;
142 if (prim.UUID != prim.ParentUUID)
143 {
144 if (objects.TryGetValue(prim.ParentUUID, out sog))
145 {
146 int originalLinkNum = prim.LinkNum;
147
148 sog.AddPart(prim);
149
150 // SceneObjectGroup.AddPart() tries to be smart and automatically set the LinkNum.
151 // We override that here
152 if (originalLinkNum != 0)
153 prim.LinkNum = originalLinkNum;
154 }
155 else
156 {
157 m_log.WarnFormat(
158 "[MOCK REGION DATA PLUGIN]: Database contains an orphan child prim {0} {1} in region {2} pointing to missing parent {3}. This prim will not be loaded.",
159 prim.Name, prim.UUID, regionUUID, prim.ParentUUID);
160 }
161 }
162 }
163
164 // TODO: Load items. This is assymetric - we store items as a separate method but don't retrieve them that
165 // way!
166
167 return new List<SceneObjectGroup>(objects.Values);
168 }
169
170 public void StoreTerrain(double[,] ter, UUID regionID)
171 {
172 m_terrains[regionID] = ter;
173 }
174
175 public double[,] LoadTerrain(UUID regionID)
176 {
177 if (m_terrains.ContainsKey(regionID))
178 return m_terrains[regionID];
179 else
180 return null;
181 }
182
183 public void RemoveLandObject(UUID globalID)
184 {
185 if (m_landData.ContainsKey(globalID))
186 m_landData.Remove(globalID);
187 }
188
189 public void StoreLandObject(ILandObject land)
190 {
191 m_landData[land.LandData.GlobalID] = land.LandData;
192 }
193
194 public List<LandData> LoadLandObjects(UUID regionUUID)
195 {
196 return new List<LandData>(m_landData.Values);
197 }
198
199 public void Shutdown()
200 {
201 }
202 }
203} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
index b70b47d..b47ad5d 100644
--- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Tests.Common.Mock
42 /// </summary> 42 /// </summary>
43 public class TestInventoryDataPlugin : IInventoryDataPlugin 43 public class TestInventoryDataPlugin : IInventoryDataPlugin
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 /// <value> 47 /// <value>
48 /// Inventory folders 48 /// Inventory folders
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs
index 01f2c14..615e519 100644
--- a/OpenSim/Tests/Common/Mock/TestScene.cs
+++ b/OpenSim/Tests/Common/Mock/TestScene.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -29,7 +29,6 @@ using System;
29using Nini.Config; 29using Nini.Config;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Framework.Communications; 31using OpenSim.Framework.Communications;
32
33using OpenSim.Framework.Servers; 32using OpenSim.Framework.Servers;
34using OpenSim.Region.Framework; 33using OpenSim.Region.Framework;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
@@ -49,6 +48,11 @@ namespace OpenSim.Tests.Common.Mock
49 } 48 }
50 49
51 /// <summary> 50 /// <summary>
51 /// Allow retrieval for test check purposes
52 /// </summary>
53 public StorageManager StorageManager { get { return m_storageManager; } }
54
55 /// <summary>
52 /// Temporarily override session authentication for tests (namely teleport). 56 /// Temporarily override session authentication for tests (namely teleport).
53 /// </summary> 57 /// </summary>
54 /// 58 ///
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index d9ded2d..9318a27 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -157,7 +157,7 @@ namespace OpenSim.Tests.Common.Setup
157 AgentCircuitManager acm = new AgentCircuitManager(); 157 AgentCircuitManager acm = new AgentCircuitManager();
158 SceneCommunicationService scs = new SceneCommunicationService(); 158 SceneCommunicationService scs = new SceneCommunicationService();
159 159
160 StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", ""); 160 StorageManager sm = new StorageManager("OpenSim.Tests.Common.dll", "", "");
161 IConfigSource configSource = new IniConfigSource(); 161 IConfigSource configSource = new IniConfigSource();
162 162
163 TestScene testScene = new TestScene( 163 TestScene testScene = new TestScene(
diff --git a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
index c57363a..915af7e 100644
--- a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Tests.Common
52 InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); 52 InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
53 53
54 item.Folder = objsFolder.ID; 54 item.Folder = objsFolder.ID;
55 scene.AddInventoryItem(userId, item); 55 scene.AddInventoryItem(item);
56 56
57 return item; 57 return item;
58 } 58 }
diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example
index 9aaa46b..deceb86 100644
--- a/bin/Robust.HG.ini.example
+++ b/bin/Robust.HG.ini.example
@@ -21,7 +21,7 @@
21; * [[<ConfigName>@]<port>/]<dll name>[:<class name>] 21; * [[<ConfigName>@]<port>/]<dll name>[:<class name>]
22; * 22; *
23[Startup] 23[Startup]
24ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:AssetServiceConnector" 24ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:AssetServiceConnector,8002/OpenSim.Server.Handlers.dll:HeloServiceInConnector"
25 25
26; * This is common for all services, it's the network setup for the entire 26; * This is common for all services, it's the network setup for the entire
27; * server instance, if none if specified above 27; * server instance, if none if specified above
@@ -219,6 +219,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
219 GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService" 219 GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
220 GridService = "OpenSim.Services.GridService.dll:GridService" 220 GridService = "OpenSim.Services.GridService.dll:GridService"
221 GatekeeperService = "OpenSim.Services.HypergridService.dll:GatekeeperService" 221 GatekeeperService = "OpenSim.Services.HypergridService.dll:GatekeeperService"
222
223 ;; If you separate the UserAgentService from the LoginService, set this to
224 ;; the IP address of the machine where your LoginService is
225 ;LoginServerIP = "127.0.0.1"
222 226
223; * The interface that local users get when they are in other grids. 227; * The interface that local users get when they are in other grids.
224; * This restricts the inventory operations while in other grids. 228; * This restricts the inventory operations while in other grids.
diff --git a/bin/config-include/HyperSimianGrid.ini b/bin/config-include/HyperSimianGrid.ini
index 87ffe69..49ba2ca 100644
--- a/bin/config-include/HyperSimianGrid.ini
+++ b/bin/config-include/HyperSimianGrid.ini
@@ -21,13 +21,13 @@
21 Include-Common = "config-include/GridCommon.ini" 21 Include-Common = "config-include/GridCommon.ini"
22 22
23[Modules] 23[Modules]
24 GridServices = "OpenSim.Services.Connectors.dll:SimianGridServiceConnector" 24 GridServices = "SimianGridServiceConnector"
25 PresenceServices = "OpenSim.Services.Connectors.dll:SimianPresenceServiceConnector" 25 PresenceServices = "SimianPresenceServiceConnector"
26 UserAccountServices = "OpenSim.Services.Connectors.dll:SimianUserAccountServiceConnector" 26 UserAccountServices = "SimianUserAccountServiceConnector"
27 AuthenticationServices = "OpenSim.Services.Connectors.dll:SimianAuthenticationServiceConnector" 27 AuthenticationServices = "SimianAuthenticationServiceConnector"
28 AssetServices = "HGAssetBroker" 28 AssetServices = "HGAssetBroker"
29 InventoryServices = "HGInventoryBroker" 29 InventoryServices = "HGInventoryBroker"
30 AvatarServices = "OpenSim.Services.Connectors.dll:SimianAvatarServiceConnector" 30 AvatarServices = "SimianAvatarServiceConnector"
31 31
32 NeighbourServices = "RemoteNeighbourServicesConnector" 32 NeighbourServices = "RemoteNeighbourServicesConnector"
33 SimulationServices = "RemoteSimulationConnectorModule" 33 SimulationServices = "RemoteSimulationConnectorModule"
@@ -74,4 +74,4 @@
74 ServicesConnectorModule = SimianGroupsServicesConnector 74 ServicesConnectorModule = SimianGroupsServicesConnector
75 75
76[Profiles] 76[Profiles]
77 Module = SimianProfiles 77 Module = "SimianProfiles"
diff --git a/bin/config-include/SimianGrid.ini b/bin/config-include/SimianGrid.ini
index 65d4ea6..9b27cc7 100644
--- a/bin/config-include/SimianGrid.ini
+++ b/bin/config-include/SimianGrid.ini
@@ -21,13 +21,13 @@
21 Include-Common = "config-include/GridCommon.ini" 21 Include-Common = "config-include/GridCommon.ini"
22 22
23[Modules] 23[Modules]
24 GridServices = "OpenSim.Services.Connectors.dll:SimianGridServiceConnector" 24 GridServices = "SimianGridServiceConnector"
25 PresenceServices = "OpenSim.Services.Connectors.dll:SimianPresenceServiceConnector" 25 PresenceServices = "SimianPresenceServiceConnector"
26 UserAccountServices = "OpenSim.Services.Connectors.dll:SimianUserAccountServiceConnector" 26 UserAccountServices = "SimianUserAccountServiceConnector"
27 AuthenticationServices = "OpenSim.Services.Connectors.dll:SimianAuthenticationServiceConnector" 27 AuthenticationServices = "SimianAuthenticationServiceConnector"
28 AssetServices = "OpenSim.Services.Connectors.dll:SimianAssetServiceConnector" 28 AssetServices = "SimianAssetServiceConnector"
29 InventoryServices = "OpenSim.Services.Connectors.dll:SimianInventoryServiceConnector" 29 InventoryServices = "SimianInventoryServiceConnector"
30 AvatarServices = "OpenSim.Services.Connectors.dll:SimianAvatarServiceConnector" 30 AvatarServices = "SimianAvatarServiceConnector"
31 31
32 NeighbourServices = "RemoteNeighbourServicesConnector" 32 NeighbourServices = "RemoteNeighbourServicesConnector"
33 SimulationServices = "RemoteSimulationConnectorModule" 33 SimulationServices = "RemoteSimulationConnectorModule"
@@ -67,4 +67,4 @@
67 ServicesConnectorModule = SimianGroupsServicesConnector 67 ServicesConnectorModule = SimianGroupsServicesConnector
68 68
69[Profiles] 69[Profiles]
70 Module = SimianProfiles 70 Module = "SimianProfiles"