diff options
author | Melanie | 2012-05-27 19:24:30 +0100 |
---|---|---|
committer | Melanie | 2012-05-27 19:24:30 +0100 |
commit | 884c0e7bb10bd2c2a951901c6f1dd56a86ef6b9f (patch) | |
tree | dd692a54213f86fd64bd29c6662584df85088193 /OpenSim | |
parent | Merge branch 'master' into careminster (diff) | |
parent | minor: code formatting from 0b72f773 (diff) | |
download | opensim-SC_OLD-884c0e7bb10bd2c2a951901c6f1dd56a86ef6b9f.zip opensim-SC_OLD-884c0e7bb10bd2c2a951901c6f1dd56a86ef6b9f.tar.gz opensim-SC_OLD-884c0e7bb10bd2c2a951901c6f1dd56a86ef6b9f.tar.bz2 opensim-SC_OLD-884c0e7bb10bd2c2a951901c6f1dd56a86ef6b9f.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Data/MySQL/MySQLSimulationData.cs
OpenSim/Data/MySQL/Resources/RegionStore.migrations
OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
OpenSim/Region/Framework/Scenes/Scene.cs
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
Diffstat (limited to 'OpenSim')
53 files changed, 2335 insertions, 939 deletions
diff --git a/OpenSim/Capabilities/LLSDEnvironmentSettings.cs b/OpenSim/Capabilities/LLSDEnvironmentSettings.cs new file mode 100644 index 0000000..39019af --- /dev/null +++ b/OpenSim/Capabilities/LLSDEnvironmentSettings.cs | |||
@@ -0,0 +1,68 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Framework.Capabilities | ||
33 | { | ||
34 | [OSDMap] | ||
35 | public class LLSDEnvironmentRequest | ||
36 | { | ||
37 | public UUID messageID; | ||
38 | public UUID regionID; | ||
39 | } | ||
40 | |||
41 | [OSDMap] | ||
42 | public class LLSDEnvironmentSetResponse | ||
43 | { | ||
44 | public UUID regionID; | ||
45 | public UUID messageID; | ||
46 | public Boolean success; | ||
47 | public String fail_reason; | ||
48 | } | ||
49 | |||
50 | public class EnvironmentSettings | ||
51 | { | ||
52 | /// <summary> | ||
53 | /// generates a empty llsd settings response for viewer | ||
54 | /// </summary> | ||
55 | /// <param name="messageID">the message UUID</param> | ||
56 | /// <param name="regionID">the region UUID</param> | ||
57 | public static string EmptySettings(UUID messageID, UUID regionID) | ||
58 | { | ||
59 | OSDArray arr = new OSDArray(); | ||
60 | LLSDEnvironmentRequest msg = new LLSDEnvironmentRequest(); | ||
61 | msg.messageID = messageID; | ||
62 | msg.regionID = regionID; | ||
63 | arr.Array.Add(msg); | ||
64 | return LLSDHelpers.SerialiseLLSDReply(arr); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index d9dfe86..3f29f5b 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs | |||
@@ -1181,6 +1181,72 @@ VALUES | |||
1181 | // } | 1181 | // } |
1182 | #endregion | 1182 | #endregion |
1183 | } | 1183 | } |
1184 | |||
1185 | #region Environment Settings | ||
1186 | public string LoadRegionEnvironmentSettings(UUID regionUUID) | ||
1187 | { | ||
1188 | string sql = "select * from [regionenvironment] where region_id = @region_id"; | ||
1189 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
1190 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
1191 | { | ||
1192 | cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID)); | ||
1193 | conn.Open(); | ||
1194 | using (SqlDataReader result = cmd.ExecuteReader()) | ||
1195 | { | ||
1196 | if (!result.Read()) | ||
1197 | { | ||
1198 | return String.Empty; | ||
1199 | } | ||
1200 | else | ||
1201 | { | ||
1202 | return Convert.ToString(result["llsd_settings"]); | ||
1203 | } | ||
1204 | } | ||
1205 | } | ||
1206 | } | ||
1207 | |||
1208 | public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings) | ||
1209 | { | ||
1210 | { | ||
1211 | string sql = "DELETE FROM [regionenvironment] WHERE region_id = @region_id"; | ||
1212 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
1213 | |||
1214 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
1215 | { | ||
1216 | cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID)); | ||
1217 | conn.Open(); | ||
1218 | cmd.ExecuteNonQuery(); | ||
1219 | } | ||
1220 | |||
1221 | sql = "INSERT INTO [regionenvironment] (region_id, llsd_settings) VALUES (@region_id, @llsd_settings)"; | ||
1222 | |||
1223 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
1224 | |||
1225 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
1226 | { | ||
1227 | cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID)); | ||
1228 | cmd.Parameters.Add(_Database.CreateParameter("@llsd_settings", settings)); | ||
1229 | |||
1230 | conn.Open(); | ||
1231 | cmd.ExecuteNonQuery(); | ||
1232 | } | ||
1233 | } | ||
1234 | } | ||
1235 | |||
1236 | public void RemoveRegionEnvironmentSettings(UUID regionUUID) | ||
1237 | { | ||
1238 | string sql = "delete from [regionenvironment] where region_id = @region_id"; | ||
1239 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
1240 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
1241 | { | ||
1242 | cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID)); | ||
1243 | |||
1244 | conn.Open(); | ||
1245 | cmd.ExecuteNonQuery(); | ||
1246 | } | ||
1247 | } | ||
1248 | #endregion | ||
1249 | |||
1184 | /// <summary> | 1250 | /// <summary> |
1185 | /// Loads the settings of a region. | 1251 | /// Loads the settings of a region. |
1186 | /// </summary> | 1252 | /// </summary> |
diff --git a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations index d6a3be9..350e548 100644 --- a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations | |||
@@ -1134,3 +1134,17 @@ ALTER TABLE landaccesslist ADD Expires integer NOT NULL DEFAULT 0; | |||
1134 | 1134 | ||
1135 | COMMIT | 1135 | COMMIT |
1136 | 1136 | ||
1137 | :VERSION 37 #---------------- Environment Settings | ||
1138 | |||
1139 | BEGIN TRANSACTION | ||
1140 | |||
1141 | CREATE TABLE [dbo].[regionenvironment]( | ||
1142 | [region_id] [uniqueidentifier] NOT NULL, | ||
1143 | [llsd_settings] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
1144 | PRIMARY KEY CLUSTERED | ||
1145 | ( | ||
1146 | [region_id] ASC | ||
1147 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
1148 | ) ON [PRIMARY] | ||
1149 | |||
1150 | COMMIT | ||
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 9467124..faf749f 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -994,6 +994,68 @@ namespace OpenSim.Data.MySQL | |||
994 | } | 994 | } |
995 | } | 995 | } |
996 | 996 | ||
997 | #region RegionEnvironmentSettings | ||
998 | public string LoadRegionEnvironmentSettings(UUID regionUUID) | ||
999 | { | ||
1000 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
1001 | { | ||
1002 | dbcon.Open(); | ||
1003 | |||
1004 | string command = "select * from `regionenvironment` where region_id = ?region_id"; | ||
1005 | |||
1006 | using (MySqlCommand cmd = new MySqlCommand(command)) | ||
1007 | { | ||
1008 | cmd.Connection = dbcon; | ||
1009 | |||
1010 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); | ||
1011 | |||
1012 | IDataReader result = ExecuteReader(cmd); | ||
1013 | if (!result.Read()) | ||
1014 | { | ||
1015 | return String.Empty; | ||
1016 | } | ||
1017 | else | ||
1018 | { | ||
1019 | return Convert.ToString(result["llsd_settings"]); | ||
1020 | } | ||
1021 | } | ||
1022 | } | ||
1023 | } | ||
1024 | |||
1025 | public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings) | ||
1026 | { | ||
1027 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
1028 | { | ||
1029 | dbcon.Open(); | ||
1030 | |||
1031 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
1032 | { | ||
1033 | cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)"; | ||
1034 | |||
1035 | cmd.Parameters.AddWithValue("region_id", regionUUID); | ||
1036 | cmd.Parameters.AddWithValue("llsd_settings", settings); | ||
1037 | |||
1038 | ExecuteNonQuery(cmd); | ||
1039 | } | ||
1040 | } | ||
1041 | } | ||
1042 | |||
1043 | public void RemoveRegionEnvironmentSettings(UUID regionUUID) | ||
1044 | { | ||
1045 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
1046 | { | ||
1047 | dbcon.Open(); | ||
1048 | |||
1049 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
1050 | { | ||
1051 | cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id"; | ||
1052 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); | ||
1053 | ExecuteNonQuery(cmd); | ||
1054 | } | ||
1055 | } | ||
1056 | } | ||
1057 | #endregion | ||
1058 | |||
997 | public virtual void StoreRegionSettings(RegionSettings rs) | 1059 | public virtual void StoreRegionSettings(RegionSettings rs) |
998 | { | 1060 | { |
999 | lock (m_dbLock) | 1061 | lock (m_dbLock) |
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index ef99ef8..db0d0ec 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations | |||
@@ -883,3 +883,15 @@ ALTER TABLE `regionsettings` MODIFY COLUMN `TelehubObject` VARCHAR(36) NOT NULL | |||
883 | 883 | ||
884 | COMMIT; | 884 | COMMIT; |
885 | 885 | ||
886 | :VERSION 44 #--------------------- Environment Settings | ||
887 | |||
888 | BEGIN; | ||
889 | |||
890 | CREATE TABLE `regionenvironment` ( | ||
891 | `region_id` varchar(36) NOT NULL, | ||
892 | `llsd_settings` TEXT NOT NULL, | ||
893 | PRIMARY KEY (`region_id`) | ||
894 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
895 | |||
896 | COMMIT; | ||
897 | |||
diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs index b788976..8f2314f 100644 --- a/OpenSim/Data/Null/NullSimulationData.cs +++ b/OpenSim/Data/Null/NullSimulationData.cs | |||
@@ -76,9 +76,27 @@ namespace OpenSim.Data.Null | |||
76 | //This connector doesn't support the windlight module yet | 76 | //This connector doesn't support the windlight module yet |
77 | } | 77 | } |
78 | 78 | ||
79 | #region Environment Settings | ||
80 | public string LoadRegionEnvironmentSettings(UUID regionUUID) | ||
81 | { | ||
82 | //This connector doesn't support the Environment module yet | ||
83 | return string.Empty; | ||
84 | } | ||
85 | |||
86 | public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings) | ||
87 | { | ||
88 | //This connector doesn't support the Environment module yet | ||
89 | } | ||
90 | |||
91 | public void RemoveRegionEnvironmentSettings(UUID regionUUID) | ||
92 | { | ||
93 | //This connector doesn't support the Environment module yet | ||
94 | } | ||
95 | #endregion | ||
96 | |||
79 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 97 | public RegionSettings LoadRegionSettings(UUID regionUUID) |
80 | { | 98 | { |
81 | RegionSettings rs = new RegionSettings(); | 99 | RegionSettings rs = new RegionSettings(); |
82 | rs.RegionUUID = regionUUID; | 100 | rs.RegionUUID = regionUUID; |
83 | return rs; | 101 | return rs; |
84 | } | 102 | } |
diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations index 1ceddf9..e872977 100644 --- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations +++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations | |||
@@ -564,3 +564,14 @@ COMMIT; | |||
564 | BEGIN; | 564 | BEGIN; |
565 | ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; | 565 | ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; |
566 | COMMIT; | 566 | COMMIT; |
567 | |||
568 | :VERSION 26 | ||
569 | |||
570 | BEGIN; | ||
571 | |||
572 | CREATE TABLE `regionenvironment` ( | ||
573 | `region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000' PRIMARY KEY, | ||
574 | `llsd_settings` TEXT NOT NULL | ||
575 | ); | ||
576 | |||
577 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 7e7c08a..f40e866 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs | |||
@@ -61,6 +61,7 @@ namespace OpenSim.Data.SQLite | |||
61 | private const string regionbanListSelect = "select * from regionban"; | 61 | private const string regionbanListSelect = "select * from regionban"; |
62 | private const string regionSettingsSelect = "select * from regionsettings"; | 62 | private const string regionSettingsSelect = "select * from regionsettings"; |
63 | private const string regionWindlightSelect = "select * from regionwindlight"; | 63 | private const string regionWindlightSelect = "select * from regionwindlight"; |
64 | private const string regionEnvironmentSelect = "select * from regionenvironment"; | ||
64 | private const string regionSpawnPointsSelect = "select * from spawn_points"; | 65 | private const string regionSpawnPointsSelect = "select * from spawn_points"; |
65 | 66 | ||
66 | private DataSet ds; | 67 | private DataSet ds; |
@@ -72,6 +73,7 @@ namespace OpenSim.Data.SQLite | |||
72 | private SqliteDataAdapter landAccessListDa; | 73 | private SqliteDataAdapter landAccessListDa; |
73 | private SqliteDataAdapter regionSettingsDa; | 74 | private SqliteDataAdapter regionSettingsDa; |
74 | private SqliteDataAdapter regionWindlightDa; | 75 | private SqliteDataAdapter regionWindlightDa; |
76 | private SqliteDataAdapter regionEnvironmentDa; | ||
75 | private SqliteDataAdapter regionSpawnPointsDa; | 77 | private SqliteDataAdapter regionSpawnPointsDa; |
76 | 78 | ||
77 | private SqliteConnection m_conn; | 79 | private SqliteConnection m_conn; |
@@ -146,6 +148,9 @@ namespace OpenSim.Data.SQLite | |||
146 | SqliteCommand regionWindlightSelectCmd = new SqliteCommand(regionWindlightSelect, m_conn); | 148 | SqliteCommand regionWindlightSelectCmd = new SqliteCommand(regionWindlightSelect, m_conn); |
147 | regionWindlightDa = new SqliteDataAdapter(regionWindlightSelectCmd); | 149 | regionWindlightDa = new SqliteDataAdapter(regionWindlightSelectCmd); |
148 | 150 | ||
151 | SqliteCommand regionEnvironmentSelectCmd = new SqliteCommand(regionEnvironmentSelect, m_conn); | ||
152 | regionEnvironmentDa = new SqliteDataAdapter(regionEnvironmentSelectCmd); | ||
153 | |||
149 | SqliteCommand regionSpawnPointsSelectCmd = new SqliteCommand(regionSpawnPointsSelect, m_conn); | 154 | SqliteCommand regionSpawnPointsSelectCmd = new SqliteCommand(regionSpawnPointsSelect, m_conn); |
150 | regionSpawnPointsDa = new SqliteDataAdapter(regionSpawnPointsSelectCmd); | 155 | regionSpawnPointsDa = new SqliteDataAdapter(regionSpawnPointsSelectCmd); |
151 | 156 | ||
@@ -179,6 +184,9 @@ namespace OpenSim.Data.SQLite | |||
179 | ds.Tables.Add(createRegionWindlightTable()); | 184 | ds.Tables.Add(createRegionWindlightTable()); |
180 | setupRegionWindlightCommands(regionWindlightDa, m_conn); | 185 | setupRegionWindlightCommands(regionWindlightDa, m_conn); |
181 | 186 | ||
187 | ds.Tables.Add(createRegionEnvironmentTable()); | ||
188 | setupRegionEnvironmentCommands(regionEnvironmentDa, m_conn); | ||
189 | |||
182 | ds.Tables.Add(createRegionSpawnPointsTable()); | 190 | ds.Tables.Add(createRegionSpawnPointsTable()); |
183 | setupRegionSpawnPointsCommands(regionSpawnPointsDa, m_conn); | 191 | setupRegionSpawnPointsCommands(regionSpawnPointsDa, m_conn); |
184 | 192 | ||
@@ -260,6 +268,15 @@ namespace OpenSim.Data.SQLite | |||
260 | 268 | ||
261 | try | 269 | try |
262 | { | 270 | { |
271 | regionEnvironmentDa.Fill(ds.Tables["regionenvironment"]); | ||
272 | } | ||
273 | catch (Exception e) | ||
274 | { | ||
275 | m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on regionenvironment table :{0}", e.Message); | ||
276 | } | ||
277 | |||
278 | try | ||
279 | { | ||
263 | regionSpawnPointsDa.Fill(ds.Tables["spawn_points"]); | 280 | regionSpawnPointsDa.Fill(ds.Tables["spawn_points"]); |
264 | } | 281 | } |
265 | catch (Exception e) | 282 | catch (Exception e) |
@@ -278,12 +295,13 @@ namespace OpenSim.Data.SQLite | |||
278 | CreateDataSetMapping(landAccessListDa, "landaccesslist"); | 295 | CreateDataSetMapping(landAccessListDa, "landaccesslist"); |
279 | CreateDataSetMapping(regionSettingsDa, "regionsettings"); | 296 | CreateDataSetMapping(regionSettingsDa, "regionsettings"); |
280 | CreateDataSetMapping(regionWindlightDa, "regionwindlight"); | 297 | CreateDataSetMapping(regionWindlightDa, "regionwindlight"); |
298 | CreateDataSetMapping(regionEnvironmentDa, "regionenvironment"); | ||
281 | CreateDataSetMapping(regionSpawnPointsDa, "spawn_points"); | 299 | CreateDataSetMapping(regionSpawnPointsDa, "spawn_points"); |
282 | } | 300 | } |
283 | } | 301 | } |
284 | catch (Exception e) | 302 | catch (Exception e) |
285 | { | 303 | { |
286 | m_log.ErrorFormat("[SQLITE REGION DB]: ", e); | 304 | m_log.ErrorFormat("[SQLITE REGION DB]: {0} - {1}", e.Message, e.StackTrace); |
287 | Environment.Exit(23); | 305 | Environment.Exit(23); |
288 | } | 306 | } |
289 | return; | 307 | return; |
@@ -341,6 +359,11 @@ namespace OpenSim.Data.SQLite | |||
341 | regionWindlightDa.Dispose(); | 359 | regionWindlightDa.Dispose(); |
342 | regionWindlightDa = null; | 360 | regionWindlightDa = null; |
343 | } | 361 | } |
362 | if (regionEnvironmentDa != null) | ||
363 | { | ||
364 | regionEnvironmentDa.Dispose(); | ||
365 | regionEnvironmentDa = null; | ||
366 | } | ||
344 | if (regionSpawnPointsDa != null) | 367 | if (regionSpawnPointsDa != null) |
345 | { | 368 | { |
346 | regionSpawnPointsDa.Dispose(); | 369 | regionSpawnPointsDa.Dispose(); |
@@ -474,6 +497,63 @@ namespace OpenSim.Data.SQLite | |||
474 | } | 497 | } |
475 | } | 498 | } |
476 | 499 | ||
500 | #region Region Environment Settings | ||
501 | public string LoadRegionEnvironmentSettings(UUID regionUUID) | ||
502 | { | ||
503 | lock (ds) | ||
504 | { | ||
505 | DataTable environmentTable = ds.Tables["regionenvironment"]; | ||
506 | DataRow row = environmentTable.Rows.Find(regionUUID.ToString()); | ||
507 | if (row == null) | ||
508 | { | ||
509 | return String.Empty; | ||
510 | } | ||
511 | |||
512 | return (String)row["llsd_settings"]; | ||
513 | } | ||
514 | } | ||
515 | |||
516 | public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings) | ||
517 | { | ||
518 | lock (ds) | ||
519 | { | ||
520 | DataTable environmentTable = ds.Tables["regionenvironment"]; | ||
521 | DataRow row = environmentTable.Rows.Find(regionUUID.ToString()); | ||
522 | |||
523 | if (row == null) | ||
524 | { | ||
525 | row = environmentTable.NewRow(); | ||
526 | row["region_id"] = regionUUID.ToString(); | ||
527 | row["llsd_settings"] = settings; | ||
528 | environmentTable.Rows.Add(row); | ||
529 | } | ||
530 | else | ||
531 | { | ||
532 | row["llsd_settings"] = settings; | ||
533 | } | ||
534 | |||
535 | regionEnvironmentDa.Update(ds, "regionenvironment"); | ||
536 | } | ||
537 | } | ||
538 | |||
539 | public void RemoveRegionEnvironmentSettings(UUID regionUUID) | ||
540 | { | ||
541 | lock (ds) | ||
542 | { | ||
543 | DataTable environmentTable = ds.Tables["regionenvironment"]; | ||
544 | DataRow row = environmentTable.Rows.Find(regionUUID.ToString()); | ||
545 | |||
546 | if (row != null) | ||
547 | { | ||
548 | row.Delete(); | ||
549 | } | ||
550 | |||
551 | regionEnvironmentDa.Update(ds, "regionenvironment"); | ||
552 | } | ||
553 | } | ||
554 | |||
555 | #endregion | ||
556 | |||
477 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 557 | public RegionSettings LoadRegionSettings(UUID regionUUID) |
478 | { | 558 | { |
479 | lock (ds) | 559 | lock (ds) |
@@ -1430,6 +1510,17 @@ namespace OpenSim.Data.SQLite | |||
1430 | return regionwindlight; | 1510 | return regionwindlight; |
1431 | } | 1511 | } |
1432 | 1512 | ||
1513 | private static DataTable createRegionEnvironmentTable() | ||
1514 | { | ||
1515 | DataTable regionEnvironment = new DataTable("regionenvironment"); | ||
1516 | createCol(regionEnvironment, "region_id", typeof(String)); | ||
1517 | createCol(regionEnvironment, "llsd_settings", typeof(String)); | ||
1518 | |||
1519 | regionEnvironment.PrimaryKey = new DataColumn[] { regionEnvironment.Columns["region_id"] }; | ||
1520 | |||
1521 | return regionEnvironment; | ||
1522 | } | ||
1523 | |||
1433 | private static DataTable createRegionSpawnPointsTable() | 1524 | private static DataTable createRegionSpawnPointsTable() |
1434 | { | 1525 | { |
1435 | DataTable spawn_points = new DataTable("spawn_points"); | 1526 | DataTable spawn_points = new DataTable("spawn_points"); |
@@ -2691,6 +2782,14 @@ namespace OpenSim.Data.SQLite | |||
2691 | da.UpdateCommand.Connection = conn; | 2782 | da.UpdateCommand.Connection = conn; |
2692 | } | 2783 | } |
2693 | 2784 | ||
2785 | private void setupRegionEnvironmentCommands(SqliteDataAdapter da, SqliteConnection conn) | ||
2786 | { | ||
2787 | da.InsertCommand = createInsertCommand("regionenvironment", ds.Tables["regionenvironment"]); | ||
2788 | da.InsertCommand.Connection = conn; | ||
2789 | da.UpdateCommand = createUpdateCommand("regionenvironment", "region_id=:region_id", ds.Tables["regionenvironment"]); | ||
2790 | da.UpdateCommand.Connection = conn; | ||
2791 | } | ||
2792 | |||
2694 | private void setupRegionSpawnPointsCommands(SqliteDataAdapter da, SqliteConnection conn) | 2793 | private void setupRegionSpawnPointsCommands(SqliteDataAdapter da, SqliteConnection conn) |
2695 | { | 2794 | { |
2696 | da.InsertCommand = createInsertCommand("spawn_points", ds.Tables["spawn_points"]); | 2795 | da.InsertCommand = createInsertCommand("spawn_points", ds.Tables["spawn_points"]); |
diff --git a/OpenSim/Framework/Console/ConsoleDisplayList.cs b/OpenSim/Framework/Console/ConsoleDisplayList.cs new file mode 100644 index 0000000..6885509 --- /dev/null +++ b/OpenSim/Framework/Console/ConsoleDisplayList.cs | |||
@@ -0,0 +1,112 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Linq; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Framework.Console | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Used to generated a formatted table for the console. | ||
37 | /// </summary> | ||
38 | /// <remarks> | ||
39 | /// Currently subject to change. If you use this, be prepared to change your code when this class changes. | ||
40 | /// </remarks> | ||
41 | public class ConsoleDisplayList | ||
42 | { | ||
43 | /// <summary> | ||
44 | /// The default divider between key and value for a list item. | ||
45 | /// </summary> | ||
46 | public const string DefaultKeyValueDivider = " : "; | ||
47 | |||
48 | /// <summary> | ||
49 | /// The divider used between key and value for a list item. | ||
50 | /// </summary> | ||
51 | public string KeyValueDivider { get; set; } | ||
52 | |||
53 | /// <summary> | ||
54 | /// Table rows | ||
55 | /// </summary> | ||
56 | public List<KeyValuePair<string, string>> Rows { get; private set; } | ||
57 | |||
58 | /// <summary> | ||
59 | /// Number of spaces to indent the list. | ||
60 | /// </summary> | ||
61 | public int Indent { get; set; } | ||
62 | |||
63 | public ConsoleDisplayList() | ||
64 | { | ||
65 | Rows = new List<KeyValuePair<string, string>>(); | ||
66 | KeyValueDivider = DefaultKeyValueDivider; | ||
67 | } | ||
68 | |||
69 | public override string ToString() | ||
70 | { | ||
71 | StringBuilder sb = new StringBuilder(); | ||
72 | AddToStringBuilder(sb); | ||
73 | return sb.ToString(); | ||
74 | } | ||
75 | |||
76 | public void AddToStringBuilder(StringBuilder sb) | ||
77 | { | ||
78 | string formatString = GetFormatString(); | ||
79 | // System.Console.WriteLine("FORMAT STRING [{0}]", formatString); | ||
80 | |||
81 | // rows | ||
82 | foreach (KeyValuePair<string, string> row in Rows) | ||
83 | sb.AppendFormat(formatString, row.Key, row.Value); | ||
84 | } | ||
85 | |||
86 | /// <summary> | ||
87 | /// Gets the format string for the table. | ||
88 | /// </summary> | ||
89 | private string GetFormatString() | ||
90 | { | ||
91 | StringBuilder formatSb = new StringBuilder(); | ||
92 | |||
93 | int longestKey = -1; | ||
94 | |||
95 | foreach (KeyValuePair<string, string> row in Rows) | ||
96 | if (row.Key.Length > longestKey) | ||
97 | longestKey = row.Key.Length; | ||
98 | |||
99 | formatSb.Append(' ', Indent); | ||
100 | |||
101 | // Can only do left formatting for now | ||
102 | formatSb.AppendFormat("{{0,-{0}}}{1}{{1}}\n", longestKey, KeyValueDivider); | ||
103 | |||
104 | return formatSb.ToString(); | ||
105 | } | ||
106 | |||
107 | public void AddRow(object key, object value) | ||
108 | { | ||
109 | Rows.Add(new KeyValuePair<string, string>(key.ToString(), value.ToString())); | ||
110 | } | ||
111 | } | ||
112 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Console/ConsoleTable.cs b/OpenSim/Framework/Console/ConsoleDisplayTable.cs index be3025b..e9d1628 100644 --- a/OpenSim/Framework/Console/ConsoleTable.cs +++ b/OpenSim/Framework/Console/ConsoleDisplayTable.cs | |||
@@ -38,7 +38,7 @@ namespace OpenSim.Framework.Console | |||
38 | /// <remarks> | 38 | /// <remarks> |
39 | /// Currently subject to change. If you use this, be prepared to change your code when this class changes. | 39 | /// Currently subject to change. If you use this, be prepared to change your code when this class changes. |
40 | /// </remarks> | 40 | /// </remarks> |
41 | public class ConsoleTable | 41 | public class ConsoleDisplayTable |
42 | { | 42 | { |
43 | /// <summary> | 43 | /// <summary> |
44 | /// Default number of spaces between table columns. | 44 | /// Default number of spaces between table columns. |
@@ -48,12 +48,12 @@ namespace OpenSim.Framework.Console | |||
48 | /// <summary> | 48 | /// <summary> |
49 | /// Table columns. | 49 | /// Table columns. |
50 | /// </summary> | 50 | /// </summary> |
51 | public List<ConsoleTableColumn> Columns { get; private set; } | 51 | public List<ConsoleDisplayTableColumn> Columns { get; private set; } |
52 | 52 | ||
53 | /// <summary> | 53 | /// <summary> |
54 | /// Table rows | 54 | /// Table rows |
55 | /// </summary> | 55 | /// </summary> |
56 | public List<ConsoleTableRow> Rows { get; private set; } | 56 | public List<ConsoleDisplayTableRow> Rows { get; private set; } |
57 | 57 | ||
58 | /// <summary> | 58 | /// <summary> |
59 | /// Number of spaces to indent the table. | 59 | /// Number of spaces to indent the table. |
@@ -65,11 +65,11 @@ namespace OpenSim.Framework.Console | |||
65 | /// </summary> | 65 | /// </summary> |
66 | public int TableSpacing { get; set; } | 66 | public int TableSpacing { get; set; } |
67 | 67 | ||
68 | public ConsoleTable() | 68 | public ConsoleDisplayTable() |
69 | { | 69 | { |
70 | TableSpacing = DefaultTableSpacing; | 70 | TableSpacing = DefaultTableSpacing; |
71 | Columns = new List<ConsoleTableColumn>(); | 71 | Columns = new List<ConsoleDisplayTableColumn>(); |
72 | Rows = new List<ConsoleTableRow>(); | 72 | Rows = new List<ConsoleDisplayTableRow>(); |
73 | } | 73 | } |
74 | 74 | ||
75 | public override string ToString() | 75 | public override string ToString() |
@@ -88,7 +88,7 @@ namespace OpenSim.Framework.Console | |||
88 | sb.AppendFormat(formatString, Columns.ConvertAll(c => c.Header).ToArray()); | 88 | sb.AppendFormat(formatString, Columns.ConvertAll(c => c.Header).ToArray()); |
89 | 89 | ||
90 | // rows | 90 | // rows |
91 | foreach (ConsoleTableRow row in Rows) | 91 | foreach (ConsoleDisplayTableRow row in Rows) |
92 | sb.AppendFormat(formatString, row.Cells.ToArray()); | 92 | sb.AppendFormat(formatString, row.Cells.ToArray()); |
93 | } | 93 | } |
94 | 94 | ||
@@ -115,23 +115,23 @@ namespace OpenSim.Framework.Console | |||
115 | } | 115 | } |
116 | } | 116 | } |
117 | 117 | ||
118 | public struct ConsoleTableColumn | 118 | public struct ConsoleDisplayTableColumn |
119 | { | 119 | { |
120 | public string Header { get; set; } | 120 | public string Header { get; set; } |
121 | public int Width { get; set; } | 121 | public int Width { get; set; } |
122 | 122 | ||
123 | public ConsoleTableColumn(string header, int width) : this() | 123 | public ConsoleDisplayTableColumn(string header, int width) : this() |
124 | { | 124 | { |
125 | Header = header; | 125 | Header = header; |
126 | Width = width; | 126 | Width = width; |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | public struct ConsoleTableRow | 130 | public struct ConsoleDisplayTableRow |
131 | { | 131 | { |
132 | public List<string> Cells { get; private set; } | 132 | public List<string> Cells { get; private set; } |
133 | 133 | ||
134 | public ConsoleTableRow(List<string> cells) : this() | 134 | public ConsoleDisplayTableRow(List<string> cells) : this() |
135 | { | 135 | { |
136 | Cells = cells; | 136 | Cells = cells; |
137 | } | 137 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpStatusCodes.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpStatusCodes.cs index 5625227..a736c8b 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpStatusCodes.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpStatusCodes.cs | |||
@@ -28,143 +28,252 @@ | |||
28 | namespace OpenSim.Framework.Servers.HttpServer | 28 | namespace OpenSim.Framework.Servers.HttpServer |
29 | { | 29 | { |
30 | /// <summary> | 30 | /// <summary> |
31 | /// HTTP status codes (almost) as defined by W3C in | 31 | /// HTTP status codes (almost) as defined by W3C in http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html and IETF in http://tools.ietf.org/html/rfc6585 |
32 | /// http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html | ||
33 | /// </summary> | 32 | /// </summary> |
34 | public enum OSHttpStatusCode: int | 33 | public enum OSHttpStatusCode : int |
35 | { | 34 | { |
36 | // 1xx Informational status codes providing a provisional | 35 | #region 1xx Informational status codes providing a provisional response. |
37 | // response. | 36 | |
38 | // 100 Tells client that to keep on going sending its request | 37 | /// <summary> |
39 | InfoContinue = 100, | 38 | /// 100 Tells client that to keep on going sending its request |
40 | // 101 Server understands request, proposes to switch to different | 39 | /// </summary> |
41 | // application level protocol | 40 | InfoContinue = 100, |
42 | InfoSwitchingProtocols = 101, | 41 | |
43 | 42 | /// <summary> | |
44 | 43 | /// 101 Server understands request, proposes to switch to different application level protocol | |
45 | // 2xx Success codes | 44 | /// </summary> |
46 | // 200 Request successful | 45 | InfoSwitchingProtocols = 101, |
47 | SuccessOk = 200, | 46 | |
48 | // 201 Request successful, new resource created | 47 | #endregion |
49 | SuccessOkCreated = 201, | 48 | |
50 | // 202 Request accepted, processing still on-going | 49 | #region 2xx Success codes |
51 | SuccessOkAccepted = 202, | 50 | |
52 | // 203 Request successful, meta information not authoritative | 51 | /// <summary> |
53 | SuccessOkNonAuthoritativeInformation = 203, | 52 | /// 200 Request successful |
54 | // 204 Request successful, nothing to return in the body | 53 | /// </summary> |
55 | SuccessOkNoContent = 204, | 54 | SuccessOk = 200, |
56 | // 205 Request successful, reset displayed content | 55 | |
57 | SuccessOkResetContent = 205, | 56 | /// <summary> |
58 | // 206 Request successful, partial content returned | 57 | /// 201 Request successful, new resource created |
59 | SuccessOkPartialContent = 206, | 58 | /// </summary> |
60 | 59 | SuccessOkCreated = 201, | |
61 | // 3xx Redirect code: user agent needs to go somewhere else | 60 | |
62 | // 300 Redirect: different presentation forms available, take | 61 | /// <summary> |
63 | // a pick | 62 | /// 202 Request accepted, processing still on-going |
64 | RedirectMultipleChoices = 300, | 63 | /// </summary> |
65 | // 301 Redirect: requested resource has moved and now lives | 64 | SuccessOkAccepted = 202, |
66 | // somewhere else | 65 | |
67 | RedirectMovedPermanently = 301, | 66 | /// <summary> |
68 | // 302 Redirect: Resource temporarily somewhere else, location | 67 | /// 203 Request successful, meta information not authoritative |
69 | // might change | 68 | /// </summary> |
70 | RedirectFound = 302, | 69 | SuccessOkNonAuthoritativeInformation = 203, |
71 | // 303 Redirect: See other as result of a POST | 70 | |
72 | RedirectSeeOther = 303, | 71 | /// <summary> |
73 | // 304 Redirect: Resource still the same as before | 72 | /// 204 Request successful, nothing to return in the body |
74 | RedirectNotModified = 304, | 73 | /// </summary> |
75 | // 305 Redirect: Resource must be accessed via proxy provided | 74 | SuccessOkNoContent = 204, |
76 | // in location field | 75 | |
77 | RedirectUseProxy = 305, | 76 | /// <summary> |
78 | // 307 Redirect: Resource temporarily somewhere else, location | 77 | /// 205 Request successful, reset displayed content |
79 | // might change | 78 | /// </summary> |
80 | RedirectMovedTemporarily = 307, | 79 | SuccessOkResetContent = 205, |
81 | 80 | ||
82 | // 4xx Client error: the client borked the request | 81 | /// <summary> |
83 | // 400 Client error: bad request, server does not grok what | 82 | /// 206 Request successful, partial content returned |
84 | // the client wants | 83 | /// </summary> |
85 | ClientErrorBadRequest = 400, | 84 | SuccessOkPartialContent = 206, |
86 | // 401 Client error: the client is not authorized, response | 85 | |
87 | // provides WWW-Authenticate header field with a challenge | 86 | #endregion |
88 | ClientErrorUnauthorized = 401, | 87 | |
89 | // 402 Client error: Payment required (reserved for future use) | 88 | #region 3xx Redirect code: user agent needs to go somewhere else |
90 | ClientErrorPaymentRequired = 402, | 89 | |
91 | // 403 Client error: Server understood request, will not | 90 | /// <summary> |
92 | // deliver, do not try again. | 91 | /// 300 Redirect: different presentation forms available, take a pick |
93 | ClientErrorForbidden = 403, | 92 | /// </summary> |
94 | // 404 Client error: Server cannot find anything matching the | 93 | RedirectMultipleChoices = 300, |
95 | // client request. | 94 | |
96 | ClientErrorNotFound = 404, | 95 | /// <summary> |
97 | // 405 Client error: The method specified by the client in the | 96 | /// 301 Redirect: requested resource has moved and now lives somewhere else |
98 | // request is not allowed for the resource requested | 97 | /// </summary> |
99 | ClientErrorMethodNotAllowed = 405, | 98 | RedirectMovedPermanently = 301, |
100 | // 406 Client error: Server cannot generate suitable response | 99 | |
101 | // for the resource and content characteristics requested by | 100 | /// <summary> |
102 | // the client | 101 | /// 302 Redirect: Resource temporarily somewhere else, location might change |
103 | ClientErrorNotAcceptable = 406, | 102 | /// </summary> |
104 | // 407 Client error: Similar to 401, Server requests that | 103 | RedirectFound = 302, |
105 | // client authenticate itself with the proxy first | 104 | |
106 | ClientErrorProxyAuthRequired = 407, | 105 | /// <summary> |
107 | // 408 Client error: Server got impatient with client and | 106 | /// 303 Redirect: See other as result of a POST |
108 | // decided to give up waiting for the client's request to | 107 | /// </summary> |
109 | // arrive | 108 | RedirectSeeOther = 303, |
110 | ClientErrorRequestTimeout = 408, | 109 | |
111 | // 409 Client error: Server could not fulfill the request for | 110 | /// <summary> |
112 | // a resource as there is a conflict with the current state of | 111 | /// 304 Redirect: Resource still the same as before |
113 | // the resource but thinks client can do something about this | 112 | /// </summary> |
114 | ClientErrorConflict = 409, | 113 | RedirectNotModified = 304, |
115 | // 410 Client error: The resource has moved somewhere else, | 114 | |
116 | // but server has no clue where. | 115 | /// <summary> |
117 | ClientErrorGone = 410, | 116 | /// 305 Redirect: Resource must be accessed via proxy provided in location field |
118 | // 411 Client error: The server is picky again and insists on | 117 | /// </summary> |
119 | // having a content-length header field in the request | 118 | RedirectUseProxy = 305, |
120 | ClientErrorLengthRequired = 411, | 119 | |
121 | // 412 Client error: one or more preconditions supplied in the | 120 | /// <summary> |
122 | // client's request is false | 121 | /// 307 Redirect: Resource temporarily somewhere else, location might change |
123 | ClientErrorPreconditionFailed = 412, | 122 | /// </summary> |
124 | // 413 Client error: For fear of reflux, the server refuses to | 123 | RedirectMovedTemporarily = 307, |
125 | // swallow that much data. | 124 | |
126 | ClientErrorRequestEntityToLarge = 413, | 125 | #endregion |
127 | // 414 Client error: The server considers the Request-URI to | 126 | |
128 | // be indecently long and refuses to even look at it. | 127 | #region 4xx Client error: the client borked the request |
129 | ClientErrorRequestURITooLong = 414, | 128 | |
130 | // 415 Client error: The server has no clue about the media | 129 | /// <summary> |
131 | // type requested by the client (contrary to popular belief it | 130 | /// 400 Client error: bad request, server does not grok what the client wants |
132 | // is not a warez server) | 131 | /// </summary> |
133 | ClientErrorUnsupportedMediaType = 415, | 132 | ClientErrorBadRequest = 400, |
134 | // 416 Client error: The requested range cannot be delivered | 133 | |
135 | // by the server. | 134 | /// <summary> |
135 | /// 401 Client error: the client is not authorized, response provides WWW-Authenticate header field with a challenge | ||
136 | /// </summary> | ||
137 | ClientErrorUnauthorized = 401, | ||
138 | |||
139 | /// <summary> | ||
140 | /// 402 Client error: Payment required (reserved for future use) | ||
141 | /// </summary> | ||
142 | ClientErrorPaymentRequired = 402, | ||
143 | |||
144 | /// <summary> | ||
145 | /// 403 Client error: Server understood request, will not deliver, do not try again. | ||
146 | ClientErrorForbidden = 403, | ||
147 | |||
148 | /// <summary> | ||
149 | /// 404 Client error: Server cannot find anything matching the client request. | ||
150 | /// </summary> | ||
151 | ClientErrorNotFound = 404, | ||
152 | |||
153 | /// <summary> | ||
154 | /// 405 Client error: The method specified by the client in the request is not allowed for the resource requested | ||
155 | /// </summary> | ||
156 | ClientErrorMethodNotAllowed = 405, | ||
157 | |||
158 | /// <summary> | ||
159 | /// 406 Client error: Server cannot generate suitable response for the resource and content characteristics requested by the client | ||
160 | /// </summary> | ||
161 | ClientErrorNotAcceptable = 406, | ||
162 | |||
163 | /// <summary> | ||
164 | /// 407 Client error: Similar to 401, Server requests that client authenticate itself with the proxy first | ||
165 | /// </summary> | ||
166 | ClientErrorProxyAuthRequired = 407, | ||
167 | |||
168 | /// <summary> | ||
169 | /// 408 Client error: Server got impatient with client and decided to give up waiting for the client's request to arrive | ||
170 | /// </summary> | ||
171 | ClientErrorRequestTimeout = 408, | ||
172 | |||
173 | /// <summary> | ||
174 | /// 409 Client error: Server could not fulfill the request for a resource as there is a conflict with the current state of the resource but thinks client can do something about this | ||
175 | /// </summary> | ||
176 | ClientErrorConflict = 409, | ||
177 | |||
178 | /// <summary> | ||
179 | /// 410 Client error: The resource has moved somewhere else, but server has no clue where. | ||
180 | /// </summary> | ||
181 | ClientErrorGone = 410, | ||
182 | |||
183 | /// <summary> | ||
184 | /// 411 Client error: The server is picky again and insists on having a content-length header field in the request | ||
185 | /// </summary> | ||
186 | ClientErrorLengthRequired = 411, | ||
187 | |||
188 | /// <summary> | ||
189 | /// 412 Client error: one or more preconditions supplied in the client's request is false | ||
190 | /// </summary> | ||
191 | ClientErrorPreconditionFailed = 412, | ||
192 | |||
193 | /// <summary> | ||
194 | /// 413 Client error: For fear of reflux, the server refuses to swallow that much data. | ||
195 | /// </summary> | ||
196 | ClientErrorRequestEntityToLarge = 413, | ||
197 | |||
198 | /// <summary> | ||
199 | /// 414 Client error: The server considers the Request-URI to be indecently long and refuses to even look at it. | ||
200 | /// </summary> | ||
201 | ClientErrorRequestURITooLong = 414, | ||
202 | |||
203 | /// <summary> | ||
204 | /// 415 Client error: The server has no clue about the media type requested by the client (contrary to popular belief it is not a warez server) | ||
205 | /// </summary> | ||
206 | ClientErrorUnsupportedMediaType = 415, | ||
207 | |||
208 | /// <summary> | ||
209 | /// 416 Client error: The requested range cannot be delivered by the server. | ||
210 | /// </summary> | ||
136 | ClientErrorRequestRangeNotSatisfiable = 416, | 211 | ClientErrorRequestRangeNotSatisfiable = 416, |
137 | // 417 Client error: The expectations of the client as | 212 | |
138 | // expressed in one or more Expect header fields cannot be met | 213 | /// <summary> |
139 | // by the server, the server is awfully sorry about this. | 214 | /// 417 Client error: The expectations of the client as expressed in one or more Expect header fields cannot be met by the server, the server is awfully sorry about this. |
140 | ClientErrorExpectationFailed = 417, | 215 | /// </summary> |
141 | // 499 Client error: Wildcard error. | 216 | ClientErrorExpectationFailed = 417, |
142 | ClientErrorJoker = 499, | 217 | |
143 | 218 | /// <summary> | |
144 | // 5xx Server errors (rare) | 219 | /// 428 Client error :The 428 status code indicates that the origin server requires the request to be conditional. |
145 | // 500 Server error: something really strange and unexpected | 220 | /// </summary> |
146 | // happened | 221 | ClientErrorPreconditionRequired = 428, |
147 | ServerErrorInternalError = 500, | 222 | |
148 | // 501 Server error: The server does not do the functionality | 223 | /// <summary> |
149 | // required to carry out the client request. not at | 224 | /// 429 Client error: The 429 status code indicates that the user has sent too many requests in a given amount of time ("rate limiting"). |
150 | // all. certainly not before breakfast. but also not after | 225 | /// </summary> |
151 | // breakfast. | 226 | ClientErrorTooManyRequests = 429, |
152 | ServerErrorNotImplemented = 501, | 227 | |
153 | // 502 Server error: While acting as a proxy or a gateway, the | 228 | /// <summary> |
154 | // server got ditched by the upstream server and as a | 229 | /// 431 Client error: The 431 status code indicates that the server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields. |
155 | // consequence regretfully cannot fulfill the client's request | 230 | /// </summary> |
156 | ServerErrorBadGateway = 502, | 231 | ClientErrorRequestHeaderFieldsTooLarge = 431, |
157 | // 503 Server error: Due to unforseen circumstances the server | 232 | |
158 | // cannot currently deliver the service requested. Retry-After | 233 | /// <summary> |
159 | // header might indicate when to try again. | 234 | /// 499 Client error: Wildcard error. |
160 | ServerErrorServiceUnavailable = 503, | 235 | /// </summary> |
161 | // 504 Server error: The server blames the upstream server | 236 | ClientErrorJoker = 499, |
162 | // for not being able to deliver the service requested and | 237 | |
163 | // claims that the upstream server is too slow delivering the | 238 | #endregion |
164 | // goods. | 239 | |
165 | ServerErrorGatewayTimeout = 504, | 240 | #region 5xx Server errors (rare) |
166 | // 505 Server error: The server does not support the HTTP | 241 | |
167 | // version conveyed in the client's request. | 242 | /// <summary> |
168 | ServerErrorHttpVersionNotSupported = 505, | 243 | /// 500 Server error: something really strange and unexpected happened |
244 | /// </summary> | ||
245 | ServerErrorInternalError = 500, | ||
246 | |||
247 | /// <summary> | ||
248 | /// 501 Server error: The server does not do the functionality required to carry out the client request. not at all. certainly not before breakfast. but also not after breakfast. | ||
249 | /// </summary> | ||
250 | ServerErrorNotImplemented = 501, | ||
251 | |||
252 | /// <summary> | ||
253 | /// 502 Server error: While acting as a proxy or a gateway, the server got ditched by the upstream server and as a consequence regretfully cannot fulfill the client's request | ||
254 | /// </summary> | ||
255 | ServerErrorBadGateway = 502, | ||
256 | |||
257 | /// <summary> | ||
258 | /// 503 Server error: Due to unforseen circumstances the server cannot currently deliver the service requested. Retry-After header might indicate when to try again. | ||
259 | /// </summary> | ||
260 | ServerErrorServiceUnavailable = 503, | ||
261 | |||
262 | /// <summary> | ||
263 | /// 504 Server error: The server blames the upstream server for not being able to deliver the service requested and claims that the upstream server is too slow delivering the goods. | ||
264 | /// </summary> | ||
265 | ServerErrorGatewayTimeout = 504, | ||
266 | |||
267 | /// <summary> | ||
268 | /// 505 Server error: The server does not support the HTTP version conveyed in the client's request. | ||
269 | /// </summary> | ||
270 | ServerErrorHttpVersionNotSupported = 505, | ||
271 | |||
272 | /// <summary> | ||
273 | /// 511 Server error: The 511 status code indicates that the client needs to authenticate to gain network access. | ||
274 | /// </summary> | ||
275 | ServerErrorNetworkAuthenticationRequired = 511, | ||
276 | |||
277 | #endregion | ||
169 | } | 278 | } |
170 | } | 279 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 2bfe190..7a91481 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
52 | private Scene m_scene; | 52 | private Scene m_scene; |
53 | private IDialogModule m_dialogModule; | 53 | private IInventoryAccessModule m_invAccessModule; |
54 | 54 | ||
55 | /// <summary> | 55 | /// <summary> |
56 | /// Are attachments enabled? | 56 | /// Are attachments enabled? |
@@ -72,7 +72,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
72 | public void AddRegion(Scene scene) | 72 | public void AddRegion(Scene scene) |
73 | { | 73 | { |
74 | m_scene = scene; | 74 | m_scene = scene; |
75 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); | ||
76 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); | 75 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); |
77 | 76 | ||
78 | if (Enabled) | 77 | if (Enabled) |
@@ -89,7 +88,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
89 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; | 88 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; |
90 | } | 89 | } |
91 | 90 | ||
92 | public void RegionLoaded(Scene scene) {} | 91 | public void RegionLoaded(Scene scene) |
92 | { | ||
93 | m_invAccessModule = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | ||
94 | } | ||
93 | 95 | ||
94 | public void Close() | 96 | public void Close() |
95 | { | 97 | { |
@@ -629,6 +631,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
629 | /// <returns>The user inventory item created that holds the attachment.</returns> | 631 | /// <returns>The user inventory item created that holds the attachment.</returns> |
630 | private InventoryItemBase AddSceneObjectAsNewAttachmentInInv(IScenePresence sp, SceneObjectGroup grp) | 632 | private InventoryItemBase AddSceneObjectAsNewAttachmentInInv(IScenePresence sp, SceneObjectGroup grp) |
631 | { | 633 | { |
634 | if (m_invAccessModule == null) | ||
635 | return null; | ||
636 | |||
632 | // m_log.DebugFormat( | 637 | // m_log.DebugFormat( |
633 | // "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}", | 638 | // "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}", |
634 | // grp.Name, grp.LocalId, remoteClient.Name); | 639 | // grp.Name, grp.LocalId, remoteClient.Name); |
@@ -702,16 +707,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
702 | // sets itemID so client can show item as 'attached' in inventory | 707 | // sets itemID so client can show item as 'attached' in inventory |
703 | grp.FromItemID = item.ID; | 708 | grp.FromItemID = item.ID; |
704 | 709 | ||
705 | if (m_scene.AddInventoryItem(item)) | ||
706 | { | ||
707 | sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | ||
708 | } | ||
709 | else | ||
710 | { | ||
711 | if (m_dialogModule != null) | ||
712 | m_dialogModule.SendAlertToUser(sp.ControllingClient, "Operation failed"); | ||
713 | } | ||
714 | |||
715 | return item; | 710 | return item; |
716 | } | 711 | } |
717 | 712 | ||
@@ -760,76 +755,75 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
760 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 755 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
761 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc) | 756 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc) |
762 | { | 757 | { |
763 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 758 | if (m_invAccessModule == null) |
764 | if (invAccess != null) | 759 | return null; |
760 | |||
761 | lock (sp.AttachmentsSyncLock) | ||
765 | { | 762 | { |
766 | lock (sp.AttachmentsSyncLock) | 763 | SceneObjectGroup objatt; |
764 | |||
765 | if (itemID != UUID.Zero) | ||
766 | objatt = m_invAccessModule.RezObject(sp.ControllingClient, | ||
767 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
768 | false, false, sp.UUID, true); | ||
769 | else | ||
770 | objatt = m_invAccessModule.RezObject(sp.ControllingClient, | ||
771 | null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
772 | false, false, sp.UUID, true); | ||
773 | |||
774 | // m_log.DebugFormat( | ||
775 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", | ||
776 | // objatt.Name, remoteClient.Name, AttachmentPt); | ||
777 | |||
778 | if (objatt != null) | ||
767 | { | 779 | { |
768 | SceneObjectGroup objatt; | 780 | // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. |
769 | 781 | objatt.HasGroupChanged = false; | |
770 | if (itemID != UUID.Zero) | 782 | bool tainted = false; |
771 | objatt = invAccess.RezObject(sp.ControllingClient, | 783 | if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint) |
772 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | 784 | tainted = true; |
773 | false, false, sp.UUID, true); | ||
774 | else | ||
775 | objatt = invAccess.RezObject(sp.ControllingClient, | ||
776 | null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
777 | false, false, sp.UUID, true); | ||
778 | |||
779 | // m_log.DebugFormat( | ||
780 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", | ||
781 | // objatt.Name, remoteClient.Name, AttachmentPt); | ||
782 | |||
783 | if (objatt != null) | ||
784 | { | ||
785 | // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. | ||
786 | objatt.HasGroupChanged = false; | ||
787 | bool tainted = false; | ||
788 | if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint) | ||
789 | tainted = true; | ||
790 | |||
791 | // This will throw if the attachment fails | ||
792 | try | ||
793 | { | ||
794 | AttachObject(sp, objatt, attachmentPt, false); | ||
795 | } | ||
796 | catch (Exception e) | ||
797 | { | ||
798 | m_log.ErrorFormat( | ||
799 | "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}", | ||
800 | objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace); | ||
801 | |||
802 | // Make sure the object doesn't stick around and bail | ||
803 | sp.RemoveAttachment(objatt); | ||
804 | m_scene.DeleteSceneObject(objatt, false); | ||
805 | return null; | ||
806 | } | ||
807 | |||
808 | if (tainted) | ||
809 | objatt.HasGroupChanged = true; | ||
810 | |||
811 | if (doc != null) | ||
812 | { | ||
813 | objatt.LoadScriptState(doc); | ||
814 | objatt.ResetOwnerChangeFlag(); | ||
815 | } | ||
816 | |||
817 | // Fire after attach, so we don't get messy perms dialogs | ||
818 | // 4 == AttachedRez | ||
819 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | ||
820 | objatt.ResumeScripts(); | ||
821 | |||
822 | // Do this last so that event listeners have access to all the effects of the attachment | ||
823 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID); | ||
824 | 785 | ||
825 | return objatt; | 786 | // This will throw if the attachment fails |
787 | try | ||
788 | { | ||
789 | AttachObject(sp, objatt, attachmentPt, false); | ||
826 | } | 790 | } |
827 | else | 791 | catch (Exception e) |
828 | { | 792 | { |
829 | m_log.WarnFormat( | 793 | m_log.ErrorFormat( |
830 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | 794 | "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}", |
831 | itemID, sp.Name, attachmentPt); | 795 | objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace); |
796 | |||
797 | // Make sure the object doesn't stick around and bail | ||
798 | sp.RemoveAttachment(objatt); | ||
799 | m_scene.DeleteSceneObject(objatt, false); | ||
800 | return null; | ||
832 | } | 801 | } |
802 | |||
803 | if (doc != null) | ||
804 | { | ||
805 | objatt.LoadScriptState(doc); | ||
806 | objatt.ResetOwnerChangeFlag(); | ||
807 | } | ||
808 | |||
809 | if (tainted) | ||
810 | objatt.HasGroupChanged = true; | ||
811 | |||
812 | // Fire after attach, so we don't get messy perms dialogs | ||
813 | // 4 == AttachedRez | ||
814 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | ||
815 | objatt.ResumeScripts(); | ||
816 | |||
817 | // Do this last so that event listeners have access to all the effects of the attachment | ||
818 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID); | ||
819 | |||
820 | return objatt; | ||
821 | } | ||
822 | else | ||
823 | { | ||
824 | m_log.WarnFormat( | ||
825 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | ||
826 | itemID, sp.Name, attachmentPt); | ||
833 | } | 827 | } |
834 | } | 828 | } |
835 | 829 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 42d07fd..5e89eec 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -99,12 +99,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
99 | public void TestAddAttachmentFromGround() | 99 | public void TestAddAttachmentFromGround() |
100 | { | 100 | { |
101 | TestHelpers.InMethod(); | 101 | TestHelpers.InMethod(); |
102 | // log4net.Config.XmlConfigurator.Configure(); | 102 | // TestHelpers.EnableLogging(); |
103 | 103 | ||
104 | AddPresence(); | 104 | AddPresence(); |
105 | string attName = "att"; | 105 | string attName = "att"; |
106 | 106 | ||
107 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup; | 107 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, m_presence.UUID).ParentGroup; |
108 | 108 | ||
109 | m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false); | 109 | m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false); |
110 | 110 | ||
@@ -123,6 +123,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
123 | Assert.That( | 123 | Assert.That( |
124 | m_presence.Appearance.GetAttachpoint(attSo.FromItemID), | 124 | m_presence.Appearance.GetAttachpoint(attSo.FromItemID), |
125 | Is.EqualTo((int)AttachmentPoint.Chest)); | 125 | Is.EqualTo((int)AttachmentPoint.Chest)); |
126 | |||
127 | InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID)); | ||
128 | Assert.That(attachmentItem, Is.Not.Null); | ||
129 | Assert.That(attachmentItem.Name, Is.EqualTo(attName)); | ||
130 | |||
131 | InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(m_presence.UUID, AssetType.Object); | ||
132 | Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID)); | ||
133 | |||
134 | // TestHelpers.DisableLogging(); | ||
126 | } | 135 | } |
127 | 136 | ||
128 | [Test] | 137 | [Test] |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 3728b85..06f27e2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | |||
@@ -415,12 +415,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
415 | 415 | ||
416 | protected override void StoreBackwards(UUID friendID, UUID agentID) | 416 | protected override void StoreBackwards(UUID friendID, UUID agentID) |
417 | { | 417 | { |
418 | Boolean agentIsLocal = true; | 418 | bool agentIsLocal = true; |
419 | Boolean friendIsLocal = true; | 419 | // bool friendIsLocal = true; |
420 | |||
420 | if (UserManagementModule != null) | 421 | if (UserManagementModule != null) |
421 | { | 422 | { |
422 | agentIsLocal = UserManagementModule.IsLocalGridUser(agentID); | 423 | agentIsLocal = UserManagementModule.IsLocalGridUser(agentID); |
423 | friendIsLocal = UserManagementModule.IsLocalGridUser(friendID); | 424 | // friendIsLocal = UserManagementModule.IsLocalGridUser(friendID); |
424 | } | 425 | } |
425 | 426 | ||
426 | // Is the requester a local user? | 427 | // Is the requester a local user? |
@@ -507,7 +508,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
507 | { | 508 | { |
508 | friendUUI = finfo.Friend; | 509 | friendUUI = finfo.Friend; |
509 | theFriendUUID = friendUUI; | 510 | theFriendUUID = friendUUI; |
510 | UUID utmp = UUID.Zero; String url = String.Empty; String first = String.Empty, last = String.Empty, tmp = String.Empty; | 511 | UUID utmp = UUID.Zero; |
512 | string url = String.Empty; | ||
513 | string first = String.Empty; | ||
514 | string last = String.Empty; | ||
515 | |||
511 | // If it's confirming the friendship, we already have the full UUI with the secret | 516 | // If it's confirming the friendship, we already have the full UUI with the secret |
512 | if (Util.ParseUniversalUserIdentifier(theFriendUUID, out utmp, out url, out first, out last, out secret)) | 517 | if (Util.ParseUniversalUserIdentifier(theFriendUUID, out utmp, out url, out first, out last, out secret)) |
513 | { | 518 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index f9e2b2f..5d9d67f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -46,7 +46,30 @@ using Nini.Config; | |||
46 | 46 | ||
47 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | 47 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer |
48 | { | 48 | { |
49 | public class EntityTransferModule : ISharedRegionModule, IEntityTransferModule | 49 | /// <summary> |
50 | /// The possible states that an agent can be in when its being transferred between regions. | ||
51 | /// </summary> | ||
52 | /// <remarks> | ||
53 | /// This is a state machine. | ||
54 | /// | ||
55 | /// [Entry] => Preparing | ||
56 | /// Preparing => { Transferring || CleaningUp || [Exit] } | ||
57 | /// Transferring => { ReceivedAtDestination || CleaningUp } | ||
58 | /// ReceivedAtDestination => CleaningUp | ||
59 | /// CleaningUp => [Exit] | ||
60 | /// | ||
61 | /// In other words, agents normally travel throwing Preparing => Transferring => ReceivedAtDestination => CleaningUp | ||
62 | /// However, any state can transition to CleaningUp if the teleport has failed. | ||
63 | /// </remarks> | ||
64 | enum AgentTransferState | ||
65 | { | ||
66 | Preparing, // The agent is being prepared for transfer | ||
67 | Transferring, // The agent is in the process of being transferred to a destination | ||
68 | ReceivedAtDestination, // The destination has notified us that the agent has been successfully received | ||
69 | CleaningUp // The agent is being changed to child/removed after a transfer | ||
70 | } | ||
71 | |||
72 | public class EntityTransferModule : INonSharedRegionModule, IEntityTransferModule | ||
50 | { | 73 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 74 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 75 | ||
@@ -65,12 +88,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
65 | public bool EnableWaitForCallbackFromTeleportDest { get; set; } | 88 | public bool EnableWaitForCallbackFromTeleportDest { get; set; } |
66 | 89 | ||
67 | protected bool m_Enabled = false; | 90 | protected bool m_Enabled = false; |
68 | protected Scene m_aScene; | 91 | |
69 | protected List<Scene> m_Scenes = new List<Scene>(); | 92 | protected Scene m_scene; |
70 | protected List<UUID> m_agentsInTransit; | 93 | |
94 | private Dictionary<UUID, AgentTransferState> m_agentsInTransit; | ||
95 | |||
71 | private ExpiringCache<UUID, ExpiringCache<ulong, DateTime>> m_bannedRegions = | 96 | private ExpiringCache<UUID, ExpiringCache<ulong, DateTime>> m_bannedRegions = |
72 | new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>(); | 97 | new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>(); |
73 | 98 | ||
99 | private IEventQueue m_eqModule; | ||
100 | |||
74 | #region ISharedRegionModule | 101 | #region ISharedRegionModule |
75 | 102 | ||
76 | public Type ReplaceableInterface | 103 | public Type ReplaceableInterface |
@@ -116,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
116 | MaxTransferDistance = DefaultMaxTransferDistance; | 143 | MaxTransferDistance = DefaultMaxTransferDistance; |
117 | } | 144 | } |
118 | 145 | ||
119 | m_agentsInTransit = new List<UUID>(); | 146 | m_agentsInTransit = new Dictionary<UUID, AgentTransferState>(); |
120 | m_Enabled = true; | 147 | m_Enabled = true; |
121 | } | 148 | } |
122 | 149 | ||
@@ -129,10 +156,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
129 | if (!m_Enabled) | 156 | if (!m_Enabled) |
130 | return; | 157 | return; |
131 | 158 | ||
132 | if (m_aScene == null) | 159 | m_scene = scene; |
133 | m_aScene = scene; | ||
134 | 160 | ||
135 | m_Scenes.Add(scene); | ||
136 | scene.RegisterModuleInterface<IEntityTransferModule>(this); | 161 | scene.RegisterModuleInterface<IEntityTransferModule>(this); |
137 | scene.EventManager.OnNewClient += OnNewClient; | 162 | scene.EventManager.OnNewClient += OnNewClient; |
138 | } | 163 | } |
@@ -143,26 +168,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
143 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 168 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
144 | } | 169 | } |
145 | 170 | ||
146 | public virtual void Close() | 171 | public virtual void Close() {} |
147 | { | ||
148 | if (!m_Enabled) | ||
149 | return; | ||
150 | } | ||
151 | |||
152 | public virtual void RemoveRegion(Scene scene) | ||
153 | { | ||
154 | if (!m_Enabled) | ||
155 | return; | ||
156 | if (scene == m_aScene) | ||
157 | m_aScene = null; | ||
158 | 172 | ||
159 | m_Scenes.Remove(scene); | 173 | public virtual void RemoveRegion(Scene scene) {} |
160 | } | ||
161 | 174 | ||
162 | public virtual void RegionLoaded(Scene scene) | 175 | public virtual void RegionLoaded(Scene scene) |
163 | { | 176 | { |
164 | if (!m_Enabled) | 177 | if (!m_Enabled) |
165 | return; | 178 | return; |
179 | |||
180 | m_eqModule = m_scene.RequestModuleInterface<IEventQueue>(); | ||
166 | } | 181 | } |
167 | 182 | ||
168 | #endregion | 183 | #endregion |
@@ -230,6 +245,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
230 | "[ENTITY TRANSFER MODULE]: Teleport for {0} to {1} within {2}", | 245 | "[ENTITY TRANSFER MODULE]: Teleport for {0} to {1} within {2}", |
231 | sp.Name, position, sp.Scene.RegionInfo.RegionName); | 246 | sp.Name, position, sp.Scene.RegionInfo.RegionName); |
232 | 247 | ||
248 | if (!SetInTransit(sp.UUID)) | ||
249 | { | ||
250 | m_log.DebugFormat( | ||
251 | "[ENTITY TRANSFER MODULE]: Ignoring within region teleport request of {0} {1} to {2} - agent is already in transit.", | ||
252 | sp.Name, sp.UUID, position); | ||
253 | |||
254 | return; | ||
255 | } | ||
256 | |||
233 | // Teleport within the same region | 257 | // Teleport within the same region |
234 | if (IsOutsideRegion(sp.Scene, position) || position.Z < 0) | 258 | if (IsOutsideRegion(sp.Scene, position) || position.Z < 0) |
235 | { | 259 | { |
@@ -258,6 +282,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
258 | position.Z = newPosZ; | 282 | position.Z = newPosZ; |
259 | } | 283 | } |
260 | 284 | ||
285 | UpdateInTransit(sp.UUID, AgentTransferState.Transferring); | ||
286 | |||
261 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 287 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
262 | 288 | ||
263 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 289 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
@@ -265,10 +291,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
265 | sp.Velocity = Vector3.Zero; | 291 | sp.Velocity = Vector3.Zero; |
266 | sp.Teleport(position); | 292 | sp.Teleport(position); |
267 | 293 | ||
294 | UpdateInTransit(sp.UUID, AgentTransferState.ReceivedAtDestination); | ||
295 | |||
268 | foreach (SceneObjectGroup grp in sp.GetAttachments()) | 296 | foreach (SceneObjectGroup grp in sp.GetAttachments()) |
269 | { | 297 | { |
270 | sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT); | 298 | sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT); |
271 | } | 299 | } |
300 | |||
301 | UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); | ||
302 | ResetFromTransit(sp.UUID); | ||
272 | } | 303 | } |
273 | 304 | ||
274 | /// <summary> | 305 | /// <summary> |
@@ -286,7 +317,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
286 | { | 317 | { |
287 | uint x = 0, y = 0; | 318 | uint x = 0, y = 0; |
288 | Utils.LongToUInts(regionHandle, out x, out y); | 319 | Utils.LongToUInts(regionHandle, out x, out y); |
289 | GridRegion reg = m_aScene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y); | 320 | GridRegion reg = m_scene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y); |
290 | 321 | ||
291 | if (reg != null) | 322 | if (reg != null) |
292 | { | 323 | { |
@@ -366,33 +397,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
366 | ScenePresence sp, GridRegion reg, GridRegion finalDestination, | 397 | ScenePresence sp, GridRegion reg, GridRegion finalDestination, |
367 | Vector3 position, Vector3 lookAt, uint teleportFlags) | 398 | Vector3 position, Vector3 lookAt, uint teleportFlags) |
368 | { | 399 | { |
369 | RegionInfo sourceRegion = sp.Scene.RegionInfo; | 400 | // Record that this agent is in transit so that we can prevent simultaneous requests and do later detection |
370 | 401 | // of whether the destination region completes the teleport. | |
371 | if (!IsWithinMaxTeleportDistance(sourceRegion, finalDestination)) | 402 | if (!SetInTransit(sp.UUID)) |
372 | { | 403 | { |
373 | sp.ControllingClient.SendTeleportFailed( | 404 | m_log.DebugFormat( |
374 | string.Format( | 405 | "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.", |
375 | "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way", | 406 | sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); |
376 | finalDestination.RegionName, finalDestination.RegionCoordX, finalDestination.RegionCoordY, | ||
377 | sourceRegion.RegionName, sourceRegion.RegionLocX, sourceRegion.RegionLocY, | ||
378 | MaxTransferDistance)); | ||
379 | 407 | ||
380 | return; | 408 | return; |
381 | } | 409 | } |
382 | 410 | ||
383 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | ||
384 | |||
385 | if (reg == null || finalDestination == null) | 411 | if (reg == null || finalDestination == null) |
386 | { | 412 | { |
387 | sp.ControllingClient.SendTeleportFailed("Unable to locate destination"); | 413 | sp.ControllingClient.SendTeleportFailed("Unable to locate destination"); |
388 | return; | 414 | ResetFromTransit(sp.UUID); |
389 | } | ||
390 | |||
391 | if (!SetInTransit(sp.UUID)) // Avie is already on the way. Caller shouldn't do this. | ||
392 | { | ||
393 | m_log.DebugFormat( | ||
394 | "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.", | ||
395 | sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); | ||
396 | 415 | ||
397 | return; | 416 | return; |
398 | } | 417 | } |
@@ -402,6 +421,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
402 | sp.Name, sp.UUID, sp.Scene.RegionInfo.RegionName, | 421 | sp.Name, sp.UUID, sp.Scene.RegionInfo.RegionName, |
403 | reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); | 422 | reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); |
404 | 423 | ||
424 | RegionInfo sourceRegion = sp.Scene.RegionInfo; | ||
425 | |||
426 | if (!IsWithinMaxTeleportDistance(sourceRegion, finalDestination)) | ||
427 | { | ||
428 | sp.ControllingClient.SendTeleportFailed( | ||
429 | string.Format( | ||
430 | "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way", | ||
431 | finalDestination.RegionName, finalDestination.RegionCoordX, finalDestination.RegionCoordY, | ||
432 | sourceRegion.RegionName, sourceRegion.RegionLocX, sourceRegion.RegionLocY, | ||
433 | MaxTransferDistance)); | ||
434 | |||
435 | ResetFromTransit(sp.UUID); | ||
436 | |||
437 | return; | ||
438 | } | ||
439 | |||
405 | uint newRegionX = (uint)(reg.RegionHandle >> 40); | 440 | uint newRegionX = (uint)(reg.RegionHandle >> 40); |
406 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); | 441 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); |
407 | uint oldRegionX = (uint)(sp.Scene.RegionInfo.RegionHandle >> 40); | 442 | uint oldRegionX = (uint)(sp.Scene.RegionInfo.RegionHandle >> 40); |
@@ -415,15 +450,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
415 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; | 450 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; |
416 | if (endPoint != null && endPoint.Address != null) | 451 | if (endPoint != null && endPoint.Address != null) |
417 | { | 452 | { |
418 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 453 | sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down"); |
419 | // both regions | 454 | ResetFromTransit(sp.UUID); |
420 | if (sp.ParentID != (uint)0) | ||
421 | sp.StandUp(); | ||
422 | 455 | ||
423 | if (!sp.ValidateAttachments()) | 456 | return; |
424 | m_log.DebugFormat( | 457 | } |
425 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for teleport of {0} from {1} to {2}. Continuing.", | 458 | |
426 | sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName); | 459 | if (!sp.ValidateAttachments()) |
460 | m_log.DebugFormat( | ||
461 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for teleport of {0} from {1} to {2}. Continuing.", | ||
462 | sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName); | ||
427 | 463 | ||
428 | // if (!sp.ValidateAttachments()) | 464 | // if (!sp.ValidateAttachments()) |
429 | // { | 465 | // { |
@@ -431,212 +467,219 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
431 | // return; | 467 | // return; |
432 | // } | 468 | // } |
433 | 469 | ||
434 | string reason; | 470 | string reason; |
435 | string version; | 471 | string version; |
436 | if (!m_aScene.SimulationService.QueryAccess( | 472 | if (!m_scene.SimulationService.QueryAccess( |
437 | finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason)) | 473 | finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason)) |
438 | { | 474 | { |
439 | sp.ControllingClient.SendTeleportFailed(reason); | 475 | sp.ControllingClient.SendTeleportFailed(reason); |
440 | ResetFromTransit(sp.UUID); | 476 | ResetFromTransit(sp.UUID); |
441 | 477 | ||
442 | m_log.DebugFormat( | 478 | m_log.DebugFormat( |
443 | "[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because {3}", | 479 | "[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because {3}", |
444 | sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason); | 480 | sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason); |
445 | 481 | ||
446 | return; | 482 | return; |
447 | } | 483 | } |
448 | 484 | ||
449 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version); | 485 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version); |
450 | 486 | ||
451 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 487 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
488 | // both regions | ||
489 | if (sp.ParentID != (uint)0) | ||
490 | sp.StandUp(); | ||
452 | 491 | ||
453 | // the avatar.Close below will clear the child region list. We need this below for (possibly) | 492 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
454 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). | ||
455 | //List<ulong> childRegions = avatar.KnownRegionHandles; | ||
456 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport | ||
457 | // failure at this point (unlike a border crossing failure). So perhaps this can never fail | ||
458 | // once we reach here... | ||
459 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); | ||
460 | 493 | ||
461 | string capsPath = String.Empty; | 494 | // the avatar.Close below will clear the child region list. We need this below for (possibly) |
495 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). | ||
496 | //List<ulong> childRegions = avatar.KnownRegionHandles; | ||
497 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport | ||
498 | // failure at this point (unlike a border crossing failure). So perhaps this can never fail | ||
499 | // once we reach here... | ||
500 | //avatar.Scene.RemoveCapsHandler(avatar.UUID); | ||
462 | 501 | ||
463 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 502 | string capsPath = String.Empty; |
464 | AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); | ||
465 | agentCircuit.startpos = position; | ||
466 | agentCircuit.child = true; | ||
467 | agentCircuit.Appearance = sp.Appearance; | ||
468 | if (currentAgentCircuit != null) | ||
469 | { | ||
470 | agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; | ||
471 | agentCircuit.IPAddress = currentAgentCircuit.IPAddress; | ||
472 | agentCircuit.Viewer = currentAgentCircuit.Viewer; | ||
473 | agentCircuit.Channel = currentAgentCircuit.Channel; | ||
474 | agentCircuit.Mac = currentAgentCircuit.Mac; | ||
475 | agentCircuit.Id0 = currentAgentCircuit.Id0; | ||
476 | } | ||
477 | 503 | ||
478 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) | 504 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
479 | { | 505 | AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); |
480 | // brand new agent, let's create a new caps seed | 506 | agentCircuit.startpos = position; |
481 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 507 | agentCircuit.child = true; |
482 | } | 508 | agentCircuit.Appearance = sp.Appearance; |
509 | if (currentAgentCircuit != null) | ||
510 | { | ||
511 | agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; | ||
512 | agentCircuit.IPAddress = currentAgentCircuit.IPAddress; | ||
513 | agentCircuit.Viewer = currentAgentCircuit.Viewer; | ||
514 | agentCircuit.Channel = currentAgentCircuit.Channel; | ||
515 | agentCircuit.Mac = currentAgentCircuit.Mac; | ||
516 | agentCircuit.Id0 = currentAgentCircuit.Id0; | ||
517 | } | ||
483 | 518 | ||
484 | // Let's create an agent there if one doesn't exist yet. | 519 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) |
485 | bool logout = false; | 520 | { |
486 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) | 521 | // brand new agent, let's create a new caps seed |
487 | { | 522 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); |
488 | sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", reason)); | 523 | } |
489 | ResetFromTransit(sp.UUID); | ||
490 | 524 | ||
491 | m_log.DebugFormat( | 525 | // Let's create an agent there if one doesn't exist yet. |
492 | "[ENTITY TRANSFER MODULE]: Teleport of {0} from {1} to {2} was refused because {3}", | 526 | bool logout = false; |
493 | sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason); | 527 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) |
528 | { | ||
529 | sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", reason)); | ||
530 | ResetFromTransit(sp.UUID); | ||
494 | 531 | ||
495 | return; | 532 | m_log.DebugFormat( |
496 | } | 533 | "[ENTITY TRANSFER MODULE]: Teleport of {0} from {1} to {2} was refused because {3}", |
534 | sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason); | ||
535 | |||
536 | return; | ||
537 | } | ||
497 | 538 | ||
498 | // OK, it got this agent. Let's close some child agents | 539 | // Past this point we have to attempt clean up if the teleport fails, so update transfer state. |
499 | sp.CloseChildAgents(newRegionX, newRegionY); | 540 | UpdateInTransit(sp.UUID, AgentTransferState.Transferring); |
500 | 541 | ||
501 | IClientIPEndpoint ipepClient; | 542 | // OK, it got this agent. Let's close some child agents |
502 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) | 543 | sp.CloseChildAgents(newRegionX, newRegionY); |
544 | |||
545 | IClientIPEndpoint ipepClient; | ||
546 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) | ||
547 | { | ||
548 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); | ||
549 | #region IP Translation for NAT | ||
550 | // Uses ipepClient above | ||
551 | if (sp.ClientView.TryGet(out ipepClient)) | ||
503 | { | 552 | { |
504 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); | 553 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); |
505 | #region IP Translation for NAT | 554 | } |
506 | // Uses ipepClient above | 555 | #endregion |
507 | if (sp.ClientView.TryGet(out ipepClient)) | 556 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); |
508 | { | ||
509 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); | ||
510 | } | ||
511 | #endregion | ||
512 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
513 | 557 | ||
514 | if (eq != null) | 558 | if (m_eqModule != null) |
515 | { | 559 | { |
516 | eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); | 560 | m_eqModule.EnableSimulator(destinationHandle, endPoint, sp.UUID); |
517 | 561 | ||
518 | // ES makes the client send a UseCircuitCode message to the destination, | 562 | // ES makes the client send a UseCircuitCode message to the destination, |
519 | // which triggers a bunch of things there. | 563 | // which triggers a bunch of things there. |
520 | // So let's wait | 564 | // So let's wait |
521 | Thread.Sleep(200); | 565 | Thread.Sleep(200); |
522 | 566 | ||
523 | eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); | 567 | m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); |
524 | 568 | ||
525 | } | ||
526 | else | ||
527 | { | ||
528 | sp.ControllingClient.InformClientOfNeighbour(destinationHandle, endPoint); | ||
529 | } | ||
530 | } | 569 | } |
531 | else | 570 | else |
532 | { | 571 | { |
533 | agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); | 572 | sp.ControllingClient.InformClientOfNeighbour(destinationHandle, endPoint); |
534 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
535 | } | 573 | } |
574 | } | ||
575 | else | ||
576 | { | ||
577 | agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); | ||
578 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
579 | } | ||
536 | 580 | ||
537 | // Let's send a full update of the agent. This is a synchronous call. | 581 | // Let's send a full update of the agent. This is a synchronous call. |
538 | AgentData agent = new AgentData(); | 582 | AgentData agent = new AgentData(); |
539 | sp.CopyTo(agent); | 583 | sp.CopyTo(agent); |
540 | agent.Position = position; | 584 | agent.Position = position; |
541 | SetCallbackURL(agent, sp.Scene.RegionInfo); | 585 | SetCallbackURL(agent, sp.Scene.RegionInfo); |
542 | 586 | ||
543 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Updating agent..."); | 587 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Updating agent..."); |
544 | 588 | ||
545 | if (!UpdateAgent(reg, finalDestination, agent)) | 589 | if (!UpdateAgent(reg, finalDestination, agent)) |
546 | { | 590 | { |
547 | // Region doesn't take it | 591 | // Region doesn't take it |
548 | m_log.WarnFormat( | 592 | m_log.WarnFormat( |
549 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Returning avatar to source region.", | 593 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Returning avatar to source region.", |
550 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); | 594 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); |
551 | 595 | ||
552 | Fail(sp, finalDestination, logout); | 596 | Fail(sp, finalDestination, logout); |
553 | return; | 597 | return; |
554 | } | 598 | } |
555 | 599 | ||
556 | sp.ControllingClient.SendTeleportProgress(teleportFlags | (uint)TeleportFlags.DisableCancel, "sending_dest"); | 600 | sp.ControllingClient.SendTeleportProgress(teleportFlags | (uint)TeleportFlags.DisableCancel, "sending_dest"); |
557 | 601 | ||
558 | m_log.DebugFormat( | 602 | m_log.DebugFormat( |
559 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} from {1} to {2}", | 603 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} from {1} to {2}", |
560 | capsPath, sp.Scene.RegionInfo.RegionName, sp.Name); | 604 | capsPath, sp.Scene.RegionInfo.RegionName, sp.Name); |
561 | 605 | ||
562 | if (eq != null) | 606 | if (m_eqModule != null) |
563 | { | 607 | { |
564 | eq.TeleportFinishEvent(destinationHandle, 13, endPoint, | 608 | m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID); |
565 | 0, teleportFlags, capsPath, sp.UUID); | 609 | } |
566 | } | 610 | else |
567 | else | 611 | { |
568 | { | 612 | sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4, |
569 | sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4, | 613 | teleportFlags, capsPath); |
570 | teleportFlags, capsPath); | 614 | } |
571 | } | ||
572 | 615 | ||
573 | // Let's set this to true tentatively. This does not trigger OnChildAgent | 616 | // Let's set this to true tentatively. This does not trigger OnChildAgent |
574 | sp.IsChildAgent = true; | 617 | sp.IsChildAgent = true; |
575 | 618 | ||
576 | // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which | 619 | // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which |
577 | // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation | 620 | // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation |
578 | // that the client contacted the destination before we close things here. | 621 | // that the client contacted the destination before we close things here. |
579 | if (EnableWaitForCallbackFromTeleportDest && !WaitForCallback(sp.UUID)) | 622 | if (EnableWaitForCallbackFromTeleportDest && !WaitForCallback(sp.UUID)) |
580 | { | 623 | { |
581 | m_log.WarnFormat( | 624 | m_log.WarnFormat( |
582 | "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.", | 625 | "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.", |
583 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); | 626 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); |
584 | 627 | ||
585 | Fail(sp, finalDestination, logout); | 628 | Fail(sp, finalDestination, logout); |
586 | return; | 629 | return; |
587 | } | 630 | } |
588 | 631 | ||
589 | // For backwards compatibility | 632 | UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); |
590 | if (version == "Unknown" || version == string.Empty) | ||
591 | { | ||
592 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it | ||
593 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one..."); | ||
594 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); | ||
595 | } | ||
596 | 633 | ||
597 | // May need to logout or other cleanup | 634 | // For backwards compatibility |
598 | AgentHasMovedAway(sp, logout); | 635 | if (version == "Unknown" || version == string.Empty) |
636 | { | ||
637 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it | ||
638 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one..."); | ||
639 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); | ||
640 | } | ||
599 | 641 | ||
600 | // Well, this is it. The agent is over there. | 642 | // May need to logout or other cleanup |
601 | KillEntity(sp.Scene, sp.LocalId); | 643 | AgentHasMovedAway(sp, logout); |
602 | 644 | ||
603 | // Now let's make it officially a child agent | 645 | // Well, this is it. The agent is over there. |
604 | sp.MakeChildAgent(); | 646 | KillEntity(sp.Scene, sp.LocalId); |
647 | |||
648 | // Now let's make it officially a child agent | ||
649 | sp.MakeChildAgent(); | ||
605 | 650 | ||
606 | // sp.Scene.CleanDroppedAttachments(); | 651 | // sp.Scene.CleanDroppedAttachments(); |
607 | 652 | ||
608 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | 653 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
609 | 654 | ||
610 | if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 655 | if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) |
611 | { | 656 | { |
612 | // We need to delay here because Imprudence viewers, unlike v1 or v3, have a short (<200ms, <500ms) delay before | 657 | // We need to delay here because Imprudence viewers, unlike v1 or v3, have a short (<200ms, <500ms) delay before |
613 | // they regard the new region as the current region after receiving the AgentMovementComplete | 658 | // they regard the new region as the current region after receiving the AgentMovementComplete |
614 | // response. If close is sent before then, it will cause the viewer to quit instead. | 659 | // response. If close is sent before then, it will cause the viewer to quit instead. |
615 | // However, if this delay is longer, then a viewer can teleport back to this region and experience | 660 | // |
616 | // a failure because the old ScenePresence has not yet been cleaned up. | 661 | // This sleep can be increased if necessary. However, whilst it's active, |
617 | Thread.Sleep(2000); | 662 | // an agent cannot teleport back to this region if it has teleported away. |
618 | 663 | Thread.Sleep(2000); | |
619 | sp.Close(); | ||
620 | sp.Scene.IncomingCloseAgent(sp.UUID); | ||
621 | } | ||
622 | else | ||
623 | { | ||
624 | // now we have a child agent in this region. | ||
625 | sp.Reset(); | ||
626 | } | ||
627 | 664 | ||
628 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | 665 | sp.Close(); |
629 | if (sp.Scene.NeedSceneCacheClear(sp.UUID)) | 666 | sp.Scene.IncomingCloseAgent(sp.UUID); |
630 | { | ||
631 | m_log.DebugFormat( | ||
632 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", | ||
633 | sp.UUID); | ||
634 | } | ||
635 | } | 667 | } |
636 | else | 668 | else |
637 | { | 669 | { |
638 | sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down"); | 670 | // now we have a child agent in this region. |
671 | sp.Reset(); | ||
672 | } | ||
673 | |||
674 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | ||
675 | if (sp.Scene.NeedSceneCacheClear(sp.UUID)) | ||
676 | { | ||
677 | m_log.DebugFormat( | ||
678 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", | ||
679 | sp.UUID); | ||
639 | } | 680 | } |
681 | |||
682 | ResetFromTransit(sp.UUID); | ||
640 | } | 683 | } |
641 | 684 | ||
642 | protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout) | 685 | protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout) |
@@ -652,7 +695,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
652 | EnableChildAgents(sp); | 695 | EnableChildAgents(sp); |
653 | 696 | ||
654 | // Finally, kill the agent we just created at the destination. | 697 | // Finally, kill the agent we just created at the destination. |
655 | m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID); | 698 | m_scene.SimulationService.CloseAgent(finalDestination, sp.UUID); |
656 | 699 | ||
657 | sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout); | 700 | sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout); |
658 | } | 701 | } |
@@ -660,7 +703,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
660 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) | 703 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) |
661 | { | 704 | { |
662 | logout = false; | 705 | logout = false; |
663 | bool success = m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); | 706 | bool success = m_scene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); |
664 | 707 | ||
665 | if (success) | 708 | if (success) |
666 | sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); | 709 | sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); |
@@ -670,7 +713,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
670 | 713 | ||
671 | protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent) | 714 | protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent) |
672 | { | 715 | { |
673 | return m_aScene.SimulationService.UpdateAgent(finalDestination, agent); | 716 | return m_scene.SimulationService.UpdateAgent(finalDestination, agent); |
674 | } | 717 | } |
675 | 718 | ||
676 | protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) | 719 | protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) |
@@ -722,7 +765,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
722 | return false; | 765 | return false; |
723 | } | 766 | } |
724 | 767 | ||
725 | |||
726 | #endregion | 768 | #endregion |
727 | 769 | ||
728 | #region Landmark Teleport | 770 | #region Landmark Teleport |
@@ -734,7 +776,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
734 | /// <param name="position"></param> | 776 | /// <param name="position"></param> |
735 | public virtual void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm) | 777 | public virtual void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm) |
736 | { | 778 | { |
737 | GridRegion info = m_aScene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID); | 779 | GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID); |
738 | 780 | ||
739 | if (info == null) | 781 | if (info == null) |
740 | { | 782 | { |
@@ -760,8 +802,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
760 | m_log.DebugFormat( | 802 | m_log.DebugFormat( |
761 | "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId); | 803 | "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId); |
762 | 804 | ||
763 | //OpenSim.Services.Interfaces.PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(client.SessionId); | 805 | //OpenSim.Services.Interfaces.PresenceInfo pinfo = m_scene.PresenceService.GetAgent(client.SessionId); |
764 | GridUserInfo uinfo = m_aScene.GridUserService.GetGridUserInfo(client.AgentId.ToString()); | 806 | GridUserInfo uinfo = m_scene.GridUserService.GetGridUserInfo(client.AgentId.ToString()); |
765 | 807 | ||
766 | if (uinfo != null) | 808 | if (uinfo != null) |
767 | { | 809 | { |
@@ -771,7 +813,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
771 | client.SendTeleportFailed("You don't have a home position set."); | 813 | client.SendTeleportFailed("You don't have a home position set."); |
772 | return false; | 814 | return false; |
773 | } | 815 | } |
774 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); | 816 | GridRegion regionInfo = m_scene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); |
775 | if (regionInfo == null) | 817 | if (regionInfo == null) |
776 | { | 818 | { |
777 | // can't find the Home region: Tell viewer and abort | 819 | // can't find the Home region: Tell viewer and abort |
@@ -1016,107 +1058,123 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1016 | ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, | 1058 | ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, |
1017 | bool isFlying, string version) | 1059 | bool isFlying, string version) |
1018 | { | 1060 | { |
1061 | if (neighbourRegion == null) | ||
1062 | return agent; | ||
1063 | |||
1019 | try | 1064 | try |
1020 | { | 1065 | { |
1066 | SetInTransit(agent.UUID); | ||
1067 | |||
1021 | ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | 1068 | ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); |
1022 | 1069 | ||
1023 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version); | 1070 | m_log.DebugFormat( |
1071 | "[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", | ||
1072 | agent.Firstname, agent.Lastname, neighbourx, neighboury, version); | ||
1024 | 1073 | ||
1025 | Scene m_scene = agent.Scene; | 1074 | Scene m_scene = agent.Scene; |
1026 | |||
1027 | if (neighbourRegion != null) | ||
1028 | { | ||
1029 | if (!agent.ValidateAttachments()) | ||
1030 | m_log.DebugFormat( | ||
1031 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.", | ||
1032 | agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName); | ||
1033 | 1075 | ||
1034 | pos = pos + agent.Velocity; | 1076 | if (!agent.ValidateAttachments()) |
1035 | Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0); | 1077 | m_log.DebugFormat( |
1078 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.", | ||
1079 | agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName); | ||
1036 | 1080 | ||
1037 | agent.RemoveFromPhysicalScene(); | 1081 | pos = pos + agent.Velocity; |
1038 | SetInTransit(agent.UUID); | 1082 | Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0); |
1039 | 1083 | ||
1040 | AgentData cAgent = new AgentData(); | 1084 | agent.RemoveFromPhysicalScene(); |
1041 | agent.CopyTo(cAgent); | ||
1042 | cAgent.Position = pos; | ||
1043 | if (isFlying) | ||
1044 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
1045 | 1085 | ||
1046 | // We don't need the callback anymnore | 1086 | AgentData cAgent = new AgentData(); |
1047 | cAgent.CallbackURI = String.Empty; | 1087 | agent.CopyTo(cAgent); |
1088 | cAgent.Position = pos; | ||
1089 | if (isFlying) | ||
1090 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
1048 | 1091 | ||
1049 | if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) | 1092 | // We don't need the callback anymnore |
1050 | { | 1093 | cAgent.CallbackURI = String.Empty; |
1051 | // region doesn't take it | ||
1052 | ReInstantiateScripts(agent); | ||
1053 | agent.AddToPhysicalScene(isFlying); | ||
1054 | ResetFromTransit(agent.UUID); | ||
1055 | return agent; | ||
1056 | } | ||
1057 | |||
1058 | //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | ||
1059 | agent.ControllingClient.RequestClientInfo(); | ||
1060 | |||
1061 | //m_log.Debug("BEFORE CROSS"); | ||
1062 | //Scene.DumpChildrenSeeds(UUID); | ||
1063 | //DumpKnownRegions(); | ||
1064 | string agentcaps; | ||
1065 | if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) | ||
1066 | { | ||
1067 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", | ||
1068 | neighbourRegion.RegionHandle); | ||
1069 | return agent; | ||
1070 | } | ||
1071 | // No turning back | ||
1072 | agent.IsChildAgent = true; | ||
1073 | 1094 | ||
1074 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); | 1095 | // Beyond this point, extra cleanup is needed beyond removing transit state |
1075 | 1096 | UpdateInTransit(agent.UUID, AgentTransferState.Transferring); | |
1076 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | ||
1077 | 1097 | ||
1078 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | 1098 | if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) |
1079 | if (eq != null) | 1099 | { |
1080 | { | 1100 | // region doesn't take it |
1081 | eq.CrossRegion(neighbourHandle, pos, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint, | 1101 | UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); |
1082 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
1083 | } | ||
1084 | else | ||
1085 | { | ||
1086 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | ||
1087 | capsPath); | ||
1088 | } | ||
1089 | 1102 | ||
1090 | // SUCCESS! | 1103 | ReInstantiateScripts(agent); |
1091 | agent.MakeChildAgent(); | 1104 | agent.AddToPhysicalScene(isFlying); |
1092 | ResetFromTransit(agent.UUID); | 1105 | ResetFromTransit(agent.UUID); |
1093 | 1106 | ||
1094 | // now we have a child agent in this region. Request all interesting data about other (root) agents | 1107 | return agent; |
1095 | agent.SendOtherAgentsAvatarDataToMe(); | 1108 | } |
1096 | agent.SendOtherAgentsAppearanceToMe(); | ||
1097 | 1109 | ||
1098 | // Backwards compatibility. Best effort | 1110 | //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); |
1099 | if (version == "Unknown" || version == string.Empty) | 1111 | agent.ControllingClient.RequestClientInfo(); |
1100 | { | ||
1101 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); | ||
1102 | Thread.Sleep(3000); // wait a little now that we're not waiting for the callback | ||
1103 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | ||
1104 | } | ||
1105 | 1112 | ||
1113 | //m_log.Debug("BEFORE CROSS"); | ||
1114 | //Scene.DumpChildrenSeeds(UUID); | ||
1115 | //DumpKnownRegions(); | ||
1116 | string agentcaps; | ||
1117 | if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) | ||
1118 | { | ||
1119 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", | ||
1120 | neighbourRegion.RegionHandle); | ||
1121 | return agent; | ||
1122 | } | ||
1123 | // No turning back | ||
1124 | agent.IsChildAgent = true; | ||
1106 | 1125 | ||
1107 | // Next, let's close the child agent connections that are too far away. | 1126 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); |
1108 | agent.CloseChildAgents(neighbourx, neighboury); | 1127 | |
1109 | 1128 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | |
1110 | AgentHasMovedAway(agent, false); | 1129 | |
1111 | 1130 | if (m_eqModule != null) | |
1112 | // the user may change their profile information in other region, | 1131 | { |
1113 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 1132 | m_eqModule.CrossRegion( |
1114 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | 1133 | neighbourHandle, pos, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint, |
1115 | if (agent.Scene.NeedSceneCacheClear(agent.UUID)) | 1134 | capsPath, agent.UUID, agent.ControllingClient.SessionId); |
1116 | { | 1135 | } |
1117 | m_log.DebugFormat( | 1136 | else |
1118 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); | 1137 | { |
1119 | } | 1138 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, |
1139 | capsPath); | ||
1140 | } | ||
1141 | |||
1142 | // SUCCESS! | ||
1143 | UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); | ||
1144 | |||
1145 | // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. | ||
1146 | UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); | ||
1147 | |||
1148 | agent.MakeChildAgent(); | ||
1149 | |||
1150 | // FIXME: Possibly this should occur lower down after other commands to close other agents, | ||
1151 | // but not sure yet what the side effects would be. | ||
1152 | ResetFromTransit(agent.UUID); | ||
1153 | |||
1154 | // now we have a child agent in this region. Request all interesting data about other (root) agents | ||
1155 | agent.SendOtherAgentsAvatarDataToMe(); | ||
1156 | agent.SendOtherAgentsAppearanceToMe(); | ||
1157 | |||
1158 | // Backwards compatibility. Best effort | ||
1159 | if (version == "Unknown" || version == string.Empty) | ||
1160 | { | ||
1161 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); | ||
1162 | Thread.Sleep(3000); // wait a little now that we're not waiting for the callback | ||
1163 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | ||
1164 | } | ||
1165 | |||
1166 | // Next, let's close the child agent connections that are too far away. | ||
1167 | agent.CloseChildAgents(neighbourx, neighboury); | ||
1168 | |||
1169 | AgentHasMovedAway(agent, false); | ||
1170 | |||
1171 | // the user may change their profile information in other region, | ||
1172 | // so the userinfo in UserProfileCache is not reliable any more, delete it | ||
1173 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | ||
1174 | if (agent.Scene.NeedSceneCacheClear(agent.UUID)) | ||
1175 | { | ||
1176 | m_log.DebugFormat( | ||
1177 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); | ||
1120 | } | 1178 | } |
1121 | 1179 | ||
1122 | //m_log.Debug("AFTER CROSS"); | 1180 | //m_log.Debug("AFTER CROSS"); |
@@ -1128,11 +1186,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1128 | m_log.ErrorFormat( | 1186 | m_log.ErrorFormat( |
1129 | "[ENTITY TRANSFER MODULE]: Problem crossing user {0} to new region {1} from {2}. Exception {3}{4}", | 1187 | "[ENTITY TRANSFER MODULE]: Problem crossing user {0} to new region {1} from {2}. Exception {3}{4}", |
1130 | agent.Name, neighbourRegion.RegionName, agent.Scene.RegionInfo.RegionName, e.Message, e.StackTrace); | 1188 | agent.Name, neighbourRegion.RegionName, agent.Scene.RegionInfo.RegionName, e.Message, e.StackTrace); |
1189 | |||
1190 | // TODO: Might be worth attempting other restoration here such as reinstantiation of scripts, etc. | ||
1131 | } | 1191 | } |
1132 | 1192 | ||
1133 | return agent; | 1193 | return agent; |
1134 | } | 1194 | } |
1135 | 1195 | ||
1136 | private void CrossAgentToNewRegionCompleted(IAsyncResult iar) | 1196 | private void CrossAgentToNewRegionCompleted(IAsyncResult iar) |
1137 | { | 1197 | { |
1138 | CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState; | 1198 | CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState; |
@@ -1431,8 +1491,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1431 | 1491 | ||
1432 | if (regionAccepted && newAgent) | 1492 | if (regionAccepted && newAgent) |
1433 | { | 1493 | { |
1434 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | 1494 | if (m_eqModule != null) |
1435 | if (eq != null) | ||
1436 | { | 1495 | { |
1437 | #region IP Translation for NAT | 1496 | #region IP Translation for NAT |
1438 | IClientIPEndpoint ipepClient; | 1497 | IClientIPEndpoint ipepClient; |
@@ -1446,8 +1505,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1446 | "and EstablishAgentCommunication with seed cap {4}", | 1505 | "and EstablishAgentCommunication with seed cap {4}", |
1447 | scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath); | 1506 | scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath); |
1448 | 1507 | ||
1449 | eq.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID); | 1508 | m_eqModule.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID); |
1450 | eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); | 1509 | m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); |
1451 | } | 1510 | } |
1452 | else | 1511 | else |
1453 | { | 1512 | { |
@@ -1573,8 +1632,37 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1573 | #region Agent Arrived | 1632 | #region Agent Arrived |
1574 | public void AgentArrivedAtDestination(UUID id) | 1633 | public void AgentArrivedAtDestination(UUID id) |
1575 | { | 1634 | { |
1576 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Agent {0} released", id); | 1635 | lock (m_agentsInTransit) |
1577 | ResetFromTransit(id); | 1636 | { |
1637 | if (!m_agentsInTransit.ContainsKey(id)) | ||
1638 | { | ||
1639 | m_log.WarnFormat( | ||
1640 | "[ENTITY TRANSFER MODULE]: Region {0} received notification of arrival in destination scene of agent {1} but no teleport request is active", | ||
1641 | m_scene.RegionInfo.RegionName, id); | ||
1642 | |||
1643 | return; | ||
1644 | } | ||
1645 | |||
1646 | AgentTransferState currentState = m_agentsInTransit[id]; | ||
1647 | |||
1648 | if (currentState == AgentTransferState.ReceivedAtDestination) | ||
1649 | { | ||
1650 | // An anomoly but don't make this an outright failure - destination region could be overzealous in sending notification. | ||
1651 | m_log.WarnFormat( | ||
1652 | "[ENTITY TRANSFER MODULE]: Region {0} received notification of arrival in destination scene of agent {1} but notification has already previously been received", | ||
1653 | m_scene.RegionInfo.RegionName, id); | ||
1654 | } | ||
1655 | else if (currentState != AgentTransferState.Transferring) | ||
1656 | { | ||
1657 | m_log.ErrorFormat( | ||
1658 | "[ENTITY TRANSFER MODULE]: Region {0} received notification of arrival in destination scene of agent {1} but agent is in transfer state {2}", | ||
1659 | m_scene.RegionInfo.RegionName, id, currentState); | ||
1660 | |||
1661 | return; | ||
1662 | } | ||
1663 | |||
1664 | m_agentsInTransit[id] = AgentTransferState.ReceivedAtDestination; | ||
1665 | } | ||
1578 | } | 1666 | } |
1579 | 1667 | ||
1580 | #endregion | 1668 | #endregion |
@@ -1845,8 +1933,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1845 | //// And the new channel... | 1933 | //// And the new channel... |
1846 | //if (m_interregionCommsOut != null) | 1934 | //if (m_interregionCommsOut != null) |
1847 | // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true); | 1935 | // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true); |
1848 | if (m_aScene.SimulationService != null) | 1936 | if (m_scene.SimulationService != null) |
1849 | successYN = m_aScene.SimulationService.CreateObject(destination, newPosition, grp, true); | 1937 | successYN = m_scene.SimulationService.CreateObject(destination, newPosition, grp, true); |
1850 | 1938 | ||
1851 | if (successYN) | 1939 | if (successYN) |
1852 | { | 1940 | { |
@@ -1925,10 +2013,29 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1925 | 2013 | ||
1926 | #region Misc | 2014 | #region Misc |
1927 | 2015 | ||
1928 | protected bool WaitForCallback(UUID id) | 2016 | private bool WaitForCallback(UUID id) |
1929 | { | 2017 | { |
2018 | lock (m_agentsInTransit) | ||
2019 | { | ||
2020 | if (!IsInTransit(id)) | ||
2021 | throw new Exception( | ||
2022 | string.Format( | ||
2023 | "Asked to wait for destination callback for agent with ID {0} but it is not in transit")); | ||
2024 | |||
2025 | AgentTransferState currentState = m_agentsInTransit[id]; | ||
2026 | |||
2027 | if (currentState != AgentTransferState.Transferring && currentState != AgentTransferState.ReceivedAtDestination) | ||
2028 | throw new Exception( | ||
2029 | string.Format( | ||
2030 | "Asked to wait for destination callback for agent with ID {0} but it is in state {1}", | ||
2031 | currentState)); | ||
2032 | } | ||
2033 | |||
1930 | int count = 200; | 2034 | int count = 200; |
1931 | while (m_agentsInTransit.Contains(id) && count-- > 0) | 2035 | |
2036 | // There should be no race condition here since no other code should be removing the agent transfer or | ||
2037 | // changing the state to another other than Transferring => ReceivedAtDestination. | ||
2038 | while (m_agentsInTransit[id] != AgentTransferState.ReceivedAtDestination && count-- > 0) | ||
1932 | { | 2039 | { |
1933 | // m_log.Debug(" >>> Waiting... " + count); | 2040 | // m_log.Debug(" >>> Waiting... " + count); |
1934 | Thread.Sleep(100); | 2041 | Thread.Sleep(100); |
@@ -1938,17 +2045,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1938 | } | 2045 | } |
1939 | 2046 | ||
1940 | /// <summary> | 2047 | /// <summary> |
1941 | /// Set that an agent is in the process of being teleported. | 2048 | /// Set that an agent is in transit. |
1942 | /// </summary> | 2049 | /// </summary> |
1943 | /// <param name='id'>The ID of the agent being teleported</param> | 2050 | /// <param name='id'>The ID of the agent being teleported</param> |
1944 | /// <returns>true if the agent was not already in transit, false if it was</returns> | 2051 | /// <returns>true if the agent was not already in transit, false if it was</returns> |
1945 | protected bool SetInTransit(UUID id) | 2052 | private bool SetInTransit(UUID id) |
1946 | { | 2053 | { |
1947 | lock (m_agentsInTransit) | 2054 | lock (m_agentsInTransit) |
1948 | { | 2055 | { |
1949 | if (!m_agentsInTransit.Contains(id)) | 2056 | if (!m_agentsInTransit.ContainsKey(id)) |
1950 | { | 2057 | { |
1951 | m_agentsInTransit.Add(id); | 2058 | m_agentsInTransit[id] = AgentTransferState.Preparing; |
1952 | return true; | 2059 | return true; |
1953 | } | 2060 | } |
1954 | } | 2061 | } |
@@ -1957,34 +2064,87 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1957 | } | 2064 | } |
1958 | 2065 | ||
1959 | /// <summary> | 2066 | /// <summary> |
1960 | /// Show whether the given agent is being teleported. | 2067 | /// Updates the state of an agent that is already in transit. |
1961 | /// </summary> | 2068 | /// </summary> |
1962 | /// <returns>true if the agent is in the process of being teleported, false otherwise.</returns> | 2069 | /// <param name='id'></param> |
1963 | /// <param name='id'>The agent ID</para></param> | 2070 | /// <param name='newState'></param> |
1964 | protected bool IsInTransit(UUID id) | 2071 | /// <returns></returns> |
2072 | /// <exception cref='Exception'>Illegal transitions will throw an Exception</exception> | ||
2073 | private void UpdateInTransit(UUID id, AgentTransferState newState) | ||
2074 | { | ||
2075 | lock (m_agentsInTransit) | ||
2076 | { | ||
2077 | // Illegal to try and update an agent that's not actually in transit. | ||
2078 | if (!m_agentsInTransit.ContainsKey(id)) | ||
2079 | throw new Exception(string.Format("Agent with ID {0} is not registered as in transit", id)); | ||
2080 | |||
2081 | AgentTransferState oldState = m_agentsInTransit[id]; | ||
2082 | |||
2083 | bool transitionOkay = false; | ||
2084 | |||
2085 | if (newState == AgentTransferState.CleaningUp && oldState != AgentTransferState.CleaningUp) | ||
2086 | transitionOkay = true; | ||
2087 | else if (newState == AgentTransferState.Transferring && oldState == AgentTransferState.Preparing) | ||
2088 | transitionOkay = true; | ||
2089 | else if (newState == AgentTransferState.ReceivedAtDestination && oldState == AgentTransferState.Transferring) | ||
2090 | transitionOkay = true; | ||
2091 | |||
2092 | if (transitionOkay) | ||
2093 | m_agentsInTransit[id] = newState; | ||
2094 | else | ||
2095 | throw new Exception( | ||
2096 | string.Format( | ||
2097 | "Agent with ID {0} is not allowed to move from old transit state {1} to new state {2}", | ||
2098 | id, oldState, newState)); | ||
2099 | } | ||
2100 | } | ||
2101 | |||
2102 | public bool IsInTransit(UUID id) | ||
1965 | { | 2103 | { |
1966 | lock (m_agentsInTransit) | 2104 | lock (m_agentsInTransit) |
1967 | return m_agentsInTransit.Contains(id); | 2105 | return m_agentsInTransit.ContainsKey(id); |
1968 | } | 2106 | } |
1969 | 2107 | ||
1970 | /// <summary> | 2108 | /// <summary> |
1971 | /// Set that an agent is no longer being teleported. | 2109 | /// Removes an agent from the transit state machine. |
1972 | /// </summary> | 2110 | /// </summary> |
1973 | /// <returns></returns> | 2111 | /// <param name='id'></param> |
1974 | /// <param name='id'> | 2112 | /// <returns>true if the agent was flagged as being teleported when this method was called, false otherwise</returns> |
1975 | /// true if the agent was flagged as being teleported when this method was called, false otherwise | 2113 | private bool ResetFromTransit(UUID id) |
1976 | /// </param> | ||
1977 | protected bool ResetFromTransit(UUID id) | ||
1978 | { | 2114 | { |
1979 | lock (m_agentsInTransit) | 2115 | lock (m_agentsInTransit) |
1980 | { | 2116 | { |
1981 | if (m_agentsInTransit.Contains(id)) | 2117 | if (m_agentsInTransit.ContainsKey(id)) |
1982 | { | 2118 | { |
2119 | AgentTransferState state = m_agentsInTransit[id]; | ||
2120 | |||
2121 | if (state == AgentTransferState.Transferring || state == AgentTransferState.ReceivedAtDestination) | ||
2122 | { | ||
2123 | // FIXME: For now, we allow exit from any state since a thrown exception in teleport is now guranteed | ||
2124 | // to be handled properly - ResetFromTransit() could be invoked at any step along the process | ||
2125 | m_log.WarnFormat( | ||
2126 | "[ENTITY TRANSFER MODULE]: Agent with ID should not exit directly from state {1}, should go to {2} state first", | ||
2127 | state, AgentTransferState.CleaningUp); | ||
2128 | |||
2129 | // throw new Exception( | ||
2130 | // "Agent with ID {0} cannot exit directly from state {1}, it must go to {2} state first", | ||
2131 | // state, AgentTransferState.CleaningUp); | ||
2132 | } | ||
2133 | |||
1983 | m_agentsInTransit.Remove(id); | 2134 | m_agentsInTransit.Remove(id); |
2135 | |||
2136 | m_log.DebugFormat( | ||
2137 | "[ENTITY TRANSFER MODULE]: Agent {0} cleared from transit in {1}", | ||
2138 | id, m_scene.RegionInfo.RegionName); | ||
2139 | |||
1984 | return true; | 2140 | return true; |
1985 | } | 2141 | } |
1986 | } | 2142 | } |
1987 | 2143 | ||
2144 | m_log.WarnFormat( | ||
2145 | "[ENTITY TRANSFER MODULE]: Agent {0} requested to clear from transit in {1} but was already cleared.", | ||
2146 | id, m_scene.RegionInfo.RegionName); | ||
2147 | |||
1988 | return false; | 2148 | return false; |
1989 | } | 2149 | } |
1990 | 2150 | ||
@@ -2015,4 +2175,4 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2015 | #endregion | 2175 | #endregion |
2016 | 2176 | ||
2017 | } | 2177 | } |
2018 | } \ No newline at end of file | 2178 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 6e27299..44ea2b1 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -45,11 +45,11 @@ using Nini.Config; | |||
45 | 45 | ||
46 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | 46 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer |
47 | { | 47 | { |
48 | public class HGEntityTransferModule : EntityTransferModule, ISharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule | 48 | public class HGEntityTransferModule |
49 | : EntityTransferModule, INonSharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule | ||
49 | { | 50 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 52 | ||
52 | private bool m_Initialized = false; | ||
53 | private int m_levelHGTeleport = 0; | 53 | private int m_levelHGTeleport = 0; |
54 | 54 | ||
55 | private GatekeeperServiceConnector m_GatekeeperConnector; | 55 | private GatekeeperServiceConnector m_GatekeeperConnector; |
@@ -64,6 +64,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
64 | public override void Initialise(IConfigSource source) | 64 | public override void Initialise(IConfigSource source) |
65 | { | 65 | { |
66 | IConfig moduleConfig = source.Configs["Modules"]; | 66 | IConfig moduleConfig = source.Configs["Modules"]; |
67 | |||
67 | if (moduleConfig != null) | 68 | if (moduleConfig != null) |
68 | { | 69 | { |
69 | string name = moduleConfig.GetString("EntityTransferModule", ""); | 70 | string name = moduleConfig.GetString("EntityTransferModule", ""); |
@@ -82,10 +83,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
82 | public override void AddRegion(Scene scene) | 83 | public override void AddRegion(Scene scene) |
83 | { | 84 | { |
84 | base.AddRegion(scene); | 85 | base.AddRegion(scene); |
86 | |||
85 | if (m_Enabled) | 87 | if (m_Enabled) |
86 | { | ||
87 | scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); | 88 | scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); |
88 | } | ||
89 | } | 89 | } |
90 | 90 | ||
91 | protected override void OnNewClient(IClientAPI client) | 91 | protected override void OnNewClient(IClientAPI client) |
@@ -98,33 +98,28 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
98 | public override void RegionLoaded(Scene scene) | 98 | public override void RegionLoaded(Scene scene) |
99 | { | 99 | { |
100 | base.RegionLoaded(scene); | 100 | base.RegionLoaded(scene); |
101 | if (m_Enabled) | ||
102 | if (!m_Initialized) | ||
103 | { | ||
104 | m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService); | ||
105 | m_Initialized = true; | ||
106 | |||
107 | } | ||
108 | 101 | ||
102 | if (m_Enabled) | ||
103 | m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService); | ||
109 | } | 104 | } |
105 | |||
110 | public override void RemoveRegion(Scene scene) | 106 | public override void RemoveRegion(Scene scene) |
111 | { | 107 | { |
112 | base.AddRegion(scene); | 108 | base.AddRegion(scene); |
109 | |||
113 | if (m_Enabled) | 110 | if (m_Enabled) |
114 | { | ||
115 | scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this); | 111 | scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this); |
116 | } | ||
117 | } | 112 | } |
118 | 113 | ||
119 | |||
120 | #endregion | 114 | #endregion |
121 | 115 | ||
122 | #region HG overrides of IEntiryTransferModule | 116 | #region HG overrides of IEntiryTransferModule |
123 | 117 | ||
124 | protected override GridRegion GetFinalDestination(GridRegion region) | 118 | protected override GridRegion GetFinalDestination(GridRegion region) |
125 | { | 119 | { |
126 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, region.RegionID); | 120 | int flags = m_scene.GridService.GetRegionFlags(m_scene.RegionInfo.ScopeID, region.RegionID); |
127 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags); | 121 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags); |
122 | |||
128 | if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) | 123 | if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) |
129 | { | 124 | { |
130 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); | 125 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); |
@@ -135,6 +130,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
135 | m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: GetHyperlinkRegion to Gatekeeper {0} failed", region.ServerURI); | 130 | m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: GetHyperlinkRegion to Gatekeeper {0} failed", region.ServerURI); |
136 | return real_destination; | 131 | return real_destination; |
137 | } | 132 | } |
133 | |||
138 | return region; | 134 | return region; |
139 | } | 135 | } |
140 | 136 | ||
@@ -143,7 +139,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
143 | if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 139 | if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) |
144 | return true; | 140 | return true; |
145 | 141 | ||
146 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); | 142 | int flags = m_scene.GridService.GetRegionFlags(m_scene.RegionInfo.ScopeID, reg.RegionID); |
147 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) | 143 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) |
148 | return true; | 144 | return true; |
149 | 145 | ||
@@ -156,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
156 | if (logout) | 152 | if (logout) |
157 | { | 153 | { |
158 | // Log them out of this grid | 154 | // Log them out of this grid |
159 | m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | 155 | m_scene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
160 | } | 156 | } |
161 | } | 157 | } |
162 | 158 | ||
@@ -165,7 +161,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
165 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI); | 161 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI); |
166 | reason = string.Empty; | 162 | reason = string.Empty; |
167 | logout = false; | 163 | logout = false; |
168 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); | 164 | int flags = m_scene.GridService.GetRegionFlags(m_scene.RegionInfo.ScopeID, reg.RegionID); |
169 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) | 165 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) |
170 | { | 166 | { |
171 | // this user is going to another grid | 167 | // this user is going to another grid |
@@ -210,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
210 | "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId); | 206 | "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId); |
211 | 207 | ||
212 | // Let's find out if this is a foreign user or a local user | 208 | // Let's find out if this is a foreign user or a local user |
213 | IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>(); | 209 | IUserManagement uMan = m_scene.RequestModuleInterface<IUserManagement>(); |
214 | if (uMan != null && uMan.IsLocalGridUser(id)) | 210 | if (uMan != null && uMan.IsLocalGridUser(id)) |
215 | { | 211 | { |
216 | // local grid user | 212 | // local grid user |
@@ -265,19 +261,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
265 | { | 261 | { |
266 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}", | 262 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}", |
267 | (lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position); | 263 | (lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position); |
264 | |||
268 | if (lm.Gatekeeper == string.Empty) | 265 | if (lm.Gatekeeper == string.Empty) |
269 | { | 266 | { |
270 | base.RequestTeleportLandmark(remoteClient, lm); | 267 | base.RequestTeleportLandmark(remoteClient, lm); |
271 | return; | 268 | return; |
272 | } | 269 | } |
273 | 270 | ||
274 | GridRegion info = m_aScene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID); | 271 | GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID); |
275 | 272 | ||
276 | // Local region? | 273 | // Local region? |
277 | if (info != null) | 274 | if (info != null) |
278 | { | 275 | { |
279 | ((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position, | 276 | ((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position, |
280 | Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); | 277 | Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); |
278 | |||
281 | return; | 279 | return; |
282 | } | 280 | } |
283 | else | 281 | else |
@@ -288,6 +286,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
288 | GridRegion gatekeeper = new GridRegion(); | 286 | GridRegion gatekeeper = new GridRegion(); |
289 | gatekeeper.ServerURI = lm.Gatekeeper; | 287 | gatekeeper.ServerURI = lm.Gatekeeper; |
290 | GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID)); | 288 | GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID)); |
289 | |||
291 | if (finalDestination != null) | 290 | if (finalDestination != null) |
292 | { | 291 | { |
293 | ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId); | 292 | ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId); |
@@ -317,8 +316,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
317 | IUserAgentService security = new UserAgentServiceConnector(url); | 316 | IUserAgentService security = new UserAgentServiceConnector(url); |
318 | return security.VerifyClient(aCircuit.SessionID, token); | 317 | return security.VerifyClient(aCircuit.SessionID, token); |
319 | } | 318 | } |
320 | else | 319 | else |
321 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent {0} {1} does not have a HomeURI OH NO!", aCircuit.firstname, aCircuit.lastname); | 320 | { |
321 | m_log.DebugFormat( | ||
322 | "[HG ENTITY TRANSFER MODULE]: Agent {0} {1} does not have a HomeURI OH NO!", | ||
323 | aCircuit.firstname, aCircuit.lastname); | ||
324 | } | ||
322 | 325 | ||
323 | return false; | 326 | return false; |
324 | } | 327 | } |
@@ -335,8 +338,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
335 | } | 338 | } |
336 | 339 | ||
337 | // Let's find out if this is a foreign user or a local user | 340 | // Let's find out if this is a foreign user or a local user |
338 | IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>(); | 341 | IUserManagement uMan = m_scene.RequestModuleInterface<IUserManagement>(); |
339 | UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId); | 342 | // UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, obj.AgentId); |
340 | if (uMan != null && uMan.IsLocalGridUser(obj.AgentId)) | 343 | if (uMan != null && uMan.IsLocalGridUser(obj.AgentId)) |
341 | { | 344 | { |
342 | // local grid user | 345 | // local grid user |
@@ -359,7 +362,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
359 | 362 | ||
360 | #endregion | 363 | #endregion |
361 | 364 | ||
362 | |||
363 | private GridRegion MakeRegion(AgentCircuitData aCircuit) | 365 | private GridRegion MakeRegion(AgentCircuitData aCircuit) |
364 | { | 366 | { |
365 | GridRegion region = new GridRegion(); | 367 | GridRegion region = new GridRegion(); |
@@ -376,6 +378,5 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
376 | region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); | 378 | region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); |
377 | return region; | 379 | return region; |
378 | } | 380 | } |
379 | |||
380 | } | 381 | } |
381 | } | 382 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index a71584a..cf72b58 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -364,8 +364,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
364 | { | 364 | { |
365 | m_log.DebugFormat("[HG INVENTORY ACCESS MODULE]: Changing root inventory for user {0}", client.Name); | 365 | m_log.DebugFormat("[HG INVENTORY ACCESS MODULE]: Changing root inventory for user {0}", client.Name); |
366 | InventoryCollection content = m_Scene.InventoryService.GetFolderContent(client.AgentId, root.ID); | 366 | InventoryCollection content = m_Scene.InventoryService.GetFolderContent(client.AgentId, root.ID); |
367 | List<UUID> fids = new List<UUID>(); | 367 | |
368 | List<UUID> iids = new List<UUID>(); | ||
369 | List<InventoryFolderBase> keep = new List<InventoryFolderBase>(); | 368 | List<InventoryFolderBase> keep = new List<InventoryFolderBase>(); |
370 | 369 | ||
371 | foreach (InventoryFolderBase f in content.Folders) | 370 | foreach (InventoryFolderBase f in content.Folders) |
@@ -395,4 +394,4 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
395 | 394 | ||
396 | #endregion | 395 | #endregion |
397 | } | 396 | } |
398 | } | 397 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index ee9961f..31820e0 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -175,7 +175,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
175 | sbyte assetType, | 175 | sbyte assetType, |
176 | byte wearableType, uint nextOwnerMask, int creationDate) | 176 | byte wearableType, uint nextOwnerMask, int creationDate) |
177 | { | 177 | { |
178 | m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item {0} in folder {1}", name, folderID); | 178 | m_log.DebugFormat("[INVENTORY ACCESS MODULE]: Received request to create inventory item {0} in folder {1}", name, folderID); |
179 | 179 | ||
180 | if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) | 180 | if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) |
181 | return; | 181 | return; |
@@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
210 | else | 210 | else |
211 | { | 211 | { |
212 | m_log.ErrorFormat( | 212 | m_log.ErrorFormat( |
213 | "ScenePresence for agent uuid {0} unexpectedly not found in CreateNewInventoryItem", | 213 | "[INVENTORY ACCESS MODULE]: ScenePresence for agent uuid {0} unexpectedly not found in CreateNewInventoryItem", |
214 | remoteClient.AgentId); | 214 | remoteClient.AgentId); |
215 | } | 215 | } |
216 | } | 216 | } |
@@ -288,16 +288,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
288 | else | 288 | else |
289 | { | 289 | { |
290 | m_log.ErrorFormat( | 290 | m_log.ErrorFormat( |
291 | "[AGENT INVENTORY]: Could not find item {0} for caps inventory update", | 291 | "[INVENTORY ACCESS MODULE]: Could not find item {0} for caps inventory update", |
292 | itemID); | 292 | itemID); |
293 | } | 293 | } |
294 | 294 | ||
295 | return UUID.Zero; | 295 | return UUID.Zero; |
296 | } | 296 | } |
297 | 297 | ||
298 | public virtual UUID CopyToInventory(DeRezAction action, UUID folderID, | 298 | public virtual List<InventoryItemBase> CopyToInventory( |
299 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient) | 299 | DeRezAction action, UUID folderID, |
300 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment) | ||
300 | { | 301 | { |
302 | List<InventoryItemBase> copiedItems = new List<InventoryItemBase>(); | ||
303 | |||
301 | Dictionary<UUID, List<SceneObjectGroup>> bundlesToCopy = new Dictionary<UUID, List<SceneObjectGroup>>(); | 304 | Dictionary<UUID, List<SceneObjectGroup>> bundlesToCopy = new Dictionary<UUID, List<SceneObjectGroup>>(); |
302 | 305 | ||
303 | if (CoalesceMultipleObjectsToInventory) | 306 | if (CoalesceMultipleObjectsToInventory) |
@@ -324,16 +327,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
324 | } | 327 | } |
325 | } | 328 | } |
326 | 329 | ||
327 | // This is method scoped and will be returned. It will be the | 330 | // m_log.DebugFormat( |
328 | // last created asset id | 331 | // "[INVENTORY ACCESS MODULE]: Copying {0} object bundles to folder {1} action {2} for {3}", |
329 | UUID assetID = UUID.Zero; | 332 | // bundlesToCopy.Count, folderID, action, remoteClient.Name); |
330 | 333 | ||
331 | // Each iteration is really a separate asset being created, | 334 | // Each iteration is really a separate asset being created, |
332 | // with distinct destinations as well. | 335 | // with distinct destinations as well. |
333 | foreach (List<SceneObjectGroup> bundle in bundlesToCopy.Values) | 336 | foreach (List<SceneObjectGroup> bundle in bundlesToCopy.Values) |
334 | assetID = CopyBundleToInventory(action, folderID, bundle, remoteClient); | 337 | copiedItems.Add(CopyBundleToInventory(action, folderID, bundle, remoteClient, asAttachment)); |
335 | 338 | ||
336 | return assetID; | 339 | return copiedItems; |
337 | } | 340 | } |
338 | 341 | ||
339 | /// <summary> | 342 | /// <summary> |
@@ -344,12 +347,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
344 | /// <param name="folderID"></param> | 347 | /// <param name="folderID"></param> |
345 | /// <param name="objlist"></param> | 348 | /// <param name="objlist"></param> |
346 | /// <param name="remoteClient"></param> | 349 | /// <param name="remoteClient"></param> |
347 | /// <returns></returns> | 350 | /// <param name="asAttachment">Should be true if the bundle is being copied as an attachment. This prevents |
348 | protected UUID CopyBundleToInventory( | 351 | /// attempted serialization of any script state which would abort any operating scripts.</param> |
349 | DeRezAction action, UUID folderID, List<SceneObjectGroup> objlist, IClientAPI remoteClient) | 352 | /// <returns>The inventory item created by the copy</returns> |
353 | protected InventoryItemBase CopyBundleToInventory( | ||
354 | DeRezAction action, UUID folderID, List<SceneObjectGroup> objlist, IClientAPI remoteClient, | ||
355 | bool asAttachment) | ||
350 | { | 356 | { |
351 | UUID assetID = UUID.Zero; | ||
352 | |||
353 | CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero); | 357 | CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero); |
354 | Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>(); | 358 | Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>(); |
355 | 359 | ||
@@ -401,18 +405,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
401 | 405 | ||
402 | string itemXml; | 406 | string itemXml; |
403 | 407 | ||
408 | // If we're being called from a script, then trying to serialize that same script's state will not complete | ||
409 | // in any reasonable time period. Therefore, we'll avoid it. The worst that can happen is that if | ||
410 | // the client/server crashes rather than logging out normally, the attachment's scripts will resume | ||
411 | // without state on relog. Arguably, this is what we want anyway. | ||
404 | if (objlist.Count > 1) | 412 | if (objlist.Count > 1) |
405 | itemXml = CoalescedSceneObjectsSerializer.ToXml(coa); | 413 | itemXml = CoalescedSceneObjectsSerializer.ToXml(coa, !asAttachment); |
406 | else | 414 | else |
407 | itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0]); | 415 | itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0], !asAttachment); |
408 | 416 | ||
409 | // Restore the position of each group now that it has been stored to inventory. | 417 | // Restore the position of each group now that it has been stored to inventory. |
410 | foreach (SceneObjectGroup objectGroup in objlist) | 418 | foreach (SceneObjectGroup objectGroup in objlist) |
411 | objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; | 419 | objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; |
412 | 420 | ||
413 | InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID); | 421 | InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID); |
422 | |||
423 | // m_log.DebugFormat( | ||
424 | // "[INVENTORY ACCESS MODULE]: Created item is {0}", | ||
425 | // item != null ? item.ID.ToString() : "NULL"); | ||
426 | |||
414 | if (item == null) | 427 | if (item == null) |
415 | return UUID.Zero; | 428 | return null; |
416 | 429 | ||
417 | // Can't know creator is the same, so null it in inventory | 430 | // Can't know creator is the same, so null it in inventory |
418 | if (objlist.Count > 1) | 431 | if (objlist.Count > 1) |
@@ -422,7 +435,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
422 | } | 435 | } |
423 | else | 436 | else |
424 | { | 437 | { |
425 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | 438 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); |
439 | item.CreatorData = objlist[0].RootPart.CreatorData; | ||
426 | item.SaleType = objlist[0].RootPart.ObjectSaleType; | 440 | item.SaleType = objlist[0].RootPart.ObjectSaleType; |
427 | item.SalePrice = objlist[0].RootPart.SalePrice; | 441 | item.SalePrice = objlist[0].RootPart.SalePrice; |
428 | } | 442 | } |
@@ -435,8 +449,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
435 | objlist[0].OwnerID.ToString()); | 449 | objlist[0].OwnerID.ToString()); |
436 | m_Scene.AssetService.Store(asset); | 450 | m_Scene.AssetService.Store(asset); |
437 | 451 | ||
438 | item.AssetID = asset.FullID; | 452 | item.AssetID = asset.FullID; |
439 | assetID = asset.FullID; | ||
440 | 453 | ||
441 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | 454 | if (DeRezAction.SaveToExistingUserInventoryItem == action) |
442 | { | 455 | { |
@@ -469,9 +482,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
469 | 482 | ||
470 | // This is a hook to do some per-asset post-processing for subclasses that need that | 483 | // This is a hook to do some per-asset post-processing for subclasses that need that |
471 | if (remoteClient != null) | 484 | if (remoteClient != null) |
472 | ExportAsset(remoteClient.AgentId, assetID); | 485 | ExportAsset(remoteClient.AgentId, asset.FullID); |
473 | 486 | ||
474 | return assetID; | 487 | return item; |
475 | } | 488 | } |
476 | 489 | ||
477 | protected virtual void ExportAsset(UUID agentID, UUID assetID) | 490 | protected virtual void ExportAsset(UUID agentID, UUID assetID) |
@@ -617,7 +630,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
617 | if (null == item) | 630 | if (null == item) |
618 | { | 631 | { |
619 | m_log.DebugFormat( | 632 | m_log.DebugFormat( |
620 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | 633 | "[INVENTORY ACCESS MODULE]: Object {0} {1} scheduled for save to inventory has already been deleted.", |
621 | so.Name, so.UUID); | 634 | so.Name, so.UUID); |
622 | 635 | ||
623 | return null; | 636 | return null; |
@@ -668,7 +681,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
668 | { | 681 | { |
669 | // Catch all. Use lost & found | 682 | // Catch all. Use lost & found |
670 | // | 683 | // |
671 | |||
672 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 684 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
673 | } | 685 | } |
674 | } | 686 | } |
@@ -718,7 +730,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
718 | 730 | ||
719 | if (item == null) | 731 | if (item == null) |
720 | { | 732 | { |
721 | |||
722 | return null; | 733 | return null; |
723 | } | 734 | } |
724 | 735 | ||
@@ -748,7 +759,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
748 | else | 759 | else |
749 | { | 760 | { |
750 | m_log.WarnFormat( | 761 | m_log.WarnFormat( |
751 | "[InventoryAccessModule]: Could not find asset {0} for {1} in RezObject()", | 762 | "[INVENTORY ACCESS MODULE]: Could not find asset {0} for {1} in RezObject()", |
752 | assetID, remoteClient.Name); | 763 | assetID, remoteClient.Name); |
753 | } | 764 | } |
754 | 765 | ||
@@ -859,7 +870,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
859 | SceneObjectPart rootPart = group.RootPart; | 870 | SceneObjectPart rootPart = group.RootPart; |
860 | 871 | ||
861 | // m_log.DebugFormat( | 872 | // m_log.DebugFormat( |
862 | // "[InventoryAccessModule]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", | 873 | // "[INVENTORY ACCESS MODULE]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", |
863 | // group.Name, group.LocalId, group.UUID, | 874 | // group.Name, group.LocalId, group.UUID, |
864 | // group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask, | 875 | // group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask, |
865 | // remoteClient.Name); | 876 | // remoteClient.Name); |
@@ -867,7 +878,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
867 | // Vector3 storedPosition = group.AbsolutePosition; | 878 | // Vector3 storedPosition = group.AbsolutePosition; |
868 | if (group.UUID == UUID.Zero) | 879 | if (group.UUID == UUID.Zero) |
869 | { | 880 | { |
870 | m_log.Debug("[InventoryAccessModule]: Object has UUID.Zero! Position 3"); | 881 | m_log.Debug("[INVENTORY ACCESS MODULE]: Object has UUID.Zero! Position 3"); |
871 | } | 882 | } |
872 | 883 | ||
873 | foreach (SceneObjectPart part in group.Parts) | 884 | foreach (SceneObjectPart part in group.Parts) |
@@ -928,7 +939,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
928 | } | 939 | } |
929 | 940 | ||
930 | // m_log.DebugFormat( | 941 | // m_log.DebugFormat( |
931 | // "[InventoryAccessModule]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", | 942 | // "[INVENTORY ACCESS MODULE]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", |
932 | // group.Name, group.LocalId, group.UUID, | 943 | // group.Name, group.LocalId, group.UUID, |
933 | // group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask, | 944 | // group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask, |
934 | // remoteClient.Name); | 945 | // remoteClient.Name); |
@@ -1023,8 +1034,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1023 | 1034 | ||
1024 | so.FromFolderID = item.Folder; | 1035 | so.FromFolderID = item.Folder; |
1025 | 1036 | ||
1026 | // Console.WriteLine("rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}", | 1037 | // m_log.DebugFormat( |
1027 | // rootPart.OwnerID, item.Owner, item.CurrentPermissions); | 1038 | // "[INVENTORY ACCESS MODULE]: rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}", |
1039 | // rootPart.OwnerID, item.Owner, item.CurrentPermissions); | ||
1028 | 1040 | ||
1029 | if ((rootPart.OwnerID != item.Owner) || | 1041 | if ((rootPart.OwnerID != item.Owner) || |
1030 | (item.CurrentPermissions & 16) != 0 || | 1042 | (item.CurrentPermissions & 16) != 0 || |
@@ -1160,7 +1172,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1160 | if (assetRequestItem.AssetID != requestID) | 1172 | if (assetRequestItem.AssetID != requestID) |
1161 | { | 1173 | { |
1162 | m_log.WarnFormat( | 1174 | m_log.WarnFormat( |
1163 | "[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}", | 1175 | "[INVENTORY ACCESS MODULE]: {0} requested asset {1} from item {2} but this does not match item's asset {3}", |
1164 | Name, requestID, itemID, assetRequestItem.AssetID); | 1176 | Name, requestID, itemID, assetRequestItem.AssetID); |
1165 | 1177 | ||
1166 | return false; | 1178 | return false; |
diff --git a/OpenSim/Region/CoreModules/LightShare/EnvironmentModule.cs b/OpenSim/Region/CoreModules/LightShare/EnvironmentModule.cs new file mode 100644 index 0000000..1526886 --- /dev/null +++ b/OpenSim/Region/CoreModules/LightShare/EnvironmentModule.cs | |||
@@ -0,0 +1,224 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Framework.Capabilities; | ||
33 | using OpenSim.Framework.Servers.HttpServer; | ||
34 | using OpenSim.Region.Framework.Interfaces; | ||
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | using log4net; | ||
37 | using Nini.Config; | ||
38 | using Mono.Addins; | ||
39 | |||
40 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
41 | |||
42 | |||
43 | namespace OpenSim.Region.CoreModules.World.LightShare | ||
44 | { | ||
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EnvironmentModule")] | ||
46 | |||
47 | public class EnvironmentModule : INonSharedRegionModule, IEnvironmentModule | ||
48 | { | ||
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | private Scene m_scene = null; | ||
52 | private UUID regionID = UUID.Zero; | ||
53 | private static bool Enabled = false; | ||
54 | |||
55 | private static readonly string capsName = "EnvironmentSettings"; | ||
56 | private static readonly string capsBase = "/CAPS/0020/"; | ||
57 | |||
58 | private LLSDEnvironmentSetResponse setResponse = null; | ||
59 | |||
60 | #region INonSharedRegionModule | ||
61 | public void Initialise(IConfigSource source) | ||
62 | { | ||
63 | IConfig config = source.Configs["ClientStack.LindenCaps"]; | ||
64 | |||
65 | if (null == config) | ||
66 | return; | ||
67 | |||
68 | if (config.GetString("Cap_EnvironmentSettings", String.Empty) != "localhost") | ||
69 | { | ||
70 | m_log.InfoFormat("[{0}]: Module is disabled.", Name); | ||
71 | return; | ||
72 | } | ||
73 | |||
74 | Enabled = true; | ||
75 | |||
76 | m_log.InfoFormat("[{0}]: Module is enabled.", Name); | ||
77 | } | ||
78 | |||
79 | public void Close() | ||
80 | { | ||
81 | } | ||
82 | |||
83 | public string Name | ||
84 | { | ||
85 | get { return "EnvironmentModule"; } | ||
86 | } | ||
87 | |||
88 | public Type ReplaceableInterface | ||
89 | { | ||
90 | get { return null; } | ||
91 | } | ||
92 | |||
93 | public void AddRegion(Scene scene) | ||
94 | { | ||
95 | if (!Enabled) | ||
96 | return; | ||
97 | |||
98 | scene.RegisterModuleInterface<IEnvironmentModule>(this); | ||
99 | m_scene = scene; | ||
100 | regionID = scene.RegionInfo.RegionID; | ||
101 | } | ||
102 | |||
103 | public void RegionLoaded(Scene scene) | ||
104 | { | ||
105 | if (!Enabled) | ||
106 | return; | ||
107 | |||
108 | setResponse = new LLSDEnvironmentSetResponse(); | ||
109 | scene.EventManager.OnRegisterCaps += OnRegisterCaps; | ||
110 | } | ||
111 | |||
112 | public void RemoveRegion(Scene scene) | ||
113 | { | ||
114 | if (Enabled) | ||
115 | return; | ||
116 | |||
117 | scene.EventManager.OnRegisterCaps -= OnRegisterCaps; | ||
118 | m_scene = null; | ||
119 | } | ||
120 | #endregion | ||
121 | |||
122 | #region IEnvironmentModule | ||
123 | public void ResetEnvironmentSettings(UUID regionUUID) | ||
124 | { | ||
125 | if (!Enabled) | ||
126 | return; | ||
127 | |||
128 | m_scene.SimulationDataService.RemoveRegionEnvironmentSettings(regionUUID); | ||
129 | } | ||
130 | #endregion | ||
131 | |||
132 | #region Events | ||
133 | private void OnRegisterCaps(UUID agentID, Caps caps) | ||
134 | { | ||
135 | // m_log.DebugFormat("[{0}]: Register capability for agentID {1} in region {2}", | ||
136 | // Name, agentID, caps.RegionName); | ||
137 | |||
138 | string capsPath = capsBase + UUID.Random(); | ||
139 | |||
140 | // Get handler | ||
141 | caps.RegisterHandler( | ||
142 | capsName, | ||
143 | new RestStreamHandler( | ||
144 | "GET", | ||
145 | capsPath, | ||
146 | (request, path, param, httpRequest, httpResponse) | ||
147 | => GetEnvironmentSettings(request, path, param, agentID, caps), | ||
148 | capsName, | ||
149 | agentID.ToString())); | ||
150 | |||
151 | // Set handler | ||
152 | caps.HttpListener.AddStreamHandler( | ||
153 | new RestStreamHandler( | ||
154 | "POST", | ||
155 | capsPath, | ||
156 | (request, path, param, httpRequest, httpResponse) | ||
157 | => SetEnvironmentSettings(request, path, param, agentID, caps), | ||
158 | capsName, | ||
159 | agentID.ToString())); | ||
160 | } | ||
161 | #endregion | ||
162 | |||
163 | private string GetEnvironmentSettings(string request, string path, string param, | ||
164 | UUID agentID, Caps caps) | ||
165 | { | ||
166 | // m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}", | ||
167 | // Name, agentID, caps.RegionName); | ||
168 | |||
169 | string env = String.Empty; | ||
170 | |||
171 | try | ||
172 | { | ||
173 | env = m_scene.SimulationDataService.LoadRegionEnvironmentSettings(regionID); | ||
174 | } | ||
175 | catch (Exception e) | ||
176 | { | ||
177 | m_log.ErrorFormat("[{0}]: Unable to load environment settings for region {1}, Exception: {2} - {3}", | ||
178 | Name, caps.RegionName, e.Message, e.StackTrace); | ||
179 | } | ||
180 | |||
181 | if (String.IsNullOrEmpty(env)) | ||
182 | env = EnvironmentSettings.EmptySettings(UUID.Zero, regionID); | ||
183 | |||
184 | return env; | ||
185 | } | ||
186 | |||
187 | private string SetEnvironmentSettings(string request, string path, string param, | ||
188 | UUID agentID, Caps caps) | ||
189 | { | ||
190 | |||
191 | // m_log.DebugFormat("[{0}]: Environment SET handle from agentID {1} in region {2}", | ||
192 | // Name, agentID, caps.RegionName); | ||
193 | |||
194 | setResponse.regionID = regionID; | ||
195 | setResponse.success = false; | ||
196 | |||
197 | if (!m_scene.Permissions.CanIssueEstateCommand(agentID, false)) | ||
198 | { | ||
199 | setResponse.fail_reason = "Insufficient estate permissions, settings has not been saved."; | ||
200 | return LLSDHelpers.SerialiseLLSDReply(setResponse); | ||
201 | } | ||
202 | |||
203 | try | ||
204 | { | ||
205 | m_scene.SimulationDataService.StoreRegionEnvironmentSettings(regionID, request); | ||
206 | setResponse.success = true; | ||
207 | |||
208 | m_log.InfoFormat("[{0}]: New Environment settings has been saved from agentID {1} in region {2}", | ||
209 | Name, agentID, caps.RegionName); | ||
210 | } | ||
211 | catch (Exception e) | ||
212 | { | ||
213 | m_log.ErrorFormat("[{0}]: Environment settings has not been saved for region {1}, Exception: {2} - {3}", | ||
214 | Name, caps.RegionName, e.Message, e.StackTrace); | ||
215 | |||
216 | setResponse.success = false; | ||
217 | setResponse.fail_reason = String.Format("Environment Set for region {0} has failed, settings has not been saved.", caps.RegionName); | ||
218 | } | ||
219 | |||
220 | return LLSDHelpers.SerialiseLLSDReply(setResponse); | ||
221 | } | ||
222 | } | ||
223 | } | ||
224 | |||
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 199dd11..1865ab8 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -85,6 +85,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
85 | private IHttpServer m_HttpsServer = null; | 85 | private IHttpServer m_HttpsServer = null; |
86 | 86 | ||
87 | private string m_ExternalHostNameForLSL = ""; | 87 | private string m_ExternalHostNameForLSL = ""; |
88 | public string ExternalHostNameForLSL | ||
89 | { | ||
90 | get { return m_ExternalHostNameForLSL; } | ||
91 | } | ||
88 | 92 | ||
89 | public Type ReplaceableInterface | 93 | public Type ReplaceableInterface |
90 | { | 94 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs index 8df1c7b..a7dd0dd 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs | |||
@@ -122,7 +122,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid | |||
122 | ISimulationService simService = scene.RequestModuleInterface<ISimulationService>(); | 122 | ISimulationService simService = scene.RequestModuleInterface<ISimulationService>(); |
123 | IFriendsSimConnector friendsConn = scene.RequestModuleInterface<IFriendsSimConnector>(); | 123 | IFriendsSimConnector friendsConn = scene.RequestModuleInterface<IFriendsSimConnector>(); |
124 | Object[] args = new Object[] { m_Config }; | 124 | Object[] args = new Object[] { m_Config }; |
125 | IFriendsService friendsService = ServerUtils.LoadPlugin<IFriendsService>(m_LocalServiceDll, args); | 125 | // IFriendsService friendsService = ServerUtils.LoadPlugin<IFriendsService>(m_LocalServiceDll, args) |
126 | ServerUtils.LoadPlugin<IFriendsService>(m_LocalServiceDll, args); | ||
126 | 127 | ||
127 | m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); | 128 | m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); |
128 | 129 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index 8395f83..008465f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | |||
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
149 | 149 | ||
150 | m_aScene = scene; | 150 | m_aScene = scene; |
151 | 151 | ||
152 | scene.RegisterModuleInterface<IAssetService>(this); | 152 | m_aScene.RegisterModuleInterface<IAssetService>(this); |
153 | } | 153 | } |
154 | 154 | ||
155 | public void RemoveRegion(Scene scene) | 155 | public void RemoveRegion(Scene scene) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index de089f3..008992e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | using System; | 27 | using System; |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Linq; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using log4net; | 31 | using log4net; |
31 | using Nini.Config; | 32 | using Nini.Config; |
@@ -41,22 +42,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
41 | public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService | 42 | public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService |
42 | { | 43 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | // Version of this service | ||
45 | private const string m_Version = "SIMULATION/0.1"; | ||
46 | 45 | ||
47 | private List<Scene> m_sceneList = new List<Scene>(); | 46 | /// <summary> |
47 | /// Version of this service | ||
48 | /// </summary> | ||
49 | private const string m_Version = "SIMULATION/0.1"; | ||
48 | 50 | ||
49 | private IEntityTransferModule m_AgentTransferModule; | 51 | /// <summary> |
50 | protected IEntityTransferModule AgentTransferModule | 52 | /// Map region ID to scene. |
51 | { | 53 | /// </summary> |
52 | get | 54 | private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); |
53 | { | ||
54 | if (m_AgentTransferModule == null) | ||
55 | m_AgentTransferModule = m_sceneList[0].RequestModuleInterface<IEntityTransferModule>(); | ||
56 | return m_AgentTransferModule; | ||
57 | } | ||
58 | } | ||
59 | 55 | ||
56 | /// <summary> | ||
57 | /// Is this module enabled? | ||
58 | /// </summary> | ||
60 | private bool m_ModuleEnabled = false; | 59 | private bool m_ModuleEnabled = false; |
61 | 60 | ||
62 | #region IRegionModule | 61 | #region IRegionModule |
@@ -129,12 +128,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
129 | /// <param name="scene"></param> | 128 | /// <param name="scene"></param> |
130 | public void RemoveScene(Scene scene) | 129 | public void RemoveScene(Scene scene) |
131 | { | 130 | { |
132 | lock (m_sceneList) | 131 | lock (m_scenes) |
133 | { | 132 | { |
134 | if (m_sceneList.Contains(scene)) | 133 | if (m_scenes.ContainsKey(scene.RegionInfo.RegionID)) |
135 | { | 134 | m_scenes.Remove(scene.RegionInfo.RegionID); |
136 | m_sceneList.Remove(scene); | 135 | else |
137 | } | 136 | m_log.WarnFormat( |
137 | "[LOCAL SIMULATION CONNECTOR]: Tried to remove region {0} but it was not present", | ||
138 | scene.RegionInfo.RegionName); | ||
138 | } | 139 | } |
139 | } | 140 | } |
140 | 141 | ||
@@ -144,13 +145,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
144 | /// <param name="scene"></param> | 145 | /// <param name="scene"></param> |
145 | public void Init(Scene scene) | 146 | public void Init(Scene scene) |
146 | { | 147 | { |
147 | if (!m_sceneList.Contains(scene)) | 148 | lock (m_scenes) |
148 | { | 149 | { |
149 | lock (m_sceneList) | 150 | if (!m_scenes.ContainsKey(scene.RegionInfo.RegionID)) |
150 | { | 151 | m_scenes[scene.RegionInfo.RegionID] = scene; |
151 | m_sceneList.Add(scene); | 152 | else |
152 | } | 153 | m_log.WarnFormat( |
153 | 154 | "[LOCAL SIMULATION CONNECTOR]: Tried to add region {0} but it is already present", | |
155 | scene.RegionInfo.RegionName); | ||
154 | } | 156 | } |
155 | } | 157 | } |
156 | 158 | ||
@@ -158,15 +160,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
158 | 160 | ||
159 | #region ISimulation | 161 | #region ISimulation |
160 | 162 | ||
161 | public IScene GetScene(ulong regionhandle) | 163 | public IScene GetScene(UUID regionId) |
162 | { | 164 | { |
163 | foreach (Scene s in m_sceneList) | 165 | if (m_scenes.ContainsKey(regionId)) |
164 | { | 166 | { |
165 | if (s.RegionInfo.RegionHandle == regionhandle) | 167 | return m_scenes[regionId]; |
166 | return s; | 168 | } |
169 | else | ||
170 | { | ||
171 | // FIXME: This was pre-existing behaviour but possibly not a good idea, since it hides an error rather | ||
172 | // than making it obvious and fixable. Need to see if the error message comes up in practice. | ||
173 | Scene s = m_scenes.Values.ToArray()[0]; | ||
174 | |||
175 | m_log.ErrorFormat( | ||
176 | "[LOCAL SIMULATION CONNECTOR]: Region with id {0} not found. Returning {1} {2} instead", | ||
177 | regionId, s.RegionInfo.RegionName, s.RegionInfo.RegionID); | ||
178 | |||
179 | return s; | ||
167 | } | 180 | } |
168 | // ? weird. should not happen | ||
169 | return m_sceneList[0]; | ||
170 | } | 181 | } |
171 | 182 | ||
172 | public ISimulationService GetInnerService() | 183 | public ISimulationService GetInnerService() |
@@ -187,13 +198,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
187 | return false; | 198 | return false; |
188 | } | 199 | } |
189 | 200 | ||
190 | foreach (Scene s in m_sceneList) | 201 | if (m_scenes.ContainsKey(destination.RegionID)) |
191 | { | 202 | { |
192 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) | ||
193 | { | ||
194 | // m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName); | 203 | // m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName); |
195 | return s.NewUserConnection(aCircuit, teleportFlags, out reason); | 204 | return m_scenes[destination.RegionID].NewUserConnection(aCircuit, teleportFlags, out reason); |
196 | } | ||
197 | } | 205 | } |
198 | 206 | ||
199 | reason = "Did not find region " + destination.RegionName; | 207 | reason = "Did not find region " + destination.RegionName; |
@@ -205,17 +213,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
205 | if (destination == null) | 213 | if (destination == null) |
206 | return false; | 214 | return false; |
207 | 215 | ||
208 | foreach (Scene s in m_sceneList) | 216 | if (m_scenes.ContainsKey(destination.RegionID)) |
209 | { | 217 | { |
210 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) | ||
211 | { | ||
212 | // m_log.DebugFormat( | 218 | // m_log.DebugFormat( |
213 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", | 219 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
214 | // s.RegionInfo.RegionName, destination.RegionHandle); | 220 | // s.RegionInfo.RegionName, destination.RegionHandle); |
215 | 221 | ||
216 | s.IncomingChildAgentDataUpdate(cAgentData); | 222 | return m_scenes[destination.RegionID].IncomingChildAgentDataUpdate(cAgentData); |
217 | return true; | ||
218 | } | ||
219 | } | 223 | } |
220 | 224 | ||
221 | // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle); | 225 | // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle); |
@@ -231,11 +235,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
231 | // simulator so when we receive the update we need to hand it to each of the | 235 | // simulator so when we receive the update we need to hand it to each of the |
232 | // scenes; scenes each check to see if the is a scene presence for the avatar | 236 | // scenes; scenes each check to see if the is a scene presence for the avatar |
233 | // note that we really don't need the GridRegion for this call | 237 | // note that we really don't need the GridRegion for this call |
234 | foreach (Scene s in m_sceneList) | 238 | foreach (Scene s in m_scenes.Values) |
235 | { | 239 | { |
236 | //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); | 240 | //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); |
237 | s.IncomingChildAgentDataUpdate(cAgentData); | 241 | s.IncomingChildAgentDataUpdate(cAgentData); |
238 | } | 242 | } |
243 | |||
239 | //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); | 244 | //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); |
240 | return true; | 245 | return true; |
241 | } | 246 | } |
@@ -247,14 +252,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
247 | if (destination == null) | 252 | if (destination == null) |
248 | return false; | 253 | return false; |
249 | 254 | ||
250 | foreach (Scene s in m_sceneList) | 255 | if (m_scenes.ContainsKey(destination.RegionID)) |
251 | { | 256 | { |
252 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) | 257 | // m_log.DebugFormat( |
253 | { | 258 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
254 | //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); | 259 | // s.RegionInfo.RegionName, destination.RegionHandle); |
255 | return s.IncomingRetrieveRootAgent(id, out agent); | 260 | |
256 | } | 261 | return m_scenes[destination.RegionID].IncomingRetrieveRootAgent(id, out agent); |
257 | } | 262 | } |
263 | |||
258 | //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); | 264 | //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); |
259 | return false; | 265 | return false; |
260 | } | 266 | } |
@@ -266,59 +272,49 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
266 | if (destination == null) | 272 | if (destination == null) |
267 | return false; | 273 | return false; |
268 | 274 | ||
269 | foreach (Scene s in m_sceneList) | 275 | if (m_scenes.ContainsKey(destination.RegionID)) |
270 | { | 276 | { |
271 | if (s.RegionInfo.RegionID == destination.RegionID) | 277 | // m_log.DebugFormat( |
272 | return s.QueryAccess(id, position, out reason); | 278 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
279 | // s.RegionInfo.RegionName, destination.RegionHandle); | ||
280 | |||
281 | return m_scenes[destination.RegionID].QueryAccess(id, position, out reason); | ||
273 | } | 282 | } |
283 | |||
284 | //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); | ||
274 | return false; | 285 | return false; |
275 | } | 286 | } |
276 | 287 | ||
277 | public bool ReleaseAgent(UUID origin, UUID id, string uri) | 288 | public bool ReleaseAgent(UUID originId, UUID agentId, string uri) |
278 | { | 289 | { |
279 | foreach (Scene s in m_sceneList) | 290 | if (m_scenes.ContainsKey(originId)) |
280 | { | 291 | { |
281 | if (s.RegionInfo.RegionID == origin) | 292 | // m_log.DebugFormat( |
282 | { | 293 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
283 | // m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent"); | 294 | // s.RegionInfo.RegionName, destination.RegionHandle); |
284 | AgentTransferModule.AgentArrivedAtDestination(id); | 295 | |
285 | return true; | 296 | m_scenes[originId].EntityTransferModule.AgentArrivedAtDestination(agentId); |
286 | // return s.IncomingReleaseAgent(id); | 297 | return true; |
287 | } | ||
288 | } | 298 | } |
299 | |||
289 | //m_log.Debug("[LOCAL COMMS]: region not found in SendReleaseAgent " + origin); | 300 | //m_log.Debug("[LOCAL COMMS]: region not found in SendReleaseAgent " + origin); |
290 | return false; | 301 | return false; |
291 | } | 302 | } |
292 | 303 | ||
293 | public bool CloseAgent(GridRegion destination, UUID id) | 304 | public bool CloseChildAgent(GridRegion destination, UUID id) |
294 | { | 305 | { |
295 | if (destination == null) | 306 | return CloseAgent(destination, id); |
296 | return false; | ||
297 | |||
298 | foreach (Scene s in m_sceneList) | ||
299 | { | ||
300 | if (s.RegionInfo.RegionID == destination.RegionID) | ||
301 | { | ||
302 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); | ||
303 | return s.IncomingCloseAgent(id); | ||
304 | } | ||
305 | } | ||
306 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); | ||
307 | return false; | ||
308 | } | 307 | } |
309 | 308 | ||
310 | public bool CloseChildAgent(GridRegion destination, UUID id) | 309 | public bool CloseAgent(GridRegion destination, UUID id) |
311 | { | 310 | { |
312 | if (destination == null) | 311 | if (destination == null) |
313 | return false; | 312 | return false; |
314 | 313 | ||
315 | foreach (Scene s in m_sceneList) | 314 | if (m_scenes.ContainsKey(destination.RegionID)) |
316 | { | 315 | { |
317 | if (s.RegionInfo.RegionID == destination.RegionID) | 316 | Util.FireAndForget(delegate { m_scenes[destination.RegionID].IncomingCloseAgent(id); }); |
318 | { | 317 | return true; |
319 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); | ||
320 | return s.IncomingCloseChildAgent(id); | ||
321 | } | ||
322 | } | 318 | } |
323 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); | 319 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); |
324 | return false; | 320 | return false; |
@@ -333,25 +329,28 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
333 | if (destination == null) | 329 | if (destination == null) |
334 | return false; | 330 | return false; |
335 | 331 | ||
336 | foreach (Scene s in m_sceneList) | 332 | if (m_scenes.ContainsKey(destination.RegionID)) |
337 | { | 333 | { |
338 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) | 334 | // m_log.DebugFormat( |
335 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", | ||
336 | // s.RegionInfo.RegionName, destination.RegionHandle); | ||
337 | |||
338 | Scene s = m_scenes[destination.RegionID]; | ||
339 | |||
340 | if (isLocalCall) | ||
339 | { | 341 | { |
340 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject"); | 342 | // We need to make a local copy of the object |
341 | if (isLocalCall) | 343 | ISceneObject sogClone = sog.CloneForNewScene(); |
342 | { | 344 | sogClone.SetState(sog.GetStateSnapshot(), s); |
343 | // We need to make a local copy of the object | 345 | return s.IncomingCreateObject(newPosition, sogClone); |
344 | ISceneObject sogClone = sog.CloneForNewScene(); | 346 | } |
345 | sogClone.SetState(sog.GetStateSnapshot(), s); | 347 | else |
346 | return s.IncomingCreateObject(newPosition, sogClone); | 348 | { |
347 | } | 349 | // Use the object as it came through the wire |
348 | else | 350 | return s.IncomingCreateObject(newPosition, sog); |
349 | { | ||
350 | // Use the object as it came through the wire | ||
351 | return s.IncomingCreateObject(newPosition, sog); | ||
352 | } | ||
353 | } | 351 | } |
354 | } | 352 | } |
353 | |||
355 | return false; | 354 | return false; |
356 | } | 355 | } |
357 | 356 | ||
@@ -360,13 +359,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
360 | if (destination == null) | 359 | if (destination == null) |
361 | return false; | 360 | return false; |
362 | 361 | ||
363 | foreach (Scene s in m_sceneList) | 362 | if (m_scenes.ContainsKey(destination.RegionID)) |
364 | { | 363 | { |
365 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) | 364 | // m_log.DebugFormat( |
366 | { | 365 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
367 | return s.IncomingCreateObject(userID, itemID); | 366 | // s.RegionInfo.RegionName, destination.RegionHandle); |
368 | } | 367 | |
368 | return m_scenes[destination.RegionID].IncomingCreateObject(userID, itemID); | ||
369 | } | 369 | } |
370 | |||
370 | return false; | 371 | return false; |
371 | } | 372 | } |
372 | 373 | ||
@@ -377,18 +378,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
377 | 378 | ||
378 | public bool IsLocalRegion(ulong regionhandle) | 379 | public bool IsLocalRegion(ulong regionhandle) |
379 | { | 380 | { |
380 | foreach (Scene s in m_sceneList) | 381 | foreach (Scene s in m_scenes.Values) |
381 | if (s.RegionInfo.RegionHandle == regionhandle) | 382 | if (s.RegionInfo.RegionHandle == regionhandle) |
382 | return true; | 383 | return true; |
384 | |||
383 | return false; | 385 | return false; |
384 | } | 386 | } |
385 | 387 | ||
386 | public bool IsLocalRegion(UUID id) | 388 | public bool IsLocalRegion(UUID id) |
387 | { | 389 | { |
388 | foreach (Scene s in m_sceneList) | 390 | return m_scenes.ContainsKey(id); |
389 | if (s.RegionInfo.RegionID == id) | ||
390 | return true; | ||
391 | return false; | ||
392 | } | 391 | } |
393 | 392 | ||
394 | #endregion | 393 | #endregion |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 4b70692..d395413 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -151,9 +151,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
151 | 151 | ||
152 | #region IInterregionComms | 152 | #region IInterregionComms |
153 | 153 | ||
154 | public IScene GetScene(ulong handle) | 154 | public IScene GetScene(UUID regionId) |
155 | { | 155 | { |
156 | return m_localBackend.GetScene(handle); | 156 | return m_localBackend.GetScene(regionId); |
157 | } | 157 | } |
158 | 158 | ||
159 | public ISimulationService GetInnerService() | 159 | public ISimulationService GetInnerService() |
@@ -226,13 +226,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
226 | return m_remoteConnector.RetrieveAgent(destination, id, out agent); | 226 | return m_remoteConnector.RetrieveAgent(destination, id, out agent); |
227 | 227 | ||
228 | return false; | 228 | return false; |
229 | |||
230 | } | 229 | } |
231 | 230 | ||
232 | public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason) | 231 | public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason) |
233 | { | 232 | { |
234 | reason = "Communications failure"; | 233 | reason = "Communications failure"; |
235 | version = "Unknown"; | 234 | version = "Unknown"; |
235 | |||
236 | if (destination == null) | 236 | if (destination == null) |
237 | return false; | 237 | return false; |
238 | 238 | ||
@@ -245,7 +245,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
245 | return m_remoteConnector.QueryAccess(destination, id, position, out version, out reason); | 245 | return m_remoteConnector.QueryAccess(destination, id, position, out version, out reason); |
246 | 246 | ||
247 | return false; | 247 | return false; |
248 | |||
249 | } | 248 | } |
250 | 249 | ||
251 | public bool ReleaseAgent(UUID origin, UUID id, string uri) | 250 | public bool ReleaseAgent(UUID origin, UUID id, string uri) |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 504f09b..4edaaca 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs | |||
@@ -428,9 +428,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
428 | s = sw.ToString(); | 428 | s = sw.ToString(); |
429 | } | 429 | } |
430 | 430 | ||
431 | if (m_scene != null) | 431 | // if (m_scene != null) |
432 | Console.WriteLine( | 432 | // Console.WriteLine( |
433 | "[ARCHIVE WRITE REQUEST PREPARATION]: Control file for {0} is: {1}", m_scene.RegionInfo.RegionName, s); | 433 | // "[ARCHIVE WRITE REQUEST PREPARATION]: Control file for {0} is: {1}", m_scene.RegionInfo.RegionName, s); |
434 | 434 | ||
435 | return s; | 435 | return s; |
436 | } | 436 | } |
diff --git a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs new file mode 100644 index 0000000..2838e0c --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs | |||
@@ -0,0 +1,155 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using System.Text.RegularExpressions; | ||
33 | using log4net; | ||
34 | using Mono.Addins; | ||
35 | using NDesk.Options; | ||
36 | using Nini.Config; | ||
37 | using OpenMetaverse; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Console; | ||
40 | using OpenSim.Framework.Statistics; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | |||
44 | namespace OpenSim.Region.CoreModules.World.Objects.Commands | ||
45 | { | ||
46 | /// <summary> | ||
47 | /// A module that holds commands for manipulating objects in the scene. | ||
48 | /// </summary> | ||
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RegionCommandsModule")] | ||
50 | public class RegionCommandsModule : INonSharedRegionModule | ||
51 | { | ||
52 | private Scene m_scene; | ||
53 | private ICommandConsole m_console; | ||
54 | |||
55 | public string Name { get { return "Region Commands Module"; } } | ||
56 | |||
57 | public Type ReplaceableInterface { get { return null; } } | ||
58 | |||
59 | public void Initialise(IConfigSource source) | ||
60 | { | ||
61 | // m_log.DebugFormat("[REGION COMMANDS MODULE]: INITIALIZED MODULE"); | ||
62 | } | ||
63 | |||
64 | public void PostInitialise() | ||
65 | { | ||
66 | // m_log.DebugFormat("[REGION COMMANDS MODULE]: POST INITIALIZED MODULE"); | ||
67 | } | ||
68 | |||
69 | public void Close() | ||
70 | { | ||
71 | // m_log.DebugFormat("[REGION COMMANDS MODULE]: CLOSED MODULE"); | ||
72 | } | ||
73 | |||
74 | public void AddRegion(Scene scene) | ||
75 | { | ||
76 | // m_log.DebugFormat("[REGION COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); | ||
77 | |||
78 | m_scene = scene; | ||
79 | m_console = MainConsole.Instance; | ||
80 | |||
81 | m_console.Commands.AddCommand( | ||
82 | "Regions", false, "show scene", | ||
83 | "show scene", | ||
84 | "Show live scene information for the currently selected region.", HandleShowScene); | ||
85 | } | ||
86 | |||
87 | public void RemoveRegion(Scene scene) | ||
88 | { | ||
89 | // m_log.DebugFormat("[REGION COMMANDS MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); | ||
90 | } | ||
91 | |||
92 | public void RegionLoaded(Scene scene) | ||
93 | { | ||
94 | // m_log.DebugFormat("[REGION COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | ||
95 | } | ||
96 | |||
97 | private void HandleShowScene(string module, string[] cmd) | ||
98 | { | ||
99 | if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) | ||
100 | return; | ||
101 | |||
102 | SimStatsReporter r = m_scene.StatsReporter; | ||
103 | float[] stats = r.LastReportedSimStats; | ||
104 | |||
105 | float timeDilation = stats[0]; | ||
106 | float simFps = stats[1]; | ||
107 | float physicsFps = stats[2]; | ||
108 | float agentUpdates = stats[3]; | ||
109 | float rootAgents = stats[4]; | ||
110 | float childAgents = stats[5]; | ||
111 | float totalPrims = stats[6]; | ||
112 | float activePrims = stats[7]; | ||
113 | float totalFrameTime = stats[8]; | ||
114 | // float netFrameTime = stats.StatsBlock[9].StatValue; // Ignored - not used by OpenSimulator | ||
115 | float physicsFrameTime = stats[10]; | ||
116 | float otherFrameTime = stats[11]; | ||
117 | // float imageFrameTime = stats.StatsBlock[12].StatValue; // Ignored | ||
118 | float inPacketsPerSecond = stats[13]; | ||
119 | float outPacketsPerSecond = stats[14]; | ||
120 | float unackedBytes = stats[15]; | ||
121 | // float agentFrameTime = stats.StatsBlock[16].StatValue; // Not really used | ||
122 | float pendingDownloads = stats[17]; | ||
123 | float pendingUploads = stats[18]; | ||
124 | float activeScripts = stats[19]; | ||
125 | float scriptLinesPerSecond = stats[20]; | ||
126 | |||
127 | StringBuilder sb = new StringBuilder(); | ||
128 | sb.AppendFormat("Scene statistics for {0}\n", m_scene.RegionInfo.RegionName); | ||
129 | |||
130 | ConsoleDisplayList dispList = new ConsoleDisplayList(); | ||
131 | dispList.AddRow("Time Dilation", timeDilation); | ||
132 | dispList.AddRow("Sim FPS", simFps); | ||
133 | dispList.AddRow("Physics FPS", physicsFps); | ||
134 | dispList.AddRow("Avatars", rootAgents); | ||
135 | dispList.AddRow("Child agents", childAgents); | ||
136 | dispList.AddRow("Total prims", totalPrims); | ||
137 | dispList.AddRow("Scripts", activeScripts); | ||
138 | dispList.AddRow("Script lines processed per second", scriptLinesPerSecond); | ||
139 | dispList.AddRow("Physics enabled prims", activePrims); | ||
140 | dispList.AddRow("Total frame time", totalFrameTime); | ||
141 | dispList.AddRow("Physics frame time", physicsFrameTime); | ||
142 | dispList.AddRow("Other frame time", otherFrameTime); | ||
143 | dispList.AddRow("Agent Updates per second", agentUpdates); | ||
144 | dispList.AddRow("Packets processed from clients per second", inPacketsPerSecond); | ||
145 | dispList.AddRow("Packets sent to clients per second", outPacketsPerSecond); | ||
146 | dispList.AddRow("Bytes unacknowledged by clients", unackedBytes); | ||
147 | dispList.AddRow("Pending asset downloads to clients", pendingDownloads); | ||
148 | dispList.AddRow("Pending asset uploads from clients", pendingUploads); | ||
149 | |||
150 | dispList.AddToStringBuilder(sb); | ||
151 | |||
152 | MainConsole.Instance.Output(sb.ToString()); | ||
153 | } | ||
154 | } | ||
155 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs index 5d2f893..b416b82 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
59 | } | 59 | } |
60 | 60 | ||
61 | //Returns true if this extension is supported for terrain save-tile | 61 | //Returns true if this extension is supported for terrain save-tile |
62 | public bool SupportsTileSave() | 62 | public override bool SupportsTileSave() |
63 | { | 63 | { |
64 | return false; | 64 | return false; |
65 | } | 65 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs index 1ebf916..71c71e6 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs | |||
@@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
65 | bool eof = false; | 65 | bool eof = false; |
66 | 66 | ||
67 | int fileXPoints = 0; | 67 | int fileXPoints = 0; |
68 | int fileYPoints = 0; | 68 | // int fileYPoints = 0; |
69 | 69 | ||
70 | // Terragen file | 70 | // Terragen file |
71 | while (eof == false) | 71 | while (eof == false) |
@@ -75,7 +75,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
75 | { | 75 | { |
76 | case "SIZE": | 76 | case "SIZE": |
77 | fileXPoints = bs.ReadInt16() + 1; | 77 | fileXPoints = bs.ReadInt16() + 1; |
78 | fileYPoints = fileXPoints; | 78 | // fileYPoints = fileXPoints; |
79 | bs.ReadInt16(); | 79 | bs.ReadInt16(); |
80 | break; | 80 | break; |
81 | case "XPTS": | 81 | case "XPTS": |
@@ -83,7 +83,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
83 | bs.ReadInt16(); | 83 | bs.ReadInt16(); |
84 | break; | 84 | break; |
85 | case "YPTS": | 85 | case "YPTS": |
86 | fileYPoints = bs.ReadInt16(); | 86 | // fileYPoints = bs.ReadInt16(); |
87 | bs.ReadInt16(); | ||
87 | bs.ReadInt16(); | 88 | bs.ReadInt16(); |
88 | break; | 89 | break; |
89 | case "ALTW": | 90 | case "ALTW": |
@@ -164,10 +165,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
164 | bool eof = false; | 165 | bool eof = false; |
165 | if (Encoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN ") | 166 | if (Encoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN ") |
166 | { | 167 | { |
167 | 168 | // int fileWidth = w; | |
168 | int fileWidth = w; | 169 | // int fileHeight = h; |
169 | int fileHeight = h; | ||
170 | |||
171 | 170 | ||
172 | // Terragen file | 171 | // Terragen file |
173 | while (eof == false) | 172 | while (eof == false) |
@@ -176,17 +175,22 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
176 | switch (tmp) | 175 | switch (tmp) |
177 | { | 176 | { |
178 | case "SIZE": | 177 | case "SIZE": |
179 | int sztmp = bs.ReadInt16() + 1; | 178 | // int sztmp = bs.ReadInt16() + 1; |
180 | fileWidth = sztmp; | 179 | // fileWidth = sztmp; |
181 | fileHeight = sztmp; | 180 | // fileHeight = sztmp; |
181 | bs.ReadInt16(); | ||
182 | bs.ReadInt16(); | ||
183 | bs.ReadInt16(); | ||
182 | bs.ReadInt16(); | 184 | bs.ReadInt16(); |
183 | break; | 185 | break; |
184 | case "XPTS": | 186 | case "XPTS": |
185 | fileWidth = bs.ReadInt16(); | 187 | // fileWidth = bs.ReadInt16(); |
188 | bs.ReadInt16(); | ||
186 | bs.ReadInt16(); | 189 | bs.ReadInt16(); |
187 | break; | 190 | break; |
188 | case "YPTS": | 191 | case "YPTS": |
189 | fileHeight = bs.ReadInt16(); | 192 | // fileHeight = bs.ReadInt16(); |
193 | bs.ReadInt16(); | ||
190 | bs.ReadInt16(); | 194 | bs.ReadInt16(); |
191 | break; | 195 | break; |
192 | case "ALTW": | 196 | case "ALTW": |
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 8732ec0..c605fc1 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -166,6 +166,19 @@ namespace OpenSim.Region.Framework.Interfaces | |||
166 | List<TaskInventoryItem> GetInventoryItems(); | 166 | List<TaskInventoryItem> GetInventoryItems(); |
167 | 167 | ||
168 | /// <summary> | 168 | /// <summary> |
169 | /// Gets an inventory item by name | ||
170 | /// </summary> | ||
171 | /// <remarks> | ||
172 | /// This method returns the first inventory item that matches the given name. In SL this is all you need | ||
173 | /// since each item in a prim inventory must have a unique name. | ||
174 | /// </remarks> | ||
175 | /// <param name='name'></param> | ||
176 | /// <returns> | ||
177 | /// The inventory item. Null if no such item was found. | ||
178 | /// </returns> | ||
179 | TaskInventoryItem GetInventoryItem(string name); | ||
180 | |||
181 | /// <summary> | ||
169 | /// Get inventory items by name. | 182 | /// Get inventory items by name. |
170 | /// </summary> | 183 | /// </summary> |
171 | /// <param name="name"></param> | 184 | /// <param name="name"></param> |
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index 9cd27f9..5bc8e51 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs | |||
@@ -57,6 +57,13 @@ namespace OpenSim.Region.Framework.Interfaces | |||
57 | void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination, | 57 | void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination, |
58 | Vector3 position, Vector3 lookAt, uint teleportFlags); | 58 | Vector3 position, Vector3 lookAt, uint teleportFlags); |
59 | 59 | ||
60 | /// <summary> | ||
61 | /// Show whether the given agent is being teleported. | ||
62 | /// </summary> | ||
63 | /// <param name='id'>The agent ID</para></param> | ||
64 | /// <returns>true if the agent is in the process of being teleported, false otherwise.</returns> | ||
65 | bool IsInTransit(UUID id); | ||
66 | |||
60 | bool Cross(ScenePresence agent, bool isFlying); | 67 | bool Cross(ScenePresence agent, bool isFlying); |
61 | 68 | ||
62 | void AgentArrivedAtDestination(UUID agent); | 69 | void AgentArrivedAtDestination(UUID agent); |
diff --git a/OpenSim/Region/Framework/Interfaces/IEnvironmentModule.cs b/OpenSim/Region/Framework/Interfaces/IEnvironmentModule.cs new file mode 100644 index 0000000..7a7b782 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IEnvironmentModule.cs | |||
@@ -0,0 +1,36 @@ | |||
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 | |||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Region.Framework.Interfaces | ||
31 | { | ||
32 | public interface IEnvironmentModule | ||
33 | { | ||
34 | void ResetEnvironmentSettings(UUID regionUUID); | ||
35 | } | ||
36 | } | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs index 1904011..3576e35 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs | |||
@@ -49,11 +49,15 @@ namespace OpenSim.Region.Framework.Interfaces | |||
49 | /// <param name="folderID"></param> | 49 | /// <param name="folderID"></param> |
50 | /// <param name="objectGroups"></param> | 50 | /// <param name="objectGroups"></param> |
51 | /// <param name="remoteClient"></param> | 51 | /// <param name="remoteClient"></param> |
52 | /// <param name="asAttachment"> | ||
53 | /// Should be true if the object(s) are begin taken as attachments. False otherwise. | ||
54 | /// </param> | ||
52 | /// <returns> | 55 | /// <returns> |
53 | /// Returns the UUID of the newly created item asset (not the item itself). | 56 | /// A list of the items created. If there was more than one object and objects are not being coaleseced in |
54 | /// FIXME: This is not very useful. It would be far more useful to return a list of items instead. | 57 | /// inventory, then the order of items is in the same order as the input objects. |
55 | /// </returns> | 58 | /// </returns> |
56 | UUID CopyToInventory(DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient); | 59 | List<InventoryItemBase> CopyToInventory( |
60 | DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment); | ||
57 | 61 | ||
58 | /// <summary> | 62 | /// <summary> |
59 | /// Rez an object into the scene from the user's inventory | 63 | /// Rez an object into the scene from the user's inventory |
diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs index 5295a72..0fcafcc 100644 --- a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs | |||
@@ -95,5 +95,26 @@ namespace OpenSim.Region.Framework.Interfaces | |||
95 | RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); | 95 | RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); |
96 | void StoreRegionWindlightSettings(RegionLightShareData wl); | 96 | void StoreRegionWindlightSettings(RegionLightShareData wl); |
97 | void RemoveRegionWindlightSettings(UUID regionID); | 97 | void RemoveRegionWindlightSettings(UUID regionID); |
98 | |||
99 | /// <summary> | ||
100 | /// Load Environment settings from region storage | ||
101 | /// </summary> | ||
102 | /// <param name="regionUUID">the region UUID</param> | ||
103 | /// <returns>LLSD string for viewer</returns> | ||
104 | string LoadRegionEnvironmentSettings(UUID regionUUID); | ||
105 | |||
106 | /// <summary> | ||
107 | /// Store Environment settings into region storage | ||
108 | /// </summary> | ||
109 | /// <param name="regionUUID">the region UUID</param> | ||
110 | /// <param name="settings">LLSD string from viewer</param> | ||
111 | void StoreRegionEnvironmentSettings(UUID regionUUID, string settings); | ||
112 | |||
113 | /// <summary> | ||
114 | /// Delete Environment settings from region storage | ||
115 | /// </summary> | ||
116 | /// <param name="regionUUID">the region UUID</param> | ||
117 | void RemoveRegionEnvironmentSettings(UUID regionUUID); | ||
118 | |||
98 | } | 119 | } |
99 | } | 120 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs index 615f377..e424976 100644 --- a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs | |||
@@ -107,6 +107,26 @@ namespace OpenSim.Region.Framework.Interfaces | |||
107 | void StoreRegionWindlightSettings(RegionLightShareData wl); | 107 | void StoreRegionWindlightSettings(RegionLightShareData wl); |
108 | void RemoveRegionWindlightSettings(UUID regionID); | 108 | void RemoveRegionWindlightSettings(UUID regionID); |
109 | 109 | ||
110 | /// <summary> | ||
111 | /// Load Environment settings from region storage | ||
112 | /// </summary> | ||
113 | /// <param name="regionUUID">the region UUID</param> | ||
114 | /// <returns>LLSD string for viewer</returns> | ||
115 | string LoadRegionEnvironmentSettings(UUID regionUUID); | ||
116 | |||
117 | /// <summary> | ||
118 | /// Store Environment settings into region storage | ||
119 | /// </summary> | ||
120 | /// <param name="regionUUID">the region UUID</param> | ||
121 | /// <param name="settings">LLSD string from viewer</param> | ||
122 | void StoreRegionEnvironmentSettings(UUID regionUUID, string settings); | ||
123 | |||
124 | /// <summary> | ||
125 | /// Delete Environment settings from region storage | ||
126 | /// </summary> | ||
127 | /// <param name="regionUUID">the region UUID</param> | ||
128 | void RemoveRegionEnvironmentSettings(UUID regionUUID); | ||
129 | |||
110 | void Shutdown(); | 130 | void Shutdown(); |
111 | } | 131 | } |
112 | } | 132 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IUrlModule.cs b/OpenSim/Region/Framework/Interfaces/IUrlModule.cs index 1b91166..457444c 100644 --- a/OpenSim/Region/Framework/Interfaces/IUrlModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IUrlModule.cs | |||
@@ -34,6 +34,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
34 | { | 34 | { |
35 | public interface IUrlModule | 35 | public interface IUrlModule |
36 | { | 36 | { |
37 | string ExternalHostNameForLSL { get; } | ||
37 | UUID RequestURL(IScriptModule engine, SceneObjectPart host, UUID itemID); | 38 | UUID RequestURL(IScriptModule engine, SceneObjectPart host, UUID itemID); |
38 | UUID RequestSecureURL(IScriptModule engine, SceneObjectPart host, UUID itemID); | 39 | UUID RequestSecureURL(IScriptModule engine, SceneObjectPart host, UUID itemID); |
39 | void ReleaseURL(string url); | 40 | void ReleaseURL(string url); |
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index 834464b..f555b49 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs | |||
@@ -155,7 +155,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
155 | { | 155 | { |
156 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 156 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
157 | if (invAccess != null) | 157 | if (invAccess != null) |
158 | invAccess.CopyToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient); | 158 | invAccess.CopyToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient, false); |
159 | 159 | ||
160 | if (x.permissionToDelete) | 160 | if (x.permissionToDelete) |
161 | { | 161 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 942c625..270b01b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -954,8 +954,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
954 | sbyte invType, sbyte type, UUID olditemID) | 954 | sbyte invType, sbyte type, UUID olditemID) |
955 | { | 955 | { |
956 | // m_log.DebugFormat( | 956 | // m_log.DebugFormat( |
957 | // "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}", | 957 | // "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}, assetType {4}, inventoryType {5}", |
958 | // remoteClient.Name, name, folderID, olditemID); | 958 | // remoteClient.Name, name, folderID, olditemID, (AssetType)type, (InventoryType)invType); |
959 | 959 | ||
960 | if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) | 960 | if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) |
961 | return; | 961 | return; |
@@ -988,10 +988,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
988 | asset.Type = type; | 988 | asset.Type = type; |
989 | asset.Name = name; | 989 | asset.Name = name; |
990 | asset.Description = description; | 990 | asset.Description = description; |
991 | 991 | ||
992 | CreateNewInventoryItem( | 992 | CreateNewInventoryItem( |
993 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, name, 0, callbackID, asset, invType, | 993 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, name, 0, callbackID, asset, invType, |
994 | (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, | 994 | (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, |
995 | (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); | 995 | (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); |
996 | } | 996 | } |
997 | else | 997 | else |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e3bd527..32c7262 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -77,7 +77,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
77 | public bool DebugUpdates { get; private set; } | 77 | public bool DebugUpdates { get; private set; } |
78 | 78 | ||
79 | public SynchronizeSceneHandler SynchronizeScene; | 79 | public SynchronizeSceneHandler SynchronizeScene; |
80 | public SimStatsReporter StatsReporter; | 80 | |
81 | /// <summary> | ||
82 | /// Statistical information for this scene. | ||
83 | /// </summary> | ||
84 | public SimStatsReporter StatsReporter { get; private set; } | ||
85 | |||
81 | public List<Border> NorthBorders = new List<Border>(); | 86 | public List<Border> NorthBorders = new List<Border>(); |
82 | public List<Border> EastBorders = new List<Border>(); | 87 | public List<Border> EastBorders = new List<Border>(); |
83 | public List<Border> SouthBorders = new List<Border>(); | 88 | public List<Border> SouthBorders = new List<Border>(); |
@@ -164,7 +169,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
164 | protected IConfigSource m_config; | 169 | protected IConfigSource m_config; |
165 | protected IRegionSerialiserModule m_serialiser; | 170 | protected IRegionSerialiserModule m_serialiser; |
166 | protected IDialogModule m_dialogModule; | 171 | protected IDialogModule m_dialogModule; |
167 | protected IEntityTransferModule m_teleportModule; | ||
168 | protected ICapabilitiesModule m_capsModule; | 172 | protected ICapabilitiesModule m_capsModule; |
169 | protected IGroupsModule m_groupsModule; | 173 | protected IGroupsModule m_groupsModule; |
170 | 174 | ||
@@ -515,6 +519,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
515 | } | 519 | } |
516 | 520 | ||
517 | public IAttachmentsModule AttachmentsModule { get; set; } | 521 | public IAttachmentsModule AttachmentsModule { get; set; } |
522 | public IEntityTransferModule EntityTransferModule { get; private set; } | ||
518 | 523 | ||
519 | public IAvatarFactoryModule AvatarFactory | 524 | public IAvatarFactoryModule AvatarFactory |
520 | { | 525 | { |
@@ -952,8 +957,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
952 | List<ulong> old = new List<ulong>(); | 957 | List<ulong> old = new List<ulong>(); |
953 | old.Add(otherRegion.RegionHandle); | 958 | old.Add(otherRegion.RegionHandle); |
954 | agent.DropOldNeighbours(old); | 959 | agent.DropOldNeighbours(old); |
955 | if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc) | 960 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) |
956 | m_teleportModule.EnableChildAgent(agent, otherRegion); | 961 | EntityTransferModule.EnableChildAgent(agent, otherRegion); |
957 | }); | 962 | }); |
958 | } | 963 | } |
959 | catch (NullReferenceException) | 964 | catch (NullReferenceException) |
@@ -1060,13 +1065,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1060 | } | 1065 | } |
1061 | } | 1066 | } |
1062 | 1067 | ||
1068 | m_log.Error("[REGION]: Closing"); | ||
1069 | Close(); | ||
1070 | |||
1063 | if (PhysicsScene != null) | 1071 | if (PhysicsScene != null) |
1064 | { | 1072 | { |
1065 | PhysicsScene.Dispose(); | 1073 | PhysicsScene.Dispose(); |
1066 | } | 1074 | } |
1067 | |||
1068 | m_log.Error("[REGION]: Closing"); | ||
1069 | Close(); | ||
1070 | 1075 | ||
1071 | m_log.Error("[REGION]: Firing Region Restart Message"); | 1076 | m_log.Error("[REGION]: Firing Region Restart Message"); |
1072 | 1077 | ||
@@ -1090,8 +1095,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1090 | { | 1095 | { |
1091 | ForEachRootScenePresence(delegate(ScenePresence agent) | 1096 | ForEachRootScenePresence(delegate(ScenePresence agent) |
1092 | { | 1097 | { |
1093 | if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc) | 1098 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) |
1094 | m_teleportModule.EnableChildAgent(agent, r); | 1099 | EntityTransferModule.EnableChildAgent(agent, r); |
1095 | }); | 1100 | }); |
1096 | } | 1101 | } |
1097 | catch (NullReferenceException) | 1102 | catch (NullReferenceException) |
@@ -1281,7 +1286,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1281 | m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); | 1286 | m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); |
1282 | m_dialogModule = RequestModuleInterface<IDialogModule>(); | 1287 | m_dialogModule = RequestModuleInterface<IDialogModule>(); |
1283 | m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); | 1288 | m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); |
1284 | m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); | 1289 | EntityTransferModule = RequestModuleInterface<IEntityTransferModule>(); |
1285 | m_groupsModule = RequestModuleInterface<IGroupsModule>(); | 1290 | m_groupsModule = RequestModuleInterface<IGroupsModule>(); |
1286 | } | 1291 | } |
1287 | 1292 | ||
@@ -2380,8 +2385,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2380 | return; | 2385 | return; |
2381 | } | 2386 | } |
2382 | 2387 | ||
2383 | if (m_teleportModule != null) | 2388 | if (EntityTransferModule != null) |
2384 | m_teleportModule.Cross(grp, attemptedPosition, silent); | 2389 | EntityTransferModule.Cross(grp, attemptedPosition, silent); |
2385 | } | 2390 | } |
2386 | 2391 | ||
2387 | public Border GetCrossedBorder(Vector3 position, Cardinals gridline) | 2392 | public Border GetCrossedBorder(Vector3 position, Cardinals gridline) |
@@ -3225,8 +3230,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3225 | /// <param name="client">The IClientAPI for the client</param> | 3230 | /// <param name="client">The IClientAPI for the client</param> |
3226 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) | 3231 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
3227 | { | 3232 | { |
3228 | if (m_teleportModule != null) | 3233 | if (EntityTransferModule != null) |
3229 | return m_teleportModule.TeleportHome(agentId, client); | 3234 | { |
3235 | EntityTransferModule.TeleportHome(agentId, client); | ||
3236 | } | ||
3230 | else | 3237 | else |
3231 | { | 3238 | { |
3232 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3239 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
@@ -4332,8 +4339,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4332 | position.Y -= shifty; | 4339 | position.Y -= shifty; |
4333 | } | 4340 | } |
4334 | 4341 | ||
4335 | if (m_teleportModule != null) | 4342 | if (EntityTransferModule != null) |
4336 | m_teleportModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags); | 4343 | { |
4344 | EntityTransferModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags); | ||
4345 | } | ||
4337 | else | 4346 | else |
4338 | { | 4347 | { |
4339 | m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active"); | 4348 | m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active"); |
@@ -4344,8 +4353,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4344 | 4353 | ||
4345 | public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying) | 4354 | public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying) |
4346 | { | 4355 | { |
4347 | if (m_teleportModule != null) | 4356 | if (EntityTransferModule != null) |
4348 | return m_teleportModule.Cross(agent, isFlying); | 4357 | { |
4358 | return EntityTransferModule.Cross(agent, isFlying); | ||
4359 | } | ||
4349 | else | 4360 | else |
4350 | { | 4361 | { |
4351 | m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule"); | 4362 | m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule"); |
@@ -5493,16 +5504,36 @@ Environment.Exit(1); | |||
5493 | throw new Exception(error); | 5504 | throw new Exception(error); |
5494 | } | 5505 | } |
5495 | 5506 | ||
5496 | // This method is called across the simulation connector to | 5507 | /// <summary> |
5497 | // determine if a given agent is allowed in this region | 5508 | /// This method is called across the simulation connector to |
5498 | // AS A ROOT AGENT. Returning false here will prevent them | 5509 | /// determine if a given agent is allowed in this region |
5499 | // from logging into the region, teleporting into the region | 5510 | /// AS A ROOT AGENT |
5500 | // or corssing the broder walking, but will NOT prevent | 5511 | /// </summary> |
5501 | // child agent creation, thereby emulating the SL behavior. | 5512 | /// <remarks> |
5513 | /// Returning false here will prevent them | ||
5514 | /// from logging into the region, teleporting into the region | ||
5515 | /// or corssing the broder walking, but will NOT prevent | ||
5516 | /// child agent creation, thereby emulating the SL behavior. | ||
5517 | /// </remarks> | ||
5518 | /// <param name='agentID'></param> | ||
5519 | /// <param name='position'></param> | ||
5520 | /// <param name='reason'></param> | ||
5521 | /// <returns></returns> | ||
5502 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) | 5522 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
5503 | { | 5523 | { |
5504 | reason = "You are banned from the region"; | 5524 | reason = "You are banned from the region"; |
5505 | 5525 | ||
5526 | if (EntityTransferModule.IsInTransit(agentID)) | ||
5527 | { | ||
5528 | reason = "Agent is still in transit from this region"; | ||
5529 | |||
5530 | m_log.WarnFormat( | ||
5531 | "[SCENE]: Denying agent {0} entry into {1} since region still has them registered as in transit", | ||
5532 | agentID, RegionInfo.RegionName); | ||
5533 | |||
5534 | return false; | ||
5535 | } | ||
5536 | |||
5506 | if (Permissions.IsGod(agentID)) | 5537 | if (Permissions.IsGod(agentID)) |
5507 | { | 5538 | { |
5508 | reason = String.Empty; | 5539 | reason = String.Empty; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 141cf66..f5b9825 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -759,14 +759,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
759 | return item; | 759 | return item; |
760 | } | 760 | } |
761 | 761 | ||
762 | /// <summary> | 762 | public TaskInventoryItem GetInventoryItem(string name) |
763 | /// Get inventory items by name. | 763 | { |
764 | /// </summary> | 764 | m_items.LockItemsForRead(true); |
765 | /// <param name="name"></param> | 765 | foreach (TaskInventoryItem item in m_items.Values) |
766 | /// <returns> | 766 | { |
767 | /// A list of inventory items with that name. | 767 | if (item.Name == name) |
768 | /// If no inventory item has that name then an empty list is returned. | 768 | { |
769 | /// </returns> | 769 | return item; |
770 | m_items.LockItemsForRead(false); | ||
771 | } | ||
772 | } | ||
773 | m_items.LockItemsForRead(false); | ||
774 | |||
775 | return null; | ||
776 | } | ||
777 | |||
770 | public List<TaskInventoryItem> GetInventoryItems(string name) | 778 | public List<TaskInventoryItem> GetInventoryItems(string name) |
771 | { | 779 | { |
772 | List<TaskInventoryItem> items = new List<TaskInventoryItem>(); | 780 | List<TaskInventoryItem> items = new List<TaskInventoryItem>(); |
@@ -1236,10 +1244,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1236 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | 1244 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) |
1237 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | 1245 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; |
1238 | } | 1246 | } |
1239 | item.OwnerChanged = true; | ||
1240 | item.CurrentPermissions &= item.NextPermissions; | 1247 | item.CurrentPermissions &= item.NextPermissions; |
1241 | item.BasePermissions &= item.NextPermissions; | 1248 | item.BasePermissions &= item.NextPermissions; |
1242 | item.EveryonePermissions &= item.NextPermissions; | 1249 | item.EveryonePermissions &= item.NextPermissions; |
1250 | item.OwnerChanged = true; | ||
1243 | item.PermsMask = 0; | 1251 | item.PermsMask = 0; |
1244 | item.PermsGranter = UUID.Zero; | 1252 | item.PermsGranter = UUID.Zero; |
1245 | } | 1253 | } |
@@ -1432,4 +1440,4 @@ namespace OpenSim.Region.Framework.Scenes | |||
1432 | } | 1440 | } |
1433 | } | 1441 | } |
1434 | } | 1442 | } |
1435 | } \ No newline at end of file | 1443 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index 55455cc..a4f730d 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs | |||
@@ -47,14 +47,30 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
47 | /// </remarks> | 47 | /// </remarks> |
48 | public class CoalescedSceneObjectsSerializer | 48 | public class CoalescedSceneObjectsSerializer |
49 | { | 49 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
52 | /// <summary> | 52 | /// <summary> |
53 | /// Serialize coalesced objects to Xml | 53 | /// Serialize coalesced objects to Xml |
54 | /// </summary> | 54 | /// </summary> |
55 | /// <param name="coa"></param> | 55 | /// <param name="coa"></param> |
56 | /// <param name="doScriptStates"> | ||
57 | /// If true then serialize script states. This will halt any running scripts | ||
58 | /// </param> | ||
56 | /// <returns></returns> | 59 | /// <returns></returns> |
57 | public static string ToXml(CoalescedSceneObjects coa) | 60 | public static string ToXml(CoalescedSceneObjects coa) |
61 | { | ||
62 | return ToXml(coa, true); | ||
63 | } | ||
64 | |||
65 | /// <summary> | ||
66 | /// Serialize coalesced objects to Xml | ||
67 | /// </summary> | ||
68 | /// <param name="coa"></param> | ||
69 | /// <param name="doScriptStates"> | ||
70 | /// If true then serialize script states. This will halt any running scripts | ||
71 | /// </param> | ||
72 | /// <returns></returns> | ||
73 | public static string ToXml(CoalescedSceneObjects coa, bool doScriptStates) | ||
58 | { | 74 | { |
59 | using (StringWriter sw = new StringWriter()) | 75 | using (StringWriter sw = new StringWriter()) |
60 | { | 76 | { |
@@ -91,7 +107,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
91 | writer.WriteAttributeString("offsety", offsets[i].Y.ToString()); | 107 | writer.WriteAttributeString("offsety", offsets[i].Y.ToString()); |
92 | writer.WriteAttributeString("offsetz", offsets[i].Z.ToString()); | 108 | writer.WriteAttributeString("offsetz", offsets[i].Z.ToString()); |
93 | 109 | ||
94 | SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, true); | 110 | SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, doScriptStates); |
95 | 111 | ||
96 | writer.WriteEndElement(); // SceneObjectGroup | 112 | writer.WriteEndElement(); // SceneObjectGroup |
97 | } | 113 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 41bff7f..ccfe4ff 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | |||
@@ -110,12 +110,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
110 | 110 | ||
111 | UUID userId = TestHelpers.ParseTail(0x1); | 111 | UUID userId = TestHelpers.ParseTail(0x1); |
112 | 112 | ||
113 | EntityTransferModule etm = new EntityTransferModule(); | 113 | EntityTransferModule etmA = new EntityTransferModule(); |
114 | EntityTransferModule etmB = new EntityTransferModule(); | ||
114 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | 115 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); |
115 | 116 | ||
116 | IConfigSource config = new IniConfigSource(); | 117 | IConfigSource config = new IniConfigSource(); |
117 | IConfig modulesConfig = config.AddConfig("Modules"); | 118 | IConfig modulesConfig = config.AddConfig("Modules"); |
118 | modulesConfig.Set("EntityTransferModule", etm.Name); | 119 | modulesConfig.Set("EntityTransferModule", etmA.Name); |
119 | modulesConfig.Set("SimulationServices", lscm.Name); | 120 | modulesConfig.Set("SimulationServices", lscm.Name); |
120 | IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); | 121 | IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); |
121 | 122 | ||
@@ -127,7 +128,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
127 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | 128 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); |
128 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); | 129 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); |
129 | 130 | ||
130 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm); | 131 | SceneHelpers.SetupSceneModules(sceneA, config, etmA); |
132 | SceneHelpers.SetupSceneModules(sceneB, config, etmB); | ||
133 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
131 | 134 | ||
132 | Vector3 teleportPosition = new Vector3(10, 11, 12); | 135 | Vector3 teleportPosition = new Vector3(10, 11, 12); |
133 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | 136 | Vector3 teleportLookAt = new Vector3(20, 21, 22); |
@@ -174,12 +177,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
174 | UUID userId = TestHelpers.ParseTail(0x1); | 177 | UUID userId = TestHelpers.ParseTail(0x1); |
175 | Vector3 preTeleportPosition = new Vector3(30, 31, 32); | 178 | Vector3 preTeleportPosition = new Vector3(30, 31, 32); |
176 | 179 | ||
177 | EntityTransferModule etm = new EntityTransferModule(); | 180 | EntityTransferModule etmA = new EntityTransferModule(); |
181 | EntityTransferModule etmB = new EntityTransferModule(); | ||
182 | |||
178 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | 183 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); |
179 | 184 | ||
180 | IConfigSource config = new IniConfigSource(); | 185 | IConfigSource config = new IniConfigSource(); |
181 | config.AddConfig("Modules"); | 186 | config.AddConfig("Modules"); |
182 | config.Configs["Modules"].Set("EntityTransferModule", etm.Name); | 187 | config.Configs["Modules"].Set("EntityTransferModule", etmA.Name); |
183 | config.Configs["Modules"].Set("SimulationServices", lscm.Name); | 188 | config.Configs["Modules"].Set("SimulationServices", lscm.Name); |
184 | 189 | ||
185 | config.AddConfig("EntityTransfer"); | 190 | config.AddConfig("EntityTransfer"); |
@@ -195,13 +200,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
195 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | 200 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); |
196 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); | 201 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); |
197 | 202 | ||
203 | SceneHelpers.SetupSceneModules(sceneA, config, etmA ); | ||
204 | |||
198 | // We need to set up the permisions module on scene B so that our later use of agent limit to deny | 205 | // We need to set up the permisions module on scene B so that our later use of agent limit to deny |
199 | // QueryAccess won't succeed anyway because administrators are always allowed in and the default | 206 | // QueryAccess won't succeed anyway because administrators are always allowed in and the default |
200 | // IsAdministrator if no permissions module is present is true. | 207 | // IsAdministrator if no permissions module is present is true. |
201 | SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule() }); | 208 | SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB }); |
202 | 209 | ||
203 | // Shared scene modules | 210 | // Shared scene modules |
204 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm); | 211 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); |
205 | 212 | ||
206 | Vector3 teleportPosition = new Vector3(10, 11, 12); | 213 | Vector3 teleportPosition = new Vector3(10, 11, 12); |
207 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | 214 | Vector3 teleportLookAt = new Vector3(20, 21, 22); |
@@ -249,12 +256,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
249 | UUID userId = TestHelpers.ParseTail(0x1); | 256 | UUID userId = TestHelpers.ParseTail(0x1); |
250 | Vector3 preTeleportPosition = new Vector3(30, 31, 32); | 257 | Vector3 preTeleportPosition = new Vector3(30, 31, 32); |
251 | 258 | ||
252 | EntityTransferModule etm = new EntityTransferModule(); | 259 | EntityTransferModule etmA = new EntityTransferModule(); |
260 | EntityTransferModule etmB = new EntityTransferModule(); | ||
253 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | 261 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); |
254 | 262 | ||
255 | IConfigSource config = new IniConfigSource(); | 263 | IConfigSource config = new IniConfigSource(); |
256 | config.AddConfig("Modules"); | 264 | config.AddConfig("Modules"); |
257 | config.Configs["Modules"].Set("EntityTransferModule", etm.Name); | 265 | config.Configs["Modules"].Set("EntityTransferModule", etmA.Name); |
258 | config.Configs["Modules"].Set("SimulationServices", lscm.Name); | 266 | config.Configs["Modules"].Set("SimulationServices", lscm.Name); |
259 | 267 | ||
260 | config.AddConfig("EntityTransfer"); | 268 | config.AddConfig("EntityTransfer"); |
@@ -267,8 +275,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
267 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | 275 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); |
268 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); | 276 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); |
269 | 277 | ||
278 | SceneHelpers.SetupSceneModules(sceneA, config, etmA); | ||
279 | SceneHelpers.SetupSceneModules(sceneB, config, etmB); | ||
280 | |||
270 | // Shared scene modules | 281 | // Shared scene modules |
271 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm); | 282 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); |
272 | 283 | ||
273 | Vector3 teleportPosition = new Vector3(10, 11, 12); | 284 | Vector3 teleportPosition = new Vector3(10, 11, 12); |
274 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | 285 | Vector3 teleportLookAt = new Vector3(20, 21, 22); |
@@ -312,12 +323,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
312 | 323 | ||
313 | UUID userId = TestHelpers.ParseTail(0x1); | 324 | UUID userId = TestHelpers.ParseTail(0x1); |
314 | 325 | ||
315 | EntityTransferModule etm = new EntityTransferModule(); | 326 | EntityTransferModule etmA = new EntityTransferModule(); |
327 | EntityTransferModule etmB = new EntityTransferModule(); | ||
316 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | 328 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); |
317 | 329 | ||
318 | IConfigSource config = new IniConfigSource(); | 330 | IConfigSource config = new IniConfigSource(); |
319 | IConfig modulesConfig = config.AddConfig("Modules"); | 331 | IConfig modulesConfig = config.AddConfig("Modules"); |
320 | modulesConfig.Set("EntityTransferModule", etm.Name); | 332 | modulesConfig.Set("EntityTransferModule", etmA.Name); |
321 | modulesConfig.Set("SimulationServices", lscm.Name); | 333 | modulesConfig.Set("SimulationServices", lscm.Name); |
322 | IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); | 334 | IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); |
323 | 335 | ||
@@ -329,9 +341,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
329 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | 341 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); |
330 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000); | 342 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000); |
331 | 343 | ||
332 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm); | 344 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); |
333 | SceneHelpers.SetupSceneModules(sceneA, new CapabilitiesModule()); | 345 | SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA); |
334 | SceneHelpers.SetupSceneModules(sceneB, new CapabilitiesModule()); | 346 | SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB); |
335 | 347 | ||
336 | Vector3 teleportPosition = new Vector3(10, 11, 12); | 348 | Vector3 teleportPosition = new Vector3(10, 11, 12); |
337 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | 349 | Vector3 teleportLookAt = new Vector3(20, 21, 22); |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs index a95514c..1b9e3ac 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs | |||
@@ -145,12 +145,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments | |||
145 | { | 145 | { |
146 | sb.AppendFormat("Attachments for {0}\n", sp.Name); | 146 | sb.AppendFormat("Attachments for {0}\n", sp.Name); |
147 | 147 | ||
148 | ConsoleTable ct = new ConsoleTable() { Indent = 2 }; | 148 | ConsoleDisplayTable ct = new ConsoleDisplayTable() { Indent = 2 }; |
149 | ct.Columns.Add(new ConsoleTableColumn("Attachment Name", 36)); | 149 | ct.Columns.Add(new ConsoleDisplayTableColumn("Attachment Name", 36)); |
150 | ct.Columns.Add(new ConsoleTableColumn("Local ID", 10)); | 150 | ct.Columns.Add(new ConsoleDisplayTableColumn("Local ID", 10)); |
151 | ct.Columns.Add(new ConsoleTableColumn("Item ID", 36)); | 151 | ct.Columns.Add(new ConsoleDisplayTableColumn("Item ID", 36)); |
152 | ct.Columns.Add(new ConsoleTableColumn("Attach Point", 14)); | 152 | ct.Columns.Add(new ConsoleDisplayTableColumn("Attach Point", 14)); |
153 | ct.Columns.Add(new ConsoleTableColumn("Position", 15)); | 153 | ct.Columns.Add(new ConsoleDisplayTableColumn("Position", 15)); |
154 | 154 | ||
155 | // sb.AppendFormat( | 155 | // sb.AppendFormat( |
156 | // " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n", | 156 | // " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n", |
@@ -176,7 +176,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments | |||
176 | // attachmentObject.Name, attachmentObject.LocalId, attachmentObject.FromItemID, | 176 | // attachmentObject.Name, attachmentObject.LocalId, attachmentObject.FromItemID, |
177 | // (AttachmentPoint)attachmentObject.AttachmentPoint, attachmentObject.RootPart.AttachedPos); | 177 | // (AttachmentPoint)attachmentObject.AttachmentPoint, attachmentObject.RootPart.AttachedPos); |
178 | ct.Rows.Add( | 178 | ct.Rows.Add( |
179 | new ConsoleTableRow( | 179 | new ConsoleDisplayTableRow( |
180 | new List<string>() | 180 | new List<string>() |
181 | { | 181 | { |
182 | attachmentObject.Name, | 182 | attachmentObject.Name, |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0cc3e8c..03f4108 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -354,51 +354,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
354 | 354 | ||
355 | protected UUID InventoryKey(string name, int type) | 355 | protected UUID InventoryKey(string name, int type) |
356 | { | 356 | { |
357 | m_host.AddScriptLPS(1); | 357 | TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); |
358 | m_host.TaskInventory.LockItemsForRead(true); | ||
359 | |||
360 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
361 | { | ||
362 | if (inv.Value.Name == name) | ||
363 | { | ||
364 | m_host.TaskInventory.LockItemsForRead(false); | ||
365 | |||
366 | if (inv.Value.Type != type) | ||
367 | { | ||
368 | return UUID.Zero; | ||
369 | } | ||
370 | 358 | ||
371 | return inv.Value.AssetID; | 359 | if (item != null && item.Type == type) |
372 | } | 360 | return item.AssetID; |
373 | } | 361 | else |
374 | 362 | return UUID.Zero; | |
375 | m_host.TaskInventory.LockItemsForRead(false); | ||
376 | return UUID.Zero; | ||
377 | } | ||
378 | |||
379 | protected UUID InventoryKey(string name) | ||
380 | { | ||
381 | m_host.AddScriptLPS(1); | ||
382 | |||
383 | |||
384 | m_host.TaskInventory.LockItemsForRead(true); | ||
385 | |||
386 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
387 | { | ||
388 | if (inv.Value.Name == name) | ||
389 | { | ||
390 | m_host.TaskInventory.LockItemsForRead(false); | ||
391 | return inv.Value.AssetID; | ||
392 | } | ||
393 | } | ||
394 | |||
395 | m_host.TaskInventory.LockItemsForRead(false); | ||
396 | |||
397 | |||
398 | return UUID.Zero; | ||
399 | } | 363 | } |
400 | 364 | ||
401 | |||
402 | /// <summary> | 365 | /// <summary> |
403 | /// accepts a valid UUID, -or- a name of an inventory item. | 366 | /// accepts a valid UUID, -or- a name of an inventory item. |
404 | /// Returns a valid UUID or UUID.Zero if key invalid and item not found | 367 | /// Returns a valid UUID or UUID.Zero if key invalid and item not found |
@@ -408,19 +371,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
408 | /// <returns></returns> | 371 | /// <returns></returns> |
409 | protected UUID KeyOrName(string k) | 372 | protected UUID KeyOrName(string k) |
410 | { | 373 | { |
411 | UUID key = UUID.Zero; | 374 | UUID key; |
412 | 375 | ||
413 | // if we can parse the string as a key, use it. | 376 | // if we can parse the string as a key, use it. |
414 | if (UUID.TryParse(k, out key)) | ||
415 | { | ||
416 | return key; | ||
417 | } | ||
418 | // else try to locate the name in inventory of object. found returns key, | 377 | // else try to locate the name in inventory of object. found returns key, |
419 | // not found returns UUID.Zero which will translate to the default particle texture | 378 | // not found returns UUID.Zero |
420 | else | 379 | if (!UUID.TryParse(k, out key)) |
421 | { | 380 | { |
422 | return InventoryKey(k); | 381 | TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k); |
382 | |||
383 | if (item != null) | ||
384 | key = item.AssetID; | ||
385 | else | ||
386 | key = UUID.Zero; | ||
423 | } | 387 | } |
388 | |||
389 | return key; | ||
424 | } | 390 | } |
425 | 391 | ||
426 | // convert a LSL_Rotation to a Quaternion | 392 | // convert a LSL_Rotation to a Quaternion |
@@ -1897,14 +1863,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1897 | 1863 | ||
1898 | return rgb; | 1864 | return rgb; |
1899 | } | 1865 | } |
1866 | |||
1900 | if (face >= 0 && face < GetNumberOfSides(part)) | 1867 | if (face >= 0 && face < GetNumberOfSides(part)) |
1901 | { | 1868 | { |
1902 | texcolor = tex.GetFace((uint)face).RGBA; | 1869 | texcolor = tex.GetFace((uint)face).RGBA; |
1903 | rgb.x = texcolor.R; | 1870 | rgb.x = texcolor.R; |
1904 | rgb.y = texcolor.G; | 1871 | rgb.y = texcolor.G; |
1905 | rgb.z = texcolor.B; | 1872 | rgb.z = texcolor.B; |
1873 | |||
1906 | return rgb; | 1874 | return rgb; |
1907 | |||
1908 | } | 1875 | } |
1909 | else | 1876 | else |
1910 | { | 1877 | { |
@@ -3598,17 +3565,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3598 | 3565 | ||
3599 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) | 3566 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) |
3600 | { | 3567 | { |
3601 | UUID animID = new UUID(); | ||
3602 | |||
3603 | if (!UUID.TryParse(anim, out animID)) | ||
3604 | { | ||
3605 | animID = InventoryKey(anim); | ||
3606 | } | ||
3607 | |||
3608 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); | 3568 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
3609 | 3569 | ||
3610 | if (presence != null) | 3570 | if (presence != null) |
3611 | { | 3571 | { |
3572 | UUID animID = KeyOrName(anim); | ||
3573 | |||
3612 | if (animID == UUID.Zero) | 3574 | if (animID == UUID.Zero) |
3613 | presence.Animator.RemoveAnimation(anim); | 3575 | presence.Animator.RemoveAnimation(anim); |
3614 | else | 3576 | else |
@@ -3737,9 +3699,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3737 | } | 3699 | } |
3738 | 3700 | ||
3739 | ScenePresence presence = World.GetScenePresence(agentID); | 3701 | ScenePresence presence = World.GetScenePresence(agentID); |
3740 | |||
3741 | if (presence != null) | 3702 | if (presence != null) |
3742 | { | 3703 | { |
3704 | // If permissions are being requested from an NPC and were not implicitly granted above then | ||
3705 | // auto grant all reuqested permissions if the script is owned by the NPC or the NPCs owner | ||
3706 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | ||
3707 | if (npcModule != null && npcModule.IsNPC(agentID, World)) | ||
3708 | { | ||
3709 | if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID) | ||
3710 | { | ||
3711 | lock (m_host.TaskInventory) | ||
3712 | { | ||
3713 | m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; | ||
3714 | m_host.TaskInventory[m_item.ItemID].PermsMask = perm; | ||
3715 | } | ||
3716 | |||
3717 | m_ScriptEngine.PostScriptEvent( | ||
3718 | m_item.ItemID, | ||
3719 | new EventParams( | ||
3720 | "run_time_permissions", new Object[] { new LSL_Integer(perm) }, new DetectParams[0])); | ||
3721 | } | ||
3722 | |||
3723 | // it is an NPC, exit even if the permissions werent granted above, they are not going to answer | ||
3724 | // the question! | ||
3725 | return; | ||
3726 | } | ||
3727 | |||
3743 | string ownerName = resolveName(m_host.ParentGroup.RootPart.OwnerID); | 3728 | string ownerName = resolveName(m_host.ParentGroup.RootPart.OwnerID); |
3744 | if (ownerName == String.Empty) | 3729 | if (ownerName == String.Empty) |
3745 | ownerName = "(hippos)"; | 3730 | ownerName = "(hippos)"; |
@@ -3762,10 +3747,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3762 | } | 3747 | } |
3763 | 3748 | ||
3764 | // Requested agent is not in range, refuse perms | 3749 | // Requested agent is not in range, refuse perms |
3765 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( | 3750 | m_ScriptEngine.PostScriptEvent( |
3766 | "run_time_permissions", new Object[] { | 3751 | m_item.ItemID, |
3767 | new LSL_Integer(0) }, | 3752 | new EventParams("run_time_permissions", new Object[] { new LSL_Integer(0) }, new DetectParams[0])); |
3768 | new DetectParams[0])); | ||
3769 | } | 3753 | } |
3770 | 3754 | ||
3771 | void handleScriptAnswer(IClientAPI client, UUID taskID, UUID itemID, int answer) | 3755 | void handleScriptAnswer(IClientAPI client, UUID taskID, UUID itemID, int answer) |
@@ -9456,7 +9440,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9456 | public LSL_String llGetSimulatorHostname() | 9440 | public LSL_String llGetSimulatorHostname() |
9457 | { | 9441 | { |
9458 | m_host.AddScriptLPS(1); | 9442 | m_host.AddScriptLPS(1); |
9459 | return System.Environment.MachineName; | 9443 | IUrlModule UrlModule = World.RequestModuleInterface<IUrlModule>(); |
9444 | return UrlModule.ExternalHostNameForLSL; | ||
9460 | } | 9445 | } |
9461 | 9446 | ||
9462 | // <summary> | 9447 | // <summary> |
@@ -9811,7 +9796,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9811 | 9796 | ||
9812 | GridRegion info; | 9797 | GridRegion info; |
9813 | 9798 | ||
9814 | if (m_ScriptEngine.World.RegionInfo.RegionName == simulator) | 9799 | if (m_ScriptEngine.World.RegionInfo.RegionName == simulator) //Det data for this simulator? |
9800 | |||
9815 | info = new GridRegion(m_ScriptEngine.World.RegionInfo); | 9801 | info = new GridRegion(m_ScriptEngine.World.RegionInfo); |
9816 | else | 9802 | else |
9817 | info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator); | 9803 | info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator); |
@@ -9824,10 +9810,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9824 | ScriptSleep(1000); | 9810 | ScriptSleep(1000); |
9825 | return UUID.Zero.ToString(); | 9811 | return UUID.Zero.ToString(); |
9826 | } | 9812 | } |
9827 | reply = new LSL_Vector( | 9813 | if (m_ScriptEngine.World.RegionInfo.RegionName != simulator) |
9828 | info.RegionLocX, | 9814 | { |
9829 | info.RegionLocY, | 9815 | //Hypergrid Region co-ordinates |
9830 | 0).ToString(); | 9816 | uint rx = 0, ry = 0; |
9817 | Utils.LongToUInts(Convert.ToUInt64(info.RegionSecret), out rx, out ry); | ||
9818 | |||
9819 | reply = new LSL_Vector( | ||
9820 | rx, | ||
9821 | ry, | ||
9822 | 0).ToString(); | ||
9823 | } | ||
9824 | else | ||
9825 | { | ||
9826 | //Local-cooridnates | ||
9827 | reply = new LSL_Vector( | ||
9828 | info.RegionLocX, | ||
9829 | info.RegionLocY, | ||
9830 | 0).ToString(); | ||
9831 | } | ||
9831 | break; | 9832 | break; |
9832 | case ScriptBaseClass.DATA_SIM_STATUS: | 9833 | case ScriptBaseClass.DATA_SIM_STATUS: |
9833 | if (info != null) | 9834 | if (info != null) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 51ace1a..8237b60 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -960,21 +960,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
960 | UUID avatarID = (UUID)avatar; | 960 | UUID avatarID = (UUID)avatar; |
961 | 961 | ||
962 | m_host.AddScriptLPS(1); | 962 | m_host.AddScriptLPS(1); |
963 | |||
964 | // FIXME: What we really want to do here is factor out the similar code in llStopAnimation() to a common | ||
965 | // method (though see that doesn't do the is animation check, which is probably a bug) and have both | ||
966 | // these functions call that common code. However, this does mean navigating the brain-dead requirement | ||
967 | // of calling InitLSL() | ||
963 | if (World.Entities.ContainsKey(avatarID) && World.Entities[avatarID] is ScenePresence) | 968 | if (World.Entities.ContainsKey(avatarID) && World.Entities[avatarID] is ScenePresence) |
964 | { | 969 | { |
965 | ScenePresence target = (ScenePresence)World.Entities[avatarID]; | 970 | ScenePresence target = (ScenePresence)World.Entities[avatarID]; |
966 | if (target != null) | 971 | if (target != null) |
967 | { | 972 | { |
968 | UUID animID = UUID.Zero; | 973 | UUID animID; |
969 | m_host.TaskInventory.LockItemsForRead(true); | 974 | |
970 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 975 | if (!UUID.TryParse(animation, out animID)) |
971 | { | 976 | { |
972 | if (inv.Value.Name == animation) | 977 | TaskInventoryItem item = m_host.Inventory.GetInventoryItem(animation); |
973 | { | 978 | if (item != null && item.Type == (int)AssetType.Animation) |
974 | if (inv.Value.Type == (int)AssetType.Animation) | 979 | animID = item.AssetID; |
975 | animID = inv.Value.AssetID; | 980 | else |
976 | continue; | 981 | animID = UUID.Zero; |
977 | } | ||
978 | } | 982 | } |
979 | m_host.TaskInventory.LockItemsForRead(false); | 983 | m_host.TaskInventory.LockItemsForRead(false); |
980 | 984 | ||
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 8f6fa52..d772c39 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -149,13 +149,16 @@ namespace OpenSim.Server.Handlers.Simulation | |||
149 | 149 | ||
150 | responsedata["int_response_code"] = HttpStatusCode.OK; | 150 | responsedata["int_response_code"] = HttpStatusCode.OK; |
151 | 151 | ||
152 | OSDMap resp = new OSDMap(2); | 152 | OSDMap resp = new OSDMap(3); |
153 | 153 | ||
154 | resp["success"] = OSD.FromBoolean(result); | 154 | resp["success"] = OSD.FromBoolean(result); |
155 | resp["reason"] = OSD.FromString(reason); | 155 | resp["reason"] = OSD.FromString(reason); |
156 | resp["version"] = OSD.FromString(version); | 156 | resp["version"] = OSD.FromString(version); |
157 | 157 | ||
158 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); | 158 | // We must preserve defaults here, otherwise a false "success" will not be put into the JSON map! |
159 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); | ||
160 | |||
161 | // Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]); | ||
159 | } | 162 | } |
160 | 163 | ||
161 | protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) | 164 | protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) |
@@ -569,7 +572,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
569 | AgentData agent = new AgentData(); | 572 | AgentData agent = new AgentData(); |
570 | try | 573 | try |
571 | { | 574 | { |
572 | agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); | 575 | agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID)); |
573 | } | 576 | } |
574 | catch (Exception ex) | 577 | catch (Exception ex) |
575 | { | 578 | { |
@@ -589,7 +592,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
589 | AgentPosition agent = new AgentPosition(); | 592 | AgentPosition agent = new AgentPosition(); |
590 | try | 593 | try |
591 | { | 594 | { |
592 | agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); | 595 | agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID)); |
593 | } | 596 | } |
594 | catch (Exception ex) | 597 | catch (Exception ex) |
595 | { | 598 | { |
diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs index f0d8f69..a4d03ba 100644 --- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs | |||
@@ -161,7 +161,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
161 | if (args.ContainsKey("extra") && args["extra"] != null) | 161 | if (args.ContainsKey("extra") && args["extra"] != null) |
162 | extraStr = args["extra"].AsString(); | 162 | extraStr = args["extra"].AsString(); |
163 | 163 | ||
164 | IScene s = m_SimulationService.GetScene(destination.RegionHandle); | 164 | IScene s = m_SimulationService.GetScene(destination.RegionID); |
165 | ISceneObject sog = null; | 165 | ISceneObject sog = null; |
166 | try | 166 | try |
167 | { | 167 | { |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs index ccef50b..c9cbbfa 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs | |||
@@ -148,5 +148,21 @@ namespace OpenSim.Services.Connectors | |||
148 | { | 148 | { |
149 | m_database.RemoveRegionWindlightSettings(regionID); | 149 | m_database.RemoveRegionWindlightSettings(regionID); |
150 | } | 150 | } |
151 | |||
152 | public string LoadRegionEnvironmentSettings(UUID regionUUID) | ||
153 | { | ||
154 | return m_database.LoadRegionEnvironmentSettings(regionUUID); | ||
155 | } | ||
156 | |||
157 | public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings) | ||
158 | { | ||
159 | m_database.StoreRegionEnvironmentSettings(regionUUID, settings); | ||
160 | } | ||
161 | |||
162 | public void RemoveRegionEnvironmentSettings(UUID regionUUID) | ||
163 | { | ||
164 | m_database.RemoveRegionEnvironmentSettings(regionUUID); | ||
165 | } | ||
166 | |||
151 | } | 167 | } |
152 | } | 168 | } |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 5037543..cd93386 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -62,7 +62,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
62 | //m_Region = region; | 62 | //m_Region = region; |
63 | } | 63 | } |
64 | 64 | ||
65 | public IScene GetScene(ulong regionHandle) | 65 | public IScene GetScene(UUID regionId) |
66 | { | 66 | { |
67 | return null; | 67 | return null; |
68 | } | 68 | } |
@@ -320,29 +320,40 @@ namespace OpenSim.Services.Connectors.Simulation | |||
320 | { | 320 | { |
321 | OSDMap data = (OSDMap)result["_Result"]; | 321 | OSDMap data = (OSDMap)result["_Result"]; |
322 | 322 | ||
323 | // FIXME: If there is a _Result map then it's the success key here that indicates the true success | ||
324 | // or failure, not the sibling result node. | ||
325 | success = data["success"]; | ||
326 | |||
323 | reason = data["reason"].AsString(); | 327 | reason = data["reason"].AsString(); |
324 | if (data["version"] != null && data["version"].AsString() != string.Empty) | 328 | if (data["version"] != null && data["version"].AsString() != string.Empty) |
325 | version = data["version"].AsString(); | 329 | version = data["version"].AsString(); |
326 | 330 | ||
327 | m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1} version {2} ({3})", uri, success, version, data["version"].AsString()); | 331 | m_log.DebugFormat( |
332 | "[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}, reason {2}, version {3} ({4})", | ||
333 | uri, success, reason, version, data["version"].AsString()); | ||
328 | } | 334 | } |
329 | 335 | ||
330 | if (!success) | 336 | if (!success) |
331 | { | 337 | { |
332 | if (result.ContainsKey("Message")) | 338 | // If we don't check this then OpenSimulator 0.7.3.1 and some period before will never see the |
339 | // actual failure message | ||
340 | if (!result.ContainsKey("_Result")) | ||
333 | { | 341 | { |
334 | string message = result["Message"].AsString(); | 342 | if (result.ContainsKey("Message")) |
335 | if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region | ||
336 | { | 343 | { |
337 | m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored"); | 344 | string message = result["Message"].AsString(); |
338 | return true; | 345 | if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region |
346 | { | ||
347 | m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored"); | ||
348 | return true; | ||
349 | } | ||
350 | |||
351 | reason = result["Message"]; | ||
352 | } | ||
353 | else | ||
354 | { | ||
355 | reason = "Communications failure"; | ||
339 | } | 356 | } |
340 | |||
341 | reason = result["Message"]; | ||
342 | } | ||
343 | else | ||
344 | { | ||
345 | reason = "Communications failure"; | ||
346 | } | 357 | } |
347 | 358 | ||
348 | return false; | 359 | return false; |
@@ -356,7 +367,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
356 | } | 367 | } |
357 | catch (Exception e) | 368 | catch (Exception e) |
358 | { | 369 | { |
359 | m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] QueryAcess failed with exception; {0}",e.ToString()); | 370 | m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] QueryAcesss failed with exception; {0}",e.ToString()); |
360 | } | 371 | } |
361 | 372 | ||
362 | return false; | 373 | return false; |
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 3dc87bc..8a60ca5 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -509,19 +509,21 @@ namespace OpenSim.Services.GridService | |||
509 | return; | 509 | return; |
510 | } | 510 | } |
511 | 511 | ||
512 | MainConsole.Instance.Output("Region Name Region UUID"); | ||
513 | MainConsole.Instance.Output("Location URI"); | ||
514 | MainConsole.Instance.Output("Owner ID Flags"); | ||
515 | MainConsole.Instance.Output("-------------------------------------------------------------------------------"); | ||
516 | foreach (RegionData r in regions) | 512 | foreach (RegionData r in regions) |
517 | { | 513 | { |
518 | OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); | 514 | OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); |
519 | MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", | 515 | |
520 | r.RegionName, r.RegionID, | 516 | ConsoleDisplayList dispList = new ConsoleDisplayList(); |
521 | String.Format("{0},{1}", r.posX / Constants.RegionSize, r.posY / Constants.RegionSize), | 517 | dispList.AddRow("Region Name", r.RegionName); |
522 | r.Data["serverURI"], | 518 | dispList.AddRow("Region ID", r.RegionID); |
523 | r.Data["owner_uuid"], flags)); | 519 | dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY)); |
520 | dispList.AddRow("URI", r.Data["serverURI"]); | ||
521 | dispList.AddRow("Owner ID", r.Data["owner_uuid"]); | ||
522 | dispList.AddRow("Flags", flags); | ||
523 | |||
524 | MainConsole.Instance.Output(dispList.ToString()); | ||
524 | } | 525 | } |
526 | |||
525 | return; | 527 | return; |
526 | } | 528 | } |
527 | 529 | ||
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index 7940256..d9f242b 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs | |||
@@ -35,7 +35,17 @@ namespace OpenSim.Services.Interfaces | |||
35 | { | 35 | { |
36 | public interface ISimulationService | 36 | public interface ISimulationService |
37 | { | 37 | { |
38 | IScene GetScene(ulong regionHandle); | 38 | /// <summary> |
39 | /// Retrieve the scene with the given region ID. | ||
40 | /// </summary> | ||
41 | /// <param name='regionId'> | ||
42 | /// Region identifier. | ||
43 | /// </param> | ||
44 | /// <returns> | ||
45 | /// The scene. | ||
46 | /// </returns> | ||
47 | IScene GetScene(UUID regionId); | ||
48 | |||
39 | ISimulationService GetInnerService(); | 49 | ISimulationService GetInnerService(); |
40 | 50 | ||
41 | #region Agents | 51 | #region Agents |
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index eed88bd..3355428 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -302,7 +302,8 @@ namespace OpenSim.Services.InventoryService | |||
302 | 302 | ||
303 | public virtual bool AddFolder(InventoryFolderBase folder) | 303 | public virtual bool AddFolder(InventoryFolderBase folder) |
304 | { | 304 | { |
305 | //m_log.DebugFormat("[XINVENTORY]: Add folder {0} type {1} in parent {2}", folder.Name, folder.Type, folder.ParentID); | 305 | // m_log.DebugFormat("[XINVENTORY]: Add folder {0} type {1} in parent {2}", folder.Name, folder.Type, folder.ParentID); |
306 | |||
306 | InventoryFolderBase check = GetFolder(folder); | 307 | InventoryFolderBase check = GetFolder(folder); |
307 | if (check != null) | 308 | if (check != null) |
308 | return false; | 309 | return false; |
@@ -327,27 +328,36 @@ namespace OpenSim.Services.InventoryService | |||
327 | 328 | ||
328 | public virtual bool UpdateFolder(InventoryFolderBase folder) | 329 | public virtual bool UpdateFolder(InventoryFolderBase folder) |
329 | { | 330 | { |
330 | //m_log.DebugFormat("[XINVENTORY]: Update folder {0} {1} ({2})", folder.Name, folder.Type, folder.ID); | 331 | // m_log.DebugFormat("[XINVENTORY]: Update folder {0} {1} ({2})", folder.Name, folder.Type, folder.ID); |
332 | |||
331 | XInventoryFolder xFolder = ConvertFromOpenSim(folder); | 333 | XInventoryFolder xFolder = ConvertFromOpenSim(folder); |
332 | InventoryFolderBase check = GetFolder(folder); | 334 | InventoryFolderBase check = GetFolder(folder); |
335 | |||
333 | if (check == null) | 336 | if (check == null) |
334 | return AddFolder(folder); | 337 | return AddFolder(folder); |
335 | 338 | ||
336 | if (check.Type != -1 || xFolder.type != -1) | 339 | if ((check.Type != (short)AssetType.Unknown || xFolder.type != (short)AssetType.Unknown) |
340 | && (check.Type != (short)AssetType.OutfitFolder || xFolder.type != (short)AssetType.OutfitFolder)) | ||
337 | { | 341 | { |
338 | if (xFolder.version < check.Version) | 342 | if (xFolder.version < check.Version) |
339 | { | 343 | { |
340 | //m_log.DebugFormat("[XINVENTORY]: {0} < {1} can't do", xFolder.version, check.Version); | 344 | // m_log.DebugFormat("[XINVENTORY]: {0} < {1} can't do", xFolder.version, check.Version); |
341 | return false; | 345 | return false; |
342 | } | 346 | } |
347 | |||
343 | check.Version = (ushort)xFolder.version; | 348 | check.Version = (ushort)xFolder.version; |
344 | xFolder = ConvertFromOpenSim(check); | 349 | xFolder = ConvertFromOpenSim(check); |
345 | //m_log.DebugFormat("[XINVENTORY]: Storing {0} {1} {2}", xFolder.folderName, xFolder.version, xFolder.type); | 350 | |
351 | // m_log.DebugFormat( | ||
352 | // "[XINVENTORY]: Storing version only update to system folder {0} {1} {2}", | ||
353 | // xFolder.folderName, xFolder.version, xFolder.type); | ||
354 | |||
346 | return m_Database.StoreFolder(xFolder); | 355 | return m_Database.StoreFolder(xFolder); |
347 | } | 356 | } |
348 | 357 | ||
349 | if (xFolder.version < check.Version) | 358 | if (xFolder.version < check.Version) |
350 | xFolder.version = check.Version; | 359 | xFolder.version = check.Version; |
360 | |||
351 | xFolder.folderID = check.ID; | 361 | xFolder.folderID = check.ID; |
352 | 362 | ||
353 | return m_Database.StoreFolder(xFolder); | 363 | return m_Database.StoreFolder(xFolder); |
@@ -433,7 +443,6 @@ namespace OpenSim.Services.InventoryService | |||
433 | 443 | ||
434 | public virtual bool UpdateItem(InventoryItemBase item) | 444 | public virtual bool UpdateItem(InventoryItemBase item) |
435 | { | 445 | { |
436 | // throw new Exception("urrgh"); | ||
437 | if (!m_AllowDelete) | 446 | if (!m_AllowDelete) |
438 | if (item.AssetType == (sbyte)AssetType.Link || item.AssetType == (sbyte)AssetType.LinkFolder) | 447 | if (item.AssetType == (sbyte)AssetType.Link || item.AssetType == (sbyte)AssetType.LinkFolder) |
439 | return false; | 448 | return false; |
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 59829d9..239afc0 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs | |||
@@ -566,7 +566,7 @@ namespace OpenSim.Tests.Common | |||
566 | /// <returns></returns> | 566 | /// <returns></returns> |
567 | public static SceneObjectPart AddSceneObject(Scene scene) | 567 | public static SceneObjectPart AddSceneObject(Scene scene) |
568 | { | 568 | { |
569 | return AddSceneObject(scene, "Test Object"); | 569 | return AddSceneObject(scene, "Test Object", UUID.Zero); |
570 | } | 570 | } |
571 | 571 | ||
572 | /// <summary> | 572 | /// <summary> |
@@ -574,10 +574,11 @@ namespace OpenSim.Tests.Common | |||
574 | /// </summary> | 574 | /// </summary> |
575 | /// <param name="scene"></param> | 575 | /// <param name="scene"></param> |
576 | /// <param name="name"></param> | 576 | /// <param name="name"></param> |
577 | /// <param name="ownerId"></param> | ||
577 | /// <returns></returns> | 578 | /// <returns></returns> |
578 | public static SceneObjectPart AddSceneObject(Scene scene, string name) | 579 | public static SceneObjectPart AddSceneObject(Scene scene, string name, UUID ownerId) |
579 | { | 580 | { |
580 | SceneObjectPart part = CreateSceneObjectPart(name, UUID.Random(), UUID.Zero); | 581 | SceneObjectPart part = CreateSceneObjectPart(name, UUID.Random(), ownerId); |
581 | 582 | ||
582 | //part.UpdatePrimFlags(false, false, true); | 583 | //part.UpdatePrimFlags(false, false, true); |
583 | //part.ObjectFlags |= (uint)PrimFlags.Phantom; | 584 | //part.ObjectFlags |= (uint)PrimFlags.Phantom; |
diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs index 579d41c..1845eb9 100644 --- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs | |||
@@ -112,6 +112,21 @@ namespace OpenSim.Data.Null | |||
112 | { | 112 | { |
113 | m_store.StoreRegionWindlightSettings(wl); | 113 | m_store.StoreRegionWindlightSettings(wl); |
114 | } | 114 | } |
115 | |||
116 | public string LoadRegionEnvironmentSettings(UUID regionUUID) | ||
117 | { | ||
118 | return m_store.LoadRegionEnvironmentSettings(regionUUID); | ||
119 | } | ||
120 | |||
121 | public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings) | ||
122 | { | ||
123 | m_store.StoreRegionEnvironmentSettings(regionUUID, settings); | ||
124 | } | ||
125 | |||
126 | public void RemoveRegionEnvironmentSettings(UUID regionUUID) | ||
127 | { | ||
128 | m_store.RemoveRegionEnvironmentSettings(regionUUID); | ||
129 | } | ||
115 | } | 130 | } |
116 | 131 | ||
117 | /// <summary> | 132 | /// <summary> |
@@ -158,7 +173,25 @@ namespace OpenSim.Data.Null | |||
158 | { | 173 | { |
159 | //This connector doesn't support the windlight module yet | 174 | //This connector doesn't support the windlight module yet |
160 | } | 175 | } |
161 | 176 | ||
177 | #region Environment Settings | ||
178 | public string LoadRegionEnvironmentSettings(UUID regionUUID) | ||
179 | { | ||
180 | //This connector doesn't support the Environment module yet | ||
181 | return string.Empty; | ||
182 | } | ||
183 | |||
184 | public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings) | ||
185 | { | ||
186 | //This connector doesn't support the Environment module yet | ||
187 | } | ||
188 | |||
189 | public void RemoveRegionEnvironmentSettings(UUID regionUUID) | ||
190 | { | ||
191 | //This connector doesn't support the Environment module yet | ||
192 | } | ||
193 | #endregion | ||
194 | |||
162 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 195 | public RegionSettings LoadRegionSettings(UUID regionUUID) |
163 | { | 196 | { |
164 | RegionSettings rs = null; | 197 | RegionSettings rs = null; |