aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2012-03-09 03:00:31 +0000
committerUbitUmarov2012-03-09 03:00:31 +0000
commitfc4dc7708dc07dc41791de64d7a6b2586d3170b5 (patch)
tree2b807fd97cdef06e671b52f3e735b849b05f9cfc /OpenSim
parent more changes on undo/redo group scaling seems to work better (diff)
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC_OLD-fc4dc7708dc07dc41791de64d7a6b2586d3170b5.zip
opensim-SC_OLD-fc4dc7708dc07dc41791de64d7a6b2586d3170b5.tar.gz
opensim-SC_OLD-fc4dc7708dc07dc41791de64d7a6b2586d3170b5.tar.bz2
opensim-SC_OLD-fc4dc7708dc07dc41791de64d7a6b2586d3170b5.tar.xz
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLFriendsData.cs6
-rw-r--r--OpenSim/Data/MSSQL/MSSQLInventoryData.cs2
-rw-r--r--OpenSim/Data/MSSQL/MSSQLSimulationData.cs87
-rw-r--r--OpenSim/Data/MSSQL/Resources/RegionStore.migrations85
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs2
-rw-r--r--OpenSim/Data/MySQL/MySQLXAssetData.cs500
-rw-r--r--OpenSim/Data/MySQL/Resources/XAssetStore.migrations27
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs2
-rw-r--r--OpenSim/Framework/Console/CommandConsole.cs114
-rw-r--r--OpenSim/Framework/Console/MockConsole.cs59
-rw-r--r--OpenSim/Framework/ICommandConsole.cs2
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs22
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs2
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs2
-rw-r--r--OpenSim/Framework/Watchdog.cs72
-rw-r--r--OpenSim/Framework/WebUtil.cs78
-rw-r--r--OpenSim/Region/Application/OpenSim.cs87
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs20
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs7
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs8
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs20
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs7
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs34
-rw-r--r--OpenSim/Region/CoreModules/World/Access/AccessModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs47
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs18
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Region/RestartModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Sun/SunModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/WindModule.cs19
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs33
-rw-r--r--OpenSim/Region/Framework/Interfaces/IWorldComm.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs25
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs239
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs71
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs175
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs3
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs14
-rw-r--r--OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs10
-rwxr-xr-xOpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs24
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs23
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs147
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs2
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs25
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs57
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs172
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs29
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs25
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs117
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs74
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs42
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs29
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs200
-rw-r--r--OpenSim/Server/Base/ServicesServerBase.cs8
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerConnector.cs6
-rw-r--r--OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs2
-rw-r--r--OpenSim/Services/AssetService/XAssetService.cs213
-rw-r--r--OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs21
-rw-r--r--OpenSim/Services/GridService/GridService.cs4
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs5
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginResponse.cs38
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs12
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs8
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs4
-rw-r--r--OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs22
-rw-r--r--OpenSim/Tests/Torture/NPCTortureTests.cs11
-rw-r--r--OpenSim/Tests/Torture/ObjectTortureTests.cs23
-rw-r--r--OpenSim/Tests/Torture/ScriptTortureTests.cs9
-rw-r--r--OpenSim/Tools/pCampBot/Bot.cs7
-rw-r--r--OpenSim/Tools/pCampBot/BotManager.cs2
-rw-r--r--OpenSim/Tools/pCampBot/pCampBot.cs4
102 files changed, 2494 insertions, 1017 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLFriendsData.cs b/OpenSim/Data/MSSQL/MSSQLFriendsData.cs
index 09dde5e..fef6978 100644
--- a/OpenSim/Data/MSSQL/MSSQLFriendsData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLFriendsData.cs
@@ -89,5 +89,11 @@ namespace OpenSim.Data.MSSQL
89 return DoQuery(cmd); 89 return DoQuery(cmd);
90 } 90 }
91 } 91 }
92
93 public FriendsData[] GetFriends(Guid principalID)
94 {
95 return GetFriends(principalID.ToString());
96 }
97
92 } 98 }
93} 99}
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
index 4d06377..961593f 100644
--- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
@@ -813,7 +813,7 @@ namespace OpenSim.Data.MSSQL
813 { 813 {
814 try 814 try
815 { 815 {
816 using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID", connection)) 816 using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID and type=-1", connection))
817 { 817 {
818 command.Parameters.Add(database.CreateParameter("folderID", folderID)); 818 command.Parameters.Add(database.CreateParameter("folderID", folderID));
819 819
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
index e58620a..d9dfe86 100644
--- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
@@ -675,7 +675,7 @@ VALUES
675 cmd.ExecuteNonQuery(); 675 cmd.ExecuteNonQuery();
676 } 676 }
677 677
678 sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags]) VALUES (@LandUUID,@AccessUUID,@Flags)"; 678 sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags],[Expires]) VALUES (@LandUUID,@AccessUUID,@Flags,@Expires)";
679 679
680 using (SqlConnection conn = new SqlConnection(m_connectionString)) 680 using (SqlConnection conn = new SqlConnection(m_connectionString))
681 using (SqlCommand cmd = new SqlCommand(sql, conn)) 681 using (SqlCommand cmd = new SqlCommand(sql, conn))
@@ -1215,6 +1215,8 @@ VALUES
1215 //Store new values 1215 //Store new values
1216 StoreNewRegionSettings(regionSettings); 1216 StoreNewRegionSettings(regionSettings);
1217 1217
1218 LoadSpawnPoints(regionSettings);
1219
1218 return regionSettings; 1220 return regionSettings;
1219 } 1221 }
1220 1222
@@ -1252,7 +1254,7 @@ VALUES
1252,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se 1254,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se
1253,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit 1255,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit
1254,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position 1256,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position
1255,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id 1257,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id, [map_tile_id] = @TerrainImageID, [telehubobject] = @telehubobject, [parcel_tile_id] = @ParcelImageID
1256 WHERE [regionUUID] = @regionUUID"; 1258 WHERE [regionUUID] = @regionUUID";
1257 1259
1258 using (SqlConnection conn = new SqlConnection(m_connectionString)) 1260 using (SqlConnection conn = new SqlConnection(m_connectionString))
@@ -1263,6 +1265,7 @@ VALUES
1263 cmd.ExecuteNonQuery(); 1265 cmd.ExecuteNonQuery();
1264 } 1266 }
1265 } 1267 }
1268 SaveSpawnPoints(regionSettings);
1266 } 1269 }
1267 1270
1268 public void Shutdown() 1271 public void Shutdown()
@@ -1367,7 +1370,7 @@ VALUES
1367 newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); 1370 newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]);
1368 newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); 1371 newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
1369 newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); 1372 newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
1370 newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); 1373 newSettings.Sandbox = Convert.ToBoolean(row["Sandbox"]);
1371 newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); 1374 newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
1372 newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); 1375 newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
1373 newSettings.SunVector = new Vector3( 1376 newSettings.SunVector = new Vector3(
@@ -1383,6 +1386,11 @@ VALUES
1383 newSettings.LoadedCreationID = ""; 1386 newSettings.LoadedCreationID = "";
1384 else 1387 else
1385 newSettings.LoadedCreationID = (String)row["loaded_creation_id"]; 1388 newSettings.LoadedCreationID = (String)row["loaded_creation_id"];
1389
1390 newSettings.TerrainImageID = new UUID((string)row["map_tile_ID"]);
1391 newSettings.ParcelImageID = new UUID((Guid)row["parcel_tile_ID"]);
1392 newSettings.TelehubObject = new UUID((Guid)row["TelehubObject"]);
1393
1386 return newSettings; 1394 return newSettings;
1387 } 1395 }
1388 1396
@@ -1454,6 +1462,13 @@ VALUES
1454 } 1462 }
1455 1463
1456 newData.ParcelAccessList = new List<LandAccessEntry>(); 1464 newData.ParcelAccessList = new List<LandAccessEntry>();
1465 newData.MediaDescription = (string)row["MediaDescription"];
1466 newData.MediaType = (string)row["MediaType"];
1467 newData.MediaWidth = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[0]);
1468 newData.MediaHeight = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[1]);
1469 newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
1470 newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
1471 newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
1457 1472
1458 return newData; 1473 return newData;
1459 } 1474 }
@@ -1468,7 +1483,7 @@ VALUES
1468 LandAccessEntry entry = new LandAccessEntry(); 1483 LandAccessEntry entry = new LandAccessEntry();
1469 entry.AgentID = new UUID((Guid)row["AccessUUID"]); 1484 entry.AgentID = new UUID((Guid)row["AccessUUID"]);
1470 entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]); 1485 entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]);
1471 entry.Expires = 0; 1486 entry.Expires = Convert.ToInt32(row["Expires"]);
1472 return entry; 1487 return entry;
1473 } 1488 }
1474 1489
@@ -1497,7 +1512,8 @@ VALUES
1497 prim.TouchName = (string)primRow["TouchName"]; 1512 prim.TouchName = (string)primRow["TouchName"];
1498 // permissions 1513 // permissions
1499 prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]); 1514 prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]);
1500 prim.CreatorID = new UUID((Guid)primRow["CreatorID"]); 1515 //prim.CreatorID = new UUID((Guid)primRow["CreatorID"]);
1516 prim.CreatorIdentification = (string)primRow["CreatorID"];
1501 prim.OwnerID = new UUID((Guid)primRow["OwnerID"]); 1517 prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
1502 prim.GroupID = new UUID((Guid)primRow["GroupID"]); 1518 prim.GroupID = new UUID((Guid)primRow["GroupID"]);
1503 prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]); 1519 prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
@@ -1691,7 +1707,8 @@ VALUES
1691 taskItem.Name = (string)inventoryRow["name"]; 1707 taskItem.Name = (string)inventoryRow["name"];
1692 taskItem.Description = (string)inventoryRow["description"]; 1708 taskItem.Description = (string)inventoryRow["description"];
1693 taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]); 1709 taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]);
1694 taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]); 1710 //taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]);
1711 taskItem.CreatorIdentification = (string)inventoryRow["creatorID"];
1695 taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]); 1712 taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]);
1696 taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]); 1713 taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]);
1697 taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]); 1714 taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]);
@@ -1782,7 +1799,7 @@ VALUES
1782 parameters.Add(_Database.CreateParameter("terrain_raise_limit", settings.TerrainRaiseLimit)); 1799 parameters.Add(_Database.CreateParameter("terrain_raise_limit", settings.TerrainRaiseLimit));
1783 parameters.Add(_Database.CreateParameter("terrain_lower_limit", settings.TerrainLowerLimit)); 1800 parameters.Add(_Database.CreateParameter("terrain_lower_limit", settings.TerrainLowerLimit));
1784 parameters.Add(_Database.CreateParameter("use_estate_sun", settings.UseEstateSun)); 1801 parameters.Add(_Database.CreateParameter("use_estate_sun", settings.UseEstateSun));
1785 parameters.Add(_Database.CreateParameter("sandbox", settings.Sandbox)); 1802 parameters.Add(_Database.CreateParameter("Sandbox", settings.Sandbox));
1786 parameters.Add(_Database.CreateParameter("fixed_sun", settings.FixedSun)); 1803 parameters.Add(_Database.CreateParameter("fixed_sun", settings.FixedSun));
1787 parameters.Add(_Database.CreateParameter("sun_position", settings.SunPosition)); 1804 parameters.Add(_Database.CreateParameter("sun_position", settings.SunPosition));
1788 parameters.Add(_Database.CreateParameter("sunvectorx", settings.SunVector.X)); 1805 parameters.Add(_Database.CreateParameter("sunvectorx", settings.SunVector.X));
@@ -1792,6 +1809,9 @@ VALUES
1792 parameters.Add(_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime)); 1809 parameters.Add(_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime));
1793 parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime)); 1810 parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime));
1794 parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID)); 1811 parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID));
1812 parameters.Add(_Database.CreateParameter("TerrainImageID", settings.TerrainImageID));
1813 parameters.Add(_Database.CreateParameter("ParcelImageID", settings.ParcelImageID));
1814 parameters.Add(_Database.CreateParameter("TelehubObject", settings.TelehubObject));
1795 1815
1796 return parameters.ToArray(); 1816 return parameters.ToArray();
1797 } 1817 }
@@ -1859,6 +1879,7 @@ VALUES
1859 parameters.Add(_Database.CreateParameter("LandUUID", parcelID)); 1879 parameters.Add(_Database.CreateParameter("LandUUID", parcelID));
1860 parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID)); 1880 parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID));
1861 parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags)); 1881 parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags));
1882 parameters.Add(_Database.CreateParameter("Expires", parcelAccessEntry.Expires));
1862 1883
1863 return parameters.ToArray(); 1884 return parameters.ToArray();
1864 } 1885 }
@@ -2063,5 +2084,57 @@ VALUES
2063 #endregion 2084 #endregion
2064 2085
2065 #endregion 2086 #endregion
2087
2088 private void LoadSpawnPoints(RegionSettings rs)
2089 {
2090 rs.ClearSpawnPoints();
2091
2092 string sql = "SELECT Yaw, Pitch, Distance FROM spawn_points WHERE RegionUUID = @RegionUUID";
2093 using (SqlConnection conn = new SqlConnection(m_connectionString))
2094 using (SqlCommand cmd = new SqlCommand(sql, conn))
2095 {
2096 cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID.ToString()));
2097 conn.Open();
2098 using (SqlDataReader reader = cmd.ExecuteReader())
2099 {
2100 if (reader.Read())
2101 {
2102 SpawnPoint sp = new SpawnPoint();
2103
2104 sp.Yaw = (float)reader["Yaw"];
2105 sp.Pitch = (float)reader["Pitch"];
2106 sp.Distance = (float)reader["Distance"];
2107
2108 rs.AddSpawnPoint(sp);
2109 }
2110 }
2111 }
2112 }
2113
2114 private void SaveSpawnPoints(RegionSettings rs)
2115 {
2116 string sql = "DELETE FROM spawn_points WHERE RegionUUID = @RegionUUID";
2117 using (SqlConnection conn = new SqlConnection(m_connectionString))
2118 using (SqlCommand cmd = new SqlCommand(sql, conn))
2119 {
2120 cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID));
2121 conn.Open();
2122 cmd.ExecuteNonQuery();
2123 }
2124 foreach (SpawnPoint p in rs.SpawnPoints())
2125 {
2126 sql = "INSERT INTO spawn_points (RegionUUID, Yaw, Pitch, Distance) VALUES (@RegionUUID, @Yaw, @Pitch, @Distance)";
2127 using (SqlConnection conn = new SqlConnection(m_connectionString))
2128 using (SqlCommand cmd = new SqlCommand(sql, conn))
2129 {
2130 cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID));
2131 cmd.Parameters.Add(_Database.CreateParameter("@Yaw", p.Yaw));
2132 cmd.Parameters.Add(_Database.CreateParameter("@Pitch", p.Pitch));
2133 cmd.Parameters.Add(_Database.CreateParameter("@Distance", p.Distance));
2134 conn.Open();
2135 cmd.ExecuteNonQuery();
2136 }
2137 }
2138 }
2066 } 2139 }
2067} 2140}
diff --git a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations
index a98690a..d6a3be9 100644
--- a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations
@@ -1044,10 +1044,93 @@ ALTER TABLE primitems ALTER COLUMN CreatorID uniqueidentifier NOT NULL
1044 1044
1045COMMIT 1045COMMIT
1046 1046
1047:VERSION 29 #--------------------- 1047:VERSION 29 #----------------- Region Covenant changed time
1048 1048
1049BEGIN TRANSACTION 1049BEGIN TRANSACTION
1050 1050
1051ALTER TABLE regionsettings ADD covenant_datetime int NOT NULL default 0 1051ALTER TABLE regionsettings ADD covenant_datetime int NOT NULL default 0
1052 1052
1053COMMIT 1053COMMIT
1054
1055:VERSION 30 #------------------Migrate creatorID storage to varchars instead of UUIDs for HG support
1056
1057BEGIN TRANSACTION
1058
1059EXECUTE sp_rename N'dbo.prims.creatorid', N'creatoridold', 'COLUMN'
1060EXECUTE sp_rename N'dbo.primitems.creatorid', N'creatoridold', 'COLUMN'
1061
1062COMMIT
1063
1064:VERSION 31 #---------------------
1065
1066BEGIN TRANSACTION
1067
1068ALTER TABLE prims ADD CreatorID varchar(255)
1069ALTER TABLE primitems ADD CreatorID varchar(255)
1070
1071COMMIT
1072
1073:VERSION 32 #---------------------
1074
1075BEGIN TRANSACTION
1076
1077UPDATE prims SET prims.CreatorID = CONVERT(varchar(255), creatoridold)
1078UPDATE primitems SET primitems.CreatorID = CONVERT(varchar(255), creatoridold)
1079
1080COMMIT
1081
1082:VERSION 33 #---------------------
1083
1084BEGIN TRANSACTION
1085
1086ALTER TABLE prims
1087ADD CONSTRAINT DF_prims_CreatorIDNew
1088DEFAULT '00000000-0000-0000-0000-000000000000'
1089FOR CreatorID
1090
1091ALTER TABLE prims ALTER COLUMN CreatorID varchar(255) NOT NULL
1092
1093ALTER TABLE primitems
1094ADD CONSTRAINT DF_primitems_CreatorIDNew
1095DEFAULT '00000000-0000-0000-0000-000000000000'
1096FOR CreatorID
1097
1098ALTER TABLE primitems ALTER COLUMN CreatorID varchar(255) NOT NULL
1099
1100COMMIT
1101
1102:VERSION 34 #--------------- Telehub support
1103
1104BEGIN TRANSACTION
1105
1106CREATE TABLE [dbo].[Spawn_Points](
1107 [RegionUUID] [uniqueidentifier] NOT NULL,
1108 [Yaw] [float] NOT NULL,
1109 [Pitch] [float] NOT NULL,
1110 [Distance] [float] NOT NULL,
1111 PRIMARY KEY CLUSTERED
1112 (
1113 [RegionUUID] ASC
1114 )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
1115) ON [PRIMARY]
1116
1117ALTER TABLE regionsettings ADD TelehubObject uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
1118
1119COMMIT
1120
1121:VERSION 35 #---------------- Parcels for sale
1122
1123BEGIN TRANSACTION
1124
1125ALTER TABLE regionsettings ADD parcel_tile_ID uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
1126
1127COMMIT
1128
1129:VERSION 36 #---------------- Timed bans/access
1130
1131BEGIN TRANSACTION
1132
1133ALTER TABLE landaccesslist ADD Expires integer NOT NULL DEFAULT 0;
1134
1135COMMIT
1136
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 5dafc0b..1197548 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -1315,7 +1315,7 @@ namespace OpenSim.Data.MySQL
1315 newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); 1315 newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]);
1316 newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); 1316 newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
1317 newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); 1317 newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
1318 newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); 1318 newSettings.Sandbox = Convert.ToBoolean(row["Sandbox"]);
1319 newSettings.SunVector = new Vector3 ( 1319 newSettings.SunVector = new Vector3 (
1320 Convert.ToSingle(row["sunvectorx"]), 1320 Convert.ToSingle(row["sunvectorx"]),
1321 Convert.ToSingle(row["sunvectory"]), 1321 Convert.ToSingle(row["sunvectory"]),
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs
new file mode 100644
index 0000000..95ef72a
--- /dev/null
+++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs
@@ -0,0 +1,500 @@
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.Data;
31using System.IO;
32using System.IO.Compression;
33using System.Reflection;
34using System.Security.Cryptography;
35using System.Text;
36using log4net;
37using MySql.Data.MySqlClient;
38using OpenMetaverse;
39using OpenSim.Framework;
40using OpenSim.Data;
41
42namespace OpenSim.Data.MySQL
43{
44 public class MySQLXAssetData : AssetDataBase
45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 protected virtual Assembly Assembly
49 {
50 get { return GetType().Assembly; }
51 }
52
53 private bool m_enableCompression = false;
54 private string m_connectionString;
55 private object m_dbLock = new object();
56
57 /// <summary>
58 /// We can reuse this for all hashing since all methods are single-threaded through m_dbBLock
59 /// </summary>
60 private HashAlgorithm hasher = new SHA256CryptoServiceProvider();
61
62 #region IPlugin Members
63
64 public override string Version { get { return "1.0.0.0"; } }
65
66 /// <summary>
67 /// <para>Initialises Asset interface</para>
68 /// <para>
69 /// <list type="bullet">
70 /// <item>Loads and initialises the MySQL storage plugin.</item>
71 /// <item>Warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
72 /// <item>Check for migration</item>
73 /// </list>
74 /// </para>
75 /// </summary>
76 /// <param name="connect">connect string</param>
77 public override void Initialise(string connect)
78 {
79 m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
80 m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
81 m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
82 m_log.ErrorFormat("[MYSQL XASSETDATA]: THIS PLUGIN IS STRICTLY EXPERIMENTAL.");
83 m_log.ErrorFormat("[MYSQL XASSETDATA]: DO NOT USE FOR ANY DATA THAT YOU DO NOT MIND LOSING.");
84 m_log.ErrorFormat("[MYSQL XASSETDATA]: DATABASE TABLES CAN CHANGE AT ANY TIME, CAUSING EXISTING DATA TO BE LOST.");
85 m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
86 m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
87 m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
88
89 m_connectionString = connect;
90
91 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
92 {
93 dbcon.Open();
94 Migration m = new Migration(dbcon, Assembly, "XAssetStore");
95 m.Update();
96 }
97 }
98
99 public override void Initialise()
100 {
101 throw new NotImplementedException();
102 }
103
104 public override void Dispose() { }
105
106 /// <summary>
107 /// The name of this DB provider
108 /// </summary>
109 override public string Name
110 {
111 get { return "MySQL XAsset storage engine"; }
112 }
113
114 #endregion
115
116 #region IAssetDataPlugin Members
117
118 /// <summary>
119 /// Fetch Asset <paramref name="assetID"/> from database
120 /// </summary>
121 /// <param name="assetID">Asset UUID to fetch</param>
122 /// <returns>Return the asset</returns>
123 /// <remarks>On failure : throw an exception and attempt to reconnect to database</remarks>
124 override public AssetBase GetAsset(UUID assetID)
125 {
126// m_log.DebugFormat("[MYSQL XASSET DATA]: Looking for asset {0}", assetID);
127
128 AssetBase asset = null;
129 lock (m_dbLock)
130 {
131 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
132 {
133 dbcon.Open();
134
135 using (MySqlCommand cmd = new MySqlCommand(
136 "SELECT name, description, asset_type, local, temporary, asset_flags, creator_id, data FROM xassetsmeta JOIN xassetsdata ON xassetsmeta.hash = xassetsdata.hash WHERE id=?id",
137 dbcon))
138 {
139 cmd.Parameters.AddWithValue("?id", assetID.ToString());
140
141 try
142 {
143 using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
144 {
145 if (dbReader.Read())
146 {
147 asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["asset_type"], dbReader["creator_id"].ToString());
148 asset.Data = (byte[])dbReader["data"];
149 asset.Description = (string)dbReader["description"];
150
151 string local = dbReader["local"].ToString();
152 if (local.Equals("1") || local.Equals("true", StringComparison.InvariantCultureIgnoreCase))
153 asset.Local = true;
154 else
155 asset.Local = false;
156
157 asset.Temporary = Convert.ToBoolean(dbReader["temporary"]);
158 asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
159
160 if (m_enableCompression)
161 {
162 using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress))
163 {
164 MemoryStream outputStream = new MemoryStream();
165 WebUtil.CopyTo(decompressionStream, outputStream, int.MaxValue);
166 // int compressedLength = asset.Data.Length;
167 asset.Data = outputStream.ToArray();
168
169 // m_log.DebugFormat(
170 // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
171 // asset.ID, asset.Name, asset.Data.Length, compressedLength);
172 }
173 }
174 }
175 }
176 }
177 catch (Exception e)
178 {
179 m_log.Error("[MYSQL XASSET DATA]: MySql failure fetching asset " + assetID + ": " + e.Message);
180 }
181 }
182 }
183 }
184
185 return asset;
186 }
187
188 /// <summary>
189 /// Create an asset in database, or update it if existing.
190 /// </summary>
191 /// <param name="asset">Asset UUID to create</param>
192 /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
193 override public void StoreAsset(AssetBase asset)
194 {
195 lock (m_dbLock)
196 {
197 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
198 {
199 dbcon.Open();
200
201 using (MySqlTransaction transaction = dbcon.BeginTransaction())
202 {
203 string assetName = asset.Name;
204 if (asset.Name.Length > 64)
205 {
206 assetName = asset.Name.Substring(0, 64);
207 m_log.Warn("[XASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add");
208 }
209
210 string assetDescription = asset.Description;
211 if (asset.Description.Length > 64)
212 {
213 assetDescription = asset.Description.Substring(0, 64);
214 m_log.Warn("[XASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add");
215 }
216
217 if (m_enableCompression)
218 {
219 MemoryStream outputStream = new MemoryStream();
220
221 using (GZipStream compressionStream = new GZipStream(outputStream, CompressionMode.Compress, false))
222 {
223 // Console.WriteLine(WebUtil.CopyTo(new MemoryStream(asset.Data), compressionStream, int.MaxValue));
224 // We have to close the compression stream in order to make sure it writes everything out to the underlying memory output stream.
225 compressionStream.Close();
226 byte[] compressedData = outputStream.ToArray();
227 asset.Data = compressedData;
228 }
229 }
230
231 byte[] hash = hasher.ComputeHash(asset.Data);
232
233// m_log.DebugFormat(
234// "[XASSET DB]: Compressed data size for {0} {1}, hash {2} is {3}",
235// asset.ID, asset.Name, hash, compressedData.Length);
236
237 try
238 {
239 using (MySqlCommand cmd =
240 new MySqlCommand(
241 "replace INTO xassetsmeta(id, hash, name, description, asset_type, local, temporary, create_time, access_time, asset_flags, creator_id)" +
242 "VALUES(?id, ?hash, ?name, ?description, ?asset_type, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?creator_id)",
243 dbcon))
244 {
245 // create unix epoch time
246 int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
247 cmd.Parameters.AddWithValue("?id", asset.ID);
248 cmd.Parameters.AddWithValue("?hash", hash);
249 cmd.Parameters.AddWithValue("?name", assetName);
250 cmd.Parameters.AddWithValue("?description", assetDescription);
251 cmd.Parameters.AddWithValue("?asset_type", asset.Type);
252 cmd.Parameters.AddWithValue("?local", asset.Local);
253 cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
254 cmd.Parameters.AddWithValue("?create_time", now);
255 cmd.Parameters.AddWithValue("?access_time", now);
256 cmd.Parameters.AddWithValue("?creator_id", asset.Metadata.CreatorID);
257 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
258 cmd.ExecuteNonQuery();
259 }
260 }
261 catch (Exception e)
262 {
263 m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset metadata {0} with name \"{1}\". Error: {2}",
264 asset.FullID, asset.Name, e.Message);
265
266 transaction.Rollback();
267
268 return;
269 }
270
271 if (!ExistsData(dbcon, transaction, hash))
272 {
273 try
274 {
275 using (MySqlCommand cmd =
276 new MySqlCommand(
277 "INSERT INTO xassetsdata(hash, data) VALUES(?hash, ?data)",
278 dbcon))
279 {
280 cmd.Parameters.AddWithValue("?hash", hash);
281 cmd.Parameters.AddWithValue("?data", asset.Data);
282 cmd.ExecuteNonQuery();
283 }
284 }
285 catch (Exception e)
286 {
287 m_log.ErrorFormat("[XASSET DB]: MySQL failure creating asset data {0} with name \"{1}\". Error: {2}",
288 asset.FullID, asset.Name, e.Message);
289
290 transaction.Rollback();
291
292 return;
293 }
294 }
295
296 transaction.Commit();
297 }
298 }
299 }
300 }
301
302// private void UpdateAccessTime(AssetBase asset)
303// {
304// lock (m_dbLock)
305// {
306// using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
307// {
308// dbcon.Open();
309// MySqlCommand cmd =
310// new MySqlCommand("update assets set access_time=?access_time where id=?id",
311// dbcon);
312//
313// // need to ensure we dispose
314// try
315// {
316// using (cmd)
317// {
318// // create unix epoch time
319// int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
320// cmd.Parameters.AddWithValue("?id", asset.ID);
321// cmd.Parameters.AddWithValue("?access_time", now);
322// cmd.ExecuteNonQuery();
323// cmd.Dispose();
324// }
325// }
326// catch (Exception e)
327// {
328// m_log.ErrorFormat(
329// "[ASSETS DB]: " +
330// "MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString()
331// + Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name);
332// }
333// }
334// }
335//
336// }
337
338 /// <summary>
339 /// We assume we already have the m_dbLock.
340 /// </summary>
341 /// TODO: need to actually use the transaction.
342 /// <param name="dbcon"></param>
343 /// <param name="transaction"></param>
344 /// <param name="hash"></param>
345 /// <returns></returns>
346 private bool ExistsData(MySqlConnection dbcon, MySqlTransaction transaction, byte[] hash)
347 {
348// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid);
349
350 bool exists = false;
351
352 using (MySqlCommand cmd = new MySqlCommand("SELECT hash FROM xassetsdata WHERE hash=?hash", dbcon))
353 {
354 cmd.Parameters.AddWithValue("?hash", hash);
355
356 try
357 {
358 using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
359 {
360 if (dbReader.Read())
361 {
362// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid);
363 exists = true;
364 }
365 }
366 }
367 catch (Exception e)
368 {
369 m_log.ErrorFormat(
370 "[XASSETS DB]: MySql failure in ExistsData fetching hash {0}. Exception {1}{2}",
371 hash, e.Message, e.StackTrace);
372 }
373 }
374
375 return exists;
376 }
377
378 /// <summary>
379 /// Check if the asset exists in the database
380 /// </summary>
381 /// <param name="uuid">The asset UUID</param>
382 /// <returns>true if it exists, false otherwise.</returns>
383 override public bool ExistsAsset(UUID uuid)
384 {
385// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid);
386
387 bool assetExists = false;
388
389 lock (m_dbLock)
390 {
391 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
392 {
393 dbcon.Open();
394 using (MySqlCommand cmd = new MySqlCommand("SELECT id FROM xassetsmeta WHERE id=?id", dbcon))
395 {
396 cmd.Parameters.AddWithValue("?id", uuid.ToString());
397
398 try
399 {
400 using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
401 {
402 if (dbReader.Read())
403 {
404// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid);
405 assetExists = true;
406 }
407 }
408 }
409 catch (Exception e)
410 {
411 m_log.ErrorFormat(
412 "[XASSETS DB]: MySql failure fetching asset {0}" + Environment.NewLine + e.ToString(), uuid);
413 }
414 }
415 }
416 }
417
418 return assetExists;
419 }
420
421 /// <summary>
422 /// Returns a list of AssetMetadata objects. The list is a subset of
423 /// the entire data set offset by <paramref name="start" /> containing
424 /// <paramref name="count" /> elements.
425 /// </summary>
426 /// <param name="start">The number of results to discard from the total data set.</param>
427 /// <param name="count">The number of rows the returned list should contain.</param>
428 /// <returns>A list of AssetMetadata objects.</returns>
429 public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
430 {
431 List<AssetMetadata> retList = new List<AssetMetadata>(count);
432
433 lock (m_dbLock)
434 {
435 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
436 {
437 dbcon.Open();
438 MySqlCommand cmd = new MySqlCommand("SELECT name,description,asset_type,temporary,id,asset_flags,creator_id FROM xassetsmeta LIMIT ?start, ?count", dbcon);
439 cmd.Parameters.AddWithValue("?start", start);
440 cmd.Parameters.AddWithValue("?count", count);
441
442 try
443 {
444 using (MySqlDataReader dbReader = cmd.ExecuteReader())
445 {
446 while (dbReader.Read())
447 {
448 AssetMetadata metadata = new AssetMetadata();
449 metadata.Name = (string)dbReader["name"];
450 metadata.Description = (string)dbReader["description"];
451 metadata.Type = (sbyte)dbReader["asset_type"];
452 metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
453 metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
454 metadata.FullID = DBGuid.FromDB(dbReader["id"]);
455 metadata.CreatorID = dbReader["creator_id"].ToString();
456
457 // We'll ignore this for now - it appears unused!
458// metadata.SHA1 = dbReader["hash"]);
459
460 retList.Add(metadata);
461 }
462 }
463 }
464 catch (Exception e)
465 {
466 m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
467 }
468 }
469 }
470
471 return retList;
472 }
473
474 public override bool Delete(string id)
475 {
476// m_log.DebugFormat("[XASSETS DB]: Deleting asset {0}", id);
477
478 lock (m_dbLock)
479 {
480 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
481 {
482 dbcon.Open();
483
484 using (MySqlCommand cmd = new MySqlCommand("delete from xassetsmeta where id=?id", dbcon))
485 {
486 cmd.Parameters.AddWithValue("?id", id);
487 cmd.ExecuteNonQuery();
488 }
489
490 // TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we
491 // keep a reference count (?)
492 }
493 }
494
495 return true;
496 }
497
498 #endregion
499 }
500} \ No newline at end of file
diff --git a/OpenSim/Data/MySQL/Resources/XAssetStore.migrations b/OpenSim/Data/MySQL/Resources/XAssetStore.migrations
new file mode 100644
index 0000000..d3cca5e
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/XAssetStore.migrations
@@ -0,0 +1,27 @@
1# -----------------
2:VERSION 1
3
4BEGIN;
5
6CREATE TABLE `xassetsmeta` (
7 `id` char(36) NOT NULL,
8 `hash` binary(32) NOT NULL,
9 `name` varchar(64) NOT NULL,
10 `description` varchar(64) NOT NULL,
11 `asset_type` tinyint(4) NOT NULL,
12 `local` tinyint(1) NOT NULL,
13 `temporary` tinyint(1) NOT NULL,
14 `create_time` int(11) NOT NULL,
15 `access_time` int(11) NOT NULL,
16 `asset_flags` int(11) NOT NULL,
17 `creator_id` varchar(128) NOT NULL,
18 PRIMARY KEY (`id`)
19) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Version 1';
20
21CREATE TABLE `xassetsdata` (
22 `hash` binary(32) NOT NULL,
23 `data` longblob NOT NULL,
24 PRIMARY KEY (`hash`)
25) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Version 1';
26
27COMMIT; \ No newline at end of file
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 186a586..7e7c08a 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -2157,7 +2157,7 @@ namespace OpenSim.Data.SQLite
2157 row["terrain_raise_limit"] = settings.TerrainRaiseLimit; 2157 row["terrain_raise_limit"] = settings.TerrainRaiseLimit;
2158 row["terrain_lower_limit"] = settings.TerrainLowerLimit; 2158 row["terrain_lower_limit"] = settings.TerrainLowerLimit;
2159 row["use_estate_sun"] = settings.UseEstateSun; 2159 row["use_estate_sun"] = settings.UseEstateSun;
2160 row["Sandbox"] = settings.Sandbox; // database uses upper case S for sandbox 2160 row["sandbox"] = settings.Sandbox; // unlike other database modules, sqlite uses a lower case s for sandbox!
2161 row["sunvectorx"] = settings.SunVector.X; 2161 row["sunvectorx"] = settings.SunVector.X;
2162 row["sunvectory"] = settings.SunVector.Y; 2162 row["sunvectory"] = settings.SunVector.Y;
2163 row["sunvectorz"] = settings.SunVector.Z; 2163 row["sunvectorz"] = settings.SunVector.Z;
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index 0d6288b..2bb7de1 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -29,6 +29,7 @@ using System;
29using System.Xml; 29using System.Xml;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Diagnostics; 31using System.Diagnostics;
32using System.Linq;
32using System.Reflection; 33using System.Reflection;
33using System.Text; 34using System.Text;
34using System.Text.RegularExpressions; 35using System.Text.RegularExpressions;
@@ -40,6 +41,8 @@ namespace OpenSim.Framework.Console
40{ 41{
41 public class Commands : ICommands 42 public class Commands : ICommands
42 { 43 {
44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45
43 /// <summary> 46 /// <summary>
44 /// Encapsulates a command that can be invoked from the console 47 /// Encapsulates a command that can be invoked from the console
45 /// </summary> 48 /// </summary>
@@ -76,6 +79,8 @@ namespace OpenSim.Framework.Console
76 public List<CommandDelegate> fn; 79 public List<CommandDelegate> fn;
77 } 80 }
78 81
82 public const string GeneralHelpText = "For more information, type 'help <item>' where <item> is one of the following categories:";
83
79 /// <value> 84 /// <value>
80 /// Commands organized by keyword in a tree 85 /// Commands organized by keyword in a tree
81 /// </value> 86 /// </value>
@@ -83,6 +88,11 @@ namespace OpenSim.Framework.Console
83 new Dictionary<string, object>(); 88 new Dictionary<string, object>();
84 89
85 /// <summary> 90 /// <summary>
91 /// Commands organized by module
92 /// </summary>
93 private Dictionary<string, List<CommandInfo>> m_modulesCommands = new Dictionary<string, List<CommandInfo>>();
94
95 /// <summary>
86 /// Get help for the given help string 96 /// Get help for the given help string
87 /// </summary> 97 /// </summary>
88 /// <param name="helpParts">Parsed parts of the help string. If empty then general help is returned.</param> 98 /// <param name="helpParts">Parsed parts of the help string. If empty then general help is returned.</param>
@@ -98,8 +108,8 @@ namespace OpenSim.Framework.Console
98 // General help 108 // General help
99 if (helpParts.Count == 0) 109 if (helpParts.Count == 0)
100 { 110 {
101 help.AddRange(CollectHelp(tree)); 111 help.Add(GeneralHelpText);
102 help.Sort(); 112 help.AddRange(CollectModulesHelp(tree));
103 } 113 }
104 else 114 else
105 { 115 {
@@ -118,6 +128,13 @@ namespace OpenSim.Framework.Console
118 { 128 {
119 string originalHelpRequest = string.Join(" ", helpParts.ToArray()); 129 string originalHelpRequest = string.Join(" ", helpParts.ToArray());
120 List<string> help = new List<string>(); 130 List<string> help = new List<string>();
131
132 // Check modules first to see if we just need to display a list of those commands
133 if (TryCollectModuleHelp(originalHelpRequest, help))
134 {
135 help.Insert(0, GeneralHelpText);
136 return help;
137 }
121 138
122 Dictionary<string, object> dict = tree; 139 Dictionary<string, object> dict = tree;
123 while (helpParts.Count > 0) 140 while (helpParts.Count > 0)
@@ -161,25 +178,61 @@ namespace OpenSim.Framework.Console
161 return help; 178 return help;
162 } 179 }
163 180
164 private List<string> CollectHelp(Dictionary<string, object> dict) 181 /// <summary>
182 /// Try to collect help for the given module if that module exists.
183 /// </summary>
184 /// <param name="moduleName"></param>
185 /// <param name="helpText">/param>
186 /// <returns>true if there was the module existed, false otherwise.</returns>
187 private bool TryCollectModuleHelp(string moduleName, List<string> helpText)
165 { 188 {
166 List<string> result = new List<string>(); 189 lock (m_modulesCommands)
167
168 foreach (KeyValuePair<string, object> kvp in dict)
169 { 190 {
170 if (kvp.Value is Dictionary<string, Object>) 191 if (m_modulesCommands.ContainsKey(moduleName))
171 { 192 {
172 result.AddRange(CollectHelp((Dictionary<string, Object>)kvp.Value)); 193 List<CommandInfo> commands = m_modulesCommands[moduleName];
194 var ourHelpText = commands.ConvertAll(c => string.Format("{0} - {1}", c.help_text, c.long_help));
195 ourHelpText.Sort();
196 helpText.AddRange(ourHelpText);
197
198 return true;
173 } 199 }
174 else 200 else
175 { 201 {
176 if (((CommandInfo)kvp.Value).long_help != String.Empty) 202 return false;
177 result.Add(((CommandInfo)kvp.Value).help_text+" - "+
178 ((CommandInfo)kvp.Value).long_help);
179 } 203 }
180 } 204 }
181 return result;
182 } 205 }
206
207 private List<string> CollectModulesHelp(Dictionary<string, object> dict)
208 {
209 lock (m_modulesCommands)
210 {
211 List<string> helpText = new List<string>(m_modulesCommands.Keys);
212 helpText.Sort();
213 return helpText;
214 }
215 }
216
217// private List<string> CollectHelp(Dictionary<string, object> dict)
218// {
219// List<string> result = new List<string>();
220//
221// foreach (KeyValuePair<string, object> kvp in dict)
222// {
223// if (kvp.Value is Dictionary<string, Object>)
224// {
225// result.AddRange(CollectHelp((Dictionary<string, Object>)kvp.Value));
226// }
227// else
228// {
229// if (((CommandInfo)kvp.Value).long_help != String.Empty)
230// result.Add(((CommandInfo)kvp.Value).help_text+" - "+
231// ((CommandInfo)kvp.Value).long_help);
232// }
233// }
234// return result;
235// }
183 236
184 /// <summary> 237 /// <summary>
185 /// Add a command to those which can be invoked from the console. 238 /// Add a command to those which can be invoked from the console.
@@ -212,21 +265,19 @@ namespace OpenSim.Framework.Console
212 265
213 Dictionary<string, Object> current = tree; 266 Dictionary<string, Object> current = tree;
214 267
215 foreach (string s in parts) 268 foreach (string part in parts)
216 { 269 {
217 if (current.ContainsKey(s)) 270 if (current.ContainsKey(part))
218 { 271 {
219 if (current[s] is Dictionary<string, Object>) 272 if (current[part] is Dictionary<string, Object>)
220 { 273 current = (Dictionary<string, Object>)current[part];
221 current = (Dictionary<string, Object>)current[s];
222 }
223 else 274 else
224 return; 275 return;
225 } 276 }
226 else 277 else
227 { 278 {
228 current[s] = new Dictionary<string, Object>(); 279 current[part] = new Dictionary<string, Object>();
229 current = (Dictionary<string, Object>)current[s]; 280 current = (Dictionary<string, Object>)current[part];
230 } 281 }
231 } 282 }
232 283
@@ -250,6 +301,24 @@ namespace OpenSim.Framework.Console
250 info.fn = new List<CommandDelegate>(); 301 info.fn = new List<CommandDelegate>();
251 info.fn.Add(fn); 302 info.fn.Add(fn);
252 current[String.Empty] = info; 303 current[String.Empty] = info;
304
305 // Now add command to modules dictionary
306 lock (m_modulesCommands)
307 {
308 List<CommandInfo> commands;
309 if (m_modulesCommands.ContainsKey(module))
310 {
311 commands = m_modulesCommands[module];
312 }
313 else
314 {
315 commands = new List<CommandInfo>();
316 m_modulesCommands[module] = commands;
317 }
318
319// m_log.DebugFormat("[COMMAND CONSOLE]: Adding to category {0} command {1}", module, command);
320 commands.Add(info);
321 }
253 } 322 }
254 323
255 public string[] FindNextOption(string[] cmd, bool term) 324 public string[] FindNextOption(string[] cmd, bool term)
@@ -607,8 +676,9 @@ namespace OpenSim.Framework.Console
607 { 676 {
608 Commands = new Commands(); 677 Commands = new Commands();
609 678
610 Commands.AddCommand("console", false, "help", "help [<command>]", 679 Commands.AddCommand(
611 "Get general command list or more detailed help on a specific command", Help); 680 "Help", false, "help", "help [<item>]",
681 "Display help on a particular command or on a list of commands in a category", Help);
612 } 682 }
613 683
614 private void Help(string module, string[] cmd) 684 private void Help(string module, string[] cmd)
diff --git a/OpenSim/Framework/Console/MockConsole.cs b/OpenSim/Framework/Console/MockConsole.cs
index a29b370..4d8751f 100644
--- a/OpenSim/Framework/Console/MockConsole.cs
+++ b/OpenSim/Framework/Console/MockConsole.cs
@@ -29,6 +29,7 @@ using System;
29using System.Threading; 29using System.Threading;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using System.Xml;
32 33
33namespace OpenSim.Framework.Console 34namespace OpenSim.Framework.Console
34{ 35{
@@ -37,28 +38,42 @@ namespace OpenSim.Framework.Console
37 /// Don't use this except for Unit Testing or you're in for a world of hurt when the 38 /// Don't use this except for Unit Testing or you're in for a world of hurt when the
38 /// sim gets to ReadLine 39 /// sim gets to ReadLine
39 /// </summary> 40 /// </summary>
40 public class MockConsole : CommandConsole 41 public class MockConsole : ICommandConsole
41 { 42 {
42 public MockConsole(string defaultPrompt) : base(defaultPrompt) 43 private MockCommands m_commands = new MockCommands();
43 {
44 }
45 public override void Output(string text)
46 {
47 }
48 public override void Output(string text, string level)
49 {
50 }
51 44
52 public override string ReadLine(string p, bool isCommand, bool e) 45 public ICommands Commands { get { return m_commands; } }
53 { 46
54 //Thread.CurrentThread.Join(1000); 47 public void Prompt() {}
55 return string.Empty; 48
56 } 49 public void RunCommand(string cmd) {}
57 public override void UnlockOutput() 50
58 { 51 public string ReadLine(string p, bool isCommand, bool e) { return ""; }
59 } 52
60 public override void LockOutput() 53 public object ConsoleScene { get { return null; } }
61 { 54
62 } 55 public void Output(string text, string level) {}
56 public void Output(string text) {}
57 public void OutputFormat(string format, params object[] components) {}
58
59 public string CmdPrompt(string p) { return ""; }
60 public string CmdPrompt(string p, string def) { return ""; }
61 public string CmdPrompt(string p, List<char> excludedCharacters) { return ""; }
62 public string CmdPrompt(string p, string def, List<char> excludedCharacters) { return ""; }
63
64 public string CmdPrompt(string prompt, string defaultresponse, List<string> options) { return ""; }
65
66 public string PasswdPrompt(string p) { return ""; }
67 }
68
69 public class MockCommands : ICommands
70 {
71 public void FromXml(XmlElement root, CommandDelegate fn) {}
72 public List<string> GetHelp(string[] cmd) { return null; }
73 public void AddCommand(string module, bool shared, string command, string help, string longhelp, CommandDelegate fn) {}
74 public void AddCommand(string module, bool shared, string command, string help, string longhelp, string descriptivehelp, CommandDelegate fn) {}
75 public string[] FindNextOption(string[] cmd, bool term) { return null; }
76 public string[] Resolve(string[] cmd) { return null; }
77 public XmlElement GetXml(XmlDocument doc) { return null; }
63 } 78 }
64} 79} \ No newline at end of file
diff --git a/OpenSim/Framework/ICommandConsole.cs b/OpenSim/Framework/ICommandConsole.cs
index d33b9b5..ca0ff93 100644
--- a/OpenSim/Framework/ICommandConsole.cs
+++ b/OpenSim/Framework/ICommandConsole.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Framework
40 /// <summary> 40 /// <summary>
41 /// Get help for the given help string 41 /// Get help for the given help string
42 /// </summary> 42 /// </summary>
43 /// <param name="helpParts">Parsed parts of the help string. If empty then general help is returned.</param> 43 /// <param name="cmd">Parsed parts of the help string. If empty then general help is returned.</param>
44 /// <returns></returns> 44 /// <returns></returns>
45 List<string> GetHelp(string[] cmd); 45 List<string> GetHelp(string[] cmd);
46 46
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 586cde6..f4d541e 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -161,43 +161,43 @@ namespace OpenSim.Framework.Servers
161 Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); 161 Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
162 } 162 }
163 163
164 m_console.Commands.AddCommand("base", false, "quit", 164 m_console.Commands.AddCommand("General", false, "quit",
165 "quit", 165 "quit",
166 "Quit the application", HandleQuit); 166 "Quit the application", HandleQuit);
167 167
168 m_console.Commands.AddCommand("base", false, "shutdown", 168 m_console.Commands.AddCommand("General", false, "shutdown",
169 "shutdown", 169 "shutdown",
170 "Quit the application", HandleQuit); 170 "Quit the application", HandleQuit);
171 171
172 m_console.Commands.AddCommand("base", false, "set log level", 172 m_console.Commands.AddCommand("General", false, "set log level",
173 "set log level <level>", 173 "set log level <level>",
174 "Set the console logging level", HandleLogLevel); 174 "Set the console logging level", HandleLogLevel);
175 175
176 m_console.Commands.AddCommand("base", false, "show info", 176 m_console.Commands.AddCommand("General", false, "show info",
177 "show info", 177 "show info",
178 "Show general information about the server", HandleShow); 178 "Show general information about the server", HandleShow);
179 179
180 m_console.Commands.AddCommand("base", false, "show stats", 180 m_console.Commands.AddCommand("General", false, "show stats",
181 "show stats", 181 "show stats",
182 "Show statistics", HandleShow); 182 "Show statistics", HandleShow);
183 183
184 m_console.Commands.AddCommand("base", false, "show threads", 184 m_console.Commands.AddCommand("General", false, "show threads",
185 "show threads", 185 "show threads",
186 "Show thread status", HandleShow); 186 "Show thread status", HandleShow);
187 187
188 m_console.Commands.AddCommand("base", false, "show uptime", 188 m_console.Commands.AddCommand("General", false, "show uptime",
189 "show uptime", 189 "show uptime",
190 "Show server uptime", HandleShow); 190 "Show server uptime", HandleShow);
191 191
192 m_console.Commands.AddCommand("base", false, "show version", 192 m_console.Commands.AddCommand("General", false, "show version",
193 "show version", 193 "show version",
194 "Show server version", HandleShow); 194 "Show server version", HandleShow);
195 195
196 m_console.Commands.AddCommand("base", false, "threads abort", 196 m_console.Commands.AddCommand("General", false, "threads abort",
197 "threads abort <thread-id>", 197 "threads abort <thread-id>",
198 "Abort a managed thread. Use \"show threads\" to find possible threads.", HandleThreadsAbort); 198 "Abort a managed thread. Use \"show threads\" to find possible threads.", HandleThreadsAbort);
199 199
200 m_console.Commands.AddCommand("base", false, "threads show", 200 m_console.Commands.AddCommand("General", false, "threads show",
201 "threads show", 201 "threads show",
202 "Show thread status. Synonym for \"show threads\"", 202 "Show thread status. Synonym for \"show threads\"",
203 (string module, string[] args) => Notice(GetThreadsReport())); 203 (string module, string[] args) => Notice(GetThreadsReport()));
@@ -247,7 +247,7 @@ namespace OpenSim.Framework.Servers
247 string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}"; 247 string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}";
248 248
249 StringBuilder sb = new StringBuilder(); 249 StringBuilder sb = new StringBuilder();
250 Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads(); 250 Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreadsInfo();
251 251
252 sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine); 252 sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine);
253 253
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index 2206feb..0062d4e 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -65,6 +65,7 @@ namespace OpenSim.Framework.Servers.HttpServer
65 String.Format("PollServiceWorkerThread{0}", i), 65 String.Format("PollServiceWorkerThread{0}", i),
66 ThreadPriority.Normal, 66 ThreadPriority.Normal,
67 false, 67 false,
68 true,
68 int.MaxValue); 69 int.MaxValue);
69 } 70 }
70 71
@@ -73,6 +74,7 @@ namespace OpenSim.Framework.Servers.HttpServer
73 "PollServiceWatcherThread", 74 "PollServiceWatcherThread",
74 ThreadPriority.Normal, 75 ThreadPriority.Normal,
75 false, 76 false,
77 true,
76 1000 * 60 * 10); 78 1000 * 60 * 10);
77 } 79 }
78 80
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index b2bb962..63ec257 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -29,7 +29,7 @@ namespace OpenSim
29{ 29{
30 public class VersionInfo 30 public class VersionInfo
31 { 31 {
32 private const string VERSION_NUMBER = "0.7.3CM"; 32 private const string VERSION_NUMBER = "0.7.4CM";
33 private const Flavour VERSION_FLAVOUR = Flavour.Dev; 33 private const Flavour VERSION_FLAVOUR = Flavour.Dev;
34 34
35 public enum Flavour 35 public enum Flavour
diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs
index fa94109..881b6aa 100644
--- a/OpenSim/Framework/Watchdog.cs
+++ b/OpenSim/Framework/Watchdog.cs
@@ -72,6 +72,11 @@ namespace OpenSim.Framework
72 /// </summary> 72 /// </summary>
73 public bool IsTimedOut { get; set; } 73 public bool IsTimedOut { get; set; }
74 74
75 /// <summary>
76 /// Will this thread trigger the alarm function if it has timed out?
77 /// </summary>
78 public bool AlarmIfTimeout { get; set; }
79
75 public ThreadWatchdogInfo(Thread thread, int timeout) 80 public ThreadWatchdogInfo(Thread thread, int timeout)
76 { 81 {
77 Thread = thread; 82 Thread = thread;
@@ -112,12 +117,13 @@ namespace OpenSim.Framework
112 /// <param name="start">The method that will be executed in a new thread</param> 117 /// <param name="start">The method that will be executed in a new thread</param>
113 /// <param name="name">A name to give to the new thread</param> 118 /// <param name="name">A name to give to the new thread</param>
114 /// <param name="priority">Priority to run the thread at</param> 119 /// <param name="priority">Priority to run the thread at</param>
115 /// <param name="isBackground">True to run this thread as a background 120 /// <param name="isBackground">True to run this thread as a background thread, otherwise false</param>
116 /// thread, otherwise false</param> 121 /// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param>
117 /// <returns>The newly created Thread object</returns> 122 /// <returns>The newly created Thread object</returns>
118 public static Thread StartThread(ThreadStart start, string name, ThreadPriority priority, bool isBackground) 123 public static Thread StartThread(
124 ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout)
119 { 125 {
120 return StartThread(start, name, priority, isBackground, WATCHDOG_TIMEOUT_MS); 126 return StartThread(start, name, priority, isBackground, alarmIfTimeout, WATCHDOG_TIMEOUT_MS);
121 } 127 }
122 128
123 /// <summary> 129 /// <summary>
@@ -128,21 +134,21 @@ namespace OpenSim.Framework
128 /// <param name="priority">Priority to run the thread at</param> 134 /// <param name="priority">Priority to run the thread at</param>
129 /// <param name="isBackground">True to run this thread as a background 135 /// <param name="isBackground">True to run this thread as a background
130 /// thread, otherwise false</param> 136 /// thread, otherwise false</param>
131 /// <param name="timeout"> 137 /// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param>
132 /// Number of milliseconds to wait until we issue a warning about timeout. 138 /// <param name="timeout">Number of milliseconds to wait until we issue a warning about timeout.</param>
133 /// </para>
134 /// <returns>The newly created Thread object</returns> 139 /// <returns>The newly created Thread object</returns>
135 public static Thread StartThread( 140 public static Thread StartThread(
136 ThreadStart start, string name, ThreadPriority priority, bool isBackground, int timeout) 141 ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout, int timeout)
137 { 142 {
138 Thread thread = new Thread(start); 143 Thread thread = new Thread(start);
139 thread.Name = name; 144 thread.Name = name;
140 thread.Priority = priority; 145 thread.Priority = priority;
141 thread.IsBackground = isBackground; 146 thread.IsBackground = isBackground;
142 147
143 ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout); 148 ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout) { AlarmIfTimeout = alarmIfTimeout };
144 149
145 m_log.Debug("[WATCHDOG]: Started tracking thread \"" + twi.Thread.Name + "\" (ID " + twi.Thread.ManagedThreadId + ")"); 150 m_log.DebugFormat(
151 "[WATCHDOG]: Started tracking thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId);
146 152
147 lock (m_threads) 153 lock (m_threads)
148 m_threads.Add(twi.Thread.ManagedThreadId, twi); 154 m_threads.Add(twi.Thread.ManagedThreadId, twi);
@@ -224,19 +230,39 @@ namespace OpenSim.Framework
224 /// Get currently watched threads for diagnostic purposes 230 /// Get currently watched threads for diagnostic purposes
225 /// </summary> 231 /// </summary>
226 /// <returns></returns> 232 /// <returns></returns>
227 public static ThreadWatchdogInfo[] GetThreads() 233 public static ThreadWatchdogInfo[] GetThreadsInfo()
228 { 234 {
229 lock (m_threads) 235 lock (m_threads)
230 return m_threads.Values.ToArray(); 236 return m_threads.Values.ToArray();
231 } 237 }
232 238
239 /// <summary>
240 /// Return the current thread's watchdog info.
241 /// </summary>
242 /// <returns>The watchdog info. null if the thread isn't being monitored.</returns>
243 public static ThreadWatchdogInfo GetCurrentThreadInfo()
244 {
245 lock (m_threads)
246 {
247 if (m_threads.ContainsKey(Thread.CurrentThread.ManagedThreadId))
248 return m_threads[Thread.CurrentThread.ManagedThreadId];
249 }
250
251 return null;
252 }
253
254 /// <summary>
255 /// Check watched threads. Fire alarm if appropriate.
256 /// </summary>
257 /// <param name="sender"></param>
258 /// <param name="e"></param>
233 private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) 259 private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
234 { 260 {
235 WatchdogTimeout callback = OnWatchdogTimeout; 261 WatchdogTimeout callback = OnWatchdogTimeout;
236 262
237 if (callback != null) 263 if (callback != null)
238 { 264 {
239 ThreadWatchdogInfo timedOut = null; 265 List<ThreadWatchdogInfo> callbackInfos = null;
240 266
241 lock (m_threads) 267 lock (m_threads)
242 { 268 {
@@ -246,21 +272,31 @@ namespace OpenSim.Framework
246 { 272 {
247 if (threadInfo.Thread.ThreadState == ThreadState.Stopped) 273 if (threadInfo.Thread.ThreadState == ThreadState.Stopped)
248 { 274 {
249 timedOut = threadInfo;
250 RemoveThread(threadInfo.Thread.ManagedThreadId); 275 RemoveThread(threadInfo.Thread.ManagedThreadId);
251 break; 276
277 if (callbackInfos == null)
278 callbackInfos = new List<ThreadWatchdogInfo>();
279
280 callbackInfos.Add(threadInfo);
252 } 281 }
253 else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) 282 else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout)
254 { 283 {
255 threadInfo.IsTimedOut = true; 284 threadInfo.IsTimedOut = true;
256 timedOut = threadInfo; 285
257 break; 286 if (threadInfo.AlarmIfTimeout)
287 {
288 if (callbackInfos == null)
289 callbackInfos = new List<ThreadWatchdogInfo>();
290
291 callbackInfos.Add(threadInfo);
292 }
258 } 293 }
259 } 294 }
260 } 295 }
261 296
262 if (timedOut != null) 297 if (callbackInfos != null)
263 callback(timedOut.Thread, timedOut.LastTick); 298 foreach (ThreadWatchdogInfo callbackInfo in callbackInfos)
299 callback(callbackInfo.Thread, callbackInfo.LastTick);
264 } 300 }
265 301
266 m_watchdogTimer.Start(); 302 m_watchdogTimer.Start();
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 854f310..f90df12 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -63,77 +63,7 @@ namespace OpenSim.Framework
63 // a "long" call for warning & debugging purposes 63 // a "long" call for warning & debugging purposes
64 public const int LongCallTime = 500; 64 public const int LongCallTime = 500;
65 65
66// /// <summary> 66 #region JSONRequest
67// /// Send LLSD to an HTTP client in application/llsd+json form
68// /// </summary>
69// /// <param name="response">HTTP response to send the data in</param>
70// /// <param name="body">LLSD to send to the client</param>
71// public static void SendJSONResponse(OSHttpResponse response, OSDMap body)
72// {
73// byte[] responseData = Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(body));
74//
75// response.ContentEncoding = Encoding.UTF8;
76// response.ContentLength = responseData.Length;
77// response.ContentType = "application/llsd+json";
78// response.Body.Write(responseData, 0, responseData.Length);
79// }
80//
81// /// <summary>
82// /// Send LLSD to an HTTP client in application/llsd+xml form
83// /// </summary>
84// /// <param name="response">HTTP response to send the data in</param>
85// /// <param name="body">LLSD to send to the client</param>
86// public static void SendXMLResponse(OSHttpResponse response, OSDMap body)
87// {
88// byte[] responseData = OSDParser.SerializeLLSDXmlBytes(body);
89//
90// response.ContentEncoding = Encoding.UTF8;
91// response.ContentLength = responseData.Length;
92// response.ContentType = "application/llsd+xml";
93// response.Body.Write(responseData, 0, responseData.Length);
94// }
95
96 /// <summary>
97 /// Make a GET or GET-like request to a web service that returns LLSD
98 /// or JSON data
99 /// </summary>
100 public static OSDMap ServiceRequest(string url, string httpVerb)
101 {
102 string errorMessage;
103
104 try
105 {
106 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
107 request.Method = httpVerb;
108
109 using (WebResponse response = request.GetResponse())
110 {
111 using (Stream responseStream = response.GetResponseStream())
112 {
113 try
114 {
115 string responseStr = responseStream.GetStreamString();
116 OSD responseOSD = OSDParser.Deserialize(responseStr);
117 if (responseOSD.Type == OSDType.Map)
118 return (OSDMap)responseOSD;
119 else
120 errorMessage = "Response format was invalid.";
121 }
122 catch
123 {
124 errorMessage = "Failed to parse the response.";
125 }
126 }
127 }
128 }
129 catch (Exception ex)
130 {
131 m_log.Warn(httpVerb + " on URL " + url + " failed: " + ex.Message);
132 errorMessage = ex.Message;
133 }
134
135 return new OSDMap { { "Message", OSD.FromString("Service request failed. " + errorMessage) } };
136 }
137 67
138 /// <summary> 68 /// <summary>
139 /// PUT JSON-encoded data to a web service that returns LLSD or 69 /// PUT JSON-encoded data to a web service that returns LLSD or
@@ -304,6 +234,10 @@ namespace OpenSim.Framework
304 return result; 234 return result;
305 } 235 }
306 236
237 #endregion JSONRequest
238
239 #region FormRequest
240
307 /// <summary> 241 /// <summary>
308 /// POST URL-encoded form data to a web service that returns LLSD or 242 /// POST URL-encoded form data to a web service that returns LLSD or
309 /// JSON data 243 /// JSON data
@@ -398,6 +332,8 @@ namespace OpenSim.Framework
398 result["Message"] = OSD.FromString("Service request failed: " + msg); 332 result["Message"] = OSD.FromString("Service request failed: " + msg);
399 return result; 333 return result;
400 } 334 }
335
336 #endregion FormRequest
401 337
402 #region Uri 338 #region Uri
403 339
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 7a40751..aad73a3 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -225,12 +225,12 @@ namespace OpenSim
225 /// </summary> 225 /// </summary>
226 private void RegisterConsoleCommands() 226 private void RegisterConsoleCommands()
227 { 227 {
228 m_console.Commands.AddCommand("region", false, "force update", 228 m_console.Commands.AddCommand("Regions", false, "force update",
229 "force update", 229 "force update",
230 "Force the update of all objects on clients", 230 "Force the update of all objects on clients",
231 HandleForceUpdate); 231 HandleForceUpdate);
232 232
233 m_console.Commands.AddCommand("region", false, "debug packet", 233 m_console.Commands.AddCommand("Comms", false, "debug packet",
234 "debug packet <level> [<avatar-first-name> <avatar-last-name>]", 234 "debug packet <level> [<avatar-first-name> <avatar-last-name>]",
235 "Turn on packet debugging", 235 "Turn on packet debugging",
236 "If level > 255 then all incoming and outgoing packets are logged.\n" 236 "If level > 255 then all incoming and outgoing packets are logged.\n"
@@ -242,7 +242,7 @@ namespace OpenSim
242 + "If an avatar name is given then only packets from that avatar are logged", 242 + "If an avatar name is given then only packets from that avatar are logged",
243 Debug); 243 Debug);
244 244
245 m_console.Commands.AddCommand("region", false, "debug http", 245 m_console.Commands.AddCommand("Comms", false, "debug http",
246 "debug http <level>", 246 "debug http <level>",
247 "Turn on inbound http request debugging for everything except the event queue (see debug eq).", 247 "Turn on inbound http request debugging for everything except the event queue (see debug eq).",
248 "If level >= 2 then the handler used to service the request is logged.\n" 248 "If level >= 2 then the handler used to service the request is logged.\n"
@@ -250,37 +250,37 @@ namespace OpenSim
250 + "If level <= 0 then no extra http logging is done.\n", 250 + "If level <= 0 then no extra http logging is done.\n",
251 Debug); 251 Debug);
252 252
253 m_console.Commands.AddCommand("region", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug); 253 m_console.Commands.AddCommand("Comms", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug);
254 254
255 m_console.Commands.AddCommand("region", false, "debug scene", 255 m_console.Commands.AddCommand("Regions", false, "debug scene",
256 "debug scene <scripting> <collisions> <physics>", 256 "debug scene <scripting> <collisions> <physics>",
257 "Turn on scene debugging", Debug); 257 "Turn on scene debugging", Debug);
258 258
259 m_console.Commands.AddCommand("region", false, "change region", 259 m_console.Commands.AddCommand("General", false, "change region",
260 "change region <region name>", 260 "change region <region name>",
261 "Change current console region", ChangeSelectedRegion); 261 "Change current console region", ChangeSelectedRegion);
262 262
263 m_console.Commands.AddCommand("region", false, "save xml", 263 m_console.Commands.AddCommand("Archiving", false, "save xml",
264 "save xml", 264 "save xml",
265 "Save a region's data in XML format", SaveXml); 265 "Save a region's data in XML format", SaveXml);
266 266
267 m_console.Commands.AddCommand("region", false, "save xml2", 267 m_console.Commands.AddCommand("Archiving", false, "save xml2",
268 "save xml2", 268 "save xml2",
269 "Save a region's data in XML2 format", SaveXml2); 269 "Save a region's data in XML2 format", SaveXml2);
270 270
271 m_console.Commands.AddCommand("region", false, "load xml", 271 m_console.Commands.AddCommand("Archiving", false, "load xml",
272 "load xml [-newIDs [<x> <y> <z>]]", 272 "load xml [-newIDs [<x> <y> <z>]]",
273 "Load a region's data from XML format", LoadXml); 273 "Load a region's data from XML format", LoadXml);
274 274
275 m_console.Commands.AddCommand("region", false, "load xml2", 275 m_console.Commands.AddCommand("Archiving", false, "load xml2",
276 "load xml2", 276 "load xml2",
277 "Load a region's data from XML2 format", LoadXml2); 277 "Load a region's data from XML2 format", LoadXml2);
278 278
279 m_console.Commands.AddCommand("region", false, "save prims xml2", 279 m_console.Commands.AddCommand("Archiving", false, "save prims xml2",
280 "save prims xml2 [<prim name> <file name>]", 280 "save prims xml2 [<prim name> <file name>]",
281 "Save named prim to XML2", SavePrimsXml2); 281 "Save named prim to XML2", SavePrimsXml2);
282 282
283 m_console.Commands.AddCommand("region", false, "load oar", 283 m_console.Commands.AddCommand("Archiving", false, "load oar",
284 "load oar [--merge] [--skip-assets] [<OAR path>]", 284 "load oar [--merge] [--skip-assets] [<OAR path>]",
285 "Load a region's data from an OAR archive.", 285 "Load a region's data from an OAR archive.",
286 "--merge will merge the OAR with the existing scene." + Environment.NewLine 286 "--merge will merge the OAR with the existing scene." + Environment.NewLine
@@ -289,7 +289,7 @@ namespace OpenSim
289 + " If this is not given then the command looks for an OAR named region.oar in the current directory.", 289 + " If this is not given then the command looks for an OAR named region.oar in the current directory.",
290 LoadOar); 290 LoadOar);
291 291
292 m_console.Commands.AddCommand("region", false, "save oar", 292 m_console.Commands.AddCommand("Archiving", false, "save oar",
293 //"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]", 293 //"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]",
294 "save oar [-h|--home=<url>] [--noassets] [--publish] [--perm=<permissions>] [<OAR path>]", 294 "save oar [-h|--home=<url>] [--noassets] [--publish] [--perm=<permissions>] [<OAR path>]",
295 "Save a region's data to an OAR archive.", 295 "Save a region's data to an OAR archive.",
@@ -306,54 +306,54 @@ namespace OpenSim
306 + " If this is not given then the oar is saved to region.oar in the current directory.", 306 + " If this is not given then the oar is saved to region.oar in the current directory.",
307 SaveOar); 307 SaveOar);
308 308
309 m_console.Commands.AddCommand("region", false, "edit scale", 309 m_console.Commands.AddCommand("Regions", false, "edit scale",
310 "edit scale <name> <x> <y> <z>", 310 "edit scale <name> <x> <y> <z>",
311 "Change the scale of a named prim", HandleEditScale); 311 "Change the scale of a named prim", HandleEditScale);
312 312
313 m_console.Commands.AddCommand("region", false, "kick user", 313 m_console.Commands.AddCommand("Users", false, "kick user",
314 "kick user <first> <last> [message]", 314 "kick user <first> <last> [message]",
315 "Kick a user off the simulator", KickUserCommand); 315 "Kick a user off the simulator", KickUserCommand);
316 316
317 m_console.Commands.AddCommand("region", false, "show users", 317 m_console.Commands.AddCommand("Users", false, "show users",
318 "show users [full]", 318 "show users [full]",
319 "Show user data for users currently on the region", 319 "Show user data for users currently on the region",
320 "Without the 'full' option, only users actually on the region are shown." 320 "Without the 'full' option, only users actually on the region are shown."
321 + " With the 'full' option child agents of users in neighbouring regions are also shown.", 321 + " With the 'full' option child agents of users in neighbouring regions are also shown.",
322 HandleShow); 322 HandleShow);
323 323
324 m_console.Commands.AddCommand("region", false, "show connections", 324 m_console.Commands.AddCommand("Comms", false, "show connections",
325 "show connections", 325 "show connections",
326 "Show connection data", HandleShow); 326 "Show connection data", HandleShow);
327 327
328 m_console.Commands.AddCommand("region", false, "show circuits", 328 m_console.Commands.AddCommand("Comms", false, "show circuits",
329 "show circuits", 329 "show circuits",
330 "Show agent circuit data", HandleShow); 330 "Show agent circuit data", HandleShow);
331 331
332 m_console.Commands.AddCommand("region", false, "show http-handlers", 332 m_console.Commands.AddCommand("Comms", false, "show http-handlers",
333 "show http-handlers", 333 "show http-handlers",
334 "Show all registered http handlers", HandleShow); 334 "Show all registered http handlers", HandleShow);
335 335
336 m_console.Commands.AddCommand("region", false, "show pending-objects", 336 m_console.Commands.AddCommand("Comms", false, "show pending-objects",
337 "show pending-objects", 337 "show pending-objects",
338 "Show # of objects on the pending queues of all scene viewers", HandleShow); 338 "Show # of objects on the pending queues of all scene viewers", HandleShow);
339 339
340 m_console.Commands.AddCommand("region", false, "show modules", 340 m_console.Commands.AddCommand("General", false, "show modules",
341 "show modules", 341 "show modules",
342 "Show module data", HandleShow); 342 "Show module data", HandleShow);
343 343
344 m_console.Commands.AddCommand("region", false, "show regions", 344 m_console.Commands.AddCommand("Regions", false, "show regions",
345 "show regions", 345 "show regions",
346 "Show region data", HandleShow); 346 "Show region data", HandleShow);
347 347
348 m_console.Commands.AddCommand("region", false, "show ratings", 348 m_console.Commands.AddCommand("Regions", false, "show ratings",
349 "show ratings", 349 "show ratings",
350 "Show rating data", HandleShow); 350 "Show rating data", HandleShow);
351 351
352 m_console.Commands.AddCommand("region", false, "backup", 352 m_console.Commands.AddCommand("Regions", false, "backup",
353 "backup", 353 "backup",
354 "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", RunCommand); 354 "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", RunCommand);
355 355
356 m_console.Commands.AddCommand("region", false, "create region", 356 m_console.Commands.AddCommand("Regions", false, "create region",
357 "create region [\"region name\"] <region_file.ini>", 357 "create region [\"region name\"] <region_file.ini>",
358 "Create a new region.", 358 "Create a new region.",
359 "The settings for \"region name\" are read from <region_file.ini>. Paths specified with <region_file.ini> are relative to your Regions directory, unless an absolute path is given." 359 "The settings for \"region name\" are read from <region_file.ini>. Paths specified with <region_file.ini> are relative to your Regions directory, unless an absolute path is given."
@@ -362,62 +362,57 @@ namespace OpenSim
362 + "If <region_file.ini> does not exist, it will be created.", 362 + "If <region_file.ini> does not exist, it will be created.",
363 HandleCreateRegion); 363 HandleCreateRegion);
364 364
365 m_console.Commands.AddCommand("region", false, "restart", 365 m_console.Commands.AddCommand("Regions", false, "restart",
366 "restart", 366 "restart",
367 "Restart all sims in this instance", RunCommand); 367 "Restart all sims in this instance", RunCommand);
368 368
369 m_console.Commands.AddCommand("region", false, "config set", 369 m_console.Commands.AddCommand("General", false, "config set",
370 "config set <section> <key> <value>", 370 "config set <section> <key> <value>",
371 "Set a config option. In most cases this is not useful since changed parameters are not dynamically reloaded. Neither do changed parameters persist - you will have to change a config file manually and restart.", HandleConfig); 371 "Set a config option. In most cases this is not useful since changed parameters are not dynamically reloaded. Neither do changed parameters persist - you will have to change a config file manually and restart.", HandleConfig);
372 372
373 m_console.Commands.AddCommand("region", false, "config get", 373 m_console.Commands.AddCommand("General", false, "config get",
374 "config get [<section>] [<key>]", 374 "config get [<section>] [<key>]",
375 "Synonym for config show", 375 "Synonym for config show",
376 HandleConfig); 376 HandleConfig);
377 377
378 m_console.Commands.AddCommand("region", false, "config show", 378 m_console.Commands.AddCommand("General", false, "config show",
379 "config show [<section>] [<key>]", 379 "config show [<section>] [<key>]",
380 "Show config information", 380 "Show config information",
381 "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine 381 "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine
382 + "If a section is given but not a field, then all fields in that section are printed.", 382 + "If a section is given but not a field, then all fields in that section are printed.",
383 HandleConfig); 383 HandleConfig);
384 384
385 m_console.Commands.AddCommand("region", false, "config save", 385 m_console.Commands.AddCommand("General", false, "config save",
386 "config save <path>", 386 "config save <path>",
387 "Save current configuration to a file at the given path", HandleConfig); 387 "Save current configuration to a file at the given path", HandleConfig);
388 388
389 m_console.Commands.AddCommand("region", false, "command-script", 389 m_console.Commands.AddCommand("General", false, "command-script",
390 "command-script <script>", 390 "command-script <script>",
391 "Run a command script from file", RunCommand); 391 "Run a command script from file", RunCommand);
392 392
393 m_console.Commands.AddCommand("region", false, "remove-region", 393 m_console.Commands.AddCommand("Regions", false, "remove-region",
394 "remove-region <name>", 394 "remove-region <name>",
395 "Remove a region from this simulator", RunCommand); 395 "Remove a region from this simulator", RunCommand);
396 396
397 m_console.Commands.AddCommand("region", false, "delete-region", 397 m_console.Commands.AddCommand("Regions", false, "delete-region",
398 "delete-region <name>", 398 "delete-region <name>",
399 "Delete a region from disk", RunCommand); 399 "Delete a region from disk", RunCommand);
400 400
401 m_console.Commands.AddCommand("region", false, "modules list", 401 m_console.Commands.AddCommand("General", false, "modules list",
402 "modules list", 402 "modules list",
403 "List modules", HandleModules); 403 "List modules", HandleModules);
404 404
405 m_console.Commands.AddCommand("region", false, "modules load", 405 m_console.Commands.AddCommand("General", false, "modules load",
406 "modules load <name>", 406 "modules load <name>",
407 "Load a module", HandleModules); 407 "Load a module", HandleModules);
408 408
409 m_console.Commands.AddCommand("region", false, "modules unload", 409 m_console.Commands.AddCommand("General", false, "modules unload",
410 "modules unload <name>", 410 "modules unload <name>",
411 "Unload a module", HandleModules); 411 "Unload a module", HandleModules);
412 412
413 m_console.Commands.AddCommand("region", false, "Add-InventoryHost", 413 m_console.Commands.AddCommand("Regions", false, "kill uuid",
414 "Add-InventoryHost <host>",
415 String.Empty, RunCommand);
416
417 m_console.Commands.AddCommand("region", false, "kill uuid",
418 "kill uuid <UUID>", 414 "kill uuid <UUID>",
419 "Kill an object by UUID", KillUUID); 415 "Kill an object by UUID", KillUUID);
420
421 } 416 }
422 417
423 public override void ShutdownSpecific() 418 public override void ShutdownSpecific()
@@ -829,14 +824,6 @@ namespace OpenSim
829 case "restart": 824 case "restart":
830 m_sceneManager.RestartCurrentScene(); 825 m_sceneManager.RestartCurrentScene();
831 break; 826 break;
832
833 case "Add-InventoryHost":
834 if (cmdparams.Length > 0)
835 {
836 MainConsole.Instance.Output("Not implemented.");
837 }
838 break;
839
840 } 827 }
841 } 828 }
842 829
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 80bff17..34f513d 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -257,15 +257,17 @@ namespace OpenSim
257 257
258 foreach (string topic in topics) 258 foreach (string topic in topics)
259 { 259 {
260 m_console.Commands.AddCommand("plugin", false, "help " + topic, 260 string capitalizedTopic = char.ToUpper(topic[0]) + topic.Substring(1);
261 "help " + topic, 261
262 m_console.Commands.AddCommand(capitalizedTopic, false, "help " + capitalizedTopic,
263 "help " + capitalizedTopic,
262 "Get help on plugin command '" + topic + "'", 264 "Get help on plugin command '" + topic + "'",
263 HandleCommanderHelp); 265 HandleCommanderHelp);
264 266//
265 m_console.Commands.AddCommand("plugin", false, topic, 267// m_console.Commands.AddCommand("General", false, topic,
266 topic, 268// topic,
267 "Execute subcommand for plugin '" + topic + "'", 269// "Execute subcommand for plugin '" + topic + "'",
268 null); 270// null);
269 271
270 ICommander commander = null; 272 ICommander commander = null;
271 273
@@ -282,7 +284,7 @@ namespace OpenSim
282 284
283 foreach (string command in commander.Commands.Keys) 285 foreach (string command in commander.Commands.Keys)
284 { 286 {
285 m_console.Commands.AddCommand(topic, false, 287 m_console.Commands.AddCommand(capitalizedTopic, false,
286 topic + " " + command, 288 topic + " " + command,
287 topic + " " + commander.Commands[command].ShortHelp(), 289 topic + " " + commander.Commands[command].ShortHelp(),
288 String.Empty, HandleCommanderCommand); 290 String.Empty, HandleCommanderCommand);
@@ -301,7 +303,7 @@ namespace OpenSim
301 // Only safe for the interactive console, since it won't 303 // Only safe for the interactive console, since it won't
302 // let us come here unless both scene and commander exist 304 // let us come here unless both scene and commander exist
303 // 305 //
304 ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(cmd[1]); 306 ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(cmd[1].ToLower());
305 if (moduleCommander != null) 307 if (moduleCommander != null)
306 m_console.Output(moduleCommander.Help); 308 m_console.Output(moduleCommander.Help);
307 } 309 }
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index be699db..35cb575 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -262,7 +262,7 @@ namespace OpenSim.Region.ClientStack.Linden
262 { 262 {
263 try 263 try
264 { 264 {
265 m_log.Debug("[CAPS]: ScriptTaskInventory Request in region: " + m_regionName); 265// m_log.Debug("[CAPS]: ScriptTaskInventory Request in region: " + m_regionName);
266 //m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param); 266 //m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param);
267 267
268 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); 268 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index 8ba6f61..7c07c56 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -106,7 +106,7 @@ namespace OpenSim.Region.ClientStack.Linden
106 scene.EventManager.OnRegisterCaps += OnRegisterCaps; 106 scene.EventManager.OnRegisterCaps += OnRegisterCaps;
107 107
108 MainConsole.Instance.Commands.AddCommand( 108 MainConsole.Instance.Commands.AddCommand(
109 "event queue", 109 "Comms",
110 false, 110 false,
111 "debug eq", 111 "debug eq",
112 "debug eq [0|1]", 112 "debug eq [0|1]",
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index a79b387..75f783b 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -244,8 +244,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
244 base.Start(m_recvBufferSize, m_asyncPacketHandling); 244 base.Start(m_recvBufferSize, m_asyncPacketHandling);
245 245
246 // Start the packet processing threads 246 // Start the packet processing threads
247 Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); 247 Watchdog.StartThread(
248 Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); 248 IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true);
249 Watchdog.StartThread(
250 OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true);
251
249 m_elapsedMSSinceLastStatReport = Environment.TickCount; 252 m_elapsedMSSinceLastStatReport = Environment.TickCount;
250 } 253 }
251 254
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 8e2dba4..127ca1d 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -203,10 +203,10 @@ namespace Flotsam.RegionModules.AssetCache
203 m_CacheDirectoryTierLen = 4; 203 m_CacheDirectoryTierLen = 4;
204 } 204 }
205 205
206 MainConsole.Instance.Commands.AddCommand(Name, true, "fcache status", "fcache status", "Display cache status", HandleConsoleCommand); 206 MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache status", "fcache status", "Display cache status", HandleConsoleCommand);
207 MainConsole.Instance.Commands.AddCommand(Name, true, "fcache clear", "fcache clear [file] [memory]", "Remove all assets in the cache. If file or memory is specified then only this cache is cleared.", HandleConsoleCommand); 207 MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache clear", "fcache clear [file] [memory]", "Remove all assets in the cache. If file or memory is specified then only this cache is cleared.", HandleConsoleCommand);
208 MainConsole.Instance.Commands.AddCommand(Name, true, "fcache assets", "fcache assets", "Attempt a deep scan and cache of all assets in all scenes", HandleConsoleCommand); 208 MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache assets", "fcache assets", "Attempt a deep scan and cache of all assets in all scenes", HandleConsoleCommand);
209 MainConsole.Instance.Commands.AddCommand(Name, true, "fcache expire", "fcache expire <datetime>", "Purge cached assets older then the specified date/time", HandleConsoleCommand); 209 MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache expire", "fcache expire <datetime>", "Purge cached assets older then the specified date/time", HandleConsoleCommand);
210 } 210 }
211 } 211 }
212 } 212 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index bb2cd1f..3c294bb 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -51,12 +51,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
51 m_scene.RegisterModuleInterface<IDialogModule>(this); 51 m_scene.RegisterModuleInterface<IDialogModule>(this);
52 52
53 m_scene.AddCommand( 53 m_scene.AddCommand(
54 this, "alert", "alert <message>", 54 "Users", this, "alert", "alert <message>",
55 "Send an alert to everyone", 55 "Send an alert to everyone",
56 HandleAlertConsoleCommand); 56 HandleAlertConsoleCommand);
57 57
58 m_scene.AddCommand( 58 m_scene.AddCommand(
59 this, "alert-user", "alert-user <first> <last> <message>", 59 "Users", this, "alert-user", "alert-user <first> <last> <message>",
60 "Send an alert to a user", 60 "Send an alert to a user",
61 HandleAlertConsoleCommand); 61 HandleAlertConsoleCommand);
62 } 62 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index a81f36c..2154827 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -108,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
108 OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; 108 OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;
109 109
110 scene.AddCommand( 110 scene.AddCommand(
111 this, "load iar", 111 "Archiving", this, "load iar",
112 "load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]", 112 "load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]",
113 "Load user inventory archive (IAR).", 113 "Load user inventory archive (IAR).",
114 "-m|--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones" 114 "-m|--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
@@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
121 HandleLoadInvConsoleCommand); 121 HandleLoadInvConsoleCommand);
122 122
123 scene.AddCommand( 123 scene.AddCommand(
124 this, "save iar", 124 "Archiving", this, "save iar",
125 "save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-v|--verbose]", 125 "save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-v|--verbose]",
126 "Save user inventory archive (IAR).", 126 "Save user inventory archive (IAR).",
127 "<first> is the user's first name." + Environment.NewLine 127 "<first> is the user's first name." + Environment.NewLine
@@ -349,8 +349,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
349 { 349 {
350 try 350 try
351 { 351 {
352 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
353
354 Dictionary<string, object> options = new Dictionary<string, object>(); 352 Dictionary<string, object> options = new Dictionary<string, object>();
355 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); 353 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
356 354
@@ -412,7 +410,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
412 return; 410 return;
413 } 411 }
414 412
415 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
416 if (options.ContainsKey("home")) 413 if (options.ContainsKey("home"))
417 m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR"); 414 m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR");
418 415
diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
index eb1e4b5..8101ca2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
@@ -150,7 +150,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
150 string skillsText = String.Empty; 150 string skillsText = String.Empty;
151 string languages = String.Empty; 151 string languages = String.Empty;
152 152
153 Byte[] charterMember = Utils.StringToBytes("Avatar"); 153 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, avatarID);
154
155 string name = "Avatar";
156 int created = 0;
157 if (account != null)
158 {
159 name = account.FirstName + " " + account.LastName;
160 created = account.Created;
161 }
162 Byte[] charterMember = Utils.StringToBytes(name);
154 163
155 profileUrl = "No profile data"; 164 profileUrl = "No profile data";
156 aboutText = string.Empty; 165 aboutText = string.Empty;
@@ -160,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
160 partner = UUID.Zero; 169 partner = UUID.Zero;
161 170
162 remoteClient.SendAvatarProperties(avatarID, aboutText, 171 remoteClient.SendAvatarProperties(avatarID, aboutText,
163 Util.ToDateTime(0).ToString( 172 Util.ToDateTime(created).ToString(
164 "M/d/yyyy", CultureInfo.InvariantCulture), 173 "M/d/yyyy", CultureInfo.InvariantCulture),
165 charterMember, firstLifeAboutText, 174 charterMember, firstLifeAboutText,
166 (uint)(0 & 0xff), 175 (uint)(0 & 0xff),
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
index 97cd738..dbe75b5 100644
--- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
@@ -69,9 +69,10 @@ namespace OpenSim.Region.CoreModules.Framework
69 { 69 {
70 m_scene = scene; 70 m_scene = scene;
71 m_scene.RegisterModuleInterface<ICapabilitiesModule>(this); 71 m_scene.RegisterModuleInterface<ICapabilitiesModule>(this);
72 MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps", 72
73 MainConsole.Instance.Commands.AddCommand("Comms", false, "show caps",
73 "show caps", 74 "show caps",
74 "Shows all registered capabilities", HandleShowCapsCommand); 75 "Shows all registered capabilities for users", HandleShowCapsCommand);
75 } 76 }
76 77
77 public void RegionLoaded(Scene scene) 78 public void RegionLoaded(Scene scene)
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 0c4ff7f..d2fe388 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
117 string userAssetServer = string.Empty; 117 string userAssetServer = string.Empty;
118 if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission) 118 if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission)
119 { 119 {
120 Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); }); 120 m_assMapper.Post(assetID, avatarID, userAssetServer);
121 } 121 }
122 } 122 }
123 123
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
index 3f466be..7f8271d 100644
--- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
72 72
73 m_scene = scene; 73 m_scene = scene;
74 74
75 m_scene.AddCommand(this, "monitor report", 75 m_scene.AddCommand("General", this, "monitor report",
76 "monitor report", 76 "monitor report",
77 "Returns a variety of statistics about the current region and/or simulator", 77 "Returns a variety of statistics about the current region and/or simulator",
78 DebugMonitors); 78 DebugMonitors);
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index b4f6b5a..554af14 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
80 // } 80 // }
81 // } 81 // }
82 //} 82 //}
83 MainConsole.Instance.Commands.AddCommand("grid", true, 83 MainConsole.Instance.Commands.AddCommand("Users", true,
84 "show names", 84 "show names",
85 "show names", 85 "show names",
86 "Show the bindings between user UUIDs and user names", 86 "Show the bindings between user UUIDs and user names",
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
index f367739..a6e2548 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
@@ -1210,7 +1210,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
1210 if (homeScene.TryGetScenePresence(avatarId,out avatar)) 1210 if (homeScene.TryGetScenePresence(avatarId,out avatar))
1211 { 1211 {
1212 KillAUser ku = new KillAUser(avatar,mod); 1212 KillAUser ku = new KillAUser(avatar,mod);
1213 Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true); 1213 Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true, true);
1214 } 1214 }
1215 } 1215 }
1216 1216
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
index 640a60b..ef9b4e0 100644
--- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
@@ -151,6 +151,14 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
151 151
152 #region IWorldComm Members 152 #region IWorldComm Members
153 153
154 public int ListenerCount
155 {
156 get
157 {
158 return m_listenerManager.ListenerCount;
159 }
160 }
161
154 /// <summary> 162 /// <summary>
155 /// Create a listen event callback with the specified filters. 163 /// Create a listen event callback with the specified filters.
156 /// The parameters localID,itemID are needed to uniquely identify 164 /// The parameters localID,itemID are needed to uniquely identify
@@ -438,6 +446,18 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
438 private int m_maxhandles; 446 private int m_maxhandles;
439 private int m_curlisteners; 447 private int m_curlisteners;
440 448
449 /// <summary>
450 /// Total number of listeners
451 /// </summary>
452 public int ListenerCount
453 {
454 get
455 {
456 lock (m_listeners)
457 return m_listeners.Count;
458 }
459 }
460
441 public ListenerManager(int maxlisteners, int maxhandles) 461 public ListenerManager(int maxlisteners, int maxhandles)
442 { 462 {
443 m_maxlisteners = maxlisteners; 463 m_maxlisteners = maxlisteners;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
index 2e6ec90..c78915f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
@@ -73,14 +73,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
73 return; 73 return;
74 } 74 }
75 75
76 string serviceDll = assetConfig.GetString("LocalServiceModule", 76 string serviceDll = assetConfig.GetString("LocalServiceModule", String.Empty);
77 String.Empty);
78 77
79 if (serviceDll == String.Empty) 78 if (serviceDll == String.Empty)
80 { 79 {
81 m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: No LocalServiceModule named in section AssetService"); 80 m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: No LocalServiceModule named in section AssetService");
82 return; 81 return;
83 } 82 }
83 else
84 {
85 m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Loading asset service at {0}", serviceDll);
86 }
84 87
85 Object[] args = new Object[] { source }; 88 Object[] args = new Object[] { source };
86 m_AssetService = ServerUtils.LoadPlugin<IAssetService>(serviceDll, args); 89 m_AssetService = ServerUtils.LoadPlugin<IAssetService>(serviceDll, args);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 3c36799..540f33a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -48,8 +48,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
48 LogManager.GetLogger( 48 LogManager.GetLogger(
49 MethodBase.GetCurrentMethod().DeclaringType); 49 MethodBase.GetCurrentMethod().DeclaringType);
50 50
51 private static LocalGridServicesConnector m_MainInstance;
52
53 private IGridService m_GridService; 51 private IGridService m_GridService;
54 private Dictionary<UUID, RegionCache> m_LocalCache = new Dictionary<UUID, RegionCache>(); 52 private Dictionary<UUID, RegionCache> m_LocalCache = new Dictionary<UUID, RegionCache>();
55 53
@@ -62,7 +60,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
62 public LocalGridServicesConnector(IConfigSource source) 60 public LocalGridServicesConnector(IConfigSource source)
63 { 61 {
64 m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated"); 62 m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated");
65 m_MainInstance = this;
66 InitialiseService(source); 63 InitialiseService(source);
67 } 64 }
68 65
@@ -87,7 +84,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
87 if (name == Name) 84 if (name == Name)
88 { 85 {
89 InitialiseService(source); 86 InitialiseService(source);
90 m_MainInstance = this;
91 m_Enabled = true; 87 m_Enabled = true;
92 m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled"); 88 m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled");
93 } 89 }
@@ -126,12 +122,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
126 122
127 public void PostInitialise() 123 public void PostInitialise()
128 { 124 {
129 if (m_MainInstance == this) 125 MainConsole.Instance.Commands.AddCommand("Regions", false, "show neighbours",
130 { 126 "show neighbours",
131 MainConsole.Instance.Commands.AddCommand("LocalGridConnector", false, "show neighbours", 127 "Shows the local regions' neighbours", NeighboursCommand);
132 "show neighbours",
133 "Shows the local regions' neighbours", NeighboursCommand);
134 }
135 } 128 }
136 129
137 public void Close() 130 public void Close()
@@ -143,22 +136,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
143 if (m_Enabled) 136 if (m_Enabled)
144 scene.RegisterModuleInterface<IGridService>(this); 137 scene.RegisterModuleInterface<IGridService>(this);
145 138
146 if (m_MainInstance == this) 139 if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID))
147 { 140 m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!");
148 if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID)) 141 else
149 m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); 142 m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene));
150 else
151 m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene));
152 }
153 } 143 }
154 144
155 public void RemoveRegion(Scene scene) 145 public void RemoveRegion(Scene scene)
156 { 146 {
157 if (m_MainInstance == this) 147 m_LocalCache[scene.RegionInfo.RegionID].Clear();
158 { 148 m_LocalCache.Remove(scene.RegionInfo.RegionID);
159 m_LocalCache[scene.RegionInfo.RegionID].Clear();
160 m_LocalCache.Remove(scene.RegionInfo.RegionID);
161 }
162 } 149 }
163 150
164 public void RegionLoaded(Scene scene) 151 public void RegionLoaded(Scene scene)
@@ -259,6 +246,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
259 246
260 MainConsole.Instance.Output(caps.ToString()); 247 MainConsole.Instance.Output(caps.ToString());
261 } 248 }
262
263 } 249 }
264} 250} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
index 2399134..553a32d 100644
--- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
+++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
@@ -47,21 +47,21 @@ namespace OpenSim.Region.CoreModules.World
47 47
48 public void Initialise(IConfigSource config) 48 public void Initialise(IConfigSource config)
49 { 49 {
50 MainConsole.Instance.Commands.AddCommand("access", true, 50 MainConsole.Instance.Commands.AddCommand("Users", true,
51 "login enable", 51 "login enable",
52 "login enable", 52 "login enable",
53 "Enable simulator logins", 53 "Enable simulator logins",
54 String.Empty, 54 String.Empty,
55 HandleLoginCommand); 55 HandleLoginCommand);
56 56
57 MainConsole.Instance.Commands.AddCommand("access", true, 57 MainConsole.Instance.Commands.AddCommand("Users", true,
58 "login disable", 58 "login disable",
59 "login disable", 59 "login disable",
60 "Disable simulator logins", 60 "Disable simulator logins",
61 String.Empty, 61 String.Empty,
62 HandleLoginCommand); 62 HandleLoginCommand);
63 63
64 MainConsole.Instance.Commands.AddCommand("access", true, 64 MainConsole.Instance.Commands.AddCommand("Users", true,
65 "login status", 65 "login status",
66 "login status", 66 "login status",
67 "Show login status", 67 "Show login status",
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
index f6d1a82..d2bbea3 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
@@ -62,58 +62,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
62 { 62 {
63 m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName); 63 m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName);
64 64
65 m_module.Scene.AddCommand(m_module, "set terrain texture", 65 m_module.Scene.AddCommand("Regions", m_module, "set terrain texture",
66 "set terrain texture <number> <uuid> [<x>] [<y>]", 66 "set terrain texture <number> <uuid> [<x>] [<y>]",
67 "Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " + 67 "Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " +
68 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + 68 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
69 " that coordinate.", 69 " that coordinate.",
70 consoleSetTerrainTexture); 70 consoleSetTerrainTexture);
71 71
72 m_module.Scene.AddCommand(m_module, "set terrain heights", 72 m_module.Scene.AddCommand("Regions", m_module, "set terrain heights",
73 "set terrain heights <corner> <min> <max> [<x>] [<y>]", 73 "set terrain heights <corner> <min> <max> [<x>] [<y>]",
74 "Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " + 74 "Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " +
75 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + 75 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
76 " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.", 76 " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.",
77 consoleSetTerrainHeights); 77 consoleSetTerrainHeights);
78
79 Command showCommand
80 = new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowEstatesCommand, "Shows all estates on the simulator.");
81
82 m_commander.RegisterCommand("show", showCommand);
83 78
84 m_module.Scene.RegisterModuleCommander(m_commander); 79 m_module.Scene.AddCommand(
85 80 "Estates", m_module, "estate show", "estate show", "Shows all estates on the simulator.", ShowEstatesCommand);
86 m_module.Scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;
87 } 81 }
88 82
89 public void Close() 83 public void Close() {}
90 {
91 m_module.Scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole;
92 m_module.Scene.UnregisterModuleCommander(m_commander.Name);
93 }
94
95 /// <summary>
96 /// Processes commandline input. Do not call directly.
97 /// </summary>
98 /// <param name="args">Commandline arguments</param>
99 protected void EventManagerOnPluginConsole(string[] args)
100 {
101 if (args[0] == "estate")
102 {
103 if (args.Length == 1)
104 {
105 m_commander.ProcessConsoleCommand("help", new string[0]);
106 return;
107 }
108
109 string[] tmpArgs = new string[args.Length - 2];
110 int i;
111 for (i = 2; i < args.Length; i++)
112 tmpArgs[i - 2] = args[i];
113
114 m_commander.ProcessConsoleCommand(args[1], tmpArgs);
115 }
116 }
117 84
118 protected void consoleSetTerrainTexture(string module, string[] args) 85 protected void consoleSetTerrainTexture(string module, string[] args)
119 { 86 {
@@ -201,7 +168,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
201 } 168 }
202 } 169 }
203 170
204 protected void ShowEstatesCommand(Object[] args) 171 protected void ShowEstatesCommand(string module, string[] cmd)
205 { 172 {
206 StringBuilder report = new StringBuilder(); 173 StringBuilder report = new StringBuilder();
207 RegionInfo ri = m_module.Scene.RegionInfo; 174 RegionInfo ri = m_module.Scene.RegionInfo;
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
index e3d04cd..f5a5c92 100644
--- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
@@ -78,45 +78,45 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
78 m_scene = scene; 78 m_scene = scene;
79 m_console = MainConsole.Instance; 79 m_console = MainConsole.Instance;
80 80
81 m_console.Commands.AddCommand("region", false, "delete object owner", 81 m_console.Commands.AddCommand("Regions", false, "delete object owner",
82 "delete object owner <UUID>", 82 "delete object owner <UUID>",
83 "Delete a scene object by owner", HandleDeleteObject); 83 "Delete a scene object by owner", HandleDeleteObject);
84 m_console.Commands.AddCommand("region", false, "delete object creator", 84 m_console.Commands.AddCommand("Regions", false, "delete object creator",
85 "delete object creator <UUID>", 85 "delete object creator <UUID>",
86 "Delete a scene object by creator", HandleDeleteObject); 86 "Delete a scene object by creator", HandleDeleteObject);
87 m_console.Commands.AddCommand("region", false, "delete object uuid", 87 m_console.Commands.AddCommand("Regions", false, "delete object uuid",
88 "delete object uuid <UUID>", 88 "delete object uuid <UUID>",
89 "Delete a scene object by uuid", HandleDeleteObject); 89 "Delete a scene object by uuid", HandleDeleteObject);
90 m_console.Commands.AddCommand("region", false, "delete object name", 90 m_console.Commands.AddCommand("Regions", false, "delete object name",
91 "delete object name <name>", 91 "delete object name <name>",
92 "Delete a scene object by name", HandleDeleteObject); 92 "Delete a scene object by name", HandleDeleteObject);
93 m_console.Commands.AddCommand("region", false, "delete object outside", 93 m_console.Commands.AddCommand("Regions", false, "delete object outside",
94 "delete object outside", 94 "delete object outside",
95 "Delete all scene objects outside region boundaries", HandleDeleteObject); 95 "Delete all scene objects outside region boundaries", HandleDeleteObject);
96 96
97 m_console.Commands.AddCommand( 97 m_console.Commands.AddCommand(
98 "region", 98 "Regions",
99 false, 99 false,
100 "show object uuid", 100 "show object uuid",
101 "show object uuid <UUID>", 101 "show object uuid <UUID>",
102 "Show details of a scene object with the given UUID", HandleShowObjectByUuid); 102 "Show details of a scene object with the given UUID", HandleShowObjectByUuid);
103 103
104 m_console.Commands.AddCommand( 104 m_console.Commands.AddCommand(
105 "region", 105 "Regions",
106 false, 106 false,
107 "show object name", 107 "show object name",
108 "show object name <name>", 108 "show object name <name>",
109 "Show details of scene objects with the given name", HandleShowObjectByName); 109 "Show details of scene objects with the given name", HandleShowObjectByName);
110 110
111 m_console.Commands.AddCommand( 111 m_console.Commands.AddCommand(
112 "region", 112 "Regions",
113 false, 113 false,
114 "show part uuid", 114 "show part uuid",
115 "show part uuid <UUID>", 115 "show part uuid <UUID>",
116 "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); 116 "Show details of a scene object parts with the given UUID", HandleShowPartByUuid);
117 117
118 m_console.Commands.AddCommand( 118 m_console.Commands.AddCommand(
119 "region", 119 "Regions",
120 false, 120 false,
121 "show part name", 121 "show part name",
122 "show part name <name>", 122 "show part name <name>",
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index df9bad1..e4ecc64 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -206,17 +206,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions
206 m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; 206 m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia;
207 m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; 207 m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia;
208 208
209 m_scene.AddCommand(this, "bypass permissions", 209 m_scene.AddCommand("Users", this, "bypass permissions",
210 "bypass permissions <true / false>", 210 "bypass permissions <true / false>",
211 "Bypass permission checks", 211 "Bypass permission checks",
212 HandleBypassPermissions); 212 HandleBypassPermissions);
213 213
214 m_scene.AddCommand(this, "force permissions", 214 m_scene.AddCommand("Users", this, "force permissions",
215 "force permissions <true / false>", 215 "force permissions <true / false>",
216 "Force permissions on or off", 216 "Force permissions on or off",
217 HandleForcePermissions); 217 HandleForcePermissions);
218 218
219 m_scene.AddCommand(this, "debug permissions", 219 m_scene.AddCommand("Users", this, "debug permissions",
220 "debug permissions <true / false>", 220 "debug permissions <true / false>",
221 "Turn on permissions debugging", 221 "Turn on permissions debugging",
222 HandleDebugPermissions); 222 HandleDebugPermissions);
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
index 86821c6..65180b5a 100644
--- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
+++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
@@ -78,21 +78,21 @@ namespace OpenSim.Region.CoreModules.World.Region
78 m_Scene = scene; 78 m_Scene = scene;
79 79
80 scene.RegisterModuleInterface<IRestartModule>(this); 80 scene.RegisterModuleInterface<IRestartModule>(this);
81 MainConsole.Instance.Commands.AddCommand("RestartModule", 81 MainConsole.Instance.Commands.AddCommand("Regions",
82 false, "region restart bluebox", 82 false, "region restart bluebox",
83 "region restart bluebox <message> <delta seconds>+", 83 "region restart bluebox <message> <delta seconds>+",
84 "Schedule a region restart", 84 "Schedule a region restart",
85 "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a dismissable bluebox notice. If multiple deltas are given then a notice is sent when we reach each delta.", 85 "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a dismissable bluebox notice. If multiple deltas are given then a notice is sent when we reach each delta.",
86 HandleRegionRestart); 86 HandleRegionRestart);
87 87
88 MainConsole.Instance.Commands.AddCommand("RestartModule", 88 MainConsole.Instance.Commands.AddCommand("Regions",
89 false, "region restart notice", 89 false, "region restart notice",
90 "region restart notice <message> <delta seconds>+", 90 "region restart notice <message> <delta seconds>+",
91 "Schedule a region restart", 91 "Schedule a region restart",
92 "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a transient notice. If multiple deltas are given then a notice is sent when we reach each delta.", 92 "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a transient notice. If multiple deltas are given then a notice is sent when we reach each delta.",
93 HandleRegionRestart); 93 HandleRegionRestart);
94 94
95 MainConsole.Instance.Commands.AddCommand("RestartModule", 95 MainConsole.Instance.Commands.AddCommand("Regions",
96 false, "region restart abort", 96 false, "region restart abort",
97 "region restart abort [<message>]", 97 "region restart abort [<message>]",
98 "Abort a region restart", HandleRegionRestart); 98 "Abort a region restart", HandleRegionRestart);
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
index a838e1e..9a954b8 100644
--- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
@@ -277,18 +277,19 @@ namespace OpenSim.Region.CoreModules
277 m_frame = 0; 277 m_frame = 0;
278 278
279 // This one puts an entry in the main help screen 279 // This one puts an entry in the main help screen
280 m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null); 280// m_scene.AddCommand("Regions", this, "sun", "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null);
281 281
282 // This one enables the ability to type just "sun" without any parameters 282 // This one enables the ability to type just "sun" without any parameters
283 m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand); 283// m_scene.AddCommand("Regions", this, "sun", "", "", HandleSunConsoleCommand);
284 foreach (KeyValuePair<string, string> kvp in GetParamList()) 284 foreach (KeyValuePair<string, string> kvp in GetParamList())
285 { 285 {
286 m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); 286 string sunCommand = string.Format("sun {0}", kvp.Key);
287 m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand);
287 } 288 }
288 289
289 TimeZone local = TimeZone.CurrentTimeZone; 290 TimeZone local = TimeZone.CurrentTimeZone;
290 TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; 291 TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks;
291 m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); 292 m_log.DebugFormat("[SUN]: localtime offset is {0}", TicksUTCOffset);
292 293
293 // Align ticks with Second Life 294 // Align ticks with Second Life
294 295
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
index a488725..7b6fbda 100644
--- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
@@ -117,24 +117,31 @@ namespace OpenSim.Region.CoreModules
117 } 117 }
118 118
119 // This one puts an entry in the main help screen 119 // This one puts an entry in the main help screen
120 m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null); 120// m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null);
121 121
122 // This one enables the ability to type just the base command without any parameters 122 // This one enables the ability to type just the base command without any parameters
123 m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand); 123// m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand);
124 124
125 // Get a list of the parameters for each plugin 125 // Get a list of the parameters for each plugin
126 foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) 126 foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values)
127 { 127 {
128 m_scene.AddCommand(this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); 128// m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand);
129 m_scene.AddCommand(this, String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand); 129 m_scene.AddCommand(
130 "Regions",
131 this,
132 "wind base wind_update_rate",
133 "wind base wind_update_rate [<value>]",
134 "Get or set the wind update rate.",
135 "",
136 HandleConsoleBaseCommand);
130 137
131 foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams()) 138 foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams())
132 { 139 {
133 m_scene.AddCommand(this, String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand); 140 string windCommand = String.Format("wind {0} {1}", windPlugin.Name, kvp.Key);
141 m_scene.AddCommand("Regions", this, windCommand, string.Format("{0} [<value>]", windCommand), kvp.Value, "", HandleConsoleParamCommand);
134 } 142 }
135 } 143 }
136 144
137
138 // Register event handlers for when Avatars enter the region, and frame ticks 145 // Register event handlers for when Avatars enter the region, and frame ticks
139 m_scene.EventManager.OnFrame += WindUpdate; 146 m_scene.EventManager.OnFrame += WindUpdate;
140 m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; 147 m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion;
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 4ebfb21..899e5ea 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
102 m_scene.RegisterModuleInterface<IWorldMapModule>(this); 102 m_scene.RegisterModuleInterface<IWorldMapModule>(this);
103 103
104 m_scene.AddCommand( 104 m_scene.AddCommand(
105 this, "export-map", 105 "Regions", this, "export-map",
106 "export-map [<path>]", 106 "export-map [<path>]",
107 "Save an image of the world map", HandleExportWorldMapConsoleCommand); 107 "Save an image of the world map", HandleExportWorldMapConsoleCommand);
108 108
@@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
132 { 132 {
133 } 133 }
134 134
135 public Type ReplaceableInterface 135 public Type ReplaceableInterface
136 { 136 {
137 get { return null; } 137 get { return null; }
138 } 138 }
@@ -220,7 +220,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
220 // There is a major hack going on in this method. The viewer doesn't request 220 // There is a major hack going on in this method. The viewer doesn't request
221 // map blocks (RequestMapBlocks) above 2048. That means that if we don't hack, 221 // map blocks (RequestMapBlocks) above 2048. That means that if we don't hack,
222 // grids above that cell don't have a map at all. So, here's the hack: we wait 222 // grids above that cell don't have a map at all. So, here's the hack: we wait
223 // for this CAP request to come, and we inject the map blocks at this point. 223 // for this CAP request to come, and we inject the map blocks at this point.
224 // In a normal scenario, this request simply sends back the MapLayer (the blue color). 224 // In a normal scenario, this request simply sends back the MapLayer (the blue color).
225 // In the hacked scenario, it also sends the map blocks via UDP. 225 // In the hacked scenario, it also sends the map blocks via UDP.
226 // 226 //
@@ -351,6 +351,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
351 process, 351 process,
352 string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName), 352 string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName),
353 ThreadPriority.BelowNormal, 353 ThreadPriority.BelowNormal,
354 true,
354 true); 355 true);
355 } 356 }
356 357
@@ -750,7 +751,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
750 { 751 {
751 uint x = 0, y = 0; 752 uint x = 0, y = 0;
752 Utils.LongToUInts(regionhandle, out x, out y); 753 Utils.LongToUInts(regionhandle, out x, out y);
753 GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); 754 GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
754 755
755 if (mreg != null) 756 if (mreg != null)
756 { 757 {
@@ -856,7 +857,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
856 finally 857 finally
857 { 858 {
858 if (os != null) 859 if (os != null)
859 os.Close(); 860 os.Close();
860 } 861 }
861 862
862 string response_mapItems_reply = null; 863 string response_mapItems_reply = null;
@@ -959,16 +960,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
959 // on an unloaded square. 960 // on an unloaded square.
960 // But make sure: Look whether the one we requested is in there 961 // But make sure: Look whether the one we requested is in there
961 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 962 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
962 minX * (int)Constants.RegionSize, 963 minX * (int)Constants.RegionSize,
963 maxX * (int)Constants.RegionSize, 964 maxX * (int)Constants.RegionSize,
964 minY * (int)Constants.RegionSize, 965 minY * (int)Constants.RegionSize,
965 maxY * (int)Constants.RegionSize); 966 maxY * (int)Constants.RegionSize);
966 967
967 if (regions != null) 968 if (regions != null)
968 { 969 {
969 foreach (GridRegion r in regions) 970 foreach (GridRegion r in regions)
970 { 971 {
971 if ((r.RegionLocX == minX * (int)Constants.RegionSize) && 972 if ((r.RegionLocX == minX * (int)Constants.RegionSize) &&
972 (r.RegionLocY == minY * (int)Constants.RegionSize)) 973 (r.RegionLocY == minY * (int)Constants.RegionSize))
973 { 974 {
974 // found it => add it to response 975 // found it => add it to response
@@ -1003,7 +1004,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1003 { 1004 {
1004 List<MapBlockData> mapBlocks = new List<MapBlockData>(); 1005 List<MapBlockData> mapBlocks = new List<MapBlockData>();
1005 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 1006 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
1006 (minX - 4) * (int)Constants.RegionSize, 1007 (minX - 4) * (int)Constants.RegionSize,
1007 (maxX + 4) * (int)Constants.RegionSize, 1008 (maxX + 4) * (int)Constants.RegionSize,
1008 (minY - 4) * (int)Constants.RegionSize, 1009 (minY - 4) * (int)Constants.RegionSize,
1009 (maxY + 4) * (int)Constants.RegionSize); 1010 (maxY + 4) * (int)Constants.RegionSize);
@@ -1335,7 +1336,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1335 // Cannot create a map for a nonexistant heightmap 1336 // Cannot create a map for a nonexistant heightmap
1336 if (m_scene.Heightmap == null) 1337 if (m_scene.Heightmap == null)
1337 return; 1338 return;
1338 1339
1339 //create a texture asset of the terrain 1340 //create a texture asset of the terrain
1340 IMapImageGenerator terrain = m_scene.RequestModuleInterface<IMapImageGenerator>(); 1341 IMapImageGenerator terrain = m_scene.RequestModuleInterface<IMapImageGenerator>();
1341 if (terrain == null) 1342 if (terrain == null)
@@ -1344,7 +1345,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1344 byte[] data = terrain.WriteJpeg2000Image(); 1345 byte[] data = terrain.WriteJpeg2000Image();
1345 if (data == null) 1346 if (data == null)
1346 return; 1347 return;
1347 1348
1348 byte[] overlay = GenerateOverlay(); 1349 byte[] overlay = GenerateOverlay();
1349 1350
1350 m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE"); 1351 m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE");
@@ -1365,7 +1366,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1365 // Store the new one 1366 // Store the new one
1366 m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID); 1367 m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID);
1367 m_scene.AssetService.Store(asset); 1368 m_scene.AssetService.Store(asset);
1368 1369
1369 if (overlay != null) 1370 if (overlay != null)
1370 { 1371 {
1371 parcelImageID = UUID.Random(); 1372 parcelImageID = UUID.Random();
@@ -1389,7 +1390,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1389 m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID; 1390 m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID;
1390 m_scene.RegionInfo.RegionSettings.ParcelImageID = parcelImageID; 1391 m_scene.RegionInfo.RegionSettings.ParcelImageID = parcelImageID;
1391 m_scene.RegionInfo.RegionSettings.Save(); 1392 m_scene.RegionInfo.RegionSettings.Save();
1392 1393
1393 // Delete the old one 1394 // Delete the old one
1394 // m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastTerrainImageID); 1395 // m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastTerrainImageID);
1395 m_scene.AssetService.Delete(lastTerrainImageID.ToString()); 1396 m_scene.AssetService.Delete(lastTerrainImageID.ToString());
@@ -1510,11 +1511,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1510 1511
1511 if (!landForSale) 1512 if (!landForSale)
1512 { 1513 {
1513 m_log.DebugFormat("[WORLD MAP]: Region {0} has no parcels for sale, not geenrating overlay", m_scene.RegionInfo.RegionName); 1514 m_log.DebugFormat("[WORLD MAP]: Region {0} has no parcels for sale, not generating overlay", m_scene.RegionInfo.RegionName);
1514 return null; 1515 return null;
1515 } 1516 }
1516 1517
1517 m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, genrating overlay", m_scene.RegionInfo.RegionName); 1518 m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, generating overlay", m_scene.RegionInfo.RegionName);
1518 1519
1519 try 1520 try
1520 { 1521 {
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
index dafbf30..e8e375e 100644
--- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
@@ -50,6 +50,11 @@ namespace OpenSim.Region.Framework.Interfaces
50 public interface IWorldComm 50 public interface IWorldComm
51 { 51 {
52 /// <summary> 52 /// <summary>
53 /// Total number of listeners
54 /// </summary>
55 int ListenerCount { get; }
56
57 /// <summary>
53 /// Create a listen event callback with the specified filters. 58 /// Create a listen event callback with the specified filters.
54 /// The parameters localID,itemID are needed to uniquely identify 59 /// The parameters localID,itemID are needed to uniquely identify
55 /// the script during 'peek' time. Parameter hostID is needed to 60 /// the script during 'peek' time. Parameter hostID is needed to
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 9fcd5fe..605ee32 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -142,8 +142,11 @@ namespace OpenSim.Region.Framework.Scenes
142 public event OnPermissionErrorDelegate OnPermissionError; 142 public event OnPermissionErrorDelegate OnPermissionError;
143 143
144 /// <summary> 144 /// <summary>
145 /// Fired when a new script is created. 145 /// Fired when a script is run.
146 /// </summary> 146 /// </summary>
147 /// <remarks>
148 /// Occurs after OnNewScript.
149 /// </remarks>
147 public event NewRezScript OnRezScript; 150 public event NewRezScript OnRezScript;
148 public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); 151 public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
149 152
@@ -191,10 +194,16 @@ namespace OpenSim.Region.Framework.Scenes
191 194
192 public event ClientClosed OnClientClosed; 195 public event ClientClosed OnClientClosed;
193 196
194 // Fired when a script is created
195 // The indication that a new script exists in this region.
196 public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID); 197 public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID);
198
199 /// <summary>
200 /// Fired when a script is created.
201 /// </summary>
202 /// <remarks>
203 /// Occurs before OnRezScript
204 /// </remarks>
197 public event NewScript OnNewScript; 205 public event NewScript OnNewScript;
206
198 public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID) 207 public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
199 { 208 {
200 NewScript handlerNewScript = OnNewScript; 209 NewScript handlerNewScript = OnNewScript;
@@ -216,10 +225,16 @@ namespace OpenSim.Region.Framework.Scenes
216 } 225 }
217 } 226 }
218 227
219 //TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset
220 // An indication that the script has changed.
221 public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID); 228 public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID);
229
230 /// <summary>
231 /// An indication that the script has changed.
232 /// </summary>
233 /// <remarks>
234 /// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset.
235 /// </remarks>
222 public event UpdateScript OnUpdateScript; 236 public event UpdateScript OnUpdateScript;
237
223 public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID) 238 public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
224 { 239 {
225 UpdateScript handlerUpdateScript = OnUpdateScript; 240 UpdateScript handlerUpdateScript = OnUpdateScript;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 5d27d86..68c05f8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -619,7 +619,7 @@ namespace OpenSim.Region.Framework.Scenes
619 619
620 #endregion Region Settings 620 #endregion Region Settings
621 621
622 MainConsole.Instance.Commands.AddCommand("region", false, "reload estate", 622 MainConsole.Instance.Commands.AddCommand("Estates", false, "reload estate",
623 "reload estate", 623 "reload estate",
624 "Reload the estate data", HandleReloadEstate); 624 "Reload the estate data", HandleReloadEstate);
625 625
@@ -651,101 +651,104 @@ namespace OpenSim.Region.Framework.Scenes
651 651
652 #region Region Config 652 #region Region Config
653 653
654 // Region config overrides global config
655 //
654 try 656 try
655 { 657 {
656 // Region config overrides global config 658 if (m_config.Configs["Startup"] != null)
657 // 659 {
658 IConfig startupConfig = m_config.Configs["Startup"]; 660 IConfig startupConfig = m_config.Configs["Startup"];
659 661
660 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); 662 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
661 m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); 663 m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup);
662 if (!m_useBackup) 664 if (!m_useBackup)
663 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); 665 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
664 666
665 //Animation states 667 //Animation states
666 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 668 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
667 669
668 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); 670 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
669 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); 671 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
670 672
671 m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); 673 m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys);
672 if (RegionInfo.NonphysPrimMax > 0) 674 if (RegionInfo.NonphysPrimMax > 0)
673 { 675 {
674 m_maxNonphys = RegionInfo.NonphysPrimMax; 676 m_maxNonphys = RegionInfo.NonphysPrimMax;
675 } 677 }
676 678
677 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); 679 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
678 680
679 if (RegionInfo.PhysPrimMax > 0) 681 if (RegionInfo.PhysPrimMax > 0)
680 { 682 {
681 m_maxPhys = RegionInfo.PhysPrimMax; 683 m_maxPhys = RegionInfo.PhysPrimMax;
682 } 684 }
683 685
684 // Here, if clamping is requested in either global or 686 // Here, if clamping is requested in either global or
685 // local config, it will be used 687 // local config, it will be used
686 // 688 //
687 m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); 689 m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize);
688 if (RegionInfo.ClampPrimSize) 690 if (RegionInfo.ClampPrimSize)
689 { 691 {
690 m_clampPrimSize = true; 692 m_clampPrimSize = true;
691 } 693 }
692 694
693 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); 695 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
694 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); 696 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
695 m_dontPersistBefore = 697 m_dontPersistBefore =
696 startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); 698 startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
697 m_dontPersistBefore *= 10000000; 699 m_dontPersistBefore *= 10000000;
698 m_persistAfter = 700 m_persistAfter =
699 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); 701 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
700 m_persistAfter *= 10000000; 702 m_persistAfter *= 10000000;
701 703
702 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); 704 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
703 m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); 705 m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
704 706
705 IConfig packetConfig = m_config.Configs["PacketPool"]; 707 IConfig packetConfig = m_config.Configs["PacketPool"];
706 if (packetConfig != null) 708 if (packetConfig != null)
707 { 709 {
708 PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); 710 PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true);
709 PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); 711 PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true);
710 } 712 }
711 713
712 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); 714 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
713 m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); 715 m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
714 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); 716 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
715 717
716 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); 718 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
717 if (m_generateMaptiles) 719 if (m_generateMaptiles)
718 {
719 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
720 if (maptileRefresh != 0)
721 { 720 {
722 m_mapGenerationTimer.Interval = maptileRefresh * 1000; 721 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
723 m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; 722 if (maptileRefresh != 0)
724 m_mapGenerationTimer.AutoReset = true; 723 {
725 m_mapGenerationTimer.Start(); 724 m_mapGenerationTimer.Interval = maptileRefresh * 1000;
725 m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
726 m_mapGenerationTimer.AutoReset = true;
727 m_mapGenerationTimer.Start();
728 }
726 } 729 }
727 } 730 else
728 else
729 {
730 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
731 UUID tileID;
732
733 if (UUID.TryParse(tile, out tileID))
734 { 731 {
735 RegionInfo.RegionSettings.TerrainImageID = tileID; 732 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
733 UUID tileID;
734
735 if (UUID.TryParse(tile, out tileID))
736 {
737 RegionInfo.RegionSettings.TerrainImageID = tileID;
738 }
736 } 739 }
737 }
738 740
739 MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); 741 MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
740 m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); 742 m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup);
741 m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); 743 m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
742 m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); 744 m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement);
743 m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); 745 m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events);
744 m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); 746 m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects);
745 m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); 747 m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics);
746 m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); 748 m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences);
747 m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); 749 m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain);
748 m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); 750 m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning);
751 }
749 } 752 }
750 catch (Exception e) 753 catch (Exception e)
751 { 754 {
@@ -756,37 +759,34 @@ namespace OpenSim.Region.Framework.Scenes
756 759
757 #region Interest Management 760 #region Interest Management
758 761
759 if (m_config != null) 762 IConfig interestConfig = m_config.Configs["InterestManagement"];
763 if (interestConfig != null)
760 { 764 {
761 IConfig interestConfig = m_config.Configs["InterestManagement"]; 765 string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower();
762 if (interestConfig != null)
763 {
764 string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower();
765
766 try
767 {
768 m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true);
769 }
770 catch (Exception)
771 {
772 m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time");
773 m_priorityScheme = UpdatePrioritizationSchemes.Time;
774 }
775 766
776 m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true); 767 try
777 m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0); 768 {
778 m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0); 769 m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true);
779 m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0);
780 } 770 }
771 catch (Exception)
772 {
773 m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time");
774 m_priorityScheme = UpdatePrioritizationSchemes.Time;
775 }
776
777 m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true);
778 m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0);
779 m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0);
780 m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0);
781 } 781 }
782 782
783 m_log.InfoFormat("[SCENE]: Using the {0} prioritization scheme", m_priorityScheme); 783 m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", m_priorityScheme);
784 784
785 #endregion Interest Management 785 #endregion Interest Management
786 786
787 StatsReporter = new SimStatsReporter(this); 787 StatsReporter = new SimStatsReporter(this);
788 StatsReporter.OnSendStatsResult += SendSimStatsPackets; 788 StatsReporter.OnSendStatsResult += SendSimStatsPackets;
789 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; 789 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
790 } 790 }
791 791
792 /// <summary> 792 /// <summary>
@@ -1102,6 +1102,8 @@ namespace OpenSim.Region.Framework.Scenes
1102 { 1102 {
1103 m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); 1103 m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName);
1104 1104
1105 StatsReporter.Close();
1106
1105 m_restartTimer.Stop(); 1107 m_restartTimer.Stop();
1106 m_restartTimer.Close(); 1108 m_restartTimer.Close();
1107 1109
@@ -1181,7 +1183,7 @@ namespace OpenSim.Region.Framework.Scenes
1181 1183
1182 HeartbeatThread 1184 HeartbeatThread
1183 = Watchdog.StartThread( 1185 = Watchdog.StartThread(
1184 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false); 1186 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
1185 } 1187 }
1186 1188
1187 /// <summary> 1189 /// <summary>
@@ -1219,6 +1221,13 @@ namespace OpenSim.Region.Framework.Scenes
1219 try 1221 try
1220 { 1222 {
1221 m_eventManager.TriggerOnRegionStarted(this); 1223 m_eventManager.TriggerOnRegionStarted(this);
1224
1225 // The first frame can take a very long time due to physics actors being added on startup. Therefore,
1226 // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false
1227 // alarms for scenes with many objects.
1228 Update();
1229 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
1230
1222 while (!shuttingdown) 1231 while (!shuttingdown)
1223 Update(); 1232 Update();
1224 } 1233 }
@@ -1244,7 +1253,7 @@ namespace OpenSim.Region.Framework.Scenes
1244 1253
1245 ++Frame; 1254 ++Frame;
1246 1255
1247// m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame); 1256// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
1248 1257
1249 try 1258 try
1250 { 1259 {
@@ -1406,26 +1415,10 @@ namespace OpenSim.Region.Framework.Scenes
1406 { 1415 {
1407 throw; 1416 throw;
1408 } 1417 }
1409 catch (AccessViolationException e)
1410 {
1411 m_log.ErrorFormat(
1412 "[REGION]: Failed on region {0} with exception {1}{2}",
1413 RegionInfo.RegionName, e.Message, e.StackTrace);
1414 }
1415 //catch (NullReferenceException e)
1416 //{
1417 // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
1418 //}
1419 catch (InvalidOperationException e)
1420 {
1421 m_log.ErrorFormat(
1422 "[REGION]: Failed on region {0} with exception {1}{2}",
1423 RegionInfo.RegionName, e.Message, e.StackTrace);
1424 }
1425 catch (Exception e) 1418 catch (Exception e)
1426 { 1419 {
1427 m_log.ErrorFormat( 1420 m_log.ErrorFormat(
1428 "[REGION]: Failed on region {0} with exception {1}{2}", 1421 "[SCENE]: Failed on region {0} with exception {1}{2}",
1429 RegionInfo.RegionName, e.Message, e.StackTrace); 1422 RegionInfo.RegionName, e.Message, e.StackTrace);
1430 } 1423 }
1431 1424
@@ -1467,7 +1460,6 @@ namespace OpenSim.Region.Framework.Scenes
1467 entry.checkAtTargets(); 1460 entry.checkAtTargets();
1468 } 1461 }
1469 1462
1470
1471 /// <summary> 1463 /// <summary>
1472 /// Send out simstats data to all clients 1464 /// Send out simstats data to all clients
1473 /// </summary> 1465 /// </summary>
@@ -4342,16 +4334,11 @@ namespace OpenSim.Region.Framework.Scenes
4342 public bool PipeEventsForScript(uint localID) 4334 public bool PipeEventsForScript(uint localID)
4343 { 4335 {
4344 SceneObjectPart part = GetSceneObjectPart(localID); 4336 SceneObjectPart part = GetSceneObjectPart(localID);
4337
4345 if (part != null) 4338 if (part != null)
4346 { 4339 {
4347 // Changed so that child prims of attachments return ScriptDanger for their parent, so that
4348 // their scripts will actually run.
4349 // -- Leaf, Tue Aug 12 14:17:05 EDT 2008
4350 SceneObjectPart parent = part.ParentGroup.RootPart; 4340 SceneObjectPart parent = part.ParentGroup.RootPart;
4351 if (part.ParentGroup.IsAttachment) 4341 return ScriptDanger(parent, parent.GetWorldPosition());
4352 return ScriptDanger(parent, parent.GetWorldPosition());
4353 else
4354 return ScriptDanger(part, part.GetWorldPosition());
4355 } 4342 }
4356 else 4343 else
4357 { 4344 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index da3b4dd..1e80f73 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -474,6 +474,63 @@ namespace OpenSim.Region.Framework.Scenes
474 /// <summary> 474 /// <summary>
475 /// Call this from a region module to add a command to the OpenSim console. 475 /// Call this from a region module to add a command to the OpenSim console.
476 /// </summary> 476 /// </summary>
477 /// <param name="mod">
478 /// The use of IRegionModuleBase is a cheap trick to get a different method signature,
479 /// though all new modules should be using interfaces descended from IRegionModuleBase anyway.
480 /// </param>
481 /// <param name="category">
482 /// Category of the command. This is the section under which it will appear when the user asks for help
483 /// </param>
484 /// <param name="command"></param>
485 /// <param name="shorthelp"></param>
486 /// <param name="longhelp"></param>
487 /// <param name="callback"></param>
488 public void AddCommand(
489 string category, object mod, string command, string shorthelp, string longhelp, CommandDelegate callback)
490 {
491 AddCommand(category, mod, command, shorthelp, longhelp, string.Empty, callback);
492 }
493
494 /// <summary>
495 /// Call this from a region module to add a command to the OpenSim console.
496 /// </summary>
497 /// <param name="mod"></param>
498 /// <param name="command"></param>
499 /// <param name="shorthelp"></param>
500 /// <param name="longhelp"></param>
501 /// <param name="descriptivehelp"></param>
502 /// <param name="callback"></param>
503 public void AddCommand(object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
504 {
505 string moduleName = "";
506
507 if (mod != null)
508 {
509 if (mod is IRegionModule)
510 {
511 IRegionModule module = (IRegionModule)mod;
512 moduleName = module.Name;
513 }
514 else if (mod is IRegionModuleBase)
515 {
516 IRegionModuleBase module = (IRegionModuleBase)mod;
517 moduleName = module.Name;
518 }
519 else
520 {
521 throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
522 }
523 }
524
525 AddCommand(moduleName, mod, command, shorthelp, longhelp, descriptivehelp, callback);
526 }
527
528 /// <summary>
529 /// Call this from a region module to add a command to the OpenSim console.
530 /// </summary>
531 /// <param name="category">
532 /// Category of the command. This is the section under which it will appear when the user asks for help
533 /// </param>
477 /// <param name="mod"></param> 534 /// <param name="mod"></param>
478 /// <param name="command"></param> 535 /// <param name="command"></param>
479 /// <param name="shorthelp"></param> 536 /// <param name="shorthelp"></param>
@@ -481,12 +538,12 @@ namespace OpenSim.Region.Framework.Scenes
481 /// <param name="descriptivehelp"></param> 538 /// <param name="descriptivehelp"></param>
482 /// <param name="callback"></param> 539 /// <param name="callback"></param>
483 public void AddCommand( 540 public void AddCommand(
484 object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) 541 string category, object mod, string command,
542 string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
485 { 543 {
486 if (MainConsole.Instance == null) 544 if (MainConsole.Instance == null)
487 return; 545 return;
488 546
489 string modulename = String.Empty;
490 bool shared = false; 547 bool shared = false;
491 548
492 if (mod != null) 549 if (mod != null)
@@ -494,20 +551,20 @@ namespace OpenSim.Region.Framework.Scenes
494 if (mod is IRegionModule) 551 if (mod is IRegionModule)
495 { 552 {
496 IRegionModule module = (IRegionModule)mod; 553 IRegionModule module = (IRegionModule)mod;
497 modulename = module.Name;
498 shared = module.IsSharedModule; 554 shared = module.IsSharedModule;
499 } 555 }
500 else if (mod is IRegionModuleBase) 556 else if (mod is IRegionModuleBase)
501 { 557 {
502 IRegionModuleBase module = (IRegionModuleBase)mod;
503 modulename = module.Name;
504 shared = mod is ISharedRegionModule; 558 shared = mod is ISharedRegionModule;
505 } 559 }
506 else throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); 560 else
561 {
562 throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
563 }
507 } 564 }
508 565
509 MainConsole.Instance.Commands.AddCommand( 566 MainConsole.Instance.Commands.AddCommand(
510 modulename, shared, command, shorthelp, longhelp, descriptivehelp, callback); 567 category, shared, command, shorthelp, longhelp, descriptivehelp, callback);
511 } 568 }
512 569
513 public virtual ISceneObject DeserializeObject(string representation) 570 public virtual ISceneObject DeserializeObject(string representation)
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 65ffe92..b806d91 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -156,8 +156,8 @@ namespace OpenSim.Region.Framework.Scenes
156 // that the region position is cached or performance will degrade 156 // that the region position is cached or performance will degrade
157 Utils.LongToUInts(regionHandle, out x, out y); 157 Utils.LongToUInts(regionHandle, out x, out y);
158 GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); 158 GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
159 bool v = true; 159// bool v = true;
160 if (! simulatorList.Contains(dest.ServerURI)) 160 if (!simulatorList.Contains(dest.ServerURI))
161 { 161 {
162 // we havent seen this simulator before, add it to the list 162 // we havent seen this simulator before, add it to the list
163 // and send it an update 163 // and send it an update
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index a320601..3cd4a10 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -230,27 +230,9 @@ namespace OpenSim.Region.Framework.Scenes
230 if (sp.IsChildAgent) 230 if (sp.IsChildAgent)
231 continue; 231 continue;
232 232
233 if (sp.ParentID != 0) 233 coarseLocations.Add(sp.AbsolutePosition);
234 { 234
235 // sitting avatar 235 avatarUUIDs.Add(sp.UUID);
236 SceneObjectPart sop = m_parentScene.GetSceneObjectPart(sp.ParentID);
237 if (sop != null)
238 {
239 coarseLocations.Add(sop.AbsolutePosition + sp.OffsetPosition);
240 avatarUUIDs.Add(sp.UUID);
241 }
242 else
243 {
244 // we can't find the parent.. ! arg!
245 coarseLocations.Add(sp.AbsolutePosition);
246 avatarUUIDs.Add(sp.UUID);
247 }
248 }
249 else
250 {
251 coarseLocations.Add(sp.AbsolutePosition);
252 avatarUUIDs.Add(sp.UUID);
253 }
254 } 236 }
255 } 237 }
256 238
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 4ba04c1..6622495 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1691,8 +1691,6 @@ namespace OpenSim.Region.Framework.Scenes
1691 if (userExposed) 1691 if (userExposed)
1692 dupe.UUID = UUID.Random(); 1692 dupe.UUID = UUID.Random();
1693 1693
1694 // The PhysActor cannot be valid on a copy because the copy is not in the scene yet.
1695 // Null it, the caller has to create a new one once the object is added to a scene
1696 dupe.PhysActor = null; 1694 dupe.PhysActor = null;
1697 1695
1698 dupe.OwnerID = AgentID; 1696 dupe.OwnerID = AgentID;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 8a7c06a..c4aaebe 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -349,13 +349,7 @@ namespace OpenSim.Region.Framework.Scenes
349 /// </summary> 349 /// </summary>
350 protected Vector3 m_lastCameraPosition; 350 protected Vector3 m_lastCameraPosition;
351 351
352 protected Vector3 m_CameraPosition; 352 public Vector3 CameraPosition { get; set; }
353
354 public Vector3 CameraPosition
355 {
356 get { return m_CameraPosition; }
357 private set { m_CameraPosition = value; }
358 }
359 353
360 public Quaternion CameraRotation 354 public Quaternion CameraRotation
361 { 355 {
@@ -365,28 +359,9 @@ namespace OpenSim.Region.Framework.Scenes
365 // Use these three vectors to figure out what the agent is looking at 359 // Use these three vectors to figure out what the agent is looking at
366 // Convert it to a Matrix and/or Quaternion 360 // Convert it to a Matrix and/or Quaternion
367 // 361 //
368 protected Vector3 m_CameraAtAxis; 362 public Vector3 CameraAtAxis { get; set; }
369 protected Vector3 m_CameraLeftAxis; 363 public Vector3 CameraLeftAxis { get; set; }
370 protected Vector3 m_CameraUpAxis; 364 public Vector3 CameraUpAxis { get; set; }
371
372 public Vector3 CameraAtAxis
373 {
374 get { return m_CameraAtAxis; }
375 private set { m_CameraAtAxis = value; }
376 }
377
378
379 public Vector3 CameraLeftAxis
380 {
381 get { return m_CameraLeftAxis; }
382 private set { m_CameraLeftAxis = value; }
383 }
384
385 public Vector3 CameraUpAxis
386 {
387 get { return m_CameraUpAxis; }
388 private set { m_CameraUpAxis = value; }
389 }
390 365
391 public Vector3 Lookat 366 public Vector3 Lookat
392 { 367 {
@@ -402,33 +377,15 @@ namespace OpenSim.Region.Framework.Scenes
402 } 377 }
403 #endregion 378 #endregion
404 379
405 public readonly string Firstname; 380 public string Firstname { get; private set; }
406 public readonly string Lastname; 381 public string Lastname { get; private set; }
407 382
408 private string m_grouptitle; 383 public string Grouptitle { get; set; }
409
410 public string Grouptitle
411 {
412 get { return m_grouptitle; }
413 set { m_grouptitle = value; }
414 }
415 384
416 // Agent's Draw distance. 385 // Agent's Draw distance.
417 protected float m_DrawDistance; 386 public float DrawDistance { get; set; }
418 387
419 public float DrawDistance 388 public bool AllowMovement { get; set; }
420 {
421 get { return m_DrawDistance; }
422 private set { m_DrawDistance = value; }
423 }
424
425 protected bool m_allowMovement = true;
426
427 public bool AllowMovement
428 {
429 get { return m_allowMovement; }
430 set { m_allowMovement = value; }
431 }
432 389
433 private bool m_setAlwaysRun; 390 private bool m_setAlwaysRun;
434 391
@@ -455,13 +412,7 @@ namespace OpenSim.Region.Framework.Scenes
455 } 412 }
456 } 413 }
457 414
458 private byte m_state; 415 public byte State { get; set; }
459
460 public byte State
461 {
462 get { return m_state; }
463 set { m_state = value; }
464 }
465 416
466 private AgentManager.ControlFlags m_AgentControlFlags; 417 private AgentManager.ControlFlags m_AgentControlFlags;
467 418
@@ -471,29 +422,14 @@ namespace OpenSim.Region.Framework.Scenes
471 set { m_AgentControlFlags = (AgentManager.ControlFlags)value; } 422 set { m_AgentControlFlags = (AgentManager.ControlFlags)value; }
472 } 423 }
473 424
474 /// <summary> 425 public IClientAPI ControllingClient { get; set; }
475 /// This works out to be the ClientView object associated with this avatar, or it's client connection manager
476 /// </summary>
477 private IClientAPI m_controllingClient;
478
479 public IClientAPI ControllingClient
480 {
481 get { return m_controllingClient; }
482 private set { m_controllingClient = value; }
483 }
484 426
485 public IClientCore ClientView 427 public IClientCore ClientView
486 { 428 {
487 get { return (IClientCore) m_controllingClient; } 429 get { return (IClientCore)ControllingClient; }
488 } 430 }
489 431
490 protected Vector3 m_parentPosition; 432 public Vector3 ParentPosition { get; set; }
491
492 public Vector3 ParentPosition
493 {
494 get { return m_parentPosition; }
495 set { m_parentPosition = value; }
496 }
497 433
498 /// <summary> 434 /// <summary>
499 /// Position of this avatar relative to the region the avatar is in 435 /// Position of this avatar relative to the region the avatar is in
@@ -502,7 +438,7 @@ namespace OpenSim.Region.Framework.Scenes
502 { 438 {
503 get 439 get
504 { 440 {
505 if (PhysicsActor != null && m_parentID == 0) 441 if (PhysicsActor != null)
506 { 442 {
507 m_pos = PhysicsActor.Position; 443 m_pos = PhysicsActor.Position;
508 444
@@ -525,12 +461,12 @@ namespace OpenSim.Region.Framework.Scenes
525 // in the sim unless the avatar is on a sit target. While 461 // in the sim unless the avatar is on a sit target. While
526 // on a sit target, m_pos will contain the desired offset 462 // on a sit target, m_pos will contain the desired offset
527 // without the parent rotation applied. 463 // without the parent rotation applied.
528 if (ParentID != 0) 464 SceneObjectPart sitPart = ParentPart;
529 { 465
530 SceneObjectPart part = ParentPart; 466 if (sitPart != null)
531 return part.AbsolutePosition + (m_pos * part.GetWorldRotation()); 467 return sitPart.AbsolutePosition + (m_pos * sitPart.GetWorldRotation());
532 }
533 } 468 }
469
534 return m_pos; 470 return m_pos;
535 } 471 }
536 set 472 set
@@ -547,7 +483,7 @@ namespace OpenSim.Region.Framework.Scenes
547 } 483 }
548 } 484 }
549 485
550 // Don't update while sitting 486 // Don't update while sitting. The PhysicsActor above is null whilst sitting.
551 if (ParentID == 0) 487 if (ParentID == 0)
552 { 488 {
553 m_pos = value; 489 m_pos = value;
@@ -574,6 +510,7 @@ namespace OpenSim.Region.Framework.Scenes
574 // There is no offset position when not seated 510 // There is no offset position when not seated
575 if (ParentID == 0) 511 if (ParentID == 0)
576 return; 512 return;
513
577 m_pos = value; 514 m_pos = value;
578 } 515 }
579 } 516 }
@@ -632,12 +569,10 @@ namespace OpenSim.Region.Framework.Scenes
632 569
633 public bool IsChildAgent { get; set; } 570 public bool IsChildAgent { get; set; }
634 571
635 public uint ParentID 572 /// <summary>
636 { 573 /// If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero.
637 get { return m_parentID; } 574 /// </summary>
638 set { m_parentID = value; } 575 public uint ParentID { get; set; }
639 }
640 private uint m_parentID;
641 576
642 public UUID ParentUUID 577 public UUID ParentUUID
643 { 578 {
@@ -646,12 +581,13 @@ namespace OpenSim.Region.Framework.Scenes
646 } 581 }
647 private UUID m_parentUUID = UUID.Zero; 582 private UUID m_parentUUID = UUID.Zero;
648 583
649 public SceneObjectPart ParentPart 584 /// <summary>
650 { 585 /// If the avatar is sitting, the prim that it's sitting on. If not sitting then null.
651 get { return m_parentPart; } 586 /// </summary>
652 set { m_parentPart = value; } 587 /// <remarks>
653 } 588 /// If you use this property then you must take a reference since another thread could set it to null.
654 private SceneObjectPart m_parentPart = null; 589 /// </remarks>
590 public SceneObjectPart ParentPart { get; set; }
655 591
656 public float Health 592 public float Health
657 { 593 {
@@ -760,7 +696,7 @@ namespace OpenSim.Region.Framework.Scenes
760 IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) 696 IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type)
761 { 697 {
762 AttachmentsSyncLock = new Object(); 698 AttachmentsSyncLock = new Object();
763 699 AllowMovement = true;
764 IsChildAgent = true; 700 IsChildAgent = true;
765 m_sendCourseLocationsMethod = SendCoarseLocationsDefault; 701 m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
766 Animator = new ScenePresenceAnimator(this); 702 Animator = new ScenePresenceAnimator(this);
@@ -839,17 +775,17 @@ namespace OpenSim.Region.Framework.Scenes
839 private Vector3[] GetWalkDirectionVectors() 775 private Vector3[] GetWalkDirectionVectors()
840 { 776 {
841 Vector3[] vector = new Vector3[11]; 777 Vector3[] vector = new Vector3[11];
842 vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD 778 vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD
843 vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK 779 vector[1] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK
844 vector[2] = Vector3.UnitY; //LEFT 780 vector[2] = Vector3.UnitY; //LEFT
845 vector[3] = -Vector3.UnitY; //RIGHT 781 vector[3] = -Vector3.UnitY; //RIGHT
846 vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP 782 vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP
847 vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN 783 vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN
848 vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE 784 vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE
849 vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE 785 vector[7] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK_NUDGE
850 vector[8] = Vector3.UnitY; //LEFT_NUDGE 786 vector[8] = Vector3.UnitY; //LEFT_NUDGE
851 vector[9] = -Vector3.UnitY; //RIGHT_NUDGE 787 vector[9] = -Vector3.UnitY; //RIGHT_NUDGE
852 vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_NUDGE 788 vector[10] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN_NUDGE
853 return vector; 789 return vector;
854 } 790 }
855 791
@@ -1381,7 +1317,7 @@ namespace OpenSim.Region.Framework.Scenes
1381 // Convert it to a Matrix and/or Quaternion 1317 // Convert it to a Matrix and/or Quaternion
1382 CameraAtAxis = agentData.CameraAtAxis; 1318 CameraAtAxis = agentData.CameraAtAxis;
1383 CameraLeftAxis = agentData.CameraLeftAxis; 1319 CameraLeftAxis = agentData.CameraLeftAxis;
1384 m_CameraUpAxis = agentData.CameraUpAxis; 1320 CameraUpAxis = agentData.CameraUpAxis;
1385 1321
1386 // The Agent's Draw distance setting 1322 // The Agent's Draw distance setting
1387 // When we get to the point of re-computing neighbors everytime this 1323 // When we get to the point of re-computing neighbors everytime this
@@ -1393,7 +1329,7 @@ namespace OpenSim.Region.Framework.Scenes
1393 // Check if Client has camera in 'follow cam' or 'build' mode. 1329 // Check if Client has camera in 'follow cam' or 'build' mode.
1394 Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); 1330 Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation);
1395 1331
1396 m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f) 1332 m_followCamAuto = ((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f)
1397 && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; 1333 && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false;
1398 1334
1399 m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; 1335 m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0;
@@ -2349,23 +2285,16 @@ namespace OpenSim.Region.Framework.Scenes
2349// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target", 2285// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target",
2350// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); 2286// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId);
2351 } 2287 }
2352 }
2353 else
2354 {
2355 return;
2356 }
2357
2358 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
2359 if (ParentPart == null)
2360 return;
2361 2288
2362 ParentID = m_requestedSitTargetID; 2289 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
2290 ParentID = m_requestedSitTargetID;
2363 2291
2364 Velocity = Vector3.Zero; 2292 Velocity = Vector3.Zero;
2365 RemoveFromPhysicalScene(); 2293 RemoveFromPhysicalScene();
2366 2294
2367 Animator.TrySetMovementAnimation(sitAnimation); 2295 Animator.TrySetMovementAnimation(sitAnimation);
2368 SendAvatarDataToAllAgents(); 2296 SendAvatarDataToAllAgents();
2297 }
2369 } 2298 }
2370 2299
2371 public void HandleAgentSitOnGround() 2300 public void HandleAgentSitOnGround()
@@ -3161,7 +3090,7 @@ namespace OpenSim.Region.Framework.Scenes
3161 cAgent.Center = CameraPosition; 3090 cAgent.Center = CameraPosition;
3162 cAgent.AtAxis = CameraAtAxis; 3091 cAgent.AtAxis = CameraAtAxis;
3163 cAgent.LeftAxis = CameraLeftAxis; 3092 cAgent.LeftAxis = CameraLeftAxis;
3164 cAgent.UpAxis = m_CameraUpAxis; 3093 cAgent.UpAxis = CameraUpAxis;
3165 3094
3166 cAgent.Far = DrawDistance; 3095 cAgent.Far = DrawDistance;
3167 3096
@@ -3250,7 +3179,7 @@ namespace OpenSim.Region.Framework.Scenes
3250 CameraPosition = cAgent.Center; 3179 CameraPosition = cAgent.Center;
3251 CameraAtAxis = cAgent.AtAxis; 3180 CameraAtAxis = cAgent.AtAxis;
3252 CameraLeftAxis = cAgent.LeftAxis; 3181 CameraLeftAxis = cAgent.LeftAxis;
3253 m_CameraUpAxis = cAgent.UpAxis; 3182 CameraUpAxis = cAgent.UpAxis;
3254 ParentUUID = cAgent.ParentPart; 3183 ParentUUID = cAgent.ParentPart;
3255 m_prevSitOffset = cAgent.SitOffset; 3184 m_prevSitOffset = cAgent.SitOffset;
3256 3185
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 35cd025..5c56264 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -178,13 +178,19 @@ namespace OpenSim.Region.Framework.Scenes
178 m_objectCapacity = scene.RegionInfo.ObjectCapacity; 178 m_objectCapacity = scene.RegionInfo.ObjectCapacity;
179 m_report.AutoReset = true; 179 m_report.AutoReset = true;
180 m_report.Interval = statsUpdatesEveryMS; 180 m_report.Interval = statsUpdatesEveryMS;
181 m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat); 181 m_report.Elapsed += statsHeartBeat;
182 m_report.Enabled = true; 182 m_report.Enabled = true;
183 183
184 if (StatsManager.SimExtraStats != null) 184 if (StatsManager.SimExtraStats != null)
185 OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket; 185 OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket;
186 } 186 }
187 187
188 public void Close()
189 {
190 m_report.Elapsed -= statsHeartBeat;
191 m_report.Close();
192 }
193
188 public void SetUpdateMS(int ms) 194 public void SetUpdateMS(int ms)
189 { 195 {
190 statsUpdatesEveryMS = ms; 196 statsUpdatesEveryMS = ms;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index e4b607d..e16903c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -65,8 +65,7 @@ namespace OpenSim.Region.Framework.Tests
65 65
66 // Create an object embedded inside the first 66 // Create an object embedded inside the first
67 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); 67 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
68 TaskInventoryItem taskSceneObjectItem 68 TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
69 = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
70 69
71 TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId); 70 TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId);
72 Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId)); 71 Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId));
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 7d7c5c5..0f62b2a 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
70 m_client = client; 70 m_client = client;
71 m_scene = scene; 71 m_scene = scene;
72 72
73 Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false); 73 Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true);
74 } 74 }
75 75
76 private void SendServerCommand(string command) 76 private void SendServerCommand(string command)
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
index eb39026..a7c5020 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
57 57
58 m_listener.Start(50); 58 m_listener.Start(50);
59 59
60 Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false); 60 Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true);
61 m_baseScene = baseScene; 61 m_baseScene = baseScene;
62 } 62 }
63 63
diff --git a/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs b/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs
index 439096a..c897aa5 100644
--- a/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs
@@ -92,7 +92,7 @@ namespace OpenSim.Region.OptionalModules.Agent.TextureSender
92 m_scene = scene; 92 m_scene = scene;
93 93
94 MainConsole.Instance.Commands.AddCommand( 94 MainConsole.Instance.Commands.AddCommand(
95 "j2k", 95 "Assets",
96 false, 96 false,
97 "j2k decode", 97 "j2k decode",
98 "j2k decode <ID>", 98 "j2k decode <ID>",
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
index 261029c..a7ebecc 100644
--- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
@@ -82,19 +82,19 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
82 m_scenes[scene.RegionInfo.RegionID] = scene; 82 m_scenes[scene.RegionInfo.RegionID] = scene;
83 83
84 scene.AddCommand( 84 scene.AddCommand(
85 this, "image queues clear", 85 "Comms", this, "image queues clear",
86 "image queues clear <first-name> <last-name>", 86 "image queues clear <first-name> <last-name>",
87 "Clear the image queues (textures downloaded via UDP) for a particular client.", 87 "Clear the image queues (textures downloaded via UDP) for a particular client.",
88 (mod, cmd) => MainConsole.Instance.Output(HandleImageQueuesClear(cmd))); 88 (mod, cmd) => MainConsole.Instance.Output(HandleImageQueuesClear(cmd)));
89 89
90 scene.AddCommand( 90 scene.AddCommand(
91 this, "image queues show", 91 "Comms", this, "image queues show",
92 "image queues show <first-name> <last-name>", 92 "image queues show <first-name> <last-name>",
93 "Show the image queues (textures downloaded via UDP) for a particular client.", 93 "Show the image queues (textures downloaded via UDP) for a particular client.",
94 (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd))); 94 (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd)));
95 95
96 scene.AddCommand( 96 scene.AddCommand(
97 this, "show pqueues", 97 "Comms", this, "show pqueues",
98 "show pqueues [full]", 98 "show pqueues [full]",
99 "Show priority queue data for each client", 99 "Show priority queue data for each client",
100 "Without the 'full' option, only root agents are shown." 100 "Without the 'full' option, only root agents are shown."
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
102 (mod, cmd) => MainConsole.Instance.Output(GetPQueuesReport(cmd))); 102 (mod, cmd) => MainConsole.Instance.Output(GetPQueuesReport(cmd)));
103 103
104 scene.AddCommand( 104 scene.AddCommand(
105 this, "show queues", 105 "Comms", this, "show queues",
106 "show queues [full]", 106 "show queues [full]",
107 "Show queue data for each client", 107 "Show queue data for each client",
108 "Without the 'full' option, only root agents are shown." 108 "Without the 'full' option, only root agents are shown."
@@ -110,13 +110,13 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
110 (mod, cmd) => MainConsole.Instance.Output(GetQueuesReport(cmd))); 110 (mod, cmd) => MainConsole.Instance.Output(GetQueuesReport(cmd)));
111 111
112 scene.AddCommand( 112 scene.AddCommand(
113 this, "show image queues", 113 "Comms", this, "show image queues",
114 "show image queues <first-name> <last-name>", 114 "show image queues <first-name> <last-name>",
115 "Show the image queues (textures downloaded via UDP) for a particular client.", 115 "Show the image queues (textures downloaded via UDP) for a particular client.",
116 (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd))); 116 (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd)));
117 117
118 scene.AddCommand( 118 scene.AddCommand(
119 this, "show throttles", 119 "Comms", this, "show throttles",
120 "show throttles [full]", 120 "show throttles [full]",
121 "Show throttle settings for each client and for the server overall", 121 "Show throttle settings for each client and for the server overall",
122 "Without the 'full' option, only root agents are shown." 122 "Without the 'full' option, only root agents are shown."
@@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
124 (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd))); 124 (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd)));
125 125
126 scene.AddCommand( 126 scene.AddCommand(
127 this, "emergency-monitoring", 127 "Comms", this, "emergency-monitoring",
128 "emergency-monitoring", 128 "emergency-monitoring",
129 "Go on/off emergency monitoring mode", 129 "Go on/off emergency monitoring mode",
130 "Go on/off emergency monitoring mode", 130 "Go on/off emergency monitoring mode",
diff --git a/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs b/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs
index a5207eb..41ec14f 100644
--- a/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Region.OptionalModules.Asset
88 m_scene = scene; 88 m_scene = scene;
89 89
90 MainConsole.Instance.Commands.AddCommand( 90 MainConsole.Instance.Commands.AddCommand(
91 "asset", 91 "Assets",
92 false, 92 false,
93 "show asset", 93 "show asset",
94 "show asset <ID>", 94 "show asset <ID>",
@@ -96,7 +96,7 @@ namespace OpenSim.Region.OptionalModules.Asset
96 HandleShowAsset); 96 HandleShowAsset);
97 97
98 MainConsole.Instance.Commands.AddCommand( 98 MainConsole.Instance.Commands.AddCommand(
99 "asset", false, "dump asset", 99 "Assets", false, "dump asset",
100 "dump asset <id>", 100 "dump asset <id>",
101 "Dump an asset", 101 "Dump an asset",
102 HandleDumpAsset); 102 HandleDumpAsset);
diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
index 2369d94..6bb6729 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
@@ -94,13 +94,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
94 m_scenes[scene.RegionInfo.RegionID] = scene; 94 m_scenes[scene.RegionInfo.RegionID] = scene;
95 95
96 scene.AddCommand( 96 scene.AddCommand(
97 this, "show appearance", 97 "Users", this, "show appearance",
98 "show appearance [<first-name> <last-name>]", 98 "show appearance [<first-name> <last-name>]",
99 "Synonym for 'appearance show'", 99 "Synonym for 'appearance show'",
100 HandleShowAppearanceCommand); 100 HandleShowAppearanceCommand);
101 101
102 scene.AddCommand( 102 scene.AddCommand(
103 this, "appearance show", 103 "Users", this, "appearance show",
104 "appearance show [<first-name> <last-name>]", 104 "appearance show [<first-name> <last-name>]",
105 "Show appearance information for each avatar in the simulator.", 105 "Show appearance information for each avatar in the simulator.",
106 "This command checks whether the simulator has all the baked textures required to display an avatar to other viewers. " 106 "This command checks whether the simulator has all the baked textures required to display an avatar to other viewers. "
@@ -110,14 +110,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
110 HandleShowAppearanceCommand); 110 HandleShowAppearanceCommand);
111 111
112 scene.AddCommand( 112 scene.AddCommand(
113 this, "appearance send", 113 "Users", this, "appearance send",
114 "appearance send [<first-name> <last-name>]", 114 "appearance send [<first-name> <last-name>]",
115 "Send appearance data for each avatar in the simulator to other viewers.", 115 "Send appearance data for each avatar in the simulator to other viewers.",
116 "Optionally, you can specify that only a particular avatar's appearance data is sent.", 116 "Optionally, you can specify that only a particular avatar's appearance data is sent.",
117 HandleSendAppearanceCommand); 117 HandleSendAppearanceCommand);
118 118
119 scene.AddCommand( 119 scene.AddCommand(
120 this, "appearance rebake", 120 "Users", this, "appearance rebake",
121 "appearance rebake <first-name> <last-name>", 121 "appearance rebake <first-name> <last-name>",
122 "Send a request to the user's viewer for it to rebake and reupload its appearance textures.", 122 "Send a request to the user's viewer for it to rebake and reupload its appearance textures.",
123 "This is currently done for all baked texture references previously received, whether the simulator can find the asset or not." 123 "This is currently done for all baked texture references previously received, whether the simulator can find the asset or not."
@@ -127,7 +127,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
127 HandleRebakeAppearanceCommand); 127 HandleRebakeAppearanceCommand);
128 128
129 scene.AddCommand( 129 scene.AddCommand(
130 this, "appearance find", 130 "Users", this, "appearance find",
131 "appearance find <uuid-or-start-of-uuid>", 131 "appearance find <uuid-or-start-of-uuid>",
132 "Find out which avatar uses the given asset as a baked texture, if any.", 132 "Find out which avatar uses the given asset as a baked texture, if any.",
133 "You can specify just the beginning of the uuid, e.g. 2008a8d. A longer UUID must be in dashed format.", 133 "You can specify just the beginning of the uuid, e.g. 2008a8d. A longer UUID must be in dashed format.",
diff --git a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs
index 23ef757..a3f68e5 100755
--- a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs
+++ b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs
@@ -100,22 +100,22 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
100 { 100 {
101 if (!m_commandsLoaded) 101 if (!m_commandsLoaded)
102 { 102 {
103 MainConsole.Instance.Commands.AddCommand("Physics", false, "physics set", 103 MainConsole.Instance.Commands.AddCommand(
104 "physics set", 104 "Regions", false, "physics set",
105 "Set physics parameter from currently selected region" + Environment.NewLine 105 setInvocation,
106 + "Invocation: " + setInvocation, 106 "Set physics parameter from currently selected region",
107 ProcessPhysicsSet); 107 ProcessPhysicsSet);
108 108
109 MainConsole.Instance.Commands.AddCommand("Physics", false, "physics get", 109 MainConsole.Instance.Commands.AddCommand(
110 "physics get", 110 "Regions", false, "physics get",
111 "Get physics parameter from currently selected region" + Environment.NewLine 111 getInvocation,
112 + "Invocation: " + getInvocation, 112 "Get physics parameter from currently selected region",
113 ProcessPhysicsGet); 113 ProcessPhysicsGet);
114 114
115 MainConsole.Instance.Commands.AddCommand("Physics", false, "physics list", 115 MainConsole.Instance.Commands.AddCommand(
116 "physics list", 116 "Regions", false, "physics list",
117 "List settable physics parameters" + Environment.NewLine 117 listInvocation,
118 + "Invocation: " + listInvocation, 118 "List settable physics parameters",
119 ProcessPhysicsList); 119 ProcessPhysicsList);
120 120
121 m_commandsLoaded = true; 121 m_commandsLoaded = true;
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 78e9b29..68f21c8 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -88,25 +88,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC
88 88
89 public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene) 89 public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene)
90 { 90 {
91 ScenePresence sp = scene.GetScenePresence(agentId); 91 ScenePresence npc = scene.GetScenePresence(agentId);
92 if (sp == null || sp.IsChildAgent) 92 if (npc == null || npc.IsChildAgent)
93 return false; 93 return false;
94 94
95 lock (m_avatars) 95 lock (m_avatars)
96 if (!m_avatars.ContainsKey(agentId)) 96 if (!m_avatars.ContainsKey(agentId))
97 return false; 97 return false;
98 98
99 // Delete existing sp attachments 99 // Delete existing npc attachments
100 scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false); 100 scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false);
101
102 AvatarAppearance app = new AvatarAppearance(appearance, true);
103 sp.Appearance = app;
104 101
105 // Set new sp appearance. Also sends to clients. 102 // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments
106 scene.RequestModuleInterface<IAvatarFactoryModule>().SetAppearance(sp, app); 103 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
104 npc.Appearance = npcAppearance;
107 105
108 // Rez needed sp attachments 106 // Rez needed npc attachments
109 scene.AttachmentsModule.RezAttachments(sp); 107 scene.AttachmentsModule.RezAttachments(npc);
108
109 IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>();
110 module.SendAppearance(npc.UUID);
110 111
111 return true; 112 return true;
112 } 113 }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index d507822..9a7e9e8 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -50,10 +50,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
50 [TestFixture] 50 [TestFixture]
51 public class NPCModuleTests 51 public class NPCModuleTests
52 { 52 {
53 private TestScene scene; 53 private TestScene m_scene;
54 private AvatarFactoryModule afm; 54 private AvatarFactoryModule m_afMod;
55 private UserManagementModule umm; 55 private UserManagementModule m_umMod;
56 private AttachmentsModule am; 56 private AttachmentsModule m_attMod;
57 private NPCModule m_npcMod;
57 58
58 [TestFixtureSetUp] 59 [TestFixtureSetUp]
59 public void FixtureInit() 60 public void FixtureInit()
@@ -79,12 +80,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
79 config.AddConfig("Modules"); 80 config.AddConfig("Modules");
80 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); 81 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
81 82
82 afm = new AvatarFactoryModule(); 83 m_afMod = new AvatarFactoryModule();
83 umm = new UserManagementModule(); 84 m_umMod = new UserManagementModule();
84 am = new AttachmentsModule(); 85 m_attMod = new AttachmentsModule();
86 m_npcMod = new NPCModule();
85 87
86 scene = SceneHelpers.SetupScene(); 88 m_scene = SceneHelpers.SetupScene();
87 SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule()); 89 SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule());
88 } 90 }
89 91
90 [Test] 92 [Test]
@@ -93,7 +95,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
93 TestHelpers.InMethod(); 95 TestHelpers.InMethod();
94// log4net.Config.XmlConfigurator.Configure(); 96// log4net.Config.XmlConfigurator.Configure();
95 97
96 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); 98 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
97// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); 99// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
98 100
99 // 8 is the index of the first baked texture in AvatarAppearance 101 // 8 is the index of the first baked texture in AvatarAppearance
@@ -104,18 +106,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
104 106
105 // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell 107 // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell
106 // ScenePresence.SendInitialData() to reset our entire appearance. 108 // ScenePresence.SendInitialData() to reset our entire appearance.
107 scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); 109 m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId));
108 110
109 afm.SetAppearance(sp, originalTe, null); 111 m_afMod.SetAppearance(sp, originalTe, null);
110 112
111 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); 113 UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
112 UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance);
113 114
114 ScenePresence npc = scene.GetScenePresence(npcId); 115 ScenePresence npc = m_scene.GetScenePresence(npcId);
115 116
116 Assert.That(npc, Is.Not.Null); 117 Assert.That(npc, Is.Not.Null);
117 Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId)); 118 Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId));
118 Assert.That(umm.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname))); 119 Assert.That(m_umMod.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname)));
119 } 120 }
120 121
121 [Test] 122 [Test]
@@ -124,42 +125,83 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
124 TestHelpers.InMethod(); 125 TestHelpers.InMethod();
125// log4net.Config.XmlConfigurator.Configure(); 126// log4net.Config.XmlConfigurator.Configure();
126 127
127 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); 128 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
128// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); 129// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
129 130
130 Vector3 startPos = new Vector3(128, 128, 30); 131 Vector3 startPos = new Vector3(128, 128, 30);
131 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); 132 UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
132 UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
133 133
134 npcModule.DeleteNPC(npcId, scene); 134 m_npcMod.DeleteNPC(npcId, m_scene);
135 135
136 ScenePresence deletedNpc = scene.GetScenePresence(npcId); 136 ScenePresence deletedNpc = m_scene.GetScenePresence(npcId);
137 137
138 Assert.That(deletedNpc, Is.Null); 138 Assert.That(deletedNpc, Is.Null);
139 } 139 }
140 140
141 [Test] 141 [Test]
142 public void TestAttachments() 142 public void TestCreateWithAttachments()
143 { 143 {
144 TestHelpers.InMethod(); 144 TestHelpers.InMethod();
145// log4net.Config.XmlConfigurator.Configure(); 145// log4net.Config.XmlConfigurator.Configure();
146 146
147 UUID userId = TestHelpers.ParseTail(0x1); 147 UUID userId = TestHelpers.ParseTail(0x1);
148 UserAccountHelpers.CreateUserWithInventory(scene, userId); 148 UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
149 ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); 149 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
150 150
151 UUID attItemId = TestHelpers.ParseTail(0x2); 151 UUID attItemId = TestHelpers.ParseTail(0x2);
152 UUID attAssetId = TestHelpers.ParseTail(0x3); 152 UUID attAssetId = TestHelpers.ParseTail(0x3);
153 string attName = "att"; 153 string attName = "att";
154 154
155 UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); 155 UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object);
156 156
157 am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); 157 m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest);
158 158
159 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); 159 UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
160 UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance);
161 160
162 ScenePresence npc = scene.GetScenePresence(npcId); 161 ScenePresence npc = m_scene.GetScenePresence(npcId);
162
163 // Check scene presence status
164 Assert.That(npc.HasAttachments(), Is.True);
165 List<SceneObjectGroup> attachments = npc.GetAttachments();
166 Assert.That(attachments.Count, Is.EqualTo(1));
167 SceneObjectGroup attSo = attachments[0];
168
169 // Just for now, we won't test the name since this is (wrongly) the asset part name rather than the item
170 // name. TODO: Do need to fix ultimately since the item may be renamed before being passed on to an NPC.
171// Assert.That(attSo.Name, Is.EqualTo(attName));
172
173 Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
174 Assert.That(attSo.IsAttachment);
175 Assert.That(attSo.UsesPhysics, Is.False);
176 Assert.That(attSo.IsTemporary, Is.False);
177 Assert.That(attSo.OwnerID, Is.EqualTo(npc.UUID));
178 }
179
180 [Test]
181 public void TestLoadAppearance()
182 {
183 TestHelpers.InMethod();
184// log4net.Config.XmlConfigurator.Configure();
185
186 UUID userId = TestHelpers.ParseTail(0x1);
187 UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
188 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
189
190 UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
191
192 // Now add the attachment to the original avatar and use that to load a new appearance
193 // TODO: Could also run tests loading from a notecard though this isn't much different for our purposes here
194 UUID attItemId = TestHelpers.ParseTail(0x2);
195 UUID attAssetId = TestHelpers.ParseTail(0x3);
196 string attName = "att";
197
198 UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object);
199
200 m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest);
201
202 m_npcMod.SetNPCAppearance(npcId, sp.Appearance, m_scene);
203
204 ScenePresence npc = m_scene.GetScenePresence(npcId);
163 205
164 // Check scene presence status 206 // Check scene presence status
165 Assert.That(npc.HasAttachments(), Is.True); 207 Assert.That(npc.HasAttachments(), Is.True);
@@ -184,31 +226,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
184 TestHelpers.InMethod(); 226 TestHelpers.InMethod();
185// log4net.Config.XmlConfigurator.Configure(); 227// log4net.Config.XmlConfigurator.Configure();
186 228
187 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); 229 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
188// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); 230// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
189 231
190 Vector3 startPos = new Vector3(128, 128, 30); 232 Vector3 startPos = new Vector3(128, 128, 30);
191 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); 233 UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
192 UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
193 234
194 ScenePresence npc = scene.GetScenePresence(npcId); 235 ScenePresence npc = m_scene.GetScenePresence(npcId);
195 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 236 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
196 237
197 // For now, we'll make the scene presence fly to simplify this test, but this needs to change. 238 // For now, we'll make the scene presence fly to simplify this test, but this needs to change.
198 npc.Flying = true; 239 npc.Flying = true;
199 240
200 scene.Update(); 241 m_scene.Update();
201 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 242 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
202 243
203 Vector3 targetPos = startPos + new Vector3(0, 10, 0); 244 Vector3 targetPos = startPos + new Vector3(0, 10, 0);
204 npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); 245 m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false);
205 246
206 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 247 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
207 //Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f))); 248 //Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f)));
208 Assert.That( 249 Assert.That(
209 npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001)); 250 npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001));
210 251
211 scene.Update(); 252 m_scene.Update();
212 253
213 // We should really check the exact figure. 254 // We should really check the exact figure.
214 Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X)); 255 Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X));
@@ -217,7 +258,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
217 Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X)); 258 Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X));
218 259
219 for (int i = 0; i < 10; i++) 260 for (int i = 0; i < 10; i++)
220 scene.Update(); 261 m_scene.Update();
221 262
222 double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); 263 double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
223 Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); 264 Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move");
@@ -227,14 +268,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
227 // Try a second movement 268 // Try a second movement
228 startPos = npc.AbsolutePosition; 269 startPos = npc.AbsolutePosition;
229 targetPos = startPos + new Vector3(10, 0, 0); 270 targetPos = startPos + new Vector3(10, 0, 0);
230 npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); 271 m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false);
231 272
232 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 273 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
233// Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1))); 274// Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1)));
234 Assert.That( 275 Assert.That(
235 npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0, 1), 0.000001)); 276 npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0, 1), 0.000001));
236 277
237 scene.Update(); 278 m_scene.Update();
238 279
239 // We should really check the exact figure. 280 // We should really check the exact figure.
240 Assert.That(npc.AbsolutePosition.X, Is.GreaterThan(startPos.X)); 281 Assert.That(npc.AbsolutePosition.X, Is.GreaterThan(startPos.X));
@@ -243,7 +284,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
243 Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); 284 Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z));
244 285
245 for (int i = 0; i < 10; i++) 286 for (int i = 0; i < 10; i++)
246 scene.Update(); 287 m_scene.Update();
247 288
248 distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); 289 distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
249 Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); 290 Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move");
@@ -256,17 +297,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
256 TestHelpers.InMethod(); 297 TestHelpers.InMethod();
257// log4net.Config.XmlConfigurator.Configure(); 298// log4net.Config.XmlConfigurator.Configure();
258 299
259 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); 300 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
260 301
261 Vector3 startPos = new Vector3(128, 128, 30); 302 Vector3 startPos = new Vector3(128, 128, 30);
262 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); 303 UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
263 UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
264 304
265 ScenePresence npc = scene.GetScenePresence(npcId); 305 ScenePresence npc = m_scene.GetScenePresence(npcId);
266 SceneObjectPart part = SceneHelpers.AddSceneObject(scene); 306 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
267 307
268 part.SitTargetPosition = new Vector3(0, 0, 1); 308 part.SitTargetPosition = new Vector3(0, 0, 1);
269 npcModule.Sit(npc.UUID, part.UUID, scene); 309 m_npcMod.Sit(npc.UUID, part.UUID, m_scene);
270 310
271 Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId)); 311 Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId));
272 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); 312 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
@@ -274,7 +314,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
274 npc.AbsolutePosition, 314 npc.AbsolutePosition,
275 Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); 315 Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
276 316
277 npcModule.Stand(npc.UUID, scene); 317 m_npcMod.Stand(npc.UUID, m_scene);
278 318
279 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); 319 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
280 Assert.That(npc.ParentID, Is.EqualTo(0)); 320 Assert.That(npc.ParentID, Is.EqualTo(0));
@@ -286,19 +326,18 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
286 TestHelpers.InMethod(); 326 TestHelpers.InMethod();
287// log4net.Config.XmlConfigurator.Configure(); 327// log4net.Config.XmlConfigurator.Configure();
288 328
289 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); 329 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
290 330
291 // FIXME: To get this to work for now, we are going to place the npc right next to the target so that 331 // FIXME: To get this to work for now, we are going to place the npc right next to the target so that
292 // the autopilot doesn't trigger 332 // the autopilot doesn't trigger
293 Vector3 startPos = new Vector3(1, 1, 1); 333 Vector3 startPos = new Vector3(1, 1, 1);
294 334
295 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); 335 UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
296 UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
297 336
298 ScenePresence npc = scene.GetScenePresence(npcId); 337 ScenePresence npc = m_scene.GetScenePresence(npcId);
299 SceneObjectPart part = SceneHelpers.AddSceneObject(scene); 338 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
300 339
301 npcModule.Sit(npc.UUID, part.UUID, scene); 340 m_npcMod.Sit(npc.UUID, part.UUID, m_scene);
302 341
303 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); 342 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
304 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); 343 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
@@ -311,7 +350,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
311 npc.AbsolutePosition, 350 npc.AbsolutePosition,
312 Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f))); 351 Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f)));
313 352
314 npcModule.Stand(npc.UUID, scene); 353 m_npcMod.Stand(npc.UUID, m_scene);
315 354
316 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); 355 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
317 Assert.That(npc.ParentID, Is.EqualTo(0)); 356 Assert.That(npc.ParentID, Is.EqualTo(0));
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 62e3763..254d578 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -1474,6 +1474,8 @@ Console.WriteLine("CreateGeom:");
1474 /// </summary> 1474 /// </summary>
1475 private void changeadd() 1475 private void changeadd()
1476 { 1476 {
1477// m_log.DebugFormat("[ODE PRIM]: Adding prim {0}", Name);
1478
1477 int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); 1479 int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
1478 IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); 1480 IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position);
1479 1481
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
index 3c36943..9d52a8f 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -630,33 +630,16 @@ namespace OpenSim.Region.RegionCombinerModule
630 630
631 List<Vector3> CoarseLocations = new List<Vector3>(); 631 List<Vector3> CoarseLocations = new List<Vector3>();
632 List<UUID> AvatarUUIDs = new List<UUID>(); 632 List<UUID> AvatarUUIDs = new List<UUID>();
633
633 connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp) 634 connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp)
634 { 635 {
635 if (sp.UUID != presence.UUID) 636 if (sp.UUID != presence.UUID)
636 { 637 {
637 if (sp.ParentID != 0) 638 CoarseLocations.Add(sp.AbsolutePosition);
638 { 639 AvatarUUIDs.Add(sp.UUID);
639 // sitting avatar
640 SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(sp.ParentID);
641 if (sop != null)
642 {
643 CoarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition);
644 AvatarUUIDs.Add(sp.UUID);
645 }
646 else
647 {
648 // we can't find the parent.. ! arg!
649 CoarseLocations.Add(sp.AbsolutePosition);
650 AvatarUUIDs.Add(sp.UUID);
651 }
652 }
653 else
654 {
655 CoarseLocations.Add(sp.AbsolutePosition);
656 AvatarUUIDs.Add(sp.UUID);
657 }
658 } 640 }
659 }); 641 });
642
660 DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence); 643 DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence);
661 } 644 }
662 645
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
index 61e4934..3cbdde5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
@@ -137,7 +137,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
137 if (cmdHandlerThread == null) 137 if (cmdHandlerThread == null)
138 { 138 {
139 // Start the thread that will be doing the work 139 // Start the thread that will be doing the work
140 cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true); 140 cmdHandlerThread
141 = Watchdog.StartThread(
142 CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true);
141 } 143 }
142 } 144 }
143 145
@@ -245,7 +247,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
245 247
246 // Remove Sensors 248 // Remove Sensors
247 m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID); 249 m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
250 }
251
252 /// <summary>
253 /// Get the sensor repeat plugin for this script engine.
254 /// </summary>
255 /// <param name="engine"></param>
256 /// <returns></returns>
257 public static SensorRepeat GetSensorRepeatPlugin(IScriptEngine engine)
258 {
259 if (m_SensorRepeat.ContainsKey(engine))
260 return m_SensorRepeat[engine];
261 else
262 return null;
263 }
248 264
265 /// <summary>
266 /// Get the dataserver plugin for this script engine.
267 /// </summary>
268 /// <param name="engine"></param>
269 /// <returns></returns>
270 public static Dataserver GetDataserverPlugin(IScriptEngine engine)
271 {
272 if (m_Dataserver.ContainsKey(engine))
273 return m_Dataserver[engine];
274 else
275 return null;
276 }
277
278 /// <summary>
279 /// Get the timer plugin for this script engine.
280 /// </summary>
281 /// <param name="engine"></param>
282 /// <returns></returns>
283 public static Timer GetTimerPlugin(IScriptEngine engine)
284 {
285 if (m_Timer.ContainsKey(engine))
286 return m_Timer[engine];
287 else
288 return null;
289 }
290
291 /// <summary>
292 /// Get the listener plugin for this script engine.
293 /// </summary>
294 /// <param name="engine"></param>
295 /// <returns></returns>
296 public static Listener GetListenerPlugin(IScriptEngine engine)
297 {
298 if (m_Listener.ContainsKey(engine))
299 return m_Listener[engine];
300 else
301 return null;
249 } 302 }
250 303
251 public static void StateChange(IScriptEngine engine, uint localID, UUID itemID) 304 public static void StateChange(IScriptEngine engine, uint localID, UUID itemID)
@@ -288,7 +341,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
288 data.AddRange(timers); 341 data.AddRange(timers);
289 } 342 }
290 343
291 Object[] sensors=m_SensorRepeat[engine].GetSerializationData(itemID); 344 Object[] sensors = m_SensorRepeat[engine].GetSerializationData(itemID);
292 if (sensors.Length > 0) 345 if (sensors.Length > 0)
293 { 346 {
294 data.Add("sensor"); 347 data.Add("sensor");
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 0cc8829..e2d17a7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4213,7 +4213,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4213 List<String> nametable = new List<String>(); 4213 List<String> nametable = new List<String>();
4214 World.ForEachRootScenePresence(delegate(ScenePresence presence) 4214 World.ForEachRootScenePresence(delegate(ScenePresence presence)
4215 { 4215 {
4216 if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) 4216 SceneObjectPart sitPart = presence.ParentPart;
4217 if (sitPart != null && m_host.ParentGroup.HasChildPrim(sitPart.LocalId))
4217 nametable.Add(presence.ControllingClient.Name); 4218 nametable.Add(presence.ControllingClient.Name);
4218 }); 4219 });
4219 4220
@@ -4450,7 +4451,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4450 Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f), 4451 Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f),
4451 Util.Clip((float)color.y, 0.0f, 1.0f), 4452 Util.Clip((float)color.y, 0.0f, 1.0f),
4452 Util.Clip((float)color.z, 0.0f, 1.0f)); 4453 Util.Clip((float)color.z, 0.0f, 1.0f));
4453 m_host.SetText(text.Length > 254 ? text.Remove(255) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); 4454 m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
4454 //m_host.ParentGroup.HasGroupChanged = true; 4455 //m_host.ParentGroup.HasGroupChanged = true;
4455 //m_host.ParentGroup.ScheduleGroupForFullUpdate(); 4456 //m_host.ParentGroup.ScheduleGroupForFullUpdate();
4456 } 4457 }
@@ -4844,22 +4845,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4844 4845
4845 // Find pushee position 4846 // Find pushee position
4846 // Pushee Linked? 4847 // Pushee Linked?
4847 if (pusheeav.ParentID != 0) 4848 SceneObjectPart sitPart = pusheeav.ParentPart;
4848 { 4849 if (sitPart != null)
4849 SceneObjectPart parentobj = World.GetSceneObjectPart(pusheeav.ParentID); 4850 PusheePos = sitPart.AbsolutePosition;
4850 if (parentobj != null)
4851 {
4852 PusheePos = parentobj.AbsolutePosition;
4853 }
4854 else
4855 {
4856 PusheePos = pusheeav.AbsolutePosition;
4857 }
4858 }
4859 else 4851 else
4860 {
4861 PusheePos = pusheeav.AbsolutePosition; 4852 PusheePos = pusheeav.AbsolutePosition;
4862 }
4863 } 4853 }
4864 4854
4865 if (!pusheeIsAvatar) 4855 if (!pusheeIsAvatar)
@@ -6067,7 +6057,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6067 flags |= ScriptBaseClass.AGENT_IN_AIR; 6057 flags |= ScriptBaseClass.AGENT_IN_AIR;
6068 } 6058 }
6069 6059
6070 if (agent.ParentID != 0) 6060 if (agent.ParentPart != null)
6071 { 6061 {
6072 flags |= ScriptBaseClass.AGENT_ON_OBJECT; 6062 flags |= ScriptBaseClass.AGENT_ON_OBJECT;
6073 flags |= ScriptBaseClass.AGENT_SITTING; 6063 flags |= ScriptBaseClass.AGENT_SITTING;
@@ -6866,16 +6856,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6866 } 6856 }
6867 } 6857 }
6868 6858
6869 public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) 6859 protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot)
6870 { 6860 {
6871 m_host.AddScriptLPS(1);
6872 // LSL quaternions can normalize to 0, normal Quaternions can't. 6861 // LSL quaternions can normalize to 0, normal Quaternions can't.
6873 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) 6862 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
6874 rot.z = 1; // ZERO_ROTATION = 0,0,0,1 6863 rot.z = 1; // ZERO_ROTATION = 0,0,0,1
6875 6864
6876 m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); 6865 part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
6877 m_host.SitTargetOrientation = Rot2Quaternion(rot); 6866 part.SitTargetOrientation = Rot2Quaternion(rot);
6878 m_host.ParentGroup.HasGroupChanged = true; 6867 part.ParentGroup.HasGroupChanged = true;
6868 }
6869
6870 public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
6871 {
6872 m_host.AddScriptLPS(1);
6873 SitTarget(m_host, offset, rot);
6874 }
6875
6876 public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
6877 {
6878 m_host.AddScriptLPS(1);
6879 if (link == ScriptBaseClass.LINK_ROOT)
6880 SitTarget(m_host.ParentGroup.RootPart, offset, rot);
6881 else if (link == ScriptBaseClass.LINK_THIS)
6882 SitTarget(m_host, offset, rot);
6883 else
6884 {
6885 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
6886 if (null != part)
6887 {
6888 SitTarget(part, offset, rot);
6889 }
6890 }
6879 } 6891 }
6880 6892
6881 public LSL_String llAvatarOnSitTarget() 6893 public LSL_String llAvatarOnSitTarget()
@@ -7560,10 +7572,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7560 shapeBlock.PathScaleX = 100; 7572 shapeBlock.PathScaleX = 100;
7561 shapeBlock.PathScaleY = 150; 7573 shapeBlock.PathScaleY = 150;
7562 7574
7563 if ((type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER) == 0 && 7575 int flag = type & (ScriptBaseClass.PRIM_SCULPT_FLAG_INVERT | ScriptBaseClass.PRIM_SCULPT_FLAG_MIRROR);
7564 (type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE) == 0 && 7576
7565 (type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE) == 0 && 7577 if (type != (ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER | flag) &&
7566 (type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS) == 0) 7578 type != (ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE | flag) &&
7579 type != (ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE | flag) &&
7580 type != (ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS | flag))
7567 { 7581 {
7568 // default 7582 // default
7569 type = type | (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; 7583 type = type | (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
@@ -8851,23 +8865,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8851 { 8865 {
8852 m_host.AddScriptLPS(1); 8866 m_host.AddScriptLPS(1);
8853 ScriptSleep(1000); 8867 ScriptSleep(1000);
8868 return GetPrimMediaParams(m_host, face, rules);
8869 }
8870
8871 public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
8872 {
8873 m_host.AddScriptLPS(1);
8874 ScriptSleep(1000);
8875 if (link == ScriptBaseClass.LINK_ROOT)
8876 return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
8877 else if (link == ScriptBaseClass.LINK_THIS)
8878 return GetPrimMediaParams(m_host, face, rules);
8879 else
8880 {
8881 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
8882 if (null != part)
8883 return GetPrimMediaParams(part, face, rules);
8884 }
8854 8885
8886 return new LSL_List();
8887 }
8888
8889 private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules)
8890 {
8855 // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid 8891 // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid
8856 // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). 8892 // TODO: Need to correctly handle case where a face has no media (which gives back an empty list).
8857 // Assuming silently fail means give back an empty list. Ideally, need to check this. 8893 // Assuming silently fail means give back an empty list. Ideally, need to check this.
8858 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8894 if (face < 0 || face > part.GetNumberOfSides() - 1)
8859 return new LSL_List(); 8895 return new LSL_List();
8860 8896
8861 return GetPrimMediaParams(face, rules);
8862 }
8863
8864 private LSL_List GetPrimMediaParams(int face, LSL_List rules)
8865 {
8866 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8897 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8867 if (null == module) 8898 if (null == module)
8868 throw new Exception("Media on a prim functions not available"); 8899 return new LSL_List();
8869 8900
8870 MediaEntry me = module.GetMediaEntry(m_host, face); 8901 MediaEntry me = module.GetMediaEntry(part, face);
8871 8902
8872 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams 8903 // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams
8873 if (null == me) 8904 if (null == me)
@@ -8949,33 +8980,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8949 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: 8980 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
8950 res.Add(new LSL_Integer((int)me.ControlPermissions)); 8981 res.Add(new LSL_Integer((int)me.ControlPermissions));
8951 break; 8982 break;
8983
8984 default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
8952 } 8985 }
8953 } 8986 }
8954 8987
8955 return res; 8988 return res;
8956 } 8989 }
8957 8990
8958 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) 8991 public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules)
8959 { 8992 {
8960 m_host.AddScriptLPS(1); 8993 m_host.AddScriptLPS(1);
8961 ScriptSleep(1000); 8994 ScriptSleep(1000);
8995 return SetPrimMediaParams(m_host, face, rules);
8996 }
8962 8997
8963 // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid 8998 public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
8964 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. 8999 {
8965 // Don't perform the media check directly 9000 m_host.AddScriptLPS(1);
8966 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 9001 ScriptSleep(1000);
8967 return ScriptBaseClass.LSL_STATUS_OK; 9002 if (link == ScriptBaseClass.LINK_ROOT)
9003 return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
9004 else if (link == ScriptBaseClass.LINK_THIS)
9005 return SetPrimMediaParams(m_host, face, rules);
9006 else
9007 {
9008 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
9009 if (null != part)
9010 return SetPrimMediaParams(part, face, rules);
9011 }
8968 9012
8969 return SetPrimMediaParams(face, rules); 9013 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
8970 } 9014 }
8971 9015
8972 private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) 9016 private LSL_Integer SetPrimMediaParams(SceneObjectPart part, LSL_Integer face, LSL_List rules)
8973 { 9017 {
9018 // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid
9019 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
9020 // Don't perform the media check directly
9021 if (face < 0 || face > part.GetNumberOfSides() - 1)
9022 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
9023
8974 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 9024 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8975 if (null == module) 9025 if (null == module)
8976 throw new Exception("Media on a prim functions not available"); 9026 return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
8977 9027
8978 MediaEntry me = module.GetMediaEntry(m_host, face); 9028 MediaEntry me = module.GetMediaEntry(part, face);
8979 if (null == me) 9029 if (null == me)
8980 me = new MediaEntry(); 9030 me = new MediaEntry();
8981 9031
@@ -9054,10 +9104,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9054 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: 9104 case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
9055 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); 9105 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
9056 break; 9106 break;
9107
9108 default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
9057 } 9109 }
9058 } 9110 }
9059 9111
9060 module.SetMediaEntry(m_host, face, me); 9112 module.SetMediaEntry(part, face, me);
9061 9113
9062 return ScriptBaseClass.LSL_STATUS_OK; 9114 return ScriptBaseClass.LSL_STATUS_OK;
9063 } 9115 }
@@ -9066,18 +9118,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9066 { 9118 {
9067 m_host.AddScriptLPS(1); 9119 m_host.AddScriptLPS(1);
9068 ScriptSleep(1000); 9120 ScriptSleep(1000);
9121 return ClearPrimMedia(m_host, face);
9122 }
9069 9123
9124 public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
9125 {
9126 m_host.AddScriptLPS(1);
9127 ScriptSleep(1000);
9128 if (link == ScriptBaseClass.LINK_ROOT)
9129 return ClearPrimMedia(m_host.ParentGroup.RootPart, face);
9130 else if (link == ScriptBaseClass.LINK_THIS)
9131 return ClearPrimMedia(m_host, face);
9132 else
9133 {
9134 SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
9135 if (null != part)
9136 return ClearPrimMedia(part, face);
9137 }
9138
9139 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
9140 }
9141
9142 private LSL_Integer ClearPrimMedia(SceneObjectPart part, LSL_Integer face)
9143 {
9070 // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid 9144 // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid
9071 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. 9145 // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
9072 // FIXME: Don't perform the media check directly 9146 // FIXME: Don't perform the media check directly
9073 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 9147 if (face < 0 || face > part.GetNumberOfSides() - 1)
9074 return ScriptBaseClass.LSL_STATUS_OK; 9148 return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
9075 9149
9076 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 9150 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
9077 if (null == module) 9151 if (null == module)
9078 throw new Exception("Media on a prim functions not available"); 9152 return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
9079 9153
9080 module.ClearMediaEntry(m_host, face); 9154 module.ClearMediaEntry(part, face);
9081 9155
9082 return ScriptBaseClass.LSL_STATUS_OK; 9156 return ScriptBaseClass.LSL_STATUS_OK;
9083 } 9157 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index a9b8e04..ecc5fb5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2169,6 +2169,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2169 return result; 2169 return result;
2170 } 2170 }
2171 2171
2172 public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start)
2173 {
2174 CheckThreatLevel(ThreatLevel.High, "osReplaceString");
2175 m_host.AddScriptLPS(1);
2176
2177 // Normalize indices (if negative).
2178 // After normlaization they may still be
2179 // negative, but that is now relative to
2180 // the start, rather than the end, of the
2181 // sequence.
2182 if (start < 0)
2183 {
2184 start = src.Length + start;
2185 }
2186
2187 if (start < 0 || start >= src.Length)
2188 {
2189 return src;
2190 }
2191
2192 // Find matches beginning at start position
2193 Regex matcher = new Regex(pattern);
2194 return matcher.Replace(src,replace,count,start);
2195 }
2196
2172 public string osLoadedCreationDate() 2197 public string osLoadedCreationDate()
2173 { 2198 {
2174 CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationDate"); 2199 CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationDate");
@@ -2786,7 +2811,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2786 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); 2811 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
2787 m_host.AddScriptLPS(1); 2812 m_host.AddScriptLPS(1);
2788 ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); 2813 ScenePresence avatar = World.GetScenePresence(new UUID(UUID));
2789 avatar.SpeedModifier = (float)SpeedModifier; 2814
2815 if (avatar != null)
2816 avatar.SpeedModifier = (float)SpeedModifier;
2790 } 2817 }
2791 2818
2792 public void osKickAvatar(string FirstName,string SurName,string alert) 2819 public void osKickAvatar(string FirstName,string SurName,string alert)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs
index 7fa19b1..9f78a49 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs
@@ -38,6 +38,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
38 { 38 {
39 public AsyncCommandManager m_CmdManager; 39 public AsyncCommandManager m_CmdManager;
40 40
41 public int DataserverRequestsCount
42 {
43 get
44 {
45 lock (DataserverRequests)
46 return DataserverRequests.Count;
47 }
48 }
49
41 private Dictionary<string, DataserverRequest> DataserverRequests = 50 private Dictionary<string, DataserverRequest> DataserverRequests =
42 new Dictionary<string, DataserverRequest>(); 51 new Dictionary<string, DataserverRequest>();
43 52
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
index 740816f..93e0261 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
@@ -42,22 +42,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
42 42
43 public AsyncCommandManager m_CmdManager; 43 public AsyncCommandManager m_CmdManager;
44 44
45 private IWorldComm m_commsPlugin;
46
47 public int ListenerCount
48 {
49 get { return m_commsPlugin.ListenerCount; }
50 }
51
45 public Listener(AsyncCommandManager CmdManager) 52 public Listener(AsyncCommandManager CmdManager)
46 { 53 {
47 m_CmdManager = CmdManager; 54 m_CmdManager = CmdManager;
55 m_commsPlugin = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
48 } 56 }
49 57
50 public void CheckListeners() 58 public void CheckListeners()
51 { 59 {
52 if (m_CmdManager.m_ScriptEngine.World == null) 60 if (m_CmdManager.m_ScriptEngine.World == null)
53 return; 61 return;
54 IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
55 62
56 if (comms != null) 63 if (m_commsPlugin != null)
57 { 64 {
58 while (comms.HasMessages()) 65 while (m_commsPlugin.HasMessages())
59 { 66 {
60 ListenerInfo lInfo = (ListenerInfo)comms.GetNextMessage(); 67 ListenerInfo lInfo = (ListenerInfo)m_commsPlugin.GetNextMessage();
61 68
62 //Deliver data to prim's listen handler 69 //Deliver data to prim's listen handler
63 object[] resobj = new object[] 70 object[] resobj = new object[]
@@ -81,17 +88,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
81 88
82 public Object[] GetSerializationData(UUID itemID) 89 public Object[] GetSerializationData(UUID itemID)
83 { 90 {
84 IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 91 return m_commsPlugin.GetSerializationData(itemID);
85
86 return comms.GetSerializationData(itemID);
87 } 92 }
88 93
89 public void CreateFromData(uint localID, UUID itemID, UUID hostID, 94 public void CreateFromData(uint localID, UUID itemID, UUID hostID,
90 Object[] data) 95 Object[] data)
91 { 96 {
92 IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 97 m_commsPlugin.CreateFromData(localID, itemID, hostID, data);
93
94 comms.CreateFromData(localID, itemID, hostID, data);
95 } 98 }
96 } 99 }
97} 100} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 83da204..1373971 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -44,6 +44,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
44 44
45 public AsyncCommandManager m_CmdManager; 45 public AsyncCommandManager m_CmdManager;
46 46
47 /// <summary>
48 /// Number of sensors active.
49 /// </summary>
50 public int SensorsCount
51 {
52 get
53 {
54 lock (SenseRepeatListLock)
55 return SenseRepeaters.Count;
56 }
57 }
58
47 public SensorRepeat(AsyncCommandManager CmdManager) 59 public SensorRepeat(AsyncCommandManager CmdManager)
48 { 60 {
49 m_CmdManager = CmdManager; 61 m_CmdManager = CmdManager;
@@ -157,12 +169,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
157 169
158 public void CheckSenseRepeaterEvents() 170 public void CheckSenseRepeaterEvents()
159 { 171 {
160 // Nothing to do here?
161 if (SenseRepeaters.Count == 0)
162 return;
163
164 lock (SenseRepeatListLock) 172 lock (SenseRepeatListLock)
165 { 173 {
174 // Nothing to do here?
175 if (SenseRepeaters.Count == 0)
176 return;
177
166 // Go through all timers 178 // Go through all timers
167 foreach (SenseRepeatClass ts in SenseRepeaters) 179 foreach (SenseRepeatClass ts in SenseRepeaters)
168 { 180 {
@@ -640,7 +652,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
640 ts.next = 652 ts.next =
641 DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); 653 DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
642 654
643 SenseRepeaters.Add(ts); 655 lock (SenseRepeatListLock)
656 SenseRepeaters.Add(ts);
657
644 idx += 6; 658 idx += 6;
645 } 659 }
646 } 660 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
index 2fd33fe..9ee6946 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
@@ -37,6 +37,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
37 { 37 {
38 public AsyncCommandManager m_CmdManager; 38 public AsyncCommandManager m_CmdManager;
39 39
40 public int TimersCount
41 {
42 get
43 {
44 lock (TimerListLock)
45 return Timers.Count;
46 }
47 }
48
40 public Timer(AsyncCommandManager CmdManager) 49 public Timer(AsyncCommandManager CmdManager)
41 { 50 {
42 m_CmdManager = CmdManager; 51 m_CmdManager = CmdManager;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index 5b8c316..8d97a7c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -64,6 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
64 LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options); 64 LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options);
65 LSL_Integer llCeil(double f); 65 LSL_Integer llCeil(double f);
66 void llClearCameraParams(); 66 void llClearCameraParams();
67 LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face);
67 LSL_Integer llClearPrimMedia(LSL_Integer face); 68 LSL_Integer llClearPrimMedia(LSL_Integer face);
68 void llCloseRemoteDataChannel(string channel); 69 void llCloseRemoteDataChannel(string channel);
69 LSL_Float llCloud(LSL_Vector offset); 70 LSL_Float llCloud(LSL_Vector offset);
@@ -140,7 +141,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
140 LSL_String llGetLinkName(int linknum); 141 LSL_String llGetLinkName(int linknum);
141 LSL_Integer llGetLinkNumber(); 142 LSL_Integer llGetLinkNumber();
142 LSL_Integer llGetLinkNumberOfSides(int link); 143 LSL_Integer llGetLinkNumberOfSides(int link);
143 LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); 144 LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules);
145 LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules);
144 LSL_Integer llGetListEntryType(LSL_List src, int index); 146 LSL_Integer llGetListEntryType(LSL_List src, int index);
145 LSL_Integer llGetListLength(LSL_List src); 147 LSL_Integer llGetListLength(LSL_List src);
146 LSL_Vector llGetLocalPos(); 148 LSL_Vector llGetLocalPos();
@@ -220,6 +222,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
220 LSL_String llGetDisplayName(string id); 222 LSL_String llGetDisplayName(string id);
221 LSL_String llRequestDisplayName(string id); 223 LSL_String llRequestDisplayName(string id);
222 void llLinkParticleSystem(int linknum, LSL_List rules); 224 void llLinkParticleSystem(int linknum, LSL_List rules);
225 void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot);
223 LSL_String llList2CSV(LSL_List src); 226 LSL_String llList2CSV(LSL_List src);
224 LSL_Float llList2Float(LSL_List src, int index); 227 LSL_Float llList2Float(LSL_List src, int index);
225 LSL_Integer llList2Integer(LSL_List src, int index); 228 LSL_Integer llList2Integer(LSL_List src, int index);
@@ -336,6 +339,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
336 void llSetInventoryPermMask(string item, int mask, int value); 339 void llSetInventoryPermMask(string item, int mask, int value);
337 void llSetLinkAlpha(int linknumber, double alpha, int face); 340 void llSetLinkAlpha(int linknumber, double alpha, int face);
338 void llSetLinkColor(int linknumber, LSL_Vector color, int face); 341 void llSetLinkColor(int linknumber, LSL_Vector color, int face);
342 LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules);
339 void llSetLinkPrimitiveParams(int linknumber, LSL_List rules); 343 void llSetLinkPrimitiveParams(int linknumber, LSL_List rules);
340 void llSetLinkTexture(int linknumber, string texture, int face); 344 void llSetLinkTexture(int linknumber, string texture, int face);
341 void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); 345 void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate);
@@ -347,7 +351,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
347 void llSetPayPrice(int price, LSL_List quick_pay_buttons); 351 void llSetPayPrice(int price, LSL_List quick_pay_buttons);
348 void llSetPos(LSL_Vector pos); 352 void llSetPos(LSL_Vector pos);
349 LSL_Integer llSetRegionPos(LSL_Vector pos); 353 LSL_Integer llSetRegionPos(LSL_Vector pos);
350 LSL_Integer llSetPrimMediaParams(int face, LSL_List rules); 354 LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules);
351 void llSetPrimitiveParams(LSL_List rules); 355 void llSetPrimitiveParams(LSL_List rules);
352 void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); 356 void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules);
353 void llSetPrimURL(string url); 357 void llSetPrimURL(string url);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index ca24051..fb52600 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -165,6 +165,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
165 165
166 LSL_String osFormatString(string str, LSL_List strings); 166 LSL_String osFormatString(string str, LSL_List strings);
167 LSL_List osMatchString(string src, string pattern, int start); 167 LSL_List osMatchString(string src, string pattern, int start);
168 LSL_String osReplaceString(string src, string pattern, string replace, int count, int start);
168 169
169 // Information about data loaded into the region 170 // Information about data loaded into the region
170 string osLoadedCreationDate(); 171 string osLoadedCreationDate();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 1366141..a8d1ddb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -1710,6 +1710,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1710 m_LSL_Functions.llSitTarget(offset, rot); 1710 m_LSL_Functions.llSitTarget(offset, rot);
1711 } 1711 }
1712 1712
1713 public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
1714 {
1715 m_LSL_Functions.llLinkSitTarget(link, offset, rot);
1716 }
1717
1713 public void llSleep(double sec) 1718 public void llSleep(double sec)
1714 { 1719 {
1715 m_LSL_Functions.llSleep(sec); 1720 m_LSL_Functions.llSleep(sec);
@@ -1909,17 +1914,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1909 { 1914 {
1910 return m_LSL_Functions.llGetPrimMediaParams(face, rules); 1915 return m_LSL_Functions.llGetPrimMediaParams(face, rules);
1911 } 1916 }
1912 1917
1918 public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
1919 {
1920 return m_LSL_Functions.llGetLinkMedia(link, face, rules);
1921 }
1922
1913 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) 1923 public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
1914 { 1924 {
1915 return m_LSL_Functions.llSetPrimMediaParams(face, rules); 1925 return m_LSL_Functions.llSetPrimMediaParams(face, rules);
1916 } 1926 }
1917 1927
1928 public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
1929 {
1930 return m_LSL_Functions.llSetLinkMedia(link, face, rules);
1931 }
1932
1918 public LSL_Integer llClearPrimMedia(LSL_Integer face) 1933 public LSL_Integer llClearPrimMedia(LSL_Integer face)
1919 { 1934 {
1920 return m_LSL_Functions.llClearPrimMedia(face); 1935 return m_LSL_Functions.llClearPrimMedia(face);
1921 } 1936 }
1922 1937
1938 public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
1939 {
1940 return m_LSL_Functions.llClearLinkMedia(link, face);
1941 }
1942
1923 public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link) 1943 public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link)
1924 { 1944 {
1925 return m_LSL_Functions.llGetLinkNumberOfSides(link); 1945 return m_LSL_Functions.llGetLinkNumberOfSides(link);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index cc8d417..4341246 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -472,6 +472,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
472 return m_OSSL_Functions.osMatchString(src, pattern, start); 472 return m_OSSL_Functions.osMatchString(src, pattern, start);
473 } 473 }
474 474
475 public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start)
476 {
477 return m_OSSL_Functions.osReplaceString(src,pattern,replace,count,start);
478 }
479
480
475 // Information about data loaded into the region 481 // Information about data loaded into the region
476 public string osLoadedCreationDate() 482 public string osLoadedCreationDate()
477 { 483 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
index 8b88588..65d3b9b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
118 emessage = emessage.Substring(slinfo.Length+2); 118 emessage = emessage.Substring(slinfo.Length+2);
119 119
120 message = String.Format("({0},{1}) {2}", 120 message = String.Format("({0},{1}) {2}",
121 e.slInfo.lineNumber - 2, 121 e.slInfo.lineNumber - 1,
122 e.slInfo.charPosition - 1, emessage); 122 e.slInfo.charPosition - 1, emessage);
123 123
124 throw new Exception(message); 124 throw new Exception(message);
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs
index 63afb0b..7763619 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs
@@ -29,6 +29,7 @@ using System.Collections.Generic;
29using System.Text.RegularExpressions; 29using System.Text.RegularExpressions;
30using NUnit.Framework; 30using NUnit.Framework;
31using OpenSim.Region.ScriptEngine.Shared.CodeTools; 31using OpenSim.Region.ScriptEngine.Shared.CodeTools;
32using OpenSim.Tests.Common;
32 33
33namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests 34namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
34{ 35{
@@ -43,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
43 [Test] 44 [Test]
44 public void TestDefaultState() 45 public void TestDefaultState()
45 { 46 {
47 TestHelpers.InMethod();
48
46 string input = @"default 49 string input = @"default
47{ 50{
48 state_entry() 51 state_entry()
@@ -63,6 +66,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
63 [Test] 66 [Test]
64 public void TestCustomState() 67 public void TestCustomState()
65 { 68 {
69 TestHelpers.InMethod();
70
66 string input = @"default 71 string input = @"default
67{ 72{
68 state_entry() 73 state_entry()
@@ -93,6 +98,8 @@ state another_state
93 [Test] 98 [Test]
94 public void TestEventWithArguments() 99 public void TestEventWithArguments()
95 { 100 {
101 TestHelpers.InMethod();
102
96 string input = @"default 103 string input = @"default
97{ 104{
98 at_rot_target(integer tnum, rotation targetrot, rotation ourrot) 105 at_rot_target(integer tnum, rotation targetrot, rotation ourrot)
@@ -113,6 +120,8 @@ state another_state
113 [Test] 120 [Test]
114 public void TestIntegerDeclaration() 121 public void TestIntegerDeclaration()
115 { 122 {
123 TestHelpers.InMethod();
124
116 string input = @"default 125 string input = @"default
117{ 126{
118 touch_start(integer num_detected) 127 touch_start(integer num_detected)
@@ -135,6 +144,8 @@ state another_state
135 [Test] 144 [Test]
136 public void TestLoneIdent() 145 public void TestLoneIdent()
137 { 146 {
147 TestHelpers.InMethod();
148
138 // A lone ident should be removed completely as it's an error in C# 149 // A lone ident should be removed completely as it's an error in C#
139 // (MONO at least). 150 // (MONO at least).
140 string input = @"default 151 string input = @"default
@@ -161,6 +172,8 @@ state another_state
161 [Test] 172 [Test]
162 public void TestAssignments() 173 public void TestAssignments()
163 { 174 {
175 TestHelpers.InMethod();
176
164 string input = @"default 177 string input = @"default
165{ 178{
166 touch_start(integer num_detected) 179 touch_start(integer num_detected)
@@ -187,6 +200,8 @@ state another_state
187 [Test] 200 [Test]
188 public void TestAdditionSubtractionOperator() 201 public void TestAdditionSubtractionOperator()
189 { 202 {
203 TestHelpers.InMethod();
204
190 string input = @"default 205 string input = @"default
191{ 206{
192 touch_start(integer num_detected) 207 touch_start(integer num_detected)
@@ -215,6 +230,8 @@ state another_state
215 [Test] 230 [Test]
216 public void TestStrings() 231 public void TestStrings()
217 { 232 {
233 TestHelpers.InMethod();
234
218 string input = @"default 235 string input = @"default
219{ 236{
220 touch_start(integer num_detected) 237 touch_start(integer num_detected)
@@ -242,6 +259,8 @@ state another_state
242 [Test] 259 [Test]
243 public void TestBinaryExpression() 260 public void TestBinaryExpression()
244 { 261 {
262 TestHelpers.InMethod();
263
245 string input = @"default 264 string input = @"default
246{ 265{
247 touch_start(integer num_detected) 266 touch_start(integer num_detected)
@@ -284,6 +303,8 @@ state another_state
284 [Test] 303 [Test]
285 public void TestFloatConstants() 304 public void TestFloatConstants()
286 { 305 {
306 TestHelpers.InMethod();
307
287 string input = @"default 308 string input = @"default
288{ 309{
289 touch_start(integer num_detected) 310 touch_start(integer num_detected)
@@ -336,6 +357,8 @@ state another_state
336 [Test] 357 [Test]
337 public void TestComments() 358 public void TestComments()
338 { 359 {
360 TestHelpers.InMethod();
361
339 string input = @"// this test tests comments 362 string input = @"// this test tests comments
340default 363default
341{ 364{
@@ -358,6 +381,8 @@ default
358 [Test] 381 [Test]
359 public void TestStringsWithEscapedQuotesAndComments() 382 public void TestStringsWithEscapedQuotesAndComments()
360 { 383 {
384 TestHelpers.InMethod();
385
361 string input = @"// this test tests strings, with escaped quotes and comments in strings 386 string input = @"// this test tests strings, with escaped quotes and comments in strings
362default 387default
363{ 388{
@@ -397,6 +422,8 @@ default
397 [Test] 422 [Test]
398 public void TestCStyleComments() 423 public void TestCStyleComments()
399 { 424 {
425 TestHelpers.InMethod();
426
400 string input = @"/* this test tests comments 427 string input = @"/* this test tests comments
401 of the C variety 428 of the C variety
402*/ 429*/
@@ -426,6 +453,8 @@ default
426 [Test] 453 [Test]
427 public void TestGlobalDefinedFunctions() 454 public void TestGlobalDefinedFunctions()
428 { 455 {
456 TestHelpers.InMethod();
457
429 string input = @"// this test tests custom defined functions 458 string input = @"// this test tests custom defined functions
430 459
431string onefunc() 460string onefunc()
@@ -470,6 +499,8 @@ default
470 [Test] 499 [Test]
471 public void TestGlobalDeclaredVariables() 500 public void TestGlobalDeclaredVariables()
472 { 501 {
502 TestHelpers.InMethod();
503
473 string input = @"// this test tests custom defined functions and global variables 504 string input = @"// this test tests custom defined functions and global variables
474 505
475string globalString; 506string globalString;
@@ -525,6 +556,8 @@ default
525 [Test] 556 [Test]
526 public void TestMoreAssignments() 557 public void TestMoreAssignments()
527 { 558 {
559 TestHelpers.InMethod();
560
528 string input = @"// this test tests +=, -=, *=, /=, %= 561 string input = @"// this test tests +=, -=, *=, /=, %=
529 562
530string globalString; 563string globalString;
@@ -579,6 +612,8 @@ default
579 [Test] 612 [Test]
580 public void TestVectorConstantNotation() 613 public void TestVectorConstantNotation()
581 { 614 {
615 TestHelpers.InMethod();
616
582 string input = @"default 617 string input = @"default
583{ 618{
584 touch_start(integer num_detected) 619 touch_start(integer num_detected)
@@ -606,6 +641,8 @@ default
606 [Test] 641 [Test]
607 public void TestVectorMemberAccess() 642 public void TestVectorMemberAccess()
608 { 643 {
644 TestHelpers.InMethod();
645
609 string input = @"default 646 string input = @"default
610{ 647{
611 touch_start(integer num_detected) 648 touch_start(integer num_detected)
@@ -632,6 +669,8 @@ default
632 [Test] 669 [Test]
633 public void TestExpressionInParentheses() 670 public void TestExpressionInParentheses()
634 { 671 {
672 TestHelpers.InMethod();
673
635 string input = @"default 674 string input = @"default
636{ 675{
637 touch_start(integer num_detected) 676 touch_start(integer num_detected)
@@ -660,6 +699,8 @@ default
660 [Test] 699 [Test]
661 public void TestIncrementDecrementOperator() 700 public void TestIncrementDecrementOperator()
662 { 701 {
702 TestHelpers.InMethod();
703
663 string input = @"// here we'll test the ++ and -- operators 704 string input = @"// here we'll test the ++ and -- operators
664 705
665default 706default
@@ -690,6 +731,8 @@ default
690 [Test] 731 [Test]
691 public void TestLists() 732 public void TestLists()
692 { 733 {
734 TestHelpers.InMethod();
735
693 string input = @"// testing lists 736 string input = @"// testing lists
694 737
695default 738default
@@ -718,6 +761,8 @@ default
718 [Test] 761 [Test]
719 public void TestIfStatement() 762 public void TestIfStatement()
720 { 763 {
764 TestHelpers.InMethod();
765
721 string input = @"// let's test if statements 766 string input = @"// let's test if statements
722 767
723default 768default
@@ -822,6 +867,8 @@ default
822 [Test] 867 [Test]
823 public void TestIfElseStatement() 868 public void TestIfElseStatement()
824 { 869 {
870 TestHelpers.InMethod();
871
825 string input = @"// let's test complex logical expressions 872 string input = @"// let's test complex logical expressions
826 873
827default 874default
@@ -928,6 +975,8 @@ default
928 [Test] 975 [Test]
929 public void TestWhileLoop() 976 public void TestWhileLoop()
930 { 977 {
978 TestHelpers.InMethod();
979
931 string input = @"// let's test while loops 980 string input = @"// let's test while loops
932 981
933default 982default
@@ -968,6 +1017,8 @@ default
968 [Test] 1017 [Test]
969 public void TestDoWhileLoop() 1018 public void TestDoWhileLoop()
970 { 1019 {
1020 TestHelpers.InMethod();
1021
971 string input = @"// let's test do-while loops 1022 string input = @"// let's test do-while loops
972 1023
973default 1024default
@@ -1012,6 +1063,8 @@ default
1012 [Test] 1063 [Test]
1013 public void TestForLoop() 1064 public void TestForLoop()
1014 { 1065 {
1066 TestHelpers.InMethod();
1067
1015 string input = @"// let's test for loops 1068 string input = @"// let's test for loops
1016 1069
1017default 1070default
@@ -1056,6 +1109,8 @@ default
1056 [Test] 1109 [Test]
1057 public void TestFloatsWithTrailingDecimal() 1110 public void TestFloatsWithTrailingDecimal()
1058 { 1111 {
1112 TestHelpers.InMethod();
1113
1059 string input = @"// a curious feature of LSL that allows floats to be defined with a trailing dot 1114 string input = @"// a curious feature of LSL that allows floats to be defined with a trailing dot
1060 1115
1061default 1116default
@@ -1108,6 +1163,8 @@ default
1108 [Test] 1163 [Test]
1109 public void TestUnaryAndBinaryOperators() 1164 public void TestUnaryAndBinaryOperators()
1110 { 1165 {
1166 TestHelpers.InMethod();
1167
1111 string input = @"// let's test a few more operators 1168 string input = @"// let's test a few more operators
1112 1169
1113default 1170default
@@ -1144,6 +1201,8 @@ default
1144 [Test] 1201 [Test]
1145 public void TestTypecasts() 1202 public void TestTypecasts()
1146 { 1203 {
1204 TestHelpers.InMethod();
1205
1147 string input = @"// let's test typecasts 1206 string input = @"// let's test typecasts
1148 1207
1149default 1208default
@@ -1189,6 +1248,8 @@ default
1189 [Test] 1248 [Test]
1190 public void TestStates() 1249 public void TestStates()
1191 { 1250 {
1251 TestHelpers.InMethod();
1252
1192 string input = @"// let's test states 1253 string input = @"// let's test states
1193 1254
1194default 1255default
@@ -1229,6 +1290,8 @@ state statetwo
1229 [Test] 1290 [Test]
1230 public void TestHexIntegerConstants() 1291 public void TestHexIntegerConstants()
1231 { 1292 {
1293 TestHelpers.InMethod();
1294
1232 string input = @"// let's test hex integers 1295 string input = @"// let's test hex integers
1233 1296
1234default 1297default
@@ -1261,6 +1324,8 @@ default
1261 [Test] 1324 [Test]
1262 public void TestJumps() 1325 public void TestJumps()
1263 { 1326 {
1327 TestHelpers.InMethod();
1328
1264 string input = @"// let's test jumps 1329 string input = @"// let's test jumps
1265 1330
1266default 1331default
@@ -1291,6 +1356,8 @@ default
1291 [Test] 1356 [Test]
1292 public void TestImplicitVariableInitialization() 1357 public void TestImplicitVariableInitialization()
1293 { 1358 {
1359 TestHelpers.InMethod();
1360
1294 string input = @"// let's test implicitly initializing variables 1361 string input = @"// let's test implicitly initializing variables
1295 1362
1296default 1363default
@@ -1334,6 +1401,8 @@ default
1334 [Test] 1401 [Test]
1335 public void TestMultipleEqualsExpression() 1402 public void TestMultipleEqualsExpression()
1336 { 1403 {
1404 TestHelpers.InMethod();
1405
1337 string input = @"// let's test x = y = 5 type expressions 1406 string input = @"// let's test x = y = 5 type expressions
1338 1407
1339default 1408default
@@ -1366,6 +1435,8 @@ default
1366 [Test] 1435 [Test]
1367 public void TestUnaryExpressionLastInVectorConstant() 1436 public void TestUnaryExpressionLastInVectorConstant()
1368 { 1437 {
1438 TestHelpers.InMethod();
1439
1369 string input = @"// let's test unary expressions some more 1440 string input = @"// let's test unary expressions some more
1370 1441
1371default 1442default
@@ -1390,6 +1461,8 @@ default
1390 [Test] 1461 [Test]
1391 public void TestVectorMemberPlusEquals() 1462 public void TestVectorMemberPlusEquals()
1392 { 1463 {
1464 TestHelpers.InMethod();
1465
1393 string input = @"// let's test unary expressions some more 1466 string input = @"// let's test unary expressions some more
1394 1467
1395default 1468default
@@ -1424,6 +1497,8 @@ default
1424 [Test] 1497 [Test]
1425 public void TestWhileLoopWithNoBody() 1498 public void TestWhileLoopWithNoBody()
1426 { 1499 {
1500 TestHelpers.InMethod();
1501
1427 string input = @"default 1502 string input = @"default
1428{ 1503{
1429 state_entry() 1504 state_entry()
@@ -1447,6 +1522,8 @@ default
1447 [Test] 1522 [Test]
1448 public void TestDoWhileLoopWithNoBody() 1523 public void TestDoWhileLoopWithNoBody()
1449 { 1524 {
1525 TestHelpers.InMethod();
1526
1450 string input = @"default 1527 string input = @"default
1451{ 1528{
1452 state_entry() 1529 state_entry()
@@ -1472,6 +1549,8 @@ default
1472 [Test] 1549 [Test]
1473 public void TestIfWithNoBody() 1550 public void TestIfWithNoBody()
1474 { 1551 {
1552 TestHelpers.InMethod();
1553
1475 string input = @"default 1554 string input = @"default
1476{ 1555{
1477 state_entry() 1556 state_entry()
@@ -1495,6 +1574,8 @@ default
1495 [Test] 1574 [Test]
1496 public void TestIfElseWithNoBody() 1575 public void TestIfElseWithNoBody()
1497 { 1576 {
1577 TestHelpers.InMethod();
1578
1498 string input = @"default 1579 string input = @"default
1499{ 1580{
1500 state_entry() 1581 state_entry()
@@ -1521,6 +1602,8 @@ default
1521 [Test] 1602 [Test]
1522 public void TestForLoopWithNoBody() 1603 public void TestForLoopWithNoBody()
1523 { 1604 {
1605 TestHelpers.InMethod();
1606
1524 string input = @"default 1607 string input = @"default
1525{ 1608{
1526 state_entry() 1609 state_entry()
@@ -1544,6 +1627,8 @@ default
1544 [Test] 1627 [Test]
1545 public void TestForLoopWithNoAssignment() 1628 public void TestForLoopWithNoAssignment()
1546 { 1629 {
1630 TestHelpers.InMethod();
1631
1547 string input = @"default 1632 string input = @"default
1548{ 1633{
1549 state_entry() 1634 state_entry()
@@ -1569,6 +1654,8 @@ default
1569 [Test] 1654 [Test]
1570 public void TestForLoopWithOnlyIdentInAssignment() 1655 public void TestForLoopWithOnlyIdentInAssignment()
1571 { 1656 {
1657 TestHelpers.InMethod();
1658
1572 string input = @"default 1659 string input = @"default
1573{ 1660{
1574 state_entry() 1661 state_entry()
@@ -1594,6 +1681,8 @@ default
1594 [Test] 1681 [Test]
1595 public void TestAssignmentInIfWhileDoWhile() 1682 public void TestAssignmentInIfWhileDoWhile()
1596 { 1683 {
1684 TestHelpers.InMethod();
1685
1597 string input = @"default 1686 string input = @"default
1598{ 1687{
1599 state_entry() 1688 state_entry()
@@ -1631,6 +1720,8 @@ default
1631 [Test] 1720 [Test]
1632 public void TestLSLListHack() 1721 public void TestLSLListHack()
1633 { 1722 {
1723 TestHelpers.InMethod();
1724
1634 string input = @"default 1725 string input = @"default
1635{ 1726{
1636 state_entry() 1727 state_entry()
@@ -1653,9 +1744,12 @@ default
1653 } 1744 }
1654 1745
1655 [Test] 1746 [Test]
1656 [ExpectedException(typeof(System.Exception))]
1657 public void TestSyntaxError() 1747 public void TestSyntaxError()
1658 { 1748 {
1749 TestHelpers.InMethod();
1750
1751 bool gotException = false;
1752
1659 string input = @"default 1753 string input = @"default
1660{ 1754{
1661 state_entry() 1755 state_entry()
@@ -1671,17 +1765,22 @@ default
1671 } 1765 }
1672 catch (System.Exception e) 1766 catch (System.Exception e)
1673 { 1767 {
1674 // The syntax error is on line 6, char 5 (expected ';', found 1768 // The syntax error is on line 5, char 4 (expected ';', found
1675 // '}'). 1769 // '}').
1676 Assert.AreEqual("(4,4) syntax error", e.Message); 1770 Assert.AreEqual("(5,4) syntax error", e.Message);
1677 throw; 1771 gotException = true;
1678 } 1772 }
1773
1774 Assert.That(gotException, Is.True);
1679 } 1775 }
1680 1776
1681 [Test] 1777 [Test]
1682 [ExpectedException(typeof(System.Exception))]
1683 public void TestSyntaxErrorDeclaringVariableInForLoop() 1778 public void TestSyntaxErrorDeclaringVariableInForLoop()
1684 { 1779 {
1780 TestHelpers.InMethod();
1781
1782 bool gotException = false;
1783
1685 string input = @"default 1784 string input = @"default
1686{ 1785{
1687 state_entry() 1786 state_entry()
@@ -1697,11 +1796,13 @@ default
1697 } 1796 }
1698 catch (System.Exception e) 1797 catch (System.Exception e)
1699 { 1798 {
1700 // The syntax error is on line 5, char 14 (Syntax error) 1799 // The syntax error is on line 4, char 13 (Syntax error)
1701 Assert.AreEqual("(3,13) syntax error", e.Message); 1800 Assert.AreEqual("(4,13) syntax error", e.Message);
1702 1801
1703 throw; 1802 gotException = true;
1704 } 1803 }
1804
1805 Assert.That(gotException, Is.True);
1705 } 1806 }
1706 } 1807 }
1707} 1808}
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs
index c5483c8..1fa6954 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
31using Microsoft.CSharp; 31using Microsoft.CSharp;
32using NUnit.Framework; 32using NUnit.Framework;
33using OpenSim.Region.ScriptEngine.Shared.CodeTools; 33using OpenSim.Region.ScriptEngine.Shared.CodeTools;
34using OpenSim.Tests.Common;
34 35
35namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests 36namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
36{ 37{
@@ -92,6 +93,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
92 //[Test] 93 //[Test]
93 public void TestUseUndeclaredVariable() 94 public void TestUseUndeclaredVariable()
94 { 95 {
96 TestHelpers.InMethod();
97
95 m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); 98 m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll");
96 99
97 string input = @"default 100 string input = @"default
@@ -124,6 +127,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
124 //[Test] 127 //[Test]
125 public void TestCastAndConcatString() 128 public void TestCastAndConcatString()
126 { 129 {
130 TestHelpers.InMethod();
131
127 m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); 132 m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll");
128 133
129 string input = @"string s = "" a string""; 134 string input = @"string s = "" a string"";
@@ -150,4 +155,4 @@ default
150 Assert.AreEqual(0, m_compilerResults.Errors.Count); 155 Assert.AreEqual(0, m_compilerResults.Errors.Count);
151 } 156 }
152 } 157 }
153} 158} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
index 3baa723..9cf9258 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
@@ -46,7 +46,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
46 [TestFixture, LongRunning] 46 [TestFixture, LongRunning]
47 public class LSL_ApiTest 47 public class LSL_ApiTest
48 { 48 {
49
50 private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; 49 private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6;
51 private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d; 50 private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d;
52 private const float FLOAT_ACCURACY = 0.00005f; 51 private const float FLOAT_ACCURACY = 0.00005f;
@@ -55,7 +54,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
55 [SetUp] 54 [SetUp]
56 public void SetUp() 55 public void SetUp()
57 { 56 {
58
59 IConfigSource initConfigSource = new IniConfigSource(); 57 IConfigSource initConfigSource = new IniConfigSource();
60 IConfig config = initConfigSource.AddConfig("XEngine"); 58 IConfig config = initConfigSource.AddConfig("XEngine");
61 config.Set("Enabled", "true"); 59 config.Set("Enabled", "true");
@@ -75,6 +73,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
75 [Test] 73 [Test]
76 public void TestllAngleBetween() 74 public void TestllAngleBetween()
77 { 75 {
76 TestHelpers.InMethod();
77
78 CheckllAngleBetween(new Vector3(1, 0, 0), 0, 1, 1); 78 CheckllAngleBetween(new Vector3(1, 0, 0), 0, 1, 1);
79 CheckllAngleBetween(new Vector3(1, 0, 0), 90, 1, 1); 79 CheckllAngleBetween(new Vector3(1, 0, 0), 90, 1, 1);
80 CheckllAngleBetween(new Vector3(1, 0, 0), 180, 1, 1); 80 CheckllAngleBetween(new Vector3(1, 0, 0), 180, 1, 1);
@@ -158,6 +158,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
158 // llRot2Euler test. 158 // llRot2Euler test.
159 public void TestllRot2Euler() 159 public void TestllRot2Euler()
160 { 160 {
161 TestHelpers.InMethod();
162
161 // 180, 90 and zero degree rotations. 163 // 180, 90 and zero degree rotations.
162 CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f)); 164 CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f));
163 CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.707107f, 0.707107f)); 165 CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.707107f, 0.707107f));
@@ -256,6 +258,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
256 // llSetPrimitiveParams and llGetPrimitiveParams test. 258 // llSetPrimitiveParams and llGetPrimitiveParams test.
257 public void TestllSetPrimitiveParams() 259 public void TestllSetPrimitiveParams()
258 { 260 {
261 TestHelpers.InMethod();
262
259 // Create Prim1. 263 // Create Prim1.
260 Scene scene = SceneHelpers.SetupScene(); 264 Scene scene = SceneHelpers.SetupScene();
261 string obj1Name = "Prim1"; 265 string obj1Name = "Prim1";
@@ -486,9 +490,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
486 } 490 }
487 491
488 [Test] 492 [Test]
489 // llVecNorm test.
490 public void TestllVecNorm() 493 public void TestllVecNorm()
491 { 494 {
495 TestHelpers.InMethod();
496
492 // Check special case for normalizing zero vector. 497 // Check special case for normalizing zero vector.
493 CheckllVecNorm(new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); 498 CheckllVecNorm(new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), new LSL_Types.Vector3(0.0d, 0.0d, 0.0d));
494 // Check various vectors. 499 // Check various vectors.
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs
index 10b52cf..3ed2562 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs
@@ -213,6 +213,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
213 [Test] 213 [Test]
214 public void TestConstructFromInt() 214 public void TestConstructFromInt()
215 { 215 {
216 TestHelpers.InMethod();
217
216 LSL_Types.LSLFloat testFloat; 218 LSL_Types.LSLFloat testFloat;
217 219
218 foreach (KeyValuePair<int, double> number in m_intDoubleSet) 220 foreach (KeyValuePair<int, double> number in m_intDoubleSet)
@@ -228,6 +230,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
228 [Test] 230 [Test]
229 public void TestConstructFromDouble() 231 public void TestConstructFromDouble()
230 { 232 {
233 TestHelpers.InMethod();
234
231 LSL_Types.LSLFloat testFloat; 235 LSL_Types.LSLFloat testFloat;
232 236
233 foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) 237 foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
@@ -243,6 +247,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
243 [Test] 247 [Test]
244 public void TestExplicitCastLSLFloatToInt() 248 public void TestExplicitCastLSLFloatToInt()
245 { 249 {
250 TestHelpers.InMethod();
251
246 int testNumber; 252 int testNumber;
247 253
248 foreach (KeyValuePair<double, int> number in m_doubleIntSet) 254 foreach (KeyValuePair<double, int> number in m_doubleIntSet)
@@ -258,6 +264,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
258 [Test] 264 [Test]
259 public void TestExplicitCastLSLFloatToUint() 265 public void TestExplicitCastLSLFloatToUint()
260 { 266 {
267 TestHelpers.InMethod();
268
261 uint testNumber; 269 uint testNumber;
262 270
263 foreach (KeyValuePair<double, int> number in m_doubleUintSet) 271 foreach (KeyValuePair<double, int> number in m_doubleUintSet)
@@ -273,6 +281,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
273 [Test] 281 [Test]
274 public void TestImplicitCastLSLFloatToBooleanTrue() 282 public void TestImplicitCastLSLFloatToBooleanTrue()
275 { 283 {
284 TestHelpers.InMethod();
285
276 LSL_Types.LSLFloat testFloat; 286 LSL_Types.LSLFloat testFloat;
277 bool testBool; 287 bool testBool;
278 288
@@ -291,6 +301,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
291 [Test] 301 [Test]
292 public void TestImplicitCastLSLFloatToBooleanFalse() 302 public void TestImplicitCastLSLFloatToBooleanFalse()
293 { 303 {
304 TestHelpers.InMethod();
305
294 LSL_Types.LSLFloat testFloat = new LSL_Types.LSLFloat(0.0); 306 LSL_Types.LSLFloat testFloat = new LSL_Types.LSLFloat(0.0);
295 bool testBool = testFloat; 307 bool testBool = testFloat;
296 308
@@ -303,6 +315,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
303 [Test] 315 [Test]
304 public void TestImplicitCastIntToLSLFloat() 316 public void TestImplicitCastIntToLSLFloat()
305 { 317 {
318 TestHelpers.InMethod();
319
306 LSL_Types.LSLFloat testFloat; 320 LSL_Types.LSLFloat testFloat;
307 321
308 foreach (int number in m_intList) 322 foreach (int number in m_intList)
@@ -318,6 +332,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
318 [Test] 332 [Test]
319 public void TestImplicitCastLSLIntegerToLSLFloat() 333 public void TestImplicitCastLSLIntegerToLSLFloat()
320 { 334 {
335 TestHelpers.InMethod();
336
321 LSL_Types.LSLFloat testFloat; 337 LSL_Types.LSLFloat testFloat;
322 338
323 foreach (int number in m_intList) 339 foreach (int number in m_intList)
@@ -333,6 +349,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
333 [Test] 349 [Test]
334 public void TestExplicitCastLSLIntegerToLSLFloat() 350 public void TestExplicitCastLSLIntegerToLSLFloat()
335 { 351 {
352 TestHelpers.InMethod();
353
336 LSL_Types.LSLFloat testFloat; 354 LSL_Types.LSLFloat testFloat;
337 355
338 foreach (int number in m_intList) 356 foreach (int number in m_intList)
@@ -348,6 +366,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
348 [Test] 366 [Test]
349 public void TestExplicitCastStringToLSLFloat() 367 public void TestExplicitCastStringToLSLFloat()
350 { 368 {
369 TestHelpers.InMethod();
370
351 LSL_Types.LSLFloat testFloat; 371 LSL_Types.LSLFloat testFloat;
352 372
353 foreach (KeyValuePair<string, double> number in m_stringDoubleSet) 373 foreach (KeyValuePair<string, double> number in m_stringDoubleSet)
@@ -363,6 +383,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
363 [Test] 383 [Test]
364 public void TestExplicitCastLSLStringToLSLFloat() 384 public void TestExplicitCastLSLStringToLSLFloat()
365 { 385 {
386 TestHelpers.InMethod();
387
366 LSL_Types.LSLFloat testFloat; 388 LSL_Types.LSLFloat testFloat;
367 389
368 foreach (KeyValuePair<string, double> number in m_stringDoubleSet) 390 foreach (KeyValuePair<string, double> number in m_stringDoubleSet)
@@ -378,6 +400,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
378 [Test] 400 [Test]
379 public void TestImplicitCastDoubleToLSLFloat() 401 public void TestImplicitCastDoubleToLSLFloat()
380 { 402 {
403 TestHelpers.InMethod();
404
381 LSL_Types.LSLFloat testFloat; 405 LSL_Types.LSLFloat testFloat;
382 406
383 foreach (double number in m_doubleList) 407 foreach (double number in m_doubleList)
@@ -393,6 +417,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
393 [Test] 417 [Test]
394 public void TestImplicitCastLSLFloatToDouble() 418 public void TestImplicitCastLSLFloatToDouble()
395 { 419 {
420 TestHelpers.InMethod();
421
396 double testNumber; 422 double testNumber;
397 LSL_Types.LSLFloat testFloat; 423 LSL_Types.LSLFloat testFloat;
398 424
@@ -411,19 +437,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
411 [Test] 437 [Test]
412 public void TestExplicitCastLSLFloatToFloat() 438 public void TestExplicitCastLSLFloatToFloat()
413 { 439 {
414 float testFloat; 440 TestHelpers.InMethod();
415 float numberAsFloat; 441
416 LSL_Types.LSLFloat testLSLFloat; 442 float testFloat;
417 foreach (double number in m_doubleList) 443 float numberAsFloat;
418 { 444 LSL_Types.LSLFloat testLSLFloat;
419 testLSLFloat = new LSL_Types.LSLFloat(number);
420 numberAsFloat = (float)number;
421 testFloat = (float)testLSLFloat;
422
423 Assert.That((double)testFloat, new DoubleToleranceConstraint((double)numberAsFloat, _lowPrecisionTolerance));
424 }
425 }
426 445
446 foreach (double number in m_doubleList)
447 {
448 testLSLFloat = new LSL_Types.LSLFloat(number);
449 numberAsFloat = (float)number;
450 testFloat = (float)testLSLFloat;
451
452 Assert.That((double)testFloat, new DoubleToleranceConstraint((double)numberAsFloat, _lowPrecisionTolerance));
453 }
454 }
427 455
428 /// <summary> 456 /// <summary>
429 /// Tests the equality (==) operator. 457 /// Tests the equality (==) operator.
@@ -431,6 +459,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
431 [Test] 459 [Test]
432 public void TestEqualsOperator() 460 public void TestEqualsOperator()
433 { 461 {
462 TestHelpers.InMethod();
463
434 LSL_Types.LSLFloat testFloatA, testFloatB; 464 LSL_Types.LSLFloat testFloatA, testFloatB;
435 465
436 foreach (double number in m_doubleList) 466 foreach (double number in m_doubleList)
@@ -450,6 +480,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
450 [Test] 480 [Test]
451 public void TestNotEqualOperator() 481 public void TestNotEqualOperator()
452 { 482 {
483 TestHelpers.InMethod();
484
453 LSL_Types.LSLFloat testFloatA, testFloatB; 485 LSL_Types.LSLFloat testFloatA, testFloatB;
454 486
455 foreach (double number in m_doubleList) 487 foreach (double number in m_doubleList)
@@ -469,6 +501,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
469 [Test] 501 [Test]
470 public void TestIncrementOperator() 502 public void TestIncrementOperator()
471 { 503 {
504 TestHelpers.InMethod();
505
472 LSL_Types.LSLFloat testFloat; 506 LSL_Types.LSLFloat testFloat;
473 double testNumber; 507 double testNumber;
474 508
@@ -493,6 +527,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
493 [Test] 527 [Test]
494 public void TestDecrementOperator() 528 public void TestDecrementOperator()
495 { 529 {
530 TestHelpers.InMethod();
531
496 LSL_Types.LSLFloat testFloat; 532 LSL_Types.LSLFloat testFloat;
497 double testNumber; 533 double testNumber;
498 534
@@ -517,6 +553,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
517 [Test] 553 [Test]
518 public void TestToString() 554 public void TestToString()
519 { 555 {
556 TestHelpers.InMethod();
557
520 LSL_Types.LSLFloat testFloat; 558 LSL_Types.LSLFloat testFloat;
521 559
522 foreach (KeyValuePair<double, string> number in m_doubleStringSet) 560 foreach (KeyValuePair<double, string> number in m_doubleStringSet)
@@ -532,6 +570,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
532 [Test] 570 [Test]
533 public void TestAddTwoLSLFloats() 571 public void TestAddTwoLSLFloats()
534 { 572 {
573 TestHelpers.InMethod();
574
535 LSL_Types.LSLFloat testResult; 575 LSL_Types.LSLFloat testResult;
536 576
537 foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) 577 foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
@@ -547,6 +587,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
547 [Test] 587 [Test]
548 public void TestSubtractTwoLSLFloats() 588 public void TestSubtractTwoLSLFloats()
549 { 589 {
590 TestHelpers.InMethod();
591
550 LSL_Types.LSLFloat testResult; 592 LSL_Types.LSLFloat testResult;
551 593
552 foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) 594 foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
@@ -562,6 +604,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
562 [Test] 604 [Test]
563 public void TestMultiplyTwoLSLFloats() 605 public void TestMultiplyTwoLSLFloats()
564 { 606 {
607 TestHelpers.InMethod();
608
565 LSL_Types.LSLFloat testResult; 609 LSL_Types.LSLFloat testResult;
566 610
567 foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) 611 foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
@@ -577,6 +621,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
577 [Test] 621 [Test]
578 public void TestDivideTwoLSLFloats() 622 public void TestDivideTwoLSLFloats()
579 { 623 {
624 TestHelpers.InMethod();
625
580 LSL_Types.LSLFloat testResult; 626 LSL_Types.LSLFloat testResult;
581 627
582 foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) 628 foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
@@ -595,6 +641,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
595 [Test] 641 [Test]
596 public void TestImplicitCastBooleanToLSLFloat() 642 public void TestImplicitCastBooleanToLSLFloat()
597 { 643 {
644 TestHelpers.InMethod();
645
598 LSL_Types.LSLFloat testFloat; 646 LSL_Types.LSLFloat testFloat;
599 647
600 testFloat = (1 == 0); 648 testFloat = (1 == 0);
@@ -610,4 +658,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
610 Assert.That(testFloat.value, new DoubleToleranceConstraint(1.0, _lowPrecisionTolerance)); 658 Assert.That(testFloat.value, new DoubleToleranceConstraint(1.0, _lowPrecisionTolerance));
611 } 659 }
612 } 660 }
613} 661} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs
index 3ad673b..8d1169a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs
@@ -79,6 +79,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
79 [Test] 79 [Test]
80 public void TestExplicitCastLSLFloatToLSLInteger() 80 public void TestExplicitCastLSLFloatToLSLInteger()
81 { 81 {
82 TestHelpers.InMethod();
83
82 LSL_Types.LSLInteger testInteger; 84 LSL_Types.LSLInteger testInteger;
83 85
84 foreach (KeyValuePair<double, int> number in m_doubleIntSet) 86 foreach (KeyValuePair<double, int> number in m_doubleIntSet)
@@ -94,6 +96,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
94 [Test] 96 [Test]
95 public void TestExplicitCastStringToLSLInteger() 97 public void TestExplicitCastStringToLSLInteger()
96 { 98 {
99 TestHelpers.InMethod();
100
97 LSL_Types.LSLInteger testInteger; 101 LSL_Types.LSLInteger testInteger;
98 102
99 foreach (KeyValuePair<string, int> number in m_stringIntSet) 103 foreach (KeyValuePair<string, int> number in m_stringIntSet)
@@ -109,6 +113,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
109 [Test] 113 [Test]
110 public void TestExplicitCastLSLStringToLSLInteger() 114 public void TestExplicitCastLSLStringToLSLInteger()
111 { 115 {
116 TestHelpers.InMethod();
117
112 LSL_Types.LSLInteger testInteger; 118 LSL_Types.LSLInteger testInteger;
113 119
114 foreach (KeyValuePair<string, int> number in m_stringIntSet) 120 foreach (KeyValuePair<string, int> number in m_stringIntSet)
@@ -124,6 +130,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
124 [Test] 130 [Test]
125 public void TestImplicitCastBooleanToLSLInteger() 131 public void TestImplicitCastBooleanToLSLInteger()
126 { 132 {
133 TestHelpers.InMethod();
134
127 LSL_Types.LSLInteger testInteger; 135 LSL_Types.LSLInteger testInteger;
128 136
129 testInteger = (1 == 0); 137 testInteger = (1 == 0);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs
index fa976ed..c4ca1a8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs
@@ -71,6 +71,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
71 [Test] 71 [Test]
72 public void TestConstructFromLSLFloat() 72 public void TestConstructFromLSLFloat()
73 { 73 {
74 TestHelpers.InMethod();
75
74 LSL_Types.LSLString testString; 76 LSL_Types.LSLString testString;
75 77
76 foreach (KeyValuePair<double, string> number in m_doubleStringSet) 78 foreach (KeyValuePair<double, string> number in m_doubleStringSet)
@@ -86,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
86 [Test] 88 [Test]
87 public void TestExplicitCastLSLFloatToLSLString() 89 public void TestExplicitCastLSLFloatToLSLString()
88 { 90 {
91 TestHelpers.InMethod();
92
89 LSL_Types.LSLString testString; 93 LSL_Types.LSLString testString;
90 94
91 foreach (KeyValuePair<double, string> number in m_doubleStringSet) 95 foreach (KeyValuePair<double, string> number in m_doubleStringSet)
@@ -101,6 +105,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
101 [Test] 105 [Test]
102 public void TestExplicitCastLSLStringToQuaternion() 106 public void TestExplicitCastLSLStringToQuaternion()
103 { 107 {
108 TestHelpers.InMethod();
109
104 string quaternionString = "<0.00000, 0.70711, 0.00000, 0.70711>"; 110 string quaternionString = "<0.00000, 0.70711, 0.00000, 0.70711>";
105 LSL_Types.LSLString quaternionLSLString = new LSL_Types.LSLString(quaternionString); 111 LSL_Types.LSLString quaternionLSLString = new LSL_Types.LSLString(quaternionString);
106 112
@@ -118,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
118 [Test] 124 [Test]
119 public void TestImplicitCastBooleanToLSLFloat() 125 public void TestImplicitCastBooleanToLSLFloat()
120 { 126 {
127 TestHelpers.InMethod();
128
121 LSL_Types.LSLString testString; 129 LSL_Types.LSLString testString;
122 130
123 testString = (LSL_Types.LSLString) (1 == 0); 131 testString = (LSL_Types.LSLString) (1 == 0);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs
index 66a7329..b81225f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs
@@ -44,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
44 [Test] 44 [Test]
45 public void TestConcatenateString() 45 public void TestConcatenateString()
46 { 46 {
47 TestHelpers.InMethod();
48
47 LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); 49 LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test"));
48 testList += new LSL_Types.LSLString("addition"); 50 testList += new LSL_Types.LSLString("addition");
49 51
@@ -64,6 +66,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
64 [Test] 66 [Test]
65 public void TestConcatenateInteger() 67 public void TestConcatenateInteger()
66 { 68 {
69 TestHelpers.InMethod();
70
67 LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); 71 LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test"));
68 testList += new LSL_Types.LSLInteger(20); 72 testList += new LSL_Types.LSLInteger(20);
69 73
@@ -84,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
84 [Test] 88 [Test]
85 public void TestConcatenateDouble() 89 public void TestConcatenateDouble()
86 { 90 {
91 TestHelpers.InMethod();
92
87 LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); 93 LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test"));
88 testList += new LSL_Types.LSLFloat(2.0f); 94 testList += new LSL_Types.LSLFloat(2.0f);
89 95
@@ -104,6 +110,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
104 [Test] 110 [Test]
105 public void TestCastLSLIntegerItemToLSLInteger() 111 public void TestCastLSLIntegerItemToLSLInteger()
106 { 112 {
113 TestHelpers.InMethod();
114
107 LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(123); 115 LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(123);
108 LSL_Types.list testList = new LSL_Types.list(testValue); 116 LSL_Types.list testList = new LSL_Types.list(testValue);
109 117
@@ -116,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
116 [Test] 124 [Test]
117 public void TestCastLSLFloatItemToLSLFloat() 125 public void TestCastLSLFloatItemToLSLFloat()
118 { 126 {
127 TestHelpers.InMethod();
128
119 LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(123.45678987); 129 LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(123.45678987);
120 LSL_Types.list testList = new LSL_Types.list(testValue); 130 LSL_Types.list testList = new LSL_Types.list(testValue);
121 131
@@ -128,6 +138,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
128 [Test] 138 [Test]
129 public void TestCastLSLStringItemToLSLString() 139 public void TestCastLSLStringItemToLSLString()
130 { 140 {
141 TestHelpers.InMethod();
142
131 LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello there"); 143 LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello there");
132 LSL_Types.list testList = new LSL_Types.list(testValue); 144 LSL_Types.list testList = new LSL_Types.list(testValue);
133 145
@@ -140,6 +152,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
140 [Test] 152 [Test]
141 public void TestCastVector3ItemToVector3() 153 public void TestCastVector3ItemToVector3()
142 { 154 {
155 TestHelpers.InMethod();
156
143 LSL_Types.Vector3 testValue = new LSL_Types.Vector3(12.34, 56.987654, 0.00987); 157 LSL_Types.Vector3 testValue = new LSL_Types.Vector3(12.34, 56.987654, 0.00987);
144 LSL_Types.list testList = new LSL_Types.list(testValue); 158 LSL_Types.list testList = new LSL_Types.list(testValue);
145 159
@@ -151,6 +165,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
151 [Test] 165 [Test]
152 public void TestCastQuaternionItemToQuaternion() 166 public void TestCastQuaternionItemToQuaternion()
153 { 167 {
168 TestHelpers.InMethod();
169
154 LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.34, 56.44323, 765.983421, 0.00987); 170 LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.34, 56.44323, 765.983421, 0.00987);
155 LSL_Types.list testList = new LSL_Types.list(testValue); 171 LSL_Types.list testList = new LSL_Types.list(testValue);
156 172
@@ -165,6 +181,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
165 [Test] 181 [Test]
166 public void TestGetLSLIntegerItemForLSLIntegerItem() 182 public void TestGetLSLIntegerItemForLSLIntegerItem()
167 { 183 {
184 TestHelpers.InMethod();
185
168 LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(999911); 186 LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(999911);
169 LSL_Types.list testList = new LSL_Types.list(testValue); 187 LSL_Types.list testList = new LSL_Types.list(testValue);
170 188
@@ -177,6 +195,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
177 [Test] 195 [Test]
178 public void TestGetLSLFloatItemForLSLFloatItem() 196 public void TestGetLSLFloatItemForLSLFloatItem()
179 { 197 {
198 TestHelpers.InMethod();
199
180 LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(321.45687876); 200 LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(321.45687876);
181 LSL_Types.list testList = new LSL_Types.list(testValue); 201 LSL_Types.list testList = new LSL_Types.list(testValue);
182 202
@@ -189,11 +209,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
189 [Test] 209 [Test]
190 public void TestGetLSLFloatItemForLSLIntegerItem() 210 public void TestGetLSLFloatItemForLSLIntegerItem()
191 { 211 {
192 LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(3060987); 212 TestHelpers.InMethod();
193 LSL_Types.LSLFloat testFloatValue = new LSL_Types.LSLFloat(testValue); 213
194 LSL_Types.list testList = new LSL_Types.list(testValue); 214 LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(3060987);
215 LSL_Types.LSLFloat testFloatValue = new LSL_Types.LSLFloat(testValue);
216 LSL_Types.list testList = new LSL_Types.list(testValue);
195 217
196 Assert.AreEqual(testFloatValue, testList.GetLSLFloatItem(0)); 218 Assert.AreEqual(testFloatValue, testList.GetLSLFloatItem(0));
197 } 219 }
198 220
199 /// <summary> 221 /// <summary>
@@ -202,6 +224,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
202 [Test] 224 [Test]
203 public void TestGetLSLStringItemForLSLStringItem() 225 public void TestGetLSLStringItemForLSLStringItem()
204 { 226 {
227 TestHelpers.InMethod();
228
205 LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello all"); 229 LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello all");
206 LSL_Types.list testList = new LSL_Types.list(testValue); 230 LSL_Types.list testList = new LSL_Types.list(testValue);
207 231
@@ -214,6 +238,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
214 [Test] 238 [Test]
215 public void TestGetLSLStringItemForKeyItem() 239 public void TestGetLSLStringItemForKeyItem()
216 { 240 {
241 TestHelpers.InMethod();
242
217 LSL_Types.key testValue 243 LSL_Types.key testValue
218 = new LSL_Types.key("98000000-0000-2222-3333-100000001000"); 244 = new LSL_Types.key("98000000-0000-2222-3333-100000001000");
219 LSL_Types.LSLString testStringValue = new LSL_Types.LSLString(testValue); 245 LSL_Types.LSLString testStringValue = new LSL_Types.LSLString(testValue);
@@ -228,6 +254,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
228 [Test] 254 [Test]
229 public void TestGetVector3ItemForVector3Item() 255 public void TestGetVector3ItemForVector3Item()
230 { 256 {
257 TestHelpers.InMethod();
258
231 LSL_Types.Vector3 testValue = new LSL_Types.Vector3(92.34, 58.98754, -0.10987); 259 LSL_Types.Vector3 testValue = new LSL_Types.Vector3(92.34, 58.98754, -0.10987);
232 LSL_Types.list testList = new LSL_Types.list(testValue); 260 LSL_Types.list testList = new LSL_Types.list(testValue);
233 261
@@ -239,6 +267,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
239 [Test] 267 [Test]
240 public void TestGetQuaternionItemForQuaternionItem() 268 public void TestGetQuaternionItemForQuaternionItem()
241 { 269 {
270 TestHelpers.InMethod();
271
242 LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987); 272 LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987);
243 LSL_Types.list testList = new LSL_Types.list(testValue); 273 LSL_Types.list testList = new LSL_Types.list(testValue);
244 274
@@ -251,6 +281,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
251 [Test] 281 [Test]
252 public void TestGetKeyItemForKeyItem() 282 public void TestGetKeyItemForKeyItem()
253 { 283 {
284 TestHelpers.InMethod();
285
254 LSL_Types.key testValue 286 LSL_Types.key testValue
255 = new LSL_Types.key("00000000-0000-2222-3333-100000001012"); 287 = new LSL_Types.key("00000000-0000-2222-3333-100000001012");
256 LSL_Types.list testList = new LSL_Types.list(testValue); 288 LSL_Types.list testList = new LSL_Types.list(testValue);
@@ -258,4 +290,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
258 Assert.AreEqual(testValue, testList.GetKeyItem(0)); 290 Assert.AreEqual(testValue, testList.GetKeyItem(0));
259 } 291 }
260 } 292 }
261} 293} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs
index 195af7f..ebf8001 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs
@@ -32,16 +32,17 @@ using OpenSim.Region.ScriptEngine.Shared;
32 32
33namespace OpenSim.Region.ScriptEngine.Shared.Tests 33namespace OpenSim.Region.ScriptEngine.Shared.Tests
34{ 34{
35 /// <summary>
36 /// Tests for Vector3
37 /// </summary>
35 [TestFixture] 38 [TestFixture]
36 public class LSL_TypesTestVector3 39 public class LSL_TypesTestVector3
37 { 40 {
38 /// <summary>
39 /// Tests for Vector3
40 /// </summary>
41 [Test] 41 [Test]
42
43 public void TestDotProduct() 42 public void TestDotProduct()
44 { 43 {
44 TestHelpers.InMethod();
45
45 // The numbers we test for. 46 // The numbers we test for.
46 Dictionary<string, double> expectsSet = new Dictionary<string, double>(); 47 Dictionary<string, double> expectsSet = new Dictionary<string, double>();
47 expectsSet.Add("<1, 2, 3> * <2, 3, 4>", 20.0); 48 expectsSet.Add("<1, 2, 3> * <2, 3, 4>", 20.0);
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 02d47bd..db6a407 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -50,7 +50,10 @@ using OpenSim.Region.ScriptEngine.Shared;
50using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 50using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
51using OpenSim.Region.ScriptEngine.Shared.CodeTools; 51using OpenSim.Region.ScriptEngine.Shared.CodeTools;
52using OpenSim.Region.ScriptEngine.Shared.Instance; 52using OpenSim.Region.ScriptEngine.Shared.Instance;
53using OpenSim.Region.ScriptEngine.Shared.Api;
54using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
53using OpenSim.Region.ScriptEngine.Interfaces; 55using OpenSim.Region.ScriptEngine.Interfaces;
56using Timer = OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer;
54 57
55using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>; 58using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>;
56 59
@@ -342,22 +345,22 @@ namespace OpenSim.Region.ScriptEngine.XEngine
342 } 345 }
343 346
344 MainConsole.Instance.Commands.AddCommand( 347 MainConsole.Instance.Commands.AddCommand(
345 "scripts", false, "xengine status", "xengine status", "Show status information", 348 "Scripts", false, "xengine status", "xengine status", "Show status information",
346 "Show status information on the script engine.", 349 "Show status information on the script engine.",
347 HandleShowStatus); 350 HandleShowStatus);
348 351
349 MainConsole.Instance.Commands.AddCommand( 352 MainConsole.Instance.Commands.AddCommand(
350 "scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information", 353 "Scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information",
351 "Show information on all scripts known to the script engine." 354 "Show information on all scripts known to the script engine."
352 + "If a <script-item-uuid> is given then only information on that script will be shown.", 355 + "If a <script-item-uuid> is given then only information on that script will be shown.",
353 HandleShowScripts); 356 HandleShowScripts);
354 357
355 MainConsole.Instance.Commands.AddCommand( 358 MainConsole.Instance.Commands.AddCommand(
356 "scripts", false, "show scripts", "show scripts [<script-item-uuid>]", "Show script information", 359 "Scripts", false, "show scripts", "show scripts [<script-item-uuid>]", "Show script information",
357 "Synonym for scripts show command", HandleShowScripts); 360 "Synonym for scripts show command", HandleShowScripts);
358 361
359 MainConsole.Instance.Commands.AddCommand( 362 MainConsole.Instance.Commands.AddCommand(
360 "scripts", false, "scripts suspend", "scripts suspend [<script-item-uuid>]", "Suspends all running scripts", 363 "Scripts", false, "scripts suspend", "scripts suspend [<script-item-uuid>]", "Suspends all running scripts",
361 "Suspends all currently running scripts. This only suspends event delivery, it will not suspend a" 364 "Suspends all currently running scripts. This only suspends event delivery, it will not suspend a"
362 + " script that is currently processing an event.\n" 365 + " script that is currently processing an event.\n"
363 + "Suspended scripts will continue to accumulate events but won't process them.\n" 366 + "Suspended scripts will continue to accumulate events but won't process them.\n"
@@ -365,20 +368,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
365 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleSuspendScript)); 368 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleSuspendScript));
366 369
367 MainConsole.Instance.Commands.AddCommand( 370 MainConsole.Instance.Commands.AddCommand(
368 "scripts", false, "scripts resume", "scripts resume [<script-item-uuid>]", "Resumes all suspended scripts", 371 "Scripts", false, "scripts resume", "scripts resume [<script-item-uuid>]", "Resumes all suspended scripts",
369 "Resumes all currently suspended scripts.\n" 372 "Resumes all currently suspended scripts.\n"
370 + "Resumed scripts will process all events accumulated whilst suspended." 373 + "Resumed scripts will process all events accumulated whilst suspended."
371 + "If a <script-item-uuid> is given then only that script will be resumed. Otherwise, all suitable scripts are resumed.", 374 + "If a <script-item-uuid> is given then only that script will be resumed. Otherwise, all suitable scripts are resumed.",
372 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleResumeScript)); 375 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleResumeScript));
373 376
374 MainConsole.Instance.Commands.AddCommand( 377 MainConsole.Instance.Commands.AddCommand(
375 "scripts", false, "scripts stop", "scripts stop [<script-item-uuid>]", "Stops all running scripts", 378 "Scripts", false, "scripts stop", "scripts stop [<script-item-uuid>]", "Stops all running scripts",
376 "Stops all running scripts." 379 "Stops all running scripts."
377 + "If a <script-item-uuid> is given then only that script will be stopped. Otherwise, all suitable scripts are stopped.", 380 + "If a <script-item-uuid> is given then only that script will be stopped. Otherwise, all suitable scripts are stopped.",
378 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStopScript)); 381 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStopScript));
379 382
380 MainConsole.Instance.Commands.AddCommand( 383 MainConsole.Instance.Commands.AddCommand(
381 "scripts", false, "scripts start", "scripts start [<script-item-uuid>]", "Starts all stopped scripts", 384 "Scripts", false, "scripts start", "scripts start [<script-item-uuid>]", "Starts all stopped scripts",
382 "Starts all stopped scripts." 385 "Starts all stopped scripts."
383 + "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.", 386 + "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.",
384 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript)); 387 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript));
@@ -454,6 +457,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
454 sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); 457 sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks);
455// sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count); 458// sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count);
456 459
460 SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(this);
461 sb.AppendFormat("Sensors : {0}\n", sr.SensorsCount);
462
463 Dataserver ds = AsyncCommandManager.GetDataserverPlugin(this);
464 sb.AppendFormat("Dataserver requests : {0}\n", ds.DataserverRequestsCount);
465
466 Timer t = AsyncCommandManager.GetTimerPlugin(this);
467 sb.AppendFormat("Timers : {0}\n", t.TimersCount);
468
469 Listener l = AsyncCommandManager.GetListenerPlugin(this);
470 sb.AppendFormat("Listeners : {0}\n", l.ListenerCount);
471
457 MainConsole.Instance.OutputFormat(sb.ToString()); 472 MainConsole.Instance.OutputFormat(sb.ToString());
458 } 473 }
459 474
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index f627e37..b9ba4bc 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -83,6 +83,9 @@ namespace OpenSim.Region.UserStatistics
83 { 83 {
84 if (m_scenes.Count == 0) 84 if (m_scenes.Count == 0)
85 { 85 {
86 if (Util.IsWindows())
87 Util.LoadArchSpecificWindowsDll("sqlite3.dll");
88
86 //IConfig startupConfig = config.Configs["Startup"]; 89 //IConfig startupConfig = config.Configs["Startup"];
87 90
88 dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3"); 91 dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3");
@@ -221,13 +224,11 @@ namespace OpenSim.Region.UserStatistics
221 concurrencyCounter--; 224 concurrencyCounter--;
222 225
223 response_code = 200; 226 response_code = 200;
224
225 } 227 }
226 else 228 else
227 { 229 {
228 strOut = MainServer.Instance.GetHTTP404(""); 230 strOut = MainServer.Instance.GetHTTP404("");
229 } 231 }
230
231 232
232 responsedata["int_response_code"] = response_code; 233 responsedata["int_response_code"] = response_code;
233 responsedata["content_type"] = contenttype; 234 responsedata["content_type"] = contenttype;
@@ -244,43 +245,44 @@ namespace OpenSim.Region.UserStatistics
244 // TODO: FIXME: implement stats migrations 245 // TODO: FIXME: implement stats migrations
245 const string SQL = @"SELECT * FROM migrations LIMIT 1"; 246 const string SQL = @"SELECT * FROM migrations LIMIT 1";
246 247
247 SqliteCommand cmd = new SqliteCommand(SQL, db); 248 using (SqliteCommand cmd = new SqliteCommand(SQL, db))
248
249 try
250 {
251 cmd.ExecuteNonQuery();
252 }
253 catch (SqliteSyntaxException)
254 { 249 {
255 CreateTables(db); 250 try
251 {
252 cmd.ExecuteNonQuery();
253 }
254 catch (SqliteSyntaxException)
255 {
256 CreateTables(db);
257 }
256 } 258 }
257 } 259 }
258 } 260 }
259 261
260 public void CreateTables(SqliteConnection db) 262 public void CreateTables(SqliteConnection db)
261 { 263 {
262 SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db); 264 using (SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db))
263 createcmd.ExecuteNonQuery(); 265 {
266 createcmd.ExecuteNonQuery();
264 267
265 createcmd.CommandText = SQL_MIGRA_TABLE_CREATE; 268 createcmd.CommandText = SQL_MIGRA_TABLE_CREATE;
266 createcmd.ExecuteNonQuery(); 269 createcmd.ExecuteNonQuery();
270 }
267 } 271 }
268 272
269 public virtual void PostInitialise() 273 public virtual void PostInitialise()
270 { 274 {
271 if (!enabled) 275 if (!enabled)
272 {
273 return; 276 return;
274 } 277
275 AddHandlers(); 278 AddHandlers();
276 } 279 }
277 280
278 public virtual void Close() 281 public virtual void Close()
279 { 282 {
280 if (!enabled) 283 if (!enabled)
281 {
282 return; 284 return;
283 } 285
284 dbConn.Close(); 286 dbConn.Close();
285 dbConn.Dispose(); 287 dbConn.Dispose();
286 m_sessions.Clear(); 288 m_sessions.Clear();
@@ -301,7 +303,8 @@ namespace OpenSim.Region.UserStatistics
301 303
302 public void OnRegisterCaps(UUID agentID, Caps caps) 304 public void OnRegisterCaps(UUID agentID, Caps caps)
303 { 305 {
304 m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); 306// m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
307
305 string capsPath = "/CAPS/VS/" + UUID.Random(); 308 string capsPath = "/CAPS/VS/" + UUID.Random();
306 caps.RegisterHandler("ViewerStats", 309 caps.RegisterHandler("ViewerStats",
307 new RestStreamHandler("POST", capsPath, 310 new RestStreamHandler("POST", capsPath,
@@ -315,7 +318,6 @@ namespace OpenSim.Region.UserStatistics
315 318
316 public void OnDeRegisterCaps(UUID agentID, Caps caps) 319 public void OnDeRegisterCaps(UUID agentID, Caps caps)
317 { 320 {
318
319 } 321 }
320 322
321 protected virtual void AddHandlers() 323 protected virtual void AddHandlers()
@@ -365,7 +367,6 @@ namespace OpenSim.Region.UserStatistics
365 367
366 public void OnMakeChildAgent(ScenePresence agent) 368 public void OnMakeChildAgent(ScenePresence agent)
367 { 369 {
368
369 } 370 }
370 371
371 public void OnClientClosed(UUID agentID, Scene scene) 372 public void OnClientClosed(UUID agentID, Scene scene)
@@ -427,6 +428,7 @@ namespace OpenSim.Region.UserStatistics
427 return scene.RegionInfo.RegionID; 428 return scene.RegionInfo.RegionID;
428 } 429 }
429 } 430 }
431
430 return UUID.Zero; 432 return UUID.Zero;
431 } 433 }
432 434
@@ -455,14 +457,14 @@ namespace OpenSim.Region.UserStatistics
455 UserSessionData usd; 457 UserSessionData usd;
456 OSD message = OSDParser.DeserializeLLSDXml(request); 458 OSD message = OSDParser.DeserializeLLSDXml(request);
457 OSDMap mmap; 459 OSDMap mmap;
460
458 lock (m_sessions) 461 lock (m_sessions)
459 { 462 {
460 if (agentID != UUID.Zero) 463 if (agentID != UUID.Zero)
461 { 464 {
462
463 if (!m_sessions.ContainsKey(agentID)) 465 if (!m_sessions.ContainsKey(agentID))
464 { 466 {
465 m_log.Warn("[WEB STATS MODULE]: no session for stat disclosure"); 467 m_log.WarnFormat("[WEB STATS MODULE]: no session for stat disclosure for agent {0}", agentID);
466 return new UserSessionID(); 468 return new UserSessionID();
467 } 469 }
468 uid = m_sessions[agentID]; 470 uid = m_sessions[agentID];
@@ -582,8 +584,6 @@ namespace OpenSim.Region.UserStatistics
582 usd.n_out_kb = (float)net_out["kbytes"].AsReal(); 584 usd.n_out_kb = (float)net_out["kbytes"].AsReal();
583 usd.n_out_pk = net_out["packets"].AsInteger(); 585 usd.n_out_pk = net_out["packets"].AsInteger();
584 } 586 }
585
586
587 } 587 }
588 } 588 }
589 589
@@ -599,83 +599,85 @@ namespace OpenSim.Region.UserStatistics
599 599
600 lock (db) 600 lock (db)
601 { 601 {
602 SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db); 602 using (SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db))
603 updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString()));
604 updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString()));
605 updatecmd.Parameters.Add(new SqliteParameter(":region_id", uid.session_data.region_id.ToString()));
606 updatecmd.Parameters.Add(new SqliteParameter(":last_updated", (int) uid.session_data.last_updated));
607 updatecmd.Parameters.Add(new SqliteParameter(":remote_ip", uid.session_data.remote_ip));
608 updatecmd.Parameters.Add(new SqliteParameter(":name_f", uid.session_data.name_f));
609 updatecmd.Parameters.Add(new SqliteParameter(":name_l", uid.session_data.name_l));
610 updatecmd.Parameters.Add(new SqliteParameter(":avg_agents_in_view", uid.session_data.avg_agents_in_view));
611 updatecmd.Parameters.Add(new SqliteParameter(":min_agents_in_view",
612 (int) uid.session_data.min_agents_in_view));
613 updatecmd.Parameters.Add(new SqliteParameter(":max_agents_in_view",
614 (int) uid.session_data.max_agents_in_view));
615 updatecmd.Parameters.Add(new SqliteParameter(":mode_agents_in_view",
616 (int) uid.session_data.mode_agents_in_view));
617 updatecmd.Parameters.Add(new SqliteParameter(":avg_fps", uid.session_data.avg_fps));
618 updatecmd.Parameters.Add(new SqliteParameter(":min_fps", uid.session_data.min_fps));
619 updatecmd.Parameters.Add(new SqliteParameter(":max_fps", uid.session_data.max_fps));
620 updatecmd.Parameters.Add(new SqliteParameter(":mode_fps", uid.session_data.mode_fps));
621 updatecmd.Parameters.Add(new SqliteParameter(":a_language", uid.session_data.a_language));
622 updatecmd.Parameters.Add(new SqliteParameter(":mem_use", uid.session_data.mem_use));
623 updatecmd.Parameters.Add(new SqliteParameter(":meters_traveled", uid.session_data.meters_traveled));
624 updatecmd.Parameters.Add(new SqliteParameter(":avg_ping", uid.session_data.avg_ping));
625 updatecmd.Parameters.Add(new SqliteParameter(":min_ping", uid.session_data.min_ping));
626 updatecmd.Parameters.Add(new SqliteParameter(":max_ping", uid.session_data.max_ping));
627 updatecmd.Parameters.Add(new SqliteParameter(":mode_ping", uid.session_data.mode_ping));
628 updatecmd.Parameters.Add(new SqliteParameter(":regions_visited", uid.session_data.regions_visited));
629 updatecmd.Parameters.Add(new SqliteParameter(":run_time", uid.session_data.run_time));
630 updatecmd.Parameters.Add(new SqliteParameter(":avg_sim_fps", uid.session_data.avg_sim_fps));
631 updatecmd.Parameters.Add(new SqliteParameter(":min_sim_fps", uid.session_data.min_sim_fps));
632 updatecmd.Parameters.Add(new SqliteParameter(":max_sim_fps", uid.session_data.max_sim_fps));
633 updatecmd.Parameters.Add(new SqliteParameter(":mode_sim_fps", uid.session_data.mode_sim_fps));
634 updatecmd.Parameters.Add(new SqliteParameter(":start_time", uid.session_data.start_time));
635 updatecmd.Parameters.Add(new SqliteParameter(":client_version", uid.session_data.client_version));
636 updatecmd.Parameters.Add(new SqliteParameter(":s_cpu", uid.session_data.s_cpu));
637 updatecmd.Parameters.Add(new SqliteParameter(":s_gpu", uid.session_data.s_gpu));
638 updatecmd.Parameters.Add(new SqliteParameter(":s_os", uid.session_data.s_os));
639 updatecmd.Parameters.Add(new SqliteParameter(":s_ram", uid.session_data.s_ram));
640 updatecmd.Parameters.Add(new SqliteParameter(":d_object_kb", uid.session_data.d_object_kb));
641 updatecmd.Parameters.Add(new SqliteParameter(":d_texture_kb", uid.session_data.d_texture_kb));
642 updatecmd.Parameters.Add(new SqliteParameter(":d_world_kb", uid.session_data.d_world_kb));
643 updatecmd.Parameters.Add(new SqliteParameter(":n_in_kb", uid.session_data.n_in_kb));
644 updatecmd.Parameters.Add(new SqliteParameter(":n_in_pk", uid.session_data.n_in_pk));
645 updatecmd.Parameters.Add(new SqliteParameter(":n_out_kb", uid.session_data.n_out_kb));
646 updatecmd.Parameters.Add(new SqliteParameter(":n_out_pk", uid.session_data.n_out_pk));
647 updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped));
648 updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends));
649 updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid));
650
651 updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit));
652 updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent));
653 updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet));
654
655 updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString()));
656 updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString()));
657 updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString()));
658// m_log.Debug("UPDATE");
659
660 int result = updatecmd.ExecuteNonQuery();
661
662 if (result == 0)
663 { 603 {
664// m_log.Debug("INSERT"); 604 updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString()));
665 updatecmd.CommandText = SQL_STATS_TABLE_INSERT; 605 updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString()));
666 try 606 updatecmd.Parameters.Add(new SqliteParameter(":region_id", uid.session_data.region_id.ToString()));
667 { 607 updatecmd.Parameters.Add(new SqliteParameter(":last_updated", (int) uid.session_data.last_updated));
668 updatecmd.ExecuteNonQuery(); 608 updatecmd.Parameters.Add(new SqliteParameter(":remote_ip", uid.session_data.remote_ip));
669 } 609 updatecmd.Parameters.Add(new SqliteParameter(":name_f", uid.session_data.name_f));
670 catch (SqliteExecutionException) 610 updatecmd.Parameters.Add(new SqliteParameter(":name_l", uid.session_data.name_l));
611 updatecmd.Parameters.Add(new SqliteParameter(":avg_agents_in_view", uid.session_data.avg_agents_in_view));
612 updatecmd.Parameters.Add(new SqliteParameter(":min_agents_in_view",
613 (int) uid.session_data.min_agents_in_view));
614 updatecmd.Parameters.Add(new SqliteParameter(":max_agents_in_view",
615 (int) uid.session_data.max_agents_in_view));
616 updatecmd.Parameters.Add(new SqliteParameter(":mode_agents_in_view",
617 (int) uid.session_data.mode_agents_in_view));
618 updatecmd.Parameters.Add(new SqliteParameter(":avg_fps", uid.session_data.avg_fps));
619 updatecmd.Parameters.Add(new SqliteParameter(":min_fps", uid.session_data.min_fps));
620 updatecmd.Parameters.Add(new SqliteParameter(":max_fps", uid.session_data.max_fps));
621 updatecmd.Parameters.Add(new SqliteParameter(":mode_fps", uid.session_data.mode_fps));
622 updatecmd.Parameters.Add(new SqliteParameter(":a_language", uid.session_data.a_language));
623 updatecmd.Parameters.Add(new SqliteParameter(":mem_use", uid.session_data.mem_use));
624 updatecmd.Parameters.Add(new SqliteParameter(":meters_traveled", uid.session_data.meters_traveled));
625 updatecmd.Parameters.Add(new SqliteParameter(":avg_ping", uid.session_data.avg_ping));
626 updatecmd.Parameters.Add(new SqliteParameter(":min_ping", uid.session_data.min_ping));
627 updatecmd.Parameters.Add(new SqliteParameter(":max_ping", uid.session_data.max_ping));
628 updatecmd.Parameters.Add(new SqliteParameter(":mode_ping", uid.session_data.mode_ping));
629 updatecmd.Parameters.Add(new SqliteParameter(":regions_visited", uid.session_data.regions_visited));
630 updatecmd.Parameters.Add(new SqliteParameter(":run_time", uid.session_data.run_time));
631 updatecmd.Parameters.Add(new SqliteParameter(":avg_sim_fps", uid.session_data.avg_sim_fps));
632 updatecmd.Parameters.Add(new SqliteParameter(":min_sim_fps", uid.session_data.min_sim_fps));
633 updatecmd.Parameters.Add(new SqliteParameter(":max_sim_fps", uid.session_data.max_sim_fps));
634 updatecmd.Parameters.Add(new SqliteParameter(":mode_sim_fps", uid.session_data.mode_sim_fps));
635 updatecmd.Parameters.Add(new SqliteParameter(":start_time", uid.session_data.start_time));
636 updatecmd.Parameters.Add(new SqliteParameter(":client_version", uid.session_data.client_version));
637 updatecmd.Parameters.Add(new SqliteParameter(":s_cpu", uid.session_data.s_cpu));
638 updatecmd.Parameters.Add(new SqliteParameter(":s_gpu", uid.session_data.s_gpu));
639 updatecmd.Parameters.Add(new SqliteParameter(":s_os", uid.session_data.s_os));
640 updatecmd.Parameters.Add(new SqliteParameter(":s_ram", uid.session_data.s_ram));
641 updatecmd.Parameters.Add(new SqliteParameter(":d_object_kb", uid.session_data.d_object_kb));
642 updatecmd.Parameters.Add(new SqliteParameter(":d_texture_kb", uid.session_data.d_texture_kb));
643 updatecmd.Parameters.Add(new SqliteParameter(":d_world_kb", uid.session_data.d_world_kb));
644 updatecmd.Parameters.Add(new SqliteParameter(":n_in_kb", uid.session_data.n_in_kb));
645 updatecmd.Parameters.Add(new SqliteParameter(":n_in_pk", uid.session_data.n_in_pk));
646 updatecmd.Parameters.Add(new SqliteParameter(":n_out_kb", uid.session_data.n_out_kb));
647 updatecmd.Parameters.Add(new SqliteParameter(":n_out_pk", uid.session_data.n_out_pk));
648 updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped));
649 updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends));
650 updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid));
651
652 updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit));
653 updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent));
654 updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet));
655
656 updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString()));
657 updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString()));
658 updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString()));
659
660// m_log.DebugFormat("[WEB STATS MODULE]: Database stats update for {0}", uid.session_data.agent_id);
661
662 int result = updatecmd.ExecuteNonQuery();
663
664 if (result == 0)
671 { 665 {
672 m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage Execution Exception"); 666// m_log.DebugFormat("[WEB STATS MODULE]: Database stats insert for {0}", uid.session_data.agent_id);
673 } 667
674 catch (SqliteSyntaxException) 668 updatecmd.CommandText = SQL_STATS_TABLE_INSERT;
675 {
676 m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage SQL Syntax Exception");
677 }
678 669
670 try
671 {
672 updatecmd.ExecuteNonQuery();
673 }
674 catch (Exception e)
675 {
676 m_log.WarnFormat(
677 "[WEB STATS MODULE]: failed to write stats for {0}, storage Execution Exception {1}{2}",
678 uid.session_data.agent_id, e.Message, e.StackTrace);
679 }
680 }
679 } 681 }
680 } 682 }
681 } 683 }
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs
index a6f4e47..36c48e6 100644
--- a/OpenSim/Server/Base/ServicesServerBase.cs
+++ b/OpenSim/Server/Base/ServicesServerBase.cs
@@ -236,16 +236,16 @@ namespace OpenSim.Server.Base
236 236
237 // Register the quit command 237 // Register the quit command
238 // 238 //
239 MainConsole.Instance.Commands.AddCommand("base", false, "quit", 239 MainConsole.Instance.Commands.AddCommand("General", false, "quit",
240 "quit", 240 "quit",
241 "Quit the application", HandleQuit); 241 "Quit the application", HandleQuit);
242 242
243 MainConsole.Instance.Commands.AddCommand("base", false, "shutdown", 243 MainConsole.Instance.Commands.AddCommand("General", false, "shutdown",
244 "shutdown", 244 "shutdown",
245 "Quit the application", HandleQuit); 245 "Quit the application", HandleQuit);
246 246
247 // Register a command to read other commands from a file 247 // Register a command to read other commands from a file
248 MainConsole.Instance.Commands.AddCommand("base", false, "command-script", 248 MainConsole.Instance.Commands.AddCommand("General", false, "command-script",
249 "command-script <script>", 249 "command-script <script>",
250 "Run a command script from file", HandleScript); 250 "Run a command script from file", HandleScript);
251 251
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
index 9b80245..8b9e749 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
@@ -72,19 +72,19 @@ namespace OpenSim.Server.Handlers.Asset
72 server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); 72 server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
73 server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete)); 73 server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete));
74 74
75 MainConsole.Instance.Commands.AddCommand("kfs", false, 75 MainConsole.Instance.Commands.AddCommand("Assets", false,
76 "show asset", 76 "show asset",
77 "show asset <ID>", 77 "show asset <ID>",
78 "Show asset information", 78 "Show asset information",
79 HandleShowAsset); 79 HandleShowAsset);
80 80
81 MainConsole.Instance.Commands.AddCommand("kfs", false, 81 MainConsole.Instance.Commands.AddCommand("Assets", false,
82 "delete asset", 82 "delete asset",
83 "delete asset <ID>", 83 "delete asset <ID>",
84 "Delete asset from database", 84 "Delete asset from database",
85 HandleDeleteAsset); 85 HandleDeleteAsset);
86 86
87 MainConsole.Instance.Commands.AddCommand("kfs", false, 87 MainConsole.Instance.Commands.AddCommand("Assets", false,
88 "dump asset", 88 "dump asset",
89 "dump asset <ID>", 89 "dump asset <ID>",
90 "Dump asset to a file", 90 "Dump asset to a file",
diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
index 440b898..dfed761 100644
--- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
@@ -248,7 +248,7 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
248 if (passwordValues != null && passwordValues.Length == 1) 248 if (passwordValues != null && passwordValues.Length == 1)
249 { 249 {
250 if (account != null && 250 if (account != null &&
251 (m_authenticationService.Authenticate(account.PrincipalID, passwordValues[0], 30) != string.Empty)) 251 (m_authenticationService.Authenticate(account.PrincipalID,Util.Md5Hash(passwordValues[0]), 30) != string.Empty))
252 authRequest.IsAuthenticated = true; 252 authRequest.IsAuthenticated = true;
253 else 253 else
254 authRequest.IsAuthenticated = false; 254 authRequest.IsAuthenticated = false;
diff --git a/OpenSim/Services/AssetService/XAssetService.cs b/OpenSim/Services/AssetService/XAssetService.cs
new file mode 100644
index 0000000..d161c58
--- /dev/null
+++ b/OpenSim/Services/AssetService/XAssetService.cs
@@ -0,0 +1,213 @@
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.Reflection;
32using Nini.Config;
33using log4net;
34using OpenSim.Framework;
35using OpenSim.Data;
36using OpenSim.Services.Interfaces;
37using OpenMetaverse;
38
39namespace OpenSim.Services.AssetService
40{
41 /// <summary>
42 /// This will be developed into a de-duplicating asset service.
43 /// XXX: Currently it's a just a copy of the existing AssetService. so please don't attempt to use it.
44 /// </summary>
45 public class XAssetService : AssetServiceBase, IAssetService
46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
49 protected static XAssetService m_RootInstance;
50
51 public XAssetService(IConfigSource config) : base(config)
52 {
53 if (m_RootInstance == null)
54 {
55 m_RootInstance = this;
56
57 if (m_AssetLoader != null)
58 {
59 IConfig assetConfig = config.Configs["AssetService"];
60 if (assetConfig == null)
61 throw new Exception("No AssetService configuration");
62
63 string loaderArgs = assetConfig.GetString("AssetLoaderArgs",
64 String.Empty);
65
66 bool assetLoaderEnabled = assetConfig.GetBoolean("AssetLoaderEnabled", true);
67
68 if (assetLoaderEnabled)
69 {
70 m_log.DebugFormat("[XASSET SERVICE]: Loading default asset set from {0}", loaderArgs);
71
72 m_AssetLoader.ForEachDefaultXmlAsset(
73 loaderArgs,
74 delegate(AssetBase a)
75 {
76 AssetBase existingAsset = Get(a.ID);
77// AssetMetadata existingMetadata = GetMetadata(a.ID);
78
79 if (existingAsset == null || Util.SHA1Hash(existingAsset.Data) != Util.SHA1Hash(a.Data))
80 {
81// m_log.DebugFormat("[ASSET]: Storing {0} {1}", a.Name, a.ID);
82 Store(a);
83 }
84 });
85 }
86
87 m_log.Debug("[XASSET SERVICE]: Local asset service enabled");
88 }
89 }
90 }
91
92 public virtual AssetBase Get(string id)
93 {
94// m_log.DebugFormat("[ASSET SERVICE]: Get asset for {0}", id);
95
96 UUID assetID;
97
98 if (!UUID.TryParse(id, out assetID))
99 {
100 m_log.WarnFormat("[XASSET SERVICE]: Could not parse requested asset id {0}", id);
101 return null;
102 }
103
104 try
105 {
106 return m_Database.GetAsset(assetID);
107 }
108 catch (Exception e)
109 {
110 m_log.ErrorFormat("[XASSET SERVICE]: Exception getting asset {0} {1}", assetID, e);
111 return null;
112 }
113 }
114
115 public virtual AssetBase GetCached(string id)
116 {
117 return Get(id);
118 }
119
120 public virtual AssetMetadata GetMetadata(string id)
121 {
122// m_log.DebugFormat("[XASSET SERVICE]: Get asset metadata for {0}", id);
123
124 UUID assetID;
125
126 if (!UUID.TryParse(id, out assetID))
127 return null;
128
129 AssetBase asset = m_Database.GetAsset(assetID);
130 if (asset != null)
131 return asset.Metadata;
132
133 return null;
134 }
135
136 public virtual byte[] GetData(string id)
137 {
138// m_log.DebugFormat("[XASSET SERVICE]: Get asset data for {0}", id);
139
140 UUID assetID;
141
142 if (!UUID.TryParse(id, out assetID))
143 return null;
144
145 AssetBase asset = m_Database.GetAsset(assetID);
146 return asset.Data;
147 }
148
149 public virtual bool Get(string id, Object sender, AssetRetrieved handler)
150 {
151 //m_log.DebugFormat("[XASSET SERVICE]: Get asset async {0}", id);
152
153 UUID assetID;
154
155 if (!UUID.TryParse(id, out assetID))
156 return false;
157
158 AssetBase asset = m_Database.GetAsset(assetID);
159
160 //m_log.DebugFormat("[XASSET SERVICE]: Got asset {0}", asset);
161
162 handler(id, sender, asset);
163
164 return true;
165 }
166
167 public virtual string Store(AssetBase asset)
168 {
169 if (!m_Database.ExistsAsset(asset.FullID))
170 {
171// m_log.DebugFormat(
172// "[XASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length);
173 m_Database.StoreAsset(asset);
174 }
175// else
176// {
177// m_log.DebugFormat(
178// "[XASSET SERVICE]: Not storing asset {0} {1}, bytes {2} as it already exists", asset.Name, asset.FullID, asset.Data.Length);
179// }
180
181 return asset.ID;
182 }
183
184 public bool UpdateContent(string id, byte[] data)
185 {
186 return false;
187 }
188
189 public virtual bool Delete(string id)
190 {
191 m_log.DebugFormat("[XASSET SERVICE]: Deleting asset {0}", id);
192 UUID assetID;
193 if (!UUID.TryParse(id, out assetID))
194 return false;
195
196 AssetBase asset = m_Database.GetAsset(assetID);
197 if (asset == null)
198 return false;
199
200 if ((int)(asset.Flags & AssetFlags.Maptile) != 0)
201 {
202 return m_Database.Delete(id);
203 }
204 else
205 {
206 m_log.DebugFormat("[XASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id);
207 }
208
209 return false;
210 }
211 }
212}
213
diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
index bb5d51f..c395178 100644
--- a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
@@ -45,6 +45,24 @@ namespace OpenSim.Services.Connectors
45 LogManager.GetLogger( 45 LogManager.GetLogger(
46 MethodBase.GetCurrentMethod().DeclaringType); 46 MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 private Dictionary<IAssetService, object> m_endpointSerializer = new Dictionary<IAssetService, object>();
49 private object EndPointLock(IAssetService connector)
50 {
51 lock (m_endpointSerializer)
52 {
53 object eplock = null;
54
55 if (! m_endpointSerializer.TryGetValue(connector, out eplock))
56 {
57 eplock = new object();
58 m_endpointSerializer.Add(connector, eplock);
59 // m_log.WarnFormat("[WEB UTIL] add a new host to end point serializer {0}",endpoint);
60 }
61
62 return eplock;
63 }
64 }
65
48 private Dictionary<string, IAssetService> m_connectors = new Dictionary<string, IAssetService>(); 66 private Dictionary<string, IAssetService> m_connectors = new Dictionary<string, IAssetService>();
49 67
50 public HGAssetServiceConnector(IConfigSource source) 68 public HGAssetServiceConnector(IConfigSource source)
@@ -197,7 +215,8 @@ namespace OpenSim.Services.Connectors
197 IAssetService connector = GetConnector(url); 215 IAssetService connector = GetConnector(url);
198 // Restore the assetID to a simple UUID 216 // Restore the assetID to a simple UUID
199 asset.ID = assetID; 217 asset.ID = assetID;
200 return connector.Store(asset); 218 lock (EndPointLock(connector))
219 return connector.Store(asset);
201 } 220 }
202 221
203 return String.Empty; 222 return String.Empty;
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 89f0716..3dc87bc 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -84,14 +84,14 @@ namespace OpenSim.Services.GridService
84 84
85 if (MainConsole.Instance != null) 85 if (MainConsole.Instance != null)
86 { 86 {
87 MainConsole.Instance.Commands.AddCommand("grid", true, 87 MainConsole.Instance.Commands.AddCommand("Regions", true,
88 "show region", 88 "show region",
89 "show region <Region name>", 89 "show region <Region name>",
90 "Show details on a region", 90 "Show details on a region",
91 String.Empty, 91 String.Empty,
92 HandleShowRegion); 92 HandleShowRegion);
93 93
94 MainConsole.Instance.Commands.AddCommand("grid", true, 94 MainConsole.Instance.Commands.AddCommand("Regions", true,
95 "set region flags", 95 "set region flags",
96 "set region flags <Region name> <flags>", 96 "set region flags <Region name> <flags>",
97 "Set database flags for region", 97 "Set database flags for region",
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index 0a59f86..4e38687 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -296,9 +296,10 @@ namespace OpenSim.Services.HypergridService
296 aCircuit.firstname = account.FirstName; 296 aCircuit.firstname = account.FirstName;
297 aCircuit.lastname = account.LastName; 297 aCircuit.lastname = account.LastName;
298 } 298 }
299 if (account == null && !aCircuit.lastname.StartsWith("@")) 299 if (account == null)
300 { 300 {
301 aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname; 301 if (!aCircuit.lastname.StartsWith("@"))
302 aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname;
302 try 303 try
303 { 304 {
304 Uri uri = new Uri(aCircuit.ServiceURLs["HomeURI"].ToString()); 305 Uri uri = new Uri(aCircuit.ServiceURLs["HomeURI"].ToString());
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index de05f28..079bcb1 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -173,6 +173,12 @@ namespace OpenSim.Services.LLLoginService
173 // Web map 173 // Web map
174 private string mapTileURL; 174 private string mapTileURL;
175 175
176 // Web Profiles
177 private string profileURL;
178
179 // OpenID
180 private string openIDURL;
181
176 private string searchURL; 182 private string searchURL;
177 183
178 // Error Flags 184 // Error Flags
@@ -225,7 +231,7 @@ namespace OpenSim.Services.LLLoginService
225 public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, 231 public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo,
226 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, 232 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
227 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, 233 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message,
228 GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL, string currency) 234 GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency)
229 : this() 235 : this()
230 { 236 {
231 FillOutInventoryData(invSkel, libService); 237 FillOutInventoryData(invSkel, libService);
@@ -242,6 +248,9 @@ namespace OpenSim.Services.LLLoginService
242 BuddList = ConvertFriendListItem(friendsList); 248 BuddList = ConvertFriendListItem(friendsList);
243 StartLocation = where; 249 StartLocation = where;
244 MapTileURL = mapTileURL; 250 MapTileURL = mapTileURL;
251 ProfileURL = profileURL;
252 OpenIDURL = openIDURL;
253
245 SearchURL = searchURL; 254 SearchURL = searchURL;
246 Currency = currency; 255 Currency = currency;
247 256
@@ -390,6 +399,8 @@ namespace OpenSim.Services.LLLoginService
390 InitialOutfitHash["gender"] = "female"; 399 InitialOutfitHash["gender"] = "female";
391 initialOutfit.Add(InitialOutfitHash); 400 initialOutfit.Add(InitialOutfitHash);
392 mapTileURL = String.Empty; 401 mapTileURL = String.Empty;
402 profileURL = String.Empty;
403 openIDURL = String.Empty;
393 searchURL = String.Empty; 404 searchURL = String.Empty;
394 405
395 currency = String.Empty; 406 currency = String.Empty;
@@ -462,6 +473,13 @@ namespace OpenSim.Services.LLLoginService
462 if (mapTileURL != String.Empty) 473 if (mapTileURL != String.Empty)
463 responseData["map-server-url"] = mapTileURL; 474 responseData["map-server-url"] = mapTileURL;
464 475
476 if (profileURL != String.Empty)
477 responseData["profile-server-url"] = profileURL;
478
479 // We need to send an openid_token back in the response too
480 if (openIDURL != String.Empty)
481 responseData["openid_url"] = openIDURL;
482
465 if (m_buddyList != null) 483 if (m_buddyList != null)
466 { 484 {
467 responseData["buddy-list"] = m_buddyList.ToArray(); 485 responseData["buddy-list"] = m_buddyList.ToArray();
@@ -567,6 +585,12 @@ namespace OpenSim.Services.LLLoginService
567 if (mapTileURL != String.Empty) 585 if (mapTileURL != String.Empty)
568 map["map-server-url"] = OSD.FromString(mapTileURL); 586 map["map-server-url"] = OSD.FromString(mapTileURL);
569 587
588 if (profileURL != String.Empty)
589 map["profile-server-url"] = OSD.FromString(profileURL);
590
591 if (openIDURL != String.Empty)
592 map["openid_url"] = OSD.FromString(openIDURL);
593
570 if (searchURL != String.Empty) 594 if (searchURL != String.Empty)
571 map["search"] = OSD.FromString(searchURL); 595 map["search"] = OSD.FromString(searchURL);
572 596
@@ -939,6 +963,18 @@ namespace OpenSim.Services.LLLoginService
939 set { mapTileURL = value; } 963 set { mapTileURL = value; }
940 } 964 }
941 965
966 public string ProfileURL
967 {
968 get { return profileURL; }
969 set { profileURL = value; }
970 }
971
972 public string OpenIDURL
973 {
974 get { return openIDURL; }
975 set { openIDURL = value; }
976 }
977
942 public string SearchURL 978 public string SearchURL
943 { 979 {
944 get { return searchURL; } 980 get { return searchURL; }
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 6a9b8c6..891c452 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -74,6 +74,8 @@ namespace OpenSim.Services.LLLoginService
74 protected string m_GatekeeperURL; 74 protected string m_GatekeeperURL;
75 protected bool m_AllowRemoteSetLoginLevel; 75 protected bool m_AllowRemoteSetLoginLevel;
76 protected string m_MapTileURL; 76 protected string m_MapTileURL;
77 protected string m_ProfileURL;
78 protected string m_OpenIDURL;
77 protected string m_SearchURL; 79 protected string m_SearchURL;
78 protected string m_Currency; 80 protected string m_Currency;
79 81
@@ -108,6 +110,8 @@ namespace OpenSim.Services.LLLoginService
108 m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0); 110 m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
109 m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); 111 m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
110 m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); 112 m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
113 m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty);
114 m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty);
111 m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); 115 m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty);
112 m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); 116 m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty);
113 117
@@ -420,7 +424,7 @@ namespace OpenSim.Services.LLLoginService
420 // Finally, fill out the response and return it 424 // Finally, fill out the response and return it
421 // 425 //
422 LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, 426 LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
423 where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_SearchURL, m_Currency); 427 where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency);
424 428
425 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); 429 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client.");
426 return response; 430 return response;
@@ -896,16 +900,16 @@ namespace OpenSim.Services.LLLoginService
896 private void RegisterCommands() 900 private void RegisterCommands()
897 { 901 {
898 //MainConsole.Instance.Commands.AddCommand 902 //MainConsole.Instance.Commands.AddCommand
899 MainConsole.Instance.Commands.AddCommand("loginservice", false, "login level", 903 MainConsole.Instance.Commands.AddCommand("Users", false, "login level",
900 "login level <level>", 904 "login level <level>",
901 "Set the minimum user level to log in", HandleLoginCommand); 905 "Set the minimum user level to log in", HandleLoginCommand);
902 906
903 MainConsole.Instance.Commands.AddCommand("loginservice", false, "login reset", 907 MainConsole.Instance.Commands.AddCommand("Users", false, "login reset",
904 "login reset", 908 "login reset",
905 "Reset the login level to allow all users", 909 "Reset the login level to allow all users",
906 HandleLoginCommand); 910 HandleLoginCommand);
907 911
908 MainConsole.Instance.Commands.AddCommand("loginservice", false, "login text", 912 MainConsole.Instance.Commands.AddCommand("Users", false, "login text",
909 "login text <text>", 913 "login text <text>",
910 "Set the text users will see on login", HandleLoginCommand); 914 "Set the text users will see on login", HandleLoginCommand);
911 915
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index ad06300..9d0aeef 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -89,17 +89,17 @@ namespace OpenSim.Services.UserAccountService
89 if (m_RootInstance == null && MainConsole.Instance != null) 89 if (m_RootInstance == null && MainConsole.Instance != null)
90 { 90 {
91 m_RootInstance = this; 91 m_RootInstance = this;
92 MainConsole.Instance.Commands.AddCommand("UserService", false, 92 MainConsole.Instance.Commands.AddCommand("Users", false,
93 "create user", 93 "create user",
94 "create user [<first> [<last> [<pass> [<email> [<user id>]]]]]", 94 "create user [<first> [<last> [<pass> [<email> [<user id>]]]]]",
95 "Create a new user", HandleCreateUser); 95 "Create a new user", HandleCreateUser);
96 96
97 MainConsole.Instance.Commands.AddCommand("UserService", false, 97 MainConsole.Instance.Commands.AddCommand("Users", false,
98 "reset user password", 98 "reset user password",
99 "reset user password [<first> [<last> [<password>]]]", 99 "reset user password [<first> [<last> [<password>]]]",
100 "Reset a user password", HandleResetUserPassword); 100 "Reset a user password", HandleResetUserPassword);
101 101
102 MainConsole.Instance.Commands.AddCommand("UserService", false, 102 MainConsole.Instance.Commands.AddCommand("Users", false,
103 "set user level", 103 "set user level",
104 "set user level [<first> [<last> [<level>]]]", 104 "set user level [<first> [<last> [<level>]]]",
105 "Set user level. If >= 200 and 'allow_grid_gods = true' in OpenSim.ini, " 105 "Set user level. If >= 200 and 'allow_grid_gods = true' in OpenSim.ini, "
@@ -107,7 +107,7 @@ namespace OpenSim.Services.UserAccountService
107 + "It will also affect the 'login level' command. ", 107 + "It will also affect the 'login level' command. ",
108 HandleSetUserLevel); 108 HandleSetUserLevel);
109 109
110 MainConsole.Instance.Commands.AddCommand("UserService", false, 110 MainConsole.Instance.Commands.AddCommand("Users", false,
111 "show account", 111 "show account",
112 "show account <first> <last>", 112 "show account <first> <last>",
113 "Show account details for the given user", HandleShowAccount); 113 "Show account details for the given user", HandleShowAccount);
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index aa904aa..7bf08ae 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -113,7 +113,7 @@ namespace OpenSim.Tests.Common
113 Console.WriteLine("Setting up test scene {0}", name); 113 Console.WriteLine("Setting up test scene {0}", name);
114 114
115 // We must set up a console otherwise setup of some modules may fail 115 // We must set up a console otherwise setup of some modules may fail
116 MainConsole.Instance = new MockConsole("TEST PROMPT"); 116 MainConsole.Instance = new MockConsole();
117 117
118 RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); 118 RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");
119 regInfo.RegionName = name; 119 regInfo.RegionName = name;
@@ -136,7 +136,7 @@ namespace OpenSim.Tests.Common
136 StartAuthenticationService(testScene); 136 StartAuthenticationService(testScene);
137 LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); 137 LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene);
138 StartGridService(testScene); 138 StartGridService(testScene);
139 LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); 139 LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene);
140 LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); 140 LocalPresenceServicesConnector presenceService = StartPresenceService(testScene);
141 141
142 inventoryService.PostInitialise(); 142 inventoryService.PostInitialise();
diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
index 79bb9c2..295e868 100644
--- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
@@ -177,9 +177,9 @@ namespace OpenSim.Data.Null
177 // Therefore, we need to store parts rather than groups. 177 // Therefore, we need to store parts rather than groups.
178 foreach (SceneObjectPart prim in obj.Parts) 178 foreach (SceneObjectPart prim in obj.Parts)
179 { 179 {
180 m_log.DebugFormat( 180// m_log.DebugFormat(
181 "[MOCK REGION DATA PLUGIN]: Storing part {0} {1} in object {2} {3} in region {4}", 181// "[MOCK REGION DATA PLUGIN]: Storing part {0} {1} in object {2} {3} in region {4}",
182 prim.Name, prim.UUID, obj.Name, obj.UUID, regionUUID); 182// prim.Name, prim.UUID, obj.Name, obj.UUID, regionUUID);
183 183
184 m_sceneObjectParts[prim.UUID] = prim; 184 m_sceneObjectParts[prim.UUID] = prim;
185 } 185 }
@@ -193,9 +193,9 @@ namespace OpenSim.Data.Null
193 { 193 {
194 if (part.ParentGroup.UUID == obj) 194 if (part.ParentGroup.UUID == obj)
195 { 195 {
196 m_log.DebugFormat( 196// m_log.DebugFormat(
197 "[MOCK REGION DATA PLUGIN]: Removing part {0} {1} as part of object {2} from {3}", 197// "[MOCK REGION DATA PLUGIN]: Removing part {0} {1} as part of object {2} from {3}",
198 part.Name, part.UUID, obj, regionUUID); 198// part.Name, part.UUID, obj, regionUUID);
199 m_sceneObjectParts.Remove(part.UUID); 199 m_sceneObjectParts.Remove(part.UUID);
200 } 200 }
201 } 201 }
@@ -215,8 +215,8 @@ namespace OpenSim.Data.Null
215 { 215 {
216 if (prim.IsRoot) 216 if (prim.IsRoot)
217 { 217 {
218 m_log.DebugFormat( 218// m_log.DebugFormat(
219 "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID); 219// "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID);
220 objects[prim.UUID] = new SceneObjectGroup(prim); 220 objects[prim.UUID] = new SceneObjectGroup(prim);
221 } 221 }
222 } 222 }
@@ -240,9 +240,9 @@ namespace OpenSim.Data.Null
240 } 240 }
241 else 241 else
242 { 242 {
243 m_log.WarnFormat( 243// m_log.WarnFormat(
244 "[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.", 244// "[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.",
245 prim.Name, prim.UUID, regionUUID, prim.ParentUUID); 245// prim.Name, prim.UUID, regionUUID, prim.ParentUUID);
246 } 246 }
247 } 247 }
248 } 248 }
diff --git a/OpenSim/Tests/Torture/NPCTortureTests.cs b/OpenSim/Tests/Torture/NPCTortureTests.cs
index 8078d9d..0224505 100644
--- a/OpenSim/Tests/Torture/NPCTortureTests.cs
+++ b/OpenSim/Tests/Torture/NPCTortureTests.cs
@@ -75,6 +75,11 @@ namespace OpenSim.Tests.Torture
75 [TestFixtureTearDown] 75 [TestFixtureTearDown]
76 public void TearDown() 76 public void TearDown()
77 { 77 {
78 scene.Close();
79 scene = null;
80 GC.Collect();
81 GC.WaitForPendingFinalizers();
82
78 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple 83 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
79 // threads. Possibly, later tests should be rewritten not to worry about such things. 84 // threads. Possibly, later tests should be rewritten not to worry about such things.
80 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; 85 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
@@ -98,7 +103,7 @@ namespace OpenSim.Tests.Torture
98 } 103 }
99 104
100 [Test] 105 [Test]
101 public void TestAddRemove100NPCs() 106 public void Test_0001_AddRemove100NPCs()
102 { 107 {
103 TestHelpers.InMethod(); 108 TestHelpers.InMethod();
104// log4net.Config.XmlConfigurator.Configure(); 109// log4net.Config.XmlConfigurator.Configure();
@@ -107,7 +112,7 @@ namespace OpenSim.Tests.Torture
107 } 112 }
108 113
109 [Test] 114 [Test]
110 public void TestAddRemove1000NPCs() 115 public void Test_0002_AddRemove1000NPCs()
111 { 116 {
112 TestHelpers.InMethod(); 117 TestHelpers.InMethod();
113// log4net.Config.XmlConfigurator.Configure(); 118// log4net.Config.XmlConfigurator.Configure();
@@ -116,7 +121,7 @@ namespace OpenSim.Tests.Torture
116 } 121 }
117 122
118 [Test] 123 [Test]
119 public void TestAddRemove2000NPCs() 124 public void Test_0003_AddRemove2000NPCs()
120 { 125 {
121 TestHelpers.InMethod(); 126 TestHelpers.InMethod();
122// log4net.Config.XmlConfigurator.Configure(); 127// log4net.Config.XmlConfigurator.Configure();
diff --git a/OpenSim/Tests/Torture/ObjectTortureTests.cs b/OpenSim/Tests/Torture/ObjectTortureTests.cs
index e83186a..978a308 100644
--- a/OpenSim/Tests/Torture/ObjectTortureTests.cs
+++ b/OpenSim/Tests/Torture/ObjectTortureTests.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Tests.Torture
66// } 66// }
67 67
68 [Test] 68 [Test]
69 public void Test0001_10K_1PrimObjects() 69 public void Test_0001_10K_1PrimObjects()
70 { 70 {
71 TestHelpers.InMethod(); 71 TestHelpers.InMethod();
72// log4net.Config.XmlConfigurator.Configure(); 72// log4net.Config.XmlConfigurator.Configure();
@@ -75,7 +75,7 @@ namespace OpenSim.Tests.Torture
75 } 75 }
76 76
77 [Test] 77 [Test]
78 public void Test0002_100K_1PrimObjects() 78 public void Test_0002_100K_1PrimObjects()
79 { 79 {
80 TestHelpers.InMethod(); 80 TestHelpers.InMethod();
81// log4net.Config.XmlConfigurator.Configure(); 81// log4net.Config.XmlConfigurator.Configure();
@@ -84,7 +84,7 @@ namespace OpenSim.Tests.Torture
84 } 84 }
85 85
86 [Test] 86 [Test]
87 public void Test0003_200K_1PrimObjects() 87 public void Test_0003_200K_1PrimObjects()
88 { 88 {
89 TestHelpers.InMethod(); 89 TestHelpers.InMethod();
90// log4net.Config.XmlConfigurator.Configure(); 90// log4net.Config.XmlConfigurator.Configure();
@@ -93,7 +93,7 @@ namespace OpenSim.Tests.Torture
93 } 93 }
94 94
95 [Test] 95 [Test]
96 public void Test0011_100_100PrimObjects() 96 public void Test_0011_100_100PrimObjects()
97 { 97 {
98 TestHelpers.InMethod(); 98 TestHelpers.InMethod();
99// log4net.Config.XmlConfigurator.Configure(); 99// log4net.Config.XmlConfigurator.Configure();
@@ -102,7 +102,7 @@ namespace OpenSim.Tests.Torture
102 } 102 }
103 103
104 [Test] 104 [Test]
105 public void Test0012_1K_100PrimObjects() 105 public void Test_0012_1K_100PrimObjects()
106 { 106 {
107 TestHelpers.InMethod(); 107 TestHelpers.InMethod();
108// log4net.Config.XmlConfigurator.Configure(); 108// log4net.Config.XmlConfigurator.Configure();
@@ -111,7 +111,7 @@ namespace OpenSim.Tests.Torture
111 } 111 }
112 112
113 [Test] 113 [Test]
114 public void Test0013_2K_100PrimObjects() 114 public void Test_0013_2K_100PrimObjects()
115 { 115 {
116 TestHelpers.InMethod(); 116 TestHelpers.InMethod();
117// log4net.Config.XmlConfigurator.Configure(); 117// log4net.Config.XmlConfigurator.Configure();
@@ -123,6 +123,9 @@ namespace OpenSim.Tests.Torture
123 { 123 {
124 UUID ownerId = new UUID("F0000000-0000-0000-0000-000000000000"); 124 UUID ownerId = new UUID("F0000000-0000-0000-0000-000000000000");
125 125
126 // Using a local variable for scene, at least on mono 2.6.7, means that it's much more likely to be garbage
127 // collected when we teardown this test. If it's done in a member variable, even if that is subsequently
128 // nulled out, the garbage collect can be delayed.
126 TestScene scene = SceneHelpers.SetupScene(); 129 TestScene scene = SceneHelpers.SetupScene();
127 130
128// Process process = Process.GetCurrentProcess(); 131// Process process = Process.GetCurrentProcess();
@@ -156,11 +159,6 @@ namespace OpenSim.Tests.Torture
156 // objects will be clean up by the garbage collector before the next stress test is run. 159 // objects will be clean up by the garbage collector before the next stress test is run.
157 scene.Update(); 160 scene.Update();
158 161
159 // Currently, we need to do this in order to garbage collect the scene objects ready for the next test run.
160 // However, what we really need to do is find out why the entire scene is not garbage collected in
161 // teardown.
162 scene.DeleteAllSceneObjects();
163
164 Console.WriteLine( 162 Console.WriteLine(
165 "Took {0}ms, {1}MB ({2} - {3}) to create {4} objects each containing {5} prim(s)", 163 "Took {0}ms, {1}MB ({2} - {3}) to create {4} objects each containing {5} prim(s)",
166 Math.Round(elapsed.TotalMilliseconds), 164 Math.Round(elapsed.TotalMilliseconds),
@@ -170,7 +168,8 @@ namespace OpenSim.Tests.Torture
170 objectsToAdd, 168 objectsToAdd,
171 primsInEachObject); 169 primsInEachObject);
172 170
173 scene = null; 171 scene.Close();
172// scene = null;
174 } 173 }
175 } 174 }
176} \ No newline at end of file 175} \ No newline at end of file
diff --git a/OpenSim/Tests/Torture/ScriptTortureTests.cs b/OpenSim/Tests/Torture/ScriptTortureTests.cs
index d94bbde..2ef55b3 100644
--- a/OpenSim/Tests/Torture/ScriptTortureTests.cs
+++ b/OpenSim/Tests/Torture/ScriptTortureTests.cs
@@ -91,6 +91,15 @@ namespace OpenSim.Tests.Torture
91 m_scene.StartScripts(); 91 m_scene.StartScripts();
92 } 92 }
93 93
94 [TearDown]
95 public void TearDown()
96 {
97 m_scene.Close();
98 m_scene = null;
99 GC.Collect();
100 GC.WaitForPendingFinalizers();
101 }
102
94 [Test] 103 [Test]
95 public void TestCompileAndStart100Scripts() 104 public void TestCompileAndStart100Scripts()
96 { 105 {
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index 0bd0bcc..da090dd 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -420,6 +420,8 @@ namespace pCampBot
420 420
421 public void Network_LoginProgress(object sender, LoginProgressEventArgs args) 421 public void Network_LoginProgress(object sender, LoginProgressEventArgs args)
422 { 422 {
423 m_log.DebugFormat("[BOT]: Bot {0} {1} in Network_LoginProcess", Name, args.Status);
424
423 if (args.Status == LoginStatus.Success) 425 if (args.Status == LoginStatus.Success)
424 { 426 {
425 if (OnConnected != null) 427 if (OnConnected != null)
@@ -431,10 +433,15 @@ namespace pCampBot
431 433
432 public void Network_SimConnected(object sender, SimConnectedEventArgs args) 434 public void Network_SimConnected(object sender, SimConnectedEventArgs args)
433 { 435 {
436 m_log.DebugFormat(
437 "[BOT]: Bot {0} connected to {1} at {2}", Name, args.Simulator.Name, args.Simulator.IPEndPoint);
434 } 438 }
435 439
436 public void Network_OnDisconnected(object sender, DisconnectedEventArgs args) 440 public void Network_OnDisconnected(object sender, DisconnectedEventArgs args)
437 { 441 {
442 m_log.DebugFormat(
443 "[BOT]: Bot {0} disconnected reason {1}, message {2}", Name, args.Reason, args.Message);
444
438// m_log.ErrorFormat("Fired Network_OnDisconnected"); 445// m_log.ErrorFormat("Fired Network_OnDisconnected");
439 446
440// if ( 447// if (
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 6481e97..0f501b7 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -266,7 +266,7 @@ namespace pCampBot
266 /// <returns></returns> 266 /// <returns></returns>
267 protected CommandConsole CreateConsole() 267 protected CommandConsole CreateConsole()
268 { 268 {
269 return new LocalConsole("Region"); 269 return new LocalConsole("pCampbot");
270 } 270 }
271 271
272 private void HandleShutdown(string module, string[] cmd) 272 private void HandleShutdown(string module, string[] cmd)
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index a73fcbe..ec5ad04 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -56,6 +56,10 @@ namespace pCampBot
56 { 56 {
57 Help(); 57 Help();
58 } 58 }
59 else if (config.Get("firstname") == null || config.Get("lastname") == null || config.Get("password") == null)
60 {
61 Console.WriteLine("ERROR: You must supply a firstname, lastname and password for the bots.");
62 }
59 else 63 else
60 { 64 {
61 int botcount = config.GetInt("botcount", 1); 65 int botcount = config.GetInt("botcount", 1);