diff options
249 files changed, 8003 insertions, 3633 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 3013277..e1de751 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt | |||
@@ -143,7 +143,10 @@ what it is today. | |||
143 | * sempuki | 143 | * sempuki |
144 | * SignpostMarv | 144 | * SignpostMarv |
145 | * SpotOn3D | 145 | * SpotOn3D |
146 | * Stefan_Boom / stoehr | ||
146 | * Strawberry Fride | 147 | * Strawberry Fride |
148 | * Talun | ||
149 | * TBG Renfold | ||
147 | * tglion | 150 | * tglion |
148 | * tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud) | 151 | * tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud) |
149 | * tyre | 152 | * tyre |
@@ -202,3 +205,4 @@ In addition, we would like to thank: | |||
202 | * The Mono Project | 205 | * The Mono Project |
203 | * The NANT Developers | 206 | * The NANT Developers |
204 | * Microsoft (.NET, MSSQL-Adapters) | 207 | * Microsoft (.NET, MSSQL-Adapters) |
208 | *x | ||
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index 45b8d6f..0065702 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | |||
@@ -122,9 +122,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
122 | Thread.CurrentThread.ManagedThreadId.ToString() + | 122 | Thread.CurrentThread.ManagedThreadId.ToString() + |
123 | ")"); | 123 | ")"); |
124 | 124 | ||
125 | m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]); | 125 | bool changed = m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]); |
126 | m_openSim.CreateRegion(regionsToLoad[i], true, out scene); | 126 | m_openSim.CreateRegion(regionsToLoad[i], true, out scene); |
127 | regionsToLoad[i].EstateSettings.Save(); | 127 | if (changed) |
128 | regionsToLoad[i].EstateSettings.Save(); | ||
128 | 129 | ||
129 | if (scene != null) | 130 | if (scene != null) |
130 | { | 131 | { |
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs index 0ba8931..5bab52f 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs | |||
@@ -63,7 +63,8 @@ namespace OpenSim.Capabilities.Handlers | |||
63 | 63 | ||
64 | FetchInventory2Handler fiHandler = new FetchInventory2Handler(m_InventoryService); | 64 | FetchInventory2Handler fiHandler = new FetchInventory2Handler(m_InventoryService); |
65 | IRequestHandler reqHandler | 65 | IRequestHandler reqHandler |
66 | = new RestStreamHandler("POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest); | 66 | = new RestStreamHandler( |
67 | "POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest, "FetchInventory", null); | ||
67 | server.AddStreamHandler(reqHandler); | 68 | server.AddStreamHandler(reqHandler); |
68 | } | 69 | } |
69 | } | 70 | } |
diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs index 2ecfa3c..8a275f3 100644 --- a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs | |||
@@ -66,13 +66,14 @@ namespace OpenSim.Capabilities.Handlers | |||
66 | throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); | 66 | throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); |
67 | 67 | ||
68 | GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); | 68 | GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); |
69 | IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), | 69 | IRequestHandler reqHandler |
70 | delegate(Hashtable m_dhttpMethod) | 70 | = new RestHTTPHandler( |
71 | { | 71 | "GET", |
72 | return gmeshHandler.ProcessGetMesh(m_dhttpMethod, UUID.Zero, null); | 72 | "/CAPS/" + UUID.Random(), |
73 | }); | 73 | httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null), |
74 | "GetMesh", | ||
75 | null); | ||
74 | server.AddStreamHandler(reqHandler); | 76 | server.AddStreamHandler(reqHandler); |
75 | } | 77 | } |
76 | |||
77 | } | 78 | } |
78 | } | 79 | } \ No newline at end of file |
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 217217e..abdbc72 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | |||
@@ -58,8 +58,8 @@ namespace OpenSim.Capabilities.Handlers | |||
58 | // TODO: Change this to a config option | 58 | // TODO: Change this to a config option |
59 | const string REDIRECT_URL = null; | 59 | const string REDIRECT_URL = null; |
60 | 60 | ||
61 | public GetTextureHandler(string path, IAssetService assService) : | 61 | public GetTextureHandler(string path, IAssetService assService, string name, string description) |
62 | base("GET", path) | 62 | : base("GET", path, name, description) |
63 | { | 63 | { |
64 | m_assetService = assService; | 64 | m_assetService = assService; |
65 | } | 65 | } |
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs index 0d072f7..71cf033 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs | |||
@@ -62,8 +62,8 @@ namespace OpenSim.Capabilities.Handlers | |||
62 | if (m_AssetService == null) | 62 | if (m_AssetService == null) |
63 | throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); | 63 | throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); |
64 | 64 | ||
65 | server.AddStreamHandler(new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService)); | 65 | server.AddStreamHandler( |
66 | new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService, "GetTexture", null)); | ||
66 | } | 67 | } |
67 | |||
68 | } | 68 | } |
69 | } | 69 | } \ No newline at end of file |
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs b/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs index fd152c3..761e4e7 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs | |||
@@ -50,9 +50,9 @@ namespace OpenSim.Capabilities.Handlers.GetTexture.Tests | |||
50 | TestHelpers.InMethod(); | 50 | TestHelpers.InMethod(); |
51 | 51 | ||
52 | // Overkill - we only really need the asset service, not a whole scene. | 52 | // Overkill - we only really need the asset service, not a whole scene. |
53 | Scene scene = SceneHelpers.SetupScene(); | 53 | Scene scene = new SceneHelpers().SetupScene(); |
54 | 54 | ||
55 | GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService); | 55 | GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService, "TestGetTexture", null); |
56 | TestOSHttpRequest req = new TestOSHttpRequest(); | 56 | TestOSHttpRequest req = new TestOSHttpRequest(); |
57 | TestOSHttpResponse resp = new TestOSHttpResponse(); | 57 | TestOSHttpResponse resp = new TestOSHttpResponse(); |
58 | req.Url = new Uri("http://localhost/?texture_id=00000000-0000-1111-9999-000000000012"); | 58 | req.Url = new Uri("http://localhost/?texture_id=00000000-0000-1111-9999-000000000012"); |
diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs index 594ce9d..8849a59 100644 --- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs | |||
@@ -85,8 +85,8 @@ namespace OpenSim.Capabilities.Handlers | |||
85 | uploader.OnUpLoad += BakedTextureUploaded; | 85 | uploader.OnUpLoad += BakedTextureUploaded; |
86 | 86 | ||
87 | m_HostCapsObj.HttpListener.AddStreamHandler( | 87 | m_HostCapsObj.HttpListener.AddStreamHandler( |
88 | new BinaryStreamHandler("POST", capsBase + uploaderPath, | 88 | new BinaryStreamHandler( |
89 | uploader.uploaderCaps)); | 89 | "POST", capsBase + uploaderPath, uploader.uploaderCaps, "UploadBakedTexture", null)); |
90 | 90 | ||
91 | string protocol = "http://"; | 91 | string protocol = "http://"; |
92 | 92 | ||
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs index 92eeb14..5d86557 100644 --- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs | |||
@@ -68,7 +68,13 @@ namespace OpenSim.Capabilities.Handlers | |||
68 | ServerUtils.LoadPlugin<ILibraryService>(libService, args); | 68 | ServerUtils.LoadPlugin<ILibraryService>(libService, args); |
69 | 69 | ||
70 | WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); | 70 | WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); |
71 | IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/, webFetchHandler.FetchInventoryDescendentsRequest); | 71 | IRequestHandler reqHandler |
72 | = new RestStreamHandler( | ||
73 | "POST", | ||
74 | "/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/, | ||
75 | webFetchHandler.FetchInventoryDescendentsRequest, | ||
76 | "WebFetchInvDesc", | ||
77 | null); | ||
72 | server.AddStreamHandler(reqHandler); | 78 | server.AddStreamHandler(reqHandler); |
73 | } | 79 | } |
74 | 80 | ||
diff --git a/OpenSim/Capabilities/LLSDStreamHandler.cs b/OpenSim/Capabilities/LLSDStreamHandler.cs index c7c1fc9..f5c728c 100644 --- a/OpenSim/Capabilities/LLSDStreamHandler.cs +++ b/OpenSim/Capabilities/LLSDStreamHandler.cs | |||
@@ -39,7 +39,11 @@ namespace OpenSim.Framework.Capabilities | |||
39 | private LLSDMethod<TRequest, TResponse> m_method; | 39 | private LLSDMethod<TRequest, TResponse> m_method; |
40 | 40 | ||
41 | public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) | 41 | public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) |
42 | : base(httpMethod, path) | 42 | : this(httpMethod, path, method, null, null) {} |
43 | |||
44 | public LLSDStreamhandler( | ||
45 | string httpMethod, string path, LLSDMethod<TRequest, TResponse> method, string name, string description) | ||
46 | : base(httpMethod, path, name, description) | ||
43 | { | 47 | { |
44 | m_method = method; | 48 | m_method = method; |
45 | } | 49 | } |
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index a22dc0a..20df234 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -163,54 +163,53 @@ namespace OpenSim.Data.MySQL | |||
163 | { | 163 | { |
164 | dbcon.Open(); | 164 | dbcon.Open(); |
165 | 165 | ||
166 | MySqlCommand cmd = | 166 | using (MySqlCommand cmd = |
167 | new MySqlCommand( | 167 | new MySqlCommand( |
168 | "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" + | 168 | "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" + |
169 | "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)", | 169 | "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)", |
170 | dbcon); | 170 | dbcon)) |
171 | |||
172 | string assetName = asset.Name; | ||
173 | if (asset.Name.Length > 64) | ||
174 | { | ||
175 | assetName = asset.Name.Substring(0, 64); | ||
176 | m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); | ||
177 | } | ||
178 | |||
179 | string assetDescription = asset.Description; | ||
180 | if (asset.Description.Length > 64) | ||
181 | { | ||
182 | assetDescription = asset.Description.Substring(0, 64); | ||
183 | m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); | ||
184 | } | ||
185 | |||
186 | // need to ensure we dispose | ||
187 | try | ||
188 | { | 171 | { |
189 | using (cmd) | 172 | string assetName = asset.Name; |
173 | if (asset.Name.Length > 64) | ||
190 | { | 174 | { |
191 | // create unix epoch time | 175 | assetName = asset.Name.Substring(0, 64); |
192 | int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); | 176 | m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); |
193 | cmd.Parameters.AddWithValue("?id", asset.ID); | 177 | } |
194 | cmd.Parameters.AddWithValue("?name", assetName); | 178 | |
195 | cmd.Parameters.AddWithValue("?description", assetDescription); | 179 | string assetDescription = asset.Description; |
196 | cmd.Parameters.AddWithValue("?assetType", asset.Type); | 180 | if (asset.Description.Length > 64) |
197 | cmd.Parameters.AddWithValue("?local", asset.Local); | 181 | { |
198 | cmd.Parameters.AddWithValue("?temporary", asset.Temporary); | 182 | assetDescription = asset.Description.Substring(0, 64); |
199 | cmd.Parameters.AddWithValue("?create_time", now); | 183 | m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); |
200 | cmd.Parameters.AddWithValue("?access_time", now); | 184 | } |
201 | cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID); | 185 | |
202 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); | 186 | try |
203 | cmd.Parameters.AddWithValue("?data", asset.Data); | 187 | { |
204 | cmd.ExecuteNonQuery(); | 188 | using (cmd) |
205 | cmd.Dispose(); | 189 | { |
206 | return true; | 190 | // create unix epoch time |
191 | int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); | ||
192 | cmd.Parameters.AddWithValue("?id", asset.ID); | ||
193 | cmd.Parameters.AddWithValue("?name", assetName); | ||
194 | cmd.Parameters.AddWithValue("?description", assetDescription); | ||
195 | cmd.Parameters.AddWithValue("?assetType", asset.Type); | ||
196 | cmd.Parameters.AddWithValue("?local", asset.Local); | ||
197 | cmd.Parameters.AddWithValue("?temporary", asset.Temporary); | ||
198 | cmd.Parameters.AddWithValue("?create_time", now); | ||
199 | cmd.Parameters.AddWithValue("?access_time", now); | ||
200 | cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID); | ||
201 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); | ||
202 | cmd.Parameters.AddWithValue("?data", asset.Data); | ||
203 | cmd.ExecuteNonQuery(); | ||
204 | return true; | ||
205 | } | ||
206 | } | ||
207 | catch (Exception e) | ||
208 | { | ||
209 | m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", | ||
210 | asset.FullID, asset.Name, e.Message); | ||
211 | return false; | ||
207 | } | 212 | } |
208 | } | ||
209 | catch (Exception e) | ||
210 | { | ||
211 | m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", | ||
212 | asset.FullID, asset.Name, e.Message); | ||
213 | return false; | ||
214 | } | 213 | } |
215 | } | 214 | } |
216 | } | 215 | } |
@@ -223,33 +222,31 @@ namespace OpenSim.Data.MySQL | |||
223 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 222 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
224 | { | 223 | { |
225 | dbcon.Open(); | 224 | dbcon.Open(); |
226 | MySqlCommand cmd = | ||
227 | new MySqlCommand("update assets set access_time=?access_time where id=?id", | ||
228 | dbcon); | ||
229 | 225 | ||
230 | // need to ensure we dispose | 226 | using (MySqlCommand cmd |
231 | try | 227 | = new MySqlCommand("update assets set access_time=?access_time where id=?id", dbcon)) |
232 | { | 228 | { |
233 | using (cmd) | 229 | try |
234 | { | 230 | { |
235 | // create unix epoch time | 231 | using (cmd) |
236 | int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); | 232 | { |
237 | cmd.Parameters.AddWithValue("?id", asset.ID); | 233 | // create unix epoch time |
238 | cmd.Parameters.AddWithValue("?access_time", now); | 234 | int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); |
239 | cmd.ExecuteNonQuery(); | 235 | cmd.Parameters.AddWithValue("?id", asset.ID); |
240 | cmd.Dispose(); | 236 | cmd.Parameters.AddWithValue("?access_time", now); |
237 | cmd.ExecuteNonQuery(); | ||
238 | } | ||
239 | } | ||
240 | catch (Exception e) | ||
241 | { | ||
242 | m_log.ErrorFormat( | ||
243 | "[ASSETS DB]: " + | ||
244 | "MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString() | ||
245 | + Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name); | ||
241 | } | 246 | } |
242 | } | ||
243 | catch (Exception e) | ||
244 | { | ||
245 | m_log.ErrorFormat( | ||
246 | "[ASSETS DB]: " + | ||
247 | "MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString() | ||
248 | + Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name); | ||
249 | } | 247 | } |
250 | } | 248 | } |
251 | } | 249 | } |
252 | |||
253 | } | 250 | } |
254 | 251 | ||
255 | /// <summary> | 252 | /// <summary> |
@@ -312,35 +309,41 @@ namespace OpenSim.Data.MySQL | |||
312 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 309 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
313 | { | 310 | { |
314 | dbcon.Open(); | 311 | dbcon.Open(); |
315 | MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id,asset_flags,CreatorID FROM assets LIMIT ?start, ?count", dbcon); | ||
316 | cmd.Parameters.AddWithValue("?start", start); | ||
317 | cmd.Parameters.AddWithValue("?count", count); | ||
318 | 312 | ||
319 | try | 313 | using (MySqlCommand cmd |
314 | = new MySqlCommand( | ||
315 | "SELECT name,description,assetType,temporary,id,asset_flags,CreatorID FROM assets LIMIT ?start, ?count", | ||
316 | dbcon)) | ||
320 | { | 317 | { |
321 | using (MySqlDataReader dbReader = cmd.ExecuteReader()) | 318 | cmd.Parameters.AddWithValue("?start", start); |
319 | cmd.Parameters.AddWithValue("?count", count); | ||
320 | |||
321 | try | ||
322 | { | 322 | { |
323 | while (dbReader.Read()) | 323 | using (MySqlDataReader dbReader = cmd.ExecuteReader()) |
324 | { | 324 | { |
325 | AssetMetadata metadata = new AssetMetadata(); | 325 | while (dbReader.Read()) |
326 | metadata.Name = (string)dbReader["name"]; | 326 | { |
327 | metadata.Description = (string)dbReader["description"]; | 327 | AssetMetadata metadata = new AssetMetadata(); |
328 | metadata.Type = (sbyte)dbReader["assetType"]; | 328 | metadata.Name = (string)dbReader["name"]; |
329 | metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct. | 329 | metadata.Description = (string)dbReader["description"]; |
330 | metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); | 330 | metadata.Type = (sbyte)dbReader["assetType"]; |
331 | metadata.FullID = DBGuid.FromDB(dbReader["id"]); | 331 | metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct. |
332 | metadata.CreatorID = dbReader["CreatorID"].ToString(); | 332 | metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); |
333 | 333 | metadata.FullID = DBGuid.FromDB(dbReader["id"]); | |
334 | // Current SHA1s are not stored/computed. | 334 | metadata.CreatorID = dbReader["CreatorID"].ToString(); |
335 | metadata.SHA1 = new byte[] { }; | 335 | |
336 | 336 | // Current SHA1s are not stored/computed. | |
337 | retList.Add(metadata); | 337 | metadata.SHA1 = new byte[] { }; |
338 | |||
339 | retList.Add(metadata); | ||
340 | } | ||
338 | } | 341 | } |
339 | } | 342 | } |
340 | } | 343 | catch (Exception e) |
341 | catch (Exception e) | 344 | { |
342 | { | 345 | m_log.Error("[ASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString()); |
343 | m_log.Error("[ASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString()); | 346 | } |
344 | } | 347 | } |
345 | } | 348 | } |
346 | } | 349 | } |
@@ -355,11 +358,12 @@ namespace OpenSim.Data.MySQL | |||
355 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 358 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
356 | { | 359 | { |
357 | dbcon.Open(); | 360 | dbcon.Open(); |
358 | MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon); | ||
359 | cmd.Parameters.AddWithValue("?id", id); | ||
360 | cmd.ExecuteNonQuery(); | ||
361 | 361 | ||
362 | cmd.Dispose(); | 362 | using (MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon)) |
363 | { | ||
364 | cmd.Parameters.AddWithValue("?id", id); | ||
365 | cmd.ExecuteNonQuery(); | ||
366 | } | ||
363 | } | 367 | } |
364 | } | 368 | } |
365 | 369 | ||
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs index 8d82f61..7627497 100644 --- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs +++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs | |||
@@ -70,99 +70,106 @@ namespace OpenSim.Data.MySQL | |||
70 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 70 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
71 | { | 71 | { |
72 | dbcon.Open(); | 72 | dbcon.Open(); |
73 | MySqlCommand cmd = new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID", dbcon); | ||
74 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); | ||
75 | |||
76 | IDataReader result = cmd.ExecuteReader(); | ||
77 | 73 | ||
78 | if (result.Read()) | 74 | using (MySqlCommand cmd |
75 | = new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID", dbcon)) | ||
79 | { | 76 | { |
80 | ret.PrincipalID = principalID; | 77 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); |
81 | 78 | ||
82 | if (m_ColumnNames == null) | 79 | IDataReader result = cmd.ExecuteReader(); |
80 | |||
81 | if (result.Read()) | ||
83 | { | 82 | { |
84 | m_ColumnNames = new List<string>(); | 83 | ret.PrincipalID = principalID; |
85 | 84 | ||
86 | DataTable schemaTable = result.GetSchemaTable(); | 85 | CheckColumnNames(result); |
87 | foreach (DataRow row in schemaTable.Rows) | 86 | |
88 | m_ColumnNames.Add(row["ColumnName"].ToString()); | 87 | foreach (string s in m_ColumnNames) |
88 | { | ||
89 | if (s == "UUID") | ||
90 | continue; | ||
91 | |||
92 | ret.Data[s] = result[s].ToString(); | ||
93 | } | ||
94 | |||
95 | return ret; | ||
89 | } | 96 | } |
90 | 97 | else | |
91 | foreach (string s in m_ColumnNames) | ||
92 | { | 98 | { |
93 | if (s == "UUID") | 99 | return null; |
94 | continue; | ||
95 | |||
96 | ret.Data[s] = result[s].ToString(); | ||
97 | } | 100 | } |
98 | |||
99 | return ret; | ||
100 | } | ||
101 | else | ||
102 | { | ||
103 | return null; | ||
104 | } | 101 | } |
105 | } | 102 | } |
106 | } | 103 | } |
107 | 104 | ||
108 | public bool Store(AuthenticationData data) | 105 | private void CheckColumnNames(IDataReader result) |
109 | { | 106 | { |
110 | if (data.Data.ContainsKey("UUID")) | 107 | if (m_ColumnNames != null) |
111 | data.Data.Remove("UUID"); | 108 | return; |
112 | 109 | ||
113 | string[] fields = new List<string>(data.Data.Keys).ToArray(); | 110 | List<string> columnNames = new List<string>(); |
114 | |||
115 | MySqlCommand cmd = new MySqlCommand(); | ||
116 | 111 | ||
117 | string update = "update `"+m_Realm+"` set "; | 112 | DataTable schemaTable = result.GetSchemaTable(); |
118 | bool first = true; | 113 | foreach (DataRow row in schemaTable.Rows) |
119 | foreach (string field in fields) | 114 | columnNames.Add(row["ColumnName"].ToString()); |
120 | { | ||
121 | if (!first) | ||
122 | update += ", "; | ||
123 | update += "`" + field + "` = ?"+field; | ||
124 | 115 | ||
125 | first = false; | 116 | m_ColumnNames = columnNames; |
126 | 117 | } | |
127 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); | ||
128 | } | ||
129 | 118 | ||
130 | update += " where UUID = ?principalID"; | 119 | public bool Store(AuthenticationData data) |
120 | { | ||
121 | if (data.Data.ContainsKey("UUID")) | ||
122 | data.Data.Remove("UUID"); | ||
131 | 123 | ||
132 | cmd.CommandText = update; | 124 | string[] fields = new List<string>(data.Data.Keys).ToArray(); |
133 | cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString()); | ||
134 | 125 | ||
135 | if (ExecuteNonQuery(cmd) < 1) | 126 | using (MySqlCommand cmd = new MySqlCommand()) |
136 | { | 127 | { |
137 | string insert = "insert into `" + m_Realm + "` (`UUID`, `" + | 128 | string update = "update `"+m_Realm+"` set "; |
138 | String.Join("`, `", fields) + | 129 | bool first = true; |
139 | "`) values (?principalID, ?" + String.Join(", ?", fields) + ")"; | 130 | foreach (string field in fields) |
140 | 131 | { | |
141 | cmd.CommandText = insert; | 132 | if (!first) |
142 | 133 | update += ", "; | |
134 | update += "`" + field + "` = ?"+field; | ||
135 | |||
136 | first = false; | ||
137 | |||
138 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); | ||
139 | } | ||
140 | |||
141 | update += " where UUID = ?principalID"; | ||
142 | |||
143 | cmd.CommandText = update; | ||
144 | cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString()); | ||
145 | |||
143 | if (ExecuteNonQuery(cmd) < 1) | 146 | if (ExecuteNonQuery(cmd) < 1) |
144 | { | 147 | { |
145 | cmd.Dispose(); | 148 | string insert = "insert into `" + m_Realm + "` (`UUID`, `" + |
146 | return false; | 149 | String.Join("`, `", fields) + |
150 | "`) values (?principalID, ?" + String.Join(", ?", fields) + ")"; | ||
151 | |||
152 | cmd.CommandText = insert; | ||
153 | |||
154 | if (ExecuteNonQuery(cmd) < 1) | ||
155 | return false; | ||
147 | } | 156 | } |
148 | } | 157 | } |
149 | 158 | ||
150 | cmd.Dispose(); | ||
151 | |||
152 | return true; | 159 | return true; |
153 | } | 160 | } |
154 | 161 | ||
155 | public bool SetDataItem(UUID principalID, string item, string value) | 162 | public bool SetDataItem(UUID principalID, string item, string value) |
156 | { | 163 | { |
157 | MySqlCommand cmd = new MySqlCommand("update `" + m_Realm + | 164 | using (MySqlCommand cmd |
158 | "` set `" + item + "` = ?" + item + " where UUID = ?UUID"); | 165 | = new MySqlCommand("update `" + m_Realm + "` set `" + item + "` = ?" + item + " where UUID = ?UUID")) |
159 | 166 | { | |
160 | 167 | cmd.Parameters.AddWithValue("?"+item, value); | |
161 | cmd.Parameters.AddWithValue("?"+item, value); | 168 | cmd.Parameters.AddWithValue("?UUID", principalID.ToString()); |
162 | cmd.Parameters.AddWithValue("?UUID", principalID.ToString()); | 169 | |
163 | 170 | if (ExecuteNonQuery(cmd) > 0) | |
164 | if (ExecuteNonQuery(cmd) > 0) | 171 | return true; |
165 | return true; | 172 | } |
166 | 173 | ||
167 | return false; | 174 | return false; |
168 | } | 175 | } |
@@ -172,18 +179,18 @@ namespace OpenSim.Data.MySQL | |||
172 | if (System.Environment.TickCount - m_LastExpire > 30000) | 179 | if (System.Environment.TickCount - m_LastExpire > 30000) |
173 | DoExpire(); | 180 | DoExpire(); |
174 | 181 | ||
175 | MySqlCommand cmd = new MySqlCommand("insert into tokens (UUID, token, validity) values (?principalID, ?token, date_add(now(), interval ?lifetime minute))"); | 182 | using (MySqlCommand cmd |
176 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); | 183 | = new MySqlCommand( |
177 | cmd.Parameters.AddWithValue("?token", token); | 184 | "insert into tokens (UUID, token, validity) values (?principalID, ?token, date_add(now(), interval ?lifetime minute))")) |
178 | cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString()); | ||
179 | |||
180 | if (ExecuteNonQuery(cmd) > 0) | ||
181 | { | 185 | { |
182 | cmd.Dispose(); | 186 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); |
183 | return true; | 187 | cmd.Parameters.AddWithValue("?token", token); |
188 | cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString()); | ||
189 | |||
190 | if (ExecuteNonQuery(cmd) > 0) | ||
191 | return true; | ||
184 | } | 192 | } |
185 | 193 | ||
186 | cmd.Dispose(); | ||
187 | return false; | 194 | return false; |
188 | } | 195 | } |
189 | 196 | ||
@@ -192,30 +199,29 @@ namespace OpenSim.Data.MySQL | |||
192 | if (System.Environment.TickCount - m_LastExpire > 30000) | 199 | if (System.Environment.TickCount - m_LastExpire > 30000) |
193 | DoExpire(); | 200 | DoExpire(); |
194 | 201 | ||
195 | MySqlCommand cmd = new MySqlCommand("update tokens set validity = date_add(now(), interval ?lifetime minute) where UUID = ?principalID and token = ?token and validity > now()"); | 202 | using (MySqlCommand cmd |
196 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); | 203 | = new MySqlCommand( |
197 | cmd.Parameters.AddWithValue("?token", token); | 204 | "update tokens set validity = date_add(now(), interval ?lifetime minute) where UUID = ?principalID and token = ?token and validity > now()")) |
198 | cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString()); | ||
199 | |||
200 | if (ExecuteNonQuery(cmd) > 0) | ||
201 | { | 205 | { |
202 | cmd.Dispose(); | 206 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); |
203 | return true; | 207 | cmd.Parameters.AddWithValue("?token", token); |
204 | } | 208 | cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString()); |
205 | 209 | ||
206 | cmd.Dispose(); | 210 | if (ExecuteNonQuery(cmd) > 0) |
211 | return true; | ||
212 | } | ||
207 | 213 | ||
208 | return false; | 214 | return false; |
209 | } | 215 | } |
210 | 216 | ||
211 | private void DoExpire() | 217 | private void DoExpire() |
212 | { | 218 | { |
213 | MySqlCommand cmd = new MySqlCommand("delete from tokens where validity < now()"); | 219 | using (MySqlCommand cmd = new MySqlCommand("delete from tokens where validity < now()")) |
214 | ExecuteNonQuery(cmd); | 220 | { |
215 | 221 | ExecuteNonQuery(cmd); | |
216 | cmd.Dispose(); | 222 | } |
217 | 223 | ||
218 | m_LastExpire = System.Environment.TickCount; | 224 | m_LastExpire = System.Environment.TickCount; |
219 | } | 225 | } |
220 | } | 226 | } |
221 | } | 227 | } \ No newline at end of file |
diff --git a/OpenSim/Data/MySQL/MySQLAvatarData.cs b/OpenSim/Data/MySQL/MySQLAvatarData.cs index 8c841ab..6a2f5d8 100644 --- a/OpenSim/Data/MySQL/MySQLAvatarData.cs +++ b/OpenSim/Data/MySQL/MySQLAvatarData.cs | |||
@@ -52,14 +52,15 @@ namespace OpenSim.Data.MySQL | |||
52 | 52 | ||
53 | public bool Delete(UUID principalID, string name) | 53 | public bool Delete(UUID principalID, string name) |
54 | { | 54 | { |
55 | MySqlCommand cmd = new MySqlCommand(); | 55 | using (MySqlCommand cmd = new MySqlCommand()) |
56 | 56 | { | |
57 | cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = ?PrincipalID and `Name` = ?Name", m_Realm); | 57 | cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = ?PrincipalID and `Name` = ?Name", m_Realm); |
58 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); | 58 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); |
59 | cmd.Parameters.AddWithValue("?Name", name); | 59 | cmd.Parameters.AddWithValue("?Name", name); |
60 | 60 | ||
61 | if (ExecuteNonQuery(cmd) > 0) | 61 | if (ExecuteNonQuery(cmd) > 0) |
62 | return true; | 62 | return true; |
63 | } | ||
63 | 64 | ||
64 | return false; | 65 | return false; |
65 | } | 66 | } |
diff --git a/OpenSim/Data/MySQL/MySQLFriendsData.cs b/OpenSim/Data/MySQL/MySQLFriendsData.cs index 130ba5e..3cd6b8f 100644 --- a/OpenSim/Data/MySQL/MySQLFriendsData.cs +++ b/OpenSim/Data/MySQL/MySQLFriendsData.cs | |||
@@ -49,34 +49,38 @@ namespace OpenSim.Data.MySQL | |||
49 | 49 | ||
50 | public bool Delete(string principalID, string friend) | 50 | public bool Delete(string principalID, string friend) |
51 | { | 51 | { |
52 | MySqlCommand cmd = new MySqlCommand(); | 52 | using (MySqlCommand cmd = new MySqlCommand()) |
53 | { | ||
54 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = ?PrincipalID and Friend = ?Friend", m_Realm); | ||
55 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); | ||
56 | cmd.Parameters.AddWithValue("?Friend", friend); | ||
53 | 57 | ||
54 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = ?PrincipalID and Friend = ?Friend", m_Realm); | 58 | ExecuteNonQuery(cmd); |
55 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); | 59 | } |
56 | cmd.Parameters.AddWithValue("?Friend", friend); | ||
57 | |||
58 | ExecuteNonQuery(cmd); | ||
59 | 60 | ||
60 | return true; | 61 | return true; |
61 | } | 62 | } |
62 | 63 | ||
63 | public FriendsData[] GetFriends(UUID principalID) | 64 | public FriendsData[] GetFriends(UUID principalID) |
64 | { | 65 | { |
65 | MySqlCommand cmd = new MySqlCommand(); | 66 | using (MySqlCommand cmd = new MySqlCommand()) |
66 | 67 | { | |
67 | cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = ?PrincipalID", m_Realm); | 68 | cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = ?PrincipalID", m_Realm); |
68 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); | 69 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); |
69 | 70 | ||
70 | return DoQuery(cmd); | 71 | return DoQuery(cmd); |
72 | } | ||
71 | } | 73 | } |
72 | 74 | ||
73 | public FriendsData[] GetFriends(string principalID) | 75 | public FriendsData[] GetFriends(string principalID) |
74 | { | 76 | { |
75 | MySqlCommand cmd = new MySqlCommand(); | 77 | using (MySqlCommand cmd = new MySqlCommand()) |
78 | { | ||
79 | cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID LIKE ?PrincipalID", m_Realm); | ||
80 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString() + '%'); | ||
76 | 81 | ||
77 | cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID LIKE ?PrincipalID", m_Realm); | 82 | return DoQuery(cmd); |
78 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString() + '%'); | 83 | } |
79 | return DoQuery(cmd); | ||
80 | } | 84 | } |
81 | } | 85 | } |
82 | } | 86 | } \ No newline at end of file |
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index 786b955..86367a1 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | |||
@@ -91,15 +91,17 @@ namespace OpenSim.Data.MySQL | |||
91 | if (m_ColumnNames != null) | 91 | if (m_ColumnNames != null) |
92 | return; | 92 | return; |
93 | 93 | ||
94 | m_ColumnNames = new List<string>(); | 94 | List<string> columnNames = new List<string>(); |
95 | 95 | ||
96 | DataTable schemaTable = reader.GetSchemaTable(); | 96 | DataTable schemaTable = reader.GetSchemaTable(); |
97 | foreach (DataRow row in schemaTable.Rows) | 97 | foreach (DataRow row in schemaTable.Rows) |
98 | { | 98 | { |
99 | if (row["ColumnName"] != null && | 99 | if (row["ColumnName"] != null && |
100 | (!m_Fields.ContainsKey(row["ColumnName"].ToString()))) | 100 | (!m_Fields.ContainsKey(row["ColumnName"].ToString()))) |
101 | m_ColumnNames.Add(row["ColumnName"].ToString()); | 101 | columnNames.Add(row["ColumnName"].ToString()); |
102 | } | 102 | } |
103 | |||
104 | m_ColumnNames = columnNames; | ||
103 | } | 105 | } |
104 | 106 | ||
105 | public virtual T[] Get(string field, string key) | 107 | public virtual T[] Get(string field, string key) |
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 1a634e5..e9b10f3 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs | |||
@@ -467,43 +467,43 @@ namespace OpenSim.Data.MySQL | |||
467 | { | 467 | { |
468 | dbcon.Open(); | 468 | dbcon.Open(); |
469 | 469 | ||
470 | MySqlCommand result = new MySqlCommand(sql, dbcon); | 470 | using (MySqlCommand result = new MySqlCommand(sql, dbcon)) |
471 | result.Parameters.AddWithValue("?inventoryID", item.ID.ToString()); | ||
472 | result.Parameters.AddWithValue("?assetID", item.AssetID.ToString()); | ||
473 | result.Parameters.AddWithValue("?assetType", item.AssetType.ToString()); | ||
474 | result.Parameters.AddWithValue("?parentFolderID", item.Folder.ToString()); | ||
475 | result.Parameters.AddWithValue("?avatarID", item.Owner.ToString()); | ||
476 | result.Parameters.AddWithValue("?inventoryName", itemName); | ||
477 | result.Parameters.AddWithValue("?inventoryDescription", itemDesc); | ||
478 | result.Parameters.AddWithValue("?inventoryNextPermissions", item.NextPermissions.ToString()); | ||
479 | result.Parameters.AddWithValue("?inventoryCurrentPermissions", | ||
480 | item.CurrentPermissions.ToString()); | ||
481 | result.Parameters.AddWithValue("?invType", item.InvType); | ||
482 | result.Parameters.AddWithValue("?creatorID", item.CreatorId); | ||
483 | result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions); | ||
484 | result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions); | ||
485 | result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions); | ||
486 | result.Parameters.AddWithValue("?salePrice", item.SalePrice); | ||
487 | result.Parameters.AddWithValue("?saleType", unchecked((sbyte)item.SaleType)); | ||
488 | result.Parameters.AddWithValue("?creationDate", item.CreationDate); | ||
489 | result.Parameters.AddWithValue("?groupID", item.GroupID); | ||
490 | result.Parameters.AddWithValue("?groupOwned", item.GroupOwned); | ||
491 | result.Parameters.AddWithValue("?flags", item.Flags); | ||
492 | |||
493 | lock (m_dbLock) | ||
494 | { | 471 | { |
495 | result.ExecuteNonQuery(); | 472 | result.Parameters.AddWithValue("?inventoryID", item.ID.ToString()); |
473 | result.Parameters.AddWithValue("?assetID", item.AssetID.ToString()); | ||
474 | result.Parameters.AddWithValue("?assetType", item.AssetType.ToString()); | ||
475 | result.Parameters.AddWithValue("?parentFolderID", item.Folder.ToString()); | ||
476 | result.Parameters.AddWithValue("?avatarID", item.Owner.ToString()); | ||
477 | result.Parameters.AddWithValue("?inventoryName", itemName); | ||
478 | result.Parameters.AddWithValue("?inventoryDescription", itemDesc); | ||
479 | result.Parameters.AddWithValue("?inventoryNextPermissions", item.NextPermissions.ToString()); | ||
480 | result.Parameters.AddWithValue("?inventoryCurrentPermissions", | ||
481 | item.CurrentPermissions.ToString()); | ||
482 | result.Parameters.AddWithValue("?invType", item.InvType); | ||
483 | result.Parameters.AddWithValue("?creatorID", item.CreatorId); | ||
484 | result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions); | ||
485 | result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions); | ||
486 | result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions); | ||
487 | result.Parameters.AddWithValue("?salePrice", item.SalePrice); | ||
488 | result.Parameters.AddWithValue("?saleType", unchecked((sbyte)item.SaleType)); | ||
489 | result.Parameters.AddWithValue("?creationDate", item.CreationDate); | ||
490 | result.Parameters.AddWithValue("?groupID", item.GroupID); | ||
491 | result.Parameters.AddWithValue("?groupOwned", item.GroupOwned); | ||
492 | result.Parameters.AddWithValue("?flags", item.Flags); | ||
493 | |||
494 | lock (m_dbLock) | ||
495 | result.ExecuteNonQuery(); | ||
496 | |||
497 | result.Dispose(); | ||
496 | } | 498 | } |
497 | 499 | ||
498 | result.Dispose(); | 500 | using (MySqlCommand result = new MySqlCommand("update inventoryfolders set version=version+1 where folderID = ?folderID", dbcon)) |
499 | |||
500 | result = new MySqlCommand("update inventoryfolders set version=version+1 where folderID = ?folderID", dbcon); | ||
501 | result.Parameters.AddWithValue("?folderID", item.Folder.ToString()); | ||
502 | lock (m_dbLock) | ||
503 | { | 501 | { |
504 | result.ExecuteNonQuery(); | 502 | result.Parameters.AddWithValue("?folderID", item.Folder.ToString()); |
503 | |||
504 | lock (m_dbLock) | ||
505 | result.ExecuteNonQuery(); | ||
505 | } | 506 | } |
506 | result.Dispose(); | ||
507 | } | 507 | } |
508 | } | 508 | } |
509 | catch (MySqlException e) | 509 | catch (MySqlException e) |
@@ -533,12 +533,12 @@ namespace OpenSim.Data.MySQL | |||
533 | { | 533 | { |
534 | dbcon.Open(); | 534 | dbcon.Open(); |
535 | 535 | ||
536 | MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", dbcon); | 536 | using (MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", dbcon)) |
537 | cmd.Parameters.AddWithValue("?uuid", itemID.ToString()); | ||
538 | |||
539 | lock (m_dbLock) | ||
540 | { | 537 | { |
541 | cmd.ExecuteNonQuery(); | 538 | cmd.Parameters.AddWithValue("?uuid", itemID.ToString()); |
539 | |||
540 | lock (m_dbLock) | ||
541 | cmd.ExecuteNonQuery(); | ||
542 | } | 542 | } |
543 | } | 543 | } |
544 | } | 544 | } |
@@ -579,24 +579,26 @@ namespace OpenSim.Data.MySQL | |||
579 | { | 579 | { |
580 | dbcon.Open(); | 580 | dbcon.Open(); |
581 | 581 | ||
582 | MySqlCommand cmd = new MySqlCommand(sql, dbcon); | 582 | using (MySqlCommand cmd = new MySqlCommand(sql, dbcon)) |
583 | cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString()); | ||
584 | cmd.Parameters.AddWithValue("?agentID", folder.Owner.ToString()); | ||
585 | cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString()); | ||
586 | cmd.Parameters.AddWithValue("?folderName", folderName); | ||
587 | cmd.Parameters.AddWithValue("?type", folder.Type); | ||
588 | cmd.Parameters.AddWithValue("?version", folder.Version); | ||
589 | |||
590 | try | ||
591 | { | 583 | { |
592 | lock (m_dbLock) | 584 | cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString()); |
585 | cmd.Parameters.AddWithValue("?agentID", folder.Owner.ToString()); | ||
586 | cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString()); | ||
587 | cmd.Parameters.AddWithValue("?folderName", folderName); | ||
588 | cmd.Parameters.AddWithValue("?type", folder.Type); | ||
589 | cmd.Parameters.AddWithValue("?version", folder.Version); | ||
590 | |||
591 | try | ||
593 | { | 592 | { |
594 | cmd.ExecuteNonQuery(); | 593 | lock (m_dbLock) |
594 | { | ||
595 | cmd.ExecuteNonQuery(); | ||
596 | } | ||
597 | } | ||
598 | catch (Exception e) | ||
599 | { | ||
600 | m_log.Error(e.ToString()); | ||
595 | } | 601 | } |
596 | } | ||
597 | catch (Exception e) | ||
598 | { | ||
599 | m_log.Error(e.ToString()); | ||
600 | } | 602 | } |
601 | } | 603 | } |
602 | } | 604 | } |
@@ -624,20 +626,22 @@ namespace OpenSim.Data.MySQL | |||
624 | { | 626 | { |
625 | dbcon.Open(); | 627 | dbcon.Open(); |
626 | 628 | ||
627 | MySqlCommand cmd = new MySqlCommand(sql, dbcon); | 629 | using (MySqlCommand cmd = new MySqlCommand(sql, dbcon)) |
628 | cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString()); | ||
629 | cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString()); | ||
630 | |||
631 | try | ||
632 | { | 630 | { |
633 | lock (m_dbLock) | 631 | cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString()); |
632 | cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString()); | ||
633 | |||
634 | try | ||
634 | { | 635 | { |
635 | cmd.ExecuteNonQuery(); | 636 | lock (m_dbLock) |
637 | { | ||
638 | cmd.ExecuteNonQuery(); | ||
639 | } | ||
640 | } | ||
641 | catch (Exception e) | ||
642 | { | ||
643 | m_log.Error(e.ToString()); | ||
636 | } | 644 | } |
637 | } | ||
638 | catch (Exception e) | ||
639 | { | ||
640 | m_log.Error(e.ToString()); | ||
641 | } | 645 | } |
642 | } | 646 | } |
643 | } | 647 | } |
diff --git a/OpenSim/Data/MySQL/MySQLPresenceData.cs b/OpenSim/Data/MySQL/MySQLPresenceData.cs index fc625f0..7808060 100644 --- a/OpenSim/Data/MySQL/MySQLPresenceData.cs +++ b/OpenSim/Data/MySQL/MySQLPresenceData.cs | |||
@@ -63,13 +63,14 @@ namespace OpenSim.Data.MySQL | |||
63 | 63 | ||
64 | public void LogoutRegionAgents(UUID regionID) | 64 | public void LogoutRegionAgents(UUID regionID) |
65 | { | 65 | { |
66 | MySqlCommand cmd = new MySqlCommand(); | 66 | using (MySqlCommand cmd = new MySqlCommand()) |
67 | 67 | { | |
68 | cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm); | 68 | cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm); |
69 | 69 | ||
70 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | 70 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); |
71 | 71 | ||
72 | ExecuteNonQuery(cmd); | 72 | ExecuteNonQuery(cmd); |
73 | } | ||
73 | } | 74 | } |
74 | 75 | ||
75 | public bool ReportAgent(UUID sessionID, UUID regionID) | 76 | public bool ReportAgent(UUID sessionID, UUID regionID) |
@@ -81,17 +82,18 @@ namespace OpenSim.Data.MySQL | |||
81 | if (regionID == UUID.Zero) | 82 | if (regionID == UUID.Zero) |
82 | return false; | 83 | return false; |
83 | 84 | ||
84 | MySqlCommand cmd = new MySqlCommand(); | 85 | using (MySqlCommand cmd = new MySqlCommand()) |
85 | 86 | { | |
86 | cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm); | 87 | cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm); |
87 | 88 | ||
88 | cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString()); | 89 | cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString()); |
89 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | 90 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); |
90 | 91 | ||
91 | if (ExecuteNonQuery(cmd) == 0) | 92 | if (ExecuteNonQuery(cmd) == 0) |
92 | return false; | 93 | return false; |
94 | } | ||
93 | 95 | ||
94 | return true; | 96 | return true; |
95 | } | 97 | } |
96 | } | 98 | } |
97 | } | 99 | } \ No newline at end of file |
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index c20c392..0614879 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -162,17 +162,7 @@ namespace OpenSim.Data.MySQL | |||
162 | ret.sizeX = Convert.ToInt32(result["sizeX"]); | 162 | ret.sizeX = Convert.ToInt32(result["sizeX"]); |
163 | ret.sizeY = Convert.ToInt32(result["sizeY"]); | 163 | ret.sizeY = Convert.ToInt32(result["sizeY"]); |
164 | 164 | ||
165 | if (m_ColumnNames == null) | 165 | CheckColumnNames(result); |
166 | { | ||
167 | m_ColumnNames = new List<string>(); | ||
168 | |||
169 | DataTable schemaTable = result.GetSchemaTable(); | ||
170 | foreach (DataRow row in schemaTable.Rows) | ||
171 | { | ||
172 | if (row["ColumnName"] != null) | ||
173 | m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
174 | } | ||
175 | } | ||
176 | 166 | ||
177 | foreach (string s in m_ColumnNames) | 167 | foreach (string s in m_ColumnNames) |
178 | { | 168 | { |
@@ -187,7 +177,11 @@ namespace OpenSim.Data.MySQL | |||
187 | if (s == "locY") | 177 | if (s == "locY") |
188 | continue; | 178 | continue; |
189 | 179 | ||
190 | ret.Data[s] = result[s].ToString(); | 180 | object value = result[s]; |
181 | if (value is DBNull) | ||
182 | ret.Data[s] = null; | ||
183 | else | ||
184 | ret.Data[s] = result[s].ToString(); | ||
191 | } | 185 | } |
192 | 186 | ||
193 | retList.Add(ret); | 187 | retList.Add(ret); |
@@ -198,6 +192,23 @@ namespace OpenSim.Data.MySQL | |||
198 | return retList; | 192 | return retList; |
199 | } | 193 | } |
200 | 194 | ||
195 | private void CheckColumnNames(IDataReader result) | ||
196 | { | ||
197 | if (m_ColumnNames != null) | ||
198 | return; | ||
199 | |||
200 | List<string> columnNames = new List<string>(); | ||
201 | |||
202 | DataTable schemaTable = result.GetSchemaTable(); | ||
203 | foreach (DataRow row in schemaTable.Rows) | ||
204 | { | ||
205 | if (row["ColumnName"] != null) | ||
206 | columnNames.Add(row["ColumnName"].ToString()); | ||
207 | } | ||
208 | |||
209 | m_ColumnNames = columnNames; | ||
210 | } | ||
211 | |||
201 | public bool Store(RegionData data) | 212 | public bool Store(RegionData data) |
202 | { | 213 | { |
203 | if (data.Data.ContainsKey("uuid")) | 214 | if (data.Data.ContainsKey("uuid")) |
@@ -318,11 +329,12 @@ namespace OpenSim.Data.MySQL | |||
318 | if (scopeID != UUID.Zero) | 329 | if (scopeID != UUID.Zero) |
319 | command += " and ScopeID = ?scopeID"; | 330 | command += " and ScopeID = ?scopeID"; |
320 | 331 | ||
321 | MySqlCommand cmd = new MySqlCommand(command); | 332 | using (MySqlCommand cmd = new MySqlCommand(command)) |
322 | 333 | { | |
323 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | 334 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); |
324 | 335 | ||
325 | return RunCommand(cmd); | 336 | return RunCommand(cmd); |
337 | } | ||
326 | } | 338 | } |
327 | } | 339 | } |
328 | } | 340 | } \ No newline at end of file |
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 33c184f..89600db 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -129,119 +129,119 @@ namespace OpenSim.Data.MySQL | |||
129 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 129 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
130 | { | 130 | { |
131 | dbcon.Open(); | 131 | dbcon.Open(); |
132 | MySqlCommand cmd = dbcon.CreateCommand(); | ||
133 | 132 | ||
134 | foreach (SceneObjectPart prim in obj.Parts) | 133 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
135 | { | 134 | { |
136 | cmd.Parameters.Clear(); | 135 | foreach (SceneObjectPart prim in obj.Parts) |
136 | { | ||
137 | cmd.Parameters.Clear(); | ||
137 | 138 | ||
138 | cmd.CommandText = "replace into prims (" + | 139 | cmd.CommandText = "replace into prims (" + |
139 | "UUID, CreationDate, " + | 140 | "UUID, CreationDate, " + |
140 | "Name, Text, Description, " + | 141 | "Name, Text, Description, " + |
141 | "SitName, TouchName, ObjectFlags, " + | 142 | "SitName, TouchName, ObjectFlags, " + |
142 | "OwnerMask, NextOwnerMask, GroupMask, " + | 143 | "OwnerMask, NextOwnerMask, GroupMask, " + |
143 | "EveryoneMask, BaseMask, PositionX, " + | 144 | "EveryoneMask, BaseMask, PositionX, " + |
144 | "PositionY, PositionZ, GroupPositionX, " + | 145 | "PositionY, PositionZ, GroupPositionX, " + |
145 | "GroupPositionY, GroupPositionZ, VelocityX, " + | 146 | "GroupPositionY, GroupPositionZ, VelocityX, " + |
146 | "VelocityY, VelocityZ, AngularVelocityX, " + | 147 | "VelocityY, VelocityZ, AngularVelocityX, " + |
147 | "AngularVelocityY, AngularVelocityZ, " + | 148 | "AngularVelocityY, AngularVelocityZ, " + |
148 | "AccelerationX, AccelerationY, " + | 149 | "AccelerationX, AccelerationY, " + |
149 | "AccelerationZ, RotationX, " + | 150 | "AccelerationZ, RotationX, " + |
150 | "RotationY, RotationZ, " + | 151 | "RotationY, RotationZ, " + |
151 | "RotationW, SitTargetOffsetX, " + | 152 | "RotationW, SitTargetOffsetX, " + |
152 | "SitTargetOffsetY, SitTargetOffsetZ, " + | 153 | "SitTargetOffsetY, SitTargetOffsetZ, " + |
153 | "SitTargetOrientW, SitTargetOrientX, " + | 154 | "SitTargetOrientW, SitTargetOrientX, " + |
154 | "SitTargetOrientY, SitTargetOrientZ, " + | 155 | "SitTargetOrientY, SitTargetOrientZ, " + |
155 | "RegionUUID, CreatorID, " + | 156 | "RegionUUID, CreatorID, " + |
156 | "OwnerID, GroupID, " + | 157 | "OwnerID, GroupID, " + |
157 | "LastOwnerID, SceneGroupID, " + | 158 | "LastOwnerID, SceneGroupID, " + |
158 | "PayPrice, PayButton1, " + | 159 | "PayPrice, PayButton1, " + |
159 | "PayButton2, PayButton3, " + | 160 | "PayButton2, PayButton3, " + |
160 | "PayButton4, LoopedSound, " + | 161 | "PayButton4, LoopedSound, " + |
161 | "LoopedSoundGain, TextureAnimation, " + | 162 | "LoopedSoundGain, TextureAnimation, " + |
162 | "OmegaX, OmegaY, OmegaZ, " + | 163 | "OmegaX, OmegaY, OmegaZ, " + |
163 | "CameraEyeOffsetX, CameraEyeOffsetY, " + | 164 | "CameraEyeOffsetX, CameraEyeOffsetY, " + |
164 | "CameraEyeOffsetZ, CameraAtOffsetX, " + | 165 | "CameraEyeOffsetZ, CameraAtOffsetX, " + |
165 | "CameraAtOffsetY, CameraAtOffsetZ, " + | 166 | "CameraAtOffsetY, CameraAtOffsetZ, " + |
166 | "ForceMouselook, ScriptAccessPin, " + | 167 | "ForceMouselook, ScriptAccessPin, " + |
167 | "AllowedDrop, DieAtEdge, " + | 168 | "AllowedDrop, DieAtEdge, " + |
168 | "SalePrice, SaleType, " + | 169 | "SalePrice, SaleType, " + |
169 | "ColorR, ColorG, ColorB, ColorA, " + | 170 | "ColorR, ColorG, ColorB, ColorA, " + |
170 | "ParticleSystem, ClickAction, Material, " + | 171 | "ParticleSystem, ClickAction, Material, " + |
171 | "CollisionSound, CollisionSoundVolume, " + | 172 | "CollisionSound, CollisionSoundVolume, " + |
172 | "PassTouches, " + | 173 | "PassTouches, " + |
173 | "LinkNumber, MediaURL, KeyframeMotion, " + | 174 | "LinkNumber, MediaURL, KeyframeMotion, " + |
174 | "PhysicsShapeType, Density, GravityModifier, " + | 175 | "PhysicsShapeType, Density, GravityModifier, " + |
175 | "Friction, Restitution) values (" + "?UUID, " + | 176 | "Friction, Restitution) values (" + "?UUID, " + |
176 | "?CreationDate, ?Name, ?Text, " + | 177 | "?CreationDate, ?Name, ?Text, " + |
177 | "?Description, ?SitName, ?TouchName, " + | 178 | "?Description, ?SitName, ?TouchName, " + |
178 | "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + | 179 | "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + |
179 | "?GroupMask, ?EveryoneMask, ?BaseMask, " + | 180 | "?GroupMask, ?EveryoneMask, ?BaseMask, " + |
180 | "?PositionX, ?PositionY, ?PositionZ, " + | 181 | "?PositionX, ?PositionY, ?PositionZ, " + |
181 | "?GroupPositionX, ?GroupPositionY, " + | 182 | "?GroupPositionX, ?GroupPositionY, " + |
182 | "?GroupPositionZ, ?VelocityX, " + | 183 | "?GroupPositionZ, ?VelocityX, " + |
183 | "?VelocityY, ?VelocityZ, ?AngularVelocityX, " + | 184 | "?VelocityY, ?VelocityZ, ?AngularVelocityX, " + |
184 | "?AngularVelocityY, ?AngularVelocityZ, " + | 185 | "?AngularVelocityY, ?AngularVelocityZ, " + |
185 | "?AccelerationX, ?AccelerationY, " + | 186 | "?AccelerationX, ?AccelerationY, " + |
186 | "?AccelerationZ, ?RotationX, " + | 187 | "?AccelerationZ, ?RotationX, " + |
187 | "?RotationY, ?RotationZ, " + | 188 | "?RotationY, ?RotationZ, " + |
188 | "?RotationW, ?SitTargetOffsetX, " + | 189 | "?RotationW, ?SitTargetOffsetX, " + |
189 | "?SitTargetOffsetY, ?SitTargetOffsetZ, " + | 190 | "?SitTargetOffsetY, ?SitTargetOffsetZ, " + |
190 | "?SitTargetOrientW, ?SitTargetOrientX, " + | 191 | "?SitTargetOrientW, ?SitTargetOrientX, " + |
191 | "?SitTargetOrientY, ?SitTargetOrientZ, " + | 192 | "?SitTargetOrientY, ?SitTargetOrientZ, " + |
192 | "?RegionUUID, ?CreatorID, ?OwnerID, " + | 193 | "?RegionUUID, ?CreatorID, ?OwnerID, " + |
193 | "?GroupID, ?LastOwnerID, ?SceneGroupID, " + | 194 | "?GroupID, ?LastOwnerID, ?SceneGroupID, " + |
194 | "?PayPrice, ?PayButton1, ?PayButton2, " + | 195 | "?PayPrice, ?PayButton1, ?PayButton2, " + |
195 | "?PayButton3, ?PayButton4, ?LoopedSound, " + | 196 | "?PayButton3, ?PayButton4, ?LoopedSound, " + |
196 | "?LoopedSoundGain, ?TextureAnimation, " + | 197 | "?LoopedSoundGain, ?TextureAnimation, " + |
197 | "?OmegaX, ?OmegaY, ?OmegaZ, " + | 198 | "?OmegaX, ?OmegaY, ?OmegaZ, " + |
198 | "?CameraEyeOffsetX, ?CameraEyeOffsetY, " + | 199 | "?CameraEyeOffsetX, ?CameraEyeOffsetY, " + |
199 | "?CameraEyeOffsetZ, ?CameraAtOffsetX, " + | 200 | "?CameraEyeOffsetZ, ?CameraAtOffsetX, " + |
200 | "?CameraAtOffsetY, ?CameraAtOffsetZ, " + | 201 | "?CameraAtOffsetY, ?CameraAtOffsetZ, " + |
201 | "?ForceMouselook, ?ScriptAccessPin, " + | 202 | "?ForceMouselook, ?ScriptAccessPin, " + |
202 | "?AllowedDrop, ?DieAtEdge, ?SalePrice, " + | 203 | "?AllowedDrop, ?DieAtEdge, ?SalePrice, " + |
203 | "?SaleType, ?ColorR, ?ColorG, " + | 204 | "?SaleType, ?ColorR, ?ColorG, " + |
204 | "?ColorB, ?ColorA, ?ParticleSystem, " + | 205 | "?ColorB, ?ColorA, ?ParticleSystem, " + |
205 | "?ClickAction, ?Material, ?CollisionSound, " + | 206 | "?ClickAction, ?Material, ?CollisionSound, " + |
206 | "?CollisionSoundVolume, ?PassTouches, " + | 207 | "?CollisionSoundVolume, ?PassTouches, " + |
207 | "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + | 208 | "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + |
208 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + | 209 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + |
209 | "?Friction, ?Restitution)"; | 210 | "?Friction, ?Restitution)"; |
210 | 211 | ||
211 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); | 212 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); |
212 | 213 | ||
213 | ExecuteNonQuery(cmd); | 214 | ExecuteNonQuery(cmd); |
214 | 215 | ||
215 | cmd.Parameters.Clear(); | 216 | cmd.Parameters.Clear(); |
216 | 217 | ||
217 | cmd.CommandText = "replace into primshapes (" + | 218 | cmd.CommandText = "replace into primshapes (" + |
218 | "UUID, Shape, ScaleX, ScaleY, " + | 219 | "UUID, Shape, ScaleX, ScaleY, " + |
219 | "ScaleZ, PCode, PathBegin, PathEnd, " + | 220 | "ScaleZ, PCode, PathBegin, PathEnd, " + |
220 | "PathScaleX, PathScaleY, PathShearX, " + | 221 | "PathScaleX, PathScaleY, PathShearX, " + |
221 | "PathShearY, PathSkew, PathCurve, " + | 222 | "PathShearY, PathSkew, PathCurve, " + |
222 | "PathRadiusOffset, PathRevolutions, " + | 223 | "PathRadiusOffset, PathRevolutions, " + |
223 | "PathTaperX, PathTaperY, PathTwist, " + | 224 | "PathTaperX, PathTaperY, PathTwist, " + |
224 | "PathTwistBegin, ProfileBegin, ProfileEnd, " + | 225 | "PathTwistBegin, ProfileBegin, ProfileEnd, " + |
225 | "ProfileCurve, ProfileHollow, Texture, " + | 226 | "ProfileCurve, ProfileHollow, Texture, " + |
226 | "ExtraParams, State, Media) values (?UUID, " + | 227 | "ExtraParams, State, Media) values (?UUID, " + |
227 | "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " + | 228 | "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " + |
228 | "?PCode, ?PathBegin, ?PathEnd, " + | 229 | "?PCode, ?PathBegin, ?PathEnd, " + |
229 | "?PathScaleX, ?PathScaleY, " + | 230 | "?PathScaleX, ?PathScaleY, " + |
230 | "?PathShearX, ?PathShearY, " + | 231 | "?PathShearX, ?PathShearY, " + |
231 | "?PathSkew, ?PathCurve, ?PathRadiusOffset, " + | 232 | "?PathSkew, ?PathCurve, ?PathRadiusOffset, " + |
232 | "?PathRevolutions, ?PathTaperX, " + | 233 | "?PathRevolutions, ?PathTaperX, " + |
233 | "?PathTaperY, ?PathTwist, " + | 234 | "?PathTaperY, ?PathTwist, " + |
234 | "?PathTwistBegin, ?ProfileBegin, " + | 235 | "?PathTwistBegin, ?ProfileBegin, " + |
235 | "?ProfileEnd, ?ProfileCurve, " + | 236 | "?ProfileEnd, ?ProfileCurve, " + |
236 | "?ProfileHollow, ?Texture, ?ExtraParams, " + | 237 | "?ProfileHollow, ?Texture, ?ExtraParams, " + |
237 | "?State, ?Media)"; | 238 | "?State, ?Media)"; |
238 | 239 | ||
239 | FillShapeCommand(cmd, prim); | 240 | FillShapeCommand(cmd, prim); |
240 | 241 | ||
241 | ExecuteNonQuery(cmd); | 242 | ExecuteNonQuery(cmd); |
243 | } | ||
242 | } | 244 | } |
243 | |||
244 | cmd.Dispose(); | ||
245 | } | 245 | } |
246 | } | 246 | } |
247 | } | 247 | } |
@@ -1865,41 +1865,40 @@ namespace OpenSim.Data.MySQL | |||
1865 | { | 1865 | { |
1866 | RemoveItems(primID); | 1866 | RemoveItems(primID); |
1867 | 1867 | ||
1868 | if (items.Count == 0) | ||
1869 | return; | ||
1870 | |||
1868 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 1871 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
1869 | { | 1872 | { |
1870 | dbcon.Open(); | 1873 | dbcon.Open(); |
1871 | 1874 | ||
1872 | MySqlCommand cmd = dbcon.CreateCommand(); | 1875 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
1873 | |||
1874 | if (items.Count == 0) | ||
1875 | return; | ||
1876 | |||
1877 | cmd.CommandText = "insert into primitems (" + | ||
1878 | "invType, assetType, name, " + | ||
1879 | "description, creationDate, nextPermissions, " + | ||
1880 | "currentPermissions, basePermissions, " + | ||
1881 | "everyonePermissions, groupPermissions, " + | ||
1882 | "flags, itemID, primID, assetID, " + | ||
1883 | "parentFolderID, creatorID, ownerID, " + | ||
1884 | "groupID, lastOwnerID) values (?invType, " + | ||
1885 | "?assetType, ?name, ?description, " + | ||
1886 | "?creationDate, ?nextPermissions, " + | ||
1887 | "?currentPermissions, ?basePermissions, " + | ||
1888 | "?everyonePermissions, ?groupPermissions, " + | ||
1889 | "?flags, ?itemID, ?primID, ?assetID, " + | ||
1890 | "?parentFolderID, ?creatorID, ?ownerID, " + | ||
1891 | "?groupID, ?lastOwnerID)"; | ||
1892 | |||
1893 | foreach (TaskInventoryItem item in items) | ||
1894 | { | 1876 | { |
1895 | cmd.Parameters.Clear(); | 1877 | cmd.CommandText = "insert into primitems (" + |
1896 | 1878 | "invType, assetType, name, " + | |
1897 | FillItemCommand(cmd, item); | 1879 | "description, creationDate, nextPermissions, " + |
1898 | 1880 | "currentPermissions, basePermissions, " + | |
1899 | ExecuteNonQuery(cmd); | 1881 | "everyonePermissions, groupPermissions, " + |
1882 | "flags, itemID, primID, assetID, " + | ||
1883 | "parentFolderID, creatorID, ownerID, " + | ||
1884 | "groupID, lastOwnerID) values (?invType, " + | ||
1885 | "?assetType, ?name, ?description, " + | ||
1886 | "?creationDate, ?nextPermissions, " + | ||
1887 | "?currentPermissions, ?basePermissions, " + | ||
1888 | "?everyonePermissions, ?groupPermissions, " + | ||
1889 | "?flags, ?itemID, ?primID, ?assetID, " + | ||
1890 | "?parentFolderID, ?creatorID, ?ownerID, " + | ||
1891 | "?groupID, ?lastOwnerID)"; | ||
1892 | |||
1893 | foreach (TaskInventoryItem item in items) | ||
1894 | { | ||
1895 | cmd.Parameters.Clear(); | ||
1896 | |||
1897 | FillItemCommand(cmd, item); | ||
1898 | |||
1899 | ExecuteNonQuery(cmd); | ||
1900 | } | ||
1900 | } | 1901 | } |
1901 | |||
1902 | cmd.Dispose(); | ||
1903 | } | 1902 | } |
1904 | } | 1903 | } |
1905 | } | 1904 | } |
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs index a18ac66..4ff3175 100644 --- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs +++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs | |||
@@ -66,38 +66,40 @@ namespace OpenSim.Data.MySQL | |||
66 | if (words.Length > 2) | 66 | if (words.Length > 2) |
67 | return new UserAccountData[0]; | 67 | return new UserAccountData[0]; |
68 | 68 | ||
69 | MySqlCommand cmd = new MySqlCommand(); | 69 | using (MySqlCommand cmd = new MySqlCommand()) |
70 | |||
71 | if (words.Length == 1) | ||
72 | { | ||
73 | cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search) and active=1", m_Realm); | ||
74 | cmd.Parameters.AddWithValue("?search", words[0] + "%"); | ||
75 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | ||
76 | } | ||
77 | else | ||
78 | { | 70 | { |
79 | cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast) and active=1", m_Realm); | 71 | if (words.Length == 1) |
80 | cmd.Parameters.AddWithValue("?searchFirst", words[0] + "%"); | 72 | { |
81 | cmd.Parameters.AddWithValue("?searchLast", words[1] + "%"); | 73 | cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search) and active=1", m_Realm); |
82 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | 74 | cmd.Parameters.AddWithValue("?search", words[0] + "%"); |
83 | } | 75 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); |
76 | } | ||
77 | else | ||
78 | { | ||
79 | cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast) and active=1", m_Realm); | ||
80 | cmd.Parameters.AddWithValue("?searchFirst", words[0] + "%"); | ||
81 | cmd.Parameters.AddWithValue("?searchLast", words[1] + "%"); | ||
82 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | ||
83 | } | ||
84 | 84 | ||
85 | return DoQuery(cmd); | 85 | return DoQuery(cmd); |
86 | } | ||
86 | } | 87 | } |
87 | 88 | ||
88 | public UserAccountData[] GetUsersWhere(UUID scopeID, string where) | 89 | public UserAccountData[] GetUsersWhere(UUID scopeID, string where) |
89 | { | 90 | { |
90 | MySqlCommand cmd = new MySqlCommand(); | 91 | using (MySqlCommand cmd = new MySqlCommand()) |
91 | |||
92 | if (scopeID != UUID.Zero) | ||
93 | { | 92 | { |
94 | where = "(ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (" + where + ")"; | 93 | if (scopeID != UUID.Zero) |
95 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | 94 | { |
96 | } | 95 | where = "(ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (" + where + ")"; |
96 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | ||
97 | } | ||
97 | 98 | ||
98 | cmd.CommandText = String.Format("select * from {0} where " + where, m_Realm); | 99 | cmd.CommandText = String.Format("select * from {0} where " + where, m_Realm); |
99 | 100 | ||
100 | return DoQuery(cmd); | 101 | return DoQuery(cmd); |
102 | } | ||
101 | } | 103 | } |
102 | } | 104 | } |
103 | } | 105 | } |
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index c5d6b78..87bdacd 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs | |||
@@ -79,7 +79,11 @@ namespace OpenSim.Framework.Console | |||
79 | public List<CommandDelegate> fn; | 79 | public List<CommandDelegate> fn; |
80 | } | 80 | } |
81 | 81 | ||
82 | public const string GeneralHelpText = "For more information, type 'help <item>' where <item> is one of the following categories:"; | 82 | public const string GeneralHelpText |
83 | = "To enter an argument that contains spaces, surround the argument with double quotes.\nFor example, show object name \"My long object name\"\n"; | ||
84 | |||
85 | public const string ItemHelpText | ||
86 | = "For more information, type 'help <item>' where <item> is one of the following:"; | ||
83 | 87 | ||
84 | /// <value> | 88 | /// <value> |
85 | /// Commands organized by keyword in a tree | 89 | /// Commands organized by keyword in a tree |
@@ -108,7 +112,9 @@ namespace OpenSim.Framework.Console | |||
108 | // General help | 112 | // General help |
109 | if (helpParts.Count == 0) | 113 | if (helpParts.Count == 0) |
110 | { | 114 | { |
115 | help.Add(""); // Will become a newline. | ||
111 | help.Add(GeneralHelpText); | 116 | help.Add(GeneralHelpText); |
117 | help.Add(ItemHelpText); | ||
112 | help.AddRange(CollectModulesHelp(tree)); | 118 | help.AddRange(CollectModulesHelp(tree)); |
113 | } | 119 | } |
114 | else | 120 | else |
@@ -132,7 +138,7 @@ namespace OpenSim.Framework.Console | |||
132 | // Check modules first to see if we just need to display a list of those commands | 138 | // Check modules first to see if we just need to display a list of those commands |
133 | if (TryCollectModuleHelp(originalHelpRequest, help)) | 139 | if (TryCollectModuleHelp(originalHelpRequest, help)) |
134 | { | 140 | { |
135 | help.Insert(0, GeneralHelpText); | 141 | help.Insert(0, ItemHelpText); |
136 | return help; | 142 | return help; |
137 | } | 143 | } |
138 | 144 | ||
diff --git a/OpenSim/Framework/Console/ConsoleTable.cs b/OpenSim/Framework/Console/ConsoleTable.cs new file mode 100644 index 0000000..be3025b --- /dev/null +++ b/OpenSim/Framework/Console/ConsoleTable.cs | |||
@@ -0,0 +1,139 @@ | |||
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 ConsoleTable | ||
42 | { | ||
43 | /// <summary> | ||
44 | /// Default number of spaces between table columns. | ||
45 | /// </summary> | ||
46 | public const int DefaultTableSpacing = 2; | ||
47 | |||
48 | /// <summary> | ||
49 | /// Table columns. | ||
50 | /// </summary> | ||
51 | public List<ConsoleTableColumn> Columns { get; private set; } | ||
52 | |||
53 | /// <summary> | ||
54 | /// Table rows | ||
55 | /// </summary> | ||
56 | public List<ConsoleTableRow> Rows { get; private set; } | ||
57 | |||
58 | /// <summary> | ||
59 | /// Number of spaces to indent the table. | ||
60 | /// </summary> | ||
61 | public int Indent { get; set; } | ||
62 | |||
63 | /// <summary> | ||
64 | /// Spacing between table columns | ||
65 | /// </summary> | ||
66 | public int TableSpacing { get; set; } | ||
67 | |||
68 | public ConsoleTable() | ||
69 | { | ||
70 | TableSpacing = DefaultTableSpacing; | ||
71 | Columns = new List<ConsoleTableColumn>(); | ||
72 | Rows = new List<ConsoleTableRow>(); | ||
73 | } | ||
74 | |||
75 | public override string ToString() | ||
76 | { | ||
77 | StringBuilder sb = new StringBuilder(); | ||
78 | AddToStringBuilder(sb); | ||
79 | return sb.ToString(); | ||
80 | } | ||
81 | |||
82 | public void AddToStringBuilder(StringBuilder sb) | ||
83 | { | ||
84 | string formatString = GetFormatString(); | ||
85 | // System.Console.WriteLine("FORMAT STRING [{0}]", formatString); | ||
86 | |||
87 | // columns | ||
88 | sb.AppendFormat(formatString, Columns.ConvertAll(c => c.Header).ToArray()); | ||
89 | |||
90 | // rows | ||
91 | foreach (ConsoleTableRow row in Rows) | ||
92 | sb.AppendFormat(formatString, row.Cells.ToArray()); | ||
93 | } | ||
94 | |||
95 | /// <summary> | ||
96 | /// Gets the format string for the table. | ||
97 | /// </summary> | ||
98 | private string GetFormatString() | ||
99 | { | ||
100 | StringBuilder formatSb = new StringBuilder(); | ||
101 | |||
102 | formatSb.Append(' ', Indent); | ||
103 | |||
104 | for (int i = 0; i < Columns.Count; i++) | ||
105 | { | ||
106 | formatSb.Append(' ', TableSpacing); | ||
107 | |||
108 | // Can only do left formatting for now | ||
109 | formatSb.AppendFormat("{{{0},-{1}}}", i, Columns[i].Width); | ||
110 | } | ||
111 | |||
112 | formatSb.Append('\n'); | ||
113 | |||
114 | return formatSb.ToString(); | ||
115 | } | ||
116 | } | ||
117 | |||
118 | public struct ConsoleTableColumn | ||
119 | { | ||
120 | public string Header { get; set; } | ||
121 | public int Width { get; set; } | ||
122 | |||
123 | public ConsoleTableColumn(string header, int width) : this() | ||
124 | { | ||
125 | Header = header; | ||
126 | Width = width; | ||
127 | } | ||
128 | } | ||
129 | |||
130 | public struct ConsoleTableRow | ||
131 | { | ||
132 | public List<string> Cells { get; private set; } | ||
133 | |||
134 | public ConsoleTableRow(List<string> cells) : this() | ||
135 | { | ||
136 | Cells = cells; | ||
137 | } | ||
138 | } | ||
139 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index 7c8626d..f65813b 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs | |||
@@ -296,6 +296,10 @@ namespace OpenSim.Framework.Console | |||
296 | matches[0].Groups["Category"].Value); | 296 | matches[0].Groups["Category"].Value); |
297 | System.Console.Write("]:"); | 297 | System.Console.Write("]:"); |
298 | } | 298 | } |
299 | else | ||
300 | { | ||
301 | outText = outText.Trim(); | ||
302 | } | ||
299 | } | 303 | } |
300 | 304 | ||
301 | if (level == "error") | 305 | if (level == "error") |
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 142b783..9020761 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs | |||
@@ -346,7 +346,7 @@ namespace OpenSim.Framework | |||
346 | l_EstateManagers.Remove(avatarID); | 346 | l_EstateManagers.Remove(avatarID); |
347 | } | 347 | } |
348 | 348 | ||
349 | public bool IsEstateManager(UUID avatarID) | 349 | public bool IsEstateManagerOrOwner(UUID avatarID) |
350 | { | 350 | { |
351 | if (IsEstateOwner(avatarID)) | 351 | if (IsEstateOwner(avatarID)) |
352 | return true; | 352 | return true; |
@@ -368,7 +368,7 @@ namespace OpenSim.Framework | |||
368 | if (ban.BannedUserID == avatarID) | 368 | if (ban.BannedUserID == avatarID) |
369 | return true; | 369 | return true; |
370 | 370 | ||
371 | if (!IsEstateManager(avatarID) && !HasAccess(avatarID)) | 371 | if (!IsEstateManagerOrOwner(avatarID) && !HasAccess(avatarID)) |
372 | { | 372 | { |
373 | if (DenyMinors) | 373 | if (DenyMinors) |
374 | { | 374 | { |
@@ -411,7 +411,7 @@ namespace OpenSim.Framework | |||
411 | 411 | ||
412 | public bool HasAccess(UUID user) | 412 | public bool HasAccess(UUID user) |
413 | { | 413 | { |
414 | if (IsEstateManager(user)) | 414 | if (IsEstateManagerOrOwner(user)) |
415 | return true; | 415 | return true; |
416 | 416 | ||
417 | return l_EstateAccess.Contains(user); | 417 | return l_EstateAccess.Contains(user); |
diff --git a/OpenSim/Framework/OSChatMessage.cs b/OpenSim/Framework/OSChatMessage.cs index 54fa275..455756d 100644 --- a/OpenSim/Framework/OSChatMessage.cs +++ b/OpenSim/Framework/OSChatMessage.cs | |||
@@ -51,10 +51,12 @@ namespace OpenSim.Framework | |||
51 | protected object m_senderObject; | 51 | protected object m_senderObject; |
52 | protected ChatTypeEnum m_type; | 52 | protected ChatTypeEnum m_type; |
53 | protected UUID m_fromID; | 53 | protected UUID m_fromID; |
54 | protected UUID m_toID; | ||
54 | 55 | ||
55 | public OSChatMessage() | 56 | public OSChatMessage() |
56 | { | 57 | { |
57 | m_position = new Vector3(); | 58 | m_position = new Vector3(); |
59 | m_toID = UUID.Zero; | ||
58 | } | 60 | } |
59 | 61 | ||
60 | /// <summary> | 62 | /// <summary> |
@@ -102,6 +104,15 @@ namespace OpenSim.Framework | |||
102 | set { m_from = value; } | 104 | set { m_from = value; } |
103 | } | 105 | } |
104 | 106 | ||
107 | /// <summary> | ||
108 | /// The name of the sender (needed for scripts) | ||
109 | /// </summary> | ||
110 | public string To | ||
111 | { | ||
112 | get { return m_from; } | ||
113 | set { m_from = value; } | ||
114 | } | ||
115 | |||
105 | #region IEventArgs Members | 116 | #region IEventArgs Members |
106 | 117 | ||
107 | /// TODO: Sender and SenderObject should just be Sender and of | 118 | /// TODO: Sender and SenderObject should just be Sender and of |
@@ -132,6 +143,15 @@ namespace OpenSim.Framework | |||
132 | } | 143 | } |
133 | 144 | ||
134 | /// <summary> | 145 | /// <summary> |
146 | /// The single recipient or all if not set. | ||
147 | /// </summary> | ||
148 | public UUID TargetUUID | ||
149 | { | ||
150 | get { return m_toID; } | ||
151 | set { m_toID = value; } | ||
152 | } | ||
153 | |||
154 | /// <summary> | ||
135 | /// | 155 | /// |
136 | /// </summary> | 156 | /// </summary> |
137 | public IScene Scene | 157 | public IScene Scene |
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index c6ccc9e..fcc9873 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -241,10 +241,14 @@ namespace OpenSim.Framework | |||
241 | 241 | ||
242 | m_textureEntry = prim.Textures.GetBytes(); | 242 | m_textureEntry = prim.Textures.GetBytes(); |
243 | 243 | ||
244 | SculptEntry = (prim.Sculpt.Type != OpenMetaverse.SculptType.None); | 244 | if (prim.Sculpt != null) |
245 | SculptData = prim.Sculpt.GetBytes(); | 245 | { |
246 | SculptTexture = prim.Sculpt.SculptTexture; | 246 | SculptEntry = (prim.Sculpt.Type != OpenMetaverse.SculptType.None); |
247 | SculptType = (byte)prim.Sculpt.Type; | 247 | SculptData = prim.Sculpt.GetBytes(); |
248 | SculptTexture = prim.Sculpt.SculptTexture; | ||
249 | SculptType = (byte)prim.Sculpt.Type; | ||
250 | } | ||
251 | else SculptType = (byte)OpenMetaverse.SculptType.None; | ||
248 | } | 252 | } |
249 | 253 | ||
250 | [XmlIgnore] | 254 | [XmlIgnore] |
diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs index c142bd9..47a2780 100644 --- a/OpenSim/Framework/RegionSettings.cs +++ b/OpenSim/Framework/RegionSettings.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using System.Runtime.Serialization; | ||
32 | 33 | ||
33 | namespace OpenSim.Framework | 34 | namespace OpenSim.Framework |
34 | { | 35 | { |
@@ -71,6 +72,32 @@ namespace OpenSim.Framework | |||
71 | 72 | ||
72 | return pos + offset; | 73 | return pos + offset; |
73 | } | 74 | } |
75 | |||
76 | /// <summary> | ||
77 | /// Returns a string representation of this SpawnPoint. | ||
78 | /// </summary> | ||
79 | /// <returns></returns> | ||
80 | public override string ToString() | ||
81 | { | ||
82 | return string.Format("{0},{1},{2}", Yaw, Pitch, Distance); | ||
83 | } | ||
84 | |||
85 | /// <summary> | ||
86 | /// Generate a SpawnPoint from a string | ||
87 | /// </summary> | ||
88 | /// <param name="str"></param> | ||
89 | public static SpawnPoint Parse(string str) | ||
90 | { | ||
91 | string[] parts = str.Split(','); | ||
92 | if (parts.Length != 3) | ||
93 | throw new ArgumentException("Invalid string: " + str); | ||
94 | |||
95 | SpawnPoint sp = new SpawnPoint(); | ||
96 | sp.Yaw = float.Parse(parts[0]); | ||
97 | sp.Pitch = float.Parse(parts[1]); | ||
98 | sp.Distance = float.Parse(parts[2]); | ||
99 | return sp; | ||
100 | } | ||
74 | } | 101 | } |
75 | 102 | ||
76 | public class RegionSettings | 103 | public class RegionSettings |
@@ -478,7 +505,7 @@ namespace OpenSim.Framework | |||
478 | } | 505 | } |
479 | 506 | ||
480 | // Connected Telehub object | 507 | // Connected Telehub object |
481 | private UUID m_TelehubObject; | 508 | private UUID m_TelehubObject = UUID.Zero; |
482 | public UUID TelehubObject | 509 | public UUID TelehubObject |
483 | { | 510 | { |
484 | get | 511 | get |
diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs index db4541e..537de7a 100644 --- a/OpenSim/Framework/SLUtil.cs +++ b/OpenSim/Framework/SLUtil.cs | |||
@@ -38,239 +38,189 @@ namespace OpenSim.Framework | |||
38 | public static class SLUtil | 38 | public static class SLUtil |
39 | { | 39 | { |
40 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 40 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
41 | 41 | ||
42 | #region SL / file extension / content-type conversions | 42 | #region SL / file extension / content-type conversions |
43 | 43 | ||
44 | public static string SLAssetTypeToContentType(int assetType) | 44 | private class TypeMapping |
45 | { | 45 | { |
46 | switch ((AssetType)assetType) | 46 | private sbyte assetType; |
47 | private InventoryType inventoryType; | ||
48 | private string contentType; | ||
49 | private string contentType2; | ||
50 | private string extension; | ||
51 | |||
52 | public sbyte AssetTypeCode | ||
53 | { | ||
54 | get { return assetType; } | ||
55 | } | ||
56 | |||
57 | public object AssetType | ||
58 | { | ||
59 | get { | ||
60 | if (Enum.IsDefined(typeof(OpenMetaverse.AssetType), assetType)) | ||
61 | return (OpenMetaverse.AssetType)assetType; | ||
62 | else | ||
63 | return OpenMetaverse.AssetType.Unknown; | ||
64 | } | ||
65 | } | ||
66 | |||
67 | public InventoryType InventoryType | ||
68 | { | ||
69 | get { return inventoryType; } | ||
70 | } | ||
71 | |||
72 | public string ContentType | ||
73 | { | ||
74 | get { return contentType; } | ||
75 | } | ||
76 | |||
77 | public string ContentType2 | ||
78 | { | ||
79 | get { return contentType2; } | ||
80 | } | ||
81 | |||
82 | public string Extension | ||
83 | { | ||
84 | get { return extension; } | ||
85 | } | ||
86 | |||
87 | private TypeMapping(sbyte assetType, InventoryType inventoryType, string contentType, string contentType2, string extension) | ||
88 | { | ||
89 | this.assetType = assetType; | ||
90 | this.inventoryType = inventoryType; | ||
91 | this.contentType = contentType; | ||
92 | this.contentType2 = contentType2; | ||
93 | this.extension = extension; | ||
94 | } | ||
95 | |||
96 | public TypeMapping(AssetType assetType, InventoryType inventoryType, string contentType, string contentType2, string extension) | ||
97 | : this((sbyte)assetType, inventoryType, contentType, contentType2, extension) | ||
98 | { | ||
99 | } | ||
100 | |||
101 | public TypeMapping(AssetType assetType, InventoryType inventoryType, string contentType, string extension) | ||
102 | : this((sbyte)assetType, inventoryType, contentType, null, extension) | ||
47 | { | 103 | { |
48 | case AssetType.Texture: | ||
49 | return "image/x-j2c"; | ||
50 | case AssetType.Sound: | ||
51 | return "audio/ogg"; | ||
52 | case AssetType.CallingCard: | ||
53 | return "application/vnd.ll.callingcard"; | ||
54 | case AssetType.Landmark: | ||
55 | return "application/vnd.ll.landmark"; | ||
56 | case AssetType.Clothing: | ||
57 | return "application/vnd.ll.clothing"; | ||
58 | case AssetType.Object: | ||
59 | return "application/vnd.ll.primitive"; | ||
60 | case AssetType.Notecard: | ||
61 | return "application/vnd.ll.notecard"; | ||
62 | case AssetType.Folder: | ||
63 | return "application/vnd.ll.folder"; | ||
64 | case AssetType.RootFolder: | ||
65 | return "application/vnd.ll.rootfolder"; | ||
66 | case AssetType.LSLText: | ||
67 | return "application/vnd.ll.lsltext"; | ||
68 | case AssetType.LSLBytecode: | ||
69 | return "application/vnd.ll.lslbyte"; | ||
70 | case AssetType.TextureTGA: | ||
71 | case AssetType.ImageTGA: | ||
72 | return "image/tga"; | ||
73 | case AssetType.Bodypart: | ||
74 | return "application/vnd.ll.bodypart"; | ||
75 | case AssetType.TrashFolder: | ||
76 | return "application/vnd.ll.trashfolder"; | ||
77 | case AssetType.SnapshotFolder: | ||
78 | return "application/vnd.ll.snapshotfolder"; | ||
79 | case AssetType.LostAndFoundFolder: | ||
80 | return "application/vnd.ll.lostandfoundfolder"; | ||
81 | case AssetType.SoundWAV: | ||
82 | return "audio/x-wav"; | ||
83 | case AssetType.ImageJPEG: | ||
84 | return "image/jpeg"; | ||
85 | case AssetType.Animation: | ||
86 | return "application/vnd.ll.animation"; | ||
87 | case AssetType.Gesture: | ||
88 | return "application/vnd.ll.gesture"; | ||
89 | case AssetType.Simstate: | ||
90 | return "application/x-metaverse-simstate"; | ||
91 | case AssetType.FavoriteFolder: | ||
92 | return "application/vnd.ll.favoritefolder"; | ||
93 | case AssetType.Link: | ||
94 | return "application/vnd.ll.link"; | ||
95 | case AssetType.LinkFolder: | ||
96 | return "application/vnd.ll.linkfolder"; | ||
97 | case AssetType.CurrentOutfitFolder: | ||
98 | return "application/vnd.ll.currentoutfitfolder"; | ||
99 | case AssetType.OutfitFolder: | ||
100 | return "application/vnd.ll.outfitfolder"; | ||
101 | case AssetType.MyOutfitsFolder: | ||
102 | return "application/vnd.ll.myoutfitsfolder"; | ||
103 | case AssetType.Unknown: | ||
104 | default: | ||
105 | return "application/octet-stream"; | ||
106 | } | 104 | } |
107 | } | 105 | } |
108 | 106 | ||
109 | public static string SLInvTypeToContentType(int invType) | 107 | /// <summary> |
108 | /// Maps between AssetType, InventoryType and Content-Type. | ||
109 | /// Where more than one possibility exists, the first one takes precedence. E.g.: | ||
110 | /// AssetType "AssetType.Texture" -> Content-Type "image-xj2c" | ||
111 | /// Content-Type "image/x-j2c" -> InventoryType "InventoryType.Texture" | ||
112 | /// </summary> | ||
113 | private static TypeMapping[] MAPPINGS = new TypeMapping[] { | ||
114 | new TypeMapping(AssetType.Unknown, InventoryType.Unknown, "application/octet-stream", "bin"), | ||
115 | new TypeMapping(AssetType.Texture, InventoryType.Texture, "image/x-j2c", "image/jp2", "j2c"), | ||
116 | new TypeMapping(AssetType.Texture, InventoryType.Snapshot, "image/x-j2c", "image/jp2", "j2c"), | ||
117 | new TypeMapping(AssetType.TextureTGA, InventoryType.Texture, "image/tga", "tga"), | ||
118 | new TypeMapping(AssetType.ImageTGA, InventoryType.Texture, "image/tga", "tga"), | ||
119 | new TypeMapping(AssetType.ImageJPEG, InventoryType.Texture, "image/jpeg", "jpg"), | ||
120 | new TypeMapping(AssetType.Sound, InventoryType.Sound, "audio/ogg", "application/ogg", "ogg"), | ||
121 | new TypeMapping(AssetType.SoundWAV, InventoryType.Sound, "audio/x-wav", "wav"), | ||
122 | new TypeMapping(AssetType.CallingCard, InventoryType.CallingCard, "application/vnd.ll.callingcard", "application/x-metaverse-callingcard", "callingcard"), | ||
123 | new TypeMapping(AssetType.Landmark, InventoryType.Landmark, "application/vnd.ll.landmark", "application/x-metaverse-landmark", "landmark"), | ||
124 | new TypeMapping(AssetType.Clothing, InventoryType.Wearable, "application/vnd.ll.clothing", "application/x-metaverse-clothing", "clothing"), | ||
125 | new TypeMapping(AssetType.Object, InventoryType.Object, "application/vnd.ll.primitive", "application/x-metaverse-primitive", "primitive"), | ||
126 | new TypeMapping(AssetType.Object, InventoryType.Attachment, "application/vnd.ll.primitive", "application/x-metaverse-primitive", "primitive"), | ||
127 | new TypeMapping(AssetType.Notecard, InventoryType.Notecard, "application/vnd.ll.notecard", "application/x-metaverse-notecard", "notecard"), | ||
128 | new TypeMapping(AssetType.Folder, InventoryType.Folder, "application/vnd.ll.folder", "folder"), | ||
129 | new TypeMapping(AssetType.RootFolder, InventoryType.RootCategory, "application/vnd.ll.rootfolder", "rootfolder"), | ||
130 | new TypeMapping(AssetType.LSLText, InventoryType.LSL, "application/vnd.ll.lsltext", "application/x-metaverse-lsl", "lsl"), | ||
131 | new TypeMapping(AssetType.LSLBytecode, InventoryType.LSL, "application/vnd.ll.lslbyte", "application/x-metaverse-lso", "lso"), | ||
132 | new TypeMapping(AssetType.Bodypart, InventoryType.Wearable, "application/vnd.ll.bodypart", "application/x-metaverse-bodypart", "bodypart"), | ||
133 | new TypeMapping(AssetType.TrashFolder, InventoryType.Folder, "application/vnd.ll.trashfolder", "trashfolder"), | ||
134 | new TypeMapping(AssetType.SnapshotFolder, InventoryType.Folder, "application/vnd.ll.snapshotfolder", "snapshotfolder"), | ||
135 | new TypeMapping(AssetType.LostAndFoundFolder, InventoryType.Folder, "application/vnd.ll.lostandfoundfolder", "lostandfoundfolder"), | ||
136 | new TypeMapping(AssetType.Animation, InventoryType.Animation, "application/vnd.ll.animation", "application/x-metaverse-animation", "animation"), | ||
137 | new TypeMapping(AssetType.Gesture, InventoryType.Gesture, "application/vnd.ll.gesture", "application/x-metaverse-gesture", "gesture"), | ||
138 | new TypeMapping(AssetType.Simstate, InventoryType.Snapshot, "application/x-metaverse-simstate", "simstate"), | ||
139 | new TypeMapping(AssetType.FavoriteFolder, InventoryType.Unknown, "application/vnd.ll.favoritefolder", "favoritefolder"), | ||
140 | new TypeMapping(AssetType.Link, InventoryType.Unknown, "application/vnd.ll.link", "link"), | ||
141 | new TypeMapping(AssetType.LinkFolder, InventoryType.Unknown, "application/vnd.ll.linkfolder", "linkfolder"), | ||
142 | new TypeMapping(AssetType.CurrentOutfitFolder, InventoryType.Unknown, "application/vnd.ll.currentoutfitfolder", "currentoutfitfolder"), | ||
143 | new TypeMapping(AssetType.OutfitFolder, InventoryType.Unknown, "application/vnd.ll.outfitfolder", "outfitfolder"), | ||
144 | new TypeMapping(AssetType.MyOutfitsFolder, InventoryType.Unknown, "application/vnd.ll.myoutfitsfolder", "myoutfitsfolder"), | ||
145 | new TypeMapping(AssetType.Mesh, InventoryType.Mesh, "application/vnd.ll.mesh", "llm") | ||
146 | }; | ||
147 | |||
148 | private static Dictionary<sbyte, string> asset2Content; | ||
149 | private static Dictionary<sbyte, string> asset2Extension; | ||
150 | private static Dictionary<InventoryType, string> inventory2Content; | ||
151 | private static Dictionary<string, sbyte> content2Asset; | ||
152 | private static Dictionary<string, InventoryType> content2Inventory; | ||
153 | |||
154 | static SLUtil() | ||
110 | { | 155 | { |
111 | switch ((InventoryType)invType) | 156 | asset2Content = new Dictionary<sbyte, string>(); |
157 | asset2Extension = new Dictionary<sbyte, string>(); | ||
158 | inventory2Content = new Dictionary<InventoryType, string>(); | ||
159 | content2Asset = new Dictionary<string, sbyte>(); | ||
160 | content2Inventory = new Dictionary<string, InventoryType>(); | ||
161 | |||
162 | foreach (TypeMapping mapping in MAPPINGS) | ||
112 | { | 163 | { |
113 | case InventoryType.Animation: | 164 | sbyte assetType = mapping.AssetTypeCode; |
114 | return "application/vnd.ll.animation"; | 165 | if (!asset2Content.ContainsKey(assetType)) |
115 | case InventoryType.CallingCard: | 166 | asset2Content.Add(assetType, mapping.ContentType); |
116 | return "application/vnd.ll.callingcard"; | 167 | if (!asset2Extension.ContainsKey(assetType)) |
117 | case InventoryType.Folder: | 168 | asset2Extension.Add(assetType, mapping.Extension); |
118 | return "application/vnd.ll.folder"; | 169 | if (!inventory2Content.ContainsKey(mapping.InventoryType)) |
119 | case InventoryType.Gesture: | 170 | inventory2Content.Add(mapping.InventoryType, mapping.ContentType); |
120 | return "application/vnd.ll.gesture"; | 171 | if (!content2Asset.ContainsKey(mapping.ContentType)) |
121 | case InventoryType.Landmark: | 172 | content2Asset.Add(mapping.ContentType, assetType); |
122 | return "application/vnd.ll.landmark"; | 173 | if (!content2Inventory.ContainsKey(mapping.ContentType)) |
123 | case InventoryType.LSL: | 174 | content2Inventory.Add(mapping.ContentType, mapping.InventoryType); |
124 | return "application/vnd.ll.lsltext"; | 175 | |
125 | case InventoryType.Notecard: | 176 | if (mapping.ContentType2 != null) |
126 | return "application/vnd.ll.notecard"; | 177 | { |
127 | case InventoryType.Attachment: | 178 | if (!content2Asset.ContainsKey(mapping.ContentType2)) |
128 | case InventoryType.Object: | 179 | content2Asset.Add(mapping.ContentType2, assetType); |
129 | return "application/vnd.ll.primitive"; | 180 | if (!content2Inventory.ContainsKey(mapping.ContentType2)) |
130 | case InventoryType.Sound: | 181 | content2Inventory.Add(mapping.ContentType2, mapping.InventoryType); |
131 | return "audio/ogg"; | 182 | } |
132 | case InventoryType.Snapshot: | ||
133 | case InventoryType.Texture: | ||
134 | return "image/x-j2c"; | ||
135 | case InventoryType.Wearable: | ||
136 | return "application/vnd.ll.clothing"; | ||
137 | default: | ||
138 | return "application/octet-stream"; | ||
139 | } | 183 | } |
140 | } | 184 | } |
185 | |||
186 | public static string SLAssetTypeToContentType(int assetType) | ||
187 | { | ||
188 | string contentType; | ||
189 | if (!asset2Content.TryGetValue((sbyte)assetType, out contentType)) | ||
190 | contentType = asset2Content[(sbyte)AssetType.Unknown]; | ||
191 | return contentType; | ||
192 | } | ||
193 | |||
194 | public static string SLInvTypeToContentType(int invType) | ||
195 | { | ||
196 | string contentType; | ||
197 | if (!inventory2Content.TryGetValue((InventoryType)invType, out contentType)) | ||
198 | contentType = inventory2Content[InventoryType.Unknown]; | ||
199 | return contentType; | ||
200 | } | ||
141 | 201 | ||
142 | public static sbyte ContentTypeToSLAssetType(string contentType) | 202 | public static sbyte ContentTypeToSLAssetType(string contentType) |
143 | { | 203 | { |
144 | switch (contentType) | 204 | sbyte assetType; |
145 | { | 205 | if (!content2Asset.TryGetValue(contentType, out assetType)) |
146 | case "image/x-j2c": | 206 | assetType = (sbyte)AssetType.Unknown; |
147 | case "image/jp2": | 207 | return (sbyte)assetType; |
148 | return (sbyte)AssetType.Texture; | ||
149 | case "application/ogg": | ||
150 | case "audio/ogg": | ||
151 | return (sbyte)AssetType.Sound; | ||
152 | case "application/vnd.ll.callingcard": | ||
153 | case "application/x-metaverse-callingcard": | ||
154 | return (sbyte)AssetType.CallingCard; | ||
155 | case "application/vnd.ll.landmark": | ||
156 | case "application/x-metaverse-landmark": | ||
157 | return (sbyte)AssetType.Landmark; | ||
158 | case "application/vnd.ll.clothing": | ||
159 | case "application/x-metaverse-clothing": | ||
160 | return (sbyte)AssetType.Clothing; | ||
161 | case "application/vnd.ll.primitive": | ||
162 | case "application/x-metaverse-primitive": | ||
163 | return (sbyte)AssetType.Object; | ||
164 | case "application/vnd.ll.notecard": | ||
165 | case "application/x-metaverse-notecard": | ||
166 | return (sbyte)AssetType.Notecard; | ||
167 | case "application/vnd.ll.folder": | ||
168 | return (sbyte)AssetType.Folder; | ||
169 | case "application/vnd.ll.rootfolder": | ||
170 | return (sbyte)AssetType.RootFolder; | ||
171 | case "application/vnd.ll.lsltext": | ||
172 | case "application/x-metaverse-lsl": | ||
173 | return (sbyte)AssetType.LSLText; | ||
174 | case "application/vnd.ll.lslbyte": | ||
175 | case "application/x-metaverse-lso": | ||
176 | return (sbyte)AssetType.LSLBytecode; | ||
177 | case "image/tga": | ||
178 | // Note that AssetType.TextureTGA will be converted to AssetType.ImageTGA | ||
179 | return (sbyte)AssetType.ImageTGA; | ||
180 | case "application/vnd.ll.bodypart": | ||
181 | case "application/x-metaverse-bodypart": | ||
182 | return (sbyte)AssetType.Bodypart; | ||
183 | case "application/vnd.ll.trashfolder": | ||
184 | return (sbyte)AssetType.TrashFolder; | ||
185 | case "application/vnd.ll.snapshotfolder": | ||
186 | return (sbyte)AssetType.SnapshotFolder; | ||
187 | case "application/vnd.ll.lostandfoundfolder": | ||
188 | return (sbyte)AssetType.LostAndFoundFolder; | ||
189 | case "audio/x-wav": | ||
190 | return (sbyte)AssetType.SoundWAV; | ||
191 | case "image/jpeg": | ||
192 | return (sbyte)AssetType.ImageJPEG; | ||
193 | case "application/vnd.ll.animation": | ||
194 | case "application/x-metaverse-animation": | ||
195 | return (sbyte)AssetType.Animation; | ||
196 | case "application/vnd.ll.gesture": | ||
197 | case "application/x-metaverse-gesture": | ||
198 | return (sbyte)AssetType.Gesture; | ||
199 | case "application/x-metaverse-simstate": | ||
200 | return (sbyte)AssetType.Simstate; | ||
201 | case "application/vnd.ll.favoritefolder": | ||
202 | return (sbyte)AssetType.FavoriteFolder; | ||
203 | case "application/vnd.ll.link": | ||
204 | return (sbyte)AssetType.Link; | ||
205 | case "application/vnd.ll.linkfolder": | ||
206 | return (sbyte)AssetType.LinkFolder; | ||
207 | case "application/vnd.ll.currentoutfitfolder": | ||
208 | return (sbyte)AssetType.CurrentOutfitFolder; | ||
209 | case "application/vnd.ll.outfitfolder": | ||
210 | return (sbyte)AssetType.OutfitFolder; | ||
211 | case "application/vnd.ll.myoutfitsfolder": | ||
212 | return (sbyte)AssetType.MyOutfitsFolder; | ||
213 | case "application/octet-stream": | ||
214 | default: | ||
215 | return (sbyte)AssetType.Unknown; | ||
216 | } | ||
217 | } | 208 | } |
218 | 209 | ||
219 | public static sbyte ContentTypeToSLInvType(string contentType) | 210 | public static sbyte ContentTypeToSLInvType(string contentType) |
220 | { | 211 | { |
221 | switch (contentType) | 212 | InventoryType invType; |
222 | { | 213 | if (!content2Inventory.TryGetValue(contentType, out invType)) |
223 | case "image/x-j2c": | 214 | invType = InventoryType.Unknown; |
224 | case "image/jp2": | 215 | return (sbyte)invType; |
225 | case "image/tga": | 216 | } |
226 | case "image/jpeg": | 217 | |
227 | return (sbyte)InventoryType.Texture; | 218 | public static string SLAssetTypeToExtension(int assetType) |
228 | case "application/ogg": | 219 | { |
229 | case "audio/ogg": | 220 | string extension; |
230 | case "audio/x-wav": | 221 | if (!asset2Extension.TryGetValue((sbyte)assetType, out extension)) |
231 | return (sbyte)InventoryType.Sound; | 222 | extension = asset2Extension[(sbyte)AssetType.Unknown]; |
232 | case "application/vnd.ll.callingcard": | 223 | return extension; |
233 | case "application/x-metaverse-callingcard": | ||
234 | return (sbyte)InventoryType.CallingCard; | ||
235 | case "application/vnd.ll.landmark": | ||
236 | case "application/x-metaverse-landmark": | ||
237 | return (sbyte)InventoryType.Landmark; | ||
238 | case "application/vnd.ll.clothing": | ||
239 | case "application/x-metaverse-clothing": | ||
240 | case "application/vnd.ll.bodypart": | ||
241 | case "application/x-metaverse-bodypart": | ||
242 | return (sbyte)InventoryType.Wearable; | ||
243 | case "application/vnd.ll.primitive": | ||
244 | case "application/x-metaverse-primitive": | ||
245 | return (sbyte)InventoryType.Object; | ||
246 | case "application/vnd.ll.notecard": | ||
247 | case "application/x-metaverse-notecard": | ||
248 | return (sbyte)InventoryType.Notecard; | ||
249 | case "application/vnd.ll.folder": | ||
250 | return (sbyte)InventoryType.Folder; | ||
251 | case "application/vnd.ll.rootfolder": | ||
252 | return (sbyte)InventoryType.RootCategory; | ||
253 | case "application/vnd.ll.lsltext": | ||
254 | case "application/x-metaverse-lsl": | ||
255 | case "application/vnd.ll.lslbyte": | ||
256 | case "application/x-metaverse-lso": | ||
257 | return (sbyte)InventoryType.LSL; | ||
258 | case "application/vnd.ll.trashfolder": | ||
259 | case "application/vnd.ll.snapshotfolder": | ||
260 | case "application/vnd.ll.lostandfoundfolder": | ||
261 | return (sbyte)InventoryType.Folder; | ||
262 | case "application/vnd.ll.animation": | ||
263 | case "application/x-metaverse-animation": | ||
264 | return (sbyte)InventoryType.Animation; | ||
265 | case "application/vnd.ll.gesture": | ||
266 | case "application/x-metaverse-gesture": | ||
267 | return (sbyte)InventoryType.Gesture; | ||
268 | case "application/x-metaverse-simstate": | ||
269 | return (sbyte)InventoryType.Snapshot; | ||
270 | case "application/octet-stream": | ||
271 | default: | ||
272 | return (sbyte)InventoryType.Unknown; | ||
273 | } | ||
274 | } | 224 | } |
275 | 225 | ||
276 | #endregion SL / file extension / content-type conversions | 226 | #endregion SL / file extension / content-type conversions |
@@ -377,4 +327,4 @@ namespace OpenSim.Framework | |||
377 | return output; | 327 | return output; |
378 | } | 328 | } |
379 | } | 329 | } |
380 | } \ No newline at end of file | 330 | } |
diff --git a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs index 931898c..f18435d 100644 --- a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs +++ b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs | |||
@@ -30,6 +30,8 @@ using System.Text; | |||
30 | using System.Xml; | 30 | using System.Xml; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using log4net; | ||
34 | using System.Reflection; | ||
33 | 35 | ||
34 | namespace OpenSim.Framework.Serialization.External | 36 | namespace OpenSim.Framework.Serialization.External |
35 | { | 37 | { |
@@ -187,7 +189,29 @@ namespace OpenSim.Framework.Serialization.External | |||
187 | break; | 189 | break; |
188 | } | 190 | } |
189 | } | 191 | } |
190 | 192 | ||
193 | xtr.ReadEndElement(); | ||
194 | |||
195 | if (xtr.IsStartElement("Telehub")) | ||
196 | { | ||
197 | xtr.ReadStartElement("Telehub"); | ||
198 | |||
199 | while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) | ||
200 | { | ||
201 | switch (xtr.Name) | ||
202 | { | ||
203 | case "TelehubObject": | ||
204 | settings.TelehubObject = UUID.Parse(xtr.ReadElementContentAsString()); | ||
205 | break; | ||
206 | case "SpawnPoint": | ||
207 | string str = xtr.ReadElementContentAsString(); | ||
208 | SpawnPoint sp = SpawnPoint.Parse(str); | ||
209 | settings.AddSpawnPoint(sp); | ||
210 | break; | ||
211 | } | ||
212 | } | ||
213 | } | ||
214 | |||
191 | xtr.Close(); | 215 | xtr.Close(); |
192 | sr.Close(); | 216 | sr.Close(); |
193 | 217 | ||
@@ -243,7 +267,16 @@ namespace OpenSim.Framework.Serialization.External | |||
243 | xtw.WriteElementString("SunPosition", settings.SunPosition.ToString()); | 267 | xtw.WriteElementString("SunPosition", settings.SunPosition.ToString()); |
244 | // Note: 'SunVector' isn't saved because this value is owned by the Sun Module, which | 268 | // Note: 'SunVector' isn't saved because this value is owned by the Sun Module, which |
245 | // calculates it automatically according to the date and other factors. | 269 | // calculates it automatically according to the date and other factors. |
246 | xtw.WriteEndElement(); | 270 | xtw.WriteEndElement(); |
271 | |||
272 | xtw.WriteStartElement("Telehub"); | ||
273 | if (settings.TelehubObject != UUID.Zero) | ||
274 | { | ||
275 | xtw.WriteElementString("TelehubObject", settings.TelehubObject.ToString()); | ||
276 | foreach (SpawnPoint sp in settings.SpawnPoints()) | ||
277 | xtw.WriteElementString("SpawnPoint", sp.ToString()); | ||
278 | } | ||
279 | xtw.WriteEndElement(); | ||
247 | 280 | ||
248 | xtw.WriteEndElement(); | 281 | xtw.WriteEndElement(); |
249 | 282 | ||
diff --git a/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs index a61e4af..09b6f6d 100644 --- a/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs +++ b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs | |||
@@ -78,6 +78,10 @@ namespace OpenSim.Framework.Serialization.Tests | |||
78 | <FixedSun>true</FixedSun> | 78 | <FixedSun>true</FixedSun> |
79 | <SunPosition>12</SunPosition> | 79 | <SunPosition>12</SunPosition> |
80 | </Terrain> | 80 | </Terrain> |
81 | <Telehub> | ||
82 | <TelehubObject>00000000-0000-0000-0000-111111111111</TelehubObject> | ||
83 | <SpawnPoint>1,-2,0.33</SpawnPoint> | ||
84 | </Telehub> | ||
81 | </RegionSettings>"; | 85 | </RegionSettings>"; |
82 | 86 | ||
83 | private RegionSettings m_rs; | 87 | private RegionSettings m_rs; |
@@ -116,6 +120,8 @@ namespace OpenSim.Framework.Serialization.Tests | |||
116 | m_rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080"); | 120 | m_rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080"); |
117 | m_rs.UseEstateSun = true; | 121 | m_rs.UseEstateSun = true; |
118 | m_rs.WaterHeight = 23; | 122 | m_rs.WaterHeight = 23; |
123 | m_rs.TelehubObject = UUID.Parse("00000000-0000-0000-0000-111111111111"); | ||
124 | m_rs.AddSpawnPoint(SpawnPoint.Parse("1,-2,0.33")); | ||
119 | } | 125 | } |
120 | 126 | ||
121 | [Test] | 127 | [Test] |
@@ -129,6 +135,8 @@ namespace OpenSim.Framework.Serialization.Tests | |||
129 | Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2)); | 135 | Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2)); |
130 | Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics)); | 136 | Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics)); |
131 | Assert.That(deserRs.TerrainLowerLimit, Is.EqualTo(m_rs.TerrainLowerLimit)); | 137 | Assert.That(deserRs.TerrainLowerLimit, Is.EqualTo(m_rs.TerrainLowerLimit)); |
138 | Assert.That(deserRs.TelehubObject, Is.EqualTo(m_rs.TelehubObject)); | ||
139 | Assert.That(deserRs.SpawnPoints()[0].ToString(), Is.EqualTo(m_rs.SpawnPoints()[0].ToString())); | ||
132 | } | 140 | } |
133 | } | 141 | } |
134 | } | 142 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHTTPHandler.cs b/OpenSim/Framework/Servers/HttpServer/BaseHTTPHandler.cs index 2fe9769..9f8f4a8 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHTTPHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHTTPHandler.cs | |||
@@ -33,9 +33,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
33 | { | 33 | { |
34 | public abstract Hashtable Handle(string path, Hashtable Request); | 34 | public abstract Hashtable Handle(string path, Hashtable Request); |
35 | 35 | ||
36 | protected BaseHTTPHandler(string httpMethod, string path) | 36 | protected BaseHTTPHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {} |
37 | : base(httpMethod, path) | 37 | |
38 | { | 38 | protected BaseHTTPHandler(string httpMethod, string path, string name, string description) |
39 | } | 39 | : base(httpMethod, path, name, description) {} |
40 | } | 40 | } |
41 | } | 41 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ad5af1f..f5addc8 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -156,7 +156,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | public List<string> GetStreamHandlerKeys() | 159 | public List<string> GetStreamHandlerKeys() |
160 | { | 160 | { |
161 | lock (m_streamHandlers) | 161 | lock (m_streamHandlers) |
162 | return new List<string>(m_streamHandlers.Keys); | 162 | return new List<string>(m_streamHandlers.Keys); |
@@ -356,7 +356,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
356 | } | 356 | } |
357 | catch (Exception e) | 357 | catch (Exception e) |
358 | { | 358 | { |
359 | m_log.ErrorFormat("[BASE HTTP SERVER]: OnRequest() failed with {0}{1}", e.Message, e.StackTrace); | 359 | m_log.Error(String.Format("[BASE HTTP SERVER]: OnRequest() failed: {0} ", e.Message), e); |
360 | } | 360 | } |
361 | } | 361 | } |
362 | 362 | ||
@@ -410,6 +410,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
410 | // string reqnum = "unknown"; | 410 | // string reqnum = "unknown"; |
411 | int tickstart = Environment.TickCount; | 411 | int tickstart = Environment.TickCount; |
412 | 412 | ||
413 | IRequestHandler requestHandler = null; | ||
414 | |||
413 | try | 415 | try |
414 | { | 416 | { |
415 | // OpenSim.Framework.WebUtil.OSHeaderRequestID | 417 | // OpenSim.Framework.WebUtil.OSHeaderRequestID |
@@ -438,8 +440,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
438 | //response.KeepAlive = true; | 440 | //response.KeepAlive = true; |
439 | response.SendChunked = false; | 441 | response.SendChunked = false; |
440 | 442 | ||
441 | IRequestHandler requestHandler; | ||
442 | |||
443 | string path = request.RawUrl; | 443 | string path = request.RawUrl; |
444 | string handlerKey = GetHandlerKey(request.HttpMethod, path); | 444 | string handlerKey = GetHandlerKey(request.HttpMethod, path); |
445 | 445 | ||
@@ -447,8 +447,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
447 | { | 447 | { |
448 | if (DebugLevel >= 1) | 448 | if (DebugLevel >= 1) |
449 | m_log.DebugFormat( | 449 | m_log.DebugFormat( |
450 | "[BASE HTTP SERVER]: Found stream handler for {0} {1}", | 450 | "[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}", |
451 | request.HttpMethod, request.Url.PathAndQuery); | 451 | request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description); |
452 | 452 | ||
453 | // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. | 453 | // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. |
454 | byte[] buffer = null; | 454 | byte[] buffer = null; |
@@ -551,11 +551,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
551 | catch (SocketException e) | 551 | catch (SocketException e) |
552 | { | 552 | { |
553 | // This has to be here to prevent a Linux/Mono crash | 553 | // This has to be here to prevent a Linux/Mono crash |
554 | m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); | 554 | m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", e.Message), e); |
555 | } | 555 | } |
556 | catch (IOException e) | 556 | catch (IOException e) |
557 | { | 557 | { |
558 | m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message); | 558 | m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}. ", e.Message), e); |
559 | } | 559 | } |
560 | 560 | ||
561 | return; | 561 | return; |
@@ -658,15 +658,15 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
658 | // | 658 | // |
659 | // An alternative may be to turn off all response write exceptions on the HttpListener, but let's go | 659 | // An alternative may be to turn off all response write exceptions on the HttpListener, but let's go |
660 | // with the minimum first | 660 | // with the minimum first |
661 | m_log.WarnFormat("[BASE HTTP SERVER]: HandleRequest threw {0}.\nNOTE: this may be spurious on Linux", e); | 661 | m_log.Warn(String.Format("[BASE HTTP SERVER]: HandleRequest threw {0}.\nNOTE: this may be spurious on Linux ", e.Message), e); |
662 | } | 662 | } |
663 | catch (IOException e) | 663 | catch (IOException e) |
664 | { | 664 | { |
665 | m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e); | 665 | m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e); |
666 | } | 666 | } |
667 | catch (Exception e) | 667 | catch (Exception e) |
668 | { | 668 | { |
669 | m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e.StackTrace); | 669 | m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e); |
670 | SendHTML500(response); | 670 | SendHTML500(response); |
671 | } | 671 | } |
672 | finally | 672 | finally |
@@ -675,8 +675,16 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
675 | // since its just for reporting, tickdiff limit can be adjusted | 675 | // since its just for reporting, tickdiff limit can be adjusted |
676 | int tickdiff = Environment.TickCount - tickstart; | 676 | int tickdiff = Environment.TickCount - tickstart; |
677 | if (tickdiff > 3000) | 677 | if (tickdiff > 3000) |
678 | { | ||
678 | m_log.InfoFormat( | 679 | m_log.InfoFormat( |
679 | "[BASE HTTP SERVER]: slow {0} request for {1} from {2} took {3} ms", requestMethod, uriString, request.RemoteIPEndPoint.ToString(), tickdiff); | 680 | "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms", |
681 | requestMethod, | ||
682 | uriString, | ||
683 | requestHandler != null ? requestHandler.Name : "", | ||
684 | requestHandler != null ? requestHandler.Description : "", | ||
685 | request.RemoteIPEndPoint.ToString(), | ||
686 | tickdiff); | ||
687 | } | ||
680 | } | 688 | } |
681 | } | 689 | } |
682 | 690 | ||
@@ -925,11 +933,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
925 | catch (SocketException e) | 933 | catch (SocketException e) |
926 | { | 934 | { |
927 | // This has to be here to prevent a Linux/Mono crash | 935 | // This has to be here to prevent a Linux/Mono crash |
928 | m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); | 936 | m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", e.Message), e); |
929 | } | 937 | } |
930 | catch (IOException e) | 938 | catch (IOException e) |
931 | { | 939 | { |
932 | m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message); | 940 | m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0} ", e.Message), e); |
933 | } | 941 | } |
934 | } | 942 | } |
935 | return; | 943 | return; |
@@ -962,11 +970,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
962 | catch (SocketException e) | 970 | catch (SocketException e) |
963 | { | 971 | { |
964 | // This has to be here to prevent a Linux/Mono crash | 972 | // This has to be here to prevent a Linux/Mono crash |
965 | m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); | 973 | m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", e.Message), e); |
966 | } | 974 | } |
967 | catch (IOException e) | 975 | catch (IOException e) |
968 | { | 976 | { |
969 | m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message); | 977 | m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0} ", e.Message), e); |
970 | } | 978 | } |
971 | } | 979 | } |
972 | } | 980 | } |
@@ -1077,12 +1085,12 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1077 | } | 1085 | } |
1078 | catch (IOException e) | 1086 | catch (IOException e) |
1079 | { | 1087 | { |
1080 | m_log.WarnFormat("[BASE HTTP SERVER]: LLSD IOException {0}.", e); | 1088 | m_log.Warn(String.Format("[BASE HTTP SERVER]: LLSD IOException {0} ", e.Message), e); |
1081 | } | 1089 | } |
1082 | catch (SocketException e) | 1090 | catch (SocketException e) |
1083 | { | 1091 | { |
1084 | // This has to be here to prevent a Linux/Mono crash | 1092 | // This has to be here to prevent a Linux/Mono crash |
1085 | m_log.WarnFormat("[BASE HTTP SERVER]: LLSD issue {0}.\nNOTE: this may be spurious on Linux.", e); | 1093 | m_log.Warn(String.Format("[BASE HTTP SERVER]: LLSD issue {0}.\nNOTE: this may be spurious on Linux. ", e.Message), e); |
1086 | } | 1094 | } |
1087 | } | 1095 | } |
1088 | } | 1096 | } |
@@ -1334,8 +1342,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1334 | catch (SocketException f) | 1342 | catch (SocketException f) |
1335 | { | 1343 | { |
1336 | // This has to be here to prevent a Linux/Mono crash | 1344 | // This has to be here to prevent a Linux/Mono crash |
1337 | m_log.WarnFormat( | 1345 | m_log.Warn( |
1338 | "[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", f); | 1346 | String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", f.Message), f); |
1339 | } | 1347 | } |
1340 | } | 1348 | } |
1341 | catch(Exception) | 1349 | catch(Exception) |
@@ -1653,11 +1661,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1653 | catch (SocketException e) | 1661 | catch (SocketException e) |
1654 | { | 1662 | { |
1655 | // This has to be here to prevent a Linux/Mono crash | 1663 | // This has to be here to prevent a Linux/Mono crash |
1656 | m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); | 1664 | m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", e.Message), e); |
1657 | } | 1665 | } |
1658 | catch (IOException e) | 1666 | catch (IOException e) |
1659 | { | 1667 | { |
1660 | m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message); | 1668 | m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0} ", e.Message), e); |
1661 | } | 1669 | } |
1662 | } | 1670 | } |
1663 | } | 1671 | } |
@@ -1694,7 +1702,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1694 | catch (SocketException e) | 1702 | catch (SocketException e) |
1695 | { | 1703 | { |
1696 | // This has to be here to prevent a Linux/Mono crash | 1704 | // This has to be here to prevent a Linux/Mono crash |
1697 | m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); | 1705 | m_log.Warn(String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", e.Message), e); |
1698 | } | 1706 | } |
1699 | } | 1707 | } |
1700 | } | 1708 | } |
@@ -1730,7 +1738,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1730 | catch (SocketException e) | 1738 | catch (SocketException e) |
1731 | { | 1739 | { |
1732 | // This has to be here to prevent a Linux/Mono crash | 1740 | // This has to be here to prevent a Linux/Mono crash |
1733 | m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); | 1741 | m_log.Warn(String.Format("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", e.Message), e); |
1734 | } | 1742 | } |
1735 | } | 1743 | } |
1736 | } | 1744 | } |
@@ -1809,7 +1817,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1809 | 1817 | ||
1810 | public void httpServerException(object source, Exception exception) | 1818 | public void httpServerException(object source, Exception exception) |
1811 | { | 1819 | { |
1812 | m_log.ErrorFormat("[BASE HTTP SERVER]: {0} had an exception {1}", source.ToString(), exception.ToString()); | 1820 | m_log.Error(String.Format("[BASE HTTP SERVER]: {0} had an exception: {1} ", source.ToString(), exception.Message), exception); |
1813 | /* | 1821 | /* |
1814 | if (HTTPDRunning)// && NotSocketErrors > 5) | 1822 | if (HTTPDRunning)// && NotSocketErrors > 5) |
1815 | { | 1823 | { |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs b/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs index a2135a3..ae7aaf2 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs | |||
@@ -45,8 +45,16 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
45 | 45 | ||
46 | private readonly string m_path; | 46 | private readonly string m_path; |
47 | 47 | ||
48 | protected BaseRequestHandler(string httpMethod, string path) | 48 | public string Name { get; private set; } |
49 | |||
50 | public string Description { get; private set; } | ||
51 | |||
52 | protected BaseRequestHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {} | ||
53 | |||
54 | protected BaseRequestHandler(string httpMethod, string path, string name, string description) | ||
49 | { | 55 | { |
56 | Name = name; | ||
57 | Description = description; | ||
50 | m_httpMethod = httpMethod; | 58 | m_httpMethod = httpMethod; |
51 | m_path = path; | 59 | m_path = path; |
52 | } | 60 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs index f1cde74..6342983 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs | |||
@@ -34,8 +34,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
34 | public abstract byte[] Handle(string path, Stream request, | 34 | public abstract byte[] Handle(string path, Stream request, |
35 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse); | 35 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse); |
36 | 36 | ||
37 | protected BaseStreamHandler(string httpMethod, string path) : base(httpMethod, path) | 37 | protected BaseStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {} |
38 | { | 38 | |
39 | } | 39 | protected BaseStreamHandler(string httpMethod, string path, string name, string description) |
40 | : base(httpMethod, path, name, description) {} | ||
40 | } | 41 | } |
41 | } | 42 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs index 1699233..b94bfb4 100644 --- a/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs | |||
@@ -36,6 +36,15 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
36 | { | 36 | { |
37 | private BinaryMethod m_method; | 37 | private BinaryMethod m_method; |
38 | 38 | ||
39 | public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod) | ||
40 | : this(httpMethod, path, binaryMethod, null, null) {} | ||
41 | |||
42 | public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod, string name, string description) | ||
43 | : base(httpMethod, path, name, description) | ||
44 | { | ||
45 | m_method = binaryMethod; | ||
46 | } | ||
47 | |||
39 | public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 48 | public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
40 | { | 49 | { |
41 | byte[] data = ReadFully(request); | 50 | byte[] data = ReadFully(request); |
@@ -45,12 +54,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
45 | return Encoding.UTF8.GetBytes(responseString); | 54 | return Encoding.UTF8.GetBytes(responseString); |
46 | } | 55 | } |
47 | 56 | ||
48 | public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod) | ||
49 | : base(httpMethod, path) | ||
50 | { | ||
51 | m_method = binaryMethod; | ||
52 | } | ||
53 | |||
54 | private static byte[] ReadFully(Stream stream) | 57 | private static byte[] ReadFully(Stream stream) |
55 | { | 58 | { |
56 | byte[] buffer = new byte[1024]; | 59 | byte[] buffer = new byte[1024]; |
@@ -70,4 +73,4 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
70 | } | 73 | } |
71 | } | 74 | } |
72 | } | 75 | } |
73 | } | 76 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs index a449c2d..cb5cce5 100644 --- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs | |||
@@ -32,6 +32,25 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
32 | { | 32 | { |
33 | public interface IRequestHandler | 33 | public interface IRequestHandler |
34 | { | 34 | { |
35 | |||
36 | /// <summary> | ||
37 | /// Name for this handler. | ||
38 | /// </summary> | ||
39 | /// <remarks> | ||
40 | /// Used for diagnostics. The path doesn't always describe what the handler does. Can be null if none | ||
41 | /// specified. | ||
42 | /// </remarks> | ||
43 | string Name { get; } | ||
44 | |||
45 | /// <summary> | ||
46 | /// Description for this handler. | ||
47 | /// </summary> | ||
48 | /// <remarks> | ||
49 | /// Used for diagnostics. The path doesn't always describe what the handler does. Can be null if none | ||
50 | /// specified. | ||
51 | /// </remarks> | ||
52 | string Description { get; } | ||
53 | |||
35 | // Return response content type | 54 | // Return response content type |
36 | string ContentType { get; } | 55 | string ContentType { get; } |
37 | 56 | ||
@@ -58,4 +77,4 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
58 | { | 77 | { |
59 | Hashtable Handle(string path, Hashtable request); | 78 | Hashtable Handle(string path, Hashtable request); |
60 | } | 79 | } |
61 | } | 80 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs index a467a83..07082a8 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs | |||
@@ -39,7 +39,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
39 | private RestDeserialiseMethod<TRequest, TResponse> m_method; | 39 | private RestDeserialiseMethod<TRequest, TResponse> m_method; |
40 | 40 | ||
41 | public RestDeserialiseHandler(string httpMethod, string path, RestDeserialiseMethod<TRequest, TResponse> method) | 41 | public RestDeserialiseHandler(string httpMethod, string path, RestDeserialiseMethod<TRequest, TResponse> method) |
42 | : base(httpMethod, path) | 42 | : this(httpMethod, path, method, null, null) {} |
43 | |||
44 | public RestDeserialiseHandler( | ||
45 | string httpMethod, string path, RestDeserialiseMethod<TRequest, TResponse> method, string name, string description) | ||
46 | : base(httpMethod, path, name, description) | ||
43 | { | 47 | { |
44 | m_method = method; | 48 | m_method = method; |
45 | } | 49 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/RestHTTPHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestHTTPHandler.cs index 1f23cac..7f89839 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestHTTPHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestHTTPHandler.cs | |||
@@ -38,19 +38,25 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
38 | get { return m_dhttpMethod; } | 38 | get { return m_dhttpMethod; } |
39 | } | 39 | } |
40 | 40 | ||
41 | public override Hashtable Handle(string path, Hashtable request) | 41 | public RestHTTPHandler(string httpMethod, string path, GenericHTTPMethod dhttpMethod) |
42 | : base(httpMethod, path) | ||
42 | { | 43 | { |
44 | m_dhttpMethod = dhttpMethod; | ||
45 | } | ||
46 | |||
47 | public RestHTTPHandler( | ||
48 | string httpMethod, string path, GenericHTTPMethod dhttpMethod, string name, string description) | ||
49 | : base(httpMethod, path, name, description) | ||
50 | { | ||
51 | m_dhttpMethod = dhttpMethod; | ||
52 | } | ||
43 | 53 | ||
54 | public override Hashtable Handle(string path, Hashtable request) | ||
55 | { | ||
44 | string param = GetParam(path); | 56 | string param = GetParam(path); |
45 | request.Add("param", param); | 57 | request.Add("param", param); |
46 | request.Add("path", path); | 58 | request.Add("path", path); |
47 | return m_dhttpMethod(request); | 59 | return m_dhttpMethod(request); |
48 | } | 60 | } |
49 | |||
50 | public RestHTTPHandler(string httpMethod, string path, GenericHTTPMethod dhttpMethod) | ||
51 | : base(httpMethod, path) | ||
52 | { | ||
53 | m_dhttpMethod = dhttpMethod; | ||
54 | } | ||
55 | } | 61 | } |
56 | } | 62 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs index d2c4002..1f17fee 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs | |||
@@ -39,6 +39,15 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
39 | get { return m_restMethod; } | 39 | get { return m_restMethod; } |
40 | } | 40 | } |
41 | 41 | ||
42 | public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) | ||
43 | : this(httpMethod, path, restMethod, null, null) {} | ||
44 | |||
45 | public RestStreamHandler(string httpMethod, string path, RestMethod restMethod, string name, string description) | ||
46 | : base(httpMethod, path, name, description) | ||
47 | { | ||
48 | m_restMethod = restMethod; | ||
49 | } | ||
50 | |||
42 | public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 51 | public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
43 | { | 52 | { |
44 | Encoding encoding = Encoding.UTF8; | 53 | Encoding encoding = Encoding.UTF8; |
@@ -52,10 +61,5 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
52 | 61 | ||
53 | return Encoding.UTF8.GetBytes(responseString); | 62 | return Encoding.UTF8.GetBytes(responseString); |
54 | } | 63 | } |
55 | |||
56 | public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base(httpMethod, path) | ||
57 | { | ||
58 | m_restMethod = restMethod; | ||
59 | } | ||
60 | } | 64 | } |
61 | } | 65 | } |
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 7ef8bf7..fb818ee 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs | |||
@@ -26,6 +26,8 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | ||
30 | using log4net; | ||
29 | using OpenMetaverse; | 31 | using OpenMetaverse; |
30 | 32 | ||
31 | namespace OpenSim.Framework | 33 | namespace OpenSim.Framework |
@@ -35,6 +37,8 @@ namespace OpenSim.Framework | |||
35 | /// </summary> | 37 | /// </summary> |
36 | public class TaskInventoryItem : ICloneable | 38 | public class TaskInventoryItem : ICloneable |
37 | { | 39 | { |
40 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
41 | |||
38 | /// <summary> | 42 | /// <summary> |
39 | /// XXX This should really be factored out into some constants class. | 43 | /// XXX This should really be factored out into some constants class. |
40 | /// </summary> | 44 | /// </summary> |
@@ -334,12 +338,18 @@ namespace OpenSim.Framework | |||
334 | } | 338 | } |
335 | } | 339 | } |
336 | 340 | ||
337 | public bool OwnerChanged { | 341 | public bool OwnerChanged |
338 | get { | 342 | { |
343 | get | ||
344 | { | ||
339 | return _ownerChanged; | 345 | return _ownerChanged; |
340 | } | 346 | } |
341 | set { | 347 | set |
348 | { | ||
342 | _ownerChanged = value; | 349 | _ownerChanged = value; |
350 | // m_log.DebugFormat( | ||
351 | // "[TASK INVENTORY ITEM]: Owner changed set {0} for {1} {2} owned by {3}", | ||
352 | // _ownerChanged, Name, ItemID, OwnerID); | ||
343 | } | 353 | } |
344 | } | 354 | } |
345 | 355 | ||
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs index 34a3f15..6fde488 100644 --- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs +++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs | |||
@@ -227,10 +227,10 @@ namespace OpenSim.Framework.Tests | |||
227 | es.AddEstateManager(UUID.Zero); | 227 | es.AddEstateManager(UUID.Zero); |
228 | 228 | ||
229 | es.AddEstateManager(bannedUserId); | 229 | es.AddEstateManager(bannedUserId); |
230 | Assert.IsTrue(es.IsEstateManager(bannedUserId), "bannedUserId should be EstateManager but isn't."); | 230 | Assert.IsTrue(es.IsEstateManagerOrOwner(bannedUserId), "bannedUserId should be EstateManager but isn't."); |
231 | 231 | ||
232 | es.RemoveEstateManager(bannedUserId); | 232 | es.RemoveEstateManager(bannedUserId); |
233 | Assert.IsFalse(es.IsEstateManager(bannedUserId), "bannedUserID is estateManager but shouldn't be"); | 233 | Assert.IsFalse(es.IsEstateManagerOrOwner(bannedUserId), "bannedUserID is estateManager but shouldn't be"); |
234 | 234 | ||
235 | Assert.IsFalse(es.HasAccess(bannedUserId), "bannedUserID has access but shouldn't"); | 235 | Assert.IsFalse(es.HasAccess(bannedUserId), "bannedUserID has access but shouldn't"); |
236 | 236 | ||
diff --git a/OpenSim/Framework/Tests/UtilTest.cs b/OpenSim/Framework/Tests/UtilTest.cs index 1ca35df..f0d2a3f 100644 --- a/OpenSim/Framework/Tests/UtilTest.cs +++ b/OpenSim/Framework/Tests/UtilTest.cs | |||
@@ -214,16 +214,13 @@ namespace OpenSim.Framework.Tests | |||
214 | 214 | ||
215 | for (int i = 0; i < contenttypes.Length; i++) | 215 | for (int i = 0; i < contenttypes.Length; i++) |
216 | { | 216 | { |
217 | if (SLUtil.ContentTypeToSLAssetType(contenttypes[i]) == 18) | 217 | int expected; |
218 | { | 218 | if (contenttypes[i] == "image/tga") |
219 | Assert.That(contenttypes[i] == "image/tga"); | 219 | expected = 12; // if we know only the content-type "image/tga", then we assume the asset type is TextureTGA; not ImageTGA |
220 | } | ||
221 | else | 220 | else |
222 | { | 221 | expected = assettypes[i]; |
223 | Assert.That(SLUtil.ContentTypeToSLAssetType(contenttypes[i]) == assettypes[i], | 222 | Assert.AreEqual(expected, SLUtil.ContentTypeToSLAssetType(contenttypes[i]), |
224 | "Expecting {0} but got {1}", assettypes[i], | 223 | String.Format("Incorrect AssetType mapped from Content-Type {0}", contenttypes[i])); |
225 | SLUtil.ContentTypeToSLAssetType(contenttypes[i])); | ||
226 | } | ||
227 | } | 224 | } |
228 | 225 | ||
229 | int[] inventorytypes = new int[] {-1,0,1,2,3,6,7,8,9,10,15,17,18,20}; | 226 | int[] inventorytypes = new int[] {-1,0,1,2,3,6,7,8,9,10,15,17,18,20}; |
@@ -237,7 +234,7 @@ namespace OpenSim.Framework.Tests | |||
237 | "application/vnd.ll.primitive", | 234 | "application/vnd.ll.primitive", |
238 | "application/vnd.ll.notecard", | 235 | "application/vnd.ll.notecard", |
239 | "application/vnd.ll.folder", | 236 | "application/vnd.ll.folder", |
240 | "application/octet-stream", | 237 | "application/vnd.ll.rootfolder", |
241 | "application/vnd.ll.lsltext", | 238 | "application/vnd.ll.lsltext", |
242 | "image/x-j2c", | 239 | "image/x-j2c", |
243 | "application/vnd.ll.primitive", | 240 | "application/vnd.ll.primitive", |
@@ -247,7 +244,8 @@ namespace OpenSim.Framework.Tests | |||
247 | 244 | ||
248 | for (int i=0;i<inventorytypes.Length;i++) | 245 | for (int i=0;i<inventorytypes.Length;i++) |
249 | { | 246 | { |
250 | Assert.That(SLUtil.SLInvTypeToContentType(inventorytypes[i]) == invcontenttypes[i], "Expected {0}, Got {1}", invcontenttypes[i], SLUtil.SLInvTypeToContentType(inventorytypes[i])); | 247 | Assert.AreEqual(invcontenttypes[i], SLUtil.SLInvTypeToContentType(inventorytypes[i]), |
248 | String.Format("Incorrect Content-Type mapped from InventoryType {0}", inventorytypes[i])); | ||
251 | } | 249 | } |
252 | 250 | ||
253 | invcontenttypes = new string[] | 251 | invcontenttypes = new string[] |
@@ -280,7 +278,8 @@ namespace OpenSim.Framework.Tests | |||
280 | 278 | ||
281 | for (int i = 0; i < invtypes.Length; i++) | 279 | for (int i = 0; i < invtypes.Length; i++) |
282 | { | 280 | { |
283 | Assert.That(SLUtil.ContentTypeToSLInvType(invcontenttypes[i]) == invtypes[i], "Expected {0}, Got {1}", invtypes[i], SLUtil.ContentTypeToSLInvType(invcontenttypes[i])); | 281 | Assert.AreEqual(invtypes[i], SLUtil.ContentTypeToSLInvType(invcontenttypes[i]), |
282 | String.Format("Incorrect InventoryType mapped from Content-Type {0}", invcontenttypes[i])); | ||
284 | } | 283 | } |
285 | } | 284 | } |
286 | } | 285 | } |
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index aac575c..6a40cd5 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -53,19 +53,36 @@ namespace OpenSim.Framework | |||
53 | LogManager.GetLogger( | 53 | LogManager.GetLogger( |
54 | MethodBase.GetCurrentMethod().DeclaringType); | 54 | MethodBase.GetCurrentMethod().DeclaringType); |
55 | 55 | ||
56 | private static int m_requestNumber = 0; | 56 | /// <summary> |
57 | /// Request number for diagnostic purposes. | ||
58 | /// </summary> | ||
59 | public static int RequestNumber = 0; | ||
57 | 60 | ||
58 | // this is the header field used to communicate the local request id | 61 | /// <summary> |
59 | // used for performance and debugging | 62 | /// this is the header field used to communicate the local request id |
63 | /// used for performance and debugging | ||
64 | /// </summary> | ||
60 | public const string OSHeaderRequestID = "opensim-request-id"; | 65 | public const string OSHeaderRequestID = "opensim-request-id"; |
61 | 66 | ||
62 | // number of milliseconds a call can take before it is considered | 67 | /// <summary> |
63 | // a "long" call for warning & debugging purposes | 68 | /// Number of milliseconds a call can take before it is considered |
64 | public const int LongCallTime = 500; | 69 | /// a "long" call for warning & debugging purposes |
70 | /// </summary> | ||
71 | public const int LongCallTime = 3000; | ||
65 | 72 | ||
66 | // dictionary of end points | 73 | /// <summary> |
74 | /// The maximum length of any data logged because of a long request time. | ||
75 | /// </summary> | ||
76 | /// <remarks> | ||
77 | /// This is to truncate any really large post data, such as an asset. In theory, the first section should | ||
78 | /// give us useful information about the call (which agent it relates to if applicable, etc.). | ||
79 | /// </remarks> | ||
80 | public const int MaxRequestDiagLength = 100; | ||
81 | |||
82 | /// <summary> | ||
83 | /// Dictionary of end points | ||
84 | /// </summary> | ||
67 | private static Dictionary<string,object> m_endpointSerializer = new Dictionary<string,object>(); | 85 | private static Dictionary<string,object> m_endpointSerializer = new Dictionary<string,object>(); |
68 | |||
69 | 86 | ||
70 | private static object EndPointLock(string url) | 87 | private static object EndPointLock(string url) |
71 | { | 88 | { |
@@ -86,8 +103,7 @@ namespace OpenSim.Framework | |||
86 | return eplock; | 103 | return eplock; |
87 | } | 104 | } |
88 | } | 105 | } |
89 | 106 | ||
90 | |||
91 | #region JSONRequest | 107 | #region JSONRequest |
92 | 108 | ||
93 | /// <summary> | 109 | /// <summary> |
@@ -129,12 +145,13 @@ namespace OpenSim.Framework | |||
129 | 145 | ||
130 | private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed) | 146 | private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed) |
131 | { | 147 | { |
132 | int reqnum = m_requestNumber++; | 148 | int reqnum = RequestNumber++; |
133 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); | 149 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); |
134 | 150 | ||
135 | string errorMessage = "unknown error"; | 151 | string errorMessage = "unknown error"; |
136 | int tickstart = Util.EnvironmentTickCount(); | 152 | int tickstart = Util.EnvironmentTickCount(); |
137 | int tickdata = 0; | 153 | int tickdata = 0; |
154 | string strBuffer = null; | ||
138 | 155 | ||
139 | try | 156 | try |
140 | { | 157 | { |
@@ -149,7 +166,7 @@ namespace OpenSim.Framework | |||
149 | // If there is some input, write it into the request | 166 | // If there is some input, write it into the request |
150 | if (data != null) | 167 | if (data != null) |
151 | { | 168 | { |
152 | string strBuffer = OSDParser.SerializeJsonString(data); | 169 | strBuffer = OSDParser.SerializeJsonString(data); |
153 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); | 170 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); |
154 | 171 | ||
155 | if (compressed) | 172 | if (compressed) |
@@ -210,14 +227,23 @@ namespace OpenSim.Framework | |||
210 | } | 227 | } |
211 | finally | 228 | finally |
212 | { | 229 | { |
213 | // This just dumps a warning for any operation that takes more than 100 ms | ||
214 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | 230 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); |
215 | if (tickdiff > LongCallTime) | 231 | if (tickdiff > LongCallTime) |
216 | m_log.DebugFormat("[WEB UTIL]: osd request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing", | 232 | m_log.InfoFormat( |
217 | reqnum,url,method,tickdiff,tickdata); | 233 | "[OSD REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", |
234 | reqnum, | ||
235 | method, | ||
236 | url, | ||
237 | tickdiff, | ||
238 | tickdata, | ||
239 | strBuffer != null | ||
240 | ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer) | ||
241 | : ""); | ||
218 | } | 242 | } |
219 | 243 | ||
220 | m_log.DebugFormat("[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage); | 244 | m_log.DebugFormat( |
245 | "[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage); | ||
246 | |||
221 | return ErrorResponseMap(errorMessage); | 247 | return ErrorResponseMap(errorMessage); |
222 | } | 248 | } |
223 | 249 | ||
@@ -290,17 +316,17 @@ namespace OpenSim.Framework | |||
290 | 316 | ||
291 | private static OSDMap ServiceFormRequestWorker(string url, NameValueCollection data, int timeout) | 317 | private static OSDMap ServiceFormRequestWorker(string url, NameValueCollection data, int timeout) |
292 | { | 318 | { |
293 | int reqnum = m_requestNumber++; | 319 | int reqnum = RequestNumber++; |
294 | string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; | 320 | string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; |
295 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method); | 321 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method); |
296 | 322 | ||
297 | string errorMessage = "unknown error"; | 323 | string errorMessage = "unknown error"; |
298 | int tickstart = Util.EnvironmentTickCount(); | 324 | int tickstart = Util.EnvironmentTickCount(); |
299 | int tickdata = 0; | 325 | int tickdata = 0; |
326 | string queryString = null; | ||
300 | 327 | ||
301 | try | 328 | try |
302 | { | 329 | { |
303 | |||
304 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); | 330 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); |
305 | request.Method = "POST"; | 331 | request.Method = "POST"; |
306 | request.Timeout = timeout; | 332 | request.Timeout = timeout; |
@@ -311,7 +337,7 @@ namespace OpenSim.Framework | |||
311 | 337 | ||
312 | if (data != null) | 338 | if (data != null) |
313 | { | 339 | { |
314 | string queryString = BuildQueryString(data); | 340 | queryString = BuildQueryString(data); |
315 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString); | 341 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString); |
316 | 342 | ||
317 | request.ContentLength = buffer.Length; | 343 | request.ContentLength = buffer.Length; |
@@ -354,11 +380,20 @@ namespace OpenSim.Framework | |||
354 | { | 380 | { |
355 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | 381 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); |
356 | if (tickdiff > LongCallTime) | 382 | if (tickdiff > LongCallTime) |
357 | m_log.InfoFormat("[WEB UTIL]: form request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing", | 383 | m_log.InfoFormat( |
358 | reqnum,url,method,tickdiff,tickdata); | 384 | "[SERVICE FORM]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", |
385 | reqnum, | ||
386 | method, | ||
387 | url, | ||
388 | tickdiff, | ||
389 | tickdata, | ||
390 | queryString != null | ||
391 | ? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString | ||
392 | : ""); | ||
359 | } | 393 | } |
360 | 394 | ||
361 | m_log.WarnFormat("[WEB UTIL]: <{0}> form request failed: {1}",reqnum,errorMessage); | 395 | m_log.WarnFormat("[SERVICE FORM]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage); |
396 | |||
362 | return ErrorResponseMap(errorMessage); | 397 | return ErrorResponseMap(errorMessage); |
363 | } | 398 | } |
364 | 399 | ||
@@ -638,8 +673,6 @@ namespace OpenSim.Framework | |||
638 | 673 | ||
639 | return new string[0]; | 674 | return new string[0]; |
640 | } | 675 | } |
641 | |||
642 | |||
643 | } | 676 | } |
644 | 677 | ||
645 | public static class AsynchronousRestObjectRequester | 678 | public static class AsynchronousRestObjectRequester |
@@ -662,6 +695,12 @@ namespace OpenSim.Framework | |||
662 | public static void MakeRequest<TRequest, TResponse>(string verb, | 695 | public static void MakeRequest<TRequest, TResponse>(string verb, |
663 | string requestUrl, TRequest obj, Action<TResponse> action) | 696 | string requestUrl, TRequest obj, Action<TResponse> action) |
664 | { | 697 | { |
698 | int reqnum = WebUtil.RequestNumber++; | ||
699 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); | ||
700 | |||
701 | int tickstart = Util.EnvironmentTickCount(); | ||
702 | int tickdata = 0; | ||
703 | |||
665 | // m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl); | 704 | // m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl); |
666 | 705 | ||
667 | Type type = typeof(TRequest); | 706 | Type type = typeof(TRequest); |
@@ -672,12 +711,13 @@ namespace OpenSim.Framework | |||
672 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | 711 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); |
673 | 712 | ||
674 | request.Method = verb; | 713 | request.Method = verb; |
714 | MemoryStream buffer = null; | ||
675 | 715 | ||
676 | if (verb == "POST") | 716 | if (verb == "POST") |
677 | { | 717 | { |
678 | request.ContentType = "text/xml"; | 718 | request.ContentType = "text/xml"; |
679 | 719 | ||
680 | MemoryStream buffer = new MemoryStream(); | 720 | buffer = new MemoryStream(); |
681 | 721 | ||
682 | XmlWriterSettings settings = new XmlWriterSettings(); | 722 | XmlWriterSettings settings = new XmlWriterSettings(); |
683 | settings.Encoding = Encoding.UTF8; | 723 | settings.Encoding = Encoding.UTF8; |
@@ -699,6 +739,9 @@ namespace OpenSim.Framework | |||
699 | requestStream.Write(buffer.ToArray(), 0, length); | 739 | requestStream.Write(buffer.ToArray(), 0, length); |
700 | requestStream.Close(); | 740 | requestStream.Close(); |
701 | 741 | ||
742 | // capture how much time was spent writing | ||
743 | tickdata = Util.EnvironmentTickCountSubtract(tickstart); | ||
744 | |||
702 | request.BeginGetResponse(delegate(IAsyncResult ar) | 745 | request.BeginGetResponse(delegate(IAsyncResult ar) |
703 | { | 746 | { |
704 | response = request.EndGetResponse(ar); | 747 | response = request.EndGetResponse(ar); |
@@ -724,83 +767,108 @@ namespace OpenSim.Framework | |||
724 | 767 | ||
725 | }, null); | 768 | }, null); |
726 | }, null); | 769 | }, null); |
727 | |||
728 | |||
729 | return; | ||
730 | } | 770 | } |
731 | 771 | else | |
732 | request.BeginGetResponse(delegate(IAsyncResult res2) | ||
733 | { | 772 | { |
734 | try | 773 | request.BeginGetResponse(delegate(IAsyncResult res2) |
735 | { | 774 | { |
736 | // If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't | ||
737 | // documented in MSDN | ||
738 | response = request.EndGetResponse(res2); | ||
739 | |||
740 | Stream respStream = null; | ||
741 | try | 775 | try |
742 | { | 776 | { |
743 | respStream = response.GetResponseStream(); | 777 | // If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't |
744 | deserial = (TResponse)deserializer.Deserialize(respStream); | 778 | // documented in MSDN |
745 | } | 779 | response = request.EndGetResponse(res2); |
746 | catch (System.InvalidOperationException) | 780 | |
747 | { | 781 | Stream respStream = null; |
748 | } | 782 | try |
749 | finally | 783 | { |
750 | { | 784 | respStream = response.GetResponseStream(); |
751 | respStream.Close(); | 785 | deserial = (TResponse)deserializer.Deserialize(respStream); |
752 | response.Close(); | 786 | } |
787 | catch (System.InvalidOperationException) | ||
788 | { | ||
789 | } | ||
790 | finally | ||
791 | { | ||
792 | respStream.Close(); | ||
793 | response.Close(); | ||
794 | } | ||
753 | } | 795 | } |
754 | } | 796 | catch (WebException e) |
755 | catch (WebException e) | ||
756 | { | ||
757 | if (e.Status == WebExceptionStatus.ProtocolError) | ||
758 | { | 797 | { |
759 | if (e.Response is HttpWebResponse) | 798 | if (e.Status == WebExceptionStatus.ProtocolError) |
760 | { | 799 | { |
761 | HttpWebResponse httpResponse = (HttpWebResponse)e.Response; | 800 | if (e.Response is HttpWebResponse) |
762 | |||
763 | if (httpResponse.StatusCode != HttpStatusCode.NotFound) | ||
764 | { | 801 | { |
765 | // We don't appear to be handling any other status codes, so log these feailures to that | 802 | HttpWebResponse httpResponse = (HttpWebResponse)e.Response; |
766 | // people don't spend unnecessary hours hunting phantom bugs. | 803 | |
767 | m_log.DebugFormat( | 804 | if (httpResponse.StatusCode != HttpStatusCode.NotFound) |
768 | "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}", | 805 | { |
769 | verb, requestUrl, httpResponse.StatusCode); | 806 | // We don't appear to be handling any other status codes, so log these feailures to that |
807 | // people don't spend unnecessary hours hunting phantom bugs. | ||
808 | m_log.DebugFormat( | ||
809 | "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}", | ||
810 | verb, requestUrl, httpResponse.StatusCode); | ||
811 | } | ||
770 | } | 812 | } |
771 | } | 813 | } |
814 | else | ||
815 | { | ||
816 | m_log.ErrorFormat( | ||
817 | "[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}", | ||
818 | verb, requestUrl, e.Status, e.Message); | ||
819 | } | ||
772 | } | 820 | } |
773 | else | 821 | catch (Exception e) |
774 | { | 822 | { |
775 | m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}", verb, requestUrl, e.Status, e.Message); | 823 | m_log.ErrorFormat( |
824 | "[ASYNC REQUEST]: Request {0} {1} failed with exception {2}{3}", | ||
825 | verb, requestUrl, e.Message, e.StackTrace); | ||
776 | } | 826 | } |
777 | } | 827 | |
778 | catch (Exception e) | 828 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); |
779 | { | ||
780 | m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with exception {2}", verb, requestUrl, e); | ||
781 | } | ||
782 | 829 | ||
783 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); | 830 | try |
831 | { | ||
832 | action(deserial); | ||
833 | } | ||
834 | catch (Exception e) | ||
835 | { | ||
836 | m_log.ErrorFormat( | ||
837 | "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}{3}", | ||
838 | verb, requestUrl, e.Message, e.StackTrace); | ||
839 | } | ||
840 | |||
841 | }, null); | ||
842 | } | ||
784 | 843 | ||
785 | try | 844 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); |
786 | { | 845 | if (tickdiff > WebUtil.LongCallTime) |
787 | action(deserial); | 846 | { |
788 | } | 847 | string originalRequest = null; |
789 | catch (Exception e) | 848 | |
849 | if (buffer != null) | ||
790 | { | 850 | { |
791 | m_log.ErrorFormat( | 851 | originalRequest = Encoding.UTF8.GetString(buffer.ToArray()); |
792 | "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e); | 852 | |
853 | if (originalRequest.Length > WebUtil.MaxRequestDiagLength) | ||
854 | originalRequest = originalRequest.Remove(WebUtil.MaxRequestDiagLength); | ||
793 | } | 855 | } |
794 | 856 | ||
795 | }, null); | 857 | m_log.InfoFormat( |
858 | "[ASYNC REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", | ||
859 | reqnum, | ||
860 | verb, | ||
861 | requestUrl, | ||
862 | tickdiff, | ||
863 | tickdata, | ||
864 | originalRequest); | ||
865 | } | ||
796 | } | 866 | } |
797 | } | 867 | } |
798 | 868 | ||
799 | public static class SynchronousRestFormsRequester | 869 | public static class SynchronousRestFormsRequester |
800 | { | 870 | { |
801 | private static readonly ILog m_log = | 871 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
802 | LogManager.GetLogger( | ||
803 | MethodBase.GetCurrentMethod().DeclaringType); | ||
804 | 872 | ||
805 | /// <summary> | 873 | /// <summary> |
806 | /// Perform a synchronous REST request. | 874 | /// Perform a synchronous REST request. |
@@ -814,6 +882,12 @@ namespace OpenSim.Framework | |||
814 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> | 882 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> |
815 | public static string MakeRequest(string verb, string requestUrl, string obj) | 883 | public static string MakeRequest(string verb, string requestUrl, string obj) |
816 | { | 884 | { |
885 | int reqnum = WebUtil.RequestNumber++; | ||
886 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); | ||
887 | |||
888 | int tickstart = Util.EnvironmentTickCount(); | ||
889 | int tickdata = 0; | ||
890 | |||
817 | WebRequest request = WebRequest.Create(requestUrl); | 891 | WebRequest request = WebRequest.Create(requestUrl); |
818 | request.Method = verb; | 892 | request.Method = verb; |
819 | string respstring = String.Empty; | 893 | string respstring = String.Empty; |
@@ -842,12 +916,16 @@ namespace OpenSim.Framework | |||
842 | } | 916 | } |
843 | catch (Exception e) | 917 | catch (Exception e) |
844 | { | 918 | { |
845 | m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); | 919 | m_log.DebugFormat( |
920 | "[FORMS]: exception occured {0} {1}: {2}{3}", verb, requestUrl, e.Message, e.StackTrace); | ||
846 | } | 921 | } |
847 | finally | 922 | finally |
848 | { | 923 | { |
849 | if (requestStream != null) | 924 | if (requestStream != null) |
850 | requestStream.Close(); | 925 | requestStream.Close(); |
926 | |||
927 | // capture how much time was spent writing | ||
928 | tickdata = Util.EnvironmentTickCountSubtract(tickstart); | ||
851 | } | 929 | } |
852 | } | 930 | } |
853 | 931 | ||
@@ -868,7 +946,9 @@ namespace OpenSim.Framework | |||
868 | } | 946 | } |
869 | catch (Exception e) | 947 | catch (Exception e) |
870 | { | 948 | { |
871 | m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); | 949 | m_log.DebugFormat( |
950 | "[FORMS]: Exception occured on receiving {0} {1}: {2}{3}", | ||
951 | verb, requestUrl, e.Message, e.StackTrace); | ||
872 | } | 952 | } |
873 | finally | 953 | finally |
874 | { | 954 | { |
@@ -881,9 +961,21 @@ namespace OpenSim.Framework | |||
881 | catch (System.InvalidOperationException) | 961 | catch (System.InvalidOperationException) |
882 | { | 962 | { |
883 | // This is what happens when there is invalid XML | 963 | // This is what happens when there is invalid XML |
884 | m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); | 964 | m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving {0} {1}", verb, requestUrl); |
885 | } | 965 | } |
886 | } | 966 | } |
967 | |||
968 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | ||
969 | if (tickdiff > WebUtil.LongCallTime) | ||
970 | m_log.InfoFormat( | ||
971 | "[FORMS]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", | ||
972 | reqnum, | ||
973 | verb, | ||
974 | requestUrl, | ||
975 | tickdiff, | ||
976 | tickdata, | ||
977 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); | ||
978 | |||
887 | return respstring; | 979 | return respstring; |
888 | } | 980 | } |
889 | } | 981 | } |
@@ -911,6 +1003,12 @@ namespace OpenSim.Framework | |||
911 | 1003 | ||
912 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout) | 1004 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout) |
913 | { | 1005 | { |
1006 | int reqnum = WebUtil.RequestNumber++; | ||
1007 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); | ||
1008 | |||
1009 | int tickstart = Util.EnvironmentTickCount(); | ||
1010 | int tickdata = 0; | ||
1011 | |||
914 | Type type = typeof(TRequest); | 1012 | Type type = typeof(TRequest); |
915 | TResponse deserial = default(TResponse); | 1013 | TResponse deserial = default(TResponse); |
916 | 1014 | ||
@@ -918,12 +1016,13 @@ namespace OpenSim.Framework | |||
918 | request.Method = verb; | 1016 | request.Method = verb; |
919 | if (pTimeout != 0) | 1017 | if (pTimeout != 0) |
920 | request.Timeout = pTimeout * 1000; | 1018 | request.Timeout = pTimeout * 1000; |
1019 | MemoryStream buffer = null; | ||
921 | 1020 | ||
922 | if ((verb == "POST") || (verb == "PUT")) | 1021 | if ((verb == "POST") || (verb == "PUT")) |
923 | { | 1022 | { |
924 | request.ContentType = "text/xml"; | 1023 | request.ContentType = "text/xml"; |
925 | 1024 | ||
926 | MemoryStream buffer = new MemoryStream(); | 1025 | buffer = new MemoryStream(); |
927 | 1026 | ||
928 | XmlWriterSettings settings = new XmlWriterSettings(); | 1027 | XmlWriterSettings settings = new XmlWriterSettings(); |
929 | settings.Encoding = Encoding.UTF8; | 1028 | settings.Encoding = Encoding.UTF8; |
@@ -946,13 +1045,19 @@ namespace OpenSim.Framework | |||
946 | } | 1045 | } |
947 | catch (Exception e) | 1046 | catch (Exception e) |
948 | { | 1047 | { |
949 | m_log.DebugFormat("[SynchronousRestObjectRequester]: exception in sending data to {0}: {1}", requestUrl, e); | 1048 | m_log.DebugFormat( |
1049 | "[SynchronousRestObjectRequester]: Exception in making request {0} {1}: {2}{3}", | ||
1050 | verb, requestUrl, e.Message, e.StackTrace); | ||
1051 | |||
950 | return deserial; | 1052 | return deserial; |
951 | } | 1053 | } |
952 | finally | 1054 | finally |
953 | { | 1055 | { |
954 | if (requestStream != null) | 1056 | if (requestStream != null) |
955 | requestStream.Close(); | 1057 | requestStream.Close(); |
1058 | |||
1059 | // capture how much time was spent writing | ||
1060 | tickdata = Util.EnvironmentTickCountSubtract(tickstart); | ||
956 | } | 1061 | } |
957 | } | 1062 | } |
958 | 1063 | ||
@@ -968,7 +1073,11 @@ namespace OpenSim.Framework | |||
968 | respStream.Close(); | 1073 | respStream.Close(); |
969 | } | 1074 | } |
970 | else | 1075 | else |
971 | m_log.DebugFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb); | 1076 | { |
1077 | m_log.DebugFormat( | ||
1078 | "[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", | ||
1079 | verb, requestUrl); | ||
1080 | } | ||
972 | } | 1081 | } |
973 | } | 1082 | } |
974 | catch (WebException e) | 1083 | catch (WebException e) |
@@ -979,17 +1088,44 @@ namespace OpenSim.Framework | |||
979 | return deserial; | 1088 | return deserial; |
980 | else | 1089 | else |
981 | m_log.ErrorFormat( | 1090 | m_log.ErrorFormat( |
982 | "[SynchronousRestObjectRequester]: WebException {0} {1} {2} {3}", | 1091 | "[SynchronousRestObjectRequester]: WebException for {0} {1} {2}: {3} {4}", |
983 | requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace); | 1092 | verb, requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace); |
984 | } | 1093 | } |
985 | catch (System.InvalidOperationException) | 1094 | catch (System.InvalidOperationException) |
986 | { | 1095 | { |
987 | // This is what happens when there is invalid XML | 1096 | // This is what happens when there is invalid XML |
988 | m_log.DebugFormat("[SynchronousRestObjectRequester]: Invalid XML {0} {1}", requestUrl, typeof(TResponse).ToString()); | 1097 | m_log.DebugFormat( |
1098 | "[SynchronousRestObjectRequester]: Invalid XML from {0} {1} {2}", | ||
1099 | verb, requestUrl, typeof(TResponse).ToString()); | ||
989 | } | 1100 | } |
990 | catch (Exception e) | 1101 | catch (Exception e) |
991 | { | 1102 | { |
992 | m_log.DebugFormat("[SynchronousRestObjectRequester]: Exception on response from {0} {1}", requestUrl, e); | 1103 | m_log.DebugFormat( |
1104 | "[SynchronousRestObjectRequester]: Exception on response from {0} {1}: {2}{3}", | ||
1105 | verb, requestUrl, e.Message, e.StackTrace); | ||
1106 | } | ||
1107 | |||
1108 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | ||
1109 | if (tickdiff > WebUtil.LongCallTime) | ||
1110 | { | ||
1111 | string originalRequest = null; | ||
1112 | |||
1113 | if (buffer != null) | ||
1114 | { | ||
1115 | originalRequest = Encoding.UTF8.GetString(buffer.ToArray()); | ||
1116 | |||
1117 | if (originalRequest.Length > WebUtil.MaxRequestDiagLength) | ||
1118 | originalRequest = originalRequest.Remove(WebUtil.MaxRequestDiagLength); | ||
1119 | } | ||
1120 | |||
1121 | m_log.InfoFormat( | ||
1122 | "[SynchronousRestObjectRequester]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", | ||
1123 | reqnum, | ||
1124 | verb, | ||
1125 | requestUrl, | ||
1126 | tickdiff, | ||
1127 | tickdata, | ||
1128 | originalRequest); | ||
993 | } | 1129 | } |
994 | 1130 | ||
995 | return deserial; | 1131 | return deserial; |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index fb1e831..daae3e6 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -225,7 +225,7 @@ namespace OpenSim | |||
225 | /// </summary> | 225 | /// </summary> |
226 | private void RegisterConsoleCommands() | 226 | private void RegisterConsoleCommands() |
227 | { | 227 | { |
228 | m_console.Commands.AddCommand("Regions", false, "force update", | 228 | m_console.Commands.AddCommand("Objects", false, "force update", |
229 | "force update", | 229 | "force update", |
230 | "Force the update of all objects on clients", | 230 | "Force the update of all objects on clients", |
231 | HandleForceUpdate); | 231 | HandleForceUpdate); |
@@ -306,7 +306,7 @@ namespace OpenSim | |||
306 | + " If this is not given then the oar is saved to region.oar in the current directory.", | 306 | + " If this is not given then the oar is saved to region.oar in the current directory.", |
307 | SaveOar); | 307 | SaveOar); |
308 | 308 | ||
309 | m_console.Commands.AddCommand("Regions", false, "edit scale", | 309 | m_console.Commands.AddCommand("Objects", false, "edit scale", |
310 | "edit scale <name> <x> <y> <z>", | 310 | "edit scale <name> <x> <y> <z>", |
311 | "Change the scale of a named prim", HandleEditScale); | 311 | "Change the scale of a named prim", HandleEditScale); |
312 | 312 | ||
@@ -349,7 +349,7 @@ namespace OpenSim | |||
349 | "show ratings", | 349 | "show ratings", |
350 | "Show rating data", HandleShow); | 350 | "Show rating data", HandleShow); |
351 | 351 | ||
352 | m_console.Commands.AddCommand("Regions", false, "backup", | 352 | m_console.Commands.AddCommand("Objects", false, "backup", |
353 | "backup", | 353 | "backup", |
354 | "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", RunCommand); | 354 | "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", RunCommand); |
355 | 355 | ||
@@ -410,7 +410,7 @@ namespace OpenSim | |||
410 | "modules unload <name>", | 410 | "modules unload <name>", |
411 | "Unload a module", HandleModules); | 411 | "Unload a module", HandleModules); |
412 | 412 | ||
413 | m_console.Commands.AddCommand("Regions", false, "kill uuid", | 413 | m_console.Commands.AddCommand("Objects", false, "kill uuid", |
414 | "kill uuid <UUID>", | 414 | "kill uuid <UUID>", |
415 | "Kill an object by UUID", KillUUID); | 415 | "Kill an object by UUID", KillUUID); |
416 | } | 416 | } |
@@ -618,10 +618,11 @@ namespace OpenSim | |||
618 | return; | 618 | return; |
619 | } | 619 | } |
620 | 620 | ||
621 | PopulateRegionEstateInfo(regInfo); | 621 | bool changed = PopulateRegionEstateInfo(regInfo); |
622 | IScene scene; | 622 | IScene scene; |
623 | CreateRegion(regInfo, true, out scene); | 623 | CreateRegion(regInfo, true, out scene); |
624 | regInfo.EstateSettings.Save(); | 624 | if (changed) |
625 | regInfo.EstateSettings.Save(); | ||
625 | } | 626 | } |
626 | 627 | ||
627 | /// <summary> | 628 | /// <summary> |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index ddc7f10..0adb693 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -437,7 +437,7 @@ namespace OpenSim | |||
437 | scene.LoadPrimsFromStorage(regionInfo.originRegionID); | 437 | scene.LoadPrimsFromStorage(regionInfo.originRegionID); |
438 | 438 | ||
439 | // TODO : Try setting resource for region xstats here on scene | 439 | // TODO : Try setting resource for region xstats here on scene |
440 | MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo)); | 440 | MainServer.Instance.AddStreamHandler(new RegionStatsHandler(regionInfo)); |
441 | 441 | ||
442 | scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID); | 442 | scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID); |
443 | scene.EventManager.TriggerParcelPrimCountUpdate(); | 443 | scene.EventManager.TriggerParcelPrimCountUpdate(); |
@@ -856,6 +856,9 @@ namespace OpenSim | |||
856 | return Util.UTF8.GetBytes("OK"); | 856 | return Util.UTF8.GetBytes("OK"); |
857 | } | 857 | } |
858 | 858 | ||
859 | public string Name { get { return "SimStatus"; } } | ||
860 | public string Description { get { return "Simulator Status"; } } | ||
861 | |||
859 | public string ContentType | 862 | public string ContentType |
860 | { | 863 | { |
861 | get { return "text/plain"; } | 864 | get { return "text/plain"; } |
@@ -880,6 +883,9 @@ namespace OpenSim | |||
880 | { | 883 | { |
881 | OpenSimBase m_opensim; | 884 | OpenSimBase m_opensim; |
882 | string osXStatsURI = String.Empty; | 885 | string osXStatsURI = String.Empty; |
886 | |||
887 | public string Name { get { return "XSimStatus"; } } | ||
888 | public string Description { get { return "Simulator XStatus"; } } | ||
883 | 889 | ||
884 | public XSimStatusHandler(OpenSimBase sim) | 890 | public XSimStatusHandler(OpenSimBase sim) |
885 | { | 891 | { |
@@ -920,6 +926,9 @@ namespace OpenSim | |||
920 | { | 926 | { |
921 | OpenSimBase m_opensim; | 927 | OpenSimBase m_opensim; |
922 | string osUXStatsURI = String.Empty; | 928 | string osUXStatsURI = String.Empty; |
929 | |||
930 | public string Name { get { return "UXSimStatus"; } } | ||
931 | public string Description { get { return "Simulator UXStatus"; } } | ||
923 | 932 | ||
924 | public UXSimStatusHandler(OpenSimBase sim) | 933 | public UXSimStatusHandler(OpenSimBase sim) |
925 | { | 934 | { |
@@ -1051,13 +1060,13 @@ namespace OpenSim | |||
1051 | /// Load the estate information for the provided RegionInfo object. | 1060 | /// Load the estate information for the provided RegionInfo object. |
1052 | /// </summary> | 1061 | /// </summary> |
1053 | /// <param name="regInfo"></param> | 1062 | /// <param name="regInfo"></param> |
1054 | public void PopulateRegionEstateInfo(RegionInfo regInfo) | 1063 | public bool PopulateRegionEstateInfo(RegionInfo regInfo) |
1055 | { | 1064 | { |
1056 | if (EstateDataService != null) | 1065 | if (EstateDataService != null) |
1057 | regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, false); | 1066 | regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, false); |
1058 | 1067 | ||
1059 | if (regInfo.EstateSettings.EstateID != 0) | 1068 | if (regInfo.EstateSettings.EstateID != 0) |
1060 | return; | 1069 | return false; // estate info in the database did not change |
1061 | 1070 | ||
1062 | m_log.WarnFormat("[ESTATE] Region {0} is not part of an estate.", regInfo.RegionName); | 1071 | m_log.WarnFormat("[ESTATE] Region {0} is not part of an estate.", regInfo.RegionName); |
1063 | 1072 | ||
@@ -1092,7 +1101,7 @@ namespace OpenSim | |||
1092 | } | 1101 | } |
1093 | 1102 | ||
1094 | if (defaultEstateJoined) | 1103 | if (defaultEstateJoined) |
1095 | return; | 1104 | return true; // need to update the database |
1096 | else | 1105 | else |
1097 | m_log.ErrorFormat( | 1106 | m_log.ErrorFormat( |
1098 | "[OPENSIM BASE]: Joining default estate {0} failed", defaultEstateName); | 1107 | "[OPENSIM BASE]: Joining default estate {0} failed", defaultEstateName); |
@@ -1154,8 +1163,10 @@ namespace OpenSim | |||
1154 | MainConsole.Instance.Output("Joining the estate failed. Please try again."); | 1163 | MainConsole.Instance.Output("Joining the estate failed. Please try again."); |
1155 | } | 1164 | } |
1156 | } | 1165 | } |
1157 | } | 1166 | } |
1158 | } | 1167 | |
1168 | return true; // need to update the database | ||
1169 | } | ||
1159 | } | 1170 | } |
1160 | 1171 | ||
1161 | public class OpenSimConfigSource | 1172 | public class OpenSimConfigSource |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index ef6dedb..d397893 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -158,7 +158,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
158 | try | 158 | try |
159 | { | 159 | { |
160 | // the root of all evil | 160 | // the root of all evil |
161 | m_HostCapsObj.RegisterHandler("SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest)); | 161 | m_HostCapsObj.RegisterHandler( |
162 | "SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest, "SEED", null)); | ||
163 | |||
162 | m_log.DebugFormat( | 164 | m_log.DebugFormat( |
163 | "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID); | 165 | "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID); |
164 | 166 | ||
@@ -166,7 +168,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
166 | // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST", | 168 | // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST", |
167 | // capsBase + m_mapLayerPath, | 169 | // capsBase + m_mapLayerPath, |
168 | // GetMapLayer); | 170 | // GetMapLayer); |
169 | IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory); | 171 | IRequestHandler req |
172 | = new RestStreamHandler( | ||
173 | "POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory, "UpdateScript", null); | ||
174 | |||
170 | m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req); | 175 | m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req); |
171 | m_HostCapsObj.RegisterHandler("UpdateScriptTask", req); | 176 | m_HostCapsObj.RegisterHandler("UpdateScriptTask", req); |
172 | } | 177 | } |
@@ -181,14 +186,22 @@ namespace OpenSim.Region.ClientStack.Linden | |||
181 | try | 186 | try |
182 | { | 187 | { |
183 | // I don't think this one works... | 188 | // I don't think this one works... |
184 | m_HostCapsObj.RegisterHandler("NewFileAgentInventory", new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", | 189 | m_HostCapsObj.RegisterHandler( |
185 | capsBase + m_newInventory, | 190 | "NewFileAgentInventory", |
186 | NewAgentInventoryRequest)); | 191 | new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>( |
187 | IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory); | 192 | "POST", |
193 | capsBase + m_newInventory, | ||
194 | NewAgentInventoryRequest, | ||
195 | "NewFileAgentInventory", | ||
196 | null)); | ||
197 | |||
198 | IRequestHandler req | ||
199 | = new RestStreamHandler( | ||
200 | "POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory, "Update*", null); | ||
201 | |||
188 | m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); | 202 | m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); |
189 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); | 203 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); |
190 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); | 204 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); |
191 | m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard)); | ||
192 | IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData); | 205 | IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData); |
193 | m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); | 206 | m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); |
194 | IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); | 207 | IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); |
@@ -197,6 +210,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
197 | m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); | 210 | m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); |
198 | 211 | ||
199 | 212 | ||
213 | |||
214 | m_HostCapsObj.RegisterHandler( | ||
215 | "CopyInventoryFromNotecard", | ||
216 | new RestStreamHandler( | ||
217 | "POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard, "CopyInventoryFromNotecard", null)); | ||
218 | |||
200 | // As of RC 1.22.9 of the Linden client this is | 219 | // As of RC 1.22.9 of the Linden client this is |
201 | // supported | 220 | // supported |
202 | 221 | ||
@@ -245,7 +264,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
245 | 264 | ||
246 | if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) | 265 | if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) |
247 | { | 266 | { |
248 | m_log.DebugFormat("[CAPS]: Unauthorized CAPS client"); | 267 | m_log.DebugFormat( |
268 | "[CAPS]: Unauthorized CAPS client {0} from {1}", | ||
269 | m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint); | ||
270 | |||
249 | return string.Empty; | 271 | return string.Empty; |
250 | } | 272 | } |
251 | 273 | ||
@@ -296,7 +318,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
296 | m_dumpAssetsToFile); | 318 | m_dumpAssetsToFile); |
297 | uploader.OnUpLoad += TaskScriptUpdated; | 319 | uploader.OnUpLoad += TaskScriptUpdated; |
298 | 320 | ||
299 | m_HostCapsObj.HttpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 321 | m_HostCapsObj.HttpListener.AddStreamHandler( |
322 | new BinaryStreamHandler( | ||
323 | "POST", capsBase + uploaderPath, uploader.uploaderCaps, "TaskInventoryScriptUpdater", null)); | ||
300 | 324 | ||
301 | string protocol = "http://"; | 325 | string protocol = "http://"; |
302 | 326 | ||
@@ -423,8 +447,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
423 | AssetUploader uploader = | 447 | AssetUploader uploader = |
424 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, | 448 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, |
425 | llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile); | 449 | llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile); |
450 | |||
426 | m_HostCapsObj.HttpListener.AddStreamHandler( | 451 | m_HostCapsObj.HttpListener.AddStreamHandler( |
427 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 452 | new BinaryStreamHandler( |
453 | "POST", | ||
454 | capsBase + uploaderPath, | ||
455 | uploader.uploaderCaps, | ||
456 | "NewAgentInventoryRequest", | ||
457 | m_HostCapsObj.AgentID.ToString())); | ||
428 | 458 | ||
429 | string protocol = "http://"; | 459 | string protocol = "http://"; |
430 | 460 | ||
@@ -740,7 +770,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
740 | uploader.OnUpLoad += ItemUpdated; | 770 | uploader.OnUpLoad += ItemUpdated; |
741 | 771 | ||
742 | m_HostCapsObj.HttpListener.AddStreamHandler( | 772 | m_HostCapsObj.HttpListener.AddStreamHandler( |
743 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 773 | new BinaryStreamHandler( |
774 | "POST", capsBase + uploaderPath, uploader.uploaderCaps, "NoteCardAgentInventory", null)); | ||
744 | 775 | ||
745 | string protocol = "http://"; | 776 | string protocol = "http://"; |
746 | 777 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index a91b02c..a38d231 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | |||
@@ -351,14 +351,18 @@ namespace OpenSim.Region.ClientStack.Linden | |||
351 | // EventQueueGet when it receive capability information, but then we replace the rest handler immediately | 351 | // EventQueueGet when it receive capability information, but then we replace the rest handler immediately |
352 | // afterwards with the poll service. So for now, we'll pass a null instead to simplify code reading, but | 352 | // afterwards with the poll service. So for now, we'll pass a null instead to simplify code reading, but |
353 | // really it should be possible to directly register the poll handler as a capability. | 353 | // really it should be possible to directly register the poll handler as a capability. |
354 | caps.RegisterHandler("EventQueueGet", | 354 | caps.RegisterHandler( |
355 | new RestHTTPHandler("POST", capsBase + EventQueueGetUUID.ToString() + "/", null)); | 355 | "EventQueueGet", |
356 | new RestHTTPHandler( | ||
357 | "POST", capsBase + EventQueueGetUUID.ToString() + "/", null)); | ||
358 | |||
356 | // delegate(Hashtable m_dhttpMethod) | 359 | // delegate(Hashtable m_dhttpMethod) |
357 | // { | 360 | // { |
358 | // return ProcessQueue(m_dhttpMethod, agentID, caps); | 361 | // return ProcessQueue(m_dhttpMethod, agentID, caps); |
359 | // })); | 362 | // })); |
360 | 363 | ||
361 | // This will persist this beyond the expiry of the caps handlers | 364 | // This will persist this beyond the expiry of the caps handlers |
365 | // TODO: Add EventQueueGet name/description for diagnostics | ||
362 | MainServer.Instance.AddPollServiceHTTPHandler( | 366 | MainServer.Instance.AddPollServiceHTTPHandler( |
363 | capsBase + EventQueueGetUUID.ToString() + "/", | 367 | capsBase + EventQueueGetUUID.ToString() + "/", |
364 | new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID)); | 368 | new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID)); |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs index a5209b7..c25b58c 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs | |||
@@ -60,7 +60,7 @@ namespace OpenSim.Region.ClientStack.Linden.Tests | |||
60 | CapabilitiesModule capsModule = new CapabilitiesModule(); | 60 | CapabilitiesModule capsModule = new CapabilitiesModule(); |
61 | EventQueueGetModule eqgModule = new EventQueueGetModule(); | 61 | EventQueueGetModule eqgModule = new EventQueueGetModule(); |
62 | 62 | ||
63 | m_scene = SceneHelpers.SetupScene(); | 63 | m_scene = new SceneHelpers().SetupScene(); |
64 | SceneHelpers.SetupSceneModules(m_scene, config, capsModule, eqgModule); | 64 | SceneHelpers.SetupSceneModules(m_scene, config, capsModule, eqgModule); |
65 | } | 65 | } |
66 | 66 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs index 14501c7..cb5afcc 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs | |||
@@ -132,7 +132,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
132 | capUrl = "/CAPS/" + UUID.Random(); | 132 | capUrl = "/CAPS/" + UUID.Random(); |
133 | 133 | ||
134 | IRequestHandler reqHandler | 134 | IRequestHandler reqHandler |
135 | = new RestStreamHandler("POST", capUrl, m_fetchHandler.FetchInventoryRequest); | 135 | = new RestStreamHandler( |
136 | "POST", capUrl, m_fetchHandler.FetchInventoryRequest, capName, agentID.ToString()); | ||
136 | 137 | ||
137 | caps.RegisterHandler(capName, reqHandler); | 138 | caps.RegisterHandler(capName, reqHandler); |
138 | } | 139 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index e7bd2e7..0d7b1fc 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | |||
@@ -120,11 +120,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
120 | { | 120 | { |
121 | // m_log.DebugFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | 121 | // m_log.DebugFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); |
122 | GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); | 122 | GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); |
123 | IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), | 123 | IRequestHandler reqHandler |
124 | delegate(Hashtable m_dhttpMethod) | 124 | = new RestHTTPHandler( |
125 | { | 125 | "GET", |
126 | return gmeshHandler.ProcessGetMesh(m_dhttpMethod, UUID.Zero, null); | 126 | "/CAPS/" + UUID.Random(), |
127 | }); | 127 | httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null), |
128 | "GetMesh", | ||
129 | agentID.ToString()); | ||
128 | 130 | ||
129 | caps.RegisterHandler("GetMesh", reqHandler); | 131 | caps.RegisterHandler("GetMesh", reqHandler); |
130 | } | 132 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index fffcee2..5ae9cc3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -130,7 +130,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
130 | if (m_URL == "localhost") | 130 | if (m_URL == "localhost") |
131 | { | 131 | { |
132 | // m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | 132 | // m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); |
133 | caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService)); | 133 | caps.RegisterHandler( |
134 | "GetTexture", | ||
135 | new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString())); | ||
134 | } | 136 | } |
135 | else | 137 | else |
136 | { | 138 | { |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs index 18c7eae..44a6883 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs | |||
@@ -117,7 +117,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
117 | 117 | ||
118 | public void RegisterCaps(UUID agentID, Caps caps) | 118 | public void RegisterCaps(UUID agentID, Caps caps) |
119 | { | 119 | { |
120 | IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), MeshUploadFlag); | 120 | IRequestHandler reqHandler |
121 | = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), MeshUploadFlag, "MeshUploadFlag", agentID.ToString()); | ||
122 | |||
121 | caps.RegisterHandler("MeshUploadFlag", reqHandler); | 123 | caps.RegisterHandler("MeshUploadFlag", reqHandler); |
122 | m_agentID = agentID; | 124 | m_agentID = agentID; |
123 | } | 125 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs index 91872c5..52c4f44 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs | |||
@@ -115,67 +115,66 @@ namespace OpenSim.Region.ClientStack.Linden | |||
115 | UUID capID = UUID.Random(); | 115 | UUID capID = UUID.Random(); |
116 | 116 | ||
117 | // m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID); | 117 | // m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID); |
118 | caps.RegisterHandler("NewFileAgentInventoryVariablePrice", | 118 | caps.RegisterHandler( |
119 | 119 | "NewFileAgentInventoryVariablePrice", | |
120 | new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDNewFileAngentInventoryVariablePriceReplyResponse>("POST", | 120 | new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDNewFileAngentInventoryVariablePriceReplyResponse>( |
121 | "/CAPS/" + capID.ToString(), | 121 | "POST", |
122 | delegate(LLSDAssetUploadRequest req) | 122 | "/CAPS/" + capID.ToString(), |
123 | { | 123 | req => NewAgentInventoryRequest(req, agentID), |
124 | return NewAgentInventoryRequest(req,agentID); | 124 | "NewFileAgentInventoryVariablePrice", |
125 | })); | 125 | agentID.ToString())); |
126 | |||
127 | } | 126 | } |
128 | 127 | ||
129 | #endregion | 128 | #endregion |
130 | 129 | ||
131 | public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) | 130 | public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) |
132 | { | 131 | { |
133 | |||
134 | //TODO: The Mesh uploader uploads many types of content. If you're going to implement a Money based limit | 132 | //TODO: The Mesh uploader uploads many types of content. If you're going to implement a Money based limit |
135 | // You need to be aware of this and | 133 | // you need to be aware of this |
136 | |||
137 | 134 | ||
138 | //if (llsdRequest.asset_type == "texture" || | 135 | //if (llsdRequest.asset_type == "texture" || |
139 | // llsdRequest.asset_type == "animation" || | 136 | // llsdRequest.asset_type == "animation" || |
140 | // llsdRequest.asset_type == "sound") | 137 | // llsdRequest.asset_type == "sound") |
141 | // { | 138 | // { |
142 | // check user level | 139 | // check user level |
143 | ScenePresence avatar = null; | ||
144 | IClientAPI client = null; | ||
145 | m_scene.TryGetScenePresence(agentID, out avatar); | ||
146 | 140 | ||
147 | if (avatar != null) | 141 | ScenePresence avatar = null; |
142 | IClientAPI client = null; | ||
143 | m_scene.TryGetScenePresence(agentID, out avatar); | ||
144 | |||
145 | if (avatar != null) | ||
146 | { | ||
147 | client = avatar.ControllingClient; | ||
148 | |||
149 | if (avatar.UserLevel < m_levelUpload) | ||
148 | { | 150 | { |
149 | client = avatar.ControllingClient; | 151 | if (client != null) |
150 | 152 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); | |
151 | if (avatar.UserLevel < m_levelUpload) | 153 | |
152 | { | 154 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); |
153 | if (client != null) | 155 | errorResponse.rsvp = ""; |
154 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); | 156 | errorResponse.state = "error"; |
155 | 157 | return errorResponse; | |
156 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); | ||
157 | errorResponse.rsvp = ""; | ||
158 | errorResponse.state = "error"; | ||
159 | return errorResponse; | ||
160 | } | ||
161 | } | 158 | } |
159 | } | ||
162 | 160 | ||
163 | // check funds | 161 | // check funds |
164 | IMoneyModule mm = m_scene.RequestModuleInterface<IMoneyModule>(); | 162 | IMoneyModule mm = m_scene.RequestModuleInterface<IMoneyModule>(); |
165 | 163 | ||
166 | if (mm != null) | 164 | if (mm != null) |
165 | { | ||
166 | if (!mm.UploadCovered(agentID, mm.UploadCharge)) | ||
167 | { | 167 | { |
168 | if (!mm.UploadCovered(agentID, mm.UploadCharge)) | 168 | if (client != null) |
169 | { | 169 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); |
170 | if (client != null) | 170 | |
171 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | 171 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); |
172 | 172 | errorResponse.rsvp = ""; | |
173 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); | 173 | errorResponse.state = "error"; |
174 | errorResponse.rsvp = ""; | 174 | return errorResponse; |
175 | errorResponse.state = "error"; | ||
176 | return errorResponse; | ||
177 | } | ||
178 | } | 175 | } |
176 | } | ||
177 | |||
179 | // } | 178 | // } |
180 | 179 | ||
181 | string assetName = llsdRequest.name; | 180 | string assetName = llsdRequest.name; |
@@ -189,8 +188,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
189 | AssetUploader uploader = | 188 | AssetUploader uploader = |
190 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, | 189 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, |
191 | llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile); | 190 | llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile); |
191 | |||
192 | MainServer.Instance.AddStreamHandler( | 192 | MainServer.Instance.AddStreamHandler( |
193 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 193 | new BinaryStreamHandler( |
194 | "POST", | ||
195 | capsBase + uploaderPath, | ||
196 | uploader.uploaderCaps, | ||
197 | "NewFileAgentInventoryVariablePrice", | ||
198 | agentID.ToString())); | ||
194 | 199 | ||
195 | string protocol = "http://"; | 200 | string protocol = "http://"; |
196 | 201 | ||
@@ -199,10 +204,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
199 | 204 | ||
200 | string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + | 205 | string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + |
201 | uploaderPath; | 206 | uploaderPath; |
202 | 207 | ||
203 | 208 | ||
204 | LLSDNewFileAngentInventoryVariablePriceReplyResponse uploadResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); | 209 | LLSDNewFileAngentInventoryVariablePriceReplyResponse uploadResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); |
205 | |||
206 | 210 | ||
207 | uploadResponse.rsvp = uploaderURL; | 211 | uploadResponse.rsvp = uploaderURL; |
208 | uploadResponse.state = "upload"; | 212 | uploadResponse.state = "upload"; |
@@ -220,6 +224,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
220 | pinventoryItem, pparentFolder, pdata, pinventoryType, | 224 | pinventoryItem, pparentFolder, pdata, pinventoryType, |
221 | passetType,agentID); | 225 | passetType,agentID); |
222 | }; | 226 | }; |
227 | |||
223 | return uploadResponse; | 228 | return uploadResponse; |
224 | } | 229 | } |
225 | 230 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs index 1c47f0e..4ccfc43 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs | |||
@@ -66,12 +66,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
66 | 66 | ||
67 | // m_log.InfoFormat("[OBJECTADD]: {0}", "/CAPS/OA/" + capuuid + "/"); | 67 | // m_log.InfoFormat("[OBJECTADD]: {0}", "/CAPS/OA/" + capuuid + "/"); |
68 | 68 | ||
69 | caps.RegisterHandler("ObjectAdd", | 69 | caps.RegisterHandler( |
70 | new RestHTTPHandler("POST", "/CAPS/OA/" + capuuid + "/", | 70 | "ObjectAdd", |
71 | delegate(Hashtable m_dhttpMethod) | 71 | new RestHTTPHandler( |
72 | { | 72 | "POST", |
73 | return ProcessAdd(m_dhttpMethod, agentID, caps); | 73 | "/CAPS/OA/" + capuuid + "/", |
74 | })); | 74 | httpMethod => ProcessAdd(httpMethod, agentID, caps), |
75 | "ObjectAdd", | ||
76 | agentID.ToString()));; | ||
75 | } | 77 | } |
76 | 78 | ||
77 | public Hashtable ProcessAdd(Hashtable request, UUID AgentId, Caps cap) | 79 | public Hashtable ProcessAdd(Hashtable request, UUID AgentId, Caps cap) |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs index 7a3d97e..f0f3984 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs | |||
@@ -106,12 +106,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
106 | UUID capID = UUID.Random(); | 106 | UUID capID = UUID.Random(); |
107 | 107 | ||
108 | // m_log.Debug("[UPLOAD OBJECT ASSET MODULE]: /CAPS/" + capID); | 108 | // m_log.Debug("[UPLOAD OBJECT ASSET MODULE]: /CAPS/" + capID); |
109 | caps.RegisterHandler("UploadObjectAsset", | 109 | caps.RegisterHandler( |
110 | new RestHTTPHandler("POST", "/CAPS/OA/" + capID + "/", | 110 | "UploadObjectAsset", |
111 | delegate(Hashtable m_dhttpMethod) | 111 | new RestHTTPHandler( |
112 | { | 112 | "POST", |
113 | return ProcessAdd(m_dhttpMethod, agentID, caps); | 113 | "/CAPS/OA/" + capID + "/", |
114 | })); | 114 | httpMethod => ProcessAdd(httpMethod, agentID, caps), |
115 | "UploadObjectAsset", | ||
116 | agentID.ToString())); | ||
117 | |||
115 | /* | 118 | /* |
116 | caps.RegisterHandler("NewFileAgentInventoryVariablePrice", | 119 | caps.RegisterHandler("NewFileAgentInventoryVariablePrice", |
117 | 120 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 1dd8938..8ed0fb3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs | |||
@@ -154,7 +154,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
154 | public void RegisterCaps(UUID agentID, Caps caps) | 154 | public void RegisterCaps(UUID agentID, Caps caps) |
155 | { | 155 | { |
156 | IRequestHandler reqHandler | 156 | IRequestHandler reqHandler |
157 | = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), HandleSimulatorFeaturesRequest); | 157 | = new RestHTTPHandler( |
158 | "GET", "/CAPS/" + UUID.Random(), | ||
159 | HandleSimulatorFeaturesRequest, "SimulatorFeatures", agentID.ToString()); | ||
158 | 160 | ||
159 | caps.RegisterHandler("SimulatorFeatures", reqHandler); | 161 | caps.RegisterHandler("SimulatorFeatures", reqHandler); |
160 | } | 162 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index 45d6071..b3d61a8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs | |||
@@ -106,7 +106,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
106 | "POST", | 106 | "POST", |
107 | "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, | 107 | "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, |
108 | new UploadBakedTextureHandler( | 108 | new UploadBakedTextureHandler( |
109 | caps, m_scene.AssetService, m_persistBakedTextures).UploadBakedTexture)); | 109 | caps, m_scene.AssetService, m_persistBakedTextures).UploadBakedTexture, |
110 | "UploadBakedTexture", | ||
111 | agentID.ToString())); | ||
110 | } | 112 | } |
111 | } | 113 | } |
112 | } \ No newline at end of file | 114 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 10f43d1..2359bd6 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | |||
@@ -144,7 +144,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
144 | capUrl = "/CAPS/" + UUID.Random(); | 144 | capUrl = "/CAPS/" + UUID.Random(); |
145 | 145 | ||
146 | IRequestHandler reqHandler | 146 | IRequestHandler reqHandler |
147 | = new RestStreamHandler("POST", capUrl, m_webFetchHandler.FetchInventoryDescendentsRequest); | 147 | = new RestStreamHandler( |
148 | "POST", | ||
149 | capUrl, | ||
150 | m_webFetchHandler.FetchInventoryDescendentsRequest, | ||
151 | "FetchInventoryDescendents2", | ||
152 | agentID.ToString()); | ||
148 | 153 | ||
149 | caps.RegisterHandler(capName, reqHandler); | 154 | caps.RegisterHandler(capName, reqHandler); |
150 | } | 155 | } |
@@ -160,4 +165,4 @@ namespace OpenSim.Region.ClientStack.Linden | |||
160 | // capName, capUrl, m_scene.RegionInfo.RegionName, agentID); | 165 | // capName, capUrl, m_scene.RegionInfo.RegionName, agentID); |
161 | } | 166 | } |
162 | } | 167 | } |
163 | } | 168 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7db6014..9ae8dfb 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -12129,21 +12129,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12129 | protected void MakeAssetRequest(TransferRequestPacket transferRequest, UUID taskID) | 12129 | protected void MakeAssetRequest(TransferRequestPacket transferRequest, UUID taskID) |
12130 | { | 12130 | { |
12131 | UUID requestID = UUID.Zero; | 12131 | UUID requestID = UUID.Zero; |
12132 | if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) | 12132 | int sourceType = transferRequest.TransferInfo.SourceType; |
12133 | |||
12134 | if (sourceType == (int)SourceType.Asset) | ||
12133 | { | 12135 | { |
12134 | requestID = new UUID(transferRequest.TransferInfo.Params, 0); | 12136 | requestID = new UUID(transferRequest.TransferInfo.Params, 0); |
12135 | } | 12137 | } |
12136 | else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) | 12138 | else if (sourceType == (int)SourceType.SimInventoryItem) |
12137 | { | 12139 | { |
12138 | requestID = new UUID(transferRequest.TransferInfo.Params, 80); | 12140 | requestID = new UUID(transferRequest.TransferInfo.Params, 80); |
12139 | } | 12141 | } |
12140 | else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimEstate) | 12142 | else if (sourceType == (int)SourceType.SimEstate) |
12141 | { | 12143 | { |
12142 | requestID = taskID; | 12144 | requestID = taskID; |
12143 | } | 12145 | } |
12144 | 12146 | ||
12145 | 12147 | // m_log.DebugFormat( | |
12146 | // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); | 12148 | // "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", |
12149 | // requestID, taskID, (SourceType)sourceType, Name); | ||
12147 | 12150 | ||
12148 | 12151 | ||
12149 | //Note, the bool returned from the below function is useless since it is always false. | 12152 | //Note, the bool returned from the below function is useless since it is always false. |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 75f783b..dda4444 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -916,7 +916,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
916 | UDPPacketBuffer buffer = (UDPPacketBuffer)array[0]; | 916 | UDPPacketBuffer buffer = (UDPPacketBuffer)array[0]; |
917 | UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1]; | 917 | UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1]; |
918 | 918 | ||
919 | m_log.DebugFormat("[LLUDPSERVER]: Handling UseCircuitCode request from {0}", buffer.RemoteEndPoint); | 919 | m_log.DebugFormat( |
920 | "[LLUDPSERVER]: Handling UseCircuitCode request for circuit {0} from {1}", | ||
921 | uccp.CircuitCode.Code, buffer.RemoteEndPoint); | ||
920 | 922 | ||
921 | remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint; | 923 | remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint; |
922 | 924 | ||
@@ -1352,7 +1354,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1352 | } | 1354 | } |
1353 | else | 1355 | else |
1354 | { | 1356 | { |
1355 | m_log.DebugFormat("[LLUDPSERVER]: Dropping incoming {0} packet for dead client {1}", packet.Type, udpClient.AgentID); | 1357 | m_log.DebugFormat( |
1358 | "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", | ||
1359 | packet.Type, udpClient.AgentID, m_scene.RegionInfo.RegionName); | ||
1356 | } | 1360 | } |
1357 | } | 1361 | } |
1358 | 1362 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs index a575e36..1321470 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs | |||
@@ -158,7 +158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
158 | TestHelpers.InMethod(); | 158 | TestHelpers.InMethod(); |
159 | // XmlConfigurator.Configure(); | 159 | // XmlConfigurator.Configure(); |
160 | 160 | ||
161 | TestScene scene = SceneHelpers.SetupScene(); | 161 | TestScene scene = new SceneHelpers().SetupScene(); |
162 | uint myCircuitCode = 123456; | 162 | uint myCircuitCode = 123456; |
163 | UUID myAgentUuid = TestHelpers.ParseTail(0x1); | 163 | UUID myAgentUuid = TestHelpers.ParseTail(0x1); |
164 | UUID mySessionUuid = TestHelpers.ParseTail(0x2); | 164 | UUID mySessionUuid = TestHelpers.ParseTail(0x2); |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs index 1b68d68..5fcf376 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs | |||
@@ -79,7 +79,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
79 | 79 | ||
80 | J2KDecoderModule j2kdm = new J2KDecoderModule(); | 80 | J2KDecoderModule j2kdm = new J2KDecoderModule(); |
81 | 81 | ||
82 | scene = SceneHelpers.SetupScene(); | 82 | SceneHelpers sceneHelpers = new SceneHelpers(); |
83 | scene = sceneHelpers.SetupScene(); | ||
83 | SceneHelpers.SetupSceneModules(scene, j2kdm); | 84 | SceneHelpers.SetupSceneModules(scene, j2kdm); |
84 | 85 | ||
85 | tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene); | 86 | tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene); |
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 6e3a58e..6e78d6d 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs | |||
@@ -111,7 +111,7 @@ namespace OpenSim.Region.ClientStack | |||
111 | server.Start(); | 111 | server.Start(); |
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | base.StartupSpecific(); | 115 | base.StartupSpecific(); |
116 | } | 116 | } |
117 | 117 | ||
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 127ca1d..7054825 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -83,7 +83,7 @@ namespace Flotsam.RegionModules.AssetCache | |||
83 | private Dictionary<string, ManualResetEvent> m_CurrentlyWriting = new Dictionary<string, ManualResetEvent>(); | 83 | private Dictionary<string, ManualResetEvent> m_CurrentlyWriting = new Dictionary<string, ManualResetEvent>(); |
84 | private int m_WaitOnInprogressTimeout = 3000; | 84 | private int m_WaitOnInprogressTimeout = 3000; |
85 | #else | 85 | #else |
86 | private List<string> m_CurrentlyWriting = new List<string>(); | 86 | private HashSet<string> m_CurrentlyWriting = new HashSet<string>(); |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | private bool m_FileCacheEnabled = true; | 89 | private bool m_FileCacheEnabled = true; |
@@ -272,7 +272,11 @@ namespace Flotsam.RegionModules.AssetCache | |||
272 | // the other thread has updated the time for us. | 272 | // the other thread has updated the time for us. |
273 | try | 273 | try |
274 | { | 274 | { |
275 | File.SetLastAccessTime(filename, DateTime.Now); | 275 | lock (m_CurrentlyWriting) |
276 | { | ||
277 | if (!m_CurrentlyWriting.Contains(filename)) | ||
278 | File.SetLastAccessTime(filename, DateTime.Now); | ||
279 | } | ||
276 | } | 280 | } |
277 | catch | 281 | catch |
278 | { | 282 | { |
diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs index 5adb845..c91b25f 100644 --- a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs +++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs | |||
@@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.Asset.Tests | |||
65 | config.Configs["AssetCache"].Set("MemoryCacheEnabled", "true"); | 65 | config.Configs["AssetCache"].Set("MemoryCacheEnabled", "true"); |
66 | 66 | ||
67 | m_cache = new FlotsamAssetCache(); | 67 | m_cache = new FlotsamAssetCache(); |
68 | m_scene = SceneHelpers.SetupScene(); | 68 | m_scene = new SceneHelpers().SetupScene(); |
69 | SceneHelpers.SetupSceneModules(m_scene, config, m_cache); | 69 | SceneHelpers.SetupSceneModules(m_scene, config, m_cache); |
70 | } | 70 | } |
71 | 71 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 78ae5e9..2bfe190 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -189,7 +189,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
189 | } | 189 | } |
190 | catch (Exception e) | 190 | catch (Exception e) |
191 | { | 191 | { |
192 | m_log.ErrorFormat("[ATTACHMENTS MODULE]: Unable to rez attachment: {0}{1}", e.Message, e.StackTrace); | 192 | UUID agentId = (sp.ControllingClient == null) ? (UUID)null : sp.ControllingClient.AgentId; |
193 | m_log.ErrorFormat("[ATTACHMENTS MODULE]: Unable to rez attachment with itemID {0}, assetID {1}, point {2} for {3}: {4}\n{5}", | ||
194 | attach.ItemID, attach.AssetID, p, agentId, e.Message, e.StackTrace); | ||
193 | } | 195 | } |
194 | } | 196 | } |
195 | } | 197 | } |
@@ -440,7 +442,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
440 | lock (sp.AttachmentsSyncLock) | 442 | lock (sp.AttachmentsSyncLock) |
441 | { | 443 | { |
442 | // Save avatar attachment information | 444 | // Save avatar attachment information |
443 | m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID); | 445 | // m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID); |
444 | 446 | ||
445 | bool changed = sp.Appearance.DetachAttachment(itemID); | 447 | bool changed = sp.Appearance.DetachAttachment(itemID); |
446 | if (changed && m_scene.AvatarFactory != null) | 448 | if (changed && m_scene.AvatarFactory != null) |
@@ -520,9 +522,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
520 | 522 | ||
521 | if (grp.HasGroupChanged || (saveAllScripted && grp.ContainsScripts())) | 523 | if (grp.HasGroupChanged || (saveAllScripted && grp.ContainsScripts())) |
522 | { | 524 | { |
523 | m_log.DebugFormat( | 525 | // m_log.DebugFormat( |
524 | "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", | 526 | // "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", |
525 | grp.UUID, grp.AttachmentPoint); | 527 | // grp.UUID, grp.AttachmentPoint); |
526 | 528 | ||
527 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | 529 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); |
528 | 530 | ||
@@ -553,12 +555,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
553 | } | 555 | } |
554 | grp.HasGroupChanged = false; // Prevent it being saved over and over | 556 | grp.HasGroupChanged = false; // Prevent it being saved over and over |
555 | } | 557 | } |
556 | else | 558 | // else |
557 | { | 559 | // { |
558 | m_log.DebugFormat( | 560 | // m_log.DebugFormat( |
559 | "[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}", | 561 | // "[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}", |
560 | grp.UUID, grp.AttachmentPoint); | 562 | // grp.UUID, grp.AttachmentPoint); |
561 | } | 563 | // } |
562 | } | 564 | } |
563 | 565 | ||
564 | /// <summary> | 566 | /// <summary> |
@@ -576,9 +578,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
576 | private void AttachToAgent( | 578 | private void AttachToAgent( |
577 | IScenePresence sp, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) | 579 | IScenePresence sp, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) |
578 | { | 580 | { |
579 | // m_log.DebugFormat( | 581 | // m_log.DebugFormat( |
580 | // "[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", | 582 | // "[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", |
581 | // so.Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); | 583 | // so.Name, sp.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); |
582 | 584 | ||
583 | so.DetachFromBackup(); | 585 | so.DetachFromBackup(); |
584 | 586 | ||
@@ -843,9 +845,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
843 | /// <param name="att"></param> | 845 | /// <param name="att"></param> |
844 | private void ShowAttachInUserInventory(IScenePresence sp, uint AttachmentPt, UUID itemID, SceneObjectGroup att) | 846 | private void ShowAttachInUserInventory(IScenePresence sp, uint AttachmentPt, UUID itemID, SceneObjectGroup att) |
845 | { | 847 | { |
846 | // m_log.DebugFormat( | 848 | // m_log.DebugFormat( |
847 | // "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", | 849 | // "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", |
848 | // att.Name, sp.Name, AttachmentPt, itemID); | 850 | // att.Name, sp.Name, AttachmentPt, itemID); |
849 | 851 | ||
850 | if (UUID.Zero == itemID) | 852 | if (UUID.Zero == itemID) |
851 | { | 853 | { |
@@ -908,9 +910,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
908 | 910 | ||
909 | private void Client_OnObjectAttach(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) | 911 | private void Client_OnObjectAttach(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) |
910 | { | 912 | { |
911 | // m_log.DebugFormat( | 913 | // m_log.DebugFormat( |
912 | // "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})", | 914 | // "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})", |
913 | // objectLocalID, remoteClient.Name, AttachmentPt, silent); | 915 | // objectLocalID, remoteClient.Name, AttachmentPt, silent); |
914 | 916 | ||
915 | if (!Enabled) | 917 | if (!Enabled) |
916 | return; | 918 | return; |
@@ -946,13 +948,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
946 | // Calls attach with a Zero position | 948 | // Calls attach with a Zero position |
947 | if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) | 949 | if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) |
948 | { | 950 | { |
949 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId); | 951 | // m_log.Debug( |
952 | // "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId | ||
953 | // + ", AttachmentPoint: " + AttachmentPt); | ||
950 | 954 | ||
951 | // Save avatar attachment information | 955 | // Save avatar attachment information |
952 | m_log.Debug( | 956 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId); |
953 | "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId | ||
954 | + ", AttachmentPoint: " + AttachmentPt); | ||
955 | |||
956 | } | 957 | } |
957 | } | 958 | } |
958 | catch (Exception e) | 959 | catch (Exception e) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index bfe5e4a..42d07fd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
72 | config.AddConfig("Modules"); | 72 | config.AddConfig("Modules"); |
73 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | 73 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); |
74 | 74 | ||
75 | scene = SceneHelpers.SetupScene(); | 75 | scene = new SceneHelpers().SetupScene(); |
76 | m_attMod = new AttachmentsModule(); | 76 | m_attMod = new AttachmentsModule(); |
77 | SceneHelpers.SetupSceneModules(scene, config, m_attMod, new BasicInventoryAccessModule()); | 77 | SceneHelpers.SetupSceneModules(scene, config, m_attMod, new BasicInventoryAccessModule()); |
78 | } | 78 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 2bebd30..875c073 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
158 | // Process the baked texture array | 158 | // Process the baked texture array |
159 | if (textureEntry != null) | 159 | if (textureEntry != null) |
160 | { | 160 | { |
161 | m_log.InfoFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID); | 161 | // m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID); |
162 | 162 | ||
163 | // WriteBakedTexturesReport(sp, m_log.DebugFormat); | 163 | // WriteBakedTexturesReport(sp, m_log.DebugFormat); |
164 | 164 | ||
@@ -208,7 +208,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
208 | ScenePresence sp = m_scene.GetScenePresence(agentId); | 208 | ScenePresence sp = m_scene.GetScenePresence(agentId); |
209 | if (sp == null) | 209 | if (sp == null) |
210 | { | 210 | { |
211 | m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId); | 211 | // This is expected if the user has gone away. |
212 | // m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId); | ||
212 | return false; | 213 | return false; |
213 | } | 214 | } |
214 | 215 | ||
@@ -248,10 +249,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
248 | 249 | ||
249 | if (bakedTextureFace == null) | 250 | if (bakedTextureFace == null) |
250 | { | 251 | { |
251 | m_log.WarnFormat( | 252 | // This can happen legitimately, since some baked textures might not exist |
252 | "[AV FACTORY]: No texture ID set for {0} for {1} in {2} not found when trying to save permanently", | 253 | //m_log.WarnFormat( |
253 | bakeType, sp.Name, m_scene.RegionInfo.RegionName); | 254 | // "[AV FACTORY]: No texture ID set for {0} for {1} in {2} not found when trying to save permanently", |
254 | 255 | // bakeType, sp.Name, m_scene.RegionInfo.RegionName); | |
255 | continue; | 256 | continue; |
256 | } | 257 | } |
257 | 258 | ||
@@ -337,7 +338,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
337 | return false; | 338 | return false; |
338 | } | 339 | } |
339 | 340 | ||
340 | m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID); | 341 | // m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID); |
341 | 342 | ||
342 | // If we only found default textures, then the appearance is not cached | 343 | // If we only found default textures, then the appearance is not cached |
343 | return (defonly ? false : true); | 344 | return (defonly ? false : true); |
@@ -370,11 +371,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
370 | if (missingTexturesOnly) | 371 | if (missingTexturesOnly) |
371 | { | 372 | { |
372 | if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) | 373 | if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) |
374 | { | ||
373 | continue; | 375 | continue; |
376 | } | ||
374 | else | 377 | else |
378 | { | ||
379 | // On inter-simulator teleports, this occurs if baked textures are not being stored by the | ||
380 | // grid asset service (which means that they are not available to the new region and so have | ||
381 | // to be re-requested from the client). | ||
382 | // | ||
383 | // The only available core OpenSimulator behaviour right now | ||
384 | // is not to store these textures, temporarily or otherwise. | ||
375 | m_log.DebugFormat( | 385 | m_log.DebugFormat( |
376 | "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", | 386 | "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", |
377 | face.TextureID, idx, sp.Name); | 387 | face.TextureID, idx, sp.Name); |
388 | } | ||
378 | } | 389 | } |
379 | else | 390 | else |
380 | { | 391 | { |
@@ -417,7 +428,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
417 | // acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); | 428 | // acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); |
418 | 429 | ||
419 | int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType); | 430 | int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType); |
420 | bakedTextures[bakeType] = faceTextures[ftIndex]; | 431 | Primitive.TextureEntryFace texture = faceTextures[ftIndex]; // this will be null if there's no such baked texture |
432 | bakedTextures[bakeType] = texture; | ||
421 | } | 433 | } |
422 | 434 | ||
423 | return bakedTextures; | 435 | return bakedTextures; |
@@ -482,7 +494,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
482 | ScenePresence sp = m_scene.GetScenePresence(agentid); | 494 | ScenePresence sp = m_scene.GetScenePresence(agentid); |
483 | if (sp == null) | 495 | if (sp == null) |
484 | { | 496 | { |
485 | m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid); | 497 | // This is expected if the user has gone away. |
498 | // m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid); | ||
486 | return; | 499 | return; |
487 | } | 500 | } |
488 | 501 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index 11a0a86..848b3bf 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs | |||
@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
53 | UUID userId = TestHelpers.ParseTail(0x1); | 53 | UUID userId = TestHelpers.ParseTail(0x1); |
54 | 54 | ||
55 | AvatarFactoryModule afm = new AvatarFactoryModule(); | 55 | AvatarFactoryModule afm = new AvatarFactoryModule(); |
56 | TestScene scene = SceneHelpers.SetupScene(); | 56 | TestScene scene = new SceneHelpers().SetupScene(); |
57 | SceneHelpers.SetupSceneModules(scene, afm); | 57 | SceneHelpers.SetupSceneModules(scene, afm); |
58 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); | 58 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); |
59 | 59 | ||
@@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
81 | CoreAssetCache assetCache = new CoreAssetCache(); | 81 | CoreAssetCache assetCache = new CoreAssetCache(); |
82 | 82 | ||
83 | AvatarFactoryModule afm = new AvatarFactoryModule(); | 83 | AvatarFactoryModule afm = new AvatarFactoryModule(); |
84 | TestScene scene = SceneHelpers.SetupScene(assetCache); | 84 | TestScene scene = new SceneHelpers(assetCache).SetupScene(); |
85 | SceneHelpers.SetupSceneModules(scene, afm); | 85 | SceneHelpers.SetupSceneModules(scene, afm); |
86 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); | 86 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); |
87 | 87 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 4d8fb90..6ffc7e6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -197,6 +197,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
197 | string fromName = c.From; | 197 | string fromName = c.From; |
198 | string fromNamePrefix = ""; | 198 | string fromNamePrefix = ""; |
199 | UUID fromID = UUID.Zero; | 199 | UUID fromID = UUID.Zero; |
200 | UUID targetID = c.TargetUUID; | ||
200 | string message = c.Message; | 201 | string message = c.Message; |
201 | IScene scene = c.Scene; | 202 | IScene scene = c.Scene; |
202 | Vector3 fromPos = c.Position; | 203 | Vector3 fromPos = c.Position; |
@@ -235,17 +236,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
235 | message = message.Substring(0, 1000); | 236 | message = message.Substring(0, 1000); |
236 | 237 | ||
237 | // m_log.DebugFormat( | 238 | // m_log.DebugFormat( |
238 | // "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}", | 239 | // "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}, targetID {5}", |
239 | // fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType); | 240 | // fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType, targetID); |
240 | 241 | ||
241 | HashSet<UUID> receiverIDs = new HashSet<UUID>(); | 242 | HashSet<UUID> receiverIDs = new HashSet<UUID>(); |
242 | 243 | ||
243 | foreach (Scene s in m_scenes) | 244 | foreach (Scene s in m_scenes) |
244 | { | 245 | { |
245 | // This should use ForEachClient, but clients don't have a position. | 246 | if (targetID == UUID.Zero) |
246 | // If camera is moved into client, then camera position can be used | 247 | { |
247 | s.ForEachRootScenePresence( | 248 | // This should use ForEachClient, but clients don't have a position. |
248 | delegate(ScenePresence presence) | 249 | // If camera is moved into client, then camera position can be used |
250 | s.ForEachRootScenePresence( | ||
251 | delegate(ScenePresence presence) | ||
252 | { | ||
253 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType, false)) | ||
254 | receiverIDs.Add(presence.UUID); | ||
255 | } | ||
256 | ); | ||
257 | } | ||
258 | else | ||
259 | { | ||
260 | // This is a send to a specific client eg from llRegionSayTo | ||
261 | // no need to check distance etc, jand send is as say | ||
262 | ScenePresence presence = s.GetScenePresence(targetID); | ||
263 | if (presence != null && !presence.IsChildAgent) | ||
249 | { | 264 | { |
250 | ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); | 265 | ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); |
251 | if (Presencecheck != null) | 266 | if (Presencecheck != null) |
@@ -256,15 +271,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
256 | // objects on a parcel with access restrictions | 271 | // objects on a parcel with access restrictions |
257 | if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) | 272 | if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) |
258 | { | 273 | { |
259 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType)) | 274 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType, false)) |
260 | receiverIDs.Add(presence.UUID); | 275 | receiverIDs.Add(presence.UUID); |
261 | } | 276 | } |
262 | } | 277 | } |
263 | |||
264 | } | 278 | } |
265 | ); | 279 | } |
266 | } | 280 | } |
267 | 281 | ||
268 | (scene as Scene).EventManager.TriggerOnChatToClients( | 282 | (scene as Scene).EventManager.TriggerOnChatToClients( |
269 | fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); | 283 | fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); |
270 | } | 284 | } |
@@ -344,7 +358,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
344 | /// precondition</returns> | 358 | /// precondition</returns> |
345 | protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, | 359 | protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, |
346 | UUID fromAgentID, string fromName, ChatTypeEnum type, | 360 | UUID fromAgentID, string fromName, ChatTypeEnum type, |
347 | string message, ChatSourceType src) | 361 | string message, ChatSourceType src, bool ignoreDistance) |
348 | { | 362 | { |
349 | // don't send stuff to child agents | 363 | // don't send stuff to child agents |
350 | if (presence.IsChildAgent) return false; | 364 | if (presence.IsChildAgent) return false; |
@@ -355,12 +369,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
355 | presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); | 369 | presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); |
356 | 370 | ||
357 | int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos); | 371 | int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos); |
358 | 372 | ||
359 | if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance || | 373 | if (!ignoreDistance) |
360 | type == ChatTypeEnum.Say && dis > m_saydistance || | ||
361 | type == ChatTypeEnum.Shout && dis > m_shoutdistance) | ||
362 | { | 374 | { |
363 | return false; | 375 | if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance || |
376 | type == ChatTypeEnum.Say && dis > m_saydistance || | ||
377 | type == ChatTypeEnum.Shout && dis > m_shoutdistance) | ||
378 | { | ||
379 | return false; | ||
380 | } | ||
364 | } | 381 | } |
365 | 382 | ||
366 | // TODO: should change so the message is sent through the avatar rather than direct to the ClientView | 383 | // TODO: should change so the message is sent through the avatar rather than direct to the ClientView |
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index 0babeb5..3a91465 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs | |||
@@ -96,6 +96,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | |||
96 | ScenePresence killingAvatar = null; | 96 | ScenePresence killingAvatar = null; |
97 | // string killingAvatarMessage; | 97 | // string killingAvatarMessage; |
98 | 98 | ||
99 | // check to see if it is an NPC and just remove it | ||
100 | INPCModule NPCmodule = deadAvatar.Scene.RequestModuleInterface<INPCModule>(); | ||
101 | if (NPCmodule != null && NPCmodule.DeleteNPC(deadAvatar.UUID, deadAvatar.Scene)) | ||
102 | { | ||
103 | return; | ||
104 | } | ||
105 | |||
99 | if (killerObjectLocalID == 0) | 106 | if (killerObjectLocalID == 0) |
100 | deadAvatarMessage = "You committed suicide!"; | 107 | deadAvatarMessage = "You committed suicide!"; |
101 | else | 108 | else |
@@ -145,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | |||
145 | catch (InvalidOperationException) | 152 | catch (InvalidOperationException) |
146 | { } | 153 | { } |
147 | 154 | ||
148 | deadAvatar.Health = 100; | 155 | deadAvatar.setHealthWithUpdate(100.0f); |
149 | deadAvatar.Scene.TeleportClientHome(deadAvatar.UUID, deadAvatar.ControllingClient); | 156 | deadAvatar.Scene.TeleportClientHome(deadAvatar.UUID, deadAvatar.ControllingClient); |
150 | } | 157 | } |
151 | 158 | ||
@@ -154,14 +161,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | |||
154 | try | 161 | try |
155 | { | 162 | { |
156 | ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 163 | ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); |
157 | 164 | if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0 | |
158 | if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) | 165 | || avatar.Scene.RegionInfo.RegionSettings.AllowDamage) |
159 | { | 166 | { |
160 | avatar.Invulnerable = false; | 167 | avatar.Invulnerable = false; |
161 | } | 168 | } |
162 | else | 169 | else |
163 | { | 170 | { |
164 | avatar.Invulnerable = true; | 171 | avatar.Invulnerable = true; |
172 | if (avatar.Health < 100.0f) | ||
173 | { | ||
174 | avatar.setHealthWithUpdate(100.0f); | ||
175 | } | ||
165 | } | 176 | } |
166 | } | 177 | } |
167 | catch (Exception) | 178 | catch (Exception) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index f64c161..24ec435 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -162,7 +162,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | protected void InitModule(IConfigSource config) | 165 | protected virtual void InitModule(IConfigSource config) |
166 | { | 166 | { |
167 | IConfig friendsConfig = config.Configs["Friends"]; | 167 | IConfig friendsConfig = config.Configs["Friends"]; |
168 | if (friendsConfig != null) | 168 | if (friendsConfig != null) |
@@ -449,29 +449,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
449 | /// </summary> | 449 | /// </summary> |
450 | public IClientAPI LocateClientObject(UUID agentID) | 450 | public IClientAPI LocateClientObject(UUID agentID) |
451 | { | 451 | { |
452 | Scene scene = GetClientScene(agentID); | ||
453 | if (scene != null) | ||
454 | { | ||
455 | ScenePresence presence = scene.GetScenePresence(agentID); | ||
456 | if (presence != null) | ||
457 | return presence.ControllingClient; | ||
458 | } | ||
459 | |||
460 | return null; | ||
461 | } | ||
462 | |||
463 | /// <summary> | ||
464 | /// Find the scene for an agent | ||
465 | /// </summary> | ||
466 | private Scene GetClientScene(UUID agentId) | ||
467 | { | ||
468 | lock (m_Scenes) | 452 | lock (m_Scenes) |
469 | { | 453 | { |
470 | foreach (Scene scene in m_Scenes) | 454 | foreach (Scene scene in m_Scenes) |
471 | { | 455 | { |
472 | ScenePresence presence = scene.GetScenePresence(agentId); | 456 | ScenePresence presence = scene.GetScenePresence(agentID); |
473 | if (presence != null && !presence.IsChildAgent) | 457 | if (presence != null && !presence.IsChildAgent) |
474 | return scene; | 458 | return presence.ControllingClient; |
475 | } | 459 | } |
476 | } | 460 | } |
477 | 461 | ||
@@ -498,7 +482,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
498 | Util.FireAndForget( | 482 | Util.FireAndForget( |
499 | delegate | 483 | delegate |
500 | { | 484 | { |
501 | m_log.DebugFormat("[FRIENDS MODULE]: Notifying {0} friends", friendList.Count); | 485 | m_log.DebugFormat( |
486 | "[FRIENDS MODULE]: Notifying {0} friends of {1} of online status {2}", | ||
487 | friendList.Count, agentID, online); | ||
488 | |||
502 | // Notify about this user status | 489 | // Notify about this user status |
503 | StatusNotify(friendList, agentID, online); | 490 | StatusNotify(friendList, agentID, online); |
504 | } | 491 | } |
@@ -515,7 +502,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
515 | { | 502 | { |
516 | // Try local | 503 | // Try local |
517 | if (LocalStatusNotification(userID, friendID, online)) | 504 | if (LocalStatusNotification(userID, friendID, online)) |
518 | return; | 505 | continue; |
519 | 506 | ||
520 | // The friend is not here [as root]. Let's forward. | 507 | // The friend is not here [as root]. Let's forward. |
521 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); | 508 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); |
@@ -523,11 +510,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
523 | { | 510 | { |
524 | PresenceInfo friendSession = null; | 511 | PresenceInfo friendSession = null; |
525 | foreach (PresenceInfo pinfo in friendSessions) | 512 | foreach (PresenceInfo pinfo in friendSessions) |
513 | { | ||
526 | if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad | 514 | if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad |
527 | { | 515 | { |
528 | friendSession = pinfo; | 516 | friendSession = pinfo; |
529 | break; | 517 | break; |
530 | } | 518 | } |
519 | } | ||
531 | 520 | ||
532 | if (friendSession != null) | 521 | if (friendSession != null) |
533 | { | 522 | { |
@@ -546,7 +535,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
546 | } | 535 | } |
547 | } | 536 | } |
548 | 537 | ||
549 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) | 538 | protected virtual void OnInstantMessage(IClientAPI client, GridInstantMessage im) |
550 | { | 539 | { |
551 | if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered) | 540 | if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered) |
552 | { | 541 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 9a6d277..3728b85 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | |||
@@ -50,6 +50,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
50 | { | 50 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 52 | ||
53 | private int m_levelHGFriends = 0; | ||
54 | |||
53 | IUserManagement m_uMan; | 55 | IUserManagement m_uMan; |
54 | public IUserManagement UserManagementModule | 56 | public IUserManagement UserManagementModule |
55 | { | 57 | { |
@@ -87,6 +89,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
87 | m_StatusNotifier = new HGStatusNotifier(this); | 89 | m_StatusNotifier = new HGStatusNotifier(this); |
88 | } | 90 | } |
89 | 91 | ||
92 | protected override void InitModule(IConfigSource config) | ||
93 | { | ||
94 | base.InitModule(config); | ||
95 | |||
96 | // Additionally to the base method | ||
97 | IConfig friendsConfig = config.Configs["HGFriendsModule"]; | ||
98 | if (friendsConfig != null) | ||
99 | { | ||
100 | m_levelHGFriends = friendsConfig.GetInt("LevelHGFriends", 0); | ||
101 | |||
102 | // TODO: read in all config variables pertaining to | ||
103 | // HG friendship permissions | ||
104 | } | ||
105 | } | ||
106 | |||
90 | #endregion | 107 | #endregion |
91 | 108 | ||
92 | #region IFriendsSimConnector | 109 | #region IFriendsSimConnector |
@@ -105,6 +122,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
105 | 122 | ||
106 | #endregion | 123 | #endregion |
107 | 124 | ||
125 | protected override void OnInstantMessage(IClientAPI client, GridInstantMessage im) | ||
126 | { | ||
127 | if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered) | ||
128 | { | ||
129 | // we got a friendship offer | ||
130 | UUID principalID = new UUID(im.fromAgentID); | ||
131 | UUID friendID = new UUID(im.toAgentID); | ||
132 | |||
133 | // Check if friendID is foreigner and if principalID has the permission | ||
134 | // to request friendships with foreigners. If not, return immediately. | ||
135 | if (!UserManagementModule.IsLocalGridUser(friendID)) | ||
136 | { | ||
137 | ScenePresence avatar = null; | ||
138 | ((Scene)client.Scene).TryGetScenePresence(principalID, out avatar); | ||
139 | |||
140 | if (avatar == null) | ||
141 | return; | ||
142 | |||
143 | if (avatar.UserLevel < m_levelHGFriends) | ||
144 | { | ||
145 | client.SendAgentAlertMessage("Unable to send friendship invitation to foreigner. Insufficient permissions.", false); | ||
146 | return; | ||
147 | } | ||
148 | } | ||
149 | } | ||
150 | |||
151 | base.OnInstantMessage(client, im); | ||
152 | } | ||
153 | |||
108 | protected override void OnApproveFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders) | 154 | protected override void OnApproveFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders) |
109 | { | 155 | { |
110 | // Update the local cache. Yes, we need to do it right here | 156 | // Update the local cache. Yes, we need to do it right here |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs index 45b4264..7a197f7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs | |||
@@ -78,7 +78,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests | |||
78 | config.AddConfig("FriendsService"); | 78 | config.AddConfig("FriendsService"); |
79 | config.Configs["FriendsService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); | 79 | config.Configs["FriendsService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); |
80 | 80 | ||
81 | m_scene = SceneHelpers.SetupScene(); | 81 | m_scene = new SceneHelpers().SetupScene(); |
82 | m_fm = new FriendsModule(); | 82 | m_fm = new FriendsModule(); |
83 | SceneHelpers.SetupSceneModules(m_scene, config, m_fm); | 83 | SceneHelpers.SetupSceneModules(m_scene, config, m_fm); |
84 | } | 84 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 8560c73..6587ead 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -39,6 +39,9 @@ using OpenSim.Framework.Serialization.External; | |||
39 | using OpenSim.Region.CoreModules.World.Archiver; | 39 | using OpenSim.Region.CoreModules.World.Archiver; |
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Services.Interfaces; | 41 | using OpenSim.Services.Interfaces; |
42 | using Ionic.Zlib; | ||
43 | using GZipStream = Ionic.Zlib.GZipStream; | ||
44 | using CompressionMode = Ionic.Zlib.CompressionMode; | ||
42 | 45 | ||
43 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | 46 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver |
44 | { | 47 | { |
@@ -91,7 +94,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
91 | /// Constructor | 94 | /// Constructor |
92 | /// </summary> | 95 | /// </summary> |
93 | public InventoryArchiveWriteRequest( | 96 | public InventoryArchiveWriteRequest( |
94 | Guid id, InventoryArchiverModule module, Scene scene, | 97 | Guid id, InventoryArchiverModule module, Scene scene, |
95 | UserAccount userInfo, string invPath, string savePath) | 98 | UserAccount userInfo, string invPath, string savePath) |
96 | : this( | 99 | : this( |
97 | id, | 100 | id, |
@@ -99,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
99 | scene, | 102 | scene, |
100 | userInfo, | 103 | userInfo, |
101 | invPath, | 104 | invPath, |
102 | new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress)) | 105 | new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress, CompressionLevel.BestCompression)) |
103 | { | 106 | { |
104 | } | 107 | } |
105 | 108 | ||
@@ -107,7 +110,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
107 | /// Constructor | 110 | /// Constructor |
108 | /// </summary> | 111 | /// </summary> |
109 | public InventoryArchiveWriteRequest( | 112 | public InventoryArchiveWriteRequest( |
110 | Guid id, InventoryArchiverModule module, Scene scene, | 113 | Guid id, InventoryArchiverModule module, Scene scene, |
111 | UserAccount userInfo, string invPath, Stream saveStream) | 114 | UserAccount userInfo, string invPath, Stream saveStream) |
112 | { | 115 | { |
113 | m_id = id; | 116 | m_id = id; |
@@ -125,7 +128,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
125 | { | 128 | { |
126 | Exception reportedException = null; | 129 | Exception reportedException = null; |
127 | bool succeeded = true; | 130 | bool succeeded = true; |
128 | 131 | ||
129 | try | 132 | try |
130 | { | 133 | { |
131 | m_archiveWriter.Close(); | 134 | m_archiveWriter.Close(); |
@@ -146,6 +149,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
146 | 149 | ||
147 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) | 150 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) |
148 | { | 151 | { |
152 | if (options.ContainsKey("exclude")) | ||
153 | { | ||
154 | if (((List<String>)options["exclude"]).Contains(inventoryItem.Name) || | ||
155 | ((List<String>)options["exclude"]).Contains(inventoryItem.ID.ToString())) | ||
156 | { | ||
157 | if (options.ContainsKey("verbose")) | ||
158 | { | ||
159 | m_log.InfoFormat( | ||
160 | "[INVENTORY ARCHIVER]: Skipping inventory item {0} {1} at {2}", | ||
161 | inventoryItem.Name, inventoryItem.ID, path); | ||
162 | } | ||
163 | return; | ||
164 | } | ||
165 | } | ||
166 | |||
149 | if (options.ContainsKey("verbose")) | 167 | if (options.ContainsKey("verbose")) |
150 | m_log.InfoFormat( | 168 | m_log.InfoFormat( |
151 | "[INVENTORY ARCHIVER]: Saving item {0} {1} with asset {2}", | 169 | "[INVENTORY ARCHIVER]: Saving item {0} {1} with asset {2}", |
@@ -175,9 +193,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
175 | /// <param name="options"></param> | 193 | /// <param name="options"></param> |
176 | /// <param name="userAccountService"></param> | 194 | /// <param name="userAccountService"></param> |
177 | protected void SaveInvFolder( | 195 | protected void SaveInvFolder( |
178 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, | 196 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, |
179 | Dictionary<string, object> options, IUserAccountService userAccountService) | 197 | Dictionary<string, object> options, IUserAccountService userAccountService) |
180 | { | 198 | { |
199 | if (options.ContainsKey("excludefolders")) | ||
200 | { | ||
201 | if (((List<String>)options["excludefolders"]).Contains(inventoryFolder.Name) || | ||
202 | ((List<String>)options["excludefolders"]).Contains(inventoryFolder.ID.ToString())) | ||
203 | { | ||
204 | if (options.ContainsKey("verbose")) | ||
205 | { | ||
206 | m_log.InfoFormat( | ||
207 | "[INVENTORY ARCHIVER]: Skipping folder {0} at {1}", | ||
208 | inventoryFolder.Name, path); | ||
209 | } | ||
210 | return; | ||
211 | } | ||
212 | } | ||
213 | |||
214 | if (options.ContainsKey("verbose")) | ||
215 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving folder {0}", inventoryFolder.Name); | ||
216 | |||
181 | if (saveThisFolderItself) | 217 | if (saveThisFolderItself) |
182 | { | 218 | { |
183 | path += CreateArchiveFolderName(inventoryFolder); | 219 | path += CreateArchiveFolderName(inventoryFolder); |
@@ -186,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
186 | m_archiveWriter.WriteDir(path); | 222 | m_archiveWriter.WriteDir(path); |
187 | } | 223 | } |
188 | 224 | ||
189 | InventoryCollection contents | 225 | InventoryCollection contents |
190 | = m_scene.InventoryService.GetFolderContent(inventoryFolder.Owner, inventoryFolder.ID); | 226 | = m_scene.InventoryService.GetFolderContent(inventoryFolder.Owner, inventoryFolder.ID); |
191 | 227 | ||
192 | foreach (InventoryFolderBase childFolder in contents.Folders) | 228 | foreach (InventoryFolderBase childFolder in contents.Folders) |
@@ -213,16 +249,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
213 | InventoryFolderBase inventoryFolder = null; | 249 | InventoryFolderBase inventoryFolder = null; |
214 | InventoryItemBase inventoryItem = null; | 250 | InventoryItemBase inventoryItem = null; |
215 | InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); | 251 | InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); |
216 | 252 | ||
217 | bool saveFolderContentsOnly = false; | 253 | bool saveFolderContentsOnly = false; |
218 | 254 | ||
219 | // Eliminate double slashes and any leading / on the path. | 255 | // Eliminate double slashes and any leading / on the path. |
220 | string[] components | 256 | string[] components |
221 | = m_invPath.Split( | 257 | = m_invPath.Split( |
222 | new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries); | 258 | new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries); |
223 | 259 | ||
224 | int maxComponentIndex = components.Length - 1; | 260 | int maxComponentIndex = components.Length - 1; |
225 | 261 | ||
226 | // If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the | 262 | // If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the |
227 | // folder itself. This may get more sophisicated later on | 263 | // folder itself. This may get more sophisicated later on |
228 | if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD) | 264 | if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD) |
@@ -230,13 +266,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
230 | saveFolderContentsOnly = true; | 266 | saveFolderContentsOnly = true; |
231 | maxComponentIndex--; | 267 | maxComponentIndex--; |
232 | } | 268 | } |
233 | 269 | ||
234 | m_invPath = String.Empty; | 270 | m_invPath = String.Empty; |
235 | for (int i = 0; i <= maxComponentIndex; i++) | 271 | for (int i = 0; i <= maxComponentIndex; i++) |
236 | { | 272 | { |
237 | m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER; | 273 | m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER; |
238 | } | 274 | } |
239 | 275 | ||
240 | // Annoyingly Split actually returns the original string if the input string consists only of delimiters | 276 | // Annoyingly Split actually returns the original string if the input string consists only of delimiters |
241 | // Therefore if we still start with a / after the split, then we need the root folder | 277 | // Therefore if we still start with a / after the split, then we need the root folder |
242 | if (m_invPath.Length == 0) | 278 | if (m_invPath.Length == 0) |
@@ -246,25 +282,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
246 | else | 282 | else |
247 | { | 283 | { |
248 | m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER)); | 284 | m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER)); |
249 | List<InventoryFolderBase> candidateFolders | 285 | List<InventoryFolderBase> candidateFolders |
250 | = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath); | 286 | = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath); |
251 | if (candidateFolders.Count > 0) | 287 | if (candidateFolders.Count > 0) |
252 | inventoryFolder = candidateFolders[0]; | 288 | inventoryFolder = candidateFolders[0]; |
253 | } | 289 | } |
254 | 290 | ||
255 | // The path may point to an item instead | 291 | // The path may point to an item instead |
256 | if (inventoryFolder == null) | 292 | if (inventoryFolder == null) |
257 | inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath); | 293 | inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath); |
258 | 294 | ||
259 | if (null == inventoryFolder && null == inventoryItem) | 295 | if (null == inventoryFolder && null == inventoryItem) |
260 | { | 296 | { |
261 | // We couldn't find the path indicated | 297 | // We couldn't find the path indicated |
262 | string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); | 298 | string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); |
263 | Exception e = new InventoryArchiverException(errorMessage); | 299 | Exception e = new InventoryArchiverException(errorMessage); |
264 | m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e); | 300 | m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e); |
265 | throw e; | 301 | throw e; |
266 | } | 302 | } |
267 | 303 | ||
268 | m_archiveWriter = new TarArchiveWriter(m_saveStream); | 304 | m_archiveWriter = new TarArchiveWriter(m_saveStream); |
269 | 305 | ||
270 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Adding control file to archive."); | 306 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Adding control file to archive."); |
@@ -278,10 +314,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
278 | { | 314 | { |
279 | m_log.DebugFormat( | 315 | m_log.DebugFormat( |
280 | "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", | 316 | "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", |
281 | inventoryFolder.Name, | 317 | inventoryFolder.Name, |
282 | inventoryFolder.ID, | 318 | inventoryFolder.ID, |
283 | m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath); | 319 | m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath); |
284 | 320 | ||
285 | //recurse through all dirs getting dirs and files | 321 | //recurse through all dirs getting dirs and files |
286 | SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly, options, userAccountService); | 322 | SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly, options, userAccountService); |
287 | } | 323 | } |
@@ -290,10 +326,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
290 | m_log.DebugFormat( | 326 | m_log.DebugFormat( |
291 | "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}", | 327 | "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}", |
292 | inventoryItem.Name, inventoryItem.ID, m_invPath); | 328 | inventoryItem.Name, inventoryItem.ID, m_invPath); |
293 | 329 | ||
294 | SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH, options, userAccountService); | 330 | SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH, options, userAccountService); |
295 | } | 331 | } |
296 | 332 | ||
297 | // Don't put all this profile information into the archive right now. | 333 | // Don't put all this profile information into the archive right now. |
298 | //SaveUsers(); | 334 | //SaveUsers(); |
299 | 335 | ||
@@ -352,7 +388,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
352 | /// | 388 | /// |
353 | /// These names are prepended with an inventory folder's UUID so that more than one folder can have the | 389 | /// These names are prepended with an inventory folder's UUID so that more than one folder can have the |
354 | /// same name | 390 | /// same name |
355 | /// | 391 | /// |
356 | /// <param name="folder"></param> | 392 | /// <param name="folder"></param> |
357 | /// <returns></returns> | 393 | /// <returns></returns> |
358 | public static string CreateArchiveFolderName(InventoryFolderBase folder) | 394 | public static string CreateArchiveFolderName(InventoryFolderBase folder) |
@@ -366,7 +402,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
366 | /// | 402 | /// |
367 | /// These names are prepended with an inventory item's UUID so that more than one item can have the | 403 | /// These names are prepended with an inventory item's UUID so that more than one item can have the |
368 | /// same name | 404 | /// same name |
369 | /// | 405 | /// |
370 | /// <param name="item"></param> | 406 | /// <param name="item"></param> |
371 | /// <returns></returns> | 407 | /// <returns></returns> |
372 | public static string CreateArchiveItemName(InventoryItemBase item) | 408 | public static string CreateArchiveItemName(InventoryItemBase item) |
@@ -412,7 +448,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
412 | public string CreateControlFile(Dictionary<string, object> options) | 448 | public string CreateControlFile(Dictionary<string, object> options) |
413 | { | 449 | { |
414 | int majorVersion, minorVersion; | 450 | int majorVersion, minorVersion; |
415 | 451 | ||
416 | if (options.ContainsKey("home")) | 452 | if (options.ContainsKey("home")) |
417 | { | 453 | { |
418 | majorVersion = 1; | 454 | majorVersion = 1; |
@@ -422,10 +458,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
422 | { | 458 | { |
423 | majorVersion = 0; | 459 | majorVersion = 0; |
424 | minorVersion = 3; | 460 | minorVersion = 3; |
425 | } | 461 | } |
426 | 462 | ||
427 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); | 463 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); |
428 | 464 | ||
429 | StringWriter sw = new StringWriter(); | 465 | StringWriter sw = new StringWriter(); |
430 | XmlTextWriter xtw = new XmlTextWriter(sw); | 466 | XmlTextWriter xtw = new XmlTextWriter(sw); |
431 | xtw.Formatting = Formatting.Indented; | 467 | xtw.Formatting = Formatting.Indented; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index ac22c3f..cf87010 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -47,18 +47,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
47 | public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule | 47 | public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule |
48 | { | 48 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | public string Name { get { return "Inventory Archiver Module"; } } | 51 | public string Name { get { return "Inventory Archiver Module"; } } |
52 | 52 | ||
53 | public bool IsSharedModule { get { return true; } } | 53 | public bool IsSharedModule { get { return true; } } |
54 | 54 | ||
55 | /// <value> | 55 | /// <value> |
56 | /// Enable or disable checking whether the iar user is actually logged in | 56 | /// Enable or disable checking whether the iar user is actually logged in |
57 | /// </value> | 57 | /// </value> |
58 | // public bool DisablePresenceChecks { get; set; } | 58 | // public bool DisablePresenceChecks { get; set; } |
59 | 59 | ||
60 | public event InventoryArchiveSaved OnInventoryArchiveSaved; | 60 | public event InventoryArchiveSaved OnInventoryArchiveSaved; |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// The file to load and save inventory if no filename has been specified | 63 | /// The file to load and save inventory if no filename has been specified |
64 | /// </summary> | 64 | /// </summary> |
@@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
68 | /// Pending save completions initiated from the console | 68 | /// Pending save completions initiated from the console |
69 | /// </value> | 69 | /// </value> |
70 | protected List<Guid> m_pendingConsoleSaves = new List<Guid>(); | 70 | protected List<Guid> m_pendingConsoleSaves = new List<Guid>(); |
71 | 71 | ||
72 | /// <value> | 72 | /// <value> |
73 | /// All scenes that this module knows about | 73 | /// All scenes that this module knows about |
74 | /// </value> | 74 | /// </value> |
@@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
106 | { | 106 | { |
107 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); | 107 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); |
108 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; | 108 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; |
109 | 109 | ||
110 | scene.AddCommand( | 110 | scene.AddCommand( |
111 | "Archiving", this, "load iar", | 111 | "Archiving", this, "load iar", |
112 | "load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]", | 112 | "load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]", |
@@ -119,11 +119,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
119 | + "<IAR path> is the filesystem path or URI from which to load the IAR." | 119 | + "<IAR path> is the filesystem path or URI from which to load the IAR." |
120 | + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), | 120 | + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), |
121 | HandleLoadInvConsoleCommand); | 121 | HandleLoadInvConsoleCommand); |
122 | 122 | ||
123 | scene.AddCommand( | 123 | scene.AddCommand( |
124 | "Archiving", this, "save iar", | 124 | "Archiving", this, "save iar", |
125 | "save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-v|--verbose]", | 125 | "save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-e|--exclude=<name/uuid>] [-f|--excludefolder=<foldername/uuid>] [-v|--verbose]", |
126 | "Save user inventory archive (IAR).", | 126 | "Save user inventory archive (IAR).", |
127 | "<first> is the user's first name.\n" | 127 | "<first> is the user's first name.\n" |
128 | + "<last> is the user's last name.\n" | 128 | + "<last> is the user's last name.\n" |
129 | + "<inventory path> is the path inside the user's inventory for the folder/item to be saved.\n" | 129 | + "<inventory path> is the path inside the user's inventory for the folder/item to be saved.\n" |
@@ -131,32 +131,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
131 | + string.Format(" If this is not given then the filename {0} in the current directory is used.\n", DEFAULT_INV_BACKUP_FILENAME) | 131 | + string.Format(" If this is not given then the filename {0} in the current directory is used.\n", DEFAULT_INV_BACKUP_FILENAME) |
132 | + "-h|--home=<url> adds the url of the profile service to the saved user information.\n" | 132 | + "-h|--home=<url> adds the url of the profile service to the saved user information.\n" |
133 | + "-c|--creators preserves information about foreign creators.\n" | 133 | + "-c|--creators preserves information about foreign creators.\n" |
134 | + "-e|--exclude=<name/uuid> don't save the inventory item in archive" + Environment.NewLine | ||
135 | + "-f|--excludefolder=<folder/uuid> don't save contents of the folder in archive" + Environment.NewLine | ||
134 | + "-v|--verbose extra debug messages.\n" | 136 | + "-v|--verbose extra debug messages.\n" |
135 | + "--noassets stops assets being saved to the IAR.", | 137 | + "--noassets stops assets being saved to the IAR.", |
136 | HandleSaveInvConsoleCommand); | 138 | HandleSaveInvConsoleCommand); |
137 | 139 | ||
138 | m_aScene = scene; | 140 | m_aScene = scene; |
139 | } | 141 | } |
140 | 142 | ||
141 | m_scenes[scene.RegionInfo.RegionID] = scene; | 143 | m_scenes[scene.RegionInfo.RegionID] = scene; |
142 | } | 144 | } |
143 | 145 | ||
144 | public void PostInitialise() {} | 146 | public void PostInitialise() {} |
145 | 147 | ||
146 | public void Close() {} | 148 | public void Close() {} |
147 | 149 | ||
148 | /// <summary> | 150 | /// <summary> |
149 | /// Trigger the inventory archive saved event. | 151 | /// Trigger the inventory archive saved event. |
150 | /// </summary> | 152 | /// </summary> |
151 | protected internal void TriggerInventoryArchiveSaved( | 153 | protected internal void TriggerInventoryArchiveSaved( |
152 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, | 154 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
153 | Exception reportedException) | 155 | Exception reportedException) |
154 | { | 156 | { |
155 | InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; | 157 | InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; |
156 | if (handlerInventoryArchiveSaved != null) | 158 | if (handlerInventoryArchiveSaved != null) |
157 | handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); | 159 | handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); |
158 | } | 160 | } |
159 | 161 | ||
160 | public bool ArchiveInventory( | 162 | public bool ArchiveInventory( |
161 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) | 163 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) |
162 | { | 164 | { |
@@ -164,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
164 | } | 166 | } |
165 | 167 | ||
166 | public bool ArchiveInventory( | 168 | public bool ArchiveInventory( |
167 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, | 169 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, |
168 | Dictionary<string, object> options) | 170 | Dictionary<string, object> options) |
169 | { | 171 | { |
170 | if (m_scenes.Count > 0) | 172 | if (m_scenes.Count > 0) |
@@ -188,7 +190,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
188 | 190 | ||
189 | return false; | 191 | return false; |
190 | } | 192 | } |
191 | 193 | ||
192 | return true; | 194 | return true; |
193 | // } | 195 | // } |
194 | // else | 196 | // else |
@@ -202,15 +204,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
202 | 204 | ||
203 | return false; | 205 | return false; |
204 | } | 206 | } |
205 | 207 | ||
206 | public bool ArchiveInventory( | 208 | public bool ArchiveInventory( |
207 | Guid id, string firstName, string lastName, string invPath, string pass, string savePath, | 209 | Guid id, string firstName, string lastName, string invPath, string pass, string savePath, |
208 | Dictionary<string, object> options) | 210 | Dictionary<string, object> options) |
209 | { | 211 | { |
210 | if (m_scenes.Count > 0) | 212 | if (m_scenes.Count > 0) |
211 | { | 213 | { |
212 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); | 214 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
213 | 215 | ||
214 | if (userInfo != null) | 216 | if (userInfo != null) |
215 | { | 217 | { |
216 | // if (CheckPresence(userInfo.PrincipalID)) | 218 | // if (CheckPresence(userInfo.PrincipalID)) |
@@ -228,7 +230,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
228 | 230 | ||
229 | return false; | 231 | return false; |
230 | } | 232 | } |
231 | 233 | ||
232 | return true; | 234 | return true; |
233 | // } | 235 | // } |
234 | // else | 236 | // else |
@@ -239,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
239 | // } | 241 | // } |
240 | } | 242 | } |
241 | } | 243 | } |
242 | 244 | ||
243 | return false; | 245 | return false; |
244 | } | 246 | } |
245 | 247 | ||
@@ -247,9 +249,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
247 | { | 249 | { |
248 | return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>()); | 250 | return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>()); |
249 | } | 251 | } |
250 | 252 | ||
251 | public bool DearchiveInventory( | 253 | public bool DearchiveInventory( |
252 | string firstName, string lastName, string invPath, string pass, Stream loadStream, | 254 | string firstName, string lastName, string invPath, string pass, Stream loadStream, |
253 | Dictionary<string, object> options) | 255 | Dictionary<string, object> options) |
254 | { | 256 | { |
255 | if (m_scenes.Count > 0) | 257 | if (m_scenes.Count > 0) |
@@ -295,22 +297,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
295 | 297 | ||
296 | return false; | 298 | return false; |
297 | } | 299 | } |
298 | 300 | ||
299 | public bool DearchiveInventory( | 301 | public bool DearchiveInventory( |
300 | string firstName, string lastName, string invPath, string pass, string loadPath, | 302 | string firstName, string lastName, string invPath, string pass, string loadPath, |
301 | Dictionary<string, object> options) | 303 | Dictionary<string, object> options) |
302 | { | 304 | { |
303 | if (m_scenes.Count > 0) | 305 | if (m_scenes.Count > 0) |
304 | { | 306 | { |
305 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); | 307 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
306 | 308 | ||
307 | if (userInfo != null) | 309 | if (userInfo != null) |
308 | { | 310 | { |
309 | // if (CheckPresence(userInfo.PrincipalID)) | 311 | // if (CheckPresence(userInfo.PrincipalID)) |
310 | // { | 312 | // { |
311 | InventoryArchiveReadRequest request; | 313 | InventoryArchiveReadRequest request; |
312 | bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); | 314 | bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); |
313 | 315 | ||
314 | try | 316 | try |
315 | { | 317 | { |
316 | request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge); | 318 | request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge); |
@@ -324,7 +326,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
324 | 326 | ||
325 | return false; | 327 | return false; |
326 | } | 328 | } |
327 | 329 | ||
328 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); | 330 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); |
329 | 331 | ||
330 | return true; | 332 | return true; |
@@ -340,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
340 | 342 | ||
341 | return false; | 343 | return false; |
342 | } | 344 | } |
343 | 345 | ||
344 | /// <summary> | 346 | /// <summary> |
345 | /// Load inventory from an inventory file archive | 347 | /// Load inventory from an inventory file archive |
346 | /// </summary> | 348 | /// </summary> |
@@ -351,26 +353,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
351 | { | 353 | { |
352 | Dictionary<string, object> options = new Dictionary<string, object>(); | 354 | Dictionary<string, object> options = new Dictionary<string, object>(); |
353 | OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); | 355 | OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); |
354 | 356 | ||
355 | List<string> mainParams = optionSet.Parse(cmdparams); | 357 | List<string> mainParams = optionSet.Parse(cmdparams); |
356 | 358 | ||
357 | if (mainParams.Count < 6) | 359 | if (mainParams.Count < 6) |
358 | { | 360 | { |
359 | m_log.Error( | 361 | m_log.Error( |
360 | "[INVENTORY ARCHIVER]: usage is load iar [-m|--merge] <first name> <last name> <inventory path> <user password> [<load file path>]"); | 362 | "[INVENTORY ARCHIVER]: usage is load iar [-m|--merge] <first name> <last name> <inventory path> <user password> [<load file path>]"); |
361 | return; | 363 | return; |
362 | } | 364 | } |
363 | 365 | ||
364 | string firstName = mainParams[2]; | 366 | string firstName = mainParams[2]; |
365 | string lastName = mainParams[3]; | 367 | string lastName = mainParams[3]; |
366 | string invPath = mainParams[4]; | 368 | string invPath = mainParams[4]; |
367 | string pass = mainParams[5]; | 369 | string pass = mainParams[5]; |
368 | string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); | 370 | string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); |
369 | 371 | ||
370 | m_log.InfoFormat( | 372 | m_log.InfoFormat( |
371 | "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", | 373 | "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", |
372 | loadPath, invPath, firstName, lastName); | 374 | loadPath, invPath, firstName, lastName); |
373 | 375 | ||
374 | if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) | 376 | if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) |
375 | m_log.InfoFormat( | 377 | m_log.InfoFormat( |
376 | "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", | 378 | "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", |
@@ -381,7 +383,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
381 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message); | 383 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message); |
382 | } | 384 | } |
383 | } | 385 | } |
384 | 386 | ||
385 | /// <summary> | 387 | /// <summary> |
386 | /// Save inventory to a file archive | 388 | /// Save inventory to a file archive |
387 | /// </summary> | 389 | /// </summary> |
@@ -398,6 +400,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
398 | ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; }); | 400 | ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; }); |
399 | ops.Add("c|creators", delegate(string v) { options["creators"] = v; }); | 401 | ops.Add("c|creators", delegate(string v) { options["creators"] = v; }); |
400 | ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; }); | 402 | ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; }); |
403 | ops.Add("e|exclude=", delegate(string v) | ||
404 | { | ||
405 | if (!options.ContainsKey("exclude")) | ||
406 | options["exclude"] = new List<String>(); | ||
407 | ((List<String>)options["exclude"]).Add(v); | ||
408 | }); | ||
409 | ops.Add("f|excludefolder=", delegate(string v) | ||
410 | { | ||
411 | if (!options.ContainsKey("excludefolders")) | ||
412 | options["excludefolders"] = new List<String>(); | ||
413 | ((List<String>)options["excludefolders"]).Add(v); | ||
414 | }); | ||
401 | 415 | ||
402 | List<string> mainParams = ops.Parse(cmdparams); | 416 | List<string> mainParams = ops.Parse(cmdparams); |
403 | 417 | ||
@@ -406,10 +420,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
406 | if (mainParams.Count < 6) | 420 | if (mainParams.Count < 6) |
407 | { | 421 | { |
408 | m_log.Error( | 422 | m_log.Error( |
409 | "[INVENTORY ARCHIVER]: usage is save iar [-h|--home=<url>] [--noassets] <first name> <last name> <inventory path> <user password> [<save file path>] [-c|--creators] [-v|--verbose]"); | 423 | "[INVENTORY ARCHIVER]: save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-e|--exclude=<name/uuid>] [-f|--excludefolder=<foldername/uuid>] [-v|--verbose]"); |
410 | return; | 424 | return; |
411 | } | 425 | } |
412 | 426 | ||
413 | if (options.ContainsKey("home")) | 427 | if (options.ContainsKey("home")) |
414 | m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR"); | 428 | m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR"); |
415 | 429 | ||
@@ -418,7 +432,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
418 | string invPath = mainParams[4]; | 432 | string invPath = mainParams[4]; |
419 | string pass = mainParams[5]; | 433 | string pass = mainParams[5]; |
420 | string savePath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); | 434 | string savePath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); |
421 | 435 | ||
422 | m_log.InfoFormat( | 436 | m_log.InfoFormat( |
423 | "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", | 437 | "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", |
424 | savePath, invPath, firstName, lastName); | 438 | savePath, invPath, firstName, lastName); |
@@ -433,9 +447,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
433 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message); | 447 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message); |
434 | } | 448 | } |
435 | } | 449 | } |
436 | 450 | ||
437 | private void SaveInvConsoleCommandCompleted( | 451 | private void SaveInvConsoleCommandCompleted( |
438 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, | 452 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
439 | Exception reportedException) | 453 | Exception reportedException) |
440 | { | 454 | { |
441 | lock (m_pendingConsoleSaves) | 455 | lock (m_pendingConsoleSaves) |
@@ -445,7 +459,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
445 | else | 459 | else |
446 | return; | 460 | return; |
447 | } | 461 | } |
448 | 462 | ||
449 | if (succeeded) | 463 | if (succeeded) |
450 | { | 464 | { |
451 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0} {1}", userInfo.FirstName, userInfo.LastName); | 465 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0} {1}", userInfo.FirstName, userInfo.LastName); |
@@ -453,11 +467,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
453 | else | 467 | else |
454 | { | 468 | { |
455 | m_log.ErrorFormat( | 469 | m_log.ErrorFormat( |
456 | "[INVENTORY ARCHIVER]: Archive save for {0} {1} failed - {2}", | 470 | "[INVENTORY ARCHIVER]: Archive save for {0} {1} failed - {2}", |
457 | userInfo.FirstName, userInfo.LastName, reportedException.Message); | 471 | userInfo.FirstName, userInfo.LastName, reportedException.Message); |
458 | } | 472 | } |
459 | } | 473 | } |
460 | 474 | ||
461 | /// <summary> | 475 | /// <summary> |
462 | /// Get user information for the given name. | 476 | /// Get user information for the given name. |
463 | /// </summary> | 477 | /// </summary> |
@@ -467,13 +481,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
467 | /// <returns></returns> | 481 | /// <returns></returns> |
468 | protected UserAccount GetUserInfo(string firstName, string lastName, string pass) | 482 | protected UserAccount GetUserInfo(string firstName, string lastName, string pass) |
469 | { | 483 | { |
470 | UserAccount account | 484 | UserAccount account |
471 | = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName); | 485 | = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName); |
472 | 486 | ||
473 | if (null == account) | 487 | if (null == account) |
474 | { | 488 | { |
475 | m_log.ErrorFormat( | 489 | m_log.ErrorFormat( |
476 | "[INVENTORY ARCHIVER]: Failed to find user info for {0} {1}", | 490 | "[INVENTORY ARCHIVER]: Failed to find user info for {0} {1}", |
477 | firstName, lastName); | 491 | firstName, lastName); |
478 | return null; | 492 | return null; |
479 | } | 493 | } |
@@ -488,7 +502,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
488 | else | 502 | else |
489 | { | 503 | { |
490 | m_log.ErrorFormat( | 504 | m_log.ErrorFormat( |
491 | "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.", | 505 | "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.", |
492 | firstName, lastName); | 506 | firstName, lastName); |
493 | return null; | 507 | return null; |
494 | } | 508 | } |
@@ -499,7 +513,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
499 | return null; | 513 | return null; |
500 | } | 514 | } |
501 | } | 515 | } |
502 | 516 | ||
503 | /// <summary> | 517 | /// <summary> |
504 | /// Notify the client of loaded nodes if they are logged in | 518 | /// Notify the client of loaded nodes if they are logged in |
505 | /// </summary> | 519 | /// </summary> |
@@ -508,22 +522,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
508 | { | 522 | { |
509 | if (loadedNodes.Count == 0) | 523 | if (loadedNodes.Count == 0) |
510 | return; | 524 | return; |
511 | 525 | ||
512 | foreach (Scene scene in m_scenes.Values) | 526 | foreach (Scene scene in m_scenes.Values) |
513 | { | 527 | { |
514 | ScenePresence user = scene.GetScenePresence(userInfo.PrincipalID); | 528 | ScenePresence user = scene.GetScenePresence(userInfo.PrincipalID); |
515 | 529 | ||
516 | if (user != null && !user.IsChildAgent) | 530 | if (user != null && !user.IsChildAgent) |
517 | { | 531 | { |
518 | foreach (InventoryNodeBase node in loadedNodes) | 532 | foreach (InventoryNodeBase node in loadedNodes) |
519 | { | 533 | { |
520 | // m_log.DebugFormat( | 534 | // m_log.DebugFormat( |
521 | // "[INVENTORY ARCHIVER]: Notifying {0} of loaded inventory node {1}", | 535 | // "[INVENTORY ARCHIVER]: Notifying {0} of loaded inventory node {1}", |
522 | // user.Name, node.Name); | 536 | // user.Name, node.Name); |
523 | 537 | ||
524 | user.ControllingClient.SendBulkUpdateInventory(node); | 538 | user.ControllingClient.SendBulkUpdateInventory(node); |
525 | } | 539 | } |
526 | 540 | ||
527 | break; | 541 | break; |
528 | } | 542 | } |
529 | } | 543 | } |
@@ -538,7 +552,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
538 | // { | 552 | // { |
539 | // if (DisablePresenceChecks) | 553 | // if (DisablePresenceChecks) |
540 | // return true; | 554 | // return true; |
541 | // | 555 | // |
542 | // foreach (Scene scene in m_scenes.Values) | 556 | // foreach (Scene scene in m_scenes.Values) |
543 | // { | 557 | // { |
544 | // ScenePresence p; | 558 | // ScenePresence p; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index 19ef571..90ae69d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs | |||
@@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
100 | // log4net.Config.XmlConfigurator.Configure(); | 100 | // log4net.Config.XmlConfigurator.Configure(); |
101 | 101 | ||
102 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 102 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
103 | Scene scene = SceneHelpers.SetupScene(); | 103 | Scene scene = new SceneHelpers().SetupScene(); |
104 | SceneHelpers.SetupSceneModules(scene, archiverModule); | 104 | SceneHelpers.SetupSceneModules(scene, archiverModule); |
105 | 105 | ||
106 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); | 106 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index e409c8e..b112b6d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
61 | SerialiserModule serialiserModule = new SerialiserModule(); | 61 | SerialiserModule serialiserModule = new SerialiserModule(); |
62 | m_archiverModule = new InventoryArchiverModule(); | 62 | m_archiverModule = new InventoryArchiverModule(); |
63 | 63 | ||
64 | m_scene = SceneHelpers.SetupScene(); | 64 | m_scene = new SceneHelpers().SetupScene(); |
65 | SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); | 65 | SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); |
66 | } | 66 | } |
67 | 67 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs index 417c20c..6eb3605 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs | |||
@@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
62 | 62 | ||
63 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 63 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
64 | 64 | ||
65 | Scene scene = SceneHelpers.SetupScene(); | 65 | Scene scene = new SceneHelpers().SetupScene(); |
66 | SceneHelpers.SetupSceneModules(scene, archiverModule); | 66 | SceneHelpers.SetupSceneModules(scene, archiverModule); |
67 | 67 | ||
68 | // Create user | 68 | // Create user |
@@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
179 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 179 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
180 | 180 | ||
181 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | 181 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene |
182 | Scene scene = SceneHelpers.SetupScene(); | 182 | Scene scene = new SceneHelpers().SetupScene(); |
183 | 183 | ||
184 | SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 184 | SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
185 | 185 | ||
@@ -222,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
222 | 222 | ||
223 | SerialiserModule serialiserModule = new SerialiserModule(); | 223 | SerialiserModule serialiserModule = new SerialiserModule(); |
224 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 224 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
225 | Scene scene = SceneHelpers.SetupScene(); | 225 | Scene scene = new SceneHelpers().SetupScene(); |
226 | SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 226 | SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
227 | 227 | ||
228 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password"); | 228 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password"); |
@@ -247,7 +247,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
247 | 247 | ||
248 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 248 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
249 | 249 | ||
250 | Scene scene = SceneHelpers.SetupScene(); | 250 | Scene scene = new SceneHelpers().SetupScene(); |
251 | SceneHelpers.SetupSceneModules(scene, archiverModule); | 251 | SceneHelpers.SetupSceneModules(scene, archiverModule); |
252 | 252 | ||
253 | // Create user | 253 | // Create user |
@@ -326,7 +326,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
326 | TestHelpers.InMethod(); | 326 | TestHelpers.InMethod(); |
327 | // log4net.Config.XmlConfigurator.Configure(); | 327 | // log4net.Config.XmlConfigurator.Configure(); |
328 | 328 | ||
329 | Scene scene = SceneHelpers.SetupScene(); | 329 | Scene scene = new SceneHelpers().SetupScene(); |
330 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); | 330 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); |
331 | 331 | ||
332 | Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); | 332 | Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); |
@@ -393,7 +393,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
393 | TestHelpers.InMethod(); | 393 | TestHelpers.InMethod(); |
394 | //log4net.Config.XmlConfigurator.Configure(); | 394 | //log4net.Config.XmlConfigurator.Configure(); |
395 | 395 | ||
396 | Scene scene = SceneHelpers.SetupScene(); | 396 | Scene scene = new SceneHelpers().SetupScene(); |
397 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); | 397 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); |
398 | 398 | ||
399 | string folder1ExistingName = "a"; | 399 | string folder1ExistingName = "a"; |
@@ -444,7 +444,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
444 | TestHelpers.InMethod(); | 444 | TestHelpers.InMethod(); |
445 | // log4net.Config.XmlConfigurator.Configure(); | 445 | // log4net.Config.XmlConfigurator.Configure(); |
446 | 446 | ||
447 | Scene scene = SceneHelpers.SetupScene(); | 447 | Scene scene = new SceneHelpers().SetupScene(); |
448 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); | 448 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); |
449 | 449 | ||
450 | string folder1ExistingName = "a"; | 450 | string folder1ExistingName = "a"; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs index bc5c1ff..92cf9d1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs | |||
@@ -240,13 +240,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
240 | { | 240 | { |
241 | ScenePresence sp = scene.GetScenePresence(client.AgentId); | 241 | ScenePresence sp = scene.GetScenePresence(client.AgentId); |
242 | IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>(); | 242 | IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>(); |
243 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | 243 | |
244 | if (transferMod != null && sp != null && eq != null) | 244 | if (transferMod != null && sp != null) |
245 | transferMod.DoTeleport(sp, gatekeeper, finalDestination, im.Position + new Vector3(0.5f, 0.5f, 0f), Vector3.UnitX, teleportflags, eq); | 245 | transferMod.DoTeleport( |
246 | sp, gatekeeper, finalDestination, im.Position + new Vector3(0.5f, 0.5f, 0f), | ||
247 | Vector3.UnitX, teleportflags); | ||
246 | } | 248 | } |
247 | } | 249 | } |
248 | } | 250 | } |
249 | } | 251 | } |
250 | } | 252 | } |
251 | } | 253 | } |
252 | } | 254 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index dcfdf8f..a889984 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | |||
@@ -151,6 +151,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
151 | Scene scene = (Scene)(client.Scene); | 151 | Scene scene = (Scene)(client.Scene); |
152 | ScenePresence presence = scene.GetScenePresence(client.AgentId); | 152 | ScenePresence presence = scene.GetScenePresence(client.AgentId); |
153 | 153 | ||
154 | // Round up Z co-ordinate rather than round-down by casting. This stops tall avatars from being given | ||
155 | // a teleport Z co-ordinate by short avatars that drops them through or embeds them in thin floors on | ||
156 | // arrival. | ||
157 | // | ||
158 | // Ideally we would give the exact float position adjusting for the relative height of the two avatars | ||
159 | // but it looks like a float component isn't possible with a parcel ID. | ||
154 | UUID dest = Util.BuildFakeParcelID( | 160 | UUID dest = Util.BuildFakeParcelID( |
155 | scene.RegionInfo.RegionHandle, | 161 | scene.RegionInfo.RegionHandle, |
156 | (uint)presence.AbsolutePosition.X, | 162 | (uint)presence.AbsolutePosition.X, |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 2b790f4..514a65b 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -30,7 +30,6 @@ using System.Collections.Generic; | |||
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | |||
34 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Capabilities; | 34 | using OpenSim.Framework.Capabilities; |
36 | using OpenSim.Framework.Client; | 35 | using OpenSim.Framework.Client; |
@@ -51,17 +50,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
51 | { | 50 | { |
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | 52 | ||
53 | public const int DefaultMaxTransferDistance = 4095; | ||
54 | public const bool EnableWaitForCallbackFromTeleportDestDefault = true; | ||
55 | |||
54 | /// <summary> | 56 | /// <summary> |
55 | /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. | 57 | /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. |
56 | /// </summary> | 58 | /// </summary> |
57 | private int m_MaxTransferDistance = 4095; | 59 | public int MaxTransferDistance { get; set; } |
58 | public int MaxTransferDistance | ||
59 | { | ||
60 | get { return m_MaxTransferDistance; } | ||
61 | set { m_MaxTransferDistance = value; } | ||
62 | } | ||
63 | 60 | ||
64 | private int m_levelHGTeleport = 0; | 61 | /// <summary> |
62 | /// If true then on a teleport, the source region waits for a callback from the destination region. If | ||
63 | /// a callback fails to arrive within a set time then the user is pulled back into the source region. | ||
64 | /// </summary> | ||
65 | public bool EnableWaitForCallbackFromTeleportDest { get; set; } | ||
65 | 66 | ||
66 | protected bool m_Enabled = false; | 67 | protected bool m_Enabled = false; |
67 | protected Scene m_aScene; | 68 | protected Scene m_aScene; |
@@ -105,8 +106,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
105 | IConfig transferConfig = source.Configs["EntityTransfer"]; | 106 | IConfig transferConfig = source.Configs["EntityTransfer"]; |
106 | if (transferConfig != null) | 107 | if (transferConfig != null) |
107 | { | 108 | { |
108 | MaxTransferDistance = transferConfig.GetInt("max_distance", 4095); | 109 | EnableWaitForCallbackFromTeleportDest |
109 | m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0); | 110 | = transferConfig.GetBoolean("wait_for_callback", EnableWaitForCallbackFromTeleportDestDefault); |
111 | |||
112 | MaxTransferDistance = transferConfig.GetInt("max_distance", DefaultMaxTransferDistance); | ||
113 | } | ||
114 | else | ||
115 | { | ||
116 | MaxTransferDistance = DefaultMaxTransferDistance; | ||
110 | } | 117 | } |
111 | 118 | ||
112 | m_agentsInTransit = new List<UUID>(); | 119 | m_agentsInTransit = new List<UUID>(); |
@@ -164,168 +171,235 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
164 | 171 | ||
165 | public void Teleport(ScenePresence sp, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags) | 172 | public void Teleport(ScenePresence sp, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags) |
166 | { | 173 | { |
174 | if (sp.Scene.Permissions.IsGridGod(sp.UUID)) | ||
175 | { | ||
176 | // This user will be a God in the destination scene, too | ||
177 | teleportFlags |= (uint)TeleportFlags.Godlike; | ||
178 | } | ||
179 | |||
167 | if (!sp.Scene.Permissions.CanTeleport(sp.UUID)) | 180 | if (!sp.Scene.Permissions.CanTeleport(sp.UUID)) |
168 | return; | 181 | return; |
169 | 182 | ||
170 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | ||
171 | |||
172 | // Reset animations; the viewer does that in teleports. | 183 | // Reset animations; the viewer does that in teleports. |
173 | sp.Animator.ResetAnimations(); | 184 | sp.Animator.ResetAnimations(); |
174 | 185 | ||
186 | string destinationRegionName = "(not found)"; | ||
187 | |||
175 | try | 188 | try |
176 | { | 189 | { |
177 | if (regionHandle == sp.Scene.RegionInfo.RegionHandle) | 190 | if (regionHandle == sp.Scene.RegionInfo.RegionHandle) |
178 | { | 191 | { |
179 | m_log.DebugFormat( | 192 | destinationRegionName = sp.Scene.RegionInfo.RegionName; |
180 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation {0} within {1}", | ||
181 | position, sp.Scene.RegionInfo.RegionName); | ||
182 | 193 | ||
183 | // Teleport within the same region | 194 | TeleportAgentWithinRegion(sp, position, lookAt, teleportFlags); |
184 | if (IsOutsideRegion(sp.Scene, position) || position.Z < 0) | 195 | } |
185 | { | 196 | else // Another region possibly in another simulator |
186 | Vector3 emergencyPos = new Vector3(128, 128, 128); | 197 | { |
198 | GridRegion finalDestination; | ||
199 | TeleportAgentToDifferentRegion( | ||
200 | sp, regionHandle, position, lookAt, teleportFlags, out finalDestination); | ||
187 | 201 | ||
188 | m_log.WarnFormat( | 202 | if (finalDestination != null) |
189 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", | 203 | destinationRegionName = finalDestination.RegionName; |
190 | position, sp.Name, sp.UUID, emergencyPos); | 204 | } |
191 | position = emergencyPos; | 205 | } |
192 | } | 206 | catch (Exception e) |
207 | { | ||
208 | m_log.ErrorFormat( | ||
209 | "[ENTITY TRANSFER MODULE]: Exception on teleport of {0} from {1}@{2} to {3}@{4}: {5}{6}", | ||
210 | sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName, | ||
211 | e.Message, e.StackTrace); | ||
193 | 212 | ||
194 | // TODO: Get proper AVG Height | 213 | // Make sure that we clear the in-transit flag so that future teleport attempts don't always fail. |
195 | float localAVHeight = 1.56f; | 214 | ResetFromTransit(sp.UUID); |
196 | float posZLimit = 22; | ||
197 | 215 | ||
198 | // TODO: Check other Scene HeightField | 216 | sp.ControllingClient.SendTeleportFailed("Internal error"); |
199 | if (position.X > 0 && position.X <= (int)Constants.RegionSize && position.Y > 0 && position.Y <= (int)Constants.RegionSize) | 217 | } |
200 | { | 218 | } |
201 | posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y]; | ||
202 | } | ||
203 | 219 | ||
204 | float newPosZ = posZLimit + localAVHeight; | 220 | /// <summary> |
205 | if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) | 221 | /// Teleports the agent within its current region. |
206 | { | 222 | /// </summary> |
207 | position.Z = newPosZ; | 223 | /// <param name="sp"></param> |
208 | } | 224 | /// <param name="position"></param> |
225 | /// <param name="lookAt"></param> | ||
226 | /// <param name="teleportFlags"></param | ||
227 | private void TeleportAgentWithinRegion(ScenePresence sp, Vector3 position, Vector3 lookAt, uint teleportFlags) | ||
228 | { | ||
229 | m_log.DebugFormat( | ||
230 | "[ENTITY TRANSFER MODULE]: Teleport for {0} to {1} within {2}", | ||
231 | sp.Name, position, sp.Scene.RegionInfo.RegionName); | ||
209 | 232 | ||
210 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 233 | // Teleport within the same region |
234 | if (IsOutsideRegion(sp.Scene, position) || position.Z < 0) | ||
235 | { | ||
236 | Vector3 emergencyPos = new Vector3(128, 128, 128); | ||
211 | 237 | ||
212 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 238 | m_log.WarnFormat( |
213 | sp.TeleportFlags = (Constants.TeleportFlags)teleportFlags; | 239 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", |
214 | sp.Teleport(position); | 240 | position, sp.Name, sp.UUID, emergencyPos); |
215 | 241 | ||
216 | foreach (SceneObjectGroup grp in sp.GetAttachments()) | 242 | position = emergencyPos; |
217 | { | 243 | } |
218 | sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT); | 244 | |
219 | } | 245 | // TODO: Get proper AVG Height |
246 | float localAVHeight = 1.56f; | ||
247 | float posZLimit = 22; | ||
248 | |||
249 | // TODO: Check other Scene HeightField | ||
250 | if (position.X > 0 && position.X <= (int)Constants.RegionSize && position.Y > 0 && position.Y <= (int)Constants.RegionSize) | ||
251 | { | ||
252 | posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y]; | ||
253 | } | ||
254 | |||
255 | float newPosZ = posZLimit + localAVHeight; | ||
256 | if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) | ||
257 | { | ||
258 | position.Z = newPosZ; | ||
259 | } | ||
260 | |||
261 | sp.ControllingClient.SendTeleportStart(teleportFlags); | ||
262 | |||
263 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | ||
264 | sp.TeleportFlags = (Constants.TeleportFlags)teleportFlags; | ||
265 | sp.Velocity = Vector3.Zero; | ||
266 | sp.Teleport(position); | ||
267 | |||
268 | foreach (SceneObjectGroup grp in sp.GetAttachments()) | ||
269 | { | ||
270 | sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT); | ||
271 | } | ||
272 | } | ||
273 | |||
274 | /// <summary> | ||
275 | /// Teleports the agent to a different region. | ||
276 | /// </summary> | ||
277 | /// <param name='sp'></param> | ||
278 | /// <param name='regionHandle'>/param> | ||
279 | /// <param name='position'></param> | ||
280 | /// <param name='lookAt'></param> | ||
281 | /// <param name='teleportFlags'></param> | ||
282 | /// <param name='finalDestination'></param> | ||
283 | private void TeleportAgentToDifferentRegion( | ||
284 | ScenePresence sp, ulong regionHandle, Vector3 position, | ||
285 | Vector3 lookAt, uint teleportFlags, out GridRegion finalDestination) | ||
286 | { | ||
287 | uint x = 0, y = 0; | ||
288 | Utils.LongToUInts(regionHandle, out x, out y); | ||
289 | GridRegion reg = m_aScene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y); | ||
290 | |||
291 | if (reg != null) | ||
292 | { | ||
293 | finalDestination = GetFinalDestination(reg); | ||
294 | |||
295 | if (finalDestination == null) | ||
296 | { | ||
297 | m_log.WarnFormat( | ||
298 | "[ENTITY TRANSFER MODULE]: Final destination is having problems. Unable to teleport {0} {1}", | ||
299 | sp.Name, sp.UUID); | ||
300 | |||
301 | sp.ControllingClient.SendTeleportFailed("Problem at destination"); | ||
302 | return; | ||
220 | } | 303 | } |
221 | else // Another region possibly in another simulator | 304 | |
305 | // Check that these are not the same coordinates | ||
306 | if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && | ||
307 | finalDestination.RegionLocY == sp.Scene.RegionInfo.RegionLocY) | ||
222 | { | 308 | { |
223 | uint x = 0, y = 0; | 309 | // Can't do. Viewer crashes |
224 | Utils.LongToUInts(regionHandle, out x, out y); | 310 | sp.ControllingClient.SendTeleportFailed("Space warp! You would crash. Move to a different region and try again."); |
225 | GridRegion reg = m_aScene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y); | 311 | return; |
312 | } | ||
226 | 313 | ||
227 | if (reg != null) | 314 | // |
228 | { | 315 | // This is it |
229 | GridRegion finalDestination = GetFinalDestination(reg); | 316 | // |
230 | if (finalDestination == null) | 317 | DoTeleport(sp, reg, finalDestination, position, lookAt, teleportFlags); |
231 | { | 318 | // |
232 | m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination is having problems. Unable to teleport agent."); | 319 | // |
233 | sp.ControllingClient.SendTeleportFailed("Problem at destination"); | 320 | // |
234 | return; | 321 | } |
235 | } | 322 | else |
323 | { | ||
324 | finalDestination = null; | ||
236 | 325 | ||
237 | // check if HyperGrid teleport is allowed, based on user level | 326 | // TP to a place that doesn't exist (anymore) |
238 | int flags = m_aScene.GridService.GetRegionFlags(sp.Scene.RegionInfo.ScopeID, reg.RegionID); | 327 | // Inform the viewer about that |
328 | sp.ControllingClient.SendTeleportFailed("The region you tried to teleport to doesn't exist anymore"); | ||
239 | 329 | ||
240 | if (((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) && (sp.UserLevel < m_levelHGTeleport)) | 330 | // and set the map-tile to '(Offline)' |
241 | { | 331 | uint regX, regY; |
242 | m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination link is non permitted hypergrid region. Unable to teleport agent."); | 332 | Utils.LongToUInts(regionHandle, out regX, out regY); |
243 | sp.ControllingClient.SendTeleportFailed("HyperGrid teleport not permitted"); | ||
244 | return; | ||
245 | } | ||
246 | 333 | ||
247 | uint curX = 0, curY = 0; | 334 | MapBlockData block = new MapBlockData(); |
248 | Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY); | 335 | block.X = (ushort)(regX / Constants.RegionSize); |
249 | int curCellX = (int)(curX / Constants.RegionSize); | 336 | block.Y = (ushort)(regY / Constants.RegionSize); |
250 | int curCellY = (int)(curY / Constants.RegionSize); | 337 | block.Access = 254; // == not there |
251 | int destCellX = (int)(finalDestination.RegionLocX / Constants.RegionSize); | ||
252 | int destCellY = (int)(finalDestination.RegionLocY / Constants.RegionSize); | ||
253 | 338 | ||
339 | List<MapBlockData> blocks = new List<MapBlockData>(); | ||
340 | blocks.Add(block); | ||
341 | sp.ControllingClient.SendMapBlock(blocks, 0); | ||
342 | } | ||
343 | } | ||
344 | |||
345 | /// <summary> | ||
346 | /// Determines whether this instance is within the max transfer distance. | ||
347 | /// </summary> | ||
348 | /// <param name="sourceRegion"></param> | ||
349 | /// <param name="destRegion"></param> | ||
350 | /// <returns> | ||
351 | /// <c>true</c> if this instance is within max transfer distance; otherwise, <c>false</c>. | ||
352 | /// </returns> | ||
353 | private bool IsWithinMaxTeleportDistance(RegionInfo sourceRegion, GridRegion destRegion) | ||
354 | { | ||
254 | // m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY); | 355 | // m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY); |
255 | // | 356 | // |
256 | // m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}", | 357 | // m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}", |
257 | // destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI); | 358 | // destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI); |
258 | 359 | ||
259 | // Check that these are not the same coordinates | 360 | // Insanely, RegionLoc on RegionInfo is the 256m map co-ord whilst GridRegion.RegionLoc is the raw meters position. |
260 | if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && | 361 | return Math.Abs(sourceRegion.RegionLocX - destRegion.RegionCoordX) <= MaxTransferDistance |
261 | finalDestination.RegionLocY == sp.Scene.RegionInfo.RegionLocY) | 362 | && Math.Abs(sourceRegion.RegionLocY - destRegion.RegionCoordY) <= MaxTransferDistance; |
262 | { | 363 | } |
263 | // Can't do. Viewer crashes | ||
264 | sp.ControllingClient.SendTeleportFailed("Space warp! You would crash. Move to a different region and try again."); | ||
265 | return; | ||
266 | } | ||
267 | 364 | ||
268 | if (Math.Abs(curCellX - destCellX) > MaxTransferDistance || Math.Abs(curCellY - destCellY) > MaxTransferDistance) | 365 | public void DoTeleport( |
269 | { | 366 | ScenePresence sp, GridRegion reg, GridRegion finalDestination, |
270 | sp.ControllingClient.SendTeleportFailed( | 367 | Vector3 position, Vector3 lookAt, uint teleportFlags) |
271 | string.Format( | 368 | { |
272 | "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way", | 369 | RegionInfo sourceRegion = sp.Scene.RegionInfo; |
273 | finalDestination.RegionName, destCellX, destCellY, | ||
274 | sp.Scene.RegionInfo.RegionName, curCellX, curCellY, | ||
275 | MaxTransferDistance)); | ||
276 | |||
277 | return; | ||
278 | } | ||
279 | 370 | ||
280 | // | 371 | if (!IsWithinMaxTeleportDistance(sourceRegion, finalDestination)) |
281 | // This is it | ||
282 | // | ||
283 | DoTeleport(sp, reg, finalDestination, position, lookAt, teleportFlags, eq); | ||
284 | // | ||
285 | // | ||
286 | // | ||
287 | } | ||
288 | else | ||
289 | { | ||
290 | // TP to a place that doesn't exist (anymore) | ||
291 | // Inform the viewer about that | ||
292 | sp.ControllingClient.SendTeleportFailed("The region you tried to teleport to doesn't exist anymore"); | ||
293 | |||
294 | // and set the map-tile to '(Offline)' | ||
295 | uint regX, regY; | ||
296 | Utils.LongToUInts(regionHandle, out regX, out regY); | ||
297 | |||
298 | MapBlockData block = new MapBlockData(); | ||
299 | block.X = (ushort)(regX / Constants.RegionSize); | ||
300 | block.Y = (ushort)(regY / Constants.RegionSize); | ||
301 | block.Access = 254; // == not there | ||
302 | |||
303 | List<MapBlockData> blocks = new List<MapBlockData>(); | ||
304 | blocks.Add(block); | ||
305 | sp.ControllingClient.SendMapBlock(blocks, 0); | ||
306 | } | ||
307 | } | ||
308 | } | ||
309 | catch (Exception e) | ||
310 | { | 372 | { |
311 | m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0} {1}", e.Message, e.StackTrace); | 373 | sp.ControllingClient.SendTeleportFailed( |
312 | sp.ControllingClient.SendTeleportFailed("Internal error"); | 374 | string.Format( |
375 | "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way", | ||
376 | finalDestination.RegionName, finalDestination.RegionCoordX, finalDestination.RegionCoordY, | ||
377 | sourceRegion.RegionName, sourceRegion.RegionLocX, sourceRegion.RegionLocY, | ||
378 | MaxTransferDistance)); | ||
379 | |||
380 | return; | ||
313 | } | 381 | } |
314 | } | ||
315 | 382 | ||
316 | public void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination, Vector3 position, Vector3 lookAt, uint teleportFlags, IEventQueue eq) | 383 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); |
317 | { | 384 | |
318 | if (reg == null || finalDestination == null) | 385 | if (reg == null || finalDestination == null) |
319 | { | 386 | { |
320 | sp.ControllingClient.SendTeleportFailed("Unable to locate destination"); | 387 | sp.ControllingClient.SendTeleportFailed("Unable to locate destination"); |
321 | return; | 388 | return; |
322 | } | 389 | } |
323 | 390 | ||
324 | if (IsInTransit(sp.UUID)) // Avie is already on the way. Caller shouldn't do this. | 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 | |||
325 | return; | 397 | return; |
398 | } | ||
326 | 399 | ||
327 | m_log.DebugFormat( | 400 | m_log.DebugFormat( |
328 | "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}", | 401 | "[ENTITY TRANSFER MODULE]: Teleporting {0} {1} from {2} to {3} ({4}) {5}/{6}", |
402 | sp.Name, sp.UUID, sp.Scene.RegionInfo.RegionName, | ||
329 | reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); | 403 | reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); |
330 | 404 | ||
331 | uint newRegionX = (uint)(reg.RegionHandle >> 40); | 405 | uint newRegionX = (uint)(reg.RegionHandle >> 40); |
@@ -362,8 +436,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
362 | if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason)) | 436 | if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason)) |
363 | { | 437 | { |
364 | sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason); | 438 | sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason); |
439 | ResetFromTransit(sp.UUID); | ||
440 | |||
365 | return; | 441 | return; |
366 | } | 442 | } |
443 | |||
367 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version); | 444 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version); |
368 | 445 | ||
369 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 446 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
@@ -403,13 +480,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
403 | bool logout = false; | 480 | bool logout = false; |
404 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) | 481 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) |
405 | { | 482 | { |
406 | sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", | 483 | sp.ControllingClient.SendTeleportFailed( |
407 | reason)); | 484 | String.Format("Teleport refused: {0}", reason)); |
485 | ResetFromTransit(sp.UUID); | ||
486 | |||
408 | return; | 487 | return; |
409 | } | 488 | } |
410 | 489 | ||
411 | // OK, it got this agent. Let's close some child agents | 490 | // OK, it got this agent. Let's close some child agents |
412 | sp.CloseChildAgents(newRegionX, newRegionY); | 491 | sp.CloseChildAgents(newRegionX, newRegionY); |
492 | |||
413 | IClientIPEndpoint ipepClient; | 493 | IClientIPEndpoint ipepClient; |
414 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) | 494 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) |
415 | { | 495 | { |
@@ -446,9 +526,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
446 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | 526 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); |
447 | } | 527 | } |
448 | 528 | ||
449 | |||
450 | SetInTransit(sp.UUID); | ||
451 | |||
452 | // Let's send a full update of the agent. This is a synchronous call. | 529 | // Let's send a full update of the agent. This is a synchronous call. |
453 | AgentData agent = new AgentData(); | 530 | AgentData agent = new AgentData(); |
454 | sp.CopyTo(agent); | 531 | sp.CopyTo(agent); |
@@ -461,8 +538,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
461 | { | 538 | { |
462 | // Region doesn't take it | 539 | // Region doesn't take it |
463 | m_log.WarnFormat( | 540 | m_log.WarnFormat( |
464 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Returning avatar to source region.", | 541 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Returning avatar to source region.", |
465 | sp.Name, finalDestination.RegionName); | 542 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); |
466 | 543 | ||
467 | Fail(sp, finalDestination, logout); | 544 | Fail(sp, finalDestination, logout); |
468 | return; | 545 | return; |
@@ -471,7 +548,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
471 | sp.ControllingClient.SendTeleportProgress(teleportFlags | (uint)TeleportFlags.DisableCancel, "sending_dest"); | 548 | sp.ControllingClient.SendTeleportProgress(teleportFlags | (uint)TeleportFlags.DisableCancel, "sending_dest"); |
472 | 549 | ||
473 | m_log.DebugFormat( | 550 | m_log.DebugFormat( |
474 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID); | 551 | "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} from {1} to {2}", |
552 | capsPath, sp.Scene.RegionInfo.RegionName, sp.Name); | ||
475 | 553 | ||
476 | if (eq != null) | 554 | if (eq != null) |
477 | { | 555 | { |
@@ -490,11 +568,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
490 | // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which | 568 | // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which |
491 | // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation | 569 | // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation |
492 | // that the client contacted the destination before we close things here. | 570 | // that the client contacted the destination before we close things here. |
493 | if (!WaitForCallback(sp.UUID)) | 571 | if (EnableWaitForCallbackFromTeleportDest && !WaitForCallback(sp.UUID)) |
494 | { | 572 | { |
495 | m_log.WarnFormat( | 573 | m_log.WarnFormat( |
496 | "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} failed due to no callback from destination region. Returning avatar to source region.", | 574 | "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.", |
497 | sp.Name, finalDestination.RegionName); | 575 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); |
498 | 576 | ||
499 | Fail(sp, finalDestination, logout); | 577 | Fail(sp, finalDestination, logout); |
500 | return; | 578 | return; |
@@ -523,7 +601,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
523 | 601 | ||
524 | if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 602 | if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) |
525 | { | 603 | { |
526 | Thread.Sleep(5000); | 604 | // We need to delay here because Imprudence viewers, unlike v1 or v3, have a short (<200ms, <500ms) delay before |
605 | // they regard the new region as the current region after receiving the AgentMovementComplete | ||
606 | // response. If close is sent before then, it will cause the viewer to quit instead. | ||
607 | // However, if this delay is longer, then a viewer can teleport back to this region and experience | ||
608 | // a failure because the old ScenePresence has not yet been cleaned up. | ||
609 | Thread.Sleep(2000); | ||
610 | |||
527 | sp.Close(); | 611 | sp.Close(); |
528 | sp.Scene.IncomingCloseAgent(sp.UUID); | 612 | sp.Scene.IncomingCloseAgent(sp.UUID); |
529 | } | 613 | } |
@@ -584,13 +668,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
584 | protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) | 668 | protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) |
585 | { | 669 | { |
586 | agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; | 670 | agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; |
587 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Set callback URL to {0}", agent.CallbackURI); | ||
588 | 671 | ||
672 | m_log.DebugFormat( | ||
673 | "[ENTITY TRANSFER MODULE]: Set release callback URL to {0} in {1}", | ||
674 | agent.CallbackURI, region.RegionName); | ||
589 | } | 675 | } |
590 | 676 | ||
591 | protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) | 677 | protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) |
592 | { | 678 | { |
593 | sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true); | 679 | if (sp.Scene.AttachmentsModule != null) |
680 | sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true); | ||
594 | } | 681 | } |
595 | 682 | ||
596 | protected void KillEntity(Scene scene, uint localID) | 683 | protected void KillEntity(Scene scene, uint localID) |
@@ -615,7 +702,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
615 | 702 | ||
616 | protected virtual bool IsOutsideRegion(Scene s, Vector3 pos) | 703 | protected virtual bool IsOutsideRegion(Scene s, Vector3 pos) |
617 | { | 704 | { |
618 | |||
619 | if (s.TestBorderCross(pos, Cardinals.N)) | 705 | if (s.TestBorderCross(pos, Cardinals.N)) |
620 | return true; | 706 | return true; |
621 | if (s.TestBorderCross(pos, Cardinals.S)) | 707 | if (s.TestBorderCross(pos, Cardinals.S)) |
@@ -663,7 +749,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
663 | 749 | ||
664 | public virtual bool TeleportHome(UUID id, IClientAPI client) | 750 | public virtual bool TeleportHome(UUID id, IClientAPI client) |
665 | { | 751 | { |
666 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 752 | m_log.DebugFormat( |
753 | "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId); | ||
667 | 754 | ||
668 | //OpenSim.Services.Interfaces.PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(client.SessionId); | 755 | //OpenSim.Services.Interfaces.PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(client.SessionId); |
669 | GridUserInfo uinfo = m_aScene.GridUserService.GetGridUserInfo(client.AgentId.ToString()); | 756 | GridUserInfo uinfo = m_aScene.GridUserService.GetGridUserInfo(client.AgentId.ToString()); |
@@ -684,8 +771,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
684 | return false; | 771 | return false; |
685 | } | 772 | } |
686 | 773 | ||
687 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", | 774 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Home region of {0} is {1} ({2}-{3})", |
688 | regionInfo.RegionName, regionInfo.RegionID, regionInfo.RegionLocX / Constants.RegionSize, regionInfo.RegionLocY / Constants.RegionSize); | 775 | client.Name, regionInfo.RegionName, regionInfo.RegionCoordX, regionInfo.RegionCoordY); |
689 | 776 | ||
690 | // a little eekie that this goes back to Scene and with a forced cast, will fix that at some point... | 777 | // a little eekie that this goes back to Scene and with a forced cast, will fix that at some point... |
691 | ((Scene)(client.Scene)).RequestTeleportLocation( | 778 | ((Scene)(client.Scene)).RequestTeleportLocation( |
@@ -736,7 +823,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
736 | 823 | ||
737 | neighbourx--; | 824 | neighbourx--; |
738 | newpos.X = Constants.RegionSize - enterDistance; | 825 | newpos.X = Constants.RegionSize - enterDistance; |
739 | |||
740 | } | 826 | } |
741 | else if (scene.TestBorderCross(pos + eastCross, Cardinals.E)) | 827 | else if (scene.TestBorderCross(pos + eastCross, Cardinals.E)) |
742 | { | 828 | { |
@@ -1186,7 +1272,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1186 | { | 1272 | { |
1187 | if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) | 1273 | if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) |
1188 | { | 1274 | { |
1189 | |||
1190 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 1275 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
1191 | AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); | 1276 | AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); |
1192 | agent.BaseFolder = UUID.Zero; | 1277 | agent.BaseFolder = UUID.Zero; |
@@ -1211,7 +1296,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1211 | seeds.Add(neighbour.RegionHandle, agent.CapsPath); | 1296 | seeds.Add(neighbour.RegionHandle, agent.CapsPath); |
1212 | } | 1297 | } |
1213 | else | 1298 | else |
1299 | { | ||
1214 | agent.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, neighbour.RegionHandle); | 1300 | agent.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, neighbour.RegionHandle); |
1301 | } | ||
1215 | 1302 | ||
1216 | cagents.Add(agent); | 1303 | cagents.Add(agent); |
1217 | } | 1304 | } |
@@ -1322,19 +1409,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1322 | // after a cross here | 1409 | // after a cross here |
1323 | Thread.Sleep(500); | 1410 | Thread.Sleep(500); |
1324 | 1411 | ||
1325 | Scene m_scene = sp.Scene; | 1412 | Scene scene = sp.Scene; |
1326 | 1413 | ||
1327 | uint x, y; | 1414 | m_log.DebugFormat( |
1328 | Utils.LongToUInts(reg.RegionHandle, out x, out y); | 1415 | "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", |
1329 | x = x / Constants.RegionSize; | 1416 | sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY); |
1330 | y = y / Constants.RegionSize; | ||
1331 | m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint + ")"); | ||
1332 | 1417 | ||
1333 | string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); | 1418 | string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); |
1334 | 1419 | ||
1335 | string reason = String.Empty; | 1420 | string reason = String.Empty; |
1336 | 1421 | ||
1337 | bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); | 1422 | bool regionAccepted = scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); |
1338 | 1423 | ||
1339 | if (regionAccepted && newAgent) | 1424 | if (regionAccepted && newAgent) |
1340 | { | 1425 | { |
@@ -1351,7 +1436,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1351 | 1436 | ||
1352 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} is sending {1} EnableSimulator for neighbour region {2} @ {3} " + | 1437 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} is sending {1} EnableSimulator for neighbour region {2} @ {3} " + |
1353 | "and EstablishAgentCommunication with seed cap {4}", | 1438 | "and EstablishAgentCommunication with seed cap {4}", |
1354 | m_scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath); | 1439 | scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath); |
1355 | 1440 | ||
1356 | eq.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID); | 1441 | eq.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID); |
1357 | eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); | 1442 | eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); |
@@ -1362,8 +1447,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1362 | // TODO: make Event Queue disablable! | 1447 | // TODO: make Event Queue disablable! |
1363 | } | 1448 | } |
1364 | 1449 | ||
1365 | m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); | 1450 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Completed inform {0} {1} about neighbour {2}", sp.Name, sp.UUID, endPoint); |
1366 | } | 1451 | } |
1452 | |||
1453 | if (!regionAccepted) | ||
1454 | m_log.WarnFormat( | ||
1455 | "[ENTITY TRANSFER MODULE]: Region {0} did not accept {1} {2}: {3}", | ||
1456 | reg.RegionName, sp.Name, sp.UUID, reason); | ||
1367 | } | 1457 | } |
1368 | 1458 | ||
1369 | /// <summary> | 1459 | /// <summary> |
@@ -1832,35 +1922,50 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1832 | int count = 200; | 1922 | int count = 200; |
1833 | while (m_agentsInTransit.Contains(id) && count-- > 0) | 1923 | while (m_agentsInTransit.Contains(id) && count-- > 0) |
1834 | { | 1924 | { |
1835 | //m_log.Debug(" >>> Waiting... " + count); | 1925 | // m_log.Debug(" >>> Waiting... " + count); |
1836 | Thread.Sleep(100); | 1926 | Thread.Sleep(100); |
1837 | } | 1927 | } |
1838 | 1928 | ||
1839 | if (count > 0) | 1929 | return count > 0; |
1840 | return true; | ||
1841 | else | ||
1842 | return false; | ||
1843 | } | 1930 | } |
1844 | 1931 | ||
1845 | protected void SetInTransit(UUID id) | 1932 | /// <summary> |
1933 | /// Set that an agent is in the process of being teleported. | ||
1934 | /// </summary> | ||
1935 | /// <param name='id'>The ID of the agent being teleported</param> | ||
1936 | /// <returns>true if the agent was not already in transit, false if it was</returns> | ||
1937 | protected bool SetInTransit(UUID id) | ||
1846 | { | 1938 | { |
1847 | lock (m_agentsInTransit) | 1939 | lock (m_agentsInTransit) |
1848 | { | 1940 | { |
1849 | if (!m_agentsInTransit.Contains(id)) | 1941 | if (!m_agentsInTransit.Contains(id)) |
1942 | { | ||
1850 | m_agentsInTransit.Add(id); | 1943 | m_agentsInTransit.Add(id); |
1944 | return true; | ||
1945 | } | ||
1851 | } | 1946 | } |
1947 | |||
1948 | return false; | ||
1852 | } | 1949 | } |
1853 | 1950 | ||
1951 | /// <summary> | ||
1952 | /// Show whether the given agent is being teleported. | ||
1953 | /// </summary> | ||
1954 | /// <returns>true if the agent is in the process of being teleported, false otherwise.</returns> | ||
1955 | /// <param name='id'>The agent ID</para></param> | ||
1854 | protected bool IsInTransit(UUID id) | 1956 | protected bool IsInTransit(UUID id) |
1855 | { | 1957 | { |
1856 | lock (m_agentsInTransit) | 1958 | lock (m_agentsInTransit) |
1857 | { | 1959 | return m_agentsInTransit.Contains(id); |
1858 | if (m_agentsInTransit.Contains(id)) | ||
1859 | return true; | ||
1860 | } | ||
1861 | return false; | ||
1862 | } | 1960 | } |
1863 | 1961 | ||
1962 | /// <summary> | ||
1963 | /// Set that an agent is no longer being teleported. | ||
1964 | /// </summary> | ||
1965 | /// <returns></returns> | ||
1966 | /// <param name='id'> | ||
1967 | /// true if the agent was flagged as being teleported when this method was called, false otherwise | ||
1968 | /// </param> | ||
1864 | protected bool ResetFromTransit(UUID id) | 1969 | protected bool ResetFromTransit(UUID id) |
1865 | { | 1970 | { |
1866 | lock (m_agentsInTransit) | 1971 | lock (m_agentsInTransit) |
@@ -1871,6 +1976,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1871 | return true; | 1976 | return true; |
1872 | } | 1977 | } |
1873 | } | 1978 | } |
1979 | |||
1874 | return false; | 1980 | return false; |
1875 | } | 1981 | } |
1876 | 1982 | ||
@@ -1901,4 +2007,4 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1901 | #endregion | 2007 | #endregion |
1902 | 2008 | ||
1903 | } | 2009 | } |
1904 | } | 2010 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 8b5ad23..6e27299 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -50,6 +50,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
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 bool m_Initialized = false; | 52 | private bool m_Initialized = false; |
53 | private int m_levelHGTeleport = 0; | ||
53 | 54 | ||
54 | private GatekeeperServiceConnector m_GatekeeperConnector; | 55 | private GatekeeperServiceConnector m_GatekeeperConnector; |
55 | 56 | ||
@@ -68,6 +69,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
68 | string name = moduleConfig.GetString("EntityTransferModule", ""); | 69 | string name = moduleConfig.GetString("EntityTransferModule", ""); |
69 | if (name == Name) | 70 | if (name == Name) |
70 | { | 71 | { |
72 | IConfig transferConfig = source.Configs["EntityTransfer"]; | ||
73 | if (transferConfig != null) | ||
74 | m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0); | ||
75 | |||
71 | InitialiseCommon(source); | 76 | InitialiseCommon(source); |
72 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); | 77 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); |
73 | } | 78 | } |
@@ -164,6 +169,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
164 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) | 169 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) |
165 | { | 170 | { |
166 | // this user is going to another grid | 171 | // this user is going to another grid |
172 | // check if HyperGrid teleport is allowed, based on user level | ||
173 | if (sp.UserLevel < m_levelHGTeleport) | ||
174 | { | ||
175 | m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel."); | ||
176 | reason = "Hypergrid teleport not allowed"; | ||
177 | return false; | ||
178 | } | ||
179 | |||
167 | if (agentCircuit.ServiceURLs.ContainsKey("HomeURI")) | 180 | if (agentCircuit.ServiceURLs.ContainsKey("HomeURI")) |
168 | { | 181 | { |
169 | string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); | 182 | string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); |
@@ -193,7 +206,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
193 | 206 | ||
194 | public override bool TeleportHome(UUID id, IClientAPI client) | 207 | public override bool TeleportHome(UUID id, IClientAPI client) |
195 | { | 208 | { |
196 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 209 | m_log.DebugFormat( |
210 | "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId); | ||
197 | 211 | ||
198 | // Let's find out if this is a foreign user or a local user | 212 | // Let's find out if this is a foreign user or a local user |
199 | IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>(); | 213 | IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>(); |
@@ -232,13 +246,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
232 | return false; | 246 | return false; |
233 | } | 247 | } |
234 | 248 | ||
235 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | ||
236 | GridRegion homeGatekeeper = MakeRegion(aCircuit); | 249 | GridRegion homeGatekeeper = MakeRegion(aCircuit); |
237 | 250 | ||
238 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}", | 251 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}", |
239 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ServerURI, homeGatekeeper.RegionName); | 252 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ServerURI, homeGatekeeper.RegionName); |
240 | 253 | ||
241 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); | 254 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); |
242 | return true; | 255 | return true; |
243 | } | 256 | } |
244 | 257 | ||
@@ -279,17 +292,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
279 | { | 292 | { |
280 | ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId); | 293 | ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId); |
281 | IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>(); | 294 | IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>(); |
282 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | 295 | |
283 | if (transferMod != null && sp != null && eq != null) | 296 | if (transferMod != null && sp != null) |
284 | transferMod.DoTeleport(sp, gatekeeper, finalDestination, lm.Position, | 297 | transferMod.DoTeleport( |
285 | Vector3.UnitX, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark), eq); | 298 | sp, gatekeeper, finalDestination, lm.Position, Vector3.UnitX, |
299 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); | ||
286 | } | 300 | } |
287 | 301 | ||
288 | } | 302 | } |
289 | 303 | ||
290 | // can't find the region: Tell viewer and abort | 304 | // can't find the region: Tell viewer and abort |
291 | remoteClient.SendTeleportFailed("The teleport destination could not be found."); | 305 | remoteClient.SendTeleportFailed("The teleport destination could not be found."); |
292 | |||
293 | } | 306 | } |
294 | 307 | ||
295 | #endregion | 308 | #endregion |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index e74310c..21d8bd7 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs | |||
@@ -64,8 +64,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests | |||
64 | IConfigSource config = new IniConfigSource(); | 64 | IConfigSource config = new IniConfigSource(); |
65 | config.AddConfig("Modules"); | 65 | config.AddConfig("Modules"); |
66 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | 66 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); |
67 | 67 | ||
68 | m_scene = SceneHelpers.SetupScene(); | 68 | SceneHelpers sceneHelpers = new SceneHelpers(); |
69 | m_scene = sceneHelpers.SetupScene(); | ||
69 | SceneHelpers.SetupSceneModules(m_scene, config, m_iam); | 70 | SceneHelpers.SetupSceneModules(m_scene, config, m_iam); |
70 | 71 | ||
71 | // Create user | 72 | // Create user |
@@ -76,7 +77,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests | |||
76 | 77 | ||
77 | AgentCircuitData acd = new AgentCircuitData(); | 78 | AgentCircuitData acd = new AgentCircuitData(); |
78 | acd.AgentID = m_userId; | 79 | acd.AgentID = m_userId; |
79 | m_tc = new TestClient(acd, m_scene); | 80 | m_tc = new TestClient(acd, m_scene); |
80 | } | 81 | } |
81 | 82 | ||
82 | [Test] | 83 | [Test] |
diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs index 9255791..e91e8b9 100644 --- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs | |||
@@ -64,6 +64,8 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules | |||
64 | private TimeSpan m_QueueTimeout = new TimeSpan(2, 0, 0); // 2 hours without llGetNextEmail drops the queue | 64 | private TimeSpan m_QueueTimeout = new TimeSpan(2, 0, 0); // 2 hours without llGetNextEmail drops the queue |
65 | private string m_InterObjectHostname = "lsl.opensim.local"; | 65 | private string m_InterObjectHostname = "lsl.opensim.local"; |
66 | 66 | ||
67 | private int m_MaxEmailSize = 4096; // largest email allowed by default, as per lsl docs. | ||
68 | |||
67 | // Scenes by Region Handle | 69 | // Scenes by Region Handle |
68 | private Dictionary<ulong, Scene> m_Scenes = | 70 | private Dictionary<ulong, Scene> m_Scenes = |
69 | new Dictionary<ulong, Scene>(); | 71 | new Dictionary<ulong, Scene>(); |
@@ -127,6 +129,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules | |||
127 | SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT); | 129 | SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT); |
128 | SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN); | 130 | SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN); |
129 | SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD); | 131 | SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD); |
132 | m_MaxEmailSize = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize); | ||
130 | } | 133 | } |
131 | catch (Exception e) | 134 | catch (Exception e) |
132 | { | 135 | { |
@@ -176,18 +179,6 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules | |||
176 | get { return true; } | 179 | get { return true; } |
177 | } | 180 | } |
178 | 181 | ||
179 | /// <summary> | ||
180 | /// Delay function using thread in seconds | ||
181 | /// </summary> | ||
182 | /// <param name="seconds"></param> | ||
183 | private void DelayInSeconds(int delay) | ||
184 | { | ||
185 | delay = (int)((float)delay * 1000); | ||
186 | if (delay == 0) | ||
187 | return; | ||
188 | System.Threading.Thread.Sleep(delay); | ||
189 | } | ||
190 | |||
191 | private bool IsLocal(UUID objectID) | 182 | private bool IsLocal(UUID objectID) |
192 | { | 183 | { |
193 | string unused; | 184 | string unused; |
@@ -267,10 +258,9 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules | |||
267 | m_log.Error("[EMAIL] REGEX Problem in EMail Address: "+address); | 258 | m_log.Error("[EMAIL] REGEX Problem in EMail Address: "+address); |
268 | return; | 259 | return; |
269 | } | 260 | } |
270 | //FIXME:Check if subject + body = 4096 Byte | 261 | if ((subject.Length + body.Length) > m_MaxEmailSize) |
271 | if ((subject.Length + body.Length) > 1024) | ||
272 | { | 262 | { |
273 | m_log.Error("[EMAIL] subject + body > 1024 Byte"); | 263 | m_log.Error("[EMAIL] subject + body larger than limit of " + m_MaxEmailSize + " bytes"); |
274 | return; | 264 | return; |
275 | } | 265 | } |
276 | 266 | ||
@@ -345,10 +335,6 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules | |||
345 | // TODO FIX | 335 | // TODO FIX |
346 | } | 336 | } |
347 | } | 337 | } |
348 | |||
349 | //DONE: Message as Second Life style | ||
350 | //20 second delay - AntiSpam System - for now only 10 seconds | ||
351 | DelayInSeconds(10); | ||
352 | } | 338 | } |
353 | 339 | ||
354 | /// <summary> | 340 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index f4cf6b4..199dd11 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -147,6 +147,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
147 | public void Close() | 147 | public void Close() |
148 | { | 148 | { |
149 | } | 149 | } |
150 | |||
150 | public UUID RequestURL(IScriptModule engine, SceneObjectPart host, UUID itemID) | 151 | public UUID RequestURL(IScriptModule engine, SceneObjectPart host, UUID itemID) |
151 | { | 152 | { |
152 | UUID urlcode = UUID.Random(); | 153 | UUID urlcode = UUID.Random(); |
@@ -176,6 +177,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
176 | uri, | 177 | uri, |
177 | new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode)); | 178 | new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode)); |
178 | 179 | ||
180 | m_log.DebugFormat( | ||
181 | "[URL MODULE]: Set up incoming request url {0} for {1} in {2} {3}", | ||
182 | uri, itemID, host.Name, host.LocalId); | ||
183 | |||
179 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); | 184 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); |
180 | } | 185 | } |
181 | 186 | ||
@@ -218,6 +223,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
218 | uri, | 223 | uri, |
219 | new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode)); | 224 | new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode)); |
220 | 225 | ||
226 | m_log.DebugFormat( | ||
227 | "[URL MODULE]: Set up incoming secure request url {0} for {1} in {2} {3}", | ||
228 | uri, itemID, host.Name, host.LocalId); | ||
229 | |||
221 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); | 230 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); |
222 | } | 231 | } |
223 | 232 | ||
@@ -241,6 +250,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
241 | m_RequestMap.Remove(req); | 250 | m_RequestMap.Remove(req); |
242 | } | 251 | } |
243 | 252 | ||
253 | // m_log.DebugFormat( | ||
254 | // "[URL MODULE]: Releasing url {0} for {1} in {2}", | ||
255 | // url, data.itemID, data.hostID); | ||
256 | |||
244 | RemoveUrl(data); | 257 | RemoveUrl(data); |
245 | m_UrlMap.Remove(url); | 258 | m_UrlMap.Remove(url); |
246 | } | 259 | } |
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 176c86d..8358bc0 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -308,56 +308,56 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
308 | /// <param name='msg'> | 308 | /// <param name='msg'> |
309 | /// Message. | 309 | /// Message. |
310 | /// </param> | 310 | /// </param> |
311 | public bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error) | 311 | public void DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg) |
312 | { | 312 | { |
313 | error = null; | ||
314 | // Is id an avatar? | 313 | // Is id an avatar? |
315 | ScenePresence sp = m_scene.GetScenePresence(target); | 314 | ScenePresence sp = m_scene.GetScenePresence(target); |
316 | 315 | ||
317 | if (sp != null) | 316 | if (sp != null) |
318 | { | 317 | { |
319 | // Send message to avatar | 318 | // ignore if a child agent this is restricted to inside one region |
319 | if (sp.IsChildAgent) | ||
320 | return; | ||
321 | |||
322 | // Send message to the avatar. | ||
323 | // Channel zero only goes to the avatar | ||
324 | // non zero channel messages only go to the attachments | ||
320 | if (channel == 0) | 325 | if (channel == 0) |
321 | { | 326 | { |
322 | m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, false); | 327 | m_scene.SimChatToAgent(target, Utils.StringToBytes(msg), pos, name, id, false); |
323 | } | 328 | } |
324 | 329 | else | |
325 | List<SceneObjectGroup> attachments = sp.GetAttachments(); | ||
326 | |||
327 | if (attachments.Count == 0) | ||
328 | return true; | ||
329 | |||
330 | // Get uuid of attachments | ||
331 | List<UUID> targets = new List<UUID>(); | ||
332 | foreach (SceneObjectGroup sog in attachments) | ||
333 | { | 330 | { |
334 | if (!sog.IsDeleted) | 331 | List<SceneObjectGroup> attachments = sp.GetAttachments(); |
335 | targets.Add(sog.UUID); | 332 | if (attachments.Count == 0) |
336 | } | 333 | return; |
337 | 334 | ||
338 | // Need to check each attachment | 335 | // Get uuid of attachments |
339 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | 336 | List<UUID> targets = new List<UUID>(); |
340 | { | 337 | foreach (SceneObjectGroup sog in attachments) |
341 | if (li.GetHostID().Equals(id)) | 338 | { |
342 | continue; | 339 | if (!sog.IsDeleted) |
340 | targets.Add(sog.UUID); | ||
341 | } | ||
343 | 342 | ||
344 | if (m_scene.GetSceneObjectPart(li.GetHostID()) == null) | 343 | // Need to check each attachment |
345 | continue; | 344 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) |
345 | { | ||
346 | if (li.GetHostID().Equals(id)) | ||
347 | continue; | ||
346 | 348 | ||
347 | if (targets.Contains(li.GetHostID())) | 349 | if (m_scene.GetSceneObjectPart(li.GetHostID()) == null) |
348 | QueueMessage(new ListenerInfo(li, name, id, msg)); | 350 | continue; |
349 | } | ||
350 | 351 | ||
351 | return true; | 352 | if (targets.Contains(li.GetHostID())) |
352 | } | 353 | QueueMessage(new ListenerInfo(li, name, id, msg)); |
354 | } | ||
355 | } | ||
353 | 356 | ||
354 | // Need to toss an error here | 357 | return; |
355 | if (channel == 0) | ||
356 | { | ||
357 | error = "Cannot use llRegionSayTo to message objects on channel 0"; | ||
358 | return false; | ||
359 | } | 358 | } |
360 | 359 | ||
360 | // No avatar found so look for an object | ||
361 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | 361 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) |
362 | { | 362 | { |
363 | // Dont process if this message is from yourself! | 363 | // Dont process if this message is from yourself! |
@@ -375,7 +375,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
375 | } | 375 | } |
376 | } | 376 | } |
377 | 377 | ||
378 | return true; | 378 | return; |
379 | } | 379 | } |
380 | 380 | ||
381 | protected void QueueMessage(ListenerInfo li) | 381 | protected void QueueMessage(ListenerInfo li) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs index f0d21e6..4470799 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
55 | MethodBase.GetCurrentMethod().DeclaringType); | 55 | MethodBase.GetCurrentMethod().DeclaringType); |
56 | 56 | ||
57 | private IUserManagement m_UserManagement; | 57 | private IUserManagement m_UserManagement; |
58 | private IGridService m_GridService; | 58 | // private IGridService m_GridService; |
59 | 59 | ||
60 | private Scene m_Scene; | 60 | private Scene m_Scene; |
61 | AccessFlags m_accessValue = AccessFlags.None; | 61 | AccessFlags m_accessValue = AccessFlags.None; |
@@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
65 | { | 65 | { |
66 | m_Scene = scene; | 66 | m_Scene = scene; |
67 | m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); | 67 | m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); |
68 | m_GridService = scene.GridService; | 68 | // m_GridService = scene.GridService; |
69 | 69 | ||
70 | if (config != null) | 70 | if (config != null) |
71 | { | 71 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs index 3b862da..6cd077a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs | |||
@@ -149,9 +149,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage | |||
149 | lock (m_scenes) | 149 | lock (m_scenes) |
150 | m_scenes[scene.RegionInfo.RegionID] = scene; | 150 | m_scenes[scene.RegionInfo.RegionID] = scene; |
151 | 151 | ||
152 | scene.EventManager.OnPrimsLoaded += new EventManager.PrimsLoaded(EventManager_OnPrimsLoaded); | 152 | scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; |
153 | } | 153 | } |
154 | 154 | ||
155 | |||
155 | ///<summary> | 156 | ///<summary> |
156 | /// | 157 | /// |
157 | ///</summary> | 158 | ///</summary> |
@@ -166,9 +167,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage | |||
166 | 167 | ||
167 | #endregion ISharedRegionModule | 168 | #endregion ISharedRegionModule |
168 | 169 | ||
169 | void EventManager_OnPrimsLoaded(Scene s) | 170 | void OnLoginsEnabled(string regionName) |
170 | { | 171 | { |
171 | UploadMapTile(s); | 172 | Scene scene = null; |
173 | foreach (Scene s in m_scenes.Values) | ||
174 | if (s.RegionInfo.RegionName == regionName) | ||
175 | { | ||
176 | scene = s; | ||
177 | break; | ||
178 | } | ||
179 | if (scene != null) | ||
180 | UploadMapTile(scene); | ||
172 | } | 181 | } |
173 | 182 | ||
174 | 183 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 6e75692..de089f3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -191,7 +191,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
191 | { | 191 | { |
192 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) | 192 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) |
193 | { | 193 | { |
194 | m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName); | 194 | // m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName); |
195 | return s.NewUserConnection(aCircuit, teleportFlags, out reason); | 195 | return s.NewUserConnection(aCircuit, teleportFlags, out reason); |
196 | } | 196 | } |
197 | } | 197 | } |
@@ -209,9 +209,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
209 | { | 209 | { |
210 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) | 210 | if (s.RegionInfo.RegionHandle == destination.RegionHandle) |
211 | { | 211 | { |
212 | m_log.DebugFormat( | 212 | // m_log.DebugFormat( |
213 | "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", | 213 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
214 | s.RegionInfo.RegionName, destination.RegionHandle); | 214 | // s.RegionInfo.RegionName, destination.RegionHandle); |
215 | 215 | ||
216 | s.IncomingChildAgentDataUpdate(cAgentData); | 216 | s.IncomingChildAgentDataUpdate(cAgentData); |
217 | return true; | 217 | return true; |
@@ -280,7 +280,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
280 | { | 280 | { |
281 | if (s.RegionInfo.RegionID == origin) | 281 | if (s.RegionInfo.RegionID == origin) |
282 | { | 282 | { |
283 | m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent"); | 283 | // m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent"); |
284 | AgentTransferModule.AgentArrivedAtDestination(id); | 284 | AgentTransferModule.AgentArrivedAtDestination(id); |
285 | return true; | 285 | return true; |
286 | // return s.IncomingReleaseAgent(id); | 286 | // return s.IncomingReleaseAgent(id); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 38db239..0c4069f 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -245,6 +245,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
245 | // Reload serialized prims | 245 | // Reload serialized prims |
246 | m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); | 246 | m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); |
247 | 247 | ||
248 | UUID oldTelehubUUID = m_scene.RegionInfo.RegionSettings.TelehubObject; | ||
249 | |||
248 | IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface<IRegionSerialiserModule>(); | 250 | IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface<IRegionSerialiserModule>(); |
249 | int sceneObjectsLoadedCount = 0; | 251 | int sceneObjectsLoadedCount = 0; |
250 | 252 | ||
@@ -266,11 +268,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
266 | 268 | ||
267 | SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject); | 269 | SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject); |
268 | 270 | ||
271 | bool isTelehub = (sceneObject.UUID == oldTelehubUUID); | ||
272 | |||
269 | // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned | 273 | // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned |
270 | // on the same region server and multiple examples a single object archive to be imported | 274 | // on the same region server and multiple examples a single object archive to be imported |
271 | // to the same scene (when this is possible). | 275 | // to the same scene (when this is possible). |
272 | sceneObject.ResetIDs(); | 276 | sceneObject.ResetIDs(); |
273 | 277 | ||
278 | if (isTelehub) | ||
279 | { | ||
280 | // Change the Telehub Object to the new UUID | ||
281 | m_scene.RegionInfo.RegionSettings.TelehubObject = sceneObject.UUID; | ||
282 | m_scene.RegionInfo.RegionSettings.Save(); | ||
283 | oldTelehubUUID = UUID.Zero; | ||
284 | } | ||
285 | |||
274 | // Try to retain the original creator/owner/lastowner if their uuid is present on this grid | 286 | // Try to retain the original creator/owner/lastowner if their uuid is present on this grid |
275 | // or creator data is present. Otherwise, use the estate owner instead. | 287 | // or creator data is present. Otherwise, use the estate owner instead. |
276 | foreach (SceneObjectPart part in sceneObject.Parts) | 288 | foreach (SceneObjectPart part in sceneObject.Parts) |
@@ -347,7 +359,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
347 | int ignoredObjects = serialisedSceneObjects.Count - sceneObjectsLoadedCount; | 359 | int ignoredObjects = serialisedSceneObjects.Count - sceneObjectsLoadedCount; |
348 | 360 | ||
349 | if (ignoredObjects > 0) | 361 | if (ignoredObjects > 0) |
350 | m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects); | 362 | m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects); |
363 | |||
364 | if (oldTelehubUUID != UUID.Zero) | ||
365 | { | ||
366 | m_log.WarnFormat("Telehub object not found: {0}", oldTelehubUUID); | ||
367 | m_scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero; | ||
368 | m_scene.RegionInfo.RegionSettings.ClearSpawnPoints(); | ||
369 | } | ||
351 | } | 370 | } |
352 | 371 | ||
353 | /// <summary> | 372 | /// <summary> |
@@ -523,6 +542,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
523 | currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; | 542 | currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; |
524 | currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; | 543 | currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; |
525 | currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; | 544 | currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; |
545 | currentRegionSettings.TelehubObject = loadedRegionSettings.TelehubObject; | ||
546 | currentRegionSettings.ClearSpawnPoints(); | ||
547 | foreach (SpawnPoint sp in loadedRegionSettings.SpawnPoints()) | ||
548 | currentRegionSettings.AddSpawnPoint(sp); | ||
526 | 549 | ||
527 | currentRegionSettings.Save(); | 550 | currentRegionSettings.Save(); |
528 | 551 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 4d459bf..5679ad5 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs | |||
@@ -40,6 +40,9 @@ using OpenSim.Framework.Serialization; | |||
40 | using OpenSim.Region.CoreModules.World.Terrain; | 40 | using OpenSim.Region.CoreModules.World.Terrain; |
41 | using OpenSim.Region.Framework.Interfaces; | 41 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.Framework.Scenes; | 42 | using OpenSim.Region.Framework.Scenes; |
43 | using Ionic.Zlib; | ||
44 | using GZipStream = Ionic.Zlib.GZipStream; | ||
45 | using CompressionMode = Ionic.Zlib.CompressionMode; | ||
43 | 46 | ||
44 | namespace OpenSim.Region.CoreModules.World.Archiver | 47 | namespace OpenSim.Region.CoreModules.World.Archiver |
45 | { | 48 | { |
@@ -82,7 +85,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
82 | { | 85 | { |
83 | try | 86 | try |
84 | { | 87 | { |
85 | m_saveStream = new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress); | 88 | m_saveStream = new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress, CompressionLevel.BestCompression); |
86 | } | 89 | } |
87 | catch (EntryPointNotFoundException e) | 90 | catch (EntryPointNotFoundException e) |
88 | { | 91 | { |
@@ -297,10 +300,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
297 | if (checkPermissions.Contains("T") && !canTransfer) | 300 | if (checkPermissions.Contains("T") && !canTransfer) |
298 | partPermitted = false; | 301 | partPermitted = false; |
299 | 302 | ||
303 | // If the user is the Creator of the object then it can always be included in the OAR | ||
304 | bool creator = (obj.CreatorID.Guid == user.Guid); | ||
305 | if (creator) | ||
306 | partPermitted = true; | ||
307 | |||
300 | //string name = (objGroup.PrimCount == 1) ? objGroup.Name : string.Format("{0} ({1}/{2})", obj.Name, primNumber, objGroup.PrimCount); | 308 | //string name = (objGroup.PrimCount == 1) ? objGroup.Name : string.Format("{0} ({1}/{2})", obj.Name, primNumber, objGroup.PrimCount); |
301 | //m_log.DebugFormat("[ARCHIVER]: Object permissions: {0}: Base={1:X4}, Owner={2:X4}, Everyone={3:X4}, permissionClass={4}, checkPermissions={5}, canCopy={6}, canTransfer={7}, permitted={8}", | 309 | //m_log.DebugFormat("[ARCHIVER]: Object permissions: {0}: Base={1:X4}, Owner={2:X4}, Everyone={3:X4}, permissionClass={4}, checkPermissions={5}, canCopy={6}, canTransfer={7}, creator={8}, permitted={9}", |
302 | // name, obj.BaseMask, obj.OwnerMask, obj.EveryoneMask, | 310 | // name, obj.BaseMask, obj.OwnerMask, obj.EveryoneMask, |
303 | // permissionClass, checkPermissions, canCopy, canTransfer, permitted); | 311 | // permissionClass, checkPermissions, canCopy, canTransfer, creator, partPermitted); |
304 | 312 | ||
305 | if (!partPermitted) | 313 | if (!partPermitted) |
306 | { | 314 | { |
@@ -320,7 +328,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
320 | /// <returns></returns> | 328 | /// <returns></returns> |
321 | public string CreateControlFile(Dictionary<string, object> options) | 329 | public string CreateControlFile(Dictionary<string, object> options) |
322 | { | 330 | { |
323 | int majorVersion = MAX_MAJOR_VERSION, minorVersion = 7; | 331 | int majorVersion = MAX_MAJOR_VERSION, minorVersion = 8; |
324 | // | 332 | // |
325 | // if (options.ContainsKey("version")) | 333 | // if (options.ContainsKey("version")) |
326 | // { | 334 | // { |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 63f1363..394ca27 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
68 | SerialiserModule serialiserModule = new SerialiserModule(); | 68 | SerialiserModule serialiserModule = new SerialiserModule(); |
69 | TerrainModule terrainModule = new TerrainModule(); | 69 | TerrainModule terrainModule = new TerrainModule(); |
70 | 70 | ||
71 | m_scene = SceneHelpers.SetupScene(); | 71 | m_scene = new SceneHelpers().SetupScene(); |
72 | SceneHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule); | 72 | SceneHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule); |
73 | } | 73 | } |
74 | 74 | ||
@@ -102,9 +102,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
102 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | 102 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); |
103 | Vector3 groupPosition = new Vector3(10, 20, 30); | 103 | Vector3 groupPosition = new Vector3(10, 20, 30); |
104 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); | 104 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); |
105 | Vector3 offsetPosition = new Vector3(5, 10, 15); | 105 | // Vector3 offsetPosition = new Vector3(5, 10, 15); |
106 | 106 | ||
107 | return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; | 107 | return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, Vector3.Zero) { Name = partName }; |
108 | } | 108 | } |
109 | 109 | ||
110 | protected SceneObjectPart CreateSceneObjectPart2() | 110 | protected SceneObjectPart CreateSceneObjectPart2() |
@@ -463,7 +463,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
463 | SerialiserModule serialiserModule = new SerialiserModule(); | 463 | SerialiserModule serialiserModule = new SerialiserModule(); |
464 | TerrainModule terrainModule = new TerrainModule(); | 464 | TerrainModule terrainModule = new TerrainModule(); |
465 | 465 | ||
466 | TestScene scene2 = SceneHelpers.SetupScene(); | 466 | TestScene scene2 = new SceneHelpers().SetupScene(); |
467 | SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule); | 467 | SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule); |
468 | 468 | ||
469 | // Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is | 469 | // Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is |
@@ -534,6 +534,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
534 | rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080"); | 534 | rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080"); |
535 | rs.UseEstateSun = true; | 535 | rs.UseEstateSun = true; |
536 | rs.WaterHeight = 23; | 536 | rs.WaterHeight = 23; |
537 | rs.TelehubObject = UUID.Parse("00000000-0000-0000-0000-111111111111"); | ||
538 | rs.AddSpawnPoint(SpawnPoint.Parse("1,-2,0.33")); | ||
537 | 539 | ||
538 | tar.WriteFile(ArchiveConstants.SETTINGS_PATH + "region1.xml", RegionSettingsSerializer.Serialize(rs)); | 540 | tar.WriteFile(ArchiveConstants.SETTINGS_PATH + "region1.xml", RegionSettingsSerializer.Serialize(rs)); |
539 | 541 | ||
@@ -580,6 +582,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
580 | Assert.That(loadedRs.TerrainTexture4, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000080"))); | 582 | Assert.That(loadedRs.TerrainTexture4, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000080"))); |
581 | Assert.That(loadedRs.UseEstateSun, Is.True); | 583 | Assert.That(loadedRs.UseEstateSun, Is.True); |
582 | Assert.That(loadedRs.WaterHeight, Is.EqualTo(23)); | 584 | Assert.That(loadedRs.WaterHeight, Is.EqualTo(23)); |
585 | Assert.AreEqual(UUID.Zero, loadedRs.TelehubObject); // because no object was found with the original UUID | ||
586 | Assert.AreEqual(0, loadedRs.SpawnPoints().Count); | ||
583 | } | 587 | } |
584 | 588 | ||
585 | /// <summary> | 589 | /// <summary> |
@@ -607,7 +611,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
607 | SerialiserModule serialiserModule = new SerialiserModule(); | 611 | SerialiserModule serialiserModule = new SerialiserModule(); |
608 | TerrainModule terrainModule = new TerrainModule(); | 612 | TerrainModule terrainModule = new TerrainModule(); |
609 | 613 | ||
610 | Scene scene = SceneHelpers.SetupScene(); | 614 | Scene scene = new SceneHelpers().SetupScene(); |
611 | SceneHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); | 615 | SceneHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); |
612 | 616 | ||
613 | m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); | 617 | m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 1e743c3..ddc2a07 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -168,12 +168,18 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
168 | sendRegionInfoPacketToAll(); | 168 | sendRegionInfoPacketToAll(); |
169 | } | 169 | } |
170 | 170 | ||
171 | public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int corner, UUID texture) | 171 | public void setEstateTerrainBaseTexture(int level, UUID texture) |
172 | { | ||
173 | setEstateTerrainBaseTexture(null, level, texture); | ||
174 | sendRegionHandshakeToAll(); | ||
175 | } | ||
176 | |||
177 | public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID texture) | ||
172 | { | 178 | { |
173 | if (texture == UUID.Zero) | 179 | if (texture == UUID.Zero) |
174 | return; | 180 | return; |
175 | 181 | ||
176 | switch (corner) | 182 | switch (level) |
177 | { | 183 | { |
178 | case 0: | 184 | case 0: |
179 | Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; | 185 | Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; |
@@ -193,6 +199,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
193 | sendRegionInfoPacketToAll(); | 199 | sendRegionInfoPacketToAll(); |
194 | } | 200 | } |
195 | 201 | ||
202 | public void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue) | ||
203 | { | ||
204 | setEstateTerrainTextureHeights(null, corner, lowValue, highValue); | ||
205 | } | ||
206 | |||
196 | public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) | 207 | public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) |
197 | { | 208 | { |
198 | switch (corner) | 209 | switch (corner) |
@@ -987,7 +998,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
987 | { | 998 | { |
988 | RegionHandshakeArgs args = new RegionHandshakeArgs(); | 999 | RegionHandshakeArgs args = new RegionHandshakeArgs(); |
989 | 1000 | ||
990 | args.isEstateManager = Scene.RegionInfo.EstateSettings.IsEstateManager(remoteClient.AgentId); | 1001 | args.isEstateManager = Scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(remoteClient.AgentId); |
991 | if (Scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero && Scene.RegionInfo.EstateSettings.EstateOwner == remoteClient.AgentId) | 1002 | if (Scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero && Scene.RegionInfo.EstateSettings.EstateOwner == remoteClient.AgentId) |
992 | args.isEstateManager = true; | 1003 | args.isEstateManager = true; |
993 | 1004 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 02ac091..2fa0b3f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -1392,21 +1392,26 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1392 | private void EventManagerOnRegisterCaps(UUID agentID, Caps caps) | 1392 | private void EventManagerOnRegisterCaps(UUID agentID, Caps caps) |
1393 | { | 1393 | { |
1394 | string capsBase = "/CAPS/" + caps.CapsObjectPath; | 1394 | string capsBase = "/CAPS/" + caps.CapsObjectPath; |
1395 | caps.RegisterHandler("RemoteParcelRequest", | 1395 | caps.RegisterHandler( |
1396 | new RestStreamHandler("POST", capsBase + remoteParcelRequestPath, | 1396 | "RemoteParcelRequest", |
1397 | delegate(string request, string path, string param, | 1397 | new RestStreamHandler( |
1398 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 1398 | "POST", |
1399 | { | 1399 | capsBase + remoteParcelRequestPath, |
1400 | return RemoteParcelRequest(request, path, param, agentID, caps); | 1400 | (request, path, param, httpRequest, httpResponse) |
1401 | })); | 1401 | => RemoteParcelRequest(request, path, param, agentID, caps), |
1402 | "RemoteParcelRequest", | ||
1403 | agentID.ToString())); | ||
1404 | |||
1402 | UUID parcelCapID = UUID.Random(); | 1405 | UUID parcelCapID = UUID.Random(); |
1403 | caps.RegisterHandler("ParcelPropertiesUpdate", | 1406 | caps.RegisterHandler( |
1404 | new RestStreamHandler("POST", "/CAPS/" + parcelCapID, | 1407 | "ParcelPropertiesUpdate", |
1405 | delegate(string request, string path, string param, | 1408 | new RestStreamHandler( |
1406 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 1409 | "POST", |
1407 | { | 1410 | "/CAPS/" + parcelCapID, |
1408 | return ProcessPropertiesUpdate(request, path, param, agentID, caps); | 1411 | (request, path, param, httpRequest, httpResponse) |
1409 | })); | 1412 | => ProcessPropertiesUpdate(request, path, param, agentID, caps), |
1413 | "ParcelPropertiesUpdate", | ||
1414 | agentID.ToString())); | ||
1410 | } | 1415 | } |
1411 | private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) | 1416 | private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) |
1412 | { | 1417 | { |
@@ -1771,7 +1776,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1771 | 1776 | ||
1772 | Vector3 pos = m_scene.GetNearestAllowedPosition(targetAvatar, land); | 1777 | Vector3 pos = m_scene.GetNearestAllowedPosition(targetAvatar, land); |
1773 | 1778 | ||
1774 | targetAvatar.TeleportWithMomentum(pos); | 1779 | targetAvatar.TeleportWithMomentum(pos, null); |
1775 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | 1780 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); |
1776 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | 1781 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); |
1777 | 1782 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 509c4d7..16792b3 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -447,7 +447,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
447 | { | 447 | { |
448 | bool isMember; | 448 | bool isMember; |
449 | if (m_groupMemberCache.TryGetValue(avatar, out isMember)) | 449 | if (m_groupMemberCache.TryGetValue(avatar, out isMember)) |
450 | { | ||
451 | m_groupMemberCache.Update(avatar, isMember, m_groupMemberCacheTimeout); | ||
450 | return isMember; | 452 | return isMember; |
453 | } | ||
451 | 454 | ||
452 | IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | 455 | IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); |
453 | if (groupsModule == null) | 456 | if (groupsModule == null) |
@@ -484,7 +487,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
484 | if (m_scene.Permissions.IsAdministrator(avatar)) | 487 | if (m_scene.Permissions.IsAdministrator(avatar)) |
485 | return false; | 488 | return false; |
486 | 489 | ||
487 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | 490 | if (m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(avatar)) |
488 | return false; | 491 | return false; |
489 | 492 | ||
490 | if (avatar == LandData.OwnerID) | 493 | if (avatar == LandData.OwnerID) |
@@ -514,7 +517,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
514 | if (m_scene.Permissions.IsAdministrator(avatar)) | 517 | if (m_scene.Permissions.IsAdministrator(avatar)) |
515 | return false; | 518 | return false; |
516 | 519 | ||
517 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | 520 | if (m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(avatar)) |
518 | return false; | 521 | return false; |
519 | 522 | ||
520 | if (avatar == LandData.OwnerID) | 523 | if (avatar == LandData.OwnerID) |
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 5122734..102b4d7 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | |||
@@ -126,7 +126,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
126 | // m_log.DebugFormat( | 126 | // m_log.DebugFormat( |
127 | // "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted", | 127 | // "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted", |
128 | // obj.Name, m_Scene.RegionInfo.RegionName); | 128 | // obj.Name, m_Scene.RegionInfo.RegionName); |
129 | |||
130 | } | 129 | } |
131 | } | 130 | } |
132 | 131 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index e553ffa..b5ee4d2 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs | |||
@@ -64,7 +64,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
64 | { | 64 | { |
65 | m_pcm = new PrimCountModule(); | 65 | m_pcm = new PrimCountModule(); |
66 | LandManagementModule lmm = new LandManagementModule(); | 66 | LandManagementModule lmm = new LandManagementModule(); |
67 | m_scene = SceneHelpers.SetupScene(); | 67 | m_scene = new SceneHelpers().SetupScene(); |
68 | SceneHelpers.SetupSceneModules(m_scene, lmm, m_pcm); | 68 | SceneHelpers.SetupSceneModules(m_scene, lmm, m_pcm); |
69 | 69 | ||
70 | int xParcelDivider = (int)Constants.RegionSize - 1; | 70 | int xParcelDivider = (int)Constants.RegionSize - 1; |
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index f86c790..aa306c7 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | |||
@@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
225 | int tc = 0; | 225 | int tc = 0; |
226 | double[,] hm = whichScene.Heightmap.GetDoubles(); | 226 | double[,] hm = whichScene.Heightmap.GetDoubles(); |
227 | tc = Environment.TickCount; | 227 | tc = Environment.TickCount; |
228 | m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); | 228 | m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); |
229 | EntityBase[] objs = whichScene.GetEntities(); | 229 | EntityBase[] objs = whichScene.GetEntities(); |
230 | Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>(); | 230 | Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>(); |
231 | //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>(); | 231 | //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>(); |
@@ -541,7 +541,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
541 | g.Dispose(); | 541 | g.Dispose(); |
542 | } // lock entities objs | 542 | } // lock entities objs |
543 | 543 | ||
544 | m_log.Info("[MAPTILE]: Generating Maptile Step 2: Done in " + (Environment.TickCount - tc) + " ms"); | 544 | m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Done in " + (Environment.TickCount - tc) + " ms"); |
545 | return mapbmp; | 545 | return mapbmp; |
546 | } | 546 | } |
547 | 547 | ||
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs index eb1a27f..992bff3 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs | |||
@@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
54 | public void TerrainToBitmap(Bitmap mapbmp) | 54 | public void TerrainToBitmap(Bitmap mapbmp) |
55 | { | 55 | { |
56 | int tc = Environment.TickCount; | 56 | int tc = Environment.TickCount; |
57 | m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain"); | 57 | m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain"); |
58 | 58 | ||
59 | double[,] hm = m_scene.Heightmap.GetDoubles(); | 59 | double[,] hm = m_scene.Heightmap.GetDoubles(); |
60 | bool ShadowDebugContinue = true; | 60 | bool ShadowDebugContinue = true; |
@@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
238 | } | 238 | } |
239 | } | 239 | } |
240 | } | 240 | } |
241 | m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms"); | 241 | m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms"); |
242 | } | 242 | } |
243 | } | 243 | } |
244 | } | 244 | } |
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs index 1d2141e..d13c2ef 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs | |||
@@ -278,7 +278,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
278 | public void TerrainToBitmap(Bitmap mapbmp) | 278 | public void TerrainToBitmap(Bitmap mapbmp) |
279 | { | 279 | { |
280 | int tc = Environment.TickCount; | 280 | int tc = Environment.TickCount; |
281 | m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain"); | 281 | m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain"); |
282 | 282 | ||
283 | // These textures should be in the AssetCache anyway, as every client conneting to this | 283 | // These textures should be in the AssetCache anyway, as every client conneting to this |
284 | // region needs them. Except on start, when the map is recreated (before anyone connected), | 284 | // region needs them. Except on start, when the map is recreated (before anyone connected), |
@@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
412 | } | 412 | } |
413 | } | 413 | } |
414 | } | 414 | } |
415 | m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms"); | 415 | m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms"); |
416 | } | 416 | } |
417 | } | 417 | } |
418 | } | 418 | } |
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 5239f50..601e81e 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | |||
@@ -145,7 +145,9 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap | |||
145 | 145 | ||
146 | // Even though we're registering for POST we're going to get GETS and UPDATES too | 146 | // Even though we're registering for POST we're going to get GETS and UPDATES too |
147 | caps.RegisterHandler( | 147 | caps.RegisterHandler( |
148 | "ObjectMedia", new RestStreamHandler("POST", omCapUrl, HandleObjectMediaMessage)); | 148 | "ObjectMedia", |
149 | new RestStreamHandler( | ||
150 | "POST", omCapUrl, HandleObjectMediaMessage, "ObjectMedia", agentID.ToString())); | ||
149 | } | 151 | } |
150 | 152 | ||
151 | string omuCapUrl = "/CAPS/" + UUID.Random(); | 153 | string omuCapUrl = "/CAPS/" + UUID.Random(); |
@@ -157,7 +159,9 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap | |||
157 | 159 | ||
158 | // Even though we're registering for POST we're going to get GETS and UPDATES too | 160 | // Even though we're registering for POST we're going to get GETS and UPDATES too |
159 | caps.RegisterHandler( | 161 | caps.RegisterHandler( |
160 | "ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage)); | 162 | "ObjectMediaNavigate", |
163 | new RestStreamHandler( | ||
164 | "POST", omuCapUrl, HandleObjectMediaNavigateMessage, "ObjectMediaNavigate", agentID.ToString())); | ||
161 | } | 165 | } |
162 | } | 166 | } |
163 | 167 | ||
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs index 4326606..0545250 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs | |||
@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests | |||
53 | public void SetUp() | 53 | public void SetUp() |
54 | { | 54 | { |
55 | m_module = new MoapModule(); | 55 | m_module = new MoapModule(); |
56 | m_scene = SceneHelpers.SetupScene(); | 56 | m_scene = new SceneHelpers().SetupScene(); |
57 | SceneHelpers.SetupSceneModules(m_scene, m_module); | 57 | SceneHelpers.SetupSceneModules(m_scene, m_module); |
58 | } | 58 | } |
59 | 59 | ||
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index f5a5c92..5e928f3 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | |||
@@ -78,45 +78,49 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
78 | m_scene = scene; | 78 | m_scene = scene; |
79 | m_console = MainConsole.Instance; | 79 | m_console = MainConsole.Instance; |
80 | 80 | ||
81 | m_console.Commands.AddCommand("Regions", false, "delete object owner", | 81 | m_console.Commands.AddCommand("Objects", false, "delete object owner", |
82 | "delete object owner <UUID>", | 82 | "delete object owner <UUID>", |
83 | "Delete a scene object by owner", HandleDeleteObject); | 83 | "Delete a scene object by owner", HandleDeleteObject); |
84 | m_console.Commands.AddCommand("Regions", false, "delete object creator", | 84 | |
85 | m_console.Commands.AddCommand("Objects", false, "delete object creator", | ||
85 | "delete object creator <UUID>", | 86 | "delete object creator <UUID>", |
86 | "Delete a scene object by creator", HandleDeleteObject); | 87 | "Delete a scene object by creator", HandleDeleteObject); |
87 | m_console.Commands.AddCommand("Regions", false, "delete object uuid", | 88 | |
89 | m_console.Commands.AddCommand("Objects", false, "delete object uuid", | ||
88 | "delete object uuid <UUID>", | 90 | "delete object uuid <UUID>", |
89 | "Delete a scene object by uuid", HandleDeleteObject); | 91 | "Delete a scene object by uuid", HandleDeleteObject); |
90 | m_console.Commands.AddCommand("Regions", false, "delete object name", | 92 | |
93 | m_console.Commands.AddCommand("Objects", false, "delete object name", | ||
91 | "delete object name <name>", | 94 | "delete object name <name>", |
92 | "Delete a scene object by name", HandleDeleteObject); | 95 | "Delete a scene object by name", HandleDeleteObject); |
93 | m_console.Commands.AddCommand("Regions", false, "delete object outside", | 96 | |
97 | m_console.Commands.AddCommand("Objects", false, "delete object outside", | ||
94 | "delete object outside", | 98 | "delete object outside", |
95 | "Delete all scene objects outside region boundaries", HandleDeleteObject); | 99 | "Delete all scene objects outside region boundaries", HandleDeleteObject); |
96 | 100 | ||
97 | m_console.Commands.AddCommand( | 101 | m_console.Commands.AddCommand( |
98 | "Regions", | 102 | "Objects", |
99 | false, | 103 | false, |
100 | "show object uuid", | 104 | "show object uuid", |
101 | "show object uuid <UUID>", | 105 | "show object uuid <UUID>", |
102 | "Show details of a scene object with the given UUID", HandleShowObjectByUuid); | 106 | "Show details of a scene object with the given UUID", HandleShowObjectByUuid); |
103 | 107 | ||
104 | m_console.Commands.AddCommand( | 108 | m_console.Commands.AddCommand( |
105 | "Regions", | 109 | "Objects", |
106 | false, | 110 | false, |
107 | "show object name", | 111 | "show object name", |
108 | "show object name <name>", | 112 | "show object name <name>", |
109 | "Show details of scene objects with the given name", HandleShowObjectByName); | 113 | "Show details of scene objects with the given name", HandleShowObjectByName); |
110 | 114 | ||
111 | m_console.Commands.AddCommand( | 115 | m_console.Commands.AddCommand( |
112 | "Regions", | 116 | "Objects", |
113 | false, | 117 | false, |
114 | "show part uuid", | 118 | "show part uuid", |
115 | "show part uuid <UUID>", | 119 | "show part uuid <UUID>", |
116 | "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); | 120 | "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); |
117 | 121 | ||
118 | m_console.Commands.AddCommand( | 122 | m_console.Commands.AddCommand( |
119 | "Regions", | 123 | "Objects", |
120 | false, | 124 | false, |
121 | "show part name", | 125 | "show part name", |
122 | "show part name <name>", | 126 | "show part name <name>", |
@@ -271,6 +275,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
271 | sb.AppendFormat("Description: {0}\n", so.Description); | 275 | sb.AppendFormat("Description: {0}\n", so.Description); |
272 | sb.AppendFormat("Location: {0} @ {1}\n", so.AbsolutePosition, so.Scene.RegionInfo.RegionName); | 276 | sb.AppendFormat("Location: {0} @ {1}\n", so.AbsolutePosition, so.Scene.RegionInfo.RegionName); |
273 | sb.AppendFormat("Parts: {0}\n", so.PrimCount); | 277 | sb.AppendFormat("Parts: {0}\n", so.PrimCount); |
278 | sb.AppendFormat("Flags: {0}\n", so.RootPart.Flags); | ||
274 | 279 | ||
275 | return sb; | 280 | return sb; |
276 | } | 281 | } |
@@ -282,7 +287,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
282 | sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName); | 287 | sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName); |
283 | sb.AppendFormat("Parent: {0}", | 288 | sb.AppendFormat("Parent: {0}", |
284 | sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID)); | 289 | sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID)); |
285 | sb.AppendFormat("Parts: {0}\n", !sop.IsRoot ? "1" : sop.ParentGroup.PrimCount.ToString());; | 290 | sb.AppendFormat("Link number: {0}\n", sop.LinkNum); |
291 | sb.AppendFormat("Flags: {0}\n", sop.Flags); | ||
286 | 292 | ||
287 | return sb; | 293 | return sb; |
288 | } | 294 | } |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 82ccaf8..190f63b 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -166,6 +166,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
166 | m_scene.Permissions.OnDeedParcel += CanDeedParcel; | 166 | m_scene.Permissions.OnDeedParcel += CanDeedParcel; |
167 | m_scene.Permissions.OnDeedObject += CanDeedObject; | 167 | m_scene.Permissions.OnDeedObject += CanDeedObject; |
168 | m_scene.Permissions.OnIsGod += IsGod; | 168 | m_scene.Permissions.OnIsGod += IsGod; |
169 | m_scene.Permissions.OnIsGridGod += IsGridGod; | ||
169 | m_scene.Permissions.OnIsAdministrator += IsAdministrator; | 170 | m_scene.Permissions.OnIsAdministrator += IsAdministrator; |
170 | m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; | 171 | m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; |
171 | m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED | 172 | m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED |
@@ -466,22 +467,34 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
466 | if (IsEstateManager(user) && m_RegionManagerIsGod) | 467 | if (IsEstateManager(user) && m_RegionManagerIsGod) |
467 | return true; | 468 | return true; |
468 | 469 | ||
470 | if (IsGridGod(user, null)) | ||
471 | return true; | ||
472 | |||
473 | return false; | ||
474 | } | ||
475 | |||
476 | /// <summary> | ||
477 | /// Is the given user a God throughout the grid (not just in the current scene)? | ||
478 | /// </summary> | ||
479 | /// <param name="user">The user</param> | ||
480 | /// <param name="scene">Unused, can be null</param> | ||
481 | /// <returns></returns> | ||
482 | protected bool IsGridGod(UUID user, Scene scene) | ||
483 | { | ||
484 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
485 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
486 | |||
487 | if (user == UUID.Zero) return false; | ||
488 | |||
469 | if (m_allowGridGods) | 489 | if (m_allowGridGods) |
470 | { | 490 | { |
471 | ScenePresence sp = m_scene.GetScenePresence(user); | 491 | ScenePresence sp = m_scene.GetScenePresence(user); |
472 | if (sp != null) | 492 | if (sp != null) |
473 | { | 493 | return (sp.UserLevel >= 200); |
474 | if (sp.UserLevel >= 200) | ||
475 | return true; | ||
476 | return false; | ||
477 | } | ||
478 | 494 | ||
479 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user); | 495 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user); |
480 | if (account != null) | 496 | if (account != null) |
481 | { | 497 | return (account.UserLevel >= 200); |
482 | if (account.UserLevel >= 200) | ||
483 | return true; | ||
484 | } | ||
485 | } | 498 | } |
486 | 499 | ||
487 | return false; | 500 | return false; |
@@ -503,7 +516,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
503 | { | 516 | { |
504 | if (user == UUID.Zero) return false; | 517 | if (user == UUID.Zero) return false; |
505 | 518 | ||
506 | return m_scene.RegionInfo.EstateSettings.IsEstateManager(user); | 519 | return m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(user); |
507 | } | 520 | } |
508 | 521 | ||
509 | #endregion | 522 | #endregion |
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index d1d2020..7825e3e 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | |||
@@ -343,7 +343,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
343 | public void Init() | 343 | public void Init() |
344 | { | 344 | { |
345 | m_serialiserModule = new SerialiserModule(); | 345 | m_serialiserModule = new SerialiserModule(); |
346 | m_scene = SceneHelpers.SetupScene(); | 346 | m_scene = new SceneHelpers().SetupScene(); |
347 | SceneHelpers.SetupSceneModules(m_scene, m_serialiserModule); | 347 | SceneHelpers.SetupSceneModules(m_scene, m_serialiserModule); |
348 | } | 348 | } |
349 | 349 | ||
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs index da81dc1..d78ade5 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs | |||
@@ -59,28 +59,32 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
59 | /// <returns>A terrain channel generated from the image.</returns> | 59 | /// <returns>A terrain channel generated from the image.</returns> |
60 | public virtual ITerrainChannel LoadFile(string filename) | 60 | public virtual ITerrainChannel LoadFile(string filename) |
61 | { | 61 | { |
62 | return LoadBitmap(new Bitmap(filename)); | 62 | using (Bitmap b = new Bitmap(filename)) |
63 | return LoadBitmap(b); | ||
63 | } | 64 | } |
64 | 65 | ||
65 | public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h) | 66 | public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h) |
66 | { | 67 | { |
67 | Bitmap bitmap = new Bitmap(filename); | 68 | using (Bitmap bitmap = new Bitmap(filename)) |
68 | ITerrainChannel retval = new TerrainChannel(true); | ||
69 | |||
70 | for (int x = 0; x < retval.Width; x++) | ||
71 | { | 69 | { |
72 | for (int y = 0; y < retval.Height; y++) | 70 | ITerrainChannel retval = new TerrainChannel(true); |
71 | |||
72 | for (int x = 0; x < retval.Width; x++) | ||
73 | { | 73 | { |
74 | retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128; | 74 | for (int y = 0; y < retval.Height; y++) |
75 | { | ||
76 | retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128; | ||
77 | } | ||
75 | } | 78 | } |
76 | } | ||
77 | 79 | ||
78 | return retval; | 80 | return retval; |
81 | } | ||
79 | } | 82 | } |
80 | 83 | ||
81 | public virtual ITerrainChannel LoadStream(Stream stream) | 84 | public virtual ITerrainChannel LoadStream(Stream stream) |
82 | { | 85 | { |
83 | return LoadBitmap(new Bitmap(stream)); | 86 | using (Bitmap b = new Bitmap(stream)) |
87 | return LoadBitmap(b); | ||
84 | } | 88 | } |
85 | 89 | ||
86 | protected virtual ITerrainChannel LoadBitmap(Bitmap bitmap) | 90 | protected virtual ITerrainChannel LoadBitmap(Bitmap bitmap) |
@@ -134,35 +138,53 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
134 | // "Saving the image to the same file it was constructed from is not allowed and throws an exception." | 138 | // "Saving the image to the same file it was constructed from is not allowed and throws an exception." |
135 | string tempName = Path.GetTempFileName(); | 139 | string tempName = Path.GetTempFileName(); |
136 | 140 | ||
137 | Bitmap entireBitmap = null; | 141 | Bitmap existingBitmap = null; |
138 | Bitmap thisBitmap = null; | 142 | Bitmap thisBitmap = null; |
139 | if (File.Exists(filename)) | 143 | Bitmap newBitmap = null; |
144 | |||
145 | try | ||
140 | { | 146 | { |
141 | File.Copy(filename, tempName, true); | 147 | if (File.Exists(filename)) |
142 | entireBitmap = new Bitmap(tempName); | 148 | { |
143 | if (entireBitmap.Width != fileWidth * regionSizeX || entireBitmap.Height != fileHeight * regionSizeY) | 149 | File.Copy(filename, tempName, true); |
150 | existingBitmap = new Bitmap(tempName); | ||
151 | if (existingBitmap.Width != fileWidth * regionSizeX || existingBitmap.Height != fileHeight * regionSizeY) | ||
152 | { | ||
153 | // old file, let's overwrite it | ||
154 | newBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY); | ||
155 | } | ||
156 | else | ||
157 | { | ||
158 | newBitmap = existingBitmap; | ||
159 | } | ||
160 | } | ||
161 | else | ||
144 | { | 162 | { |
145 | // old file, let's overwrite it | 163 | newBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY); |
146 | entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY); | ||
147 | } | 164 | } |
165 | |||
166 | thisBitmap = CreateGrayscaleBitmapFromMap(m_channel); | ||
167 | // Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY); | ||
168 | for (int x = 0; x < regionSizeX; x++) | ||
169 | for (int y = 0; y < regionSizeY; y++) | ||
170 | newBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y)); | ||
171 | |||
172 | Save(newBitmap, filename); | ||
148 | } | 173 | } |
149 | else | 174 | finally |
150 | { | 175 | { |
151 | entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY); | 176 | if (existingBitmap != null) |
152 | } | 177 | existingBitmap.Dispose(); |
153 | 178 | ||
154 | thisBitmap = CreateGrayscaleBitmapFromMap(m_channel); | 179 | if (thisBitmap != null) |
155 | // Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY); | 180 | thisBitmap.Dispose(); |
156 | for (int x = 0; x < regionSizeX; x++) | ||
157 | for (int y = 0; y < regionSizeY; y++) | ||
158 | entireBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y)); | ||
159 | 181 | ||
160 | Save(entireBitmap, filename); | 182 | if (newBitmap != null) |
161 | thisBitmap.Dispose(); | 183 | newBitmap.Dispose(); |
162 | entireBitmap.Dispose(); | ||
163 | 184 | ||
164 | if (File.Exists(tempName)) | 185 | if (File.Exists(tempName)) |
165 | File.Delete(tempName); | 186 | File.Delete(tempName); |
187 | } | ||
166 | } | 188 | } |
167 | 189 | ||
168 | protected virtual void Save(Bitmap bmp, string filename) | 190 | protected virtual void Save(Bitmap bmp, string filename) |
@@ -226,16 +248,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
226 | /// <returns>A System.Drawing.Bitmap containing a coloured image</returns> | 248 | /// <returns>A System.Drawing.Bitmap containing a coloured image</returns> |
227 | protected static Bitmap CreateBitmapFromMap(ITerrainChannel map) | 249 | protected static Bitmap CreateBitmapFromMap(ITerrainChannel map) |
228 | { | 250 | { |
229 | Bitmap gradientmapLd = new Bitmap("defaultstripe.png"); | 251 | int pallete; |
230 | 252 | Bitmap bmp; | |
231 | int pallete = gradientmapLd.Height; | 253 | Color[] colours; |
232 | 254 | ||
233 | Bitmap bmp = new Bitmap(map.Width, map.Height); | 255 | using (Bitmap gradientmapLd = new Bitmap("defaultstripe.png")) |
234 | Color[] colours = new Color[pallete]; | ||
235 | |||
236 | for (int i = 0; i < pallete; i++) | ||
237 | { | 256 | { |
238 | colours[i] = gradientmapLd.GetPixel(0, i); | 257 | pallete = gradientmapLd.Height; |
258 | |||
259 | bmp = new Bitmap(map.Width, map.Height); | ||
260 | colours = new Color[pallete]; | ||
261 | |||
262 | for (int i = 0; i < pallete; i++) | ||
263 | { | ||
264 | colours[i] = gradientmapLd.GetPixel(0, i); | ||
265 | } | ||
239 | } | 266 | } |
240 | 267 | ||
241 | for (int y = 0; y < map.Height; y++) | 268 | for (int y = 0; y < map.Height; y++) |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs index 699d67a..9cc767a 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs | |||
@@ -99,16 +99,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
99 | 99 | ||
100 | private static Bitmap CreateBitmapFromMap(ITerrainChannel map) | 100 | private static Bitmap CreateBitmapFromMap(ITerrainChannel map) |
101 | { | 101 | { |
102 | Bitmap gradientmapLd = new Bitmap("defaultstripe.png"); | 102 | int pallete; |
103 | Bitmap bmp; | ||
104 | Color[] colours; | ||
103 | 105 | ||
104 | int pallete = gradientmapLd.Height; | 106 | using (Bitmap gradientmapLd = new Bitmap("defaultstripe.png")) |
105 | |||
106 | Bitmap bmp = new Bitmap(map.Width, map.Height); | ||
107 | Color[] colours = new Color[pallete]; | ||
108 | |||
109 | for (int i = 0; i < pallete; i++) | ||
110 | { | 107 | { |
111 | colours[i] = gradientmapLd.GetPixel(0, i); | 108 | pallete = gradientmapLd.Height; |
109 | |||
110 | bmp = new Bitmap(map.Width, map.Height); | ||
111 | colours = new Color[pallete]; | ||
112 | |||
113 | for (int i = 0; i < pallete; i++) | ||
114 | { | ||
115 | colours[i] = gradientmapLd.GetPixel(0, i); | ||
116 | } | ||
112 | } | 117 | } |
113 | 118 | ||
114 | for (int y = 0; y < map.Height; y++) | 119 | for (int y = 0; y < map.Height; y++) |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index e2bd769..5b03ac7 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -724,6 +724,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
724 | } | 724 | } |
725 | if (shouldTaint) | 725 | if (shouldTaint) |
726 | { | 726 | { |
727 | m_scene.EventManager.TriggerTerrainTainted(); | ||
727 | m_tainted = true; | 728 | m_tainted = true; |
728 | } | 729 | } |
729 | } | 730 | } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 899e5ea..be6b240 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -190,14 +190,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
190 | { | 190 | { |
191 | //m_log.DebugFormat("[WORLD MAP]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); | 191 | //m_log.DebugFormat("[WORLD MAP]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); |
192 | string capsBase = "/CAPS/" + caps.CapsObjectPath; | 192 | string capsBase = "/CAPS/" + caps.CapsObjectPath; |
193 | caps.RegisterHandler("MapLayer", | 193 | caps.RegisterHandler( |
194 | new RestStreamHandler("POST", capsBase + m_mapLayerPath, | 194 | "MapLayer", |
195 | delegate(string request, string path, string param, | 195 | new RestStreamHandler( |
196 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 196 | "POST", |
197 | { | 197 | capsBase + m_mapLayerPath, |
198 | return MapLayerRequest(request, path, param, | 198 | (request, path, param, httpRequest, httpResponse) |
199 | agentID, caps); | 199 | => MapLayerRequest(request, path, param, agentID, caps), |
200 | })); | 200 | "MapLayer", |
201 | agentID.ToString())); | ||
201 | } | 202 | } |
202 | 203 | ||
203 | /// <summary> | 204 | /// <summary> |
diff --git a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs index 2f2b3e6..32e93b4 100644 --- a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs +++ b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs | |||
@@ -42,13 +42,13 @@ namespace OpenSim.Region.DataSnapshot | |||
42 | { | 42 | { |
43 | public class DataRequestHandler | 43 | public class DataRequestHandler |
44 | { | 44 | { |
45 | private Scene m_scene = null; | 45 | // private Scene m_scene = null; |
46 | private DataSnapshotManager m_externalData = null; | 46 | private DataSnapshotManager m_externalData = null; |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | public DataRequestHandler(Scene scene, DataSnapshotManager externalData) | 49 | public DataRequestHandler(Scene scene, DataSnapshotManager externalData) |
50 | { | 50 | { |
51 | m_scene = scene; | 51 | // m_scene = scene; |
52 | m_externalData = externalData; | 52 | m_externalData = externalData; |
53 | 53 | ||
54 | //Register HTTP handler | 54 | //Register HTTP handler |
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 32f4eea..8732ec0 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -174,7 +174,17 @@ namespace OpenSim.Region.Framework.Interfaces | |||
174 | /// If no inventory item has that name then an empty list is returned. | 174 | /// If no inventory item has that name then an empty list is returned. |
175 | /// </returns> | 175 | /// </returns> |
176 | List<TaskInventoryItem> GetInventoryItems(string name); | 176 | List<TaskInventoryItem> GetInventoryItems(string name); |
177 | 177 | ||
178 | /// <summary> | ||
179 | /// Get inventory items by type. | ||
180 | /// </summary> | ||
181 | /// <param type="name"></param> | ||
182 | /// <returns> | ||
183 | /// A list of inventory items of that type. | ||
184 | /// If no inventory items of that type then an empty list is returned. | ||
185 | /// </returns> | ||
186 | List<TaskInventoryItem> GetInventoryItems(InventoryType type); | ||
187 | |||
178 | /// <summary> | 188 | /// <summary> |
179 | /// Get the scene object referenced by an inventory item. | 189 | /// Get the scene object referenced by an inventory item. |
180 | /// </summary> | 190 | /// </summary> |
@@ -228,6 +238,16 @@ namespace OpenSim.Region.Framework.Interfaces | |||
228 | bool ContainsScripts(); | 238 | bool ContainsScripts(); |
229 | 239 | ||
230 | /// <summary> | 240 | /// <summary> |
241 | /// Returns the count of scripts contained | ||
242 | /// </summary></returns> | ||
243 | int ScriptCount(); | ||
244 | |||
245 | /// <summary> | ||
246 | /// Returns the count of running scripts contained | ||
247 | /// </summary></returns> | ||
248 | int RunningScriptCount(); | ||
249 | |||
250 | /// <summary> | ||
231 | /// Get the uuids of all items in this inventory | 251 | /// Get the uuids of all items in this inventory |
232 | /// </summary> | 252 | /// </summary> |
233 | /// <returns></returns> | 253 | /// <returns></returns> |
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index 76f1641..9cd27f9 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs | |||
@@ -39,13 +39,23 @@ namespace OpenSim.Region.Framework.Interfaces | |||
39 | 39 | ||
40 | public interface IEntityTransferModule | 40 | public interface IEntityTransferModule |
41 | { | 41 | { |
42 | void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position, | 42 | /// <summary> |
43 | Vector3 lookAt, uint teleportFlags); | 43 | /// Teleport an agent within the same or to a different region. |
44 | /// </summary> | ||
45 | /// <param name='agent'></param> | ||
46 | /// <param name='regionHandle'> | ||
47 | /// The handle of the destination region. If it's the same as the region currently | ||
48 | /// occupied by the agent then the teleport will be within that region. | ||
49 | /// </param> | ||
50 | /// <param name='position'></param> | ||
51 | /// <param name='lookAt'></param> | ||
52 | /// <param name='teleportFlags'></param> | ||
53 | void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags); | ||
44 | 54 | ||
45 | bool TeleportHome(UUID id, IClientAPI client); | 55 | bool TeleportHome(UUID id, IClientAPI client); |
46 | 56 | ||
47 | void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination, | 57 | void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination, |
48 | Vector3 position, Vector3 lookAt, uint teleportFlags, IEventQueue eq); | 58 | Vector3 position, Vector3 lookAt, uint teleportFlags); |
49 | 59 | ||
50 | bool Cross(ScenePresence agent, bool isFlying); | 60 | bool Cross(ScenePresence agent, bool isFlying); |
51 | 61 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index 72e79ed..ca2ad94 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs | |||
@@ -47,5 +47,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
47 | void sendRegionHandshakeToAll(); | 47 | void sendRegionHandshakeToAll(); |
48 | void TriggerEstateInfoChange(); | 48 | void TriggerEstateInfoChange(); |
49 | void TriggerRegionInfoChange(); | 49 | void TriggerRegionInfoChange(); |
50 | |||
51 | void setEstateTerrainBaseTexture(int level, UUID texture); | ||
52 | void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue); | ||
50 | } | 53 | } |
51 | } | 54 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs new file mode 100644 index 0000000..baac6e8 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors | ||
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 OpenSim 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 | |||
32 | namespace OpenSim.Region.Framework.Interfaces | ||
33 | { | ||
34 | public delegate void TakeValueCallback(string s); | ||
35 | |||
36 | public interface IJsonStoreModule | ||
37 | { | ||
38 | bool CreateStore(string value, out UUID result); | ||
39 | bool DestroyStore(UUID storeID); | ||
40 | bool TestPath(UUID storeID, string path, bool useJson); | ||
41 | bool SetValue(UUID storeID, string path, string value, bool useJson); | ||
42 | bool RemoveValue(UUID storeID, string path); | ||
43 | bool GetValue(UUID storeID, string path, bool useJson, out string value); | ||
44 | |||
45 | void TakeValue(UUID storeID, string path, bool useJson, TakeValueCallback cback); | ||
46 | void ReadValue(UUID storeID, string path, bool useJson, TakeValueCallback cback); | ||
47 | } | ||
48 | } | ||
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index dc3ff89..860483d 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs | |||
@@ -113,9 +113,11 @@ namespace OpenSim.Region.Framework.Interfaces | |||
113 | /// </param> | 113 | /// </param> |
114 | /// <param name="landAtTarget"> | 114 | /// <param name="landAtTarget"> |
115 | /// If true and the avatar is flying when it reaches the target, land. | 115 | /// If true and the avatar is flying when it reaches the target, land. |
116 | /// </param> | 116 | /// </param> name="running"> |
117 | /// If true, NPC moves with running speed. | ||
117 | /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> | 118 | /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> |
118 | bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget); | 119 | /// |
120 | bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running); | ||
119 | 121 | ||
120 | /// <summary> | 122 | /// <summary> |
121 | /// Stop the NPC's current movement. | 123 | /// Stop the NPC's current movement. |
@@ -135,6 +137,36 @@ namespace OpenSim.Region.Framework.Interfaces | |||
135 | bool Say(UUID agentID, Scene scene, string text); | 137 | bool Say(UUID agentID, Scene scene, string text); |
136 | 138 | ||
137 | /// <summary> | 139 | /// <summary> |
140 | /// Get the NPC to say something. | ||
141 | /// </summary> | ||
142 | /// <param name="agentID">The UUID of the NPC</param> | ||
143 | /// <param name="scene"></param> | ||
144 | /// <param name="text"></param> | ||
145 | /// <param name="channel"></param> | ||
146 | /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> | ||
147 | bool Say(UUID agentID, Scene scene, string text, int channel); | ||
148 | |||
149 | /// <summary> | ||
150 | /// Get the NPC to shout something. | ||
151 | /// </summary> | ||
152 | /// <param name="agentID">The UUID of the NPC</param> | ||
153 | /// <param name="scene"></param> | ||
154 | /// <param name="text"></param> | ||
155 | /// <param name="channel"></param> | ||
156 | /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> | ||
157 | bool Shout(UUID agentID, Scene scene, string text, int channel); | ||
158 | |||
159 | /// <summary> | ||
160 | /// Get the NPC to whisper something. | ||
161 | /// </summary> | ||
162 | /// <param name="agentID">The UUID of the NPC</param> | ||
163 | /// <param name="scene"></param> | ||
164 | /// <param name="text"></param> | ||
165 | /// <param name="channel"></param> | ||
166 | /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> | ||
167 | bool Whisper(UUID agentID, Scene scene, string text, int channel); | ||
168 | |||
169 | /// <summary> | ||
138 | /// Sit the NPC. | 170 | /// Sit the NPC. |
139 | /// </summary> | 171 | /// </summary> |
140 | /// <param name="agentID"></param> | 172 | /// <param name="agentID"></param> |
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index ce66100..143af48 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs | |||
@@ -71,6 +71,12 @@ namespace OpenSim.Region.Framework.Interfaces | |||
71 | 71 | ||
72 | bool HasScript(UUID itemID, out bool running); | 72 | bool HasScript(UUID itemID, out bool running); |
73 | 73 | ||
74 | /// <summary> | ||
75 | /// Returns true if a script is running. | ||
76 | /// </summary> | ||
77 | /// <param name="itemID">The item ID of the script.</param> | ||
78 | bool GetScriptState(UUID itemID); | ||
79 | |||
74 | void SaveAllState(); | 80 | void SaveAllState(); |
75 | 81 | ||
76 | /// <summary> | 82 | /// <summary> |
@@ -79,6 +85,14 @@ namespace OpenSim.Region.Framework.Interfaces | |||
79 | void StartProcessing(); | 85 | void StartProcessing(); |
80 | 86 | ||
81 | /// <summary> | 87 | /// <summary> |
88 | /// Get the execution times of all scripts in the given array if they are currently running. | ||
89 | /// </summary> | ||
90 | /// <returns> | ||
91 | /// A float the value is a representative execution time in milliseconds of all scripts in that Array. | ||
92 | /// </returns> | ||
93 | float GetScriptExecutionTime(List<UUID> itemIDs); | ||
94 | |||
95 | /// <summary> | ||
82 | /// Get the execution times of all scripts in each object. | 96 | /// Get the execution times of all scripts in each object. |
83 | /// </summary> | 97 | /// </summary> |
84 | /// <returns> | 98 | /// <returns> |
@@ -87,4 +101,4 @@ namespace OpenSim.Region.Framework.Interfaces | |||
87 | /// </returns> | 101 | /// </returns> |
88 | Dictionary<uint, float> GetObjectScriptsExecutionTimes(); | 102 | Dictionary<uint, float> GetObjectScriptsExecutionTimes(); |
89 | } | 103 | } |
90 | } \ No newline at end of file | 104 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs index e8e375e..4e74781 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs | |||
@@ -103,7 +103,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
103 | /// <param name='msg'> | 103 | /// <param name='msg'> |
104 | /// Message. | 104 | /// Message. |
105 | /// </param> | 105 | /// </param> |
106 | bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error); | 106 | void DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg); |
107 | 107 | ||
108 | /// <summary> | 108 | /// <summary> |
109 | /// Are there any listen events ready to be dispatched? | 109 | /// Are there any listen events ready to be dispatched? |
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index e577958..9ddac19 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -294,6 +294,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
294 | return "FALLDOWN"; | 294 | return "FALLDOWN"; |
295 | } | 295 | } |
296 | 296 | ||
297 | // Check if the user has stopped walking just now | ||
298 | if (CurrentMovementAnimation == "WALK" && (move == Vector3.Zero)) | ||
299 | return "STAND"; | ||
300 | |||
297 | return CurrentMovementAnimation; | 301 | return CurrentMovementAnimation; |
298 | } | 302 | } |
299 | 303 | ||
@@ -418,13 +422,16 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
418 | /// </summary> | 422 | /// </summary> |
419 | public void UpdateMovementAnimations() | 423 | public void UpdateMovementAnimations() |
420 | { | 424 | { |
421 | CurrentMovementAnimation = DetermineMovementAnimation(); | 425 | lock (m_animations) |
426 | { | ||
427 | CurrentMovementAnimation = DetermineMovementAnimation(); | ||
422 | 428 | ||
423 | // m_log.DebugFormat( | 429 | // m_log.DebugFormat( |
424 | // "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", | 430 | // "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", |
425 | // CurrentMovementAnimation, m_scenePresence.Name); | 431 | // CurrentMovementAnimation, m_scenePresence.Name); |
426 | 432 | ||
427 | TrySetMovementAnimation(CurrentMovementAnimation); | 433 | TrySetMovementAnimation(CurrentMovementAnimation); |
434 | } | ||
428 | } | 435 | } |
429 | 436 | ||
430 | public UUID[] GetAnimationArray() | 437 | public UUID[] GetAnimationArray() |
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index f678d07..834464b 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs | |||
@@ -117,7 +117,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
117 | 117 | ||
118 | private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) | 118 | private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) |
119 | { | 119 | { |
120 | m_log.Debug("[ASYNC DELETER]: Starting send to inventory loop"); | 120 | // m_log.Debug("[ASYNC DELETER]: Starting send to inventory loop"); |
121 | 121 | ||
122 | // We must set appearance parameters in the en_US culture in order to avoid issues where values are saved | 122 | // We must set appearance parameters in the en_US culture in order to avoid issues where values are saved |
123 | // in a culture where decimal points are commas and then reloaded in a culture which just treats them as | 123 | // in a culture where decimal points are commas and then reloaded in a culture which just treats them as |
@@ -147,9 +147,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
147 | { | 147 | { |
148 | x = m_inventoryDeletes.Dequeue(); | 148 | x = m_inventoryDeletes.Dequeue(); |
149 | 149 | ||
150 | m_log.DebugFormat( | 150 | // m_log.DebugFormat( |
151 | "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.", | 151 | // "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.", |
152 | left, x.action, x.objectGroups.Count); | 152 | // left, x.action, x.objectGroups.Count); |
153 | 153 | ||
154 | try | 154 | try |
155 | { | 155 | { |
@@ -185,7 +185,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
185 | e.StackTrace); | 185 | e.StackTrace); |
186 | } | 186 | } |
187 | 187 | ||
188 | m_log.Debug("[ASYNC DELETER]: No objects left in inventory send queue."); | 188 | // m_log.Debug("[ASYNC DELETER]: No objects left in inventory send queue."); |
189 | 189 | ||
190 | return false; | 190 | return false; |
191 | } | 191 | } |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 2365cfe..7688cf8 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -53,6 +53,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
53 | 53 | ||
54 | public event ClientMovement OnClientMovement; | 54 | public event ClientMovement OnClientMovement; |
55 | 55 | ||
56 | public delegate void OnTerrainTaintedDelegate(); | ||
57 | |||
58 | public event OnTerrainTaintedDelegate OnTerrainTainted; | ||
59 | |||
56 | public delegate void OnTerrainTickDelegate(); | 60 | public delegate void OnTerrainTickDelegate(); |
57 | 61 | ||
58 | public delegate void OnTerrainUpdateDelegate(); | 62 | public delegate void OnTerrainUpdateDelegate(); |
@@ -484,6 +488,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
484 | public delegate void SceneObjectPartUpdated(SceneObjectPart sop); | 488 | public delegate void SceneObjectPartUpdated(SceneObjectPart sop); |
485 | public event SceneObjectPartUpdated OnSceneObjectPartUpdated; | 489 | public event SceneObjectPartUpdated OnSceneObjectPartUpdated; |
486 | 490 | ||
491 | public delegate void ScenePresenceUpdated(ScenePresence sp); | ||
492 | public event ScenePresenceUpdated OnScenePresenceUpdated; | ||
493 | |||
487 | public delegate void RegionUp(GridRegion region); | 494 | public delegate void RegionUp(GridRegion region); |
488 | public event RegionUp OnRegionUp; | 495 | public event RegionUp OnRegionUp; |
489 | 496 | ||
@@ -935,6 +942,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
935 | } | 942 | } |
936 | } | 943 | } |
937 | 944 | ||
945 | public void TriggerTerrainTainted() | ||
946 | { | ||
947 | OnTerrainTaintedDelegate handlerTerrainTainted = OnTerrainTainted; | ||
948 | if (handlerTerrainTainted != null) | ||
949 | { | ||
950 | foreach (OnTerrainTickDelegate d in handlerTerrainTainted.GetInvocationList()) | ||
951 | { | ||
952 | try | ||
953 | { | ||
954 | d(); | ||
955 | } | ||
956 | catch (Exception e) | ||
957 | { | ||
958 | m_log.ErrorFormat( | ||
959 | "[EVENT MANAGER]: Delegate for TriggerTerrainTainted failed - continuing. {0} {1}", | ||
960 | e.Message, e.StackTrace); | ||
961 | } | ||
962 | } | ||
963 | } | ||
964 | } | ||
965 | |||
938 | public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) | 966 | public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) |
939 | { | 967 | { |
940 | OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = OnParcelPrimCountAdd; | 968 | OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = OnParcelPrimCountAdd; |
@@ -2367,6 +2395,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2367 | } | 2395 | } |
2368 | } | 2396 | } |
2369 | 2397 | ||
2398 | public void TriggerScenePresenceUpdated(ScenePresence sp) | ||
2399 | { | ||
2400 | ScenePresenceUpdated handler = OnScenePresenceUpdated; | ||
2401 | if (handler != null) | ||
2402 | { | ||
2403 | foreach (ScenePresenceUpdated d in handler.GetInvocationList()) | ||
2404 | { | ||
2405 | try | ||
2406 | { | ||
2407 | d(sp); | ||
2408 | } | ||
2409 | catch (Exception e) | ||
2410 | { | ||
2411 | m_log.ErrorFormat( | ||
2412 | "[EVENT MANAGER]: Delegate for TriggerScenePresenceUpdated failed - continuing. {0} {1}", | ||
2413 | e.Message, e.StackTrace); | ||
2414 | } | ||
2415 | } | ||
2416 | } | ||
2417 | } | ||
2418 | |||
2370 | public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, | 2419 | public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, |
2371 | int local_id, IClientAPI remote_client) | 2420 | int local_id, IClientAPI remote_client) |
2372 | { | 2421 | { |
diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs index 6c5685c..1365831 100644 --- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs +++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs | |||
@@ -48,16 +48,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
48 | { | 48 | { |
49 | public class RegionStatsHandler : IStreamedRequestHandler | 49 | public class RegionStatsHandler : IStreamedRequestHandler |
50 | { | 50 | { |
51 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
51 | private string osRXStatsURI = String.Empty; | 53 | private string osRXStatsURI = String.Empty; |
52 | private string osXStatsURI = String.Empty; | 54 | private string osXStatsURI = String.Empty; |
53 | //private string osSecret = String.Empty; | 55 | //private string osSecret = String.Empty; |
54 | private OpenSim.Framework.RegionInfo regionInfo; | 56 | private OpenSim.Framework.RegionInfo regionInfo; |
55 | public string localZone = TimeZone.CurrentTimeZone.StandardName; | 57 | public string localZone = TimeZone.CurrentTimeZone.StandardName; |
56 | public TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); | 58 | public TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); |
57 | |||
58 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
59 | 59 | ||
60 | public RegionStatsHandler(OpenSim.Framework.RegionInfo region_info) | 60 | public string Name { get { return "RegionStats"; } } |
61 | public string Description { get { return "Region Statistics"; } } | ||
62 | |||
63 | public RegionStatsHandler(RegionInfo region_info) | ||
61 | { | 64 | { |
62 | regionInfo = region_info; | 65 | regionInfo = region_info; |
63 | osRXStatsURI = Util.SHA1Hash(regionInfo.regionSecret); | 66 | osRXStatsURI = Util.SHA1Hash(regionInfo.regionSecret); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 29465c0..942c625 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -300,6 +300,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
300 | AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data, remoteClient.AgentId); | 300 | AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data, remoteClient.AgentId); |
301 | AssetService.Store(asset); | 301 | AssetService.Store(asset); |
302 | 302 | ||
303 | // m_log.DebugFormat( | ||
304 | // "[PRIM INVENTORY]: Stored asset {0} when updating item {1} in prim {2} for {3}", | ||
305 | // asset.ID, item.Name, part.Name, remoteClient.Name); | ||
306 | |||
303 | if (isScriptRunning) | 307 | if (isScriptRunning) |
304 | { | 308 | { |
305 | part.Inventory.RemoveScriptInstance(item.ItemID, false); | 309 | part.Inventory.RemoveScriptInstance(item.ItemID, false); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 3ef1e29..cf68ff4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -38,8 +38,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
38 | { | 38 | { |
39 | public partial class Scene | 39 | public partial class Scene |
40 | { | 40 | { |
41 | |||
41 | protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, | 42 | protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, |
42 | UUID fromID, bool fromAgent, bool broadcast) | 43 | UUID fromID, UUID targetID, bool fromAgent, bool broadcast) |
43 | { | 44 | { |
44 | OSChatMessage args = new OSChatMessage(); | 45 | OSChatMessage args = new OSChatMessage(); |
45 | 46 | ||
@@ -63,14 +64,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
63 | } | 64 | } |
64 | 65 | ||
65 | args.From = fromName; | 66 | args.From = fromName; |
66 | //args. | 67 | args.TargetUUID = targetID; |
67 | 68 | ||
68 | if (broadcast) | 69 | if (broadcast) |
69 | EventManager.TriggerOnChatBroadcast(this, args); | 70 | EventManager.TriggerOnChatBroadcast(this, args); |
70 | else | 71 | else |
71 | EventManager.TriggerOnChatFromWorld(this, args); | 72 | EventManager.TriggerOnChatFromWorld(this, args); |
72 | } | 73 | } |
73 | 74 | ||
75 | protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, | ||
76 | UUID fromID, bool fromAgent, bool broadcast) | ||
77 | { | ||
78 | SimChat(message, type, channel, fromPos, fromName, fromID, UUID.Zero, fromAgent, broadcast); | ||
79 | } | ||
80 | |||
74 | /// <summary> | 81 | /// <summary> |
75 | /// | 82 | /// |
76 | /// </summary> | 83 | /// </summary> |
@@ -108,6 +115,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
108 | { | 115 | { |
109 | SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, true); | 116 | SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, true); |
110 | } | 117 | } |
118 | /// <summary> | ||
119 | /// | ||
120 | /// </summary> | ||
121 | /// <param name="message"></param> | ||
122 | /// <param name="type"></param> | ||
123 | /// <param name="fromPos"></param> | ||
124 | /// <param name="fromName"></param> | ||
125 | /// <param name="fromAgentID"></param> | ||
126 | /// <param name="targetID"></param> | ||
127 | public void SimChatToAgent(UUID targetID, byte[] message, Vector3 fromPos, string fromName, UUID fromID, bool fromAgent) | ||
128 | { | ||
129 | SimChat(message, ChatTypeEnum.Say, 0, fromPos, fromName, fromID, targetID, fromAgent, false); | ||
130 | } | ||
111 | 131 | ||
112 | /// <summary> | 132 | /// <summary> |
113 | /// Invoked when the client requests a prim. | 133 | /// Invoked when the client requests a prim. |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index e1fedf4..535d87a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -67,6 +67,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
67 | public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene); | 67 | public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene); |
68 | public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand); | 68 | public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand); |
69 | public delegate bool IsGodHandler(UUID user, Scene requestFromScene); | 69 | public delegate bool IsGodHandler(UUID user, Scene requestFromScene); |
70 | public delegate bool IsGridGodHandler(UUID user, Scene requestFromScene); | ||
70 | public delegate bool IsAdministratorHandler(UUID user); | 71 | public delegate bool IsAdministratorHandler(UUID user); |
71 | public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); | 72 | public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); |
72 | public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene); | 73 | public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene); |
@@ -134,6 +135,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
134 | public event RunConsoleCommandHandler OnRunConsoleCommand; | 135 | public event RunConsoleCommandHandler OnRunConsoleCommand; |
135 | public event IssueEstateCommandHandler OnIssueEstateCommand; | 136 | public event IssueEstateCommandHandler OnIssueEstateCommand; |
136 | public event IsGodHandler OnIsGod; | 137 | public event IsGodHandler OnIsGod; |
138 | public event IsGridGodHandler OnIsGridGod; | ||
137 | public event IsAdministratorHandler OnIsAdministrator; | 139 | public event IsAdministratorHandler OnIsAdministrator; |
138 | // public event EditParcelHandler OnEditParcel; | 140 | // public event EditParcelHandler OnEditParcel; |
139 | public event EditParcelPropertiesHandler OnEditParcelProperties; | 141 | public event EditParcelPropertiesHandler OnEditParcelProperties; |
@@ -728,6 +730,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
728 | return true; | 730 | return true; |
729 | } | 731 | } |
730 | 732 | ||
733 | public bool IsGridGod(UUID user) | ||
734 | { | ||
735 | IsGridGodHandler handler = OnIsGridGod; | ||
736 | if (handler != null) | ||
737 | { | ||
738 | Delegate[] list = handler.GetInvocationList(); | ||
739 | foreach (IsGridGodHandler h in list) | ||
740 | { | ||
741 | if (h(user, m_scene) == false) | ||
742 | return false; | ||
743 | } | ||
744 | } | ||
745 | return true; | ||
746 | } | ||
747 | |||
731 | public bool IsAdministrator(UUID user) | 748 | public bool IsAdministrator(UUID user) |
732 | { | 749 | { |
733 | IsAdministratorHandler handler = OnIsAdministrator; | 750 | IsAdministratorHandler handler = OnIsAdministrator; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a9a4cda..3e11db3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -103,6 +103,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
103 | public bool m_trustBinaries; | 103 | public bool m_trustBinaries; |
104 | public bool m_allowScriptCrossings; | 104 | public bool m_allowScriptCrossings; |
105 | public bool m_useFlySlow; | 105 | public bool m_useFlySlow; |
106 | public bool m_useTrashOnDelete = true; | ||
106 | 107 | ||
107 | /// <summary> | 108 | /// <summary> |
108 | /// Temporarily setting to trigger appearance resends at 60 second intervals. | 109 | /// Temporarily setting to trigger appearance resends at 60 second intervals. |
@@ -458,6 +459,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
458 | { | 459 | { |
459 | if (m_simulationService == null) | 460 | if (m_simulationService == null) |
460 | m_simulationService = RequestModuleInterface<ISimulationService>(); | 461 | m_simulationService = RequestModuleInterface<ISimulationService>(); |
462 | |||
461 | return m_simulationService; | 463 | return m_simulationService; |
462 | } | 464 | } |
463 | } | 465 | } |
@@ -589,6 +591,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
589 | get { return m_sceneGraph.Entities; } | 591 | get { return m_sceneGraph.Entities; } |
590 | } | 592 | } |
591 | 593 | ||
594 | // can be closest/random/sequence | ||
595 | private string m_SpawnPointRouting = "closest"; | ||
596 | // used in sequence see: SpawnPoint() | ||
597 | private int m_SpawnPoint; | ||
598 | public string SpawnPointRouting | ||
599 | { | ||
600 | get { return m_SpawnPointRouting; } | ||
601 | } | ||
602 | |||
592 | #endregion Properties | 603 | #endregion Properties |
593 | 604 | ||
594 | #region Constructors | 605 | #region Constructors |
@@ -606,7 +617,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
606 | 617 | ||
607 | Random random = new Random(); | 618 | Random random = new Random(); |
608 | 619 | ||
609 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4); | 620 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); |
610 | m_moduleLoader = moduleLoader; | 621 | m_moduleLoader = moduleLoader; |
611 | m_authenticateHandler = authen; | 622 | m_authenticateHandler = authen; |
612 | m_sceneGridService = sceneGridService; | 623 | m_sceneGridService = sceneGridService; |
@@ -726,6 +737,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
726 | m_maxPhys = RegionInfo.PhysPrimMax; | 737 | m_maxPhys = RegionInfo.PhysPrimMax; |
727 | } | 738 | } |
728 | 739 | ||
740 | m_SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | ||
741 | |||
729 | // Here, if clamping is requested in either global or | 742 | // Here, if clamping is requested in either global or |
730 | // local config, it will be used | 743 | // local config, it will be used |
731 | // | 744 | // |
@@ -735,6 +748,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
735 | m_clampPrimSize = true; | 748 | m_clampPrimSize = true; |
736 | } | 749 | } |
737 | 750 | ||
751 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); | ||
738 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 752 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
739 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 753 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
740 | m_dontPersistBefore = | 754 | m_dontPersistBefore = |
@@ -833,13 +847,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
833 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 847 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
834 | } | 848 | } |
835 | 849 | ||
836 | /// <summary> | ||
837 | /// Mock constructor for scene group persistency unit tests. | ||
838 | /// SceneObjectGroup RegionId property is delegated to Scene. | ||
839 | /// </summary> | ||
840 | /// <param name="regInfo"></param> | ||
841 | public Scene(RegionInfo regInfo) | 850 | public Scene(RegionInfo regInfo) |
842 | { | 851 | { |
852 | PhysicalPrims = true; | ||
853 | CollidablePrims = true; | ||
854 | |||
843 | BordersLocked = true; | 855 | BordersLocked = true; |
844 | Border northBorder = new Border(); | 856 | Border northBorder = new Border(); |
845 | northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- | 857 | northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- |
@@ -866,8 +878,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
866 | m_eventManager = new EventManager(); | 878 | m_eventManager = new EventManager(); |
867 | 879 | ||
868 | m_permissions = new ScenePermissions(this); | 880 | m_permissions = new ScenePermissions(this); |
869 | |||
870 | // m_lastUpdate = Util.EnvironmentTickCount(); | ||
871 | } | 881 | } |
872 | 882 | ||
873 | #endregion | 883 | #endregion |
@@ -1404,6 +1414,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1404 | 1414 | ||
1405 | try | 1415 | try |
1406 | { | 1416 | { |
1417 | // Apply taints in terrain module to terrain in physics scene | ||
1418 | if (Frame % m_update_terrain == 0) | ||
1419 | { | ||
1420 | terMS = Util.EnvironmentTickCount(); | ||
1421 | UpdateTerrain(); | ||
1422 | terrainMS = Util.EnvironmentTickCountSubtract(terMS); | ||
1423 | } | ||
1424 | |||
1407 | tmpPhysicsMS2 = Util.EnvironmentTickCount(); | 1425 | tmpPhysicsMS2 = Util.EnvironmentTickCount(); |
1408 | if ((Frame % m_update_physics == 0) && m_physics_enabled) | 1426 | if ((Frame % m_update_physics == 0) && m_physics_enabled) |
1409 | m_sceneGraph.UpdatePreparePhysics(); | 1427 | m_sceneGraph.UpdatePreparePhysics(); |
@@ -1468,13 +1486,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1468 | backupMS = Util.EnvironmentTickCountSubtract(backMS); | 1486 | backupMS = Util.EnvironmentTickCountSubtract(backMS); |
1469 | } | 1487 | } |
1470 | 1488 | ||
1471 | if (Frame % m_update_terrain == 0) | ||
1472 | { | ||
1473 | terMS = Util.EnvironmentTickCount(); | ||
1474 | UpdateTerrain(); | ||
1475 | terrainMS = Util.EnvironmentTickCountSubtract(terMS); | ||
1476 | } | ||
1477 | |||
1478 | //if (Frame % m_update_land == 0) | 1489 | //if (Frame % m_update_land == 0) |
1479 | //{ | 1490 | //{ |
1480 | // int ldMS = Util.EnvironmentTickCount(); | 1491 | // int ldMS = Util.EnvironmentTickCount(); |
@@ -2684,10 +2695,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2684 | { | 2695 | { |
2685 | SceneObjectGroup grp = sceneObject; | 2696 | SceneObjectGroup grp = sceneObject; |
2686 | 2697 | ||
2687 | m_log.DebugFormat( | 2698 | // m_log.DebugFormat( |
2688 | "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); | 2699 | // "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); |
2689 | m_log.DebugFormat( | 2700 | // m_log.DebugFormat( |
2690 | "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); | 2701 | // "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); |
2691 | 2702 | ||
2692 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2703 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2693 | 2704 | ||
@@ -3382,8 +3393,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3382 | try | 3393 | try |
3383 | { | 3394 | { |
3384 | m_log.DebugFormat( | 3395 | m_log.DebugFormat( |
3385 | "[SCENE]: Removing {0} agent {1} from region {2}", | 3396 | "[SCENE]: Removing {0} agent {1} {2} from region {3}", |
3386 | (isChildAgent ? "child" : "root"), agentID, RegionInfo.RegionName); | 3397 | (isChildAgent ? "child" : "root"), avatar.Name, agentID, RegionInfo.RegionName); |
3387 | 3398 | ||
3388 | m_sceneGraph.removeUserCount(!isChildAgent); | 3399 | m_sceneGraph.removeUserCount(!isChildAgent); |
3389 | 3400 | ||
@@ -3554,7 +3565,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3554 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup) | 3565 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup) |
3555 | { | 3566 | { |
3556 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || | 3567 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || |
3557 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); | 3568 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); |
3558 | bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); | 3569 | bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); |
3559 | bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); | 3570 | bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); |
3560 | 3571 | ||
@@ -3570,8 +3581,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3570 | // Don't disable this log message - it's too helpful | 3581 | // Don't disable this log message - it's too helpful |
3571 | m_log.DebugFormat( | 3582 | m_log.DebugFormat( |
3572 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", | 3583 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", |
3573 | RegionInfo.RegionName, (agent.child ? "child" : "root"),agent.firstname, agent.lastname, | 3584 | RegionInfo.RegionName, |
3574 | agent.AgentID, agent.circuitcode, agent.IPAddress, agent.Viewer, ((TPFlags)teleportFlags).ToString(), agent.startpos); | 3585 | (agent.child ? "child" : "root"), |
3586 | agent.firstname, | ||
3587 | agent.lastname, | ||
3588 | agent.AgentID, | ||
3589 | agent.circuitcode, | ||
3590 | agent.IPAddress, | ||
3591 | agent.Viewer, | ||
3592 | ((TPFlags)teleportFlags).ToString(), | ||
3593 | agent.startpos | ||
3594 | ); | ||
3575 | 3595 | ||
3576 | if (LoginsDisabled) | 3596 | if (LoginsDisabled) |
3577 | { | 3597 | { |
@@ -3586,7 +3606,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3586 | // We have a zombie from a crashed session. | 3606 | // We have a zombie from a crashed session. |
3587 | // Or the same user is trying to be root twice here, won't work. | 3607 | // Or the same user is trying to be root twice here, won't work. |
3588 | // Kill it. | 3608 | // Kill it. |
3589 | m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName); | 3609 | m_log.DebugFormat( |
3610 | "[SCENE]: Zombie scene presence detected for {0} in {1}", | ||
3611 | agent.AgentID, | ||
3612 | RegionInfo.RegionName | ||
3613 | ); | ||
3590 | sp.ControllingClient.Close(); | 3614 | sp.ControllingClient.Close(); |
3591 | sp = null; | 3615 | sp = null; |
3592 | } | 3616 | } |
@@ -3613,8 +3637,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3613 | { | 3637 | { |
3614 | if (!VerifyUserPresence(agent, out reason)) | 3638 | if (!VerifyUserPresence(agent, out reason)) |
3615 | return false; | 3639 | return false; |
3616 | } | 3640 | } catch (Exception e) |
3617 | catch (Exception e) | ||
3618 | { | 3641 | { |
3619 | m_log.ErrorFormat( | 3642 | m_log.ErrorFormat( |
3620 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | 3643 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
@@ -3649,8 +3672,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3649 | CapsModule.SetAgentCapsSeeds(agent); | 3672 | CapsModule.SetAgentCapsSeeds(agent); |
3650 | CapsModule.CreateCaps(agent.AgentID); | 3673 | CapsModule.CreateCaps(agent.AgentID); |
3651 | } | 3674 | } |
3652 | } | 3675 | } else |
3653 | else | ||
3654 | { | 3676 | { |
3655 | // Let the SP know how we got here. This has a lot of interesting | 3677 | // Let the SP know how we got here. This has a lot of interesting |
3656 | // uses down the line. | 3678 | // uses down the line. |
@@ -3673,7 +3695,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3673 | agent.teleportFlags = teleportFlags; | 3695 | agent.teleportFlags = teleportFlags; |
3674 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | 3696 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); |
3675 | 3697 | ||
3676 | if (vialogin) | 3698 | if (vialogin) |
3677 | { | 3699 | { |
3678 | // CleanDroppedAttachments(); | 3700 | // CleanDroppedAttachments(); |
3679 | 3701 | ||
@@ -3714,8 +3736,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3714 | agent.startpos.Z = 720; | 3736 | agent.startpos.Z = 720; |
3715 | } | 3737 | } |
3716 | } | 3738 | } |
3717 | } | 3739 | } else |
3718 | else | ||
3719 | { | 3740 | { |
3720 | if (agent.startpos.X > EastBorders[0].BorderLine.Z) | 3741 | if (agent.startpos.X > EastBorders[0].BorderLine.Z) |
3721 | { | 3742 | { |
@@ -3741,10 +3762,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
3741 | SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); | 3762 | SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); |
3742 | // Can have multiple SpawnPoints | 3763 | // Can have multiple SpawnPoints |
3743 | List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints(); | 3764 | List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints(); |
3744 | if ( spawnpoints.Count > 1) | 3765 | if (spawnpoints.Count > 1) |
3745 | { | 3766 | { |
3746 | // We have multiple SpawnPoints, Route the agent to a random one | 3767 | // We have multiple SpawnPoints, Route the agent to a random or sequential one |
3747 | agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count)].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 3768 | if (SpawnPointRouting == "random") |
3769 | agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation( | ||
3770 | telehub.AbsolutePosition, | ||
3771 | telehub.GroupRotation | ||
3772 | ); | ||
3773 | else | ||
3774 | agent.startpos = spawnpoints[SpawnPoint()].GetLocation( | ||
3775 | telehub.AbsolutePosition, | ||
3776 | telehub.GroupRotation | ||
3777 | ); | ||
3748 | } | 3778 | } |
3749 | else | 3779 | else |
3750 | { | 3780 | { |
@@ -3981,41 +4011,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
3981 | return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc); | 4011 | return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc); |
3982 | } | 4012 | } |
3983 | 4013 | ||
3984 | /// <summary> | 4014 | // /// <summary> |
3985 | /// The Grid has requested that we log-off a user. Log them off. | 4015 | // /// The Grid has requested that we log-off a user. Log them off. |
3986 | /// </summary> | 4016 | // /// </summary> |
3987 | /// <param name="AvatarID">Unique ID of the avatar to log-off</param> | 4017 | // /// <param name="AvatarID">Unique ID of the avatar to log-off</param> |
3988 | /// <param name="RegionSecret">SecureSessionID of the user, or the RegionSecret text when logging on to the grid</param> | 4018 | // /// <param name="RegionSecret">SecureSessionID of the user, or the RegionSecret text when logging on to the grid</param> |
3989 | /// <param name="message">message to display to the user. Reason for being logged off</param> | 4019 | // /// <param name="message">message to display to the user. Reason for being logged off</param> |
3990 | public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) | 4020 | // public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) |
3991 | { | 4021 | // { |
3992 | ScenePresence loggingOffUser = GetScenePresence(AvatarID); | 4022 | // ScenePresence loggingOffUser = GetScenePresence(AvatarID); |
3993 | if (loggingOffUser != null) | 4023 | // if (loggingOffUser != null) |
3994 | { | 4024 | // { |
3995 | UUID localRegionSecret = UUID.Zero; | 4025 | // UUID localRegionSecret = UUID.Zero; |
3996 | bool parsedsecret = UUID.TryParse(m_regInfo.regionSecret, out localRegionSecret); | 4026 | // bool parsedsecret = UUID.TryParse(m_regInfo.regionSecret, out localRegionSecret); |
3997 | 4027 | // | |
3998 | // Region Secret is used here in case a new sessionid overwrites an old one on the user server. | 4028 | // // Region Secret is used here in case a new sessionid overwrites an old one on the user server. |
3999 | // Will update the user server in a few revisions to use it. | 4029 | // // Will update the user server in a few revisions to use it. |
4000 | 4030 | // | |
4001 | if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret)) | 4031 | // if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret)) |
4002 | { | 4032 | // { |
4003 | m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, loggingOffUser.KnownRegionHandles); | 4033 | // m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, loggingOffUser.KnownRegionHandles); |
4004 | loggingOffUser.ControllingClient.Kick(message); | 4034 | // loggingOffUser.ControllingClient.Kick(message); |
4005 | // Give them a second to receive the message! | 4035 | // // Give them a second to receive the message! |
4006 | Thread.Sleep(1000); | 4036 | // Thread.Sleep(1000); |
4007 | loggingOffUser.ControllingClient.Close(); | 4037 | // loggingOffUser.ControllingClient.Close(); |
4008 | } | 4038 | // } |
4009 | else | 4039 | // else |
4010 | { | 4040 | // { |
4011 | m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate"); | 4041 | // m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate"); |
4012 | } | 4042 | // } |
4013 | } | 4043 | // } |
4014 | else | 4044 | // else |
4015 | { | 4045 | // { |
4016 | m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString()); | 4046 | // m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString()); |
4017 | } | 4047 | // } |
4018 | } | 4048 | // } |
4019 | 4049 | ||
4020 | /// <summary> | 4050 | /// <summary> |
4021 | /// Triggered when an agent crosses into this sim. Also happens on initial login. | 4051 | /// Triggered when an agent crosses into this sim. Also happens on initial login. |
@@ -4071,7 +4101,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4071 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4101 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
4072 | if (nearestParcel == null) | 4102 | if (nearestParcel == null) |
4073 | { | 4103 | { |
4074 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: no allowed parcel", cAgentData.AgentID); | 4104 | m_log.DebugFormat( |
4105 | "[SCENE]: Denying root agent entry to {0} in {1}: no allowed parcel", | ||
4106 | cAgentData.AgentID, RegionInfo.RegionName); | ||
4107 | |||
4075 | return false; | 4108 | return false; |
4076 | } | 4109 | } |
4077 | 4110 | ||
@@ -5637,5 +5670,19 @@ Environment.Exit(1); | |||
5637 | } | 5670 | } |
5638 | } | 5671 | } |
5639 | } | 5672 | } |
5673 | |||
5674 | // manage and select spawn points in sequence | ||
5675 | public int SpawnPoint() | ||
5676 | { | ||
5677 | int spawnpoints = RegionInfo.RegionSettings.SpawnPoints().Count; | ||
5678 | |||
5679 | if (spawnpoints == 0) | ||
5680 | return 0; | ||
5681 | |||
5682 | m_SpawnPoint++; | ||
5683 | if (m_SpawnPoint > spawnpoints) | ||
5684 | m_SpawnPoint = 1; | ||
5685 | return m_SpawnPoint - 1; | ||
5686 | } | ||
5640 | } | 5687 | } |
5641 | } | 5688 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index b806d91..77e808e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -156,7 +156,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
156 | // that the region position is cached or performance will degrade | 156 | // that the region position is cached or performance will degrade |
157 | Utils.LongToUInts(regionHandle, out x, out y); | 157 | Utils.LongToUInts(regionHandle, out x, out y); |
158 | GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | 158 | GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); |
159 | // bool v = true; | 159 | if (dest == null) |
160 | continue; | ||
161 | |||
160 | if (!simulatorList.Contains(dest.ServerURI)) | 162 | if (!simulatorList.Contains(dest.ServerURI)) |
161 | { | 163 | { |
162 | // we havent seen this simulator before, add it to the list | 164 | // we havent seen this simulator before, add it to the list |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 0d178c3..00f76e0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -101,6 +101,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
101 | /// </summary> | 101 | /// </summary> |
102 | protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>(); | 102 | protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>(); |
103 | 103 | ||
104 | /// <summary> | ||
105 | /// Lock to prevent object group update, linking, delinking and duplication operations from running concurrently. | ||
106 | /// </summary> | ||
107 | /// <remarks> | ||
108 | /// These operations rely on the parts composition of the object. If allowed to run concurrently then race | ||
109 | /// conditions can occur. | ||
110 | /// </remarks> | ||
104 | private Object m_updateLock = new Object(); | 111 | private Object m_updateLock = new Object(); |
105 | 112 | ||
106 | #endregion | 113 | #endregion |
@@ -2064,12 +2071,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2064 | /// <param name="AgentID"></param> | 2071 | /// <param name="AgentID"></param> |
2065 | /// <param name="GroupID"></param> | 2072 | /// <param name="GroupID"></param> |
2066 | /// <param name="rot"></param> | 2073 | /// <param name="rot"></param> |
2074 | /// <returns>null if duplication fails, otherwise the duplicated object</returns> | ||
2075 | /// <summary> | ||
2067 | public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) | 2076 | public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) |
2068 | { | 2077 | { |
2069 | // m_log.DebugFormat( | 2078 | // m_log.DebugFormat( |
2070 | // "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", | 2079 | // "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", |
2071 | // originalPrimID, offset, AgentID); | 2080 | // originalPrimID, offset, AgentID); |
2072 | 2081 | ||
2073 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); | 2082 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); |
2074 | if (original != null) | 2083 | if (original != null) |
2075 | { | 2084 | { |
@@ -2099,25 +2108,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2099 | 2108 | ||
2100 | // FIXME: This section needs to be refactored so that it just calls AddSceneObject() | 2109 | // FIXME: This section needs to be refactored so that it just calls AddSceneObject() |
2101 | Entities.Add(copy); | 2110 | Entities.Add(copy); |
2102 | 2111 | ||
2103 | lock (SceneObjectGroupsByFullID) | 2112 | lock (SceneObjectGroupsByFullID) |
2104 | SceneObjectGroupsByFullID[copy.UUID] = copy; | 2113 | SceneObjectGroupsByFullID[copy.UUID] = copy; |
2105 | 2114 | ||
2106 | SceneObjectPart[] children = copy.Parts; | 2115 | SceneObjectPart[] children = copy.Parts; |
2107 | 2116 | ||
2108 | lock (SceneObjectGroupsByFullPartID) | 2117 | lock (SceneObjectGroupsByFullPartID) |
2109 | { | 2118 | { |
2110 | SceneObjectGroupsByFullPartID[copy.UUID] = copy; | 2119 | SceneObjectGroupsByFullPartID[copy.UUID] = copy; |
2111 | foreach (SceneObjectPart part in children) | 2120 | foreach (SceneObjectPart part in children) |
2112 | SceneObjectGroupsByFullPartID[part.UUID] = copy; | 2121 | SceneObjectGroupsByFullPartID[part.UUID] = copy; |
2113 | } | 2122 | } |
2114 | 2123 | ||
2115 | lock (SceneObjectGroupsByLocalPartID) | 2124 | lock (SceneObjectGroupsByLocalPartID) |
2116 | { | 2125 | { |
2117 | SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; | 2126 | SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; |
2118 | foreach (SceneObjectPart part in children) | 2127 | foreach (SceneObjectPart part in children) |
2119 | SceneObjectGroupsByLocalPartID[part.LocalId] = copy; | 2128 | SceneObjectGroupsByLocalPartID[part.LocalId] = copy; |
2120 | } | 2129 | } |
2121 | // PROBABLE END OF FIXME | 2130 | // PROBABLE END OF FIXME |
2122 | 2131 | ||
2123 | // Since we copy from a source group that is in selected | 2132 | // Since we copy from a source group that is in selected |
@@ -2149,11 +2158,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2149 | { | 2158 | { |
2150 | m_log.WarnFormat("[SCENE]: Attempted to duplicate nonexistant prim id {0}", GroupID); | 2159 | m_log.WarnFormat("[SCENE]: Attempted to duplicate nonexistant prim id {0}", GroupID); |
2151 | } | 2160 | } |
2152 | 2161 | ||
2153 | return null; | 2162 | return null; |
2154 | } | 2163 | } |
2155 | 2164 | ||
2156 | /// <summary> | ||
2157 | /// Calculates the distance between two Vector3s | 2165 | /// Calculates the distance between two Vector3s |
2158 | /// </summary> | 2166 | /// </summary> |
2159 | /// <param name="v1"></param> | 2167 | /// <param name="v1"></param> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a6551c1..5328ddc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2670,6 +2670,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2670 | /// <summary> | 2670 | /// <summary> |
2671 | /// Link the prims in a given group to this group | 2671 | /// Link the prims in a given group to this group |
2672 | /// </summary> | 2672 | /// </summary> |
2673 | /// <remarks> | ||
2674 | /// Do not call this method directly - use Scene.LinkObjects() instead to avoid races between threads. | ||
2675 | /// FIXME: There are places where scripts call these methods directly without locking. This is a potential race condition. | ||
2676 | /// </remarks> | ||
2673 | /// <param name="objectGroup">The group of prims which should be linked to this group</param> | 2677 | /// <param name="objectGroup">The group of prims which should be linked to this group</param> |
2674 | public void LinkToGroup(SceneObjectGroup objectGroup) | 2678 | public void LinkToGroup(SceneObjectGroup objectGroup) |
2675 | { | 2679 | { |
@@ -2751,6 +2755,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2751 | } | 2755 | } |
2752 | 2756 | ||
2753 | linkPart.LinkNum = linkNum++; | 2757 | linkPart.LinkNum = linkNum++; |
2758 | linkPart.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false); | ||
2754 | 2759 | ||
2755 | SceneObjectPart[] ogParts = objectGroup.Parts; | 2760 | SceneObjectPart[] ogParts = objectGroup.Parts; |
2756 | Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) | 2761 | Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) |
@@ -2802,6 +2807,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2802 | /// Delink the given prim from this group. The delinked prim is established as | 2807 | /// Delink the given prim from this group. The delinked prim is established as |
2803 | /// an independent SceneObjectGroup. | 2808 | /// an independent SceneObjectGroup. |
2804 | /// </summary> | 2809 | /// </summary> |
2810 | /// <remarks> | ||
2811 | /// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race | ||
2812 | /// condition. But currently there is no | ||
2813 | /// alternative method that does take a lonk to delink a single prim. | ||
2814 | /// </remarks> | ||
2805 | /// <param name="partID"></param> | 2815 | /// <param name="partID"></param> |
2806 | /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns> | 2816 | /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns> |
2807 | public SceneObjectGroup DelinkFromGroup(uint partID) | 2817 | public SceneObjectGroup DelinkFromGroup(uint partID) |
@@ -2813,6 +2823,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2813 | /// Delink the given prim from this group. The delinked prim is established as | 2823 | /// Delink the given prim from this group. The delinked prim is established as |
2814 | /// an independent SceneObjectGroup. | 2824 | /// an independent SceneObjectGroup. |
2815 | /// </summary> | 2825 | /// </summary> |
2826 | /// <remarks> | ||
2827 | /// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race | ||
2828 | /// condition. But currently there is no | ||
2829 | /// alternative method that does take a lonk to delink a single prim. | ||
2830 | /// </remarks> | ||
2816 | /// <param name="partID"></param> | 2831 | /// <param name="partID"></param> |
2817 | /// <param name="sendEvents"></param> | 2832 | /// <param name="sendEvents"></param> |
2818 | /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns> | 2833 | /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns> |
@@ -2838,6 +2853,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2838 | /// Delink the given prim from this group. The delinked prim is established as | 2853 | /// Delink the given prim from this group. The delinked prim is established as |
2839 | /// an independent SceneObjectGroup. | 2854 | /// an independent SceneObjectGroup. |
2840 | /// </summary> | 2855 | /// </summary> |
2856 | /// <remarks> | ||
2857 | /// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race | ||
2858 | /// condition. But currently there is no | ||
2859 | /// alternative method that does take a lonk to delink a single prim. | ||
2860 | /// </remarks> | ||
2841 | /// <param name="partID"></param> | 2861 | /// <param name="partID"></param> |
2842 | /// <param name="sendEvents"></param> | 2862 | /// <param name="sendEvents"></param> |
2843 | /// <returns>The object group of the newly delinked prim.</returns> | 2863 | /// <returns>The object group of the newly delinked prim.</returns> |
@@ -2971,6 +2991,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2971 | oldRot = part.RotationOffset; | 2991 | oldRot = part.RotationOffset; |
2972 | Quaternion newRot = Quaternion.Conjugate(parentRot) * worldRot; | 2992 | Quaternion newRot = Quaternion.Conjugate(parentRot) * worldRot; |
2973 | part.RotationOffset = newRot; | 2993 | part.RotationOffset = newRot; |
2994 | |||
2995 | part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false); | ||
2974 | } | 2996 | } |
2975 | 2997 | ||
2976 | /// <summary> | 2998 | /// <summary> |
@@ -3482,7 +3504,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3482 | 3504 | ||
3483 | //we need to do a terse update even if the move wasn't allowed | 3505 | //we need to do a terse update even if the move wasn't allowed |
3484 | // so that the position is reset in the client (the object snaps back) | 3506 | // so that the position is reset in the client (the object snaps back) |
3485 | ScheduleGroupForTerseUpdate(); | 3507 | RootPart.ScheduleTerseUpdate(); |
3486 | } | 3508 | } |
3487 | 3509 | ||
3488 | /// <summary> | 3510 | /// <summary> |
@@ -4182,7 +4204,72 @@ namespace OpenSim.Region.Framework.Scenes | |||
4182 | for (int i = 0; i < parts.Length; i++) | 4204 | for (int i = 0; i < parts.Length; i++) |
4183 | parts[i].TriggerScriptChangedEvent(val); | 4205 | parts[i].TriggerScriptChangedEvent(val); |
4184 | } | 4206 | } |
4185 | 4207 | ||
4208 | /// <summary> | ||
4209 | /// Returns a count of the number of scripts in this groups parts. | ||
4210 | /// </summary> | ||
4211 | public int ScriptCount() | ||
4212 | { | ||
4213 | int count = 0; | ||
4214 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4215 | for (int i = 0; i < parts.Length; i++) | ||
4216 | count += parts[i].Inventory.ScriptCount(); | ||
4217 | |||
4218 | return count; | ||
4219 | } | ||
4220 | |||
4221 | /// <summary> | ||
4222 | /// A float the value is a representative execution time in milliseconds of all scripts in the link set. | ||
4223 | /// </summary> | ||
4224 | public float ScriptExecutionTime() | ||
4225 | { | ||
4226 | IScriptModule[] engines = Scene.RequestModuleInterfaces<IScriptModule>(); | ||
4227 | |||
4228 | if (engines.Length == 0) // No engine at all | ||
4229 | return 0.0f; | ||
4230 | |||
4231 | float time = 0.0f; | ||
4232 | |||
4233 | // get all the scripts in all parts | ||
4234 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4235 | List<TaskInventoryItem> scripts = new List<TaskInventoryItem>(); | ||
4236 | for (int i = 0; i < parts.Length; i++) | ||
4237 | { | ||
4238 | scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL)); | ||
4239 | } | ||
4240 | // extract the UUIDs | ||
4241 | List<UUID> ids = new List<UUID>(scripts.Count); | ||
4242 | foreach (TaskInventoryItem script in scripts) | ||
4243 | { | ||
4244 | if (!ids.Contains(script.ItemID)) | ||
4245 | { | ||
4246 | ids.Add(script.ItemID); | ||
4247 | } | ||
4248 | } | ||
4249 | // Offer the list of script UUIDs to each engine found and accumulate the time | ||
4250 | foreach (IScriptModule e in engines) | ||
4251 | { | ||
4252 | if (e != null) | ||
4253 | { | ||
4254 | time += e.GetScriptExecutionTime(ids); | ||
4255 | } | ||
4256 | } | ||
4257 | return time; | ||
4258 | } | ||
4259 | |||
4260 | /// <summary> | ||
4261 | /// Returns a count of the number of running scripts in this groups parts. | ||
4262 | /// </summary> | ||
4263 | public int RunningScriptCount() | ||
4264 | { | ||
4265 | int count = 0; | ||
4266 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4267 | for (int i = 0; i < parts.Length; i++) | ||
4268 | count += parts[i].Inventory.RunningScriptCount(); | ||
4269 | |||
4270 | return count; | ||
4271 | } | ||
4272 | |||
4186 | public override string ToString() | 4273 | public override string ToString() |
4187 | { | 4274 | { |
4188 | return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); | 4275 | return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f7edd31..f9c5e28 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2105,6 +2105,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2105 | /// <param name="isNew"></param> | 2105 | /// <param name="isNew"></param> |
2106 | public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) | 2106 | public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) |
2107 | { | 2107 | { |
2108 | if (ParentGroup.Scene == null) | ||
2109 | return; | ||
2110 | |||
2108 | if (!ParentGroup.Scene.PhysicalPrims && UsePhysics) | 2111 | if (!ParentGroup.Scene.PhysicalPrims && UsePhysics) |
2109 | return; | 2112 | return; |
2110 | 2113 | ||
@@ -3502,7 +3505,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3502 | hasProfileCut = hasDimple; // is it the same thing? | 3505 | hasProfileCut = hasDimple; // is it the same thing? |
3503 | } | 3506 | } |
3504 | 3507 | ||
3505 | |||
3506 | public void SetGroup(UUID groupID, IClientAPI client) | 3508 | public void SetGroup(UUID groupID, IClientAPI client) |
3507 | { | 3509 | { |
3508 | // Scene.AddNewPrims() calls with client == null so can't use this. | 3510 | // Scene.AddNewPrims() calls with client == null so can't use this. |
@@ -3532,10 +3534,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3532 | 3534 | ||
3533 | public void SetPhysicsAxisRotation() | 3535 | public void SetPhysicsAxisRotation() |
3534 | { | 3536 | { |
3535 | if (PhysActor != null) | 3537 | PhysicsActor pa = PhysActor; |
3538 | |||
3539 | if (pa != null) | ||
3536 | { | 3540 | { |
3537 | PhysActor.LockAngularMotion(RotationAxis); | 3541 | pa.LockAngularMotion(RotationAxis); |
3538 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 3542 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); |
3539 | } | 3543 | } |
3540 | } | 3544 | } |
3541 | 3545 | ||
@@ -4252,7 +4256,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4252 | // For now, we use the NINJA naming scheme for identifying joints. | 4256 | // For now, we use the NINJA naming scheme for identifying joints. |
4253 | // In the future, we can support other joint specification schemes such as a | 4257 | // In the future, we can support other joint specification schemes such as a |
4254 | // custom checkbox in the viewer GUI. | 4258 | // custom checkbox in the viewer GUI. |
4255 | if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) | 4259 | if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) |
4256 | { | 4260 | { |
4257 | string hingeString = "hingejoint"; | 4261 | string hingeString = "hingejoint"; |
4258 | return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString); | 4262 | return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString); |
@@ -4268,7 +4272,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4268 | // For now, we use the NINJA naming scheme for identifying joints. | 4272 | // For now, we use the NINJA naming scheme for identifying joints. |
4269 | // In the future, we can support other joint specification schemes such as a | 4273 | // In the future, we can support other joint specification schemes such as a |
4270 | // custom checkbox in the viewer GUI. | 4274 | // custom checkbox in the viewer GUI. |
4271 | if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) | 4275 | if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) |
4272 | { | 4276 | { |
4273 | string ballString = "balljoint"; | 4277 | string ballString = "balljoint"; |
4274 | return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString); | 4278 | return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString); |
@@ -4284,7 +4288,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4284 | // For now, we use the NINJA naming scheme for identifying joints. | 4288 | // For now, we use the NINJA naming scheme for identifying joints. |
4285 | // In the future, we can support other joint specification schemes such as a | 4289 | // In the future, we can support other joint specification schemes such as a |
4286 | // custom checkbox in the viewer GUI. | 4290 | // custom checkbox in the viewer GUI. |
4287 | if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) | 4291 | if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) |
4288 | { | 4292 | { |
4289 | return IsHingeJoint() || IsBallJoint(); | 4293 | return IsHingeJoint() || IsBallJoint(); |
4290 | } | 4294 | } |
@@ -4403,7 +4407,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4403 | } | 4407 | } |
4404 | } | 4408 | } |
4405 | } | 4409 | } |
4406 | |||
4407 | else // it already has a physical representation | 4410 | else // it already has a physical representation |
4408 | { | 4411 | { |
4409 | DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. | 4412 | DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 959046a..141cf66 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -267,14 +267,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
267 | /// </summary> | 267 | /// </summary> |
268 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) | 268 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) |
269 | { | 269 | { |
270 | Items.LockItemsForRead(true); | 270 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); |
271 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 271 | foreach (TaskInventoryItem item in scripts) |
272 | Items.LockItemsForRead(false); | 272 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); |
273 | foreach (TaskInventoryItem item in items) | ||
274 | { | ||
275 | if ((int)InventoryType.LSL == item.InvType) | ||
276 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); | ||
277 | } | ||
278 | } | 273 | } |
279 | 274 | ||
280 | public ArrayList GetScriptErrors(UUID itemID) | 275 | public ArrayList GetScriptErrors(UUID itemID) |
@@ -305,17 +300,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
305 | /// </param> | 300 | /// </param> |
306 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) | 301 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) |
307 | { | 302 | { |
308 | Items.LockItemsForRead(true); | 303 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); |
309 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 304 | foreach (TaskInventoryItem item in scripts) |
310 | Items.LockItemsForRead(false); | ||
311 | |||
312 | foreach (TaskInventoryItem item in items) | ||
313 | { | 305 | { |
314 | if ((int)InventoryType.LSL == item.InvType) | 306 | RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted); |
315 | { | 307 | m_part.RemoveScriptEvents(item.ItemID); |
316 | RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted); | ||
317 | m_part.RemoveScriptEvents(item.ItemID); | ||
318 | } | ||
319 | } | 308 | } |
320 | } | 309 | } |
321 | 310 | ||
@@ -1281,9 +1270,57 @@ namespace OpenSim.Region.Framework.Scenes | |||
1281 | return true; | 1270 | return true; |
1282 | } | 1271 | } |
1283 | } | 1272 | } |
1273 | |||
1284 | return false; | 1274 | return false; |
1285 | } | 1275 | } |
1286 | 1276 | ||
1277 | /// <summary> | ||
1278 | /// Returns the count of scripts in this parts inventory. | ||
1279 | /// </summary> | ||
1280 | /// <returns></returns> | ||
1281 | public int ScriptCount() | ||
1282 | { | ||
1283 | int count = 0; | ||
1284 | Items.LockItemsForRead(true); | ||
1285 | foreach (TaskInventoryItem item in m_items.Values) | ||
1286 | { | ||
1287 | if (item.InvType == (int)InventoryType.LSL) | ||
1288 | { | ||
1289 | count++; | ||
1290 | } | ||
1291 | } | ||
1292 | Items.LockItemsForRead(false); | ||
1293 | return count; | ||
1294 | } | ||
1295 | /// <summary> | ||
1296 | /// Returns the count of running scripts in this parts inventory. | ||
1297 | /// </summary> | ||
1298 | /// <returns></returns> | ||
1299 | public int RunningScriptCount() | ||
1300 | { | ||
1301 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
1302 | if (engines.Length == 0) | ||
1303 | return 0; | ||
1304 | |||
1305 | int count = 0; | ||
1306 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); | ||
1307 | |||
1308 | foreach (TaskInventoryItem item in scripts) | ||
1309 | { | ||
1310 | foreach (IScriptModule engine in engines) | ||
1311 | { | ||
1312 | if (engine != null) | ||
1313 | { | ||
1314 | if (engine.GetScriptState(item.ItemID)) | ||
1315 | { | ||
1316 | count++; | ||
1317 | } | ||
1318 | } | ||
1319 | } | ||
1320 | } | ||
1321 | return count; | ||
1322 | } | ||
1323 | |||
1287 | public List<UUID> GetInventoryList() | 1324 | public List<UUID> GetInventoryList() |
1288 | { | 1325 | { |
1289 | List<UUID> ret = new List<UUID>(); | 1326 | List<UUID> ret = new List<UUID>(); |
@@ -1298,22 +1335,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1298 | { | 1335 | { |
1299 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); | 1336 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); |
1300 | 1337 | ||
1301 | lock (m_items) | 1338 | Items.LockItemsForRead(true); |
1302 | ret = new List<TaskInventoryItem>(m_items.Values); | 1339 | ret = new List<TaskInventoryItem>(m_items.Values); |
1340 | Items.LockItemsForRead(false); | ||
1303 | 1341 | ||
1304 | return ret; | 1342 | return ret; |
1305 | } | 1343 | } |
1306 | 1344 | ||
1307 | public List<TaskInventoryItem> GetInventoryScripts() | 1345 | public List<TaskInventoryItem> GetInventoryItems(InventoryType type) |
1308 | { | 1346 | { |
1309 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); | 1347 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); |
1310 | 1348 | ||
1311 | lock (m_items) | 1349 | Items.LockItemsForRead(true); |
1312 | { | 1350 | |
1313 | foreach (TaskInventoryItem item in m_items.Values) | 1351 | foreach (TaskInventoryItem item in m_items.Values) |
1314 | if (item.InvType == (int)InventoryType.LSL) | 1352 | if (item.InvType == (int)type) |
1315 | ret.Add(item); | 1353 | ret.Add(item); |
1316 | } | 1354 | |
1355 | Items.LockItemsForRead(false); | ||
1317 | 1356 | ||
1318 | return ret; | 1357 | return ret; |
1319 | } | 1358 | } |
@@ -1335,35 +1374,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1335 | if (engines.Length == 0) // No engine at all | 1374 | if (engines.Length == 0) // No engine at all |
1336 | return ret; | 1375 | return ret; |
1337 | 1376 | ||
1338 | Items.LockItemsForRead(true); | 1377 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); |
1339 | foreach (TaskInventoryItem item in m_items.Values) | 1378 | |
1379 | foreach (TaskInventoryItem item in scripts) | ||
1340 | { | 1380 | { |
1341 | if (item.InvType == (int)InventoryType.LSL) | 1381 | foreach (IScriptModule e in engines) |
1342 | { | 1382 | { |
1343 | foreach (IScriptModule e in engines) | 1383 | if (e != null) |
1344 | { | 1384 | { |
1345 | if (e != null) | 1385 | string n = e.GetXMLState(item.ItemID); |
1386 | if (n != String.Empty) | ||
1346 | { | 1387 | { |
1347 | string n = e.GetXMLState(item.ItemID); | 1388 | if (oldIDs) |
1348 | if (n != String.Empty) | 1389 | { |
1390 | if (!ret.ContainsKey(item.OldItemID)) | ||
1391 | ret[item.OldItemID] = n; | ||
1392 | } | ||
1393 | else | ||
1349 | { | 1394 | { |
1350 | if (oldIDs) | 1395 | if (!ret.ContainsKey(item.ItemID)) |
1351 | { | 1396 | ret[item.ItemID] = n; |
1352 | if (!ret.ContainsKey(item.OldItemID)) | ||
1353 | ret[item.OldItemID] = n; | ||
1354 | } | ||
1355 | else | ||
1356 | { | ||
1357 | if (!ret.ContainsKey(item.ItemID)) | ||
1358 | ret[item.ItemID] = n; | ||
1359 | } | ||
1360 | break; | ||
1361 | } | 1397 | } |
1398 | break; | ||
1362 | } | 1399 | } |
1363 | } | 1400 | } |
1364 | } | 1401 | } |
1365 | } | 1402 | } |
1366 | Items.LockItemsForRead(false); | ||
1367 | return ret; | 1403 | return ret; |
1368 | } | 1404 | } |
1369 | 1405 | ||
@@ -1373,27 +1409,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
1373 | if (engines.Length == 0) | 1409 | if (engines.Length == 0) |
1374 | return; | 1410 | return; |
1375 | 1411 | ||
1412 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); | ||
1376 | 1413 | ||
1377 | Items.LockItemsForRead(true); | 1414 | foreach (TaskInventoryItem item in scripts) |
1378 | |||
1379 | foreach (TaskInventoryItem item in m_items.Values) | ||
1380 | { | 1415 | { |
1381 | if (item.InvType == (int)InventoryType.LSL) | 1416 | foreach (IScriptModule engine in engines) |
1382 | { | 1417 | { |
1383 | foreach (IScriptModule engine in engines) | 1418 | if (engine != null) |
1384 | { | 1419 | { |
1385 | if (engine != null) | 1420 | // m_log.DebugFormat( |
1386 | { | 1421 | // "[PRIM INVENTORY]: Resuming script {0} {1} for {2}, OwnerChanged {3}", |
1387 | if (item.OwnerChanged) | 1422 | // item.Name, item.ItemID, item.OwnerID, item.OwnerChanged); |
1388 | engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER }); | 1423 | |
1389 | item.OwnerChanged = false; | 1424 | engine.ResumeScript(item.ItemID); |
1390 | engine.ResumeScript(item.ItemID); | 1425 | |
1391 | } | 1426 | if (item.OwnerChanged) |
1427 | engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER }); | ||
1428 | |||
1429 | item.OwnerChanged = false; | ||
1392 | } | 1430 | } |
1393 | } | 1431 | } |
1394 | } | 1432 | } |
1395 | |||
1396 | Items.LockItemsForRead(false); | ||
1397 | } | 1433 | } |
1398 | } | 1434 | } |
1399 | } | 1435 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index ba0ed95..34362bf 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -45,6 +45,7 @@ using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags; | |||
45 | 45 | ||
46 | namespace OpenSim.Region.Framework.Scenes | 46 | namespace OpenSim.Region.Framework.Scenes |
47 | { | 47 | { |
48 | [Flags] | ||
48 | enum ScriptControlled : uint | 49 | enum ScriptControlled : uint |
49 | { | 50 | { |
50 | CONTROL_ZERO = 0, | 51 | CONTROL_ZERO = 0, |
@@ -76,6 +77,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
76 | // { | 77 | // { |
77 | // m_log.Debug("[SCENE PRESENCE] Destructor called"); | 78 | // m_log.Debug("[SCENE PRESENCE] Destructor called"); |
78 | // } | 79 | // } |
80 | private void TriggerScenePresenceUpdated() | ||
81 | { | ||
82 | if (m_scene != null) | ||
83 | m_scene.EventManager.TriggerScenePresenceUpdated(this); | ||
84 | } | ||
79 | 85 | ||
80 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 86 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
81 | 87 | ||
@@ -497,6 +503,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
497 | //m_log.DebugFormat( | 503 | //m_log.DebugFormat( |
498 | // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", | 504 | // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", |
499 | // Scene.RegionInfo.RegionName, Name, m_pos); | 505 | // Scene.RegionInfo.RegionName, Name, m_pos); |
506 | TriggerScenePresenceUpdated(); | ||
500 | } | 507 | } |
501 | } | 508 | } |
502 | 509 | ||
@@ -516,6 +523,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
516 | return; | 523 | return; |
517 | 524 | ||
518 | m_pos = value; | 525 | m_pos = value; |
526 | TriggerScenePresenceUpdated(); | ||
519 | } | 527 | } |
520 | } | 528 | } |
521 | 529 | ||
@@ -1085,23 +1093,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1085 | /// <param name="pos"></param> | 1093 | /// <param name="pos"></param> |
1086 | public void Teleport(Vector3 pos) | 1094 | public void Teleport(Vector3 pos) |
1087 | { | 1095 | { |
1088 | bool isFlying = Flying; | 1096 | TeleportWithMomentum(pos, Vector3.Zero); |
1089 | RemoveFromPhysicalScene(); | ||
1090 | Velocity = Vector3.Zero; | ||
1091 | CheckLandingPoint(ref pos); | ||
1092 | AbsolutePosition = pos; | ||
1093 | AddToPhysicalScene(isFlying); | ||
1094 | |||
1095 | SendTerseUpdateToAllClients(); | ||
1096 | } | ||
1097 | |||
1098 | public void TeleportWithMomentum(Vector3 pos) | ||
1099 | { | ||
1100 | TeleportWithMomentum(pos, null); | ||
1101 | } | 1097 | } |
1102 | 1098 | ||
1103 | public void TeleportWithMomentum(Vector3 pos, Vector3? v) | 1099 | public void TeleportWithMomentum(Vector3 pos, Vector3? v) |
1104 | { | 1100 | { |
1101 | if (ParentID != (uint)0) | ||
1102 | StandUp(); | ||
1105 | bool isFlying = Flying; | 1103 | bool isFlying = Flying; |
1106 | Vector3 vel = Velocity; | 1104 | Vector3 vel = Velocity; |
1107 | RemoveFromPhysicalScene(); | 1105 | RemoveFromPhysicalScene(); |
@@ -1281,17 +1279,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
1281 | 1279 | ||
1282 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | 1280 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
1283 | MakeRootAgent(AbsolutePosition, flying); | 1281 | MakeRootAgent(AbsolutePosition, flying); |
1282 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | ||
1283 | |||
1284 | // m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); | ||
1284 | 1285 | ||
1285 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) | 1286 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) |
1286 | { | 1287 | { |
1287 | m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); | 1288 | // We cannot sleep here since this would hold up the inbound packet processing thread, as |
1289 | // CompleteMovement() is executed synchronously. However, it might be better to delay the release | ||
1290 | // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete | ||
1291 | // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this | ||
1292 | // region as the current region, meaning that a close sent before then will fail the teleport. | ||
1293 | // System.Threading.Thread.Sleep(2000); | ||
1294 | |||
1295 | m_log.DebugFormat( | ||
1296 | "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", | ||
1297 | client.Name, client.AgentId, m_callbackURI); | ||
1298 | |||
1288 | Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI); | 1299 | Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI); |
1289 | m_callbackURI = null; | 1300 | m_callbackURI = null; |
1290 | } | 1301 | } |
1291 | 1302 | ||
1292 | // m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); | ||
1293 | |||
1294 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | ||
1295 | ValidateAndSendAppearanceAndAgentData(); | 1303 | ValidateAndSendAppearanceAndAgentData(); |
1296 | 1304 | ||
1297 | // Create child agents in neighbouring regions | 1305 | // Create child agents in neighbouring regions |
@@ -1306,7 +1314,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1306 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); | 1314 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); |
1307 | } | 1315 | } |
1308 | 1316 | ||
1309 | |||
1310 | // m_log.DebugFormat( | 1317 | // m_log.DebugFormat( |
1311 | // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", | 1318 | // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", |
1312 | // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); | 1319 | // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); |
@@ -1359,7 +1366,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1359 | { | 1366 | { |
1360 | // m_log.DebugFormat( | 1367 | // m_log.DebugFormat( |
1361 | // "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", | 1368 | // "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", |
1362 | // Scene.RegionInfo.RegionName, remoteClient.Name, agentData.ControlFlags); | 1369 | // Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); |
1363 | 1370 | ||
1364 | if (IsChildAgent) | 1371 | if (IsChildAgent) |
1365 | { | 1372 | { |
@@ -1469,14 +1476,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1469 | } | 1476 | } |
1470 | } | 1477 | } |
1471 | 1478 | ||
1472 | lock (scriptedcontrols) | 1479 | uint flagsForScripts = (uint)flags; |
1473 | { | 1480 | flags = RemoveIgnoredControls(flags, IgnoredControls); |
1474 | if (scriptedcontrols.Count > 0) | ||
1475 | { | ||
1476 | SendControlToScripts((uint)flags); | ||
1477 | flags = RemoveIgnoredControls(flags, IgnoredControls); | ||
1478 | } | ||
1479 | } | ||
1480 | 1481 | ||
1481 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) | 1482 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) |
1482 | HandleAgentSitOnGround(); | 1483 | HandleAgentSitOnGround(); |
@@ -1490,6 +1491,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1490 | PhysicsActor actor = PhysicsActor; | 1491 | PhysicsActor actor = PhysicsActor; |
1491 | if (actor == null) | 1492 | if (actor == null) |
1492 | { | 1493 | { |
1494 | SendControlsToScripts(flagsForScripts); | ||
1493 | return; | 1495 | return; |
1494 | } | 1496 | } |
1495 | 1497 | ||
@@ -1569,7 +1571,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1569 | MovementFlag |= (byte)nudgehack; | 1571 | MovementFlag |= (byte)nudgehack; |
1570 | } | 1572 | } |
1571 | 1573 | ||
1572 | // m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF); | 1574 | //m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF); |
1573 | MovementFlag += (byte)(uint)DCF; | 1575 | MovementFlag += (byte)(uint)DCF; |
1574 | update_movementflag = true; | 1576 | update_movementflag = true; |
1575 | } | 1577 | } |
@@ -1582,7 +1584,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1582 | && ((MovementFlag & (byte)nudgehack) == nudgehack)) | 1584 | && ((MovementFlag & (byte)nudgehack) == nudgehack)) |
1583 | ) // This or is for Nudge forward | 1585 | ) // This or is for Nudge forward |
1584 | { | 1586 | { |
1585 | // m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF); | 1587 | //m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF); |
1586 | MovementFlag -= ((byte)(uint)DCF); | 1588 | MovementFlag -= ((byte)(uint)DCF); |
1587 | update_movementflag = true; | 1589 | update_movementflag = true; |
1588 | 1590 | ||
@@ -1663,11 +1665,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1663 | // } | 1665 | // } |
1664 | // } | 1666 | // } |
1665 | 1667 | ||
1666 | // if (update_movementflag && ParentID == 0) | 1668 | if (update_movementflag && ParentID == 0) |
1667 | // Animator.UpdateMovementAnimations(); | 1669 | Animator.UpdateMovementAnimations(); |
1670 | |||
1671 | SendControlsToScripts(flagsForScripts); | ||
1668 | } | 1672 | } |
1669 | 1673 | ||
1670 | m_scene.EventManager.TriggerOnClientMovement(this); | 1674 | m_scene.EventManager.TriggerOnClientMovement(this); |
1675 | TriggerScenePresenceUpdated(); | ||
1671 | } | 1676 | } |
1672 | 1677 | ||
1673 | /// <summary> | 1678 | /// <summary> |
@@ -2607,6 +2612,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2607 | 2612 | ||
2608 | m_scene.ForEachClient(SendTerseUpdateToClient); | 2613 | m_scene.ForEachClient(SendTerseUpdateToClient); |
2609 | } | 2614 | } |
2615 | TriggerScenePresenceUpdated(); | ||
2610 | } | 2616 | } |
2611 | 2617 | ||
2612 | public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) | 2618 | public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) |
@@ -3089,8 +3095,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3089 | x = x / Constants.RegionSize; | 3095 | x = x / Constants.RegionSize; |
3090 | y = y / Constants.RegionSize; | 3096 | y = y / Constants.RegionSize; |
3091 | 3097 | ||
3092 | //m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | 3098 | // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); |
3093 | //m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | 3099 | // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); |
3094 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY)) | 3100 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY)) |
3095 | { | 3101 | { |
3096 | byebyeRegions.Add(handle); | 3102 | byebyeRegions.Add(handle); |
@@ -3392,6 +3398,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3392 | Velocity = force; | 3398 | Velocity = force; |
3393 | 3399 | ||
3394 | m_forceToApply = null; | 3400 | m_forceToApply = null; |
3401 | TriggerScenePresenceUpdated(); | ||
3395 | } | 3402 | } |
3396 | } | 3403 | } |
3397 | 3404 | ||
@@ -3497,25 +3504,53 @@ namespace OpenSim.Region.Framework.Scenes | |||
3497 | } | 3504 | } |
3498 | } | 3505 | } |
3499 | 3506 | ||
3500 | RaiseCollisionScriptEvents(coldata); | 3507 | // Gods do not take damage and Invulnerable is set depending on parcel/region flags |
3501 | 3508 | if (Invulnerable || GodLevel > 0) | |
3502 | if (Invulnerable) | ||
3503 | return; | 3509 | return; |
3504 | 3510 | ||
3511 | // The following may be better in the ICombatModule | ||
3512 | // probably tweaking of the values for ground and normal prim collisions will be needed | ||
3505 | float starthealth = Health; | 3513 | float starthealth = Health; |
3506 | uint killerObj = 0; | 3514 | uint killerObj = 0; |
3515 | SceneObjectPart part = null; | ||
3507 | foreach (uint localid in coldata.Keys) | 3516 | foreach (uint localid in coldata.Keys) |
3508 | { | 3517 | { |
3509 | SceneObjectPart part = Scene.GetSceneObjectPart(localid); | 3518 | if (localid == 0) |
3510 | 3519 | { | |
3511 | if (part != null && part.ParentGroup.Damage != -1.0f) | 3520 | part = null; |
3512 | Health -= part.ParentGroup.Damage; | 3521 | } |
3513 | else | 3522 | else |
3514 | { | 3523 | { |
3515 | if (coldata[localid].PenetrationDepth >= 0.10f) | 3524 | part = Scene.GetSceneObjectPart(localid); |
3525 | } | ||
3526 | if (part != null) | ||
3527 | { | ||
3528 | // Ignore if it has been deleted or volume detect | ||
3529 | if (!part.ParentGroup.IsDeleted && !part.ParentGroup.IsVolumeDetect) | ||
3530 | { | ||
3531 | if (part.ParentGroup.Damage > 0.0f) | ||
3532 | { | ||
3533 | // Something with damage... | ||
3534 | Health -= part.ParentGroup.Damage; | ||
3535 | part.ParentGroup.Scene.DeleteSceneObject(part.ParentGroup, false); | ||
3536 | } | ||
3537 | else | ||
3538 | { | ||
3539 | // An ordinary prim | ||
3540 | if (coldata[localid].PenetrationDepth >= 0.10f) | ||
3541 | Health -= coldata[localid].PenetrationDepth * 5.0f; | ||
3542 | } | ||
3543 | } | ||
3544 | } | ||
3545 | else | ||
3546 | { | ||
3547 | // 0 is the ground | ||
3548 | // what about collisions with other avatars? | ||
3549 | if (localid == 0 && coldata[localid].PenetrationDepth >= 0.10f) | ||
3516 | Health -= coldata[localid].PenetrationDepth * 5.0f; | 3550 | Health -= coldata[localid].PenetrationDepth * 5.0f; |
3517 | } | 3551 | } |
3518 | 3552 | ||
3553 | |||
3519 | if (Health <= 0.0f) | 3554 | if (Health <= 0.0f) |
3520 | { | 3555 | { |
3521 | if (localid != 0) | 3556 | if (localid != 0) |
@@ -3531,7 +3566,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3531 | ControllingClient.SendHealth(Health); | 3566 | ControllingClient.SendHealth(Health); |
3532 | } | 3567 | } |
3533 | if (Health <= 0) | 3568 | if (Health <= 0) |
3569 | { | ||
3534 | m_scene.EventManager.TriggerAvatarKill(killerObj, this); | 3570 | m_scene.EventManager.TriggerAvatarKill(killerObj, this); |
3571 | } | ||
3572 | if (starthealth == Health && Health < 100.0f) | ||
3573 | { | ||
3574 | Health += 0.03f; | ||
3575 | if (Health > 100.0f) | ||
3576 | Health = 100.0f; | ||
3577 | ControllingClient.SendHealth(Health); | ||
3578 | } | ||
3535 | } | 3579 | } |
3536 | } | 3580 | } |
3537 | 3581 | ||
@@ -3613,6 +3657,63 @@ namespace OpenSim.Region.Framework.Scenes | |||
3613 | return m_attachments.Count > 0; | 3657 | return m_attachments.Count > 0; |
3614 | } | 3658 | } |
3615 | 3659 | ||
3660 | /// <summary> | ||
3661 | /// Returns the total count of scripts in all parts inventories. | ||
3662 | /// </summary> | ||
3663 | public int ScriptCount() | ||
3664 | { | ||
3665 | int count = 0; | ||
3666 | lock (m_attachments) | ||
3667 | { | ||
3668 | foreach (SceneObjectGroup gobj in m_attachments) | ||
3669 | { | ||
3670 | if (gobj != null) | ||
3671 | { | ||
3672 | count += gobj.ScriptCount(); | ||
3673 | } | ||
3674 | } | ||
3675 | } | ||
3676 | return count; | ||
3677 | } | ||
3678 | |||
3679 | /// <summary> | ||
3680 | /// A float the value is a representative execution time in milliseconds of all scripts in all attachments. | ||
3681 | /// </summary> | ||
3682 | public float ScriptExecutionTime() | ||
3683 | { | ||
3684 | float time = 0.0f; | ||
3685 | lock (m_attachments) | ||
3686 | { | ||
3687 | foreach (SceneObjectGroup gobj in m_attachments) | ||
3688 | { | ||
3689 | if (gobj != null) | ||
3690 | { | ||
3691 | time += gobj.ScriptExecutionTime(); | ||
3692 | } | ||
3693 | } | ||
3694 | } | ||
3695 | return time; | ||
3696 | } | ||
3697 | |||
3698 | /// <summary> | ||
3699 | /// Returns the total count of running scripts in all parts. | ||
3700 | /// </summary> | ||
3701 | public int RunningScriptCount() | ||
3702 | { | ||
3703 | int count = 0; | ||
3704 | lock (m_attachments) | ||
3705 | { | ||
3706 | foreach (SceneObjectGroup gobj in m_attachments) | ||
3707 | { | ||
3708 | if (gobj != null) | ||
3709 | { | ||
3710 | count += gobj.RunningScriptCount(); | ||
3711 | } | ||
3712 | } | ||
3713 | } | ||
3714 | return count; | ||
3715 | } | ||
3716 | |||
3616 | public bool HasScriptedAttachments() | 3717 | public bool HasScriptedAttachments() |
3617 | { | 3718 | { |
3618 | lock (m_attachments) | 3719 | lock (m_attachments) |
@@ -3830,77 +3931,92 @@ namespace OpenSim.Region.Framework.Scenes | |||
3830 | } | 3931 | } |
3831 | } | 3932 | } |
3832 | 3933 | ||
3833 | internal void SendControlToScripts(uint flags) | 3934 | private void SendControlsToScripts(uint flags) |
3834 | { | 3935 | { |
3835 | ScriptControlled allflags = ScriptControlled.CONTROL_ZERO; | 3936 | // Notify the scripts only after calling UpdateMovementAnimations(), so that if a script |
3836 | 3937 | // (e.g., a walking script) checks which animation is active it will be the correct animation. | |
3837 | if (MouseDown) | 3938 | lock (scriptedcontrols) |
3838 | { | 3939 | { |
3839 | allflags = LastCommands & (ScriptControlled.CONTROL_ML_LBUTTON | ScriptControlled.CONTROL_LBUTTON); | 3940 | if (scriptedcontrols.Count <= 0) |
3840 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_UP) != 0 || (flags & unchecked((uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_UP)) != 0) | 3941 | return; |
3942 | |||
3943 | ScriptControlled allflags = ScriptControlled.CONTROL_ZERO; | ||
3944 | |||
3945 | if (MouseDown) | ||
3841 | { | 3946 | { |
3842 | allflags = ScriptControlled.CONTROL_ZERO; | 3947 | allflags = LastCommands & (ScriptControlled.CONTROL_ML_LBUTTON | ScriptControlled.CONTROL_LBUTTON); |
3948 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_UP) != 0 || (flags & unchecked((uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_UP)) != 0) | ||
3949 | { | ||
3950 | allflags = ScriptControlled.CONTROL_ZERO; | ||
3951 | MouseDown = true; | ||
3952 | } | ||
3953 | } | ||
3954 | |||
3955 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_DOWN) != 0) | ||
3956 | { | ||
3957 | allflags |= ScriptControlled.CONTROL_ML_LBUTTON; | ||
3843 | MouseDown = true; | 3958 | MouseDown = true; |
3844 | } | 3959 | } |
3845 | } | 3960 | |
3961 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0) | ||
3962 | { | ||
3963 | allflags |= ScriptControlled.CONTROL_LBUTTON; | ||
3964 | MouseDown = true; | ||
3965 | } | ||
3966 | |||
3967 | // find all activated controls, whether the scripts are interested in them or not | ||
3968 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) != 0) | ||
3969 | { | ||
3970 | allflags |= ScriptControlled.CONTROL_FWD; | ||
3971 | } | ||
3972 | |||
3973 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) != 0) | ||
3974 | { | ||
3975 | allflags |= ScriptControlled.CONTROL_BACK; | ||
3976 | } | ||
3977 | |||
3978 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_POS) != 0) | ||
3979 | { | ||
3980 | allflags |= ScriptControlled.CONTROL_UP; | ||
3981 | } | ||
3982 | |||
3983 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0) | ||
3984 | { | ||
3985 | allflags |= ScriptControlled.CONTROL_DOWN; | ||
3986 | } | ||
3846 | 3987 | ||
3847 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_DOWN) != 0) | 3988 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) != 0) |
3848 | { | 3989 | { |
3849 | allflags |= ScriptControlled.CONTROL_ML_LBUTTON; | 3990 | allflags |= ScriptControlled.CONTROL_LEFT; |
3850 | MouseDown = true; | 3991 | } |
3851 | } | 3992 | |
3852 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0) | 3993 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) != 0) |
3853 | { | 3994 | { |
3854 | allflags |= ScriptControlled.CONTROL_LBUTTON; | 3995 | allflags |= ScriptControlled.CONTROL_RIGHT; |
3855 | MouseDown = true; | 3996 | } |
3856 | } | 3997 | |
3998 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0) | ||
3999 | { | ||
4000 | allflags |= ScriptControlled.CONTROL_ROT_RIGHT; | ||
4001 | } | ||
4002 | |||
4003 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0) | ||
4004 | { | ||
4005 | allflags |= ScriptControlled.CONTROL_ROT_LEFT; | ||
4006 | } | ||
3857 | 4007 | ||
3858 | // find all activated controls, whether the scripts are interested in them or not | 4008 | // optimization; we have to check per script, but if nothing is pressed and nothing changed, we can skip that |
3859 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) != 0) | 4009 | if (allflags != ScriptControlled.CONTROL_ZERO || allflags != LastCommands) |
3860 | { | ||
3861 | allflags |= ScriptControlled.CONTROL_FWD; | ||
3862 | } | ||
3863 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) != 0) | ||
3864 | { | ||
3865 | allflags |= ScriptControlled.CONTROL_BACK; | ||
3866 | } | ||
3867 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_POS) != 0) | ||
3868 | { | ||
3869 | allflags |= ScriptControlled.CONTROL_UP; | ||
3870 | } | ||
3871 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0) | ||
3872 | { | ||
3873 | allflags |= ScriptControlled.CONTROL_DOWN; | ||
3874 | } | ||
3875 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) != 0) | ||
3876 | { | ||
3877 | allflags |= ScriptControlled.CONTROL_LEFT; | ||
3878 | } | ||
3879 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) != 0) | ||
3880 | { | ||
3881 | allflags |= ScriptControlled.CONTROL_RIGHT; | ||
3882 | } | ||
3883 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0) | ||
3884 | { | ||
3885 | allflags |= ScriptControlled.CONTROL_ROT_RIGHT; | ||
3886 | } | ||
3887 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0) | ||
3888 | { | ||
3889 | allflags |= ScriptControlled.CONTROL_ROT_LEFT; | ||
3890 | } | ||
3891 | // optimization; we have to check per script, but if nothing is pressed and nothing changed, we can skip that | ||
3892 | if (allflags != ScriptControlled.CONTROL_ZERO || allflags != LastCommands) | ||
3893 | { | ||
3894 | lock (scriptedcontrols) | ||
3895 | { | 4010 | { |
3896 | foreach (KeyValuePair<UUID, ScriptControllers> kvp in scriptedcontrols) | 4011 | foreach (KeyValuePair<UUID, ScriptControllers> kvp in scriptedcontrols) |
3897 | { | 4012 | { |
3898 | UUID scriptUUID = kvp.Key; | 4013 | UUID scriptUUID = kvp.Key; |
3899 | ScriptControllers scriptControlData = kvp.Value; | 4014 | ScriptControllers scriptControlData = kvp.Value; |
3900 | 4015 | ||
3901 | ScriptControlled localHeld = allflags & scriptControlData.eventControls; // the flags interesting for us | 4016 | ScriptControlled localHeld = allflags & scriptControlData.eventControls; // the flags interesting for us |
3902 | ScriptControlled localLast = LastCommands & scriptControlData.eventControls; // the activated controls in the last cycle | 4017 | ScriptControlled localLast = LastCommands & scriptControlData.eventControls; // the activated controls in the last cycle |
3903 | ScriptControlled localChange = localHeld ^ localLast; // the changed bits | 4018 | ScriptControlled localChange = localHeld ^ localLast; // the changed bits |
4019 | |||
3904 | if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO) | 4020 | if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO) |
3905 | { | 4021 | { |
3906 | // only send if still pressed or just changed | 4022 | // only send if still pressed or just changed |
@@ -3908,9 +4024,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3908 | } | 4024 | } |
3909 | } | 4025 | } |
3910 | } | 4026 | } |
4027 | |||
4028 | LastCommands = allflags; | ||
3911 | } | 4029 | } |
3912 | |||
3913 | LastCommands = allflags; | ||
3914 | } | 4030 | } |
3915 | 4031 | ||
3916 | internal static AgentManager.ControlFlags RemoveIgnoredControls(AgentManager.ControlFlags flags, ScriptControlled ignored) | 4032 | internal static AgentManager.ControlFlags RemoveIgnoredControls(AgentManager.ControlFlags flags, ScriptControlled ignored) |
@@ -3990,7 +4106,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3990 | land.LandData.UserLocation != Vector3.Zero && | 4106 | land.LandData.UserLocation != Vector3.Zero && |
3991 | land.LandData.OwnerID != m_uuid && | 4107 | land.LandData.OwnerID != m_uuid && |
3992 | (!m_scene.Permissions.IsGod(m_uuid)) && | 4108 | (!m_scene.Permissions.IsGod(m_uuid)) && |
3993 | (!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid))) | 4109 | (!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid))) |
3994 | { | 4110 | { |
3995 | float curr = Vector3.Distance(AbsolutePosition, pos); | 4111 | float curr = Vector3.Distance(AbsolutePosition, pos); |
3996 | if (Vector3.Distance(land.LandData.UserLocation, pos) < curr) | 4112 | if (Vector3.Distance(land.LandData.UserLocation, pos) < curr) |
@@ -4010,7 +4126,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4010 | { | 4126 | { |
4011 | if (GodLevel < 200 && | 4127 | if (GodLevel < 200 && |
4012 | ((!m_scene.Permissions.IsGod(m_uuid) && | 4128 | ((!m_scene.Permissions.IsGod(m_uuid) && |
4013 | !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) || | 4129 | !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || |
4014 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || | 4130 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || |
4015 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) | 4131 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) |
4016 | { | 4132 | { |
@@ -4018,28 +4134,93 @@ namespace OpenSim.Region.Framework.Scenes | |||
4018 | if (spawnPoints.Length == 0) | 4134 | if (spawnPoints.Length == 0) |
4019 | return; | 4135 | return; |
4020 | 4136 | ||
4021 | float distance = 9999; | 4137 | int index; |
4022 | int closest = -1; | 4138 | bool selected = false; |
4023 | 4139 | ||
4024 | for (int i = 0 ; i < spawnPoints.Length ; i++) | 4140 | switch (m_scene.SpawnPointRouting) |
4025 | { | 4141 | { |
4026 | Vector3 spawnPosition = spawnPoints[i].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 4142 | case "closest": |
4027 | Vector3 offset = spawnPosition - pos; | 4143 | |
4028 | float d = Vector3.Mag(offset); | 4144 | float distance = 9999; |
4029 | if (d >= distance) | 4145 | int closest = -1; |
4030 | continue; | 4146 | |
4031 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | 4147 | for (int i = 0; i < spawnPoints.Length; i++) |
4032 | if (land == null) | 4148 | { |
4033 | continue; | 4149 | Vector3 spawnPosition = spawnPoints[i].GetLocation( |
4034 | if (land.IsEitherBannedOrRestricted(UUID)) | 4150 | telehub.AbsolutePosition, |
4035 | continue; | 4151 | telehub.GroupRotation |
4036 | distance = d; | 4152 | ); |
4037 | closest = i; | 4153 | Vector3 offset = spawnPosition - pos; |
4038 | } | 4154 | float d = Vector3.Mag(offset); |
4039 | if (closest == -1) | 4155 | if (d >= distance) |
4040 | return; | 4156 | continue; |
4157 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4158 | if (land == null) | ||
4159 | continue; | ||
4160 | if (land.IsEitherBannedOrRestricted(UUID)) | ||
4161 | continue; | ||
4162 | distance = d; | ||
4163 | closest = i; | ||
4164 | } | ||
4165 | if (closest == -1) | ||
4166 | return; | ||
4167 | |||
4168 | pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
4169 | return; | ||
4170 | |||
4171 | case "random": | ||
4041 | 4172 | ||
4042 | pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 4173 | do |
4174 | { | ||
4175 | index = Util.RandomClass.Next(spawnPoints.Length - 1); | ||
4176 | |||
4177 | Vector3 spawnPosition = spawnPoints[index].GetLocation( | ||
4178 | telehub.AbsolutePosition, | ||
4179 | telehub.GroupRotation | ||
4180 | ); | ||
4181 | // SpawnPoint sp = spawnPoints[index]; | ||
4182 | |||
4183 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4184 | if (land == null || land.IsEitherBannedOrRestricted(UUID)) | ||
4185 | selected = false; | ||
4186 | else | ||
4187 | selected = true; | ||
4188 | |||
4189 | } while ( selected == false); | ||
4190 | |||
4191 | pos = spawnPoints[index].GetLocation( | ||
4192 | telehub.AbsolutePosition, | ||
4193 | telehub.GroupRotation | ||
4194 | ); | ||
4195 | return; | ||
4196 | |||
4197 | case "sequence": | ||
4198 | |||
4199 | do | ||
4200 | { | ||
4201 | index = m_scene.SpawnPoint(); | ||
4202 | |||
4203 | Vector3 spawnPosition = spawnPoints[index].GetLocation( | ||
4204 | telehub.AbsolutePosition, | ||
4205 | telehub.GroupRotation | ||
4206 | ); | ||
4207 | // SpawnPoint sp = spawnPoints[index]; | ||
4208 | |||
4209 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4210 | if (land == null || land.IsEitherBannedOrRestricted(UUID)) | ||
4211 | selected = false; | ||
4212 | else | ||
4213 | selected = true; | ||
4214 | |||
4215 | } while (selected == false); | ||
4216 | |||
4217 | pos = spawnPoints[index].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
4218 | ; | ||
4219 | return; | ||
4220 | |||
4221 | default: | ||
4222 | return; | ||
4223 | } | ||
4043 | } | 4224 | } |
4044 | } | 4225 | } |
4045 | } | 4226 | } |
@@ -4084,7 +4265,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4084 | GodLevel < 200 && | 4265 | GodLevel < 200 && |
4085 | ((land.LandData.OwnerID != m_uuid && | 4266 | ((land.LandData.OwnerID != m_uuid && |
4086 | !m_scene.Permissions.IsGod(m_uuid) && | 4267 | !m_scene.Permissions.IsGod(m_uuid) && |
4087 | !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) || | 4268 | !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || |
4088 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || | 4269 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || |
4089 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) | 4270 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) |
4090 | { | 4271 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs index ab6311b..4a21dc9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | ||
30 | using System.Text; | 31 | using System.Text; |
31 | using NUnit.Framework; | 32 | using NUnit.Framework; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
@@ -68,11 +69,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
68 | Vector3 position = new Vector3(200,200,21); | 69 | Vector3 position = new Vector3(200,200,21); |
69 | 70 | ||
70 | foreach (Border b in testborders) | 71 | foreach (Border b in testborders) |
71 | { | ||
72 | Assert.That(!b.TestCross(position)); | 72 | Assert.That(!b.TestCross(position)); |
73 | 73 | ||
74 | } | ||
75 | |||
76 | position = new Vector3(200,280,21); | 74 | position = new Vector3(200,280,21); |
77 | Assert.That(NorthBorder.TestCross(position)); | 75 | Assert.That(NorthBorder.TestCross(position)); |
78 | 76 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index a5d2b23..ea9fc93 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs | |||
@@ -45,7 +45,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
45 | { | 45 | { |
46 | static public Random random; | 46 | static public Random random; |
47 | SceneObjectGroup found; | 47 | SceneObjectGroup found; |
48 | Scene scene = SceneHelpers.SetupScene(); | 48 | Scene scene = new SceneHelpers().SetupScene(); |
49 | 49 | ||
50 | [Test] | 50 | [Test] |
51 | public void T010_AddObjects() | 51 | public void T010_AddObjects() |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index 9a60e50..d23c965 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs | |||
@@ -26,7 +26,9 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Text; | ||
30 | using NUnit.Framework; | 32 | using NUnit.Framework; |
31 | using OpenMetaverse; | 33 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
@@ -44,7 +46,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
44 | public void TestDuplicateObject() | 46 | public void TestDuplicateObject() |
45 | { | 47 | { |
46 | TestHelpers.InMethod(); | 48 | TestHelpers.InMethod(); |
47 | Scene scene = SceneHelpers.SetupScene(); | 49 | // TestHelpers.EnableLogging(); |
50 | |||
51 | Scene scene = new SceneHelpers().SetupScene(); | ||
48 | 52 | ||
49 | UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); | 53 | UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); |
50 | string part1Name = "part1"; | 54 | string part1Name = "part1"; |
@@ -82,6 +86,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
82 | Assert.That(dupePart1.PhysActor, Is.Not.Null); | 86 | Assert.That(dupePart1.PhysActor, Is.Not.Null); |
83 | Assert.That(dupePart2.PhysActor, Is.Not.Null); | 87 | Assert.That(dupePart2.PhysActor, Is.Not.Null); |
84 | */ | 88 | */ |
89 | |||
90 | // TestHelpers.DisableLogging(); | ||
85 | } | 91 | } |
86 | } | 92 | } |
87 | } \ No newline at end of file | 93 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 7737d8e..453e077 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
88 | { | 88 | { |
89 | TestHelpers.InMethod(); | 89 | TestHelpers.InMethod(); |
90 | 90 | ||
91 | Scene scene = SceneHelpers.SetupScene(); | 91 | Scene scene = new SceneHelpers().SetupScene(); |
92 | int partsToTestCount = 3; | 92 | int partsToTestCount = 3; |
93 | 93 | ||
94 | SceneObjectGroup so | 94 | SceneObjectGroup so |
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
118 | { | 118 | { |
119 | TestHelpers.InMethod(); | 119 | TestHelpers.InMethod(); |
120 | 120 | ||
121 | Scene scene = SceneHelpers.SetupScene(); | 121 | Scene scene = new SceneHelpers().SetupScene(); |
122 | 122 | ||
123 | string obj1Name = "Alfred"; | 123 | string obj1Name = "Alfred"; |
124 | string obj2Name = "Betty"; | 124 | string obj2Name = "Betty"; |
@@ -152,7 +152,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
152 | { | 152 | { |
153 | TestHelpers.InMethod(); | 153 | TestHelpers.InMethod(); |
154 | 154 | ||
155 | Scene scene = SceneHelpers.SetupScene(); | 155 | Scene scene = new SceneHelpers().SetupScene(); |
156 | int partsToTestCount = 3; | 156 | int partsToTestCount = 3; |
157 | 157 | ||
158 | SceneObjectGroup so | 158 | SceneObjectGroup so |
@@ -185,7 +185,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
185 | { | 185 | { |
186 | TestHelpers.InMethod(); | 186 | TestHelpers.InMethod(); |
187 | 187 | ||
188 | TestScene scene = SceneHelpers.SetupScene(); | 188 | TestScene scene = new SceneHelpers().SetupScene(); |
189 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | 189 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); |
190 | scene.DeleteSceneObject(part.ParentGroup, false); | 190 | scene.DeleteSceneObject(part.ParentGroup, false); |
191 | 191 | ||
@@ -204,7 +204,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
204 | 204 | ||
205 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 205 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
206 | 206 | ||
207 | TestScene scene = SceneHelpers.SetupScene(); | 207 | TestScene scene = new SceneHelpers().SetupScene(); |
208 | 208 | ||
209 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | 209 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. |
210 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | 210 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index 654b1a2..0076f41 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
61 | 61 | ||
62 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); | 62 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); |
63 | 63 | ||
64 | TestScene scene = SceneHelpers.SetupScene(); | 64 | TestScene scene = new SceneHelpers().SetupScene(); |
65 | IConfigSource configSource = new IniConfigSource(); | 65 | IConfigSource configSource = new IniConfigSource(); |
66 | IConfig config = configSource.AddConfig("Startup"); | 66 | IConfig config = configSource.AddConfig("Startup"); |
67 | config.Set("serverside_object_permissions", true); | 67 | config.Set("serverside_object_permissions", true); |
@@ -100,7 +100,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
100 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); | 100 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); |
101 | UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); | 101 | UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); |
102 | 102 | ||
103 | TestScene scene = SceneHelpers.SetupScene(); | 103 | TestScene scene = new SceneHelpers().SetupScene(); |
104 | IConfigSource configSource = new IniConfigSource(); | 104 | IConfigSource configSource = new IniConfigSource(); |
105 | IConfig config = configSource.AddConfig("Startup"); | 105 | IConfig config = configSource.AddConfig("Startup"); |
106 | config.Set("serverside_object_permissions", true); | 106 | config.Set("serverside_object_permissions", true); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index be5b4a8..1add3dd 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
55 | UUID ownerId = TestHelpers.ParseTail(0x1); | 55 | UUID ownerId = TestHelpers.ParseTail(0x1); |
56 | int nParts = 3; | 56 | int nParts = 3; |
57 | 57 | ||
58 | TestScene scene = SceneHelpers.SetupScene(); | 58 | TestScene scene = new SceneHelpers().SetupScene(); |
59 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(nParts, ownerId, "TestLinkToSelf_", 0x10); | 59 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(nParts, ownerId, "TestLinkToSelf_", 0x10); |
60 | scene.AddSceneObject(sog1); | 60 | scene.AddSceneObject(sog1); |
61 | scene.LinkObjects(ownerId, sog1.LocalId, new List<uint>() { sog1.Parts[1].LocalId }); | 61 | scene.LinkObjects(ownerId, sog1.LocalId, new List<uint>() { sog1.Parts[1].LocalId }); |
@@ -71,7 +71,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
71 | 71 | ||
72 | bool debugtest = false; | 72 | bool debugtest = false; |
73 | 73 | ||
74 | Scene scene = SceneHelpers.SetupScene(); | 74 | Scene scene = new SceneHelpers().SetupScene(); |
75 | SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); | 75 | SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); |
76 | SceneObjectGroup grp1 = part1.ParentGroup; | 76 | SceneObjectGroup grp1 = part1.ParentGroup; |
77 | SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); | 77 | SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); |
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
153 | 153 | ||
154 | bool debugtest = false; | 154 | bool debugtest = false; |
155 | 155 | ||
156 | Scene scene = SceneHelpers.SetupScene(); | 156 | Scene scene = new SceneHelpers().SetupScene(); |
157 | SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); | 157 | SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); |
158 | SceneObjectGroup grp1 = part1.ParentGroup; | 158 | SceneObjectGroup grp1 = part1.ParentGroup; |
159 | SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); | 159 | SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); |
@@ -286,7 +286,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
286 | TestHelpers.InMethod(); | 286 | TestHelpers.InMethod(); |
287 | //log4net.Config.XmlConfigurator.Configure(); | 287 | //log4net.Config.XmlConfigurator.Configure(); |
288 | 288 | ||
289 | TestScene scene = SceneHelpers.SetupScene(); | 289 | TestScene scene = new SceneHelpers().SetupScene(); |
290 | 290 | ||
291 | string rootPartName = "rootpart"; | 291 | string rootPartName = "rootpart"; |
292 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 292 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); |
@@ -325,7 +325,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
325 | TestHelpers.InMethod(); | 325 | TestHelpers.InMethod(); |
326 | //log4net.Config.XmlConfigurator.Configure(); | 326 | //log4net.Config.XmlConfigurator.Configure(); |
327 | 327 | ||
328 | TestScene scene = SceneHelpers.SetupScene(); | 328 | TestScene scene = new SceneHelpers().SetupScene(); |
329 | 329 | ||
330 | string rootPartName = "rootpart"; | 330 | string rootPartName = "rootpart"; |
331 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 331 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index b49c6e7..0a94c19 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs | |||
@@ -52,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
52 | TestHelpers.InMethod(); | 52 | TestHelpers.InMethod(); |
53 | // log4net.Config.XmlConfigurator.Configure(); | 53 | // log4net.Config.XmlConfigurator.Configure(); |
54 | 54 | ||
55 | Scene scene = SceneHelpers.SetupScene(); | 55 | Scene scene = new SceneHelpers().SetupScene(); |
56 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup; | 56 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup; |
57 | 57 | ||
58 | g1.GroupResize(new Vector3(2, 3, 4)); | 58 | g1.GroupResize(new Vector3(2, 3, 4)); |
@@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
75 | TestHelpers.InMethod(); | 75 | TestHelpers.InMethod(); |
76 | //log4net.Config.XmlConfigurator.Configure(); | 76 | //log4net.Config.XmlConfigurator.Configure(); |
77 | 77 | ||
78 | Scene scene = SceneHelpers.SetupScene(); | 78 | Scene scene = new SceneHelpers().SetupScene(); |
79 | 79 | ||
80 | SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero); | 80 | SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero); |
81 | g1.RootPart.Scale = new Vector3(2, 3, 4); | 81 | g1.RootPart.Scale = new Vector3(2, 3, 4); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs index c582cf6..d2361f8 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs | |||
@@ -52,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
52 | // UUID itemId = TestHelpers.ParseTail(0x2); | 52 | // UUID itemId = TestHelpers.ParseTail(0x2); |
53 | string itemName = "Test Script Item"; | 53 | string itemName = "Test Script Item"; |
54 | 54 | ||
55 | Scene scene = SceneHelpers.SetupScene(); | 55 | Scene scene = new SceneHelpers().SetupScene(); |
56 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); | 56 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); |
57 | scene.AddNewSceneObject(so, true); | 57 | scene.AddNewSceneObject(so, true); |
58 | 58 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs new file mode 100644 index 0000000..6d255aa --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs | |||
@@ -0,0 +1,154 @@ | |||
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 System.Threading; | ||
31 | using NUnit.Framework; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Communications; | ||
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | using OpenSim.Tests.Common; | ||
37 | using OpenSim.Tests.Common.Mock; | ||
38 | |||
39 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// Spatial scene object tests (will eventually cover root and child part position, rotation properties, etc.) | ||
43 | /// </summary> | ||
44 | [TestFixture] | ||
45 | public class SceneObjectSpatialTests | ||
46 | { | ||
47 | TestScene m_scene; | ||
48 | UUID m_ownerId = TestHelpers.ParseTail(0x1); | ||
49 | |||
50 | [SetUp] | ||
51 | public void SetUp() | ||
52 | { | ||
53 | m_scene = new SceneHelpers().SetupScene(); | ||
54 | } | ||
55 | |||
56 | [Test] | ||
57 | public void TestGetSceneObjectGroupPosition() | ||
58 | { | ||
59 | TestHelpers.InMethod(); | ||
60 | |||
61 | Vector3 position = new Vector3(10, 20, 30); | ||
62 | |||
63 | SceneObjectGroup so | ||
64 | = SceneHelpers.CreateSceneObject(1, m_ownerId, "obj1", 0x10); | ||
65 | so.AbsolutePosition = position; | ||
66 | m_scene.AddNewSceneObject(so, false); | ||
67 | |||
68 | Assert.That(so.AbsolutePosition, Is.EqualTo(position)); | ||
69 | } | ||
70 | |||
71 | [Test] | ||
72 | public void TestGetRootPartPosition() | ||
73 | { | ||
74 | TestHelpers.InMethod(); | ||
75 | |||
76 | Vector3 partPosition = new Vector3(10, 20, 30); | ||
77 | |||
78 | SceneObjectGroup so | ||
79 | = SceneHelpers.CreateSceneObject(1, m_ownerId, "obj1", 0x10); | ||
80 | so.AbsolutePosition = partPosition; | ||
81 | m_scene.AddNewSceneObject(so, false); | ||
82 | |||
83 | Assert.That(so.RootPart.AbsolutePosition, Is.EqualTo(partPosition)); | ||
84 | Assert.That(so.RootPart.GroupPosition, Is.EqualTo(partPosition)); | ||
85 | Assert.That(so.RootPart.GetWorldPosition(), Is.EqualTo(partPosition)); | ||
86 | Assert.That(so.RootPart.RelativePosition, Is.EqualTo(partPosition)); | ||
87 | Assert.That(so.RootPart.OffsetPosition, Is.EqualTo(Vector3.Zero)); | ||
88 | } | ||
89 | |||
90 | [Test] | ||
91 | public void TestGetChildPartPosition() | ||
92 | { | ||
93 | TestHelpers.InMethod(); | ||
94 | |||
95 | Vector3 rootPartPosition = new Vector3(10, 20, 30); | ||
96 | Vector3 childOffsetPosition = new Vector3(2, 3, 4); | ||
97 | |||
98 | SceneObjectGroup so | ||
99 | = SceneHelpers.CreateSceneObject(2, m_ownerId, "obj1", 0x10); | ||
100 | so.AbsolutePosition = rootPartPosition; | ||
101 | so.Parts[1].OffsetPosition = childOffsetPosition; | ||
102 | |||
103 | m_scene.AddNewSceneObject(so, false); | ||
104 | |||
105 | // Calculate child absolute position. | ||
106 | Vector3 childPosition = new Vector3(rootPartPosition + childOffsetPosition); | ||
107 | |||
108 | SceneObjectPart childPart = so.Parts[1]; | ||
109 | Assert.That(childPart.AbsolutePosition, Is.EqualTo(childPosition)); | ||
110 | Assert.That(childPart.GroupPosition, Is.EqualTo(rootPartPosition)); | ||
111 | Assert.That(childPart.GetWorldPosition(), Is.EqualTo(childPosition)); | ||
112 | Assert.That(childPart.RelativePosition, Is.EqualTo(childOffsetPosition)); | ||
113 | Assert.That(childPart.OffsetPosition, Is.EqualTo(childOffsetPosition)); | ||
114 | } | ||
115 | |||
116 | [Test] | ||
117 | public void TestGetChildPartPositionAfterObjectRotation() | ||
118 | { | ||
119 | TestHelpers.InMethod(); | ||
120 | |||
121 | Vector3 rootPartPosition = new Vector3(10, 20, 30); | ||
122 | Vector3 childOffsetPosition = new Vector3(2, 3, 4); | ||
123 | |||
124 | SceneObjectGroup so | ||
125 | = SceneHelpers.CreateSceneObject(2, m_ownerId, "obj1", 0x10); | ||
126 | so.AbsolutePosition = rootPartPosition; | ||
127 | so.Parts[1].OffsetPosition = childOffsetPosition; | ||
128 | |||
129 | m_scene.AddNewSceneObject(so, false); | ||
130 | |||
131 | so.UpdateGroupRotationR(Quaternion.CreateFromEulers(0, 0, -90 * Utils.DEG_TO_RAD)); | ||
132 | |||
133 | // Calculate child absolute position. | ||
134 | Vector3 rotatedChildOffsetPosition | ||
135 | = new Vector3(childOffsetPosition.Y, -childOffsetPosition.X, childOffsetPosition.Z); | ||
136 | |||
137 | Vector3 childPosition = new Vector3(rootPartPosition + rotatedChildOffsetPosition); | ||
138 | |||
139 | SceneObjectPart childPart = so.Parts[1]; | ||
140 | |||
141 | // FIXME: Should be childPosition after rotation? | ||
142 | Assert.That(childPart.AbsolutePosition, Is.EqualTo(rootPartPosition + childOffsetPosition)); | ||
143 | |||
144 | Assert.That(childPart.GroupPosition, Is.EqualTo(rootPartPosition)); | ||
145 | Assert.That(childPart.GetWorldPosition(), Is.EqualTo(childPosition)); | ||
146 | |||
147 | // Relative to root part as (0, 0, 0) | ||
148 | Assert.That(childPart.RelativePosition, Is.EqualTo(childOffsetPosition)); | ||
149 | |||
150 | // Relative to root part as (0, 0, 0) | ||
151 | Assert.That(childPart.OffsetPosition, Is.EqualTo(childOffsetPosition)); | ||
152 | } | ||
153 | } | ||
154 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index 2a342d5..742c769 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using NUnit.Framework; | 31 | using NUnit.Framework; |
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
@@ -43,24 +44,141 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
43 | [TestFixture] | 44 | [TestFixture] |
44 | public class SceneObjectStatusTests | 45 | public class SceneObjectStatusTests |
45 | { | 46 | { |
47 | private TestScene m_scene; | ||
48 | private UUID m_ownerId = TestHelpers.ParseTail(0x1); | ||
49 | private SceneObjectGroup m_so1; | ||
50 | private SceneObjectGroup m_so2; | ||
51 | |||
52 | [SetUp] | ||
53 | public void Init() | ||
54 | { | ||
55 | m_scene = new SceneHelpers().SetupScene(); | ||
56 | m_so1 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so1", 0x10); | ||
57 | m_so2 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so2", 0x20); | ||
58 | } | ||
59 | |||
46 | [Test] | 60 | [Test] |
47 | public void TestSetPhantom() | 61 | public void TestSetPhantomSinglePrim() |
48 | { | 62 | { |
49 | TestHelpers.InMethod(); | 63 | TestHelpers.InMethod(); |
50 | 64 | ||
51 | // Scene scene = SceneSetupHelpers.SetupScene(); | 65 | m_scene.AddSceneObject(m_so1); |
52 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero); | 66 | |
53 | SceneObjectPart rootPart = so.RootPart; | 67 | SceneObjectPart rootPart = m_so1.RootPart; |
54 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); | 68 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); |
55 | 69 | ||
56 | so.ScriptSetPhantomStatus(true); | 70 | m_so1.ScriptSetPhantomStatus(true); |
57 | 71 | ||
58 | // Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); | 72 | // Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); |
59 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); | 73 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); |
60 | 74 | ||
61 | so.ScriptSetPhantomStatus(false); | 75 | m_so1.ScriptSetPhantomStatus(false); |
62 | 76 | ||
63 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); | 77 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); |
64 | } | 78 | } |
79 | |||
80 | [Test] | ||
81 | public void TestSetPhysicsSinglePrim() | ||
82 | { | ||
83 | TestHelpers.InMethod(); | ||
84 | |||
85 | m_scene.AddSceneObject(m_so1); | ||
86 | |||
87 | SceneObjectPart rootPart = m_so1.RootPart; | ||
88 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); | ||
89 | |||
90 | m_so1.ScriptSetPhysicsStatus(true); | ||
91 | |||
92 | // Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); | ||
93 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics)); | ||
94 | |||
95 | m_so1.ScriptSetPhysicsStatus(false); | ||
96 | |||
97 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); | ||
98 | } | ||
99 | |||
100 | [Test] | ||
101 | public void TestSetPhysicsLinkset() | ||
102 | { | ||
103 | TestHelpers.InMethod(); | ||
104 | |||
105 | m_scene.AddSceneObject(m_so1); | ||
106 | m_scene.AddSceneObject(m_so2); | ||
107 | |||
108 | m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId }); | ||
109 | |||
110 | m_so1.ScriptSetPhysicsStatus(true); | ||
111 | |||
112 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics)); | ||
113 | Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics)); | ||
114 | |||
115 | m_so1.ScriptSetPhysicsStatus(false); | ||
116 | |||
117 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None)); | ||
118 | Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None)); | ||
119 | |||
120 | m_so1.ScriptSetPhysicsStatus(true); | ||
121 | |||
122 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics)); | ||
123 | Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics)); | ||
124 | } | ||
125 | |||
126 | /// <summary> | ||
127 | /// Test that linking results in the correct physical status for all linkees. | ||
128 | /// </summary> | ||
129 | [Test] | ||
130 | public void TestLinkPhysicsBothPhysical() | ||
131 | { | ||
132 | TestHelpers.InMethod(); | ||
133 | |||
134 | m_scene.AddSceneObject(m_so1); | ||
135 | m_scene.AddSceneObject(m_so2); | ||
136 | |||
137 | m_so1.ScriptSetPhysicsStatus(true); | ||
138 | m_so2.ScriptSetPhysicsStatus(true); | ||
139 | |||
140 | m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId }); | ||
141 | |||
142 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics)); | ||
143 | Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics)); | ||
144 | } | ||
145 | |||
146 | /// <summary> | ||
147 | /// Test that linking results in the correct physical status for all linkees. | ||
148 | /// </summary> | ||
149 | [Test] | ||
150 | public void TestLinkPhysicsRootPhysicalOnly() | ||
151 | { | ||
152 | TestHelpers.InMethod(); | ||
153 | |||
154 | m_scene.AddSceneObject(m_so1); | ||
155 | m_scene.AddSceneObject(m_so2); | ||
156 | |||
157 | m_so1.ScriptSetPhysicsStatus(true); | ||
158 | |||
159 | m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId }); | ||
160 | |||
161 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics)); | ||
162 | Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics)); | ||
163 | } | ||
164 | |||
165 | /// <summary> | ||
166 | /// Test that linking results in the correct physical status for all linkees. | ||
167 | /// </summary> | ||
168 | [Test] | ||
169 | public void TestLinkPhysicsChildPhysicalOnly() | ||
170 | { | ||
171 | TestHelpers.InMethod(); | ||
172 | |||
173 | m_scene.AddSceneObject(m_so1); | ||
174 | m_scene.AddSceneObject(m_so2); | ||
175 | |||
176 | m_so2.ScriptSetPhysicsStatus(true); | ||
177 | |||
178 | m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId }); | ||
179 | |||
180 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None)); | ||
181 | Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None)); | ||
182 | } | ||
65 | } | 183 | } |
66 | } \ No newline at end of file | 184 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index c13d82e..c7eaff9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
58 | 58 | ||
59 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); | 59 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); |
60 | 60 | ||
61 | TestScene scene = SceneHelpers.SetupScene(); | 61 | TestScene scene = new SceneHelpers().SetupScene(); |
62 | IConfigSource configSource = new IniConfigSource(); | 62 | IConfigSource configSource = new IniConfigSource(); |
63 | 63 | ||
64 | IConfig startupConfig = configSource.AddConfig("Startup"); | 64 | IConfig startupConfig = configSource.AddConfig("Startup"); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index ed9b179..1aa48d7 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | |||
@@ -67,10 +67,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
67 | public void Init() | 67 | public void Init() |
68 | { | 68 | { |
69 | TestHelpers.InMethod(); | 69 | TestHelpers.InMethod(); |
70 | 70 | ||
71 | scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); | 71 | SceneHelpers sh = new SceneHelpers(); |
72 | scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); | 72 | |
73 | scene3 = SceneHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); | 73 | scene = sh.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); |
74 | scene2 = sh.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); | ||
75 | scene3 = sh.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); | ||
74 | 76 | ||
75 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); | 77 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); |
76 | interregionComms.Initialise(new IniConfigSource()); | 78 | interregionComms.Initialise(new IniConfigSource()); |
@@ -101,7 +103,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
101 | TestHelpers.InMethod(); | 103 | TestHelpers.InMethod(); |
102 | // log4net.Config.XmlConfigurator.Configure(); | 104 | // log4net.Config.XmlConfigurator.Configure(); |
103 | 105 | ||
104 | TestScene scene = SceneHelpers.SetupScene(); | 106 | TestScene scene = new SceneHelpers().SetupScene(); |
105 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 107 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); |
106 | 108 | ||
107 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null); | 109 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null); |
@@ -126,7 +128,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
126 | IConfig config = configSource.AddConfig("Modules"); | 128 | IConfig config = configSource.AddConfig("Modules"); |
127 | config.Set("SimulationServices", "LocalSimulationConnectorModule"); | 129 | config.Set("SimulationServices", "LocalSimulationConnectorModule"); |
128 | 130 | ||
129 | TestScene scene = SceneHelpers.SetupScene(); | 131 | SceneHelpers sceneHelpers = new SceneHelpers(); |
132 | TestScene scene = sceneHelpers.SetupScene(); | ||
130 | SceneHelpers.SetupSceneModules(scene, configSource, lsc); | 133 | SceneHelpers.SetupSceneModules(scene, configSource, lsc); |
131 | 134 | ||
132 | UUID agentId = TestHelpers.ParseTail(0x01); | 135 | UUID agentId = TestHelpers.ParseTail(0x01); |
@@ -176,8 +179,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
176 | 179 | ||
177 | // UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 180 | // UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
178 | 181 | ||
179 | TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); | 182 | TestScene myScene1 = new SceneHelpers().SetupScene("Neighbour y", UUID.Random(), 1000, 1000); |
180 | TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); | 183 | TestScene myScene2 = new SceneHelpers().SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); |
181 | 184 | ||
182 | IConfigSource configSource = new IniConfigSource(); | 185 | IConfigSource configSource = new IniConfigSource(); |
183 | IConfig config = configSource.AddConfig("Startup"); | 186 | IConfig config = configSource.AddConfig("Startup"); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs index 89f8007..646e5fa 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
59 | TestHelpers.InMethod(); | 59 | TestHelpers.InMethod(); |
60 | // log4net.Config.XmlConfigurator.Configure(); | 60 | // log4net.Config.XmlConfigurator.Configure(); |
61 | 61 | ||
62 | TestScene scene = SceneHelpers.SetupScene(); | 62 | TestScene scene = new SceneHelpers().SetupScene(); |
63 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 63 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); |
64 | sp.Flying = true; | 64 | sp.Flying = true; |
65 | sp.PhysicsCollisionUpdate(new CollisionEventUpdate()); | 65 | sp.PhysicsCollisionUpdate(new CollisionEventUpdate()); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs index cfea10d..1d1ff88 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs | |||
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
64 | [SetUp] | 64 | [SetUp] |
65 | public void Init() | 65 | public void Init() |
66 | { | 66 | { |
67 | m_scene = SceneHelpers.SetupScene(); | 67 | m_scene = new SceneHelpers().SetupScene(); |
68 | } | 68 | } |
69 | 69 | ||
70 | [Test] | 70 | [Test] |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs index b7b8db4..313e350 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
50 | [SetUp] | 50 | [SetUp] |
51 | public void Init() | 51 | public void Init() |
52 | { | 52 | { |
53 | m_scene = SceneHelpers.SetupScene(); | 53 | m_scene = new SceneHelpers().SetupScene(); |
54 | m_sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); | 54 | m_sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); |
55 | } | 55 | } |
56 | 56 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index bebc10c..ea4fb66 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | |||
@@ -34,10 +34,13 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.CoreModules.Framework; | ||
38 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | ||
37 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 39 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
38 | using OpenSim.Tests.Common; | 40 | using OpenSim.Tests.Common; |
39 | using OpenSim.Tests.Common.Mock; | 41 | using OpenSim.Tests.Common.Mock; |
40 | using System.Threading; | 42 | using System.IO; |
43 | using System.Text; | ||
41 | 44 | ||
42 | namespace OpenSim.Region.Framework.Scenes.Tests | 45 | namespace OpenSim.Region.Framework.Scenes.Tests |
43 | { | 46 | { |
@@ -47,145 +50,190 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
47 | [TestFixture] | 50 | [TestFixture] |
48 | public class ScenePresenceTeleportTests | 51 | public class ScenePresenceTeleportTests |
49 | { | 52 | { |
50 | /// <summary> | 53 | [TestFixtureSetUp] |
51 | /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. | 54 | public void FixtureInit() |
52 | /// </summary> | 55 | { |
53 | /// Does not yet do what is says on the tin. | 56 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. |
54 | /// Commenting for now | 57 | Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest; |
55 | //[Test, LongRunning] | 58 | } |
56 | public void TestSimpleNotNeighboursTeleport() | 59 | |
60 | [TestFixtureTearDown] | ||
61 | public void TearDown() | ||
62 | { | ||
63 | // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple | ||
64 | // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression | ||
65 | // tests really shouldn't). | ||
66 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | ||
67 | } | ||
68 | |||
69 | [Test] | ||
70 | public void TestSameRegionTeleport() | ||
57 | { | 71 | { |
58 | TestHelpers.InMethod(); | 72 | TestHelpers.InMethod(); |
59 | ThreadRunResults results = new ThreadRunResults(); | 73 | // log4net.Config.XmlConfigurator.Configure(); |
60 | results.Result = false; | ||
61 | results.Message = "Test did not run"; | ||
62 | TestRunning testClass = new TestRunning(results); | ||
63 | 74 | ||
64 | Thread testThread = new Thread(testClass.run); | 75 | EntityTransferModule etm = new EntityTransferModule(); |
65 | 76 | ||
66 | // Seems kind of redundant to start a thread and then join it, however.. We need to protect against | 77 | IConfigSource config = new IniConfigSource(); |
67 | // A thread abort exception in the simulator code. | 78 | config.AddConfig("Modules"); |
68 | testThread.Start(); | 79 | // Not strictly necessary since FriendsModule assumes it is the default (!) |
69 | testThread.Join(); | 80 | config.Configs["Modules"].Set("EntityTransferModule", etm.Name); |
70 | 81 | ||
71 | Assert.That(testClass.results.Result, Is.EqualTo(true), testClass.results.Message); | 82 | TestScene scene = new SceneHelpers().SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); |
72 | // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); | 83 | SceneHelpers.SetupSceneModules(scene, config, etm); |
84 | |||
85 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
86 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
87 | |||
88 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | ||
89 | sp.AbsolutePosition = new Vector3(30, 31, 32); | ||
90 | scene.RequestTeleportLocation( | ||
91 | sp.ControllingClient, | ||
92 | scene.RegionInfo.RegionHandle, | ||
93 | teleportPosition, | ||
94 | teleportLookAt, | ||
95 | (uint)TeleportFlags.ViaLocation); | ||
96 | |||
97 | Assert.That(sp.AbsolutePosition, Is.EqualTo(teleportPosition)); | ||
98 | |||
99 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera | ||
100 | // position instead). | ||
101 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
73 | } | 102 | } |
74 | 103 | ||
75 | [TearDown] | 104 | [Test] |
76 | public void TearDown() | 105 | public void TestSameSimulatorSeparatedRegionsTeleport() |
77 | { | 106 | { |
78 | try | 107 | TestHelpers.InMethod(); |
79 | { | 108 | // log4net.Config.XmlConfigurator.Configure(); |
80 | if (MainServer.Instance != null) MainServer.Instance.Stop(); | ||
81 | } | ||
82 | catch (NullReferenceException) | ||
83 | { } | ||
84 | } | ||
85 | 109 | ||
86 | } | 110 | UUID userId = TestHelpers.ParseTail(0x1); |
87 | 111 | ||
88 | public class ThreadRunResults | 112 | EntityTransferModule etm = new EntityTransferModule(); |
89 | { | 113 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); |
90 | public bool Result = false; | ||
91 | public string Message = string.Empty; | ||
92 | } | ||
93 | 114 | ||
94 | public class TestRunning | 115 | IConfigSource config = new IniConfigSource(); |
95 | { | 116 | IConfig modulesConfig = config.AddConfig("Modules"); |
96 | public ThreadRunResults results; | 117 | modulesConfig.Set("EntityTransferModule", etm.Name); |
97 | public TestRunning(ThreadRunResults t) | 118 | modulesConfig.Set("SimulationServices", lscm.Name); |
98 | { | 119 | IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); |
99 | results = t; | 120 | |
121 | // In order to run a single threaded regression test we do not want the entity transfer module waiting | ||
122 | // for a callback from the destination scene before removing its avatar data. | ||
123 | entityTransferConfig.Set("wait_for_callback", false); | ||
124 | |||
125 | SceneHelpers sh = new SceneHelpers(); | ||
126 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
127 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); | ||
128 | |||
129 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm); | ||
130 | |||
131 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
132 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
133 | |||
134 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); | ||
135 | sp.AbsolutePosition = new Vector3(30, 31, 32); | ||
136 | |||
137 | // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole | ||
138 | // UDP stack (?) | ||
139 | // ((TestClient)sp.ControllingClient).TeleportTargetScene = sceneB; | ||
140 | |||
141 | sceneA.RequestTeleportLocation( | ||
142 | sp.ControllingClient, | ||
143 | sceneB.RegionInfo.RegionHandle, | ||
144 | teleportPosition, | ||
145 | teleportLookAt, | ||
146 | (uint)TeleportFlags.ViaLocation); | ||
147 | |||
148 | ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); | ||
149 | |||
150 | Assert.That(sceneA.GetScenePresence(userId), Is.Null); | ||
151 | |||
152 | ScenePresence sceneBSp = sceneB.GetScenePresence(userId); | ||
153 | Assert.That(sceneBSp, Is.Not.Null); | ||
154 | Assert.That(sceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); | ||
155 | Assert.That(sceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); | ||
156 | |||
157 | // TODO: Add assertions to check correct circuit details in both scenes. | ||
158 | |||
159 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera | ||
160 | // position instead). | ||
161 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
100 | } | 162 | } |
101 | public void run(object o) | 163 | |
164 | [Test] | ||
165 | public void TestSameSimulatorNeighbouringRegionsTeleport() | ||
102 | { | 166 | { |
103 | 167 | TestHelpers.InMethod(); | |
104 | //results.Result = true; | 168 | // TestHelpers.EnableLogging(); |
105 | log4net.Config.XmlConfigurator.Configure(); | 169 | |
106 | 170 | UUID userId = TestHelpers.ParseTail(0x1); | |
107 | UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); | 171 | |
108 | UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); | 172 | EntityTransferModule etm = new EntityTransferModule(); |
109 | 173 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | |
110 | // shared module | 174 | |
111 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); | 175 | IConfigSource config = new IniConfigSource(); |
112 | 176 | IConfig modulesConfig = config.AddConfig("Modules"); | |
113 | 177 | modulesConfig.Set("EntityTransferModule", etm.Name); | |
114 | Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); | 178 | modulesConfig.Set("SimulationServices", lscm.Name); |
115 | SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); | 179 | IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); |
116 | sceneB.RegisterRegionWithGrid(); | 180 | |
117 | 181 | // In order to run a single threaded regression test we do not want the entity transfer module waiting | |
118 | Scene sceneA = SceneHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); | 182 | // for a callback from the destination scene before removing its avatar data. |
119 | SceneHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); | 183 | entityTransferConfig.Set("wait_for_callback", false); |
120 | sceneA.RegisterRegionWithGrid(); | 184 | |
121 | 185 | SceneHelpers sh = new SceneHelpers(); | |
122 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); | 186 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); |
123 | TestClient client = (TestClient)SceneHelpers.AddScenePresence(sceneA, agentId).ControllingClient; | 187 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000); |
124 | 188 | ||
125 | ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); | 189 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm); |
126 | 190 | SceneHelpers.SetupSceneModules(sceneA, new CapabilitiesModule()); | |
127 | results.Result = (sceneACapsModule.GetCapsPath(agentId) == client.CapsSeedUrl); | 191 | SceneHelpers.SetupSceneModules(sceneB, new CapabilitiesModule()); |
128 | 192 | ||
129 | if (!results.Result) | 193 | Vector3 teleportPosition = new Vector3(10, 11, 12); |
130 | { | 194 | Vector3 teleportLookAt = new Vector3(20, 21, 22); |
131 | results.Message = "Incorrect caps object path set up in sceneA"; | 195 | |
132 | return; | 196 | ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); |
133 | } | 197 | originalSp.AbsolutePosition = new Vector3(30, 31, 32); |
134 | 198 | ||
135 | /* | 199 | ScenePresence beforeSceneASp = sceneA.GetScenePresence(userId); |
136 | Assert.That( | 200 | Assert.That(beforeSceneASp, Is.Not.Null); |
137 | sceneACapsModule.GetCapsPath(agentId), | 201 | Assert.That(beforeSceneASp.IsChildAgent, Is.False); |
138 | Is.EqualTo(client.CapsSeedUrl), | 202 | |
139 | "Incorrect caps object path set up in sceneA"); | 203 | ScenePresence beforeSceneBSp = sceneB.GetScenePresence(userId); |
140 | */ | 204 | Assert.That(beforeSceneBSp, Is.Not.Null); |
141 | // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used. | 205 | Assert.That(beforeSceneBSp.IsChildAgent, Is.True); |
142 | 206 | ||
143 | 207 | // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole | |
144 | client.TeleportTargetScene = sceneB; | 208 | // UDP stack (?) |
145 | client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40)); | 209 | // ((TestClient)beforeSceneASp.ControllingClient).TeleportTargetScene = sceneB; |
146 | 210 | ||
147 | results.Result = (sceneB.GetScenePresence(agentId) != null); | 211 | sceneA.RequestTeleportLocation( |
148 | if (!results.Result) | 212 | beforeSceneASp.ControllingClient, |
149 | { | 213 | sceneB.RegionInfo.RegionHandle, |
150 | results.Message = "Client does not have an agent in sceneB"; | 214 | teleportPosition, |
151 | return; | 215 | teleportLookAt, |
152 | } | 216 | (uint)TeleportFlags.ViaLocation); |
153 | 217 | ||
154 | //Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB"); | 218 | ((TestClient)beforeSceneASp.ControllingClient).CompleteTeleportClientSide(); |
155 | 219 | ||
156 | //Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA"); | 220 | ScenePresence afterSceneASp = sceneA.GetScenePresence(userId); |
157 | 221 | Assert.That(afterSceneASp, Is.Not.Null); | |
158 | results.Result = (sceneA.GetScenePresence(agentId) == null); | 222 | Assert.That(afterSceneASp.IsChildAgent, Is.True); |
159 | if (!results.Result) | 223 | |
160 | { | 224 | ScenePresence afterSceneBSp = sceneB.GetScenePresence(userId); |
161 | results.Message = "Client still had an agent in sceneA"; | 225 | Assert.That(afterSceneBSp, Is.Not.Null); |
162 | return; | 226 | Assert.That(afterSceneBSp.IsChildAgent, Is.False); |
163 | } | 227 | Assert.That(afterSceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); |
164 | 228 | Assert.That(afterSceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); | |
165 | ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface<ICapabilitiesModule>(); | 229 | |
166 | 230 | // TODO: Add assertions to check correct circuit details in both scenes. | |
167 | 231 | ||
168 | results.Result = ("http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + | 232 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera |
169 | "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/" == client.CapsSeedUrl); | 233 | // position instead). |
170 | if (!results.Result) | 234 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); |
171 | { | 235 | |
172 | results.Message = "Incorrect caps object path set up in sceneB"; | 236 | // TestHelpers.DisableLogging(); |
173 | return; | ||
174 | } | ||
175 | |||
176 | // Temporary assertion - caps url construction should at least be doable through a method. | ||
177 | /* | ||
178 | Assert.That( | ||
179 | "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/", | ||
180 | Is.EqualTo(client.CapsSeedUrl), | ||
181 | "Incorrect caps object path set up in sceneB"); | ||
182 | */ | ||
183 | // This assertion will currently fail since we don't remove the caps paths when no longer needed | ||
184 | //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path"); | ||
185 | |||
186 | // TODO: Check that more of everything is as it should be | ||
187 | |||
188 | // TODO: test what happens if we try to teleport to a region that doesn't exist | ||
189 | } | 237 | } |
190 | } | 238 | } |
191 | } | 239 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index 5c9a77d..d722a09 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs | |||
@@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
60 | { | 60 | { |
61 | TestHelpers.InMethod(); | 61 | TestHelpers.InMethod(); |
62 | 62 | ||
63 | Scene scene = SceneHelpers.SetupScene(); | 63 | Scene scene = new SceneHelpers().SetupScene(); |
64 | scene.Update(1); | 64 | scene.Update(1); |
65 | 65 | ||
66 | Assert.That(scene.Frame, Is.EqualTo(1)); | 66 | Assert.That(scene.Frame, Is.EqualTo(1)); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 55c80f5..d15141b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Tests | |||
58 | TestHelpers.InMethod(); | 58 | TestHelpers.InMethod(); |
59 | // log4net.Config.XmlConfigurator.Configure(); | 59 | // log4net.Config.XmlConfigurator.Configure(); |
60 | 60 | ||
61 | Scene scene = SceneHelpers.SetupScene(); | 61 | Scene scene = new SceneHelpers().SetupScene(); |
62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | 62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
63 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); | 63 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); |
64 | SceneObjectPart sop1 = sog1.RootPart; | 64 | SceneObjectPart sop1 = sog1.RootPart; |
@@ -81,7 +81,7 @@ namespace OpenSim.Region.Framework.Tests | |||
81 | TestHelpers.InMethod(); | 81 | TestHelpers.InMethod(); |
82 | // log4net.Config.XmlConfigurator.Configure(); | 82 | // log4net.Config.XmlConfigurator.Configure(); |
83 | 83 | ||
84 | Scene scene = SceneHelpers.SetupScene(); | 84 | Scene scene = new SceneHelpers().SetupScene(); |
85 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | 85 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
86 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); | 86 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); |
87 | SceneObjectPart sop1 = sog1.RootPart; | 87 | SceneObjectPart sop1 = sog1.RootPart; |
@@ -124,7 +124,7 @@ namespace OpenSim.Region.Framework.Tests | |||
124 | TestHelpers.InMethod(); | 124 | TestHelpers.InMethod(); |
125 | // log4net.Config.XmlConfigurator.Configure(); | 125 | // log4net.Config.XmlConfigurator.Configure(); |
126 | 126 | ||
127 | Scene scene = SceneHelpers.SetupScene(); | 127 | Scene scene = new SceneHelpers().SetupScene(); |
128 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | 128 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
129 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); | 129 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); |
130 | SceneObjectPart sop1 = sog1.RootPart; | 130 | SceneObjectPart sop1 = sog1.RootPart; |
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Tests | |||
153 | TestHelpers.InMethod(); | 153 | TestHelpers.InMethod(); |
154 | // log4net.Config.XmlConfigurator.Configure(); | 154 | // log4net.Config.XmlConfigurator.Configure(); |
155 | 155 | ||
156 | Scene scene = SceneHelpers.SetupScene(); | 156 | Scene scene = new SceneHelpers().SetupScene(); |
157 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | 157 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
158 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); | 158 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); |
159 | SceneObjectPart sop1 = sog1.RootPart; | 159 | SceneObjectPart sop1 = sog1.RootPart; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 55fc1e7..44d2d45 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Tests | |||
58 | TestHelpers.InMethod(); | 58 | TestHelpers.InMethod(); |
59 | // log4net.Config.XmlConfigurator.Configure(); | 59 | // log4net.Config.XmlConfigurator.Configure(); |
60 | 60 | ||
61 | Scene scene = SceneHelpers.SetupScene(); | 61 | Scene scene = new SceneHelpers().SetupScene(); |
62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); | 62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); |
63 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); | 63 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); |
64 | InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); | 64 | InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); |
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Tests | |||
85 | TestHelpers.InMethod(); | 85 | TestHelpers.InMethod(); |
86 | // log4net.Config.XmlConfigurator.Configure(); | 86 | // log4net.Config.XmlConfigurator.Configure(); |
87 | 87 | ||
88 | Scene scene = SceneHelpers.SetupScene(); | 88 | Scene scene = new SceneHelpers().SetupScene(); |
89 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); | 89 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); |
90 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); | 90 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); |
91 | InventoryFolderBase folder1 | 91 | InventoryFolderBase folder1 |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index d9fe87c..198e487 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
47 | public void Init() | 47 | public void Init() |
48 | { | 48 | { |
49 | // FIXME: We don't need a full scene here - it would be enough to set up the asset service. | 49 | // FIXME: We don't need a full scene here - it would be enough to set up the asset service. |
50 | Scene scene = SceneHelpers.SetupScene(); | 50 | Scene scene = new SceneHelpers().SetupScene(); |
51 | m_assetService = scene.AssetService; | 51 | m_assetService = scene.AssetService; |
52 | m_uuidGatherer = new UuidGatherer(m_assetService); | 52 | m_uuidGatherer = new UuidGatherer(m_assetService); |
53 | } | 53 | } |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs new file mode 100644 index 0000000..a95514c --- /dev/null +++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs | |||
@@ -0,0 +1,195 @@ | |||
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.Reflection; | ||
32 | using System.Text; | ||
33 | using log4net; | ||
34 | using Mono.Addins; | ||
35 | using Nini.Config; | ||
36 | using OpenMetaverse; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Console; | ||
39 | using OpenSim.Framework.Statistics; | ||
40 | using OpenSim.Region.ClientStack.LindenUDP; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | |||
44 | namespace OpenSim.Region.OptionalModules.Avatar.Attachments | ||
45 | { | ||
46 | /// <summary> | ||
47 | /// A module that just holds commands for inspecting avatar appearance. | ||
48 | /// </summary> | ||
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AttachmentsCommandModule")] | ||
50 | public class AttachmentsCommandModule : ISharedRegionModule | ||
51 | { | ||
52 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
53 | |||
54 | private List<Scene> m_scenes = new List<Scene>(); | ||
55 | // private IAvatarFactoryModule m_avatarFactory; | ||
56 | |||
57 | public string Name { get { return "Attachments Command Module"; } } | ||
58 | |||
59 | public Type ReplaceableInterface { get { return null; } } | ||
60 | |||
61 | public void Initialise(IConfigSource source) | ||
62 | { | ||
63 | // m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: INITIALIZED MODULE"); | ||
64 | } | ||
65 | |||
66 | public void PostInitialise() | ||
67 | { | ||
68 | // m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: POST INITIALIZED MODULE"); | ||
69 | } | ||
70 | |||
71 | public void Close() | ||
72 | { | ||
73 | // m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: CLOSED MODULE"); | ||
74 | } | ||
75 | |||
76 | public void AddRegion(Scene scene) | ||
77 | { | ||
78 | // m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); | ||
79 | } | ||
80 | |||
81 | public void RemoveRegion(Scene scene) | ||
82 | { | ||
83 | // m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); | ||
84 | |||
85 | lock (m_scenes) | ||
86 | m_scenes.Remove(scene); | ||
87 | } | ||
88 | |||
89 | public void RegionLoaded(Scene scene) | ||
90 | { | ||
91 | // m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | ||
92 | |||
93 | lock (m_scenes) | ||
94 | m_scenes.Add(scene); | ||
95 | |||
96 | scene.AddCommand( | ||
97 | "Users", this, "attachments show", | ||
98 | "attachments show [<first-name> <last-name>]", | ||
99 | "Show attachment information for avatars in this simulator.", | ||
100 | HandleShowAttachmentsCommand); | ||
101 | } | ||
102 | |||
103 | protected void HandleShowAttachmentsCommand(string module, string[] cmd) | ||
104 | { | ||
105 | if (cmd.Length != 2 && cmd.Length < 4) | ||
106 | { | ||
107 | MainConsole.Instance.OutputFormat("Usage: attachments show [<first-name> <last-name>]"); | ||
108 | return; | ||
109 | } | ||
110 | |||
111 | bool targetNameSupplied = false; | ||
112 | string optionalTargetFirstName = null; | ||
113 | string optionalTargetLastName = null; | ||
114 | |||
115 | if (cmd.Length >= 4) | ||
116 | { | ||
117 | targetNameSupplied = true; | ||
118 | optionalTargetFirstName = cmd[2]; | ||
119 | optionalTargetLastName = cmd[3]; | ||
120 | } | ||
121 | |||
122 | StringBuilder sb = new StringBuilder(); | ||
123 | |||
124 | lock (m_scenes) | ||
125 | { | ||
126 | foreach (Scene scene in m_scenes) | ||
127 | { | ||
128 | if (targetNameSupplied) | ||
129 | { | ||
130 | ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName); | ||
131 | if (sp != null && !sp.IsChildAgent) | ||
132 | GetAttachmentsReport(sp, sb); | ||
133 | } | ||
134 | else | ||
135 | { | ||
136 | scene.ForEachRootScenePresence(sp => GetAttachmentsReport(sp, sb)); | ||
137 | } | ||
138 | } | ||
139 | } | ||
140 | |||
141 | MainConsole.Instance.Output(sb.ToString()); | ||
142 | } | ||
143 | |||
144 | private void GetAttachmentsReport(ScenePresence sp, StringBuilder sb) | ||
145 | { | ||
146 | sb.AppendFormat("Attachments for {0}\n", sp.Name); | ||
147 | |||
148 | ConsoleTable ct = new ConsoleTable() { Indent = 2 }; | ||
149 | ct.Columns.Add(new ConsoleTableColumn("Attachment Name", 36)); | ||
150 | ct.Columns.Add(new ConsoleTableColumn("Local ID", 10)); | ||
151 | ct.Columns.Add(new ConsoleTableColumn("Item ID", 36)); | ||
152 | ct.Columns.Add(new ConsoleTableColumn("Attach Point", 14)); | ||
153 | ct.Columns.Add(new ConsoleTableColumn("Position", 15)); | ||
154 | |||
155 | // sb.AppendFormat( | ||
156 | // " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n", | ||
157 | // "Attachment Name", "Local ID", "Item ID", "Attach Point", "Position"); | ||
158 | |||
159 | List<SceneObjectGroup> attachmentObjects = sp.GetAttachments(); | ||
160 | foreach (SceneObjectGroup attachmentObject in attachmentObjects) | ||
161 | { | ||
162 | // InventoryItemBase attachmentItem | ||
163 | // = m_scenes[0].InventoryService.GetItem(new InventoryItemBase(attachmentObject.FromItemID)); | ||
164 | |||
165 | // if (attachmentItem == null) | ||
166 | // { | ||
167 | // sb.AppendFormat( | ||
168 | // "WARNING: Couldn't find attachment for item {0} at point {1}\n", | ||
169 | // attachmentData.ItemID, (AttachmentPoint)attachmentData.AttachPoint); | ||
170 | // continue; | ||
171 | // } | ||
172 | // else | ||
173 | // { | ||
174 | // sb.AppendFormat( | ||
175 | // " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n", | ||
176 | // attachmentObject.Name, attachmentObject.LocalId, attachmentObject.FromItemID, | ||
177 | // (AttachmentPoint)attachmentObject.AttachmentPoint, attachmentObject.RootPart.AttachedPos); | ||
178 | ct.Rows.Add( | ||
179 | new ConsoleTableRow( | ||
180 | new List<string>() | ||
181 | { | ||
182 | attachmentObject.Name, | ||
183 | attachmentObject.LocalId.ToString(), | ||
184 | attachmentObject.FromItemID.ToString(), | ||
185 | ((AttachmentPoint)attachmentObject.AttachmentPoint).ToString(), | ||
186 | attachmentObject.RootPart.AttachedPos.ToString() | ||
187 | })); | ||
188 | // } | ||
189 | } | ||
190 | |||
191 | ct.AddToStringBuilder(sb); | ||
192 | sb.Append("\n"); | ||
193 | } | ||
194 | } | ||
195 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs index e68f9d0..2602050 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs | |||
@@ -58,6 +58,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends | |||
58 | private Scene m_scene; | 58 | private Scene m_scene; |
59 | private IFriendsModule m_friendsModule; | 59 | private IFriendsModule m_friendsModule; |
60 | private IUserManagement m_userManagementModule; | 60 | private IUserManagement m_userManagementModule; |
61 | private IPresenceService m_presenceService; | ||
61 | 62 | ||
62 | // private IAvatarFactoryModule m_avatarFactory; | 63 | // private IAvatarFactoryModule m_avatarFactory; |
63 | 64 | ||
@@ -99,8 +100,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends | |||
99 | 100 | ||
100 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | 101 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); |
101 | m_userManagementModule = m_scene.RequestModuleInterface<IUserManagement>(); | 102 | m_userManagementModule = m_scene.RequestModuleInterface<IUserManagement>(); |
103 | m_presenceService = m_scene.RequestModuleInterface<IPresenceService>(); | ||
102 | 104 | ||
103 | if (m_friendsModule != null && m_userManagementModule != null) | 105 | if (m_friendsModule != null && m_userManagementModule != null && m_presenceService != null) |
104 | { | 106 | { |
105 | m_scene.AddCommand( | 107 | m_scene.AddCommand( |
106 | "Friends", this, "friends show", | 108 | "Friends", this, "friends show", |
@@ -162,7 +164,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends | |||
162 | 164 | ||
163 | MainConsole.Instance.OutputFormat("Friends for {0} {1} {2}:", firstName, lastName, userId); | 165 | MainConsole.Instance.OutputFormat("Friends for {0} {1} {2}:", firstName, lastName, userId); |
164 | 166 | ||
165 | MainConsole.Instance.OutputFormat("UUID, Name, MyFlags, TheirFlags"); | 167 | MainConsole.Instance.OutputFormat( |
168 | "{0,-36} {1,-36} {2,-7} {3,7} {4,10}", "UUID", "Name", "Status", "MyFlags", "TheirFlags"); | ||
166 | 169 | ||
167 | foreach (FriendInfo friend in friends) | 170 | foreach (FriendInfo friend in friends) |
168 | { | 171 | { |
@@ -175,14 +178,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends | |||
175 | 178 | ||
176 | UUID friendId; | 179 | UUID friendId; |
177 | string friendName; | 180 | string friendName; |
181 | string onlineText; | ||
178 | 182 | ||
179 | if (UUID.TryParse(friend.Friend, out friendId)) | 183 | if (UUID.TryParse(friend.Friend, out friendId)) |
180 | friendName = m_userManagementModule.GetUserName(friendId); | 184 | friendName = m_userManagementModule.GetUserName(friendId); |
181 | else | 185 | else |
182 | friendName = friend.Friend; | 186 | friendName = friend.Friend; |
183 | 187 | ||
188 | OpenSim.Services.Interfaces.PresenceInfo[] pi = m_presenceService.GetAgents(new string[] { friend.Friend }); | ||
189 | if (pi.Length > 0) | ||
190 | onlineText = "online"; | ||
191 | else | ||
192 | onlineText = "offline"; | ||
193 | |||
184 | MainConsole.Instance.OutputFormat( | 194 | MainConsole.Instance.OutputFormat( |
185 | "{0} {1} {2} {3}", friend.Friend, friendName, friend.MyFlags, friend.TheirFlags); | 195 | "{0,-36} {1,-36} {2,-7} {3,-7} {4,-10}", |
196 | friend.Friend, friendName, onlineText, friend.MyFlags, friend.TheirFlags); | ||
186 | } | 197 | } |
187 | } | 198 | } |
188 | } | 199 | } |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 8af3652..6c53d95 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | |||
@@ -306,30 +306,35 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
306 | agentID, caps, scene.RegionInfo.RegionName); | 306 | agentID, caps, scene.RegionInfo.RegionName); |
307 | 307 | ||
308 | string capsBase = "/CAPS/" + caps.CapsObjectPath; | 308 | string capsBase = "/CAPS/" + caps.CapsObjectPath; |
309 | caps.RegisterHandler("ProvisionVoiceAccountRequest", | 309 | caps.RegisterHandler( |
310 | new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath, | 310 | "ProvisionVoiceAccountRequest", |
311 | delegate(string request, string path, string param, | 311 | new RestStreamHandler( |
312 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 312 | "POST", |
313 | { | 313 | capsBase + m_provisionVoiceAccountRequestPath, |
314 | return ProvisionVoiceAccountRequest(scene, request, path, param, | 314 | (request, path, param, httpRequest, httpResponse) |
315 | agentID, caps); | 315 | => ProvisionVoiceAccountRequest(scene, request, path, param, agentID, caps), |
316 | })); | 316 | "ProvisionVoiceAccountRequest", |
317 | caps.RegisterHandler("ParcelVoiceInfoRequest", | 317 | agentID.ToString())); |
318 | new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath, | 318 | |
319 | delegate(string request, string path, string param, | 319 | caps.RegisterHandler( |
320 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 320 | "ParcelVoiceInfoRequest", |
321 | { | 321 | new RestStreamHandler( |
322 | return ParcelVoiceInfoRequest(scene, request, path, param, | 322 | "POST", |
323 | agentID, caps); | 323 | capsBase + m_parcelVoiceInfoRequestPath, |
324 | })); | 324 | (request, path, param, httpRequest, httpResponse) |
325 | caps.RegisterHandler("ChatSessionRequest", | 325 | => ParcelVoiceInfoRequest(scene, request, path, param, agentID, caps), |
326 | new RestStreamHandler("POST", capsBase + m_chatSessionRequestPath, | 326 | "ParcelVoiceInfoRequest", |
327 | delegate(string request, string path, string param, | 327 | agentID.ToString())); |
328 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 328 | |
329 | { | 329 | caps.RegisterHandler( |
330 | return ChatSessionRequest(scene, request, path, param, | 330 | "ChatSessionRequest", |
331 | agentID, caps); | 331 | new RestStreamHandler( |
332 | })); | 332 | "POST", |
333 | capsBase + m_chatSessionRequestPath, | ||
334 | (request, path, param, httpRequest, httpResponse) | ||
335 | => ChatSessionRequest(scene, request, path, param, agentID, caps), | ||
336 | "ChatSessionRequest", | ||
337 | agentID.ToString())); | ||
333 | } | 338 | } |
334 | 339 | ||
335 | /// <summary> | 340 | /// <summary> |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index 4dbac1d..396d4c5 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs | |||
@@ -406,30 +406,36 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
406 | m_log.DebugFormat("[VivoxVoice] OnRegisterCaps: agentID {0} caps {1}", agentID, caps); | 406 | m_log.DebugFormat("[VivoxVoice] OnRegisterCaps: agentID {0} caps {1}", agentID, caps); |
407 | 407 | ||
408 | string capsBase = "/CAPS/" + caps.CapsObjectPath; | 408 | string capsBase = "/CAPS/" + caps.CapsObjectPath; |
409 | caps.RegisterHandler("ProvisionVoiceAccountRequest", | 409 | |
410 | new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath, | 410 | caps.RegisterHandler( |
411 | delegate(string request, string path, string param, | 411 | "ProvisionVoiceAccountRequest", |
412 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 412 | new RestStreamHandler( |
413 | { | 413 | "POST", |
414 | return ProvisionVoiceAccountRequest(scene, request, path, param, | 414 | capsBase + m_provisionVoiceAccountRequestPath, |
415 | agentID, caps); | 415 | (request, path, param, httpRequest, httpResponse) |
416 | })); | 416 | => ProvisionVoiceAccountRequest(scene, request, path, param, agentID, caps), |
417 | caps.RegisterHandler("ParcelVoiceInfoRequest", | 417 | "ProvisionVoiceAccountRequest", |
418 | new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath, | 418 | agentID.ToString())); |
419 | delegate(string request, string path, string param, | 419 | |
420 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 420 | caps.RegisterHandler( |
421 | { | 421 | "ParcelVoiceInfoRequest", |
422 | return ParcelVoiceInfoRequest(scene, request, path, param, | 422 | new RestStreamHandler( |
423 | agentID, caps); | 423 | "POST", |
424 | })); | 424 | capsBase + m_parcelVoiceInfoRequestPath, |
425 | caps.RegisterHandler("ChatSessionRequest", | 425 | (request, path, param, httpRequest, httpResponse) |
426 | new RestStreamHandler("POST", capsBase + m_chatSessionRequestPath, | 426 | => ParcelVoiceInfoRequest(scene, request, path, param, agentID, caps), |
427 | delegate(string request, string path, string param, | 427 | "ParcelVoiceInfoRequest", |
428 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 428 | agentID.ToString())); |
429 | { | 429 | |
430 | return ChatSessionRequest(scene, request, path, param, | 430 | caps.RegisterHandler( |
431 | agentID, caps); | 431 | "ChatSessionRequest", |
432 | })); | 432 | new RestStreamHandler( |
433 | "POST", | ||
434 | capsBase + m_chatSessionRequestPath, | ||
435 | (request, path, param, httpRequest, httpResponse) | ||
436 | => ChatSessionRequest(scene, request, path, param, agentID, caps), | ||
437 | "ChatSessionRequest", | ||
438 | agentID.ToString())); | ||
433 | } | 439 | } |
434 | 440 | ||
435 | /// <summary> | 441 | /// <summary> |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs index 130513d..5d57f70 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs | |||
@@ -1401,9 +1401,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1401 | { | 1401 | { |
1402 | response = WebUtil.PostToService(m_groupsServerURI, requestArgs); | 1402 | response = WebUtil.PostToService(m_groupsServerURI, requestArgs); |
1403 | } | 1403 | } |
1404 | catch (Exception e) | 1404 | catch (Exception) |
1405 | { | 1405 | { |
1406 | m_log.InfoFormat("[SIMIAN GROUPS CONNECTOR] request failed {0}",CacheKey); | 1406 | m_log.ErrorFormat("[SIMIAN GROUPS CONNECTOR]: request failed {0}", CacheKey); |
1407 | } | 1407 | } |
1408 | 1408 | ||
1409 | // and cache the response | 1409 | // and cache the response |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs index d2f6327..ac638f1 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests | |||
50 | TestHelpers.InMethod(); | 50 | TestHelpers.InMethod(); |
51 | // log4net.Config.XmlConfigurator.Configure(); | 51 | // log4net.Config.XmlConfigurator.Configure(); |
52 | 52 | ||
53 | TestScene scene = SceneHelpers.SetupScene(); | 53 | TestScene scene = new SceneHelpers().SetupScene(); |
54 | IConfigSource configSource = new IniConfigSource(); | 54 | IConfigSource configSource = new IniConfigSource(); |
55 | IConfig config = configSource.AddConfig("Groups"); | 55 | IConfig config = configSource.AddConfig("Groups"); |
56 | config.Set("Enabled", true); | 56 | config.Set("Enabled", true); |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs new file mode 100644 index 0000000..34894ba --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs | |||
@@ -0,0 +1,500 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors | ||
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 OpenSim 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 | using Mono.Addins; | ||
28 | |||
29 | using System; | ||
30 | using System.Reflection; | ||
31 | using System.Threading; | ||
32 | using System.Text; | ||
33 | using System.Net; | ||
34 | using System.Net.Sockets; | ||
35 | using log4net; | ||
36 | using Nini.Config; | ||
37 | using OpenMetaverse; | ||
38 | using OpenMetaverse.StructuredData; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Region.Framework.Interfaces; | ||
41 | using OpenSim.Region.Framework.Scenes; | ||
42 | using System.Collections.Generic; | ||
43 | using System.Text.RegularExpressions; | ||
44 | |||
45 | namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | ||
46 | { | ||
47 | public class JsonStore | ||
48 | { | ||
49 | private static readonly ILog m_log = | ||
50 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
51 | |||
52 | private OSD m_ValueStore; | ||
53 | |||
54 | protected class TakeValueCallbackClass | ||
55 | { | ||
56 | public string Path { get; set; } | ||
57 | public bool UseJson { get; set; } | ||
58 | public TakeValueCallback Callback { get; set; } | ||
59 | |||
60 | public TakeValueCallbackClass(string spath, bool usejson, TakeValueCallback cback) | ||
61 | { | ||
62 | Path = spath; | ||
63 | UseJson = usejson; | ||
64 | Callback = cback; | ||
65 | } | ||
66 | } | ||
67 | |||
68 | protected List<TakeValueCallbackClass> m_TakeStore; | ||
69 | protected List<TakeValueCallbackClass> m_ReadStore; | ||
70 | |||
71 | |||
72 | // ----------------------------------------------------------------- | ||
73 | /// <summary> | ||
74 | /// | ||
75 | /// </summary> | ||
76 | // ----------------------------------------------------------------- | ||
77 | public JsonStore() : this("") {} | ||
78 | |||
79 | public JsonStore(string value) | ||
80 | { | ||
81 | m_TakeStore = new List<TakeValueCallbackClass>(); | ||
82 | m_ReadStore = new List<TakeValueCallbackClass>(); | ||
83 | |||
84 | if (String.IsNullOrEmpty(value)) | ||
85 | m_ValueStore = new OSDMap(); | ||
86 | else | ||
87 | m_ValueStore = OSDParser.DeserializeJson(value); | ||
88 | } | ||
89 | |||
90 | // ----------------------------------------------------------------- | ||
91 | /// <summary> | ||
92 | /// | ||
93 | /// </summary> | ||
94 | // ----------------------------------------------------------------- | ||
95 | public bool TestPath(string expr, bool useJson) | ||
96 | { | ||
97 | Stack<string> path = ParsePathExpression(expr); | ||
98 | OSD result = ProcessPathExpression(m_ValueStore,path); | ||
99 | |||
100 | if (result == null) | ||
101 | return false; | ||
102 | |||
103 | if (useJson || result.Type == OSDType.String) | ||
104 | return true; | ||
105 | |||
106 | return false; | ||
107 | } | ||
108 | |||
109 | // ----------------------------------------------------------------- | ||
110 | /// <summary> | ||
111 | /// | ||
112 | /// </summary> | ||
113 | // ----------------------------------------------------------------- | ||
114 | public bool GetValue(string expr, out string value, bool useJson) | ||
115 | { | ||
116 | Stack<string> path = ParsePathExpression(expr); | ||
117 | OSD result = ProcessPathExpression(m_ValueStore,path); | ||
118 | return ConvertOutputValue(result,out value,useJson); | ||
119 | } | ||
120 | |||
121 | |||
122 | // ----------------------------------------------------------------- | ||
123 | /// <summary> | ||
124 | /// | ||
125 | /// </summary> | ||
126 | // ----------------------------------------------------------------- | ||
127 | public bool RemoveValue(string expr) | ||
128 | { | ||
129 | return SetValueFromExpression(expr,null); | ||
130 | } | ||
131 | |||
132 | // ----------------------------------------------------------------- | ||
133 | /// <summary> | ||
134 | /// | ||
135 | /// </summary> | ||
136 | // ----------------------------------------------------------------- | ||
137 | public bool SetValue(string expr, string value, bool useJson) | ||
138 | { | ||
139 | OSD ovalue = useJson ? OSDParser.DeserializeJson(value) : new OSDString(value); | ||
140 | return SetValueFromExpression(expr,ovalue); | ||
141 | } | ||
142 | |||
143 | // ----------------------------------------------------------------- | ||
144 | /// <summary> | ||
145 | /// | ||
146 | /// </summary> | ||
147 | // ----------------------------------------------------------------- | ||
148 | public bool TakeValue(string expr, bool useJson, TakeValueCallback cback) | ||
149 | { | ||
150 | Stack<string> path = ParsePathExpression(expr); | ||
151 | string pexpr = PathExpressionToKey(path); | ||
152 | |||
153 | OSD result = ProcessPathExpression(m_ValueStore,path); | ||
154 | if (result == null) | ||
155 | { | ||
156 | m_TakeStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); | ||
157 | return false; | ||
158 | } | ||
159 | |||
160 | string value = String.Empty; | ||
161 | if (! ConvertOutputValue(result,out value,useJson)) | ||
162 | { | ||
163 | // the structure does not match the request so i guess we'll wait | ||
164 | m_TakeStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); | ||
165 | return false; | ||
166 | } | ||
167 | |||
168 | SetValueFromExpression(expr,null); | ||
169 | cback(value); | ||
170 | |||
171 | return true; | ||
172 | } | ||
173 | |||
174 | // ----------------------------------------------------------------- | ||
175 | /// <summary> | ||
176 | /// | ||
177 | /// </summary> | ||
178 | // ----------------------------------------------------------------- | ||
179 | public bool ReadValue(string expr, bool useJson, TakeValueCallback cback) | ||
180 | { | ||
181 | Stack<string> path = ParsePathExpression(expr); | ||
182 | string pexpr = PathExpressionToKey(path); | ||
183 | |||
184 | OSD result = ProcessPathExpression(m_ValueStore,path); | ||
185 | if (result == null) | ||
186 | { | ||
187 | m_ReadStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); | ||
188 | return false; | ||
189 | } | ||
190 | |||
191 | string value = String.Empty; | ||
192 | if (! ConvertOutputValue(result,out value,useJson)) | ||
193 | { | ||
194 | // the structure does not match the request so i guess we'll wait | ||
195 | m_ReadStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); | ||
196 | return false; | ||
197 | } | ||
198 | |||
199 | cback(value); | ||
200 | |||
201 | return true; | ||
202 | } | ||
203 | |||
204 | // ----------------------------------------------------------------- | ||
205 | /// <summary> | ||
206 | /// | ||
207 | /// </summary> | ||
208 | // ----------------------------------------------------------------- | ||
209 | protected bool SetValueFromExpression(string expr, OSD ovalue) | ||
210 | { | ||
211 | Stack<string> path = ParsePathExpression(expr); | ||
212 | if (path.Count == 0) | ||
213 | { | ||
214 | m_ValueStore = ovalue; | ||
215 | return true; | ||
216 | } | ||
217 | |||
218 | string pkey = path.Pop(); | ||
219 | string pexpr = PathExpressionToKey(path); | ||
220 | if (pexpr != "") | ||
221 | pexpr += "."; | ||
222 | |||
223 | OSD result = ProcessPathExpression(m_ValueStore,path); | ||
224 | if (result == null) | ||
225 | return false; | ||
226 | |||
227 | Regex aPattern = new Regex("\\[([0-9]+|\\+)\\]"); | ||
228 | MatchCollection amatches = aPattern.Matches(pkey,0); | ||
229 | |||
230 | if (amatches.Count > 0) | ||
231 | { | ||
232 | if (result.Type != OSDType.Array) | ||
233 | return false; | ||
234 | |||
235 | OSDArray amap = result as OSDArray; | ||
236 | |||
237 | Match match = amatches[0]; | ||
238 | GroupCollection groups = match.Groups; | ||
239 | string akey = groups[1].Value; | ||
240 | |||
241 | if (akey == "+") | ||
242 | { | ||
243 | string npkey = String.Format("[{0}]",amap.Count); | ||
244 | |||
245 | amap.Add(ovalue); | ||
246 | InvokeNextCallback(pexpr + npkey); | ||
247 | return true; | ||
248 | } | ||
249 | |||
250 | int aval = Convert.ToInt32(akey); | ||
251 | if (0 <= aval && aval < amap.Count) | ||
252 | { | ||
253 | if (ovalue == null) | ||
254 | amap.RemoveAt(aval); | ||
255 | else | ||
256 | { | ||
257 | amap[aval] = ovalue; | ||
258 | InvokeNextCallback(pexpr + pkey); | ||
259 | } | ||
260 | return true; | ||
261 | } | ||
262 | |||
263 | return false; | ||
264 | } | ||
265 | |||
266 | Regex hPattern = new Regex("{([^}]+)}"); | ||
267 | MatchCollection hmatches = hPattern.Matches(pkey,0); | ||
268 | |||
269 | if (hmatches.Count > 0) | ||
270 | { | ||
271 | Match match = hmatches[0]; | ||
272 | GroupCollection groups = match.Groups; | ||
273 | string hkey = groups[1].Value; | ||
274 | |||
275 | if (result is OSDMap) | ||
276 | { | ||
277 | OSDMap hmap = result as OSDMap; | ||
278 | if (ovalue != null) | ||
279 | { | ||
280 | hmap[hkey] = ovalue; | ||
281 | InvokeNextCallback(pexpr + pkey); | ||
282 | } | ||
283 | else if (hmap.ContainsKey(hkey)) | ||
284 | hmap.Remove(hkey); | ||
285 | |||
286 | return true; | ||
287 | } | ||
288 | |||
289 | return false; | ||
290 | } | ||
291 | |||
292 | // Shouldn't get here if the path was checked correctly | ||
293 | m_log.WarnFormat("[JsonStore] invalid path expression"); | ||
294 | return false; | ||
295 | } | ||
296 | |||
297 | // ----------------------------------------------------------------- | ||
298 | /// <summary> | ||
299 | /// | ||
300 | /// </summary> | ||
301 | // ----------------------------------------------------------------- | ||
302 | protected bool InvokeNextCallback(string pexpr) | ||
303 | { | ||
304 | // Process all of the reads that match the expression first | ||
305 | List<TakeValueCallbackClass> reads = | ||
306 | m_ReadStore.FindAll(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); }); | ||
307 | |||
308 | foreach (TakeValueCallbackClass readcb in reads) | ||
309 | { | ||
310 | m_ReadStore.Remove(readcb); | ||
311 | ReadValue(readcb.Path,readcb.UseJson,readcb.Callback); | ||
312 | } | ||
313 | |||
314 | // Process one take next | ||
315 | TakeValueCallbackClass takecb = | ||
316 | m_TakeStore.Find(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); }); | ||
317 | |||
318 | if (takecb != null) | ||
319 | { | ||
320 | m_TakeStore.Remove(takecb); | ||
321 | TakeValue(takecb.Path,takecb.UseJson,takecb.Callback); | ||
322 | |||
323 | return true; | ||
324 | } | ||
325 | |||
326 | return false; | ||
327 | } | ||
328 | |||
329 | // ----------------------------------------------------------------- | ||
330 | /// <summary> | ||
331 | /// Parse the path expression and put the components into a stack. We | ||
332 | /// use a stack because we process the path in inverse order later | ||
333 | /// </summary> | ||
334 | // ----------------------------------------------------------------- | ||
335 | protected static Stack<string> ParsePathExpression(string path) | ||
336 | { | ||
337 | Stack<string> m_path = new Stack<string>(); | ||
338 | |||
339 | // add front and rear separators | ||
340 | path = "." + path + "."; | ||
341 | |||
342 | // add separators for quoted paths | ||
343 | Regex pass1 = new Regex("{[^}]+}"); | ||
344 | path = pass1.Replace(path,".$0.",-1,0); | ||
345 | |||
346 | // add separators for array references | ||
347 | Regex pass2 = new Regex("(\\[[0-9]+\\]|\\[\\+\\])"); | ||
348 | path = pass2.Replace(path,".$0.",-1,0); | ||
349 | |||
350 | // add quotes to bare identifier | ||
351 | Regex pass3 = new Regex("\\.([a-zA-Z]+)"); | ||
352 | path = pass3.Replace(path,".{$1}",-1,0); | ||
353 | |||
354 | // remove extra separators | ||
355 | Regex pass4 = new Regex("\\.+"); | ||
356 | path = pass4.Replace(path,".",-1,0); | ||
357 | |||
358 | Regex validate = new Regex("^\\.(({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])\\.)+$"); | ||
359 | if (validate.IsMatch(path)) | ||
360 | { | ||
361 | Regex parser = new Regex("\\.({[^}]+}|\\[[0-9]+\\]|\\[\\+\\]+)"); | ||
362 | MatchCollection matches = parser.Matches(path,0); | ||
363 | foreach (Match match in matches) | ||
364 | m_path.Push(match.Groups[1].Value); | ||
365 | } | ||
366 | |||
367 | return m_path; | ||
368 | } | ||
369 | |||
370 | // ----------------------------------------------------------------- | ||
371 | /// <summary> | ||
372 | /// | ||
373 | /// </summary> | ||
374 | /// <param>path is a stack where the top level of the path is at the bottom of the stack</param> | ||
375 | // ----------------------------------------------------------------- | ||
376 | protected static OSD ProcessPathExpression(OSD map, Stack<string> path) | ||
377 | { | ||
378 | if (path.Count == 0) | ||
379 | return map; | ||
380 | |||
381 | string pkey = path.Pop(); | ||
382 | |||
383 | OSD rmap = ProcessPathExpression(map,path); | ||
384 | if (rmap == null) | ||
385 | return null; | ||
386 | |||
387 | // ---------- Check for an array index ---------- | ||
388 | Regex aPattern = new Regex("\\[([0-9]+)\\]"); | ||
389 | MatchCollection amatches = aPattern.Matches(pkey,0); | ||
390 | |||
391 | if (amatches.Count > 0) | ||
392 | { | ||
393 | if (rmap.Type != OSDType.Array) | ||
394 | { | ||
395 | m_log.WarnFormat("[JsonStore] wrong type for key {2}, expecting {0}, got {1}",OSDType.Array,rmap.Type,pkey); | ||
396 | return null; | ||
397 | } | ||
398 | |||
399 | OSDArray amap = rmap as OSDArray; | ||
400 | |||
401 | Match match = amatches[0]; | ||
402 | GroupCollection groups = match.Groups; | ||
403 | string akey = groups[1].Value; | ||
404 | int aval = Convert.ToInt32(akey); | ||
405 | |||
406 | if (aval < amap.Count) | ||
407 | return (OSD) amap[aval]; | ||
408 | |||
409 | return null; | ||
410 | } | ||
411 | |||
412 | // ---------- Check for a hash index ---------- | ||
413 | Regex hPattern = new Regex("{([^}]+)}"); | ||
414 | MatchCollection hmatches = hPattern.Matches(pkey,0); | ||
415 | |||
416 | if (hmatches.Count > 0) | ||
417 | { | ||
418 | if (rmap.Type != OSDType.Map) | ||
419 | { | ||
420 | m_log.WarnFormat("[JsonStore] wrong type for key {2}, expecting {0}, got {1}",OSDType.Map,rmap.Type,pkey); | ||
421 | return null; | ||
422 | } | ||
423 | |||
424 | OSDMap hmap = rmap as OSDMap; | ||
425 | |||
426 | Match match = hmatches[0]; | ||
427 | GroupCollection groups = match.Groups; | ||
428 | string hkey = groups[1].Value; | ||
429 | |||
430 | if (hmap.ContainsKey(hkey)) | ||
431 | return (OSD) hmap[hkey]; | ||
432 | |||
433 | return null; | ||
434 | } | ||
435 | |||
436 | // Shouldn't get here if the path was checked correctly | ||
437 | m_log.WarnFormat("[JsonStore] Path type (unknown) does not match the structure"); | ||
438 | return null; | ||
439 | } | ||
440 | |||
441 | // ----------------------------------------------------------------- | ||
442 | /// <summary> | ||
443 | /// | ||
444 | /// </summary> | ||
445 | // ----------------------------------------------------------------- | ||
446 | protected static bool ConvertOutputValue(OSD result, out string value, bool useJson) | ||
447 | { | ||
448 | value = String.Empty; | ||
449 | |||
450 | // If we couldn't process the path | ||
451 | if (result == null) | ||
452 | return false; | ||
453 | |||
454 | if (useJson) | ||
455 | { | ||
456 | // The path pointed to an intermediate hash structure | ||
457 | if (result.Type == OSDType.Map) | ||
458 | { | ||
459 | value = OSDParser.SerializeJsonString(result as OSDMap); | ||
460 | return true; | ||
461 | } | ||
462 | |||
463 | // The path pointed to an intermediate hash structure | ||
464 | if (result.Type == OSDType.Array) | ||
465 | { | ||
466 | value = OSDParser.SerializeJsonString(result as OSDArray); | ||
467 | return true; | ||
468 | } | ||
469 | |||
470 | value = "'" + result.AsString() + "'"; | ||
471 | return true; | ||
472 | } | ||
473 | |||
474 | if (result.Type == OSDType.String) | ||
475 | { | ||
476 | value = result.AsString(); | ||
477 | return true; | ||
478 | } | ||
479 | |||
480 | return false; | ||
481 | } | ||
482 | |||
483 | // ----------------------------------------------------------------- | ||
484 | /// <summary> | ||
485 | /// | ||
486 | /// </summary> | ||
487 | // ----------------------------------------------------------------- | ||
488 | protected static string PathExpressionToKey(Stack<string> path) | ||
489 | { | ||
490 | if (path.Count == 0) | ||
491 | return ""; | ||
492 | |||
493 | string pkey = ""; | ||
494 | foreach (string k in path) | ||
495 | pkey = (pkey == "") ? k : (k + "." + pkey); | ||
496 | |||
497 | return pkey; | ||
498 | } | ||
499 | } | ||
500 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs new file mode 100644 index 0000000..311531c --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs | |||
@@ -0,0 +1,430 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors | ||
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 OpenSim 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 | using Mono.Addins; | ||
28 | |||
29 | using System; | ||
30 | using System.Reflection; | ||
31 | using System.Threading; | ||
32 | using System.Text; | ||
33 | using System.Net; | ||
34 | using System.Net.Sockets; | ||
35 | using log4net; | ||
36 | using Nini.Config; | ||
37 | using OpenMetaverse; | ||
38 | using OpenMetaverse.StructuredData; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Region.Framework.Interfaces; | ||
41 | using OpenSim.Region.Framework.Scenes; | ||
42 | using System.Collections.Generic; | ||
43 | using System.Text.RegularExpressions; | ||
44 | |||
45 | |||
46 | namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | ||
47 | { | ||
48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "JsonStoreModule")] | ||
49 | |||
50 | public class JsonStoreModule : INonSharedRegionModule, IJsonStoreModule | ||
51 | { | ||
52 | private static readonly ILog m_log = | ||
53 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
54 | |||
55 | private IConfig m_config = null; | ||
56 | private bool m_enabled = false; | ||
57 | private Scene m_scene = null; | ||
58 | |||
59 | private Dictionary<UUID,JsonStore> m_JsonValueStore; | ||
60 | private UUID m_sharedStore; | ||
61 | |||
62 | #region IRegionModule Members | ||
63 | |||
64 | // ----------------------------------------------------------------- | ||
65 | /// <summary> | ||
66 | /// Name of this shared module is it's class name | ||
67 | /// </summary> | ||
68 | // ----------------------------------------------------------------- | ||
69 | public string Name | ||
70 | { | ||
71 | get { return this.GetType().Name; } | ||
72 | } | ||
73 | |||
74 | // ----------------------------------------------------------------- | ||
75 | /// <summary> | ||
76 | /// Initialise this shared module | ||
77 | /// </summary> | ||
78 | /// <param name="scene">this region is getting initialised</param> | ||
79 | /// <param name="source">nini config, we are not using this</param> | ||
80 | // ----------------------------------------------------------------- | ||
81 | public void Initialise(IConfigSource config) | ||
82 | { | ||
83 | try | ||
84 | { | ||
85 | if ((m_config = config.Configs["JsonStore"]) == null) | ||
86 | { | ||
87 | // There is no configuration, the module is disabled | ||
88 | // m_log.InfoFormat("[JsonStore] no configuration info"); | ||
89 | return; | ||
90 | } | ||
91 | |||
92 | m_enabled = m_config.GetBoolean("Enabled", m_enabled); | ||
93 | } | ||
94 | catch (Exception e) | ||
95 | { | ||
96 | m_log.ErrorFormat("[JsonStore] initialization error: {0}",e.Message); | ||
97 | return; | ||
98 | } | ||
99 | |||
100 | if (m_enabled) | ||
101 | m_log.DebugFormat("[JsonStore] module is enabled"); | ||
102 | } | ||
103 | |||
104 | // ----------------------------------------------------------------- | ||
105 | /// <summary> | ||
106 | /// everything is loaded, perform post load configuration | ||
107 | /// </summary> | ||
108 | // ----------------------------------------------------------------- | ||
109 | public void PostInitialise() | ||
110 | { | ||
111 | } | ||
112 | |||
113 | // ----------------------------------------------------------------- | ||
114 | /// <summary> | ||
115 | /// Nothing to do on close | ||
116 | /// </summary> | ||
117 | // ----------------------------------------------------------------- | ||
118 | public void Close() | ||
119 | { | ||
120 | } | ||
121 | |||
122 | // ----------------------------------------------------------------- | ||
123 | /// <summary> | ||
124 | /// </summary> | ||
125 | // ----------------------------------------------------------------- | ||
126 | public void AddRegion(Scene scene) | ||
127 | { | ||
128 | if (m_enabled) | ||
129 | { | ||
130 | m_scene = scene; | ||
131 | m_scene.RegisterModuleInterface<IJsonStoreModule>(this); | ||
132 | |||
133 | m_sharedStore = UUID.Zero; | ||
134 | m_JsonValueStore = new Dictionary<UUID,JsonStore>(); | ||
135 | m_JsonValueStore.Add(m_sharedStore,new JsonStore("")); | ||
136 | } | ||
137 | } | ||
138 | |||
139 | // ----------------------------------------------------------------- | ||
140 | /// <summary> | ||
141 | /// </summary> | ||
142 | // ----------------------------------------------------------------- | ||
143 | public void RemoveRegion(Scene scene) | ||
144 | { | ||
145 | // need to remove all references to the scene in the subscription | ||
146 | // list to enable full garbage collection of the scene object | ||
147 | } | ||
148 | |||
149 | // ----------------------------------------------------------------- | ||
150 | /// <summary> | ||
151 | /// Called when all modules have been added for a region. This is | ||
152 | /// where we hook up events | ||
153 | /// </summary> | ||
154 | // ----------------------------------------------------------------- | ||
155 | public void RegionLoaded(Scene scene) | ||
156 | { | ||
157 | if (m_enabled) {} | ||
158 | } | ||
159 | |||
160 | /// ----------------------------------------------------------------- | ||
161 | /// <summary> | ||
162 | /// </summary> | ||
163 | // ----------------------------------------------------------------- | ||
164 | public Type ReplaceableInterface | ||
165 | { | ||
166 | get { return null; } | ||
167 | } | ||
168 | |||
169 | #endregion | ||
170 | |||
171 | #region ScriptInvocationInteface | ||
172 | |||
173 | // ----------------------------------------------------------------- | ||
174 | /// <summary> | ||
175 | /// | ||
176 | /// </summary> | ||
177 | // ----------------------------------------------------------------- | ||
178 | public bool CreateStore(string value, out UUID result) | ||
179 | { | ||
180 | result = UUID.Zero; | ||
181 | |||
182 | if (! m_enabled) return false; | ||
183 | |||
184 | UUID uuid = UUID.Random(); | ||
185 | JsonStore map = null; | ||
186 | |||
187 | try | ||
188 | { | ||
189 | map = new JsonStore(value); | ||
190 | } | ||
191 | catch (Exception e) | ||
192 | { | ||
193 | m_log.InfoFormat("[JsonStore] Unable to initialize store from {0}; {1}",value,e.Message); | ||
194 | return false; | ||
195 | } | ||
196 | |||
197 | lock (m_JsonValueStore) | ||
198 | m_JsonValueStore.Add(uuid,map); | ||
199 | |||
200 | result = uuid; | ||
201 | return true; | ||
202 | } | ||
203 | |||
204 | // ----------------------------------------------------------------- | ||
205 | /// <summary> | ||
206 | /// | ||
207 | /// </summary> | ||
208 | // ----------------------------------------------------------------- | ||
209 | public bool DestroyStore(UUID storeID) | ||
210 | { | ||
211 | if (! m_enabled) return false; | ||
212 | |||
213 | lock (m_JsonValueStore) | ||
214 | m_JsonValueStore.Remove(storeID); | ||
215 | |||
216 | return true; | ||
217 | } | ||
218 | |||
219 | // ----------------------------------------------------------------- | ||
220 | /// <summary> | ||
221 | /// | ||
222 | /// </summary> | ||
223 | // ----------------------------------------------------------------- | ||
224 | public bool TestPath(UUID storeID, string path, bool useJson) | ||
225 | { | ||
226 | if (! m_enabled) return false; | ||
227 | |||
228 | JsonStore map = null; | ||
229 | lock (m_JsonValueStore) | ||
230 | { | ||
231 | if (! m_JsonValueStore.TryGetValue(storeID,out map)) | ||
232 | { | ||
233 | m_log.InfoFormat("[JsonStore] Missing store {0}",storeID); | ||
234 | return true; | ||
235 | } | ||
236 | } | ||
237 | |||
238 | try | ||
239 | { | ||
240 | lock (map) | ||
241 | return map.TestPath(path,useJson); | ||
242 | } | ||
243 | catch (Exception e) | ||
244 | { | ||
245 | m_log.InfoFormat("[JsonStore] Path test failed for {0} in {1}; {2}",path,storeID,e.Message); | ||
246 | } | ||
247 | |||
248 | return false; | ||
249 | } | ||
250 | |||
251 | // ----------------------------------------------------------------- | ||
252 | /// <summary> | ||
253 | /// | ||
254 | /// </summary> | ||
255 | // ----------------------------------------------------------------- | ||
256 | public bool SetValue(UUID storeID, string path, string value, bool useJson) | ||
257 | { | ||
258 | if (! m_enabled) return false; | ||
259 | |||
260 | JsonStore map = null; | ||
261 | lock (m_JsonValueStore) | ||
262 | { | ||
263 | if (! m_JsonValueStore.TryGetValue(storeID,out map)) | ||
264 | { | ||
265 | m_log.InfoFormat("[JsonStore] Missing store {0}",storeID); | ||
266 | return false; | ||
267 | } | ||
268 | } | ||
269 | |||
270 | try | ||
271 | { | ||
272 | lock (map) | ||
273 | if (map.SetValue(path,value,useJson)) | ||
274 | return true; | ||
275 | } | ||
276 | catch (Exception e) | ||
277 | { | ||
278 | m_log.InfoFormat("[JsonStore] Unable to assign {0} to {1} in {2}; {3}",value,path,storeID,e.Message); | ||
279 | } | ||
280 | |||
281 | return false; | ||
282 | } | ||
283 | |||
284 | // ----------------------------------------------------------------- | ||
285 | /// <summary> | ||
286 | /// | ||
287 | /// </summary> | ||
288 | // ----------------------------------------------------------------- | ||
289 | public bool RemoveValue(UUID storeID, string path) | ||
290 | { | ||
291 | if (! m_enabled) return false; | ||
292 | |||
293 | JsonStore map = null; | ||
294 | lock (m_JsonValueStore) | ||
295 | { | ||
296 | if (! m_JsonValueStore.TryGetValue(storeID,out map)) | ||
297 | { | ||
298 | m_log.InfoFormat("[JsonStore] Missing store {0}",storeID); | ||
299 | return false; | ||
300 | } | ||
301 | } | ||
302 | |||
303 | try | ||
304 | { | ||
305 | lock (map) | ||
306 | if (map.RemoveValue(path)) | ||
307 | return true; | ||
308 | } | ||
309 | catch (Exception e) | ||
310 | { | ||
311 | m_log.InfoFormat("[JsonStore] Unable to remove {0} in {1}; {2}",path,storeID,e.Message); | ||
312 | } | ||
313 | |||
314 | return false; | ||
315 | } | ||
316 | |||
317 | // ----------------------------------------------------------------- | ||
318 | /// <summary> | ||
319 | /// | ||
320 | /// </summary> | ||
321 | // ----------------------------------------------------------------- | ||
322 | public bool GetValue(UUID storeID, string path, bool useJson, out string value) | ||
323 | { | ||
324 | value = String.Empty; | ||
325 | |||
326 | if (! m_enabled) return false; | ||
327 | |||
328 | JsonStore map = null; | ||
329 | lock (m_JsonValueStore) | ||
330 | { | ||
331 | if (! m_JsonValueStore.TryGetValue(storeID,out map)) | ||
332 | return false; | ||
333 | } | ||
334 | |||
335 | try | ||
336 | { | ||
337 | lock (map) | ||
338 | { | ||
339 | return map.GetValue(path, out value, useJson); | ||
340 | } | ||
341 | } | ||
342 | catch (Exception e) | ||
343 | { | ||
344 | m_log.InfoFormat("[JsonStore] unable to retrieve value; {0}",e.Message); | ||
345 | } | ||
346 | |||
347 | return false; | ||
348 | } | ||
349 | |||
350 | // ----------------------------------------------------------------- | ||
351 | /// <summary> | ||
352 | /// | ||
353 | /// </summary> | ||
354 | // ----------------------------------------------------------------- | ||
355 | public void TakeValue(UUID storeID, string path, bool useJson, TakeValueCallback cback) | ||
356 | { | ||
357 | if (! m_enabled) | ||
358 | { | ||
359 | cback(String.Empty); | ||
360 | return; | ||
361 | } | ||
362 | |||
363 | JsonStore map = null; | ||
364 | lock (m_JsonValueStore) | ||
365 | { | ||
366 | if (! m_JsonValueStore.TryGetValue(storeID,out map)) | ||
367 | { | ||
368 | cback(String.Empty); | ||
369 | return; | ||
370 | } | ||
371 | } | ||
372 | |||
373 | try | ||
374 | { | ||
375 | lock (map) | ||
376 | { | ||
377 | map.TakeValue(path, useJson, cback); | ||
378 | return; | ||
379 | } | ||
380 | } | ||
381 | catch (Exception e) | ||
382 | { | ||
383 | m_log.InfoFormat("[JsonStore] unable to retrieve value; {0}",e.ToString()); | ||
384 | } | ||
385 | |||
386 | cback(String.Empty); | ||
387 | } | ||
388 | |||
389 | // ----------------------------------------------------------------- | ||
390 | /// <summary> | ||
391 | /// | ||
392 | /// </summary> | ||
393 | // ----------------------------------------------------------------- | ||
394 | public void ReadValue(UUID storeID, string path, bool useJson, TakeValueCallback cback) | ||
395 | { | ||
396 | if (! m_enabled) | ||
397 | { | ||
398 | cback(String.Empty); | ||
399 | return; | ||
400 | } | ||
401 | |||
402 | JsonStore map = null; | ||
403 | lock (m_JsonValueStore) | ||
404 | { | ||
405 | if (! m_JsonValueStore.TryGetValue(storeID,out map)) | ||
406 | { | ||
407 | cback(String.Empty); | ||
408 | return; | ||
409 | } | ||
410 | } | ||
411 | |||
412 | try | ||
413 | { | ||
414 | lock (map) | ||
415 | { | ||
416 | map.ReadValue(path, useJson, cback); | ||
417 | return; | ||
418 | } | ||
419 | } | ||
420 | catch (Exception e) | ||
421 | { | ||
422 | m_log.InfoFormat("[JsonStore] unable to retrieve value; {0}",e.ToString()); | ||
423 | } | ||
424 | |||
425 | cback(String.Empty); | ||
426 | } | ||
427 | |||
428 | #endregion | ||
429 | } | ||
430 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs new file mode 100644 index 0000000..4949097 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs | |||
@@ -0,0 +1,499 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors | ||
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 OpenSim 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 | using Mono.Addins; | ||
28 | |||
29 | using System; | ||
30 | using System.Reflection; | ||
31 | using System.Threading; | ||
32 | using System.Text; | ||
33 | using System.Net; | ||
34 | using System.Net.Sockets; | ||
35 | using log4net; | ||
36 | using Nini.Config; | ||
37 | using OpenMetaverse; | ||
38 | using OpenMetaverse.StructuredData; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Region.Framework.Interfaces; | ||
41 | using OpenSim.Region.Framework.Scenes; | ||
42 | using System.Collections.Generic; | ||
43 | using System.Text.RegularExpressions; | ||
44 | |||
45 | namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | ||
46 | { | ||
47 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "JsonStoreScriptModule")] | ||
48 | |||
49 | public class JsonStoreScriptModule : INonSharedRegionModule | ||
50 | { | ||
51 | private static readonly ILog m_log = | ||
52 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
53 | |||
54 | private IConfig m_config = null; | ||
55 | private bool m_enabled = false; | ||
56 | private Scene m_scene = null; | ||
57 | |||
58 | private IScriptModuleComms m_comms; | ||
59 | private IJsonStoreModule m_store; | ||
60 | |||
61 | #region IRegionModule Members | ||
62 | |||
63 | // ----------------------------------------------------------------- | ||
64 | /// <summary> | ||
65 | /// Name of this shared module is it's class name | ||
66 | /// </summary> | ||
67 | // ----------------------------------------------------------------- | ||
68 | public string Name | ||
69 | { | ||
70 | get { return this.GetType().Name; } | ||
71 | } | ||
72 | |||
73 | // ----------------------------------------------------------------- | ||
74 | /// <summary> | ||
75 | /// Initialise this shared module | ||
76 | /// </summary> | ||
77 | /// <param name="scene">this region is getting initialised</param> | ||
78 | /// <param name="source">nini config, we are not using this</param> | ||
79 | // ----------------------------------------------------------------- | ||
80 | public void Initialise(IConfigSource config) | ||
81 | { | ||
82 | try | ||
83 | { | ||
84 | if ((m_config = config.Configs["JsonStore"]) == null) | ||
85 | { | ||
86 | // There is no configuration, the module is disabled | ||
87 | // m_log.InfoFormat("[JsonStoreScripts] no configuration info"); | ||
88 | return; | ||
89 | } | ||
90 | |||
91 | m_enabled = m_config.GetBoolean("Enabled", m_enabled); | ||
92 | } | ||
93 | catch (Exception e) | ||
94 | { | ||
95 | m_log.ErrorFormat("[JsonStoreScripts] initialization error: {0}",e.Message); | ||
96 | return; | ||
97 | } | ||
98 | |||
99 | if (m_enabled) | ||
100 | m_log.DebugFormat("[JsonStoreScripts] module is enabled"); | ||
101 | } | ||
102 | |||
103 | // ----------------------------------------------------------------- | ||
104 | /// <summary> | ||
105 | /// everything is loaded, perform post load configuration | ||
106 | /// </summary> | ||
107 | // ----------------------------------------------------------------- | ||
108 | public void PostInitialise() | ||
109 | { | ||
110 | } | ||
111 | |||
112 | // ----------------------------------------------------------------- | ||
113 | /// <summary> | ||
114 | /// Nothing to do on close | ||
115 | /// </summary> | ||
116 | // ----------------------------------------------------------------- | ||
117 | public void Close() | ||
118 | { | ||
119 | } | ||
120 | |||
121 | // ----------------------------------------------------------------- | ||
122 | /// <summary> | ||
123 | /// </summary> | ||
124 | // ----------------------------------------------------------------- | ||
125 | public void AddRegion(Scene scene) | ||
126 | { | ||
127 | } | ||
128 | |||
129 | // ----------------------------------------------------------------- | ||
130 | /// <summary> | ||
131 | /// </summary> | ||
132 | // ----------------------------------------------------------------- | ||
133 | public void RemoveRegion(Scene scene) | ||
134 | { | ||
135 | // need to remove all references to the scene in the subscription | ||
136 | // list to enable full garbage collection of the scene object | ||
137 | } | ||
138 | |||
139 | // ----------------------------------------------------------------- | ||
140 | /// <summary> | ||
141 | /// Called when all modules have been added for a region. This is | ||
142 | /// where we hook up events | ||
143 | /// </summary> | ||
144 | // ----------------------------------------------------------------- | ||
145 | public void RegionLoaded(Scene scene) | ||
146 | { | ||
147 | if (m_enabled) | ||
148 | { | ||
149 | m_scene = scene; | ||
150 | m_comms = m_scene.RequestModuleInterface<IScriptModuleComms>(); | ||
151 | if (m_comms == null) | ||
152 | { | ||
153 | m_log.ErrorFormat("[JsonStoreScripts] ScriptModuleComms interface not defined"); | ||
154 | m_enabled = false; | ||
155 | return; | ||
156 | } | ||
157 | |||
158 | m_store = m_scene.RequestModuleInterface<IJsonStoreModule>(); | ||
159 | if (m_store == null) | ||
160 | { | ||
161 | m_log.ErrorFormat("[JsonStoreScripts] JsonModule interface not defined"); | ||
162 | m_enabled = false; | ||
163 | return; | ||
164 | } | ||
165 | |||
166 | try | ||
167 | { | ||
168 | m_comms.RegisterScriptInvocation(this,"JsonCreateStore"); | ||
169 | m_comms.RegisterScriptInvocation(this,"JsonDestroyStore"); | ||
170 | |||
171 | m_comms.RegisterScriptInvocation(this,"JsonReadNotecard"); | ||
172 | m_comms.RegisterScriptInvocation(this,"JsonWriteNotecard"); | ||
173 | |||
174 | m_comms.RegisterScriptInvocation(this,"JsonTestPath"); | ||
175 | m_comms.RegisterScriptInvocation(this,"JsonTestPathJson"); | ||
176 | |||
177 | m_comms.RegisterScriptInvocation(this,"JsonGetValue"); | ||
178 | m_comms.RegisterScriptInvocation(this,"JsonGetValueJson"); | ||
179 | |||
180 | m_comms.RegisterScriptInvocation(this,"JsonTakeValue"); | ||
181 | m_comms.RegisterScriptInvocation(this,"JsonTakeValueJson"); | ||
182 | |||
183 | m_comms.RegisterScriptInvocation(this,"JsonReadValue"); | ||
184 | m_comms.RegisterScriptInvocation(this,"JsonReadValueJson"); | ||
185 | |||
186 | m_comms.RegisterScriptInvocation(this,"JsonSetValue"); | ||
187 | m_comms.RegisterScriptInvocation(this,"JsonSetValueJson"); | ||
188 | |||
189 | m_comms.RegisterScriptInvocation(this,"JsonRemoveValue"); | ||
190 | } | ||
191 | catch (Exception e) | ||
192 | { | ||
193 | // See http://opensimulator.org/mantis/view.php?id=5971 for more information | ||
194 | m_log.WarnFormat("[JsonStroreScripts] script method registration failed; {0}",e.Message); | ||
195 | m_enabled = false; | ||
196 | } | ||
197 | } | ||
198 | } | ||
199 | |||
200 | /// ----------------------------------------------------------------- | ||
201 | /// <summary> | ||
202 | /// </summary> | ||
203 | // ----------------------------------------------------------------- | ||
204 | public Type ReplaceableInterface | ||
205 | { | ||
206 | get { return null; } | ||
207 | } | ||
208 | |||
209 | #endregion | ||
210 | |||
211 | #region ScriptInvocationInteface | ||
212 | // ----------------------------------------------------------------- | ||
213 | /// <summary> | ||
214 | /// | ||
215 | /// </summary> | ||
216 | // ----------------------------------------------------------------- | ||
217 | protected void GenerateRuntimeError(string msg) | ||
218 | { | ||
219 | throw new Exception("JsonStore Runtime Error: " + msg); | ||
220 | } | ||
221 | |||
222 | // ----------------------------------------------------------------- | ||
223 | /// <summary> | ||
224 | /// | ||
225 | /// </summary> | ||
226 | // ----------------------------------------------------------------- | ||
227 | protected UUID JsonCreateStore(UUID hostID, UUID scriptID, string value) | ||
228 | { | ||
229 | UUID uuid = UUID.Zero; | ||
230 | if (! m_store.CreateStore(value, out uuid)) | ||
231 | GenerateRuntimeError("Failed to create Json store"); | ||
232 | |||
233 | return uuid; | ||
234 | } | ||
235 | |||
236 | // ----------------------------------------------------------------- | ||
237 | /// <summary> | ||
238 | /// | ||
239 | /// </summary> | ||
240 | // ----------------------------------------------------------------- | ||
241 | protected int JsonDestroyStore(UUID hostID, UUID scriptID, UUID storeID) | ||
242 | { | ||
243 | return m_store.DestroyStore(storeID) ? 1 : 0; | ||
244 | } | ||
245 | |||
246 | // ----------------------------------------------------------------- | ||
247 | /// <summary> | ||
248 | /// | ||
249 | /// </summary> | ||
250 | // ----------------------------------------------------------------- | ||
251 | protected UUID JsonReadNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, UUID assetID) | ||
252 | { | ||
253 | UUID reqID = UUID.Random(); | ||
254 | Util.FireAndForget(delegate(object o) { DoJsonReadNotecard(reqID,hostID,scriptID,storeID,path,assetID); }); | ||
255 | return reqID; | ||
256 | } | ||
257 | |||
258 | // ----------------------------------------------------------------- | ||
259 | /// <summary> | ||
260 | /// | ||
261 | /// </summary> | ||
262 | // ----------------------------------------------------------------- | ||
263 | protected UUID JsonWriteNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, string name) | ||
264 | { | ||
265 | UUID reqID = UUID.Random(); | ||
266 | Util.FireAndForget(delegate(object o) { DoJsonWriteNotecard(reqID,hostID,scriptID,storeID,path,name); }); | ||
267 | return reqID; | ||
268 | } | ||
269 | |||
270 | // ----------------------------------------------------------------- | ||
271 | /// <summary> | ||
272 | /// | ||
273 | /// </summary> | ||
274 | // ----------------------------------------------------------------- | ||
275 | protected int JsonTestPath(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
276 | { | ||
277 | return m_store.TestPath(storeID,path,false) ? 1 : 0; | ||
278 | } | ||
279 | |||
280 | protected int JsonTestPathJson(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
281 | { | ||
282 | return m_store.TestPath(storeID,path,true) ? 1 : 0; | ||
283 | } | ||
284 | |||
285 | // ----------------------------------------------------------------- | ||
286 | /// <summary> | ||
287 | /// | ||
288 | /// </summary> | ||
289 | // ----------------------------------------------------------------- | ||
290 | protected int JsonSetValue(UUID hostID, UUID scriptID, UUID storeID, string path, string value) | ||
291 | { | ||
292 | return m_store.SetValue(storeID,path,value,false) ? 1 : 0; | ||
293 | } | ||
294 | |||
295 | protected int JsonSetValueJson(UUID hostID, UUID scriptID, UUID storeID, string path, string value) | ||
296 | { | ||
297 | return m_store.SetValue(storeID,path,value,true) ? 1 : 0; | ||
298 | } | ||
299 | |||
300 | // ----------------------------------------------------------------- | ||
301 | /// <summary> | ||
302 | /// | ||
303 | /// </summary> | ||
304 | // ----------------------------------------------------------------- | ||
305 | protected int JsonRemoveValue(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
306 | { | ||
307 | return m_store.RemoveValue(storeID,path) ? 1 : 0; | ||
308 | } | ||
309 | |||
310 | // ----------------------------------------------------------------- | ||
311 | /// <summary> | ||
312 | /// | ||
313 | /// </summary> | ||
314 | // ----------------------------------------------------------------- | ||
315 | protected string JsonGetValue(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
316 | { | ||
317 | string value = String.Empty; | ||
318 | m_store.GetValue(storeID,path,false,out value); | ||
319 | return value; | ||
320 | } | ||
321 | |||
322 | protected string JsonGetValueJson(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
323 | { | ||
324 | string value = String.Empty; | ||
325 | m_store.GetValue(storeID,path,true, out value); | ||
326 | return value; | ||
327 | } | ||
328 | |||
329 | // ----------------------------------------------------------------- | ||
330 | /// <summary> | ||
331 | /// | ||
332 | /// </summary> | ||
333 | // ----------------------------------------------------------------- | ||
334 | protected UUID JsonTakeValue(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
335 | { | ||
336 | UUID reqID = UUID.Random(); | ||
337 | Util.FireAndForget(delegate(object o) { DoJsonTakeValue(scriptID,reqID,storeID,path,false); }); | ||
338 | return reqID; | ||
339 | } | ||
340 | |||
341 | protected UUID JsonTakeValueJson(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
342 | { | ||
343 | UUID reqID = UUID.Random(); | ||
344 | Util.FireAndForget(delegate(object o) { DoJsonTakeValue(scriptID,reqID,storeID,path,true); }); | ||
345 | return reqID; | ||
346 | } | ||
347 | |||
348 | private void DoJsonTakeValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson) | ||
349 | { | ||
350 | try | ||
351 | { | ||
352 | m_store.TakeValue(storeID,path,useJson,delegate(string value) { DispatchValue(scriptID,reqID,value); }); | ||
353 | return; | ||
354 | } | ||
355 | catch (Exception e) | ||
356 | { | ||
357 | m_log.InfoFormat("[JsonStoreScripts] unable to retrieve value; {0}",e.ToString()); | ||
358 | } | ||
359 | |||
360 | DispatchValue(scriptID,reqID,String.Empty); | ||
361 | } | ||
362 | |||
363 | |||
364 | // ----------------------------------------------------------------- | ||
365 | /// <summary> | ||
366 | /// | ||
367 | /// </summary> | ||
368 | // ----------------------------------------------------------------- | ||
369 | protected UUID JsonReadValue(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
370 | { | ||
371 | UUID reqID = UUID.Random(); | ||
372 | Util.FireAndForget(delegate(object o) { DoJsonReadValue(scriptID,reqID,storeID,path,false); }); | ||
373 | return reqID; | ||
374 | } | ||
375 | |||
376 | protected UUID JsonReadValueJson(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
377 | { | ||
378 | UUID reqID = UUID.Random(); | ||
379 | Util.FireAndForget(delegate(object o) { DoJsonReadValue(scriptID,reqID,storeID,path,true); }); | ||
380 | return reqID; | ||
381 | } | ||
382 | |||
383 | private void DoJsonReadValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson) | ||
384 | { | ||
385 | try | ||
386 | { | ||
387 | m_store.ReadValue(storeID,path,useJson,delegate(string value) { DispatchValue(scriptID,reqID,value); }); | ||
388 | return; | ||
389 | } | ||
390 | catch (Exception e) | ||
391 | { | ||
392 | m_log.InfoFormat("[JsonStoreScripts] unable to retrieve value; {0}",e.ToString()); | ||
393 | } | ||
394 | |||
395 | DispatchValue(scriptID,reqID,String.Empty); | ||
396 | } | ||
397 | |||
398 | #endregion | ||
399 | |||
400 | // ----------------------------------------------------------------- | ||
401 | /// <summary> | ||
402 | /// | ||
403 | /// </summary> | ||
404 | // ----------------------------------------------------------------- | ||
405 | protected void DispatchValue(UUID scriptID, UUID reqID, string value) | ||
406 | { | ||
407 | m_comms.DispatchReply(scriptID,1,value,reqID.ToString()); | ||
408 | } | ||
409 | |||
410 | // ----------------------------------------------------------------- | ||
411 | /// <summary> | ||
412 | /// | ||
413 | /// </summary> | ||
414 | // ----------------------------------------------------------------- | ||
415 | private void DoJsonReadNotecard(UUID reqID, UUID hostID, UUID scriptID, UUID storeID, string path, UUID assetID) | ||
416 | { | ||
417 | AssetBase a = m_scene.AssetService.Get(assetID.ToString()); | ||
418 | if (a == null) | ||
419 | GenerateRuntimeError(String.Format("Unable to find notecard asset {0}",assetID)); | ||
420 | |||
421 | if (a.Type != (sbyte)AssetType.Notecard) | ||
422 | GenerateRuntimeError(String.Format("Invalid notecard asset {0}",assetID)); | ||
423 | |||
424 | m_log.DebugFormat("[JsonStoreScripts] read notecard in context {0}",storeID); | ||
425 | |||
426 | try | ||
427 | { | ||
428 | System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); | ||
429 | string jsondata = SLUtil.ParseNotecardToString(enc.GetString(a.Data)); | ||
430 | int result = m_store.SetValue(storeID,path,jsondata,true) ? 1 : 0; | ||
431 | m_comms.DispatchReply(scriptID,result,"",reqID.ToString()); | ||
432 | return; | ||
433 | } | ||
434 | catch (Exception e) | ||
435 | { | ||
436 | m_log.WarnFormat("[JsonStoreScripts] Json parsing failed; {0}",e.Message); | ||
437 | } | ||
438 | |||
439 | GenerateRuntimeError(String.Format("Json parsing failed for {0}",assetID.ToString())); | ||
440 | m_comms.DispatchReply(scriptID,0,"",reqID.ToString()); | ||
441 | } | ||
442 | |||
443 | // ----------------------------------------------------------------- | ||
444 | /// <summary> | ||
445 | /// | ||
446 | /// </summary> | ||
447 | // ----------------------------------------------------------------- | ||
448 | private void DoJsonWriteNotecard(UUID reqID, UUID hostID, UUID scriptID, UUID storeID, string path, string name) | ||
449 | { | ||
450 | string data; | ||
451 | if (! m_store.GetValue(storeID,path,true, out data)) | ||
452 | { | ||
453 | m_comms.DispatchReply(scriptID,0,UUID.Zero.ToString(),reqID.ToString()); | ||
454 | return; | ||
455 | } | ||
456 | |||
457 | SceneObjectPart host = m_scene.GetSceneObjectPart(hostID); | ||
458 | |||
459 | // Create new asset | ||
460 | UUID assetID = UUID.Random(); | ||
461 | AssetBase asset = new AssetBase(assetID, name, (sbyte)AssetType.Notecard, host.OwnerID.ToString()); | ||
462 | asset.Description = "Json store"; | ||
463 | |||
464 | int textLength = data.Length; | ||
465 | data = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length " | ||
466 | + textLength.ToString() + "\n" + data + "}\n"; | ||
467 | |||
468 | asset.Data = Util.UTF8.GetBytes(data); | ||
469 | m_scene.AssetService.Store(asset); | ||
470 | |||
471 | // Create Task Entry | ||
472 | TaskInventoryItem taskItem = new TaskInventoryItem(); | ||
473 | |||
474 | taskItem.ResetIDs(host.UUID); | ||
475 | taskItem.ParentID = host.UUID; | ||
476 | taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch(); | ||
477 | taskItem.Name = asset.Name; | ||
478 | taskItem.Description = asset.Description; | ||
479 | taskItem.Type = (int)AssetType.Notecard; | ||
480 | taskItem.InvType = (int)InventoryType.Notecard; | ||
481 | taskItem.OwnerID = host.OwnerID; | ||
482 | taskItem.CreatorID = host.OwnerID; | ||
483 | taskItem.BasePermissions = (uint)PermissionMask.All; | ||
484 | taskItem.CurrentPermissions = (uint)PermissionMask.All; | ||
485 | taskItem.EveryonePermissions = 0; | ||
486 | taskItem.NextPermissions = (uint)PermissionMask.All; | ||
487 | taskItem.GroupID = host.GroupID; | ||
488 | taskItem.GroupPermissions = 0; | ||
489 | taskItem.Flags = 0; | ||
490 | taskItem.PermsGranter = UUID.Zero; | ||
491 | taskItem.PermsMask = 0; | ||
492 | taskItem.AssetID = asset.FullID; | ||
493 | |||
494 | host.Inventory.AddInventoryItem(taskItem, false); | ||
495 | |||
496 | m_comms.DispatchReply(scriptID,1,assetID.ToString(),reqID.ToString()); | ||
497 | } | ||
498 | } | ||
499 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs index 922eaaf..d192309 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs | |||
@@ -68,7 +68,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
68 | public Vector3 WorldPosition | 68 | public Vector3 WorldPosition |
69 | { | 69 | { |
70 | get { return GetSP().AbsolutePosition; } | 70 | get { return GetSP().AbsolutePosition; } |
71 | set { GetSP().TeleportWithMomentum(value); } | 71 | set { GetSP().Teleport(value); } |
72 | } | 72 | } |
73 | 73 | ||
74 | public bool IsChildAgent | 74 | public bool IsChildAgent |
diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index cab30de..74a85e2 100644 --- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | |||
@@ -38,7 +38,7 @@ using OpenMetaverse; | |||
38 | using System.Linq; | 38 | using System.Linq; |
39 | using System.Linq.Expressions; | 39 | using System.Linq.Expressions; |
40 | 40 | ||
41 | namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms | 41 | namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms |
42 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ScriptModuleCommsModule")] | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ScriptModuleCommsModule")] |
44 | class ScriptModuleCommsModule : INonSharedRegionModule, IScriptModuleComms | 44 | class ScriptModuleCommsModule : INonSharedRegionModule, IScriptModuleComms |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 8996865..e798382 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -76,22 +76,27 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
76 | 76 | ||
77 | public void Say(string message) | 77 | public void Say(string message) |
78 | { | 78 | { |
79 | SendOnChatFromClient(message, ChatTypeEnum.Say); | 79 | SendOnChatFromClient(0, message, ChatTypeEnum.Say); |
80 | } | 80 | } |
81 | 81 | ||
82 | public void Shout(string message) | 82 | public void Say(int channel, string message) |
83 | { | 83 | { |
84 | SendOnChatFromClient(message, ChatTypeEnum.Shout); | 84 | SendOnChatFromClient(channel, message, ChatTypeEnum.Say); |
85 | } | 85 | } |
86 | 86 | ||
87 | public void Whisper(string message) | 87 | public void Shout(int channel, string message) |
88 | { | 88 | { |
89 | SendOnChatFromClient(message, ChatTypeEnum.Whisper); | 89 | SendOnChatFromClient(channel, message, ChatTypeEnum.Shout); |
90 | } | ||
91 | |||
92 | public void Whisper(int channel, string message) | ||
93 | { | ||
94 | SendOnChatFromClient(channel, message, ChatTypeEnum.Whisper); | ||
90 | } | 95 | } |
91 | 96 | ||
92 | public void Broadcast(string message) | 97 | public void Broadcast(string message) |
93 | { | 98 | { |
94 | SendOnChatFromClient(message, ChatTypeEnum.Broadcast); | 99 | SendOnChatFromClient(0, message, ChatTypeEnum.Broadcast); |
95 | } | 100 | } |
96 | 101 | ||
97 | public void GiveMoney(UUID target, int amount) | 102 | public void GiveMoney(UUID target, int amount) |
@@ -146,10 +151,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
146 | 151 | ||
147 | #region Internal Functions | 152 | #region Internal Functions |
148 | 153 | ||
149 | private void SendOnChatFromClient(string message, ChatTypeEnum chatType) | 154 | private void SendOnChatFromClient(int channel, string message, ChatTypeEnum chatType) |
150 | { | 155 | { |
151 | OSChatMessage chatFromClient = new OSChatMessage(); | 156 | OSChatMessage chatFromClient = new OSChatMessage(); |
152 | chatFromClient.Channel = 0; | 157 | chatFromClient.Channel = channel; |
153 | chatFromClient.From = Name; | 158 | chatFromClient.From = Name; |
154 | chatFromClient.Message = message; | 159 | chatFromClient.Message = message; |
155 | chatFromClient.Position = StartPos; | 160 | chatFromClient.Position = StartPos; |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index ebf5e84..a32ab2a 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -155,18 +155,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
155 | ScenePresence sp; | 155 | ScenePresence sp; |
156 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) | 156 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) |
157 | { | 157 | { |
158 | m_log.DebugFormat( | ||
159 | "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); | ||
160 | |||
161 | sp.CompleteMovement(npcAvatar, false); | 158 | sp.CompleteMovement(npcAvatar, false); |
162 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); | 159 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); |
160 | m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); | ||
163 | } | 161 | } |
164 | else | ||
165 | { | ||
166 | m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID); | ||
167 | npcAvatar.AgentId = UUID.Zero; | ||
168 | } | ||
169 | |||
170 | } | 162 | } |
171 | ev.Set(); | 163 | ev.Set(); |
172 | }); | 164 | }); |
@@ -178,7 +170,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
178 | return npcAvatar.AgentId; | 170 | return npcAvatar.AgentId; |
179 | } | 171 | } |
180 | 172 | ||
181 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget) | 173 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running) |
182 | { | 174 | { |
183 | lock (m_avatars) | 175 | lock (m_avatars) |
184 | { | 176 | { |
@@ -192,6 +184,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
192 | sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget); | 184 | sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget); |
193 | 185 | ||
194 | sp.MoveToTarget(pos, noFly, landAtTarget); | 186 | sp.MoveToTarget(pos, noFly, landAtTarget); |
187 | sp.SetAlwaysRun = running; | ||
195 | 188 | ||
196 | return true; | 189 | return true; |
197 | } | 190 | } |
@@ -221,6 +214,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
221 | 214 | ||
222 | public bool Say(UUID agentID, Scene scene, string text) | 215 | public bool Say(UUID agentID, Scene scene, string text) |
223 | { | 216 | { |
217 | return Say(agentID, scene, text, 0); | ||
218 | } | ||
219 | |||
220 | public bool Say(UUID agentID, Scene scene, string text, int channel) | ||
221 | { | ||
224 | lock (m_avatars) | 222 | lock (m_avatars) |
225 | { | 223 | { |
226 | if (m_avatars.ContainsKey(agentID)) | 224 | if (m_avatars.ContainsKey(agentID)) |
@@ -228,7 +226,25 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
228 | ScenePresence sp; | 226 | ScenePresence sp; |
229 | scene.TryGetScenePresence(agentID, out sp); | 227 | scene.TryGetScenePresence(agentID, out sp); |
230 | 228 | ||
231 | m_avatars[agentID].Say(text); | 229 | m_avatars[agentID].Say(channel, text); |
230 | |||
231 | return true; | ||
232 | } | ||
233 | } | ||
234 | |||
235 | return false; | ||
236 | } | ||
237 | |||
238 | public bool Shout(UUID agentID, Scene scene, string text, int channel) | ||
239 | { | ||
240 | lock (m_avatars) | ||
241 | { | ||
242 | if (m_avatars.ContainsKey(agentID)) | ||
243 | { | ||
244 | ScenePresence sp; | ||
245 | scene.TryGetScenePresence(agentID, out sp); | ||
246 | |||
247 | m_avatars[agentID].Shout(channel, text); | ||
232 | 248 | ||
233 | return true; | 249 | return true; |
234 | } | 250 | } |
@@ -255,6 +271,24 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
255 | return false; | 271 | return false; |
256 | } | 272 | } |
257 | 273 | ||
274 | public bool Whisper(UUID agentID, Scene scene, string text, int channel) | ||
275 | { | ||
276 | lock (m_avatars) | ||
277 | { | ||
278 | if (m_avatars.ContainsKey(agentID)) | ||
279 | { | ||
280 | ScenePresence sp; | ||
281 | scene.TryGetScenePresence(agentID, out sp); | ||
282 | |||
283 | m_avatars[agentID].Whisper(channel, text); | ||
284 | |||
285 | return true; | ||
286 | } | ||
287 | } | ||
288 | |||
289 | return false; | ||
290 | } | ||
291 | |||
258 | public bool Stand(UUID agentID, Scene scene) | 292 | public bool Stand(UUID agentID, Scene scene) |
259 | { | 293 | { |
260 | lock (m_avatars) | 294 | lock (m_avatars) |
@@ -308,7 +342,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
308 | scene.RemoveClient(agentID, false); | 342 | scene.RemoveClient(agentID, false); |
309 | m_avatars.Remove(agentID); | 343 | m_avatars.Remove(agentID); |
310 | 344 | ||
311 | // m_log.DebugFormat("[NPC MODULE]: Removed {0} {1}", agentID, av.Name); | 345 | m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", agentID, av.Name); |
312 | return true; | 346 | return true; |
313 | } | 347 | } |
314 | } | 348 | } |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index eea0b2e..65dad2d 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | |||
@@ -85,7 +85,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
85 | m_attMod = new AttachmentsModule(); | 85 | m_attMod = new AttachmentsModule(); |
86 | m_npcMod = new NPCModule(); | 86 | m_npcMod = new NPCModule(); |
87 | 87 | ||
88 | m_scene = SceneHelpers.SetupScene(); | 88 | m_scene = new SceneHelpers().SetupScene(); |
89 | SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule()); | 89 | SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule()); |
90 | } | 90 | } |
91 | 91 | ||
@@ -242,7 +242,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
242 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | 242 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); |
243 | 243 | ||
244 | Vector3 targetPos = startPos + new Vector3(0, 10, 0); | 244 | Vector3 targetPos = startPos + new Vector3(0, 10, 0); |
245 | m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false); | 245 | m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false, false); |
246 | 246 | ||
247 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | 247 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); |
248 | //Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f))); | 248 | //Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f))); |
@@ -267,7 +267,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
267 | // Try a second movement | 267 | // Try a second movement |
268 | startPos = npc.AbsolutePosition; | 268 | startPos = npc.AbsolutePosition; |
269 | targetPos = startPos + new Vector3(10, 0, 0); | 269 | targetPos = startPos + new Vector3(10, 0, 0); |
270 | m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false); | 270 | m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false, false); |
271 | 271 | ||
272 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | 272 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); |
273 | // Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1))); | 273 | // Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1))); |
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs index b1a3ff9..e43136a 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs | |||
@@ -36,13 +36,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
36 | { | 36 | { |
37 | public class BasicActor : PhysicsActor | 37 | public class BasicActor : PhysicsActor |
38 | { | 38 | { |
39 | private Vector3 _position; | ||
40 | private Vector3 _velocity; | ||
41 | private Vector3 _acceleration; | ||
42 | private Vector3 _size; | 39 | private Vector3 _size; |
43 | private Vector3 m_rotationalVelocity; | ||
44 | private bool flying; | ||
45 | private bool iscolliding; | ||
46 | 40 | ||
47 | public BasicActor(Vector3 size) | 41 | public BasicActor(Vector3 size) |
48 | { | 42 | { |
@@ -55,11 +49,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
55 | set { return; } | 49 | set { return; } |
56 | } | 50 | } |
57 | 51 | ||
58 | public override Vector3 RotationalVelocity | 52 | public override Vector3 RotationalVelocity { get; set; } |
59 | { | ||
60 | get { return m_rotationalVelocity; } | ||
61 | set { m_rotationalVelocity = value; } | ||
62 | } | ||
63 | 53 | ||
64 | public override bool SetAlwaysRun | 54 | public override bool SetAlwaysRun |
65 | { | 55 | { |
@@ -105,17 +95,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
105 | set { return; } | 95 | set { return; } |
106 | } | 96 | } |
107 | 97 | ||
108 | public override bool Flying | 98 | public override bool Flying { get; set; } |
109 | { | ||
110 | get { return flying; } | ||
111 | set { flying = value; } | ||
112 | } | ||
113 | 99 | ||
114 | public override bool IsColliding | 100 | public override bool IsColliding { get; set; } |
115 | { | ||
116 | get { return iscolliding; } | ||
117 | set { iscolliding = value; } | ||
118 | } | ||
119 | 101 | ||
120 | public override bool CollidingGround | 102 | public override bool CollidingGround |
121 | { | 103 | { |
@@ -134,11 +116,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
134 | get { return false; } | 116 | get { return false; } |
135 | } | 117 | } |
136 | 118 | ||
137 | public override Vector3 Position | 119 | public override Vector3 Position { get; set; } |
138 | { | ||
139 | get { return _position; } | ||
140 | set { _position = value; } | ||
141 | } | ||
142 | 120 | ||
143 | public override Vector3 Size | 121 | public override Vector3 Size |
144 | { | 122 | { |
@@ -206,11 +184,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
206 | get { return Vector3.Zero; } | 184 | get { return Vector3.Zero; } |
207 | } | 185 | } |
208 | 186 | ||
209 | public override Vector3 Velocity | 187 | public override Vector3 Velocity { get; set; } |
210 | { | ||
211 | get { return _velocity; } | ||
212 | set { _velocity = value; } | ||
213 | } | ||
214 | 188 | ||
215 | public override Vector3 Torque | 189 | public override Vector3 Torque |
216 | { | 190 | { |
@@ -230,11 +204,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
230 | set { } | 204 | set { } |
231 | } | 205 | } |
232 | 206 | ||
233 | public override Vector3 Acceleration | 207 | public override Vector3 Acceleration { get; set; } |
234 | { | ||
235 | get { return _acceleration; } | ||
236 | set { _acceleration = value; } | ||
237 | } | ||
238 | 208 | ||
239 | public override bool Kinematic | 209 | public override bool Kinematic |
240 | { | 210 | { |
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs new file mode 100644 index 0000000..b89eeed --- /dev/null +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs | |||
@@ -0,0 +1,314 @@ | |||
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 Nini.Config; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.Physics.Manager; | ||
34 | |||
35 | namespace OpenSim.Region.Physics.BasicPhysicsPlugin | ||
36 | { | ||
37 | public class BasicPhysicsPrim : PhysicsActor | ||
38 | { | ||
39 | private Vector3 _size; | ||
40 | private PrimitiveBaseShape _shape; | ||
41 | |||
42 | public BasicPhysicsPrim( | ||
43 | string name, uint localId, Vector3 position, Vector3 size, Quaternion orientation, PrimitiveBaseShape shape) | ||
44 | { | ||
45 | Name = name; | ||
46 | LocalID = localId; | ||
47 | Position = position; | ||
48 | Size = size; | ||
49 | Orientation = orientation; | ||
50 | Shape = shape; | ||
51 | } | ||
52 | |||
53 | public override int PhysicsActorType | ||
54 | { | ||
55 | get { return (int) ActorTypes.Agent; } | ||
56 | set { return; } | ||
57 | } | ||
58 | |||
59 | public override Vector3 RotationalVelocity { get; set; } | ||
60 | |||
61 | public override bool SetAlwaysRun | ||
62 | { | ||
63 | get { return false; } | ||
64 | set { return; } | ||
65 | } | ||
66 | |||
67 | public override uint LocalID | ||
68 | { | ||
69 | set { return; } | ||
70 | } | ||
71 | |||
72 | public override bool Grabbed | ||
73 | { | ||
74 | set { return; } | ||
75 | } | ||
76 | |||
77 | public override bool Selected | ||
78 | { | ||
79 | set { return; } | ||
80 | } | ||
81 | |||
82 | public override float Buoyancy | ||
83 | { | ||
84 | get { return 0f; } | ||
85 | set { return; } | ||
86 | } | ||
87 | |||
88 | public override bool FloatOnWater | ||
89 | { | ||
90 | set { return; } | ||
91 | } | ||
92 | |||
93 | public override bool IsPhysical | ||
94 | { | ||
95 | get { return false; } | ||
96 | set { return; } | ||
97 | } | ||
98 | |||
99 | public override bool ThrottleUpdates | ||
100 | { | ||
101 | get { return false; } | ||
102 | set { return; } | ||
103 | } | ||
104 | |||
105 | public override bool Flying { get; set; } | ||
106 | |||
107 | public override bool IsColliding { get; set; } | ||
108 | |||
109 | public override bool CollidingGround | ||
110 | { | ||
111 | get { return false; } | ||
112 | set { return; } | ||
113 | } | ||
114 | |||
115 | public override bool CollidingObj | ||
116 | { | ||
117 | get { return false; } | ||
118 | set { return; } | ||
119 | } | ||
120 | |||
121 | public override bool Stopped | ||
122 | { | ||
123 | get { return false; } | ||
124 | } | ||
125 | |||
126 | public override Vector3 Position { get; set; } | ||
127 | |||
128 | public override Vector3 Size | ||
129 | { | ||
130 | get { return _size; } | ||
131 | set { | ||
132 | _size = value; | ||
133 | _size.Z = _size.Z / 2.0f; | ||
134 | } | ||
135 | } | ||
136 | |||
137 | public override PrimitiveBaseShape Shape | ||
138 | { | ||
139 | set { _shape = value; } | ||
140 | } | ||
141 | |||
142 | public override float Mass | ||
143 | { | ||
144 | get { return 0f; } | ||
145 | } | ||
146 | |||
147 | public override Vector3 Force | ||
148 | { | ||
149 | get { return Vector3.Zero; } | ||
150 | set { return; } | ||
151 | } | ||
152 | |||
153 | public override int VehicleType | ||
154 | { | ||
155 | get { return 0; } | ||
156 | set { return; } | ||
157 | } | ||
158 | |||
159 | public override void VehicleFloatParam(int param, float value) | ||
160 | { | ||
161 | |||
162 | } | ||
163 | |||
164 | public override void VehicleVectorParam(int param, Vector3 value) | ||
165 | { | ||
166 | |||
167 | } | ||
168 | |||
169 | public override void VehicleRotationParam(int param, Quaternion rotation) | ||
170 | { | ||
171 | |||
172 | } | ||
173 | |||
174 | public override void VehicleFlags(int param, bool remove) | ||
175 | { | ||
176 | |||
177 | } | ||
178 | |||
179 | public override void SetVolumeDetect(int param) | ||
180 | { | ||
181 | |||
182 | } | ||
183 | |||
184 | public override Vector3 CenterOfMass | ||
185 | { | ||
186 | get { return Vector3.Zero; } | ||
187 | } | ||
188 | |||
189 | public override Vector3 GeometricCenter | ||
190 | { | ||
191 | get { return Vector3.Zero; } | ||
192 | } | ||
193 | |||
194 | public override Vector3 Velocity { get; set; } | ||
195 | |||
196 | public override Vector3 Torque | ||
197 | { | ||
198 | get { return Vector3.Zero; } | ||
199 | set { return; } | ||
200 | } | ||
201 | |||
202 | public override float CollisionScore | ||
203 | { | ||
204 | get { return 0f; } | ||
205 | set { } | ||
206 | } | ||
207 | |||
208 | public override Quaternion Orientation { get; set; } | ||
209 | |||
210 | public override Vector3 Acceleration { get; set; } | ||
211 | |||
212 | public override bool Kinematic | ||
213 | { | ||
214 | get { return true; } | ||
215 | set { } | ||
216 | } | ||
217 | |||
218 | public override void link(PhysicsActor obj) | ||
219 | { | ||
220 | } | ||
221 | |||
222 | public override void delink() | ||
223 | { | ||
224 | } | ||
225 | |||
226 | public override void LockAngularMotion(Vector3 axis) | ||
227 | { | ||
228 | } | ||
229 | |||
230 | public override void AddForce(Vector3 force, bool pushforce) | ||
231 | { | ||
232 | } | ||
233 | |||
234 | public override void AddAngularForce(Vector3 force, bool pushforce) | ||
235 | { | ||
236 | } | ||
237 | |||
238 | public override void SetMomentum(Vector3 momentum) | ||
239 | { | ||
240 | } | ||
241 | |||
242 | public override void CrossingFailure() | ||
243 | { | ||
244 | } | ||
245 | |||
246 | public override Vector3 PIDTarget | ||
247 | { | ||
248 | set { return; } | ||
249 | } | ||
250 | |||
251 | public override bool PIDActive | ||
252 | { | ||
253 | set { return; } | ||
254 | } | ||
255 | |||
256 | public override float PIDTau | ||
257 | { | ||
258 | set { return; } | ||
259 | } | ||
260 | |||
261 | public override float PIDHoverHeight | ||
262 | { | ||
263 | set { return; } | ||
264 | } | ||
265 | |||
266 | public override bool PIDHoverActive | ||
267 | { | ||
268 | set { return; } | ||
269 | } | ||
270 | |||
271 | public override PIDHoverType PIDHoverType | ||
272 | { | ||
273 | set { return; } | ||
274 | } | ||
275 | |||
276 | public override float PIDHoverTau | ||
277 | { | ||
278 | set { return; } | ||
279 | } | ||
280 | |||
281 | public override Quaternion APIDTarget | ||
282 | { | ||
283 | set { return; } | ||
284 | } | ||
285 | |||
286 | public override bool APIDActive | ||
287 | { | ||
288 | set { return; } | ||
289 | } | ||
290 | |||
291 | public override float APIDStrength | ||
292 | { | ||
293 | set { return; } | ||
294 | } | ||
295 | |||
296 | public override float APIDDamping | ||
297 | { | ||
298 | set { return; } | ||
299 | } | ||
300 | |||
301 | public override void SubscribeEvents(int ms) | ||
302 | { | ||
303 | } | ||
304 | |||
305 | public override void UnSubscribeEvents() | ||
306 | { | ||
307 | } | ||
308 | |||
309 | public override bool SubscribedEvents() | ||
310 | { | ||
311 | return false; | ||
312 | } | ||
313 | } | ||
314 | } | ||
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs index 2e14216..f5826ed 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | |||
@@ -34,9 +34,17 @@ using OpenSim.Region.Physics.Manager; | |||
34 | 34 | ||
35 | namespace OpenSim.Region.Physics.BasicPhysicsPlugin | 35 | namespace OpenSim.Region.Physics.BasicPhysicsPlugin |
36 | { | 36 | { |
37 | /// <summary> | ||
38 | /// This is an incomplete extremely basic physics implementation | ||
39 | /// </summary> | ||
40 | /// <remarks> | ||
41 | /// Not useful for anything at the moment apart from some regression testing in other components where some form | ||
42 | /// of physics plugin is needed. | ||
43 | /// </remarks> | ||
37 | public class BasicScene : PhysicsScene | 44 | public class BasicScene : PhysicsScene |
38 | { | 45 | { |
39 | private List<BasicActor> _actors = new List<BasicActor>(); | 46 | private List<BasicActor> _actors = new List<BasicActor>(); |
47 | private List<BasicPhysicsPrim> _prims = new List<BasicPhysicsPrim>(); | ||
40 | private float[] _heightMap; | 48 | private float[] _heightMap; |
41 | 49 | ||
42 | //protected internal string sceneIdentifier; | 50 | //protected internal string sceneIdentifier; |
@@ -50,10 +58,19 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
50 | { | 58 | { |
51 | } | 59 | } |
52 | 60 | ||
53 | public override void Dispose() | 61 | public override void Dispose() {} |
62 | |||
63 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | ||
64 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid) | ||
54 | { | 65 | { |
66 | BasicPhysicsPrim prim = new BasicPhysicsPrim(primName, localid, position, size, rotation, pbs); | ||
67 | prim.IsPhysical = isPhysical; | ||
68 | |||
69 | _prims.Add(prim); | ||
55 | 70 | ||
71 | return prim; | ||
56 | } | 72 | } |
73 | |||
57 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) | 74 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) |
58 | { | 75 | { |
59 | BasicActor act = new BasicActor(size); | 76 | BasicActor act = new BasicActor(size); |
@@ -63,30 +80,18 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
63 | return act; | 80 | return act; |
64 | } | 81 | } |
65 | 82 | ||
66 | public override void RemovePrim(PhysicsActor prim) | 83 | public override void RemovePrim(PhysicsActor actor) |
67 | { | 84 | { |
85 | BasicPhysicsPrim prim = (BasicPhysicsPrim)actor; | ||
86 | if (_prims.Contains(prim)) | ||
87 | _prims.Remove(prim); | ||
68 | } | 88 | } |
69 | 89 | ||
70 | public override void RemoveAvatar(PhysicsActor actor) | 90 | public override void RemoveAvatar(PhysicsActor actor) |
71 | { | 91 | { |
72 | BasicActor act = (BasicActor) actor; | 92 | BasicActor act = (BasicActor)actor; |
73 | if (_actors.Contains(act)) | 93 | if (_actors.Contains(act)) |
74 | { | ||
75 | _actors.Remove(act); | 94 | _actors.Remove(act); |
76 | } | ||
77 | } | ||
78 | |||
79 | /* | ||
80 | public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation) | ||
81 | { | ||
82 | return null; | ||
83 | } | ||
84 | */ | ||
85 | |||
86 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | ||
87 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid) | ||
88 | { | ||
89 | return null; | ||
90 | } | 95 | } |
91 | 96 | ||
92 | public override void AddPhysicsActorTaint(PhysicsActor prim) | 97 | public override void AddPhysicsActorTaint(PhysicsActor prim) |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 6f37347..a41c856 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -156,7 +156,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
156 | /// </summary> | 156 | /// </summary> |
157 | public IntPtr m_targetSpace = IntPtr.Zero; | 157 | public IntPtr m_targetSpace = IntPtr.Zero; |
158 | 158 | ||
159 | /// <summary> | ||
160 | /// The prim geometry, used for collision detection. | ||
161 | /// </summary> | ||
162 | /// <remarks> | ||
163 | /// This is never null except for a brief period when the geometry needs to be replaced (due to resizing or | ||
164 | /// mesh change) or when the physical prim is being removed from the scene. | ||
165 | /// </remarks> | ||
159 | public IntPtr prim_geom { get; private set; } | 166 | public IntPtr prim_geom { get; private set; } |
167 | |||
160 | public IntPtr _triMeshData { get; private set; } | 168 | public IntPtr _triMeshData { get; private set; } |
161 | 169 | ||
162 | private IntPtr _linkJointGroup = IntPtr.Zero; | 170 | private IntPtr _linkJointGroup = IntPtr.Zero; |
@@ -325,14 +333,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
325 | { | 333 | { |
326 | prim_geom = geom; | 334 | prim_geom = geom; |
327 | //Console.WriteLine("SetGeom to " + prim_geom + " for " + Name); | 335 | //Console.WriteLine("SetGeom to " + prim_geom + " for " + Name); |
328 | if (prim_geom != IntPtr.Zero) | ||
329 | { | ||
330 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
331 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
332 | 336 | ||
333 | _parent_scene.geom_name_map[prim_geom] = Name; | 337 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
334 | _parent_scene.actor_name_map[prim_geom] = this; | 338 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
335 | } | 339 | |
340 | _parent_scene.geom_name_map[prim_geom] = Name; | ||
341 | _parent_scene.actor_name_map[prim_geom] = this; | ||
336 | 342 | ||
337 | if (childPrim) | 343 | if (childPrim) |
338 | { | 344 | { |
@@ -765,11 +771,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
765 | m_collisionCategories &= ~CollisionCategories.Body; | 771 | m_collisionCategories &= ~CollisionCategories.Body; |
766 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); | 772 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); |
767 | 773 | ||
768 | if (prim_geom != IntPtr.Zero) | 774 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
769 | { | 775 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
770 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
771 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
772 | } | ||
773 | 776 | ||
774 | d.BodyDestroy(Body); | 777 | d.BodyDestroy(Body); |
775 | lock (childrenPrim) | 778 | lock (childrenPrim) |
@@ -793,11 +796,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
793 | m_collisionCategories &= ~CollisionCategories.Body; | 796 | m_collisionCategories &= ~CollisionCategories.Body; |
794 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); | 797 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); |
795 | 798 | ||
796 | if (prim_geom != IntPtr.Zero) | 799 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
797 | { | 800 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
798 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
799 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
800 | } | ||
801 | 801 | ||
802 | Body = IntPtr.Zero; | 802 | Body = IntPtr.Zero; |
803 | } | 803 | } |
@@ -864,10 +864,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
864 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); | 864 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); |
865 | try | 865 | try |
866 | { | 866 | { |
867 | if (prim_geom == IntPtr.Zero) | 867 | SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null)); |
868 | { | ||
869 | SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null)); | ||
870 | } | ||
871 | } | 868 | } |
872 | catch (AccessViolationException) | 869 | catch (AccessViolationException) |
873 | { | 870 | { |
@@ -890,73 +887,67 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
890 | #if SPAM | 887 | #if SPAM |
891 | Console.WriteLine("ZProcessTaints for " + Name); | 888 | Console.WriteLine("ZProcessTaints for " + Name); |
892 | #endif | 889 | #endif |
890 | |||
891 | // This must be processed as the very first taint so that later operations have a prim_geom to work with | ||
892 | // if this is a new prim. | ||
893 | if (m_taintadd) | 893 | if (m_taintadd) |
894 | { | ||
895 | changeadd(); | 894 | changeadd(); |
896 | } | ||
897 | |||
898 | if (prim_geom != IntPtr.Zero) | ||
899 | { | ||
900 | if (!_position.ApproxEquals(m_taintposition, 0f)) | ||
901 | changemove(); | ||
902 | 895 | ||
903 | if (m_taintrot != _orientation) | 896 | if (!_position.ApproxEquals(m_taintposition, 0f)) |
904 | { | 897 | changemove(); |
905 | if (childPrim && IsPhysical) // For physical child prim... | 898 | |
906 | { | 899 | if (m_taintrot != _orientation) |
907 | rotate(); | 900 | { |
908 | // KF: ODE will also rotate the parent prim! | 901 | if (childPrim && IsPhysical) // For physical child prim... |
909 | // so rotate the root back to where it was | 902 | { |
910 | OdePrim parent = (OdePrim)_parent; | 903 | rotate(); |
911 | parent.rotate(); | 904 | // KF: ODE will also rotate the parent prim! |
912 | } | 905 | // so rotate the root back to where it was |
913 | else | 906 | OdePrim parent = (OdePrim)_parent; |
914 | { | 907 | parent.rotate(); |
915 | //Just rotate the prim | ||
916 | rotate(); | ||
917 | } | ||
918 | } | 908 | } |
919 | 909 | else | |
920 | if (m_taintPhysics != IsPhysical && !(m_taintparent != _parent)) | 910 | { |
921 | changePhysicsStatus(); | 911 | //Just rotate the prim |
912 | rotate(); | ||
913 | } | ||
914 | } | ||
915 | |||
916 | if (m_taintPhysics != IsPhysical && !(m_taintparent != _parent)) | ||
917 | changePhysicsStatus(); | ||
922 | 918 | ||
923 | if (!_size.ApproxEquals(m_taintsize, 0f)) | 919 | if (!_size.ApproxEquals(m_taintsize, 0f)) |
924 | changesize(); | 920 | changesize(); |
925 | 921 | ||
926 | if (m_taintshape) | 922 | if (m_taintshape) |
927 | changeshape(); | 923 | changeshape(); |
928 | 924 | ||
929 | if (m_taintforce) | 925 | if (m_taintforce) |
930 | changeAddForce(); | 926 | changeAddForce(); |
931 | 927 | ||
932 | if (m_taintaddangularforce) | 928 | if (m_taintaddangularforce) |
933 | changeAddAngularForce(); | 929 | changeAddAngularForce(); |
934 | 930 | ||
935 | if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f)) | 931 | if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f)) |
936 | changeSetTorque(); | 932 | changeSetTorque(); |
937 | 933 | ||
938 | if (m_taintdisable) | 934 | if (m_taintdisable) |
939 | changedisable(); | 935 | changedisable(); |
940 | 936 | ||
941 | if (m_taintselected != m_isSelected) | 937 | if (m_taintselected != m_isSelected) |
942 | changeSelectedStatus(); | 938 | changeSelectedStatus(); |
943 | 939 | ||
944 | if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f)) | 940 | if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f)) |
945 | changevelocity(); | 941 | changevelocity(); |
946 | 942 | ||
947 | if (m_taintparent != _parent) | 943 | if (m_taintparent != _parent) |
948 | changelink(); | 944 | changelink(); |
949 | 945 | ||
950 | if (m_taintCollidesWater != m_collidesWater) | 946 | if (m_taintCollidesWater != m_collidesWater) |
951 | changefloatonwater(); | 947 | changefloatonwater(); |
952 | 948 | ||
953 | if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f)) | 949 | if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f)) |
954 | changeAngularLock(); | 950 | changeAngularLock(); |
955 | } | ||
956 | else | ||
957 | { | ||
958 | m_log.ErrorFormat("[PHYSICS]: The scene reused a disposed PhysActor for {0}! *waves finger*, Don't be evil. A couple of things can cause this. An improper prim breakdown(be sure to set prim_geom to zero after d.GeomDestroy! An improper buildup (creating the geom failed). Or, the Scene Reused a physics actor after disposing it.)", Name); | ||
959 | } | ||
960 | } | 951 | } |
961 | 952 | ||
962 | /// <summary> | 953 | /// <summary> |
@@ -1052,150 +1043,146 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1052 | /// <param name="prim">Child prim</param> | 1043 | /// <param name="prim">Child prim</param> |
1053 | private void AddChildPrim(OdePrim prim) | 1044 | private void AddChildPrim(OdePrim prim) |
1054 | { | 1045 | { |
1055 | //Console.WriteLine("AddChildPrim " + Name); | 1046 | if (LocalID == prim.LocalID) |
1056 | if (LocalID != prim.LocalID) | 1047 | return; |
1048 | |||
1049 | if (Body == IntPtr.Zero) | ||
1057 | { | 1050 | { |
1058 | if (Body == IntPtr.Zero) | 1051 | Body = d.BodyCreate(_parent_scene.world); |
1052 | setMass(); | ||
1053 | } | ||
1054 | |||
1055 | lock (childrenPrim) | ||
1056 | { | ||
1057 | if (childrenPrim.Contains(prim)) | ||
1058 | return; | ||
1059 | |||
1060 | // m_log.DebugFormat( | ||
1061 | // "[ODE PRIM]: Linking prim {0} {1} to {2} {3}", prim.Name, prim.LocalID, Name, LocalID); | ||
1062 | |||
1063 | childrenPrim.Add(prim); | ||
1064 | |||
1065 | foreach (OdePrim prm in childrenPrim) | ||
1059 | { | 1066 | { |
1060 | Body = d.BodyCreate(_parent_scene.world); | 1067 | d.Mass m2; |
1061 | setMass(); | 1068 | d.MassSetZero(out m2); |
1069 | d.MassSetBoxTotal(out m2, prim.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z); | ||
1070 | |||
1071 | d.Quaternion quat = new d.Quaternion(); | ||
1072 | quat.W = prm._orientation.W; | ||
1073 | quat.X = prm._orientation.X; | ||
1074 | quat.Y = prm._orientation.Y; | ||
1075 | quat.Z = prm._orientation.Z; | ||
1076 | |||
1077 | d.Matrix3 mat = new d.Matrix3(); | ||
1078 | d.RfromQ(out mat, ref quat); | ||
1079 | d.MassRotate(ref m2, ref mat); | ||
1080 | d.MassTranslate(ref m2, Position.X - prm.Position.X, Position.Y - prm.Position.Y, Position.Z - prm.Position.Z); | ||
1081 | d.MassAdd(ref pMass, ref m2); | ||
1062 | } | 1082 | } |
1063 | if (Body != IntPtr.Zero) | 1083 | |
1084 | foreach (OdePrim prm in childrenPrim) | ||
1064 | { | 1085 | { |
1065 | lock (childrenPrim) | 1086 | prm.m_collisionCategories |= CollisionCategories.Body; |
1066 | { | 1087 | prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); |
1067 | if (!childrenPrim.Contains(prim)) | ||
1068 | { | ||
1069 | //Console.WriteLine("childrenPrim.Add " + prim); | ||
1070 | childrenPrim.Add(prim); | ||
1071 | |||
1072 | foreach (OdePrim prm in childrenPrim) | ||
1073 | { | ||
1074 | d.Mass m2; | ||
1075 | d.MassSetZero(out m2); | ||
1076 | d.MassSetBoxTotal(out m2, prim.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z); | ||
1077 | |||
1078 | d.Quaternion quat = new d.Quaternion(); | ||
1079 | quat.W = prm._orientation.W; | ||
1080 | quat.X = prm._orientation.X; | ||
1081 | quat.Y = prm._orientation.Y; | ||
1082 | quat.Z = prm._orientation.Z; | ||
1083 | |||
1084 | d.Matrix3 mat = new d.Matrix3(); | ||
1085 | d.RfromQ(out mat, ref quat); | ||
1086 | d.MassRotate(ref m2, ref mat); | ||
1087 | d.MassTranslate(ref m2, Position.X - prm.Position.X, Position.Y - prm.Position.Y, Position.Z - prm.Position.Z); | ||
1088 | d.MassAdd(ref pMass, ref m2); | ||
1089 | } | ||
1090 | |||
1091 | foreach (OdePrim prm in childrenPrim) | ||
1092 | { | ||
1093 | prm.m_collisionCategories |= CollisionCategories.Body; | ||
1094 | prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); | ||
1095 | 1088 | ||
1096 | if (prm.prim_geom == IntPtr.Zero) | ||
1097 | { | ||
1098 | m_log.WarnFormat( | ||
1099 | "[PHYSICS]: Unable to link one of the linkset elements {0} for parent {1}. No geom yet", | ||
1100 | prm.Name, prim.Name); | ||
1101 | continue; | ||
1102 | } | ||
1103 | //Console.WriteLine(" GeomSetCategoryBits 1: " + prm.prim_geom + " - " + (int)prm.m_collisionCategories + " for " + Name); | 1089 | //Console.WriteLine(" GeomSetCategoryBits 1: " + prm.prim_geom + " - " + (int)prm.m_collisionCategories + " for " + Name); |
1104 | d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories); | 1090 | d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories); |
1105 | d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags); | 1091 | d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags); |
1106 | |||
1107 | 1092 | ||
1108 | d.Quaternion quat = new d.Quaternion(); | 1093 | d.Quaternion quat = new d.Quaternion(); |
1109 | quat.W = prm._orientation.W; | 1094 | quat.W = prm._orientation.W; |
1110 | quat.X = prm._orientation.X; | 1095 | quat.X = prm._orientation.X; |
1111 | quat.Y = prm._orientation.Y; | 1096 | quat.Y = prm._orientation.Y; |
1112 | quat.Z = prm._orientation.Z; | 1097 | quat.Z = prm._orientation.Z; |
1113 | 1098 | ||
1114 | d.Matrix3 mat = new d.Matrix3(); | 1099 | d.Matrix3 mat = new d.Matrix3(); |
1115 | d.RfromQ(out mat, ref quat); | 1100 | d.RfromQ(out mat, ref quat); |
1116 | if (Body != IntPtr.Zero) | 1101 | if (Body != IntPtr.Zero) |
1117 | { | 1102 | { |
1118 | d.GeomSetBody(prm.prim_geom, Body); | 1103 | d.GeomSetBody(prm.prim_geom, Body); |
1119 | prm.childPrim = true; | 1104 | prm.childPrim = true; |
1120 | d.GeomSetOffsetWorldPosition(prm.prim_geom, prm.Position.X , prm.Position.Y, prm.Position.Z); | 1105 | d.GeomSetOffsetWorldPosition(prm.prim_geom, prm.Position.X , prm.Position.Y, prm.Position.Z); |
1121 | //d.GeomSetOffsetPosition(prim.prim_geom, | 1106 | //d.GeomSetOffsetPosition(prim.prim_geom, |
1122 | // (Position.X - prm.Position.X) - pMass.c.X, | 1107 | // (Position.X - prm.Position.X) - pMass.c.X, |
1123 | // (Position.Y - prm.Position.Y) - pMass.c.Y, | 1108 | // (Position.Y - prm.Position.Y) - pMass.c.Y, |
1124 | // (Position.Z - prm.Position.Z) - pMass.c.Z); | 1109 | // (Position.Z - prm.Position.Z) - pMass.c.Z); |
1125 | d.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat); | 1110 | d.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat); |
1126 | //d.GeomSetOffsetRotation(prm.prim_geom, ref mat); | 1111 | //d.GeomSetOffsetRotation(prm.prim_geom, ref mat); |
1127 | d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z); | 1112 | d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z); |
1128 | d.BodySetMass(Body, ref pMass); | 1113 | d.BodySetMass(Body, ref pMass); |
1129 | } | 1114 | } |
1130 | else | 1115 | else |
1131 | { | 1116 | { |
1132 | m_log.DebugFormat("[PHYSICS]: {0} ain't got no boooooooooddy, no body", Name); | 1117 | m_log.DebugFormat("[PHYSICS]: {0} ain't got no boooooooooddy, no body", Name); |
1133 | } | 1118 | } |
1134 | 1119 | ||
1135 | prm.m_interpenetrationcount = 0; | 1120 | prm.m_interpenetrationcount = 0; |
1136 | prm.m_collisionscore = 0; | 1121 | prm.m_collisionscore = 0; |
1137 | prm.m_disabled = false; | 1122 | prm.m_disabled = false; |
1138 | 1123 | ||
1139 | // The body doesn't already have a finite rotation mode set here | 1124 | // The body doesn't already have a finite rotation mode set here |
1140 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) | 1125 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) |
1141 | { | 1126 | { |
1142 | prm.createAMotor(m_angularlock); | 1127 | prm.createAMotor(m_angularlock); |
1143 | } | 1128 | } |
1144 | prm.Body = Body; | 1129 | prm.Body = Body; |
1145 | _parent_scene.ActivatePrim(prm); | 1130 | _parent_scene.ActivatePrim(prm); |
1146 | } | 1131 | } |
1147 | 1132 | ||
1148 | m_collisionCategories |= CollisionCategories.Body; | 1133 | m_collisionCategories |= CollisionCategories.Body; |
1149 | m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); | 1134 | m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); |
1150 | 1135 | ||
1151 | //Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name); | 1136 | //Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name); |
1152 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 1137 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
1153 | //Console.WriteLine(" Post GeomSetCategoryBits 2"); | 1138 | //Console.WriteLine(" Post GeomSetCategoryBits 2"); |
1154 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 1139 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
1155 | |||
1156 | d.Quaternion quat2 = new d.Quaternion(); | ||
1157 | quat2.W = _orientation.W; | ||
1158 | quat2.X = _orientation.X; | ||
1159 | quat2.Y = _orientation.Y; | ||
1160 | quat2.Z = _orientation.Z; | ||
1161 | |||
1162 | d.Matrix3 mat2 = new d.Matrix3(); | ||
1163 | d.RfromQ(out mat2, ref quat2); | ||
1164 | d.GeomSetBody(prim_geom, Body); | ||
1165 | d.GeomSetOffsetWorldPosition(prim_geom, Position.X - pMass.c.X, Position.Y - pMass.c.Y, Position.Z - pMass.c.Z); | ||
1166 | //d.GeomSetOffsetPosition(prim.prim_geom, | ||
1167 | // (Position.X - prm.Position.X) - pMass.c.X, | ||
1168 | // (Position.Y - prm.Position.Y) - pMass.c.Y, | ||
1169 | // (Position.Z - prm.Position.Z) - pMass.c.Z); | ||
1170 | //d.GeomSetOffsetRotation(prim_geom, ref mat2); | ||
1171 | d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z); | ||
1172 | d.BodySetMass(Body, ref pMass); | ||
1173 | |||
1174 | d.BodySetAutoDisableFlag(Body, true); | ||
1175 | d.BodySetAutoDisableSteps(Body, body_autodisable_frames); | ||
1176 | 1140 | ||
1177 | m_interpenetrationcount = 0; | 1141 | d.Quaternion quat2 = new d.Quaternion(); |
1178 | m_collisionscore = 0; | 1142 | quat2.W = _orientation.W; |
1179 | m_disabled = false; | 1143 | quat2.X = _orientation.X; |
1144 | quat2.Y = _orientation.Y; | ||
1145 | quat2.Z = _orientation.Z; | ||
1180 | 1146 | ||
1181 | // The body doesn't already have a finite rotation mode set here | 1147 | d.Matrix3 mat2 = new d.Matrix3(); |
1182 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) | 1148 | d.RfromQ(out mat2, ref quat2); |
1183 | { | 1149 | d.GeomSetBody(prim_geom, Body); |
1184 | createAMotor(m_angularlock); | 1150 | d.GeomSetOffsetWorldPosition(prim_geom, Position.X - pMass.c.X, Position.Y - pMass.c.Y, Position.Z - pMass.c.Z); |
1185 | } | 1151 | //d.GeomSetOffsetPosition(prim.prim_geom, |
1186 | d.BodySetPosition(Body, Position.X, Position.Y, Position.Z); | 1152 | // (Position.X - prm.Position.X) - pMass.c.X, |
1187 | if (m_vehicle.Type != Vehicle.TYPE_NONE) | 1153 | // (Position.Y - prm.Position.Y) - pMass.c.Y, |
1188 | m_vehicle.Enable(Body, _parent_scene); | 1154 | // (Position.Z - prm.Position.Z) - pMass.c.Z); |
1155 | //d.GeomSetOffsetRotation(prim_geom, ref mat2); | ||
1156 | d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z); | ||
1157 | d.BodySetMass(Body, ref pMass); | ||
1189 | 1158 | ||
1190 | _parent_scene.ActivatePrim(this); | 1159 | d.BodySetAutoDisableFlag(Body, true); |
1191 | } | 1160 | d.BodySetAutoDisableSteps(Body, body_autodisable_frames); |
1192 | } | 1161 | |
1162 | m_interpenetrationcount = 0; | ||
1163 | m_collisionscore = 0; | ||
1164 | m_disabled = false; | ||
1165 | |||
1166 | // The body doesn't already have a finite rotation mode set here | ||
1167 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) | ||
1168 | { | ||
1169 | createAMotor(m_angularlock); | ||
1193 | } | 1170 | } |
1171 | |||
1172 | d.BodySetPosition(Body, Position.X, Position.Y, Position.Z); | ||
1173 | |||
1174 | if (m_vehicle.Type != Vehicle.TYPE_NONE) | ||
1175 | m_vehicle.Enable(Body, _parent_scene); | ||
1176 | |||
1177 | _parent_scene.ActivatePrim(this); | ||
1194 | } | 1178 | } |
1195 | } | 1179 | } |
1196 | 1180 | ||
1197 | private void ChildSetGeom(OdePrim odePrim) | 1181 | private void ChildSetGeom(OdePrim odePrim) |
1198 | { | 1182 | { |
1183 | // m_log.DebugFormat( | ||
1184 | // "[ODE PRIM]: ChildSetGeom {0} {1} for {2} {3}", odePrim.Name, odePrim.LocalID, Name, LocalID); | ||
1185 | |||
1199 | //if (IsPhysical && Body != IntPtr.Zero) | 1186 | //if (IsPhysical && Body != IntPtr.Zero) |
1200 | lock (childrenPrim) | 1187 | lock (childrenPrim) |
1201 | { | 1188 | { |
@@ -1210,12 +1197,14 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1210 | //prm.childPrim = false; | 1197 | //prm.childPrim = false; |
1211 | } | 1198 | } |
1212 | } | 1199 | } |
1200 | |||
1213 | disableBody(); | 1201 | disableBody(); |
1214 | 1202 | ||
1215 | if (Body != IntPtr.Zero) | 1203 | // Spurious - Body == IntPtr.Zero after disableBody() |
1216 | { | 1204 | // if (Body != IntPtr.Zero) |
1217 | _parent_scene.DeactivatePrim(this); | 1205 | // { |
1218 | } | 1206 | // _parent_scene.DeactivatePrim(this); |
1207 | // } | ||
1219 | 1208 | ||
1220 | lock (childrenPrim) | 1209 | lock (childrenPrim) |
1221 | { | 1210 | { |
@@ -1229,6 +1218,9 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1229 | 1218 | ||
1230 | private void ChildDelink(OdePrim odePrim) | 1219 | private void ChildDelink(OdePrim odePrim) |
1231 | { | 1220 | { |
1221 | // m_log.DebugFormat( | ||
1222 | // "[ODE PRIM]: Delinking prim {0} {1} from {2} {3}", odePrim.Name, odePrim.LocalID, Name, LocalID); | ||
1223 | |||
1232 | // Okay, we have a delinked child.. need to rebuild the body. | 1224 | // Okay, we have a delinked child.. need to rebuild the body. |
1233 | lock (childrenPrim) | 1225 | lock (childrenPrim) |
1234 | { | 1226 | { |
@@ -1243,6 +1235,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1243 | //prm.childPrim = false; | 1235 | //prm.childPrim = false; |
1244 | } | 1236 | } |
1245 | } | 1237 | } |
1238 | |||
1246 | disableBody(); | 1239 | disableBody(); |
1247 | 1240 | ||
1248 | lock (childrenPrim) | 1241 | lock (childrenPrim) |
@@ -1251,10 +1244,11 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1251 | childrenPrim.Remove(odePrim); | 1244 | childrenPrim.Remove(odePrim); |
1252 | } | 1245 | } |
1253 | 1246 | ||
1254 | if (Body != IntPtr.Zero) | 1247 | // Spurious - Body == IntPtr.Zero after disableBody() |
1255 | { | 1248 | // if (Body != IntPtr.Zero) |
1256 | _parent_scene.DeactivatePrim(this); | 1249 | // { |
1257 | } | 1250 | // _parent_scene.DeactivatePrim(this); |
1251 | // } | ||
1258 | 1252 | ||
1259 | lock (childrenPrim) | 1253 | lock (childrenPrim) |
1260 | { | 1254 | { |
@@ -1303,11 +1297,8 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1303 | disableBodySoft(); | 1297 | disableBodySoft(); |
1304 | } | 1298 | } |
1305 | 1299 | ||
1306 | if (prim_geom != IntPtr.Zero) | 1300 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
1307 | { | 1301 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
1308 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
1309 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
1310 | } | ||
1311 | 1302 | ||
1312 | if (IsPhysical) | 1303 | if (IsPhysical) |
1313 | { | 1304 | { |
@@ -1328,11 +1319,8 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1328 | if (m_collidesWater) | 1319 | if (m_collidesWater) |
1329 | m_collisionFlags |= CollisionCategories.Water; | 1320 | m_collisionFlags |= CollisionCategories.Water; |
1330 | 1321 | ||
1331 | if (prim_geom != IntPtr.Zero) | 1322 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
1332 | { | 1323 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
1333 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
1334 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
1335 | } | ||
1336 | 1324 | ||
1337 | if (IsPhysical) | 1325 | if (IsPhysical) |
1338 | { | 1326 | { |
@@ -1472,6 +1460,9 @@ Console.WriteLine("CreateGeom:"); | |||
1472 | } | 1460 | } |
1473 | else | 1461 | else |
1474 | { | 1462 | { |
1463 | m_log.WarnFormat( | ||
1464 | "[ODE PRIM]: Called RemoveGeom() on {0} {1} where geometry was already null.", Name, LocalID); | ||
1465 | |||
1475 | return false; | 1466 | return false; |
1476 | } | 1467 | } |
1477 | } | 1468 | } |
@@ -1505,16 +1496,13 @@ Console.WriteLine("changeadd 1"); | |||
1505 | #endif | 1496 | #endif |
1506 | CreateGeom(m_targetSpace, mesh); | 1497 | CreateGeom(m_targetSpace, mesh); |
1507 | 1498 | ||
1508 | if (prim_geom != IntPtr.Zero) | 1499 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
1509 | { | 1500 | d.Quaternion myrot = new d.Quaternion(); |
1510 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 1501 | myrot.X = _orientation.X; |
1511 | d.Quaternion myrot = new d.Quaternion(); | 1502 | myrot.Y = _orientation.Y; |
1512 | myrot.X = _orientation.X; | 1503 | myrot.Z = _orientation.Z; |
1513 | myrot.Y = _orientation.Y; | 1504 | myrot.W = _orientation.W; |
1514 | myrot.Z = _orientation.Z; | 1505 | d.GeomSetQuaternion(prim_geom, ref myrot); |
1515 | myrot.W = _orientation.W; | ||
1516 | d.GeomSetQuaternion(prim_geom, ref myrot); | ||
1517 | } | ||
1518 | 1506 | ||
1519 | if (IsPhysical && Body == IntPtr.Zero) | 1507 | if (IsPhysical && Body == IntPtr.Zero) |
1520 | enableBody(); | 1508 | enableBody(); |
@@ -1579,24 +1567,20 @@ Console.WriteLine(" JointCreateFixed"); | |||
1579 | //m_log.Debug("[BUG]: race!"); | 1567 | //m_log.Debug("[BUG]: race!"); |
1580 | //} | 1568 | //} |
1581 | } | 1569 | } |
1582 | else | ||
1583 | { | ||
1584 | // string primScenAvatarIn = _parent_scene.whichspaceamIin(_position); | ||
1585 | // int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position); | ||
1586 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); | ||
1587 | 1570 | ||
1588 | IntPtr tempspace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace); | 1571 | // string primScenAvatarIn = _parent_scene.whichspaceamIin(_position); |
1589 | m_targetSpace = tempspace; | 1572 | // int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position); |
1573 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); | ||
1574 | |||
1575 | IntPtr tempspace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace); | ||
1576 | m_targetSpace = tempspace; | ||
1590 | 1577 | ||
1591 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); | 1578 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); |
1592 | if (prim_geom != IntPtr.Zero) | 1579 | |
1593 | { | 1580 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
1594 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | ||
1595 | 1581 | ||
1596 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); | 1582 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); |
1597 | d.SpaceAdd(m_targetSpace, prim_geom); | 1583 | d.SpaceAdd(m_targetSpace, prim_geom); |
1598 | } | ||
1599 | } | ||
1600 | 1584 | ||
1601 | changeSelectedStatus(); | 1585 | changeSelectedStatus(); |
1602 | 1586 | ||
@@ -2047,18 +2031,16 @@ Console.WriteLine(" JointCreateFixed"); | |||
2047 | { | 2031 | { |
2048 | m_collidesWater = m_taintCollidesWater; | 2032 | m_collidesWater = m_taintCollidesWater; |
2049 | 2033 | ||
2050 | if (prim_geom != IntPtr.Zero) | 2034 | if (m_collidesWater) |
2051 | { | 2035 | { |
2052 | if (m_collidesWater) | 2036 | m_collisionFlags |= CollisionCategories.Water; |
2053 | { | ||
2054 | m_collisionFlags |= CollisionCategories.Water; | ||
2055 | } | ||
2056 | else | ||
2057 | { | ||
2058 | m_collisionFlags &= ~CollisionCategories.Water; | ||
2059 | } | ||
2060 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
2061 | } | 2037 | } |
2038 | else | ||
2039 | { | ||
2040 | m_collisionFlags &= ~CollisionCategories.Water; | ||
2041 | } | ||
2042 | |||
2043 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
2062 | } | 2044 | } |
2063 | 2045 | ||
2064 | /// <summary> | 2046 | /// <summary> |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 842ff91..409b27b 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -2226,7 +2226,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2226 | /// <param name="prim"></param> | 2226 | /// <param name="prim"></param> |
2227 | internal void RemovePrimThreadLocked(OdePrim prim) | 2227 | internal void RemovePrimThreadLocked(OdePrim prim) |
2228 | { | 2228 | { |
2229 | //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); | 2229 | // m_log.DebugFormat("[ODE SCENE]: Removing physical prim {0} {1}", prim.Name, prim.LocalID); |
2230 | |||
2230 | lock (prim) | 2231 | lock (prim) |
2231 | { | 2232 | { |
2232 | RemoveCollisionEventReporting(prim); | 2233 | RemoveCollisionEventReporting(prim); |
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs index bb5bacc..2027ca6 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs | |||
@@ -27,17 +27,22 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using OpenMetaverse; | 29 | using OpenMetaverse; |
30 | using OpenSim.Framework; | ||
30 | using OpenSim.Region.Framework.Scenes; | 31 | using OpenSim.Region.Framework.Scenes; |
31 | 32 | ||
32 | |||
33 | namespace OpenSim.Region.ScriptEngine.Interfaces | 33 | namespace OpenSim.Region.ScriptEngine.Interfaces |
34 | { | 34 | { |
35 | public interface IScriptApi | 35 | public interface IScriptApi |
36 | { | 36 | { |
37 | // | 37 | /// <summary> |
38 | // Each API has an identifier, which is used to load the | 38 | /// Initialize the API |
39 | // proper runtime assembly at load time. | 39 | /// </summary> |
40 | // | 40 | /// <remarks> |
41 | void Initialize(IScriptEngine engine, SceneObjectPart part, uint localID, UUID item); | 41 | /// Each API has an identifier, which is used to load the |
42 | /// proper runtime assembly at load time. | ||
43 | /// <param name='engine'>/param> | ||
44 | /// <param name='part'></param> | ||
45 | /// <param name='item'></param> | ||
46 | void Initialize(IScriptEngine engine, SceneObjectPart part, TaskInventoryItem item); | ||
42 | } | 47 | } |
43 | } | 48 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs index 47ed6ba..684138f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs | |||
@@ -29,42 +29,43 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | ||
32 | using OpenSim.Region.ScriptEngine.Interfaces; | 33 | using OpenSim.Region.ScriptEngine.Interfaces; |
33 | 34 | ||
34 | namespace OpenSim.Region.ScriptEngine.Shared.Api | 35 | namespace OpenSim.Region.ScriptEngine.Shared.Api |
35 | { | 36 | { |
36 | public class ApiManager | 37 | public class ApiManager |
37 | { | 38 | { |
39 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
40 | |||
38 | private Dictionary<string,Type> m_Apis = new Dictionary<string,Type>(); | 41 | private Dictionary<string,Type> m_Apis = new Dictionary<string,Type>(); |
39 | 42 | ||
40 | public string[] GetApis() | 43 | public string[] GetApis() |
41 | { | 44 | { |
42 | if (m_Apis.Count > 0) | 45 | if (m_Apis.Count <= 0) |
43 | { | 46 | { |
44 | List<string> l = new List<string>(m_Apis.Keys); | 47 | Assembly a = Assembly.GetExecutingAssembly(); |
45 | return l.ToArray(); | ||
46 | } | ||
47 | 48 | ||
48 | Assembly a = Assembly.GetExecutingAssembly(); | 49 | Type[] types = a.GetExportedTypes(); |
49 | 50 | ||
50 | Type[] types = a.GetExportedTypes(); | 51 | foreach (Type t in types) |
51 | |||
52 | foreach (Type t in types) | ||
53 | { | ||
54 | string name = t.ToString(); | ||
55 | int idx = name.LastIndexOf('.'); | ||
56 | if (idx != -1) | ||
57 | name = name.Substring(idx+1); | ||
58 | |||
59 | if (name.EndsWith("_Api")) | ||
60 | { | 52 | { |
61 | name = name.Substring(0, name.Length - 4); | 53 | string name = t.ToString(); |
62 | m_Apis[name] = t; | 54 | int idx = name.LastIndexOf('.'); |
55 | if (idx != -1) | ||
56 | name = name.Substring(idx+1); | ||
57 | |||
58 | if (name.EndsWith("_Api")) | ||
59 | { | ||
60 | name = name.Substring(0, name.Length - 4); | ||
61 | m_Apis[name] = t; | ||
62 | } | ||
63 | } | 63 | } |
64 | } | 64 | } |
65 | 65 | ||
66 | List<string> ret = new List<string>(m_Apis.Keys); | 66 | // m_log.DebugFormat("[API MANAGER]: Found {0} apis", m_Apis.Keys.Count); |
67 | return ret.ToArray(); | 67 | |
68 | return new List<string>(m_Apis.Keys).ToArray(); | ||
68 | } | 69 | } |
69 | 70 | ||
70 | public IScriptApi CreateApi(string api) | 71 | public IScriptApi CreateApi(string api) |
@@ -76,4 +77,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
76 | return ret; | 77 | return ret; |
77 | } | 78 | } |
78 | } | 79 | } |
79 | } | 80 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs index 489c1c6..b5fa6de 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs | |||
@@ -59,16 +59,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
59 | { | 59 | { |
60 | internal IScriptEngine m_ScriptEngine; | 60 | internal IScriptEngine m_ScriptEngine; |
61 | internal SceneObjectPart m_host; | 61 | internal SceneObjectPart m_host; |
62 | internal uint m_localID; | 62 | internal TaskInventoryItem m_item; |
63 | internal UUID m_itemID; | ||
64 | internal bool m_CMFunctionsEnabled = false; | 63 | internal bool m_CMFunctionsEnabled = false; |
65 | 64 | ||
66 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 65 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
67 | { | 66 | { |
68 | m_ScriptEngine = ScriptEngine; | 67 | m_ScriptEngine = ScriptEngine; |
69 | m_host = host; | 68 | m_host = host; |
70 | m_localID = localID; | 69 | m_item = item; |
71 | m_itemID = itemID; | ||
72 | 70 | ||
73 | if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false)) | 71 | if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false)) |
74 | m_CMFunctionsEnabled = true; | 72 | m_CMFunctionsEnabled = true; |
@@ -95,7 +93,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
95 | public string cmDetectedCountry(int number) | 93 | public string cmDetectedCountry(int number) |
96 | { | 94 | { |
97 | m_host.AddScriptLPS(1); | 95 | m_host.AddScriptLPS(1); |
98 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 96 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
99 | if (detectedParams == null) | 97 | if (detectedParams == null) |
100 | return String.Empty; | 98 | return String.Empty; |
101 | return detectedParams.Country; | 99 | return detectedParams.Country; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index edabc2e..8072e72 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -88,8 +88,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
88 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 88 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
89 | protected IScriptEngine m_ScriptEngine; | 89 | protected IScriptEngine m_ScriptEngine; |
90 | protected SceneObjectPart m_host; | 90 | protected SceneObjectPart m_host; |
91 | protected uint m_localID; | 91 | |
92 | protected UUID m_itemID; | 92 | /// <summary> |
93 | /// The item that hosts this script | ||
94 | /// </summary> | ||
95 | protected TaskInventoryItem m_item; | ||
96 | |||
93 | protected bool throwErrorOnNotImplemented = true; | 97 | protected bool throwErrorOnNotImplemented = true; |
94 | protected AsyncCommandManager AsyncCommands = null; | 98 | protected AsyncCommandManager AsyncCommands = null; |
95 | protected float m_ScriptDelayFactor = 1.0f; | 99 | protected float m_ScriptDelayFactor = 1.0f; |
@@ -107,11 +111,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
107 | protected IUrlModule m_UrlModule = null; | 111 | protected IUrlModule m_UrlModule = null; |
108 | protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = | 112 | protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = |
109 | new Dictionary<UUID, UserInfoCacheEntry>(); | 113 | new Dictionary<UUID, UserInfoCacheEntry>(); |
114 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. | ||
110 | 115 | ||
111 | protected Timer m_ShoutSayTimer; | 116 | protected Timer m_ShoutSayTimer; |
112 | protected int m_SayShoutCount = 0; | 117 | protected int m_SayShoutCount = 0; |
113 | 118 | ||
114 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 119 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
115 | { | 120 | { |
116 | m_ShoutSayTimer = new Timer(1000); | 121 | m_ShoutSayTimer = new Timer(1000); |
117 | m_ShoutSayTimer.Elapsed += SayShoutTimerElapsed; | 122 | m_ShoutSayTimer.Elapsed += SayShoutTimerElapsed; |
@@ -120,10 +125,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
120 | 125 | ||
121 | m_ScriptEngine = ScriptEngine; | 126 | m_ScriptEngine = ScriptEngine; |
122 | m_host = host; | 127 | m_host = host; |
123 | m_localID = localID; | 128 | m_item = item; |
124 | m_itemID = itemID; | ||
125 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); | 129 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); |
126 | 130 | ||
131 | LoadLimits(); // read script limits from config. | ||
132 | |||
133 | m_TransferModule = | ||
134 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); | ||
135 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); | ||
136 | |||
137 | AsyncCommands = new AsyncCommandManager(ScriptEngine); | ||
138 | } | ||
139 | |||
140 | /* load configuration items that affect script, object and run-time behavior. */ | ||
141 | private void LoadLimits() | ||
142 | { | ||
127 | m_ScriptDelayFactor = | 143 | m_ScriptDelayFactor = |
128 | m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); | 144 | m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); |
129 | m_ScriptDistanceFactor = | 145 | m_ScriptDistanceFactor = |
@@ -136,12 +152,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
136 | m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); | 152 | m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); |
137 | if (m_notecardLineReadCharsMax > 65535) | 153 | if (m_notecardLineReadCharsMax > 65535) |
138 | m_notecardLineReadCharsMax = 65535; | 154 | m_notecardLineReadCharsMax = 65535; |
139 | 155 | // load limits for particular subsystems. | |
140 | m_TransferModule = | 156 | IConfig SMTPConfig; |
141 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); | 157 | if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) { |
142 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); | 158 | // there's an smtp config, so load in the snooze time. |
143 | 159 | EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); | |
144 | AsyncCommands = new AsyncCommandManager(ScriptEngine); | 160 | } |
145 | } | 161 | } |
146 | 162 | ||
147 | public override Object InitializeLifetimeService() | 163 | public override Object InitializeLifetimeService() |
@@ -173,7 +189,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
173 | [DebuggerNonUserCode] | 189 | [DebuggerNonUserCode] |
174 | public void state(string newState) | 190 | public void state(string newState) |
175 | { | 191 | { |
176 | m_ScriptEngine.SetState(m_itemID, newState); | 192 | m_ScriptEngine.SetState(m_item.ItemID, newState); |
177 | } | 193 | } |
178 | 194 | ||
179 | /// <summary> | 195 | /// <summary> |
@@ -184,7 +200,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
184 | public void llResetScript() | 200 | public void llResetScript() |
185 | { | 201 | { |
186 | m_host.AddScriptLPS(1); | 202 | m_host.AddScriptLPS(1); |
187 | m_ScriptEngine.ApiResetScript(m_itemID); | 203 | m_ScriptEngine.ApiResetScript(m_item.ItemID); |
188 | } | 204 | } |
189 | 205 | ||
190 | public void llResetOtherScript(string name) | 206 | public void llResetOtherScript(string name) |
@@ -336,30 +352,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
336 | } | 352 | } |
337 | } | 353 | } |
338 | 354 | ||
339 | protected UUID InventorySelf() | ||
340 | { | ||
341 | UUID invItemID = new UUID(); | ||
342 | bool unlock = false; | ||
343 | if (!m_host.TaskInventory.IsReadLockedByMe()) | ||
344 | { | ||
345 | m_host.TaskInventory.LockItemsForRead(true); | ||
346 | unlock = true; | ||
347 | } | ||
348 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
349 | { | ||
350 | if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) | ||
351 | { | ||
352 | invItemID = inv.Key; | ||
353 | break; | ||
354 | } | ||
355 | } | ||
356 | if (unlock) | ||
357 | { | ||
358 | m_host.TaskInventory.LockItemsForRead(false); | ||
359 | } | ||
360 | return invItemID; | ||
361 | } | ||
362 | |||
363 | protected UUID InventoryKey(string name, int type) | 355 | protected UUID InventoryKey(string name, int type) |
364 | { | 356 | { |
365 | m_host.AddScriptLPS(1); | 357 | m_host.AddScriptLPS(1); |
@@ -941,20 +933,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
941 | 933 | ||
942 | public void llRegionSayTo(string target, int channel, string msg) | 934 | public void llRegionSayTo(string target, int channel, string msg) |
943 | { | 935 | { |
944 | string error = String.Empty; | ||
945 | |||
946 | if (msg.Length > 1023) | 936 | if (msg.Length > 1023) |
947 | msg = msg.Substring(0, 1023); | 937 | msg = msg.Substring(0, 1023); |
948 | 938 | ||
949 | m_host.AddScriptLPS(1); | 939 | m_host.AddScriptLPS(1); |
950 | 940 | ||
941 | if (channel == ScriptBaseClass.DEBUG_CHANNEL) | ||
942 | { | ||
943 | return; | ||
944 | } | ||
945 | |||
951 | UUID TargetID; | 946 | UUID TargetID; |
952 | UUID.TryParse(target, out TargetID); | 947 | UUID.TryParse(target, out TargetID); |
953 | 948 | ||
954 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 949 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
955 | if (wComm != null) | 950 | if (wComm != null) |
956 | if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error)) | 951 | wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg); |
957 | LSLError(error); | ||
958 | } | 952 | } |
959 | 953 | ||
960 | public LSL_Integer llListen(int channelID, string name, string ID, string msg) | 954 | public LSL_Integer llListen(int channelID, string name, string ID, string msg) |
@@ -964,7 +958,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
964 | UUID.TryParse(ID, out keyID); | 958 | UUID.TryParse(ID, out keyID); |
965 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 959 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
966 | if (wComm != null) | 960 | if (wComm != null) |
967 | return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, keyID, msg); | 961 | return wComm.Listen(m_host.LocalId, m_item.ItemID, m_host.UUID, channelID, name, keyID, msg); |
968 | else | 962 | else |
969 | return -1; | 963 | return -1; |
970 | } | 964 | } |
@@ -974,7 +968,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
974 | m_host.AddScriptLPS(1); | 968 | m_host.AddScriptLPS(1); |
975 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 969 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
976 | if (wComm != null) | 970 | if (wComm != null) |
977 | wComm.ListenControl(m_itemID, number, active); | 971 | wComm.ListenControl(m_item.ItemID, number, active); |
978 | } | 972 | } |
979 | 973 | ||
980 | public void llListenRemove(int number) | 974 | public void llListenRemove(int number) |
@@ -982,7 +976,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
982 | m_host.AddScriptLPS(1); | 976 | m_host.AddScriptLPS(1); |
983 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 977 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
984 | if (wComm != null) | 978 | if (wComm != null) |
985 | wComm.ListenRemove(m_itemID, number); | 979 | wComm.ListenRemove(m_item.ItemID, number); |
986 | } | 980 | } |
987 | 981 | ||
988 | public void llSensor(string name, string id, int type, double range, double arc) | 982 | public void llSensor(string name, string id, int type, double range, double arc) |
@@ -991,7 +985,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
991 | UUID keyID = UUID.Zero; | 985 | UUID keyID = UUID.Zero; |
992 | UUID.TryParse(id, out keyID); | 986 | UUID.TryParse(id, out keyID); |
993 | 987 | ||
994 | AsyncCommands.SensorRepeatPlugin.SenseOnce(m_localID, m_itemID, name, keyID, type, range, arc, m_host); | 988 | AsyncCommands.SensorRepeatPlugin.SenseOnce(m_host.LocalId, m_item.ItemID, name, keyID, type, range, arc, m_host); |
995 | } | 989 | } |
996 | 990 | ||
997 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) | 991 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) |
@@ -1000,13 +994,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1000 | UUID keyID = UUID.Zero; | 994 | UUID keyID = UUID.Zero; |
1001 | UUID.TryParse(id, out keyID); | 995 | UUID.TryParse(id, out keyID); |
1002 | 996 | ||
1003 | AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host); | 997 | AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_host.LocalId, m_item.ItemID, name, keyID, type, range, arc, rate, m_host); |
1004 | } | 998 | } |
1005 | 999 | ||
1006 | public void llSensorRemove() | 1000 | public void llSensorRemove() |
1007 | { | 1001 | { |
1008 | m_host.AddScriptLPS(1); | 1002 | m_host.AddScriptLPS(1); |
1009 | AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_localID, m_itemID); | 1003 | AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_host.LocalId, m_item.ItemID); |
1010 | } | 1004 | } |
1011 | 1005 | ||
1012 | public string resolveName(UUID objecUUID) | 1006 | public string resolveName(UUID objecUUID) |
@@ -1047,7 +1041,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1047 | public LSL_String llDetectedName(int number) | 1041 | public LSL_String llDetectedName(int number) |
1048 | { | 1042 | { |
1049 | m_host.AddScriptLPS(1); | 1043 | m_host.AddScriptLPS(1); |
1050 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1044 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1051 | if (detectedParams == null) | 1045 | if (detectedParams == null) |
1052 | return String.Empty; | 1046 | return String.Empty; |
1053 | return detectedParams.Name; | 1047 | return detectedParams.Name; |
@@ -1056,7 +1050,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1056 | public LSL_String llDetectedKey(int number) | 1050 | public LSL_String llDetectedKey(int number) |
1057 | { | 1051 | { |
1058 | m_host.AddScriptLPS(1); | 1052 | m_host.AddScriptLPS(1); |
1059 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1053 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1060 | if (detectedParams == null) | 1054 | if (detectedParams == null) |
1061 | return String.Empty; | 1055 | return String.Empty; |
1062 | return detectedParams.Key.ToString(); | 1056 | return detectedParams.Key.ToString(); |
@@ -1065,7 +1059,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1065 | public LSL_String llDetectedOwner(int number) | 1059 | public LSL_String llDetectedOwner(int number) |
1066 | { | 1060 | { |
1067 | m_host.AddScriptLPS(1); | 1061 | m_host.AddScriptLPS(1); |
1068 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1062 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1069 | if (detectedParams == null) | 1063 | if (detectedParams == null) |
1070 | return String.Empty; | 1064 | return String.Empty; |
1071 | return detectedParams.Owner.ToString(); | 1065 | return detectedParams.Owner.ToString(); |
@@ -1074,7 +1068,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1074 | public LSL_Integer llDetectedType(int number) | 1068 | public LSL_Integer llDetectedType(int number) |
1075 | { | 1069 | { |
1076 | m_host.AddScriptLPS(1); | 1070 | m_host.AddScriptLPS(1); |
1077 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1071 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1078 | if (detectedParams == null) | 1072 | if (detectedParams == null) |
1079 | return 0; | 1073 | return 0; |
1080 | return new LSL_Integer(detectedParams.Type); | 1074 | return new LSL_Integer(detectedParams.Type); |
@@ -1083,7 +1077,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1083 | public LSL_Vector llDetectedPos(int number) | 1077 | public LSL_Vector llDetectedPos(int number) |
1084 | { | 1078 | { |
1085 | m_host.AddScriptLPS(1); | 1079 | m_host.AddScriptLPS(1); |
1086 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1080 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1087 | if (detectedParams == null) | 1081 | if (detectedParams == null) |
1088 | return new LSL_Vector(); | 1082 | return new LSL_Vector(); |
1089 | return detectedParams.Position; | 1083 | return detectedParams.Position; |
@@ -1092,7 +1086,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1092 | public LSL_Vector llDetectedVel(int number) | 1086 | public LSL_Vector llDetectedVel(int number) |
1093 | { | 1087 | { |
1094 | m_host.AddScriptLPS(1); | 1088 | m_host.AddScriptLPS(1); |
1095 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1089 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1096 | if (detectedParams == null) | 1090 | if (detectedParams == null) |
1097 | return new LSL_Vector(); | 1091 | return new LSL_Vector(); |
1098 | return detectedParams.Velocity; | 1092 | return detectedParams.Velocity; |
@@ -1101,7 +1095,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1101 | public LSL_Vector llDetectedGrab(int number) | 1095 | public LSL_Vector llDetectedGrab(int number) |
1102 | { | 1096 | { |
1103 | m_host.AddScriptLPS(1); | 1097 | m_host.AddScriptLPS(1); |
1104 | DetectParams parms = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1098 | DetectParams parms = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1105 | if (parms == null) | 1099 | if (parms == null) |
1106 | return new LSL_Vector(0, 0, 0); | 1100 | return new LSL_Vector(0, 0, 0); |
1107 | 1101 | ||
@@ -1111,7 +1105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1111 | public LSL_Rotation llDetectedRot(int number) | 1105 | public LSL_Rotation llDetectedRot(int number) |
1112 | { | 1106 | { |
1113 | m_host.AddScriptLPS(1); | 1107 | m_host.AddScriptLPS(1); |
1114 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1108 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1115 | if (detectedParams == null) | 1109 | if (detectedParams == null) |
1116 | return new LSL_Rotation(); | 1110 | return new LSL_Rotation(); |
1117 | return detectedParams.Rotation; | 1111 | return detectedParams.Rotation; |
@@ -1120,7 +1114,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1120 | public LSL_Integer llDetectedGroup(int number) | 1114 | public LSL_Integer llDetectedGroup(int number) |
1121 | { | 1115 | { |
1122 | m_host.AddScriptLPS(1); | 1116 | m_host.AddScriptLPS(1); |
1123 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1117 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1124 | if (detectedParams == null) | 1118 | if (detectedParams == null) |
1125 | return new LSL_Integer(0); | 1119 | return new LSL_Integer(0); |
1126 | if (m_host.GroupID == detectedParams.Group) | 1120 | if (m_host.GroupID == detectedParams.Group) |
@@ -1131,7 +1125,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1131 | public LSL_Integer llDetectedLinkNumber(int number) | 1125 | public LSL_Integer llDetectedLinkNumber(int number) |
1132 | { | 1126 | { |
1133 | m_host.AddScriptLPS(1); | 1127 | m_host.AddScriptLPS(1); |
1134 | DetectParams parms = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1128 | DetectParams parms = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1135 | if (parms == null) | 1129 | if (parms == null) |
1136 | return new LSL_Integer(0); | 1130 | return new LSL_Integer(0); |
1137 | 1131 | ||
@@ -1144,7 +1138,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1144 | public LSL_Vector llDetectedTouchBinormal(int index) | 1138 | public LSL_Vector llDetectedTouchBinormal(int index) |
1145 | { | 1139 | { |
1146 | m_host.AddScriptLPS(1); | 1140 | m_host.AddScriptLPS(1); |
1147 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); | 1141 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); |
1148 | if (detectedParams == null) | 1142 | if (detectedParams == null) |
1149 | return new LSL_Vector(); | 1143 | return new LSL_Vector(); |
1150 | return detectedParams.TouchBinormal; | 1144 | return detectedParams.TouchBinormal; |
@@ -1156,7 +1150,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1156 | public LSL_Integer llDetectedTouchFace(int index) | 1150 | public LSL_Integer llDetectedTouchFace(int index) |
1157 | { | 1151 | { |
1158 | m_host.AddScriptLPS(1); | 1152 | m_host.AddScriptLPS(1); |
1159 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); | 1153 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); |
1160 | if (detectedParams == null) | 1154 | if (detectedParams == null) |
1161 | return new LSL_Integer(-1); | 1155 | return new LSL_Integer(-1); |
1162 | return new LSL_Integer(detectedParams.TouchFace); | 1156 | return new LSL_Integer(detectedParams.TouchFace); |
@@ -1168,7 +1162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1168 | public LSL_Vector llDetectedTouchNormal(int index) | 1162 | public LSL_Vector llDetectedTouchNormal(int index) |
1169 | { | 1163 | { |
1170 | m_host.AddScriptLPS(1); | 1164 | m_host.AddScriptLPS(1); |
1171 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); | 1165 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); |
1172 | if (detectedParams == null) | 1166 | if (detectedParams == null) |
1173 | return new LSL_Vector(); | 1167 | return new LSL_Vector(); |
1174 | return detectedParams.TouchNormal; | 1168 | return detectedParams.TouchNormal; |
@@ -1180,7 +1174,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1180 | public LSL_Vector llDetectedTouchPos(int index) | 1174 | public LSL_Vector llDetectedTouchPos(int index) |
1181 | { | 1175 | { |
1182 | m_host.AddScriptLPS(1); | 1176 | m_host.AddScriptLPS(1); |
1183 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); | 1177 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); |
1184 | if (detectedParams == null) | 1178 | if (detectedParams == null) |
1185 | return new LSL_Vector(); | 1179 | return new LSL_Vector(); |
1186 | return detectedParams.TouchPos; | 1180 | return detectedParams.TouchPos; |
@@ -1192,7 +1186,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1192 | public LSL_Vector llDetectedTouchST(int index) | 1186 | public LSL_Vector llDetectedTouchST(int index) |
1193 | { | 1187 | { |
1194 | m_host.AddScriptLPS(1); | 1188 | m_host.AddScriptLPS(1); |
1195 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); | 1189 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); |
1196 | if (detectedParams == null) | 1190 | if (detectedParams == null) |
1197 | return new LSL_Vector(-1.0, -1.0, 0.0); | 1191 | return new LSL_Vector(-1.0, -1.0, 0.0); |
1198 | return detectedParams.TouchST; | 1192 | return detectedParams.TouchST; |
@@ -1204,7 +1198,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1204 | public LSL_Vector llDetectedTouchUV(int index) | 1198 | public LSL_Vector llDetectedTouchUV(int index) |
1205 | { | 1199 | { |
1206 | m_host.AddScriptLPS(1); | 1200 | m_host.AddScriptLPS(1); |
1207 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); | 1201 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); |
1208 | if (detectedParams == null) | 1202 | if (detectedParams == null) |
1209 | return new LSL_Vector(-1.0, -1.0, 0.0); | 1203 | return new LSL_Vector(-1.0, -1.0, 0.0); |
1210 | return detectedParams.TouchUV; | 1204 | return detectedParams.TouchUV; |
@@ -1910,6 +1904,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1910 | rgb.y = texcolor.G; | 1904 | rgb.y = texcolor.G; |
1911 | rgb.z = texcolor.B; | 1905 | rgb.z = texcolor.B; |
1912 | return rgb; | 1906 | return rgb; |
1907 | |||
1913 | } | 1908 | } |
1914 | else | 1909 | else |
1915 | { | 1910 | { |
@@ -2948,20 +2943,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2948 | 2943 | ||
2949 | public LSL_Integer llGiveMoney(string destination, int amount) | 2944 | public LSL_Integer llGiveMoney(string destination, int amount) |
2950 | { | 2945 | { |
2951 | UUID invItemID=InventorySelf(); | ||
2952 | if (invItemID == UUID.Zero) | ||
2953 | return 0; | ||
2954 | |||
2955 | m_host.AddScriptLPS(1); | 2946 | m_host.AddScriptLPS(1); |
2956 | 2947 | ||
2957 | m_host.TaskInventory.LockItemsForRead(true); | 2948 | if (m_item.PermsGranter == UUID.Zero) |
2958 | TaskInventoryItem item = m_host.TaskInventory[invItemID]; | ||
2959 | m_host.TaskInventory.LockItemsForRead(false); | ||
2960 | |||
2961 | if (item.PermsGranter == UUID.Zero) | ||
2962 | return 0; | 2949 | return 0; |
2963 | 2950 | ||
2964 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) | 2951 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) |
2965 | { | 2952 | { |
2966 | LSLError("No permissions to give money"); | 2953 | LSLError("No permissions to give money"); |
2967 | return 0; | 2954 | return 0; |
@@ -3148,11 +3135,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3148 | sec = m_MinTimerInterval; | 3135 | sec = m_MinTimerInterval; |
3149 | m_host.AddScriptLPS(1); | 3136 | m_host.AddScriptLPS(1); |
3150 | // Setting timer repeat | 3137 | // Setting timer repeat |
3151 | AsyncCommands.TimerPlugin.SetTimerEvent(m_localID, m_itemID, sec); | 3138 | AsyncCommands.TimerPlugin.SetTimerEvent(m_host.LocalId, m_item.ItemID, sec); |
3152 | } | 3139 | } |
3153 | 3140 | ||
3154 | public virtual void llSleep(double sec) | 3141 | public virtual void llSleep(double sec) |
3155 | { | 3142 | { |
3143 | // m_log.Info("llSleep snoozing " + sec + "s."); | ||
3156 | m_host.AddScriptLPS(1); | 3144 | m_host.AddScriptLPS(1); |
3157 | Thread.Sleep((int)(sec * 1000)); | 3145 | Thread.Sleep((int)(sec * 1000)); |
3158 | } | 3146 | } |
@@ -3211,29 +3199,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3211 | 3199 | ||
3212 | public void llTakeControls(int controls, int accept, int pass_on) | 3200 | public void llTakeControls(int controls, int accept, int pass_on) |
3213 | { | 3201 | { |
3214 | TaskInventoryItem item; | 3202 | if (m_item.PermsGranter != UUID.Zero) |
3215 | |||
3216 | m_host.TaskInventory.LockItemsForRead(true); | ||
3217 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3218 | { | ||
3219 | m_host.TaskInventory.LockItemsForRead(false); | ||
3220 | return; | ||
3221 | } | ||
3222 | else | ||
3223 | { | ||
3224 | item = m_host.TaskInventory[InventorySelf()]; | ||
3225 | } | ||
3226 | m_host.TaskInventory.LockItemsForRead(false); | ||
3227 | |||
3228 | if (item.PermsGranter != UUID.Zero) | ||
3229 | { | 3203 | { |
3230 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); | 3204 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
3231 | 3205 | ||
3232 | if (presence != null) | 3206 | if (presence != null) |
3233 | { | 3207 | { |
3234 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) | 3208 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) |
3235 | { | 3209 | { |
3236 | presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_itemID); | 3210 | presence.RegisterControlEventsToScript(controls, accept, pass_on, m_host.LocalId, m_item.ItemID); |
3237 | } | 3211 | } |
3238 | } | 3212 | } |
3239 | } | 3213 | } |
@@ -3243,38 +3217,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3243 | 3217 | ||
3244 | public void llReleaseControls() | 3218 | public void llReleaseControls() |
3245 | { | 3219 | { |
3246 | TaskInventoryItem item; | ||
3247 | |||
3248 | m_host.TaskInventory.LockItemsForRead(true); | ||
3249 | lock (m_host.TaskInventory) | ||
3250 | { | ||
3251 | |||
3252 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3253 | { | ||
3254 | m_host.TaskInventory.LockItemsForRead(false); | ||
3255 | return; | ||
3256 | } | ||
3257 | else | ||
3258 | { | ||
3259 | item = m_host.TaskInventory[InventorySelf()]; | ||
3260 | } | ||
3261 | } | ||
3262 | m_host.TaskInventory.LockItemsForRead(false); | ||
3263 | |||
3264 | m_host.AddScriptLPS(1); | 3220 | m_host.AddScriptLPS(1); |
3265 | 3221 | ||
3266 | if (item.PermsGranter != UUID.Zero) | 3222 | if (m_item.PermsGranter != UUID.Zero) |
3267 | { | 3223 | { |
3268 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); | 3224 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
3269 | 3225 | ||
3270 | if (presence != null) | 3226 | if (presence != null) |
3271 | { | 3227 | { |
3272 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) | 3228 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) |
3273 | { | 3229 | { |
3274 | // Unregister controls from Presence | 3230 | // Unregister controls from Presence |
3275 | presence.UnRegisterControlEventsToScript(m_localID, m_itemID); | 3231 | presence.UnRegisterControlEventsToScript(m_host.LocalId, m_item.ItemID); |
3276 | // Remove Take Control permission. | 3232 | // Remove Take Control permission. |
3277 | item.PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS; | 3233 | m_item.PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS; |
3278 | } | 3234 | } |
3279 | } | 3235 | } |
3280 | } | 3236 | } |
@@ -3287,86 +3243,71 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3287 | m_UrlModule.ReleaseURL(url); | 3243 | m_UrlModule.ReleaseURL(url); |
3288 | } | 3244 | } |
3289 | 3245 | ||
3290 | public void llAttachToAvatar(int attachment) | 3246 | /// <summary> |
3247 | /// Attach the object containing this script to the avatar that owns it. | ||
3248 | /// </summary> | ||
3249 | /// <param name='attachment'>The attachment point (e.g. ATTACH_CHEST)</param> | ||
3250 | /// <returns>true if the attach suceeded, false if it did not</returns> | ||
3251 | public bool AttachToAvatar(int attachmentPoint) | ||
3291 | { | 3252 | { |
3292 | m_host.AddScriptLPS(1); | 3253 | SceneObjectGroup grp = m_host.ParentGroup; |
3293 | 3254 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | |
3294 | TaskInventoryItem item; | ||
3295 | 3255 | ||
3296 | m_host.TaskInventory.LockItemsForRead(true); | 3256 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
3297 | 3257 | ||
3298 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | 3258 | if (attachmentsModule != null) |
3299 | { | 3259 | return attachmentsModule.AttachObject(presence, grp, (uint)attachmentPoint, false); |
3300 | m_host.TaskInventory.LockItemsForRead(false); | ||
3301 | return; | ||
3302 | } | ||
3303 | else | 3260 | else |
3304 | { | 3261 | return false; |
3305 | item = m_host.TaskInventory[InventorySelf()]; | 3262 | } |
3306 | } | ||
3307 | |||
3308 | m_host.TaskInventory.LockItemsForRead(false); | ||
3309 | 3263 | ||
3310 | if (item.PermsGranter != m_host.OwnerID) | 3264 | /// <summary> |
3311 | return; | 3265 | /// Detach the object containing this script from the avatar it is attached to. |
3266 | /// </summary> | ||
3267 | /// <remarks> | ||
3268 | /// Nothing happens if the object is not attached. | ||
3269 | /// </remarks> | ||
3270 | public void DetachFromAvatar() | ||
3271 | { | ||
3272 | Util.FireAndForget(DetachWrapper, m_host); | ||
3273 | } | ||
3312 | 3274 | ||
3313 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) | 3275 | private void DetachWrapper(object o) |
3314 | { | 3276 | { |
3315 | SceneObjectGroup grp = m_host.ParentGroup; | 3277 | SceneObjectPart host = (SceneObjectPart)o; |
3316 | 3278 | ||
3317 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 3279 | SceneObjectGroup grp = host.ParentGroup; |
3280 | UUID itemID = grp.FromItemID; | ||
3281 | ScenePresence presence = World.GetScenePresence(host.OwnerID); | ||
3318 | 3282 | ||
3319 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | 3283 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
3320 | if (attachmentsModule != null) | 3284 | if (attachmentsModule != null) |
3321 | attachmentsModule.AttachObject(presence, grp, (uint)attachment, false); | 3285 | attachmentsModule.DetachSingleAttachmentToInv(presence, itemID); |
3322 | } | ||
3323 | } | 3286 | } |
3324 | 3287 | ||
3325 | public void llDetachFromAvatar() | 3288 | public void llAttachToAvatar(int attachmentPoint) |
3326 | { | 3289 | { |
3327 | m_host.AddScriptLPS(1); | 3290 | m_host.AddScriptLPS(1); |
3328 | 3291 | ||
3329 | if (m_host.ParentGroup.AttachmentPoint == 0) | 3292 | if (m_item.PermsGranter != m_host.OwnerID) |
3330 | return; | 3293 | return; |
3331 | 3294 | ||
3332 | TaskInventoryItem item; | 3295 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) |
3296 | AttachToAvatar(attachmentPoint); | ||
3297 | } | ||
3333 | 3298 | ||
3334 | m_host.TaskInventory.LockItemsForRead(true); | 3299 | public void llDetachFromAvatar() |
3300 | { | ||
3301 | m_host.AddScriptLPS(1); | ||
3335 | 3302 | ||
3336 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | 3303 | if (m_host.ParentGroup.AttachmentPoint == 0) |
3337 | { | ||
3338 | m_host.TaskInventory.LockItemsForRead(false); | ||
3339 | return; | 3304 | return; |
3340 | } | ||
3341 | else | ||
3342 | { | ||
3343 | item = m_host.TaskInventory[InventorySelf()]; | ||
3344 | } | ||
3345 | m_host.TaskInventory.LockItemsForRead(false); | ||
3346 | 3305 | ||
3347 | 3306 | if (m_item.PermsGranter != m_host.OwnerID) | |
3348 | if (item.PermsGranter != m_host.OwnerID) | ||
3349 | return; | 3307 | return; |
3350 | 3308 | ||
3351 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) | 3309 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) |
3352 | { | 3310 | DetachFromAvatar(); |
3353 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | ||
3354 | if (attachmentsModule != null) | ||
3355 | Util.FireAndForget(DetachWrapper, m_host); | ||
3356 | } | ||
3357 | } | ||
3358 | |||
3359 | private void DetachWrapper(object o) | ||
3360 | { | ||
3361 | SceneObjectPart host = (SceneObjectPart)o; | ||
3362 | |||
3363 | SceneObjectGroup grp = host.ParentGroup; | ||
3364 | UUID itemID = grp.FromItemID; | ||
3365 | ScenePresence presence = World.GetScenePresence(host.OwnerID); | ||
3366 | |||
3367 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | ||
3368 | if (attachmentsModule != null) | ||
3369 | attachmentsModule.DetachSingleAttachmentToInv(presence, itemID); | ||
3370 | } | 3311 | } |
3371 | 3312 | ||
3372 | public void llTakeCamera(string avatar) | 3313 | public void llTakeCamera(string avatar) |
@@ -3487,7 +3428,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3487 | } | 3428 | } |
3488 | 3429 | ||
3489 | emailModule.SendEmail(m_host.UUID, address, subject, message); | 3430 | emailModule.SendEmail(m_host.UUID, address, subject, message); |
3490 | ScriptSleep(15000); | 3431 | ScriptSleep(EMAIL_PAUSE_TIME * 1000); |
3491 | } | 3432 | } |
3492 | 3433 | ||
3493 | public void llGetNextEmail(string address, string subject) | 3434 | public void llGetNextEmail(string address, string subject) |
@@ -3524,6 +3465,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3524 | return m_host.UUID.ToString(); | 3465 | return m_host.UUID.ToString(); |
3525 | } | 3466 | } |
3526 | 3467 | ||
3468 | public LSL_Key llGenerateKey() | ||
3469 | { | ||
3470 | m_host.AddScriptLPS(1); | ||
3471 | return UUID.Random().ToString(); | ||
3472 | } | ||
3473 | |||
3527 | public void llSetBuoyancy(double buoyancy) | 3474 | public void llSetBuoyancy(double buoyancy) |
3528 | { | 3475 | { |
3529 | m_host.AddScriptLPS(1); | 3476 | m_host.AddScriptLPS(1); |
@@ -3570,7 +3517,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3570 | m_host.AddScriptLPS(1); | 3517 | m_host.AddScriptLPS(1); |
3571 | try | 3518 | try |
3572 | { | 3519 | { |
3573 | m_ScriptEngine.SetMinEventDelay(m_itemID, delay); | 3520 | m_ScriptEngine.SetMinEventDelay(m_item.ItemID, delay); |
3574 | } | 3521 | } |
3575 | catch (NotImplementedException) | 3522 | catch (NotImplementedException) |
3576 | { | 3523 | { |
@@ -3623,29 +3570,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3623 | { | 3570 | { |
3624 | m_host.AddScriptLPS(1); | 3571 | m_host.AddScriptLPS(1); |
3625 | 3572 | ||
3626 | UUID invItemID = InventorySelf(); | 3573 | if (m_item.PermsGranter == UUID.Zero) |
3627 | if (invItemID == UUID.Zero) | ||
3628 | return; | 3574 | return; |
3629 | 3575 | ||
3630 | TaskInventoryItem item; | 3576 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) |
3631 | |||
3632 | m_host.TaskInventory.LockItemsForRead(true); | ||
3633 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3634 | { | ||
3635 | m_host.TaskInventory.LockItemsForRead(false); | ||
3636 | return; | ||
3637 | } | ||
3638 | else | ||
3639 | { | 3577 | { |
3640 | item = m_host.TaskInventory[InventorySelf()]; | 3578 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
3641 | } | ||
3642 | m_host.TaskInventory.LockItemsForRead(false); | ||
3643 | if (item.PermsGranter == UUID.Zero) | ||
3644 | return; | ||
3645 | |||
3646 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) | ||
3647 | { | ||
3648 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); | ||
3649 | 3579 | ||
3650 | if (presence != null) | 3580 | if (presence != null) |
3651 | { | 3581 | { |
@@ -3663,38 +3593,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3663 | { | 3593 | { |
3664 | m_host.AddScriptLPS(1); | 3594 | m_host.AddScriptLPS(1); |
3665 | 3595 | ||
3666 | UUID invItemID=InventorySelf(); | 3596 | if (m_item.PermsGranter == UUID.Zero) |
3667 | if (invItemID == UUID.Zero) | ||
3668 | return; | 3597 | return; |
3669 | 3598 | ||
3670 | TaskInventoryItem item; | 3599 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) |
3671 | |||
3672 | m_host.TaskInventory.LockItemsForRead(true); | ||
3673 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3674 | { | ||
3675 | m_host.TaskInventory.LockItemsForRead(false); | ||
3676 | return; | ||
3677 | } | ||
3678 | else | ||
3679 | { | ||
3680 | item = m_host.TaskInventory[InventorySelf()]; | ||
3681 | } | ||
3682 | m_host.TaskInventory.LockItemsForRead(false); | ||
3683 | |||
3684 | |||
3685 | if (item.PermsGranter == UUID.Zero) | ||
3686 | return; | ||
3687 | |||
3688 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) | ||
3689 | { | 3600 | { |
3690 | UUID animID = new UUID(); | 3601 | UUID animID = new UUID(); |
3691 | 3602 | ||
3692 | if (!UUID.TryParse(anim, out animID)) | 3603 | if (!UUID.TryParse(anim, out animID)) |
3693 | { | 3604 | { |
3694 | animID=InventoryKey(anim); | 3605 | animID = InventoryKey(anim); |
3695 | } | 3606 | } |
3696 | 3607 | ||
3697 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); | 3608 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
3698 | 3609 | ||
3699 | if (presence != null) | 3610 | if (presence != null) |
3700 | { | 3611 | { |
@@ -3730,44 +3641,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3730 | public LSL_Integer llGetStartParameter() | 3641 | public LSL_Integer llGetStartParameter() |
3731 | { | 3642 | { |
3732 | m_host.AddScriptLPS(1); | 3643 | m_host.AddScriptLPS(1); |
3733 | return m_ScriptEngine.GetStartParameter(m_itemID); | 3644 | return m_ScriptEngine.GetStartParameter(m_item.ItemID); |
3734 | } | 3645 | } |
3735 | 3646 | ||
3736 | public void llRequestPermissions(string agent, int perm) | 3647 | public void llRequestPermissions(string agent, int perm) |
3737 | { | 3648 | { |
3738 | UUID agentID = new UUID(); | 3649 | UUID agentID; |
3739 | 3650 | ||
3740 | if (!UUID.TryParse(agent, out agentID)) | 3651 | if (!UUID.TryParse(agent, out agentID)) |
3741 | return; | 3652 | return; |
3742 | 3653 | ||
3743 | UUID invItemID = InventorySelf(); | ||
3744 | |||
3745 | if (invItemID == UUID.Zero) | ||
3746 | return; // Not in a prim? How?? | ||
3747 | |||
3748 | TaskInventoryItem item; | ||
3749 | |||
3750 | |||
3751 | m_host.TaskInventory.LockItemsForRead(true); | ||
3752 | if (!m_host.TaskInventory.ContainsKey(invItemID)) | ||
3753 | { | ||
3754 | m_host.TaskInventory.LockItemsForRead(false); | ||
3755 | return; | ||
3756 | } | ||
3757 | else | ||
3758 | { | ||
3759 | item = m_host.TaskInventory[invItemID]; | ||
3760 | } | ||
3761 | m_host.TaskInventory.LockItemsForRead(false); | ||
3762 | |||
3763 | if (agentID == UUID.Zero || perm == 0) // Releasing permissions | 3654 | if (agentID == UUID.Zero || perm == 0) // Releasing permissions |
3764 | { | 3655 | { |
3765 | llReleaseControls(); | 3656 | llReleaseControls(); |
3766 | 3657 | ||
3767 | item.PermsGranter = UUID.Zero; | 3658 | m_item.PermsGranter = UUID.Zero; |
3768 | item.PermsMask = 0; | 3659 | m_item.PermsMask = 0; |
3769 | 3660 | ||
3770 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3661 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( |
3771 | "run_time_permissions", new Object[] { | 3662 | "run_time_permissions", new Object[] { |
3772 | new LSL_Integer(0) }, | 3663 | new LSL_Integer(0) }, |
3773 | new DetectParams[0])); | 3664 | new DetectParams[0])); |
@@ -3775,7 +3666,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3775 | return; | 3666 | return; |
3776 | } | 3667 | } |
3777 | 3668 | ||
3778 | if (item.PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) | 3669 | if (m_item.PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) |
3779 | llReleaseControls(); | 3670 | llReleaseControls(); |
3780 | 3671 | ||
3781 | m_host.AddScriptLPS(1); | 3672 | m_host.AddScriptLPS(1); |
@@ -3792,11 +3683,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3792 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms | 3683 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms |
3793 | { | 3684 | { |
3794 | m_host.TaskInventory.LockItemsForWrite(true); | 3685 | m_host.TaskInventory.LockItemsForWrite(true); |
3795 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3686 | m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; |
3796 | m_host.TaskInventory[invItemID].PermsMask = perm; | 3687 | m_host.TaskInventory[m_item.ItemID].PermsMask = perm; |
3797 | m_host.TaskInventory.LockItemsForWrite(false); | 3688 | m_host.TaskInventory.LockItemsForWrite(false); |
3798 | 3689 | ||
3799 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3690 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( |
3800 | "run_time_permissions", new Object[] { | 3691 | "run_time_permissions", new Object[] { |
3801 | new LSL_Integer(perm) }, | 3692 | new LSL_Integer(perm) }, |
3802 | new DetectParams[0])); | 3693 | new DetectParams[0])); |
@@ -3831,11 +3722,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3831 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms | 3722 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms |
3832 | { | 3723 | { |
3833 | m_host.TaskInventory.LockItemsForWrite(true); | 3724 | m_host.TaskInventory.LockItemsForWrite(true); |
3834 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3725 | m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; |
3835 | m_host.TaskInventory[invItemID].PermsMask = perm; | 3726 | m_host.TaskInventory[m_item.ItemID].PermsMask = perm; |
3836 | m_host.TaskInventory.LockItemsForWrite(false); | 3727 | m_host.TaskInventory.LockItemsForWrite(false); |
3837 | 3728 | ||
3838 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3729 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( |
3839 | "run_time_permissions", new Object[] { | 3730 | "run_time_permissions", new Object[] { |
3840 | new LSL_Integer(perm) }, | 3731 | new LSL_Integer(perm) }, |
3841 | new DetectParams[0])); | 3732 | new DetectParams[0])); |
@@ -3856,8 +3747,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3856 | if (!m_waitingForScriptAnswer) | 3747 | if (!m_waitingForScriptAnswer) |
3857 | { | 3748 | { |
3858 | m_host.TaskInventory.LockItemsForWrite(true); | 3749 | m_host.TaskInventory.LockItemsForWrite(true); |
3859 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3750 | m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; |
3860 | m_host.TaskInventory[invItemID].PermsMask = 0; | 3751 | m_host.TaskInventory[m_item.ItemID].PermsMask = 0; |
3861 | m_host.TaskInventory.LockItemsForWrite(false); | 3752 | m_host.TaskInventory.LockItemsForWrite(false); |
3862 | 3753 | ||
3863 | presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; | 3754 | presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; |
@@ -3865,13 +3756,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3865 | } | 3756 | } |
3866 | 3757 | ||
3867 | presence.ControllingClient.SendScriptQuestion( | 3758 | presence.ControllingClient.SendScriptQuestion( |
3868 | m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm); | 3759 | m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, m_item.ItemID, perm); |
3869 | 3760 | ||
3870 | return; | 3761 | return; |
3871 | } | 3762 | } |
3872 | 3763 | ||
3873 | // Requested agent is not in range, refuse perms | 3764 | // Requested agent is not in range, refuse perms |
3874 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3765 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( |
3875 | "run_time_permissions", new Object[] { | 3766 | "run_time_permissions", new Object[] { |
3876 | new LSL_Integer(0) }, | 3767 | new LSL_Integer(0) }, |
3877 | new DetectParams[0])); | 3768 | new DetectParams[0])); |
@@ -3882,24 +3773,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3882 | if (taskID != m_host.UUID) | 3773 | if (taskID != m_host.UUID) |
3883 | return; | 3774 | return; |
3884 | 3775 | ||
3885 | UUID invItemID = InventorySelf(); | 3776 | client.OnScriptAnswer -= handleScriptAnswer; |
3886 | 3777 | m_waitingForScriptAnswer = false; | |
3887 | if (invItemID == UUID.Zero) | ||
3888 | return; | ||
3889 | |||
3890 | client.OnScriptAnswer-=handleScriptAnswer; | ||
3891 | m_waitingForScriptAnswer=false; | ||
3892 | 3778 | ||
3893 | if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) | 3779 | if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) |
3894 | llReleaseControls(); | 3780 | llReleaseControls(); |
3895 | 3781 | ||
3896 | |||
3897 | m_host.TaskInventory.LockItemsForWrite(true); | 3782 | m_host.TaskInventory.LockItemsForWrite(true); |
3898 | m_host.TaskInventory[invItemID].PermsMask = answer; | 3783 | m_host.TaskInventory[m_item.ItemID].PermsMask = answer; |
3899 | m_host.TaskInventory.LockItemsForWrite(false); | 3784 | m_host.TaskInventory.LockItemsForWrite(false); |
3900 | 3785 | ||
3901 | 3786 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( | |
3902 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | ||
3903 | "run_time_permissions", new Object[] { | 3787 | "run_time_permissions", new Object[] { |
3904 | new LSL_Integer(answer) }, | 3788 | new LSL_Integer(answer) }, |
3905 | new DetectParams[0])); | 3789 | new DetectParams[0])); |
@@ -3909,41 +3793,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3909 | { | 3793 | { |
3910 | m_host.AddScriptLPS(1); | 3794 | m_host.AddScriptLPS(1); |
3911 | 3795 | ||
3912 | m_host.TaskInventory.LockItemsForRead(true); | 3796 | return m_item.PermsGranter.ToString(); |
3913 | |||
3914 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
3915 | { | ||
3916 | if (item.Type == 10 && item.ItemID == m_itemID) | ||
3917 | { | ||
3918 | m_host.TaskInventory.LockItemsForRead(false); | ||
3919 | return item.PermsGranter.ToString(); | ||
3920 | } | ||
3921 | } | ||
3922 | m_host.TaskInventory.LockItemsForRead(false); | ||
3923 | |||
3924 | return UUID.Zero.ToString(); | ||
3925 | } | 3797 | } |
3926 | 3798 | ||
3927 | public LSL_Integer llGetPermissions() | 3799 | public LSL_Integer llGetPermissions() |
3928 | { | 3800 | { |
3929 | m_host.AddScriptLPS(1); | 3801 | m_host.AddScriptLPS(1); |
3930 | 3802 | ||
3931 | m_host.TaskInventory.LockItemsForRead(true); | 3803 | int perms = m_item.PermsMask; |
3932 | 3804 | ||
3933 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 3805 | if (m_automaticLinkPermission) |
3934 | { | 3806 | perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; |
3935 | if (item.Type == 10 && item.ItemID == m_itemID) | ||
3936 | { | ||
3937 | int perms = item.PermsMask; | ||
3938 | if (m_automaticLinkPermission) | ||
3939 | perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | ||
3940 | m_host.TaskInventory.LockItemsForRead(false); | ||
3941 | return perms; | ||
3942 | } | ||
3943 | } | ||
3944 | m_host.TaskInventory.LockItemsForRead(false); | ||
3945 | 3807 | ||
3946 | return 0; | 3808 | return perms; |
3947 | } | 3809 | } |
3948 | 3810 | ||
3949 | public LSL_Integer llGetLinkNumber() | 3811 | public LSL_Integer llGetLinkNumber() |
@@ -3981,18 +3843,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3981 | public void llCreateLink(string target, int parent) | 3843 | public void llCreateLink(string target, int parent) |
3982 | { | 3844 | { |
3983 | m_host.AddScriptLPS(1); | 3845 | m_host.AddScriptLPS(1); |
3984 | UUID invItemID = InventorySelf(); | 3846 | |
3985 | UUID targetID; | 3847 | UUID targetID; |
3986 | 3848 | ||
3987 | if (!UUID.TryParse(target, out targetID)) | 3849 | if (!UUID.TryParse(target, out targetID)) |
3988 | return; | 3850 | return; |
3989 | 3851 | ||
3990 | TaskInventoryItem item; | 3852 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
3991 | m_host.TaskInventory.LockItemsForRead(true); | ||
3992 | item = m_host.TaskInventory[invItemID]; | ||
3993 | m_host.TaskInventory.LockItemsForRead(false); | ||
3994 | |||
3995 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | ||
3996 | && !m_automaticLinkPermission) | 3853 | && !m_automaticLinkPermission) |
3997 | { | 3854 | { |
3998 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); | 3855 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); |
@@ -4000,7 +3857,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4000 | } | 3857 | } |
4001 | 3858 | ||
4002 | IClientAPI client = null; | 3859 | IClientAPI client = null; |
4003 | ScenePresence sp = World.GetScenePresence(item.PermsGranter); | 3860 | ScenePresence sp = World.GetScenePresence(m_item.PermsGranter); |
4004 | if (sp != null) | 3861 | if (sp != null) |
4005 | client = sp.ControllingClient; | 3862 | client = sp.ControllingClient; |
4006 | 3863 | ||
@@ -4046,18 +3903,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4046 | public void llBreakLink(int linknum) | 3903 | public void llBreakLink(int linknum) |
4047 | { | 3904 | { |
4048 | m_host.AddScriptLPS(1); | 3905 | m_host.AddScriptLPS(1); |
4049 | UUID invItemID = InventorySelf(); | ||
4050 | 3906 | ||
4051 | m_host.TaskInventory.LockItemsForRead(true); | 3907 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
4052 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 3908 | && !m_automaticLinkPermission) |
4053 | && !m_automaticLinkPermission) | 3909 | { |
4054 | { | 3910 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); |
4055 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); | 3911 | return; |
4056 | m_host.TaskInventory.LockItemsForRead(false); | 3912 | } |
4057 | return; | 3913 | |
4058 | } | ||
4059 | m_host.TaskInventory.LockItemsForRead(false); | ||
4060 | |||
4061 | if (linknum < ScriptBaseClass.LINK_THIS) | 3914 | if (linknum < ScriptBaseClass.LINK_THIS) |
4062 | return; | 3915 | return; |
4063 | 3916 | ||
@@ -4156,12 +4009,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4156 | { | 4009 | { |
4157 | m_host.AddScriptLPS(1); | 4010 | m_host.AddScriptLPS(1); |
4158 | 4011 | ||
4159 | UUID invItemID = InventorySelf(); | 4012 | TaskInventoryItem item = m_item; |
4160 | |||
4161 | TaskInventoryItem item; | ||
4162 | m_host.TaskInventory.LockItemsForRead(true); | ||
4163 | item = m_host.TaskInventory[invItemID]; | ||
4164 | m_host.TaskInventory.LockItemsForRead(false); | ||
4165 | 4013 | ||
4166 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 4014 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
4167 | && !m_automaticLinkPermission) | 4015 | && !m_automaticLinkPermission) |
@@ -4472,7 +4320,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4472 | { | 4320 | { |
4473 | if (item.Name == name) | 4321 | if (item.Name == name) |
4474 | { | 4322 | { |
4475 | if (item.ItemID == m_itemID) | 4323 | if (item.ItemID == m_item.ItemID) |
4476 | throw new ScriptDeleteException(); | 4324 | throw new ScriptDeleteException(); |
4477 | else | 4325 | else |
4478 | m_host.Inventory.RemoveInventoryItem(item.ItemID); | 4326 | m_host.Inventory.RemoveInventoryItem(item.ItemID); |
@@ -4606,8 +4454,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4606 | UUID rq = UUID.Random(); | 4454 | UUID rq = UUID.Random(); |
4607 | 4455 | ||
4608 | UUID tid = AsyncCommands. | 4456 | UUID tid = AsyncCommands. |
4609 | DataserverPlugin.RegisterRequest(m_localID, | 4457 | DataserverPlugin.RegisterRequest(m_host.LocalId, |
4610 | m_itemID, rq.ToString()); | 4458 | m_item.ItemID, rq.ToString()); |
4611 | 4459 | ||
4612 | AsyncCommands. | 4460 | AsyncCommands. |
4613 | DataserverPlugin.DataserverReply(rq.ToString(), reply); | 4461 | DataserverPlugin.DataserverReply(rq.ToString(), reply); |
@@ -4634,8 +4482,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4634 | if (item.Type == 3 && item.Name == name) | 4482 | if (item.Type == 3 && item.Name == name) |
4635 | { | 4483 | { |
4636 | UUID tid = AsyncCommands. | 4484 | UUID tid = AsyncCommands. |
4637 | DataserverPlugin.RegisterRequest(m_localID, | 4485 | DataserverPlugin.RegisterRequest(m_host.LocalId, |
4638 | m_itemID, item.AssetID.ToString()); | 4486 | m_item.ItemID, item.AssetID.ToString()); |
4639 | 4487 | ||
4640 | Vector3 region = new Vector3( | 4488 | Vector3 region = new Vector3( |
4641 | World.RegionInfo.RegionLocX * Constants.RegionSize, | 4489 | World.RegionInfo.RegionLocX * Constants.RegionSize, |
@@ -5034,22 +4882,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5034 | 4882 | ||
5035 | public LSL_String llGetScriptName() | 4883 | public LSL_String llGetScriptName() |
5036 | { | 4884 | { |
5037 | string result = String.Empty; | ||
5038 | |||
5039 | m_host.AddScriptLPS(1); | 4885 | m_host.AddScriptLPS(1); |
5040 | 4886 | ||
5041 | m_host.TaskInventory.LockItemsForRead(true); | 4887 | return m_item.Name != null ? m_item.Name : String.Empty; |
5042 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
5043 | { | ||
5044 | if (item.Type == 10 && item.ItemID == m_itemID) | ||
5045 | { | ||
5046 | result = item.Name!=null?item.Name:String.Empty; | ||
5047 | break; | ||
5048 | } | ||
5049 | } | ||
5050 | m_host.TaskInventory.LockItemsForRead(false); | ||
5051 | |||
5052 | return result; | ||
5053 | } | 4888 | } |
5054 | 4889 | ||
5055 | public LSL_Integer llGetLinkNumberOfSides(int link) | 4890 | public LSL_Integer llGetLinkNumberOfSides(int link) |
@@ -6334,7 +6169,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6334 | if (m_host.OwnerID == land.LandData.OwnerID) | 6169 | if (m_host.OwnerID == land.LandData.OwnerID) |
6335 | { | 6170 | { |
6336 | Vector3 pos = World.GetNearestAllowedPosition(presence, land); | 6171 | Vector3 pos = World.GetNearestAllowedPosition(presence, land); |
6337 | presence.TeleportWithMomentum(pos); | 6172 | presence.TeleportWithMomentum(pos, null); |
6338 | presence.ControllingClient.SendAlertMessage("You have been ejected from this land"); | 6173 | presence.ControllingClient.SendAlertMessage("You have been ejected from this land"); |
6339 | } | 6174 | } |
6340 | } | 6175 | } |
@@ -7281,14 +7116,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7281 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7116 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7282 | if (xmlrpcMod.IsEnabled()) | 7117 | if (xmlrpcMod.IsEnabled()) |
7283 | { | 7118 | { |
7284 | UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero); | 7119 | UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero); |
7285 | IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); | 7120 | IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); |
7286 | if (xmlRpcRouter != null) | 7121 | if (xmlRpcRouter != null) |
7287 | { | 7122 | { |
7288 | string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName; | 7123 | string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName; |
7289 | 7124 | ||
7290 | xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID, | 7125 | xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID, |
7291 | m_itemID, String.Format("http://{0}:{1}/", ExternalHostName, | 7126 | m_item.ItemID, String.Format("http://{0}:{1}/", ExternalHostName, |
7292 | xmlrpcMod.Port.ToString())); | 7127 | xmlrpcMod.Port.ToString())); |
7293 | } | 7128 | } |
7294 | object[] resobj = new object[] | 7129 | object[] resobj = new object[] |
@@ -7300,7 +7135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7300 | new LSL_Integer(0), | 7135 | new LSL_Integer(0), |
7301 | new LSL_String(String.Empty) | 7136 | new LSL_String(String.Empty) |
7302 | }; | 7137 | }; |
7303 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams("remote_data", resobj, | 7138 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams("remote_data", resobj, |
7304 | new DetectParams[0])); | 7139 | new DetectParams[0])); |
7305 | } | 7140 | } |
7306 | ScriptSleep(1000); | 7141 | ScriptSleep(1000); |
@@ -7311,7 +7146,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7311 | m_host.AddScriptLPS(1); | 7146 | m_host.AddScriptLPS(1); |
7312 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7147 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7313 | ScriptSleep(3000); | 7148 | ScriptSleep(3000); |
7314 | return (xmlrpcMod.SendRemoteData(m_localID, m_itemID, channel, dest, idata, sdata)).ToString(); | 7149 | return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); |
7315 | } | 7150 | } |
7316 | 7151 | ||
7317 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) | 7152 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) |
@@ -8150,7 +7985,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8150 | return; | 7985 | return; |
8151 | face = (int)rules.GetLSLIntegerItem(idx++); | 7986 | face = (int)rules.GetLSLIntegerItem(idx++); |
8152 | int shiny = (int)rules.GetLSLIntegerItem(idx++); | 7987 | int shiny = (int)rules.GetLSLIntegerItem(idx++); |
8153 | Bumpiness bump = (Bumpiness)Convert.ToByte((int)rules.GetLSLIntegerItem(idx++)); | 7988 | Bumpiness bump = (Bumpiness)(int)rules.GetLSLIntegerItem(idx++); |
8154 | 7989 | ||
8155 | SetShiny(part, face, shiny, bump); | 7990 | SetShiny(part, face, shiny, bump); |
8156 | 7991 | ||
@@ -9954,13 +9789,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9954 | { | 9789 | { |
9955 | m_host.AddScriptLPS(1); | 9790 | m_host.AddScriptLPS(1); |
9956 | if (m_UrlModule != null) | 9791 | if (m_UrlModule != null) |
9957 | return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_itemID).ToString(); | 9792 | return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID).ToString(); |
9958 | return UUID.Zero.ToString(); | 9793 | return UUID.Zero.ToString(); |
9959 | } | 9794 | } |
9960 | 9795 | ||
9961 | public LSL_String llRequestSimulatorData(string simulator, int data) | 9796 | public LSL_String llRequestSimulatorData(string simulator, int data) |
9962 | { | 9797 | { |
9963 | IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_itemID, "OSSL"); | 9798 | IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "OSSL"); |
9964 | 9799 | ||
9965 | try | 9800 | try |
9966 | { | 9801 | { |
@@ -10022,7 +9857,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10022 | UUID rq = UUID.Random(); | 9857 | UUID rq = UUID.Random(); |
10023 | 9858 | ||
10024 | UUID tid = AsyncCommands. | 9859 | UUID tid = AsyncCommands. |
10025 | DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); | 9860 | DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString()); |
10026 | 9861 | ||
10027 | AsyncCommands. | 9862 | AsyncCommands. |
10028 | DataserverPlugin.DataserverReply(rq.ToString(), reply); | 9863 | DataserverPlugin.DataserverReply(rq.ToString(), reply); |
@@ -10041,7 +9876,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10041 | m_host.AddScriptLPS(1); | 9876 | m_host.AddScriptLPS(1); |
10042 | 9877 | ||
10043 | if (m_UrlModule != null) | 9878 | if (m_UrlModule != null) |
10044 | return m_UrlModule.RequestURL(m_ScriptEngine.ScriptModule, m_host, m_itemID).ToString(); | 9879 | return m_UrlModule.RequestURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID).ToString(); |
10045 | return UUID.Zero.ToString(); | 9880 | return UUID.Zero.ToString(); |
10046 | } | 9881 | } |
10047 | 9882 | ||
@@ -10077,7 +9912,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10077 | // child agents have a mass of 1.0 | 9912 | // child agents have a mass of 1.0 |
10078 | return 1; | 9913 | return 1; |
10079 | else | 9914 | else |
10080 | return avatar.GetMass(); | 9915 | return (double)avatar.GetMass(); |
10081 | } | 9916 | } |
10082 | catch (KeyNotFoundException) | 9917 | catch (KeyNotFoundException) |
10083 | { | 9918 | { |
@@ -10520,22 +10355,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10520 | public LSL_Vector llGetCameraPos() | 10355 | public LSL_Vector llGetCameraPos() |
10521 | { | 10356 | { |
10522 | m_host.AddScriptLPS(1); | 10357 | m_host.AddScriptLPS(1); |
10523 | UUID invItemID = InventorySelf(); | ||
10524 | |||
10525 | if (invItemID == UUID.Zero) | ||
10526 | return new LSL_Vector(); | ||
10527 | 10358 | ||
10528 | m_host.TaskInventory.LockItemsForRead(true); | 10359 | if (m_item.PermsGranter == UUID.Zero) |
10529 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | 10360 | return new LSL_Vector(); |
10530 | { | ||
10531 | m_host.TaskInventory.LockItemsForRead(false); | ||
10532 | return new LSL_Vector(); | ||
10533 | } | ||
10534 | 10361 | ||
10535 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | 10362 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
10536 | { | 10363 | { |
10537 | ShoutError("No permissions to track the camera"); | 10364 | ShoutError("No permissions to track the camera"); |
10538 | m_host.TaskInventory.LockItemsForRead(false); | ||
10539 | return new LSL_Vector(); | 10365 | return new LSL_Vector(); |
10540 | } | 10366 | } |
10541 | m_host.TaskInventory.LockItemsForRead(false); | 10367 | m_host.TaskInventory.LockItemsForRead(false); |
@@ -10552,20 +10378,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10552 | public LSL_Rotation llGetCameraRot() | 10378 | public LSL_Rotation llGetCameraRot() |
10553 | { | 10379 | { |
10554 | m_host.AddScriptLPS(1); | 10380 | m_host.AddScriptLPS(1); |
10555 | UUID invItemID = InventorySelf(); | ||
10556 | if (invItemID == UUID.Zero) | ||
10557 | return new LSL_Rotation(); | ||
10558 | 10381 | ||
10559 | m_host.TaskInventory.LockItemsForRead(true); | 10382 | if (m_item.PermsGranter == UUID.Zero) |
10560 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | 10383 | return new LSL_Rotation(); |
10561 | { | 10384 | |
10562 | m_host.TaskInventory.LockItemsForRead(false); | 10385 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
10563 | return new LSL_Rotation(); | ||
10564 | } | ||
10565 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | ||
10566 | { | 10386 | { |
10567 | ShoutError("No permissions to track the camera"); | 10387 | ShoutError("No permissions to track the camera"); |
10568 | m_host.TaskInventory.LockItemsForRead(false); | ||
10569 | return new LSL_Rotation(); | 10388 | return new LSL_Rotation(); |
10570 | } | 10389 | } |
10571 | m_host.TaskInventory.LockItemsForRead(false); | 10390 | m_host.TaskInventory.LockItemsForRead(false); |
@@ -10629,7 +10448,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10629 | public void llMapDestination(string simname, LSL_Vector pos, LSL_Vector lookAt) | 10448 | public void llMapDestination(string simname, LSL_Vector pos, LSL_Vector lookAt) |
10630 | { | 10449 | { |
10631 | m_host.AddScriptLPS(1); | 10450 | m_host.AddScriptLPS(1); |
10632 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, 0); | 10451 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, 0); |
10633 | if (detectedParams == null) | 10452 | if (detectedParams == null) |
10634 | { | 10453 | { |
10635 | if (m_host.ParentGroup.IsAttachment == true) | 10454 | if (m_host.ParentGroup.IsAttachment == true) |
@@ -10753,30 +10572,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10753 | { | 10572 | { |
10754 | m_host.AddScriptLPS(1); | 10573 | m_host.AddScriptLPS(1); |
10755 | 10574 | ||
10756 | // our key in the object we are in | ||
10757 | UUID invItemID = InventorySelf(); | ||
10758 | if (invItemID == UUID.Zero) return; | ||
10759 | |||
10760 | // the object we are in | 10575 | // the object we are in |
10761 | UUID objectID = m_host.ParentUUID; | 10576 | UUID objectID = m_host.ParentUUID; |
10762 | if (objectID == UUID.Zero) return; | 10577 | if (objectID == UUID.Zero) |
10578 | return; | ||
10763 | 10579 | ||
10764 | UUID agentID; | ||
10765 | m_host.TaskInventory.LockItemsForRead(true); | ||
10766 | // we need the permission first, to know which avatar we want to set the camera for | 10580 | // we need the permission first, to know which avatar we want to set the camera for |
10767 | agentID = m_host.TaskInventory[invItemID].PermsGranter; | 10581 | UUID agentID = m_item.PermsGranter; |
10768 | 10582 | ||
10769 | if (agentID == UUID.Zero) | 10583 | if (agentID == UUID.Zero) |
10770 | { | ||
10771 | m_host.TaskInventory.LockItemsForRead(false); | ||
10772 | return; | 10584 | return; |
10773 | } | 10585 | |
10774 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) | 10586 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) |
10775 | { | ||
10776 | m_host.TaskInventory.LockItemsForRead(false); | ||
10777 | return; | 10587 | return; |
10778 | } | ||
10779 | m_host.TaskInventory.LockItemsForRead(false); | ||
10780 | 10588 | ||
10781 | ScenePresence presence = World.GetScenePresence(agentID); | 10589 | ScenePresence presence = World.GetScenePresence(agentID); |
10782 | 10590 | ||
@@ -10818,34 +10626,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10818 | { | 10626 | { |
10819 | m_host.AddScriptLPS(1); | 10627 | m_host.AddScriptLPS(1); |
10820 | 10628 | ||
10821 | // our key in the object we are in | ||
10822 | UUID invItemID=InventorySelf(); | ||
10823 | if (invItemID == UUID.Zero) return; | ||
10824 | |||
10825 | // the object we are in | 10629 | // the object we are in |
10826 | UUID objectID = m_host.ParentUUID; | 10630 | UUID objectID = m_host.ParentUUID; |
10827 | if (objectID == UUID.Zero) return; | 10631 | if (objectID == UUID.Zero) |
10632 | return; | ||
10828 | 10633 | ||
10829 | // we need the permission first, to know which avatar we want to clear the camera for | 10634 | // we need the permission first, to know which avatar we want to clear the camera for |
10830 | UUID agentID; | 10635 | UUID agentID = m_item.PermsGranter; |
10831 | m_host.TaskInventory.LockItemsForRead(true); | 10636 | |
10832 | agentID = m_host.TaskInventory[invItemID].PermsGranter; | ||
10833 | if (agentID == UUID.Zero) | 10637 | if (agentID == UUID.Zero) |
10834 | { | ||
10835 | m_host.TaskInventory.LockItemsForRead(false); | ||
10836 | return; | 10638 | return; |
10837 | } | 10639 | |
10838 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) | 10640 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) |
10839 | { | ||
10840 | m_host.TaskInventory.LockItemsForRead(false); | ||
10841 | return; | 10641 | return; |
10842 | } | ||
10843 | m_host.TaskInventory.LockItemsForRead(false); | ||
10844 | 10642 | ||
10845 | ScenePresence presence = World.GetScenePresence(agentID); | 10643 | ScenePresence presence = World.GetScenePresence(agentID); |
10846 | 10644 | ||
10847 | // we are not interested in child-agents | 10645 | // we are not interested in child-agents |
10848 | if (presence.IsChildAgent) return; | 10646 | if (presence.IsChildAgent) |
10647 | return; | ||
10849 | 10648 | ||
10850 | presence.ControllingClient.SendClearFollowCamProperties(objectID); | 10649 | presence.ControllingClient.SendClearFollowCamProperties(objectID); |
10851 | } | 10650 | } |
@@ -11036,8 +10835,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11036 | } | 10835 | } |
11037 | } | 10836 | } |
11038 | 10837 | ||
11039 | UUID reqID = httpScriptMod. | 10838 | UUID reqID |
11040 | StartHttpRequest(m_localID, m_itemID, url, param, httpHeaders, body); | 10839 | = httpScriptMod.StartHttpRequest(m_host.LocalId, m_item.ItemID, url, param, httpHeaders, body); |
11041 | 10840 | ||
11042 | if (reqID != UUID.Zero) | 10841 | if (reqID != UUID.Zero) |
11043 | return reqID.ToString(); | 10842 | return reqID.ToString(); |
@@ -11269,19 +11068,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11269 | break; | 11068 | break; |
11270 | // For the following 8 see the Object version below | 11069 | // For the following 8 see the Object version below |
11271 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: | 11070 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: |
11272 | ret.Add(new LSL_Integer(0)); | 11071 | ret.Add(new LSL_Integer(av.RunningScriptCount())); |
11273 | break; | 11072 | break; |
11274 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: | 11073 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: |
11275 | ret.Add(new LSL_Integer(0)); | 11074 | ret.Add(new LSL_Integer(av.ScriptCount())); |
11276 | break; | 11075 | break; |
11277 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: | 11076 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: |
11278 | ret.Add(new LSL_Integer(0)); | 11077 | ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384)); |
11279 | break; | 11078 | break; |
11280 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: | 11079 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: |
11281 | ret.Add(new LSL_Float(0)); | 11080 | ret.Add(new LSL_Float(av.ScriptExecutionTime() / 1000.0f)); |
11282 | break; | 11081 | break; |
11283 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: | 11082 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: |
11284 | ret.Add(new LSL_Integer(0)); | 11083 | ret.Add(new LSL_Integer(1)); |
11285 | break; | 11084 | break; |
11286 | case ScriptBaseClass.OBJECT_SERVER_COST: | 11085 | case ScriptBaseClass.OBJECT_SERVER_COST: |
11287 | ret.Add(new LSL_Float(0)); | 11086 | ret.Add(new LSL_Float(0)); |
@@ -11333,43 +11132,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11333 | case ScriptBaseClass.OBJECT_CREATOR: | 11132 | case ScriptBaseClass.OBJECT_CREATOR: |
11334 | ret.Add(new LSL_String(obj.CreatorID.ToString())); | 11133 | ret.Add(new LSL_String(obj.CreatorID.ToString())); |
11335 | break; | 11134 | break; |
11336 | // The following 8 I have intentionaly coded to return zero. They are part of | ||
11337 | // "Land Impact" calculations. These calculations are probably not applicable | ||
11338 | // to OpenSim, required figures (cpu/memory usage) are not currently tracked | ||
11339 | // I have intentionally left these all at zero rather than return possibly | ||
11340 | // missleading numbers | ||
11341 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: | 11135 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: |
11342 | // in SL this currently includes crashed scripts | 11136 | ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount())); |
11343 | ret.Add(new LSL_Integer(0)); | ||
11344 | break; | 11137 | break; |
11345 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: | 11138 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: |
11346 | ret.Add(new LSL_Integer(0)); | 11139 | ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount())); |
11347 | break; | 11140 | break; |
11348 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: | 11141 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: |
11349 | // The value returned in SL for mono scripts is 65536 * number of active scripts | 11142 | // The value returned in SL for mono scripts is 65536 * number of active scripts |
11350 | ret.Add(new LSL_Integer(0)); | 11143 | // and 16384 * number of active scripts for LSO. since llGetFreememory |
11144 | // is coded to give the LSO value use it here | ||
11145 | ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384)); | ||
11351 | break; | 11146 | break; |
11352 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: | 11147 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: |
11353 | // Average cpu time per simulator frame expended on all scripts in the objetc | 11148 | // Average cpu time in seconds per simulator frame expended on all scripts in the object |
11354 | ret.Add(new LSL_Float(0)); | 11149 | ret.Add(new LSL_Float(obj.ParentGroup.ScriptExecutionTime() / 1000.0f)); |
11355 | break; | 11150 | break; |
11356 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: | 11151 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: |
11357 | // according to the SL wiki A prim or linkset will have prim | 11152 | // according to the SL wiki A prim or linkset will have prim |
11358 | // equivalent of the number of prims in a linkset if it does not | 11153 | // equivalent of the number of prims in a linkset if it does not |
11359 | // contain a mesh anywhere in the link set or is not a normal prim | 11154 | // contain a mesh anywhere in the link set or is not a normal prim |
11360 | // The value returned in SL for normal prims is prim count | 11155 | // The value returned in SL for normal prims is prim count |
11361 | ret.Add(new LSL_Integer(0)); | 11156 | ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount)); |
11362 | break; | 11157 | break; |
11158 | // The following 3 costs I have intentionaly coded to return zero. They are part of | ||
11159 | // "Land Impact" calculations. These calculations are probably not applicable | ||
11160 | // to OpenSim and are not yet complete in SL | ||
11363 | case ScriptBaseClass.OBJECT_SERVER_COST: | 11161 | case ScriptBaseClass.OBJECT_SERVER_COST: |
11364 | // The value returned in SL for normal prims is prim count | 11162 | // The linden calculation is here |
11163 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight | ||
11164 | // The value returned in SL for normal prims looks like the prim count | ||
11365 | ret.Add(new LSL_Float(0)); | 11165 | ret.Add(new LSL_Float(0)); |
11366 | break; | 11166 | break; |
11367 | case ScriptBaseClass.OBJECT_STREAMING_COST: | 11167 | case ScriptBaseClass.OBJECT_STREAMING_COST: |
11368 | // The value returned in SL for normal prims is prim count * 0.06 | 11168 | // The linden calculation is here |
11169 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_Streaming_Cost | ||
11170 | // The value returned in SL for normal prims looks like the prim count * 0.06 | ||
11369 | ret.Add(new LSL_Float(0)); | 11171 | ret.Add(new LSL_Float(0)); |
11370 | break; | 11172 | break; |
11371 | case ScriptBaseClass.OBJECT_PHYSICS_COST: | 11173 | case ScriptBaseClass.OBJECT_PHYSICS_COST: |
11372 | // The value returned in SL for normal prims is prim count | 11174 | // The linden calculation is here |
11175 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_physics | ||
11176 | // The value returned in SL for normal prims looks like the prim count | ||
11373 | ret.Add(new LSL_Float(0)); | 11177 | ret.Add(new LSL_Float(0)); |
11374 | break; | 11178 | break; |
11375 | default: | 11179 | default: |
@@ -11467,7 +11271,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11467 | } | 11271 | } |
11468 | 11272 | ||
11469 | // was: UUID tid = tid = AsyncCommands. | 11273 | // was: UUID tid = tid = AsyncCommands. |
11470 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, assetID.ToString()); | 11274 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString()); |
11471 | 11275 | ||
11472 | if (NotecardCache.IsCached(assetID)) | 11276 | if (NotecardCache.IsCached(assetID)) |
11473 | { | 11277 | { |
@@ -11530,7 +11334,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11530 | } | 11334 | } |
11531 | 11335 | ||
11532 | // was: UUID tid = tid = AsyncCommands. | 11336 | // was: UUID tid = tid = AsyncCommands. |
11533 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, assetID.ToString()); | 11337 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString()); |
11534 | 11338 | ||
11535 | if (NotecardCache.IsCached(assetID)) | 11339 | if (NotecardCache.IsCached(assetID)) |
11536 | { | 11340 | { |
@@ -11614,7 +11418,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11614 | { | 11418 | { |
11615 | UUID rq = UUID.Random(); | 11419 | UUID rq = UUID.Random(); |
11616 | 11420 | ||
11617 | AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); | 11421 | AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString()); |
11618 | 11422 | ||
11619 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id))); | 11423 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id))); |
11620 | 11424 | ||
@@ -11630,7 +11434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11630 | { | 11434 | { |
11631 | UUID rq = UUID.Random(); | 11435 | UUID rq = UUID.Random(); |
11632 | 11436 | ||
11633 | AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); | 11437 | AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString()); |
11634 | 11438 | ||
11635 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id)); | 11439 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id)); |
11636 | 11440 | ||
@@ -12124,7 +11928,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12124 | bool isAccount = false; | 11928 | bool isAccount = false; |
12125 | bool isGroup = false; | 11929 | bool isGroup = false; |
12126 | 11930 | ||
12127 | if (!estate.IsEstateOwner(m_host.OwnerID) || !estate.IsEstateManager(m_host.OwnerID)) | 11931 | if (!estate.IsEstateOwner(m_host.OwnerID) || !estate.IsEstateManagerOrOwner(m_host.OwnerID)) |
12128 | return 0; | 11932 | return 0; |
12129 | 11933 | ||
12130 | UUID id = new UUID(); | 11934 | UUID id = new UUID(); |
@@ -12186,35 +11990,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12186 | return 1; | 11990 | return 1; |
12187 | } | 11991 | } |
12188 | 11992 | ||
12189 | #region Not Implemented | 11993 | public LSL_Integer llGetMemoryLimit() |
12190 | // | 11994 | { |
12191 | // Listing the unimplemented lsl functions here, please move | 11995 | m_host.AddScriptLPS(1); |
12192 | // them from this region as they are completed | 11996 | // The value returned for LSO scripts in SL |
12193 | // | 11997 | return 16384; |
11998 | } | ||
12194 | 11999 | ||
12195 | public void llGetEnv(LSL_String name) | 12000 | public LSL_Integer llSetMemoryLimit(LSL_Integer limit) |
12196 | { | 12001 | { |
12197 | m_host.AddScriptLPS(1); | 12002 | m_host.AddScriptLPS(1); |
12198 | NotImplemented("llGetEnv"); | 12003 | // Treat as an LSO script |
12004 | return ScriptBaseClass.FALSE; | ||
12199 | } | 12005 | } |
12200 | 12006 | ||
12201 | public void llGetSPMaxMemory() | 12007 | public LSL_Integer llGetSPMaxMemory() |
12202 | { | 12008 | { |
12203 | m_host.AddScriptLPS(1); | 12009 | m_host.AddScriptLPS(1); |
12204 | NotImplemented("llGetSPMaxMemory"); | 12010 | // The value returned for LSO scripts in SL |
12011 | return 16384; | ||
12205 | } | 12012 | } |
12206 | 12013 | ||
12207 | public virtual LSL_Integer llGetUsedMemory() | 12014 | public virtual LSL_Integer llGetUsedMemory() |
12208 | { | 12015 | { |
12209 | m_host.AddScriptLPS(1); | 12016 | m_host.AddScriptLPS(1); |
12210 | NotImplemented("llGetUsedMemory"); | 12017 | // The value returned for LSO scripts in SL |
12211 | return 0; | 12018 | return 16384; |
12212 | } | 12019 | } |
12213 | 12020 | ||
12214 | public void llScriptProfiler(LSL_Integer flags) | 12021 | public void llScriptProfiler(LSL_Integer flags) |
12215 | { | 12022 | { |
12216 | m_host.AddScriptLPS(1); | 12023 | m_host.AddScriptLPS(1); |
12217 | //NotImplemented("llScriptProfiler"); | 12024 | // This does nothing for LSO scripts in SL |
12025 | } | ||
12026 | |||
12027 | #region Not Implemented | ||
12028 | // | ||
12029 | // Listing the unimplemented lsl functions here, please move | ||
12030 | // them from this region as they are completed | ||
12031 | // | ||
12032 | |||
12033 | public void llGetEnv(LSL_String name) | ||
12034 | { | ||
12035 | m_host.AddScriptLPS(1); | ||
12036 | NotImplemented("llGetEnv"); | ||
12218 | } | 12037 | } |
12219 | 12038 | ||
12220 | public void llSetSoundQueueing(int queue) | 12039 | public void llSetSoundQueueing(int queue) |
@@ -12294,8 +12113,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12294 | 12113 | ||
12295 | try | 12114 | try |
12296 | { | 12115 | { |
12297 | UUID invItemID=InventorySelf(); | 12116 | TaskInventoryItem item = m_item; |
12298 | if (invItemID == UUID.Zero) | 12117 | if (item == null) |
12299 | { | 12118 | { |
12300 | replydata = "SERVICE_ERROR"; | 12119 | replydata = "SERVICE_ERROR"; |
12301 | return; | 12120 | return; |
@@ -12303,10 +12122,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12303 | 12122 | ||
12304 | m_host.AddScriptLPS(1); | 12123 | m_host.AddScriptLPS(1); |
12305 | 12124 | ||
12306 | m_host.TaskInventory.LockItemsForRead(true); | ||
12307 | TaskInventoryItem item = m_host.TaskInventory[invItemID]; | ||
12308 | m_host.TaskInventory.LockItemsForRead(false); | ||
12309 | |||
12310 | if (item.PermsGranter == UUID.Zero) | 12125 | if (item.PermsGranter == UUID.Zero) |
12311 | { | 12126 | { |
12312 | replydata = "MISSING_PERMISSION_DEBIT"; | 12127 | replydata = "MISSING_PERMISSION_DEBIT"; |
@@ -12348,7 +12163,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12348 | } | 12163 | } |
12349 | finally | 12164 | finally |
12350 | { | 12165 | { |
12351 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 12166 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( |
12352 | "transaction_result", new Object[] { | 12167 | "transaction_result", new Object[] { |
12353 | new LSL_String(txn.ToString()), | 12168 | new LSL_String(txn.ToString()), |
12354 | new LSL_Integer(replycode), | 12169 | new LSL_Integer(replycode), |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index 77a784d..795de80 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | |||
@@ -58,17 +58,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
58 | { | 58 | { |
59 | internal IScriptEngine m_ScriptEngine; | 59 | internal IScriptEngine m_ScriptEngine; |
60 | internal SceneObjectPart m_host; | 60 | internal SceneObjectPart m_host; |
61 | internal uint m_localID; | ||
62 | internal UUID m_itemID; | ||
63 | internal bool m_LSFunctionsEnabled = false; | 61 | internal bool m_LSFunctionsEnabled = false; |
64 | internal IScriptModuleComms m_comms = null; | 62 | internal IScriptModuleComms m_comms = null; |
65 | 63 | ||
66 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 64 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
67 | { | 65 | { |
68 | m_ScriptEngine = ScriptEngine; | 66 | m_ScriptEngine = ScriptEngine; |
69 | m_host = host; | 67 | m_host = host; |
70 | m_localID = localID; | ||
71 | m_itemID = itemID; | ||
72 | 68 | ||
73 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) | 69 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) |
74 | m_LSFunctionsEnabled = true; | 70 | m_LSFunctionsEnabled = true; |
@@ -449,7 +445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
449 | LSShoutError("LightShare functions are not enabled."); | 445 | LSShoutError("LightShare functions are not enabled."); |
450 | return 0; | 446 | return 0; |
451 | } | 447 | } |
452 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | 448 | if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
453 | { | 449 | { |
454 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); | 450 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); |
455 | return 0; | 451 | return 0; |
@@ -477,7 +473,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
477 | LSShoutError("LightShare functions are not enabled."); | 473 | LSShoutError("LightShare functions are not enabled."); |
478 | return; | 474 | return; |
479 | } | 475 | } |
480 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | 476 | if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
481 | { | 477 | { |
482 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); | 478 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); |
483 | return; | 479 | return; |
@@ -500,7 +496,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
500 | LSShoutError("LightShare functions are not enabled."); | 496 | LSShoutError("LightShare functions are not enabled."); |
501 | return 0; | 497 | return 0; |
502 | } | 498 | } |
503 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | 499 | if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
504 | { | 500 | { |
505 | LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); | 501 | LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); |
506 | return 0; | 502 | return 0; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 7c07e15..4bd3dff 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | |||
@@ -57,17 +57,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
57 | { | 57 | { |
58 | internal IScriptEngine m_ScriptEngine; | 58 | internal IScriptEngine m_ScriptEngine; |
59 | internal SceneObjectPart m_host; | 59 | internal SceneObjectPart m_host; |
60 | internal uint m_localID; | 60 | internal TaskInventoryItem m_item; |
61 | internal UUID m_itemID; | ||
62 | internal bool m_MODFunctionsEnabled = false; | 61 | internal bool m_MODFunctionsEnabled = false; |
63 | internal IScriptModuleComms m_comms = null; | 62 | internal IScriptModuleComms m_comms = null; |
64 | 63 | ||
65 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 64 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
66 | { | 65 | { |
67 | m_ScriptEngine = ScriptEngine; | 66 | m_ScriptEngine = ScriptEngine; |
68 | m_host = host; | 67 | m_host = host; |
69 | m_localID = localID; | 68 | m_item = item; |
70 | m_itemID = itemID; | ||
71 | 69 | ||
72 | if (m_ScriptEngine.Config.GetBoolean("AllowMODFunctions", false)) | 70 | if (m_ScriptEngine.Config.GetBoolean("AllowMODFunctions", false)) |
73 | m_MODFunctionsEnabled = true; | 71 | m_MODFunctionsEnabled = true; |
@@ -252,7 +250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
252 | // non-null but don't trust it completely | 250 | // non-null but don't trust it completely |
253 | try | 251 | try |
254 | { | 252 | { |
255 | object result = m_comms.InvokeOperation(m_host.UUID, m_itemID, fname, convertedParms); | 253 | object result = m_comms.InvokeOperation(m_host.UUID, m_item.ItemID, fname, convertedParms); |
256 | if (result != null) | 254 | if (result != null) |
257 | return result; | 255 | return result; |
258 | 256 | ||
@@ -279,7 +277,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
279 | 277 | ||
280 | UUID req = UUID.Random(); | 278 | UUID req = UUID.Random(); |
281 | 279 | ||
282 | m_comms.RaiseEvent(m_itemID, req.ToString(), module, command, k); | 280 | m_comms.RaiseEvent(m_item.ItemID, req.ToString(), module, command, k); |
283 | 281 | ||
284 | return req.ToString(); | 282 | return req.ToString(); |
285 | } | 283 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 0dc2aa2..51ace1a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -128,11 +128,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
128 | { | 128 | { |
129 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 129 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
130 | 130 | ||
131 | public const string GridInfoServiceConfigSectionName = "GridInfoService"; | ||
132 | |||
131 | internal IScriptEngine m_ScriptEngine; | 133 | internal IScriptEngine m_ScriptEngine; |
132 | internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there | 134 | internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there |
133 | internal SceneObjectPart m_host; | 135 | internal SceneObjectPart m_host; |
134 | internal uint m_localID; | 136 | internal TaskInventoryItem m_item; |
135 | internal UUID m_itemID; | ||
136 | internal bool m_OSFunctionsEnabled = false; | 137 | internal bool m_OSFunctionsEnabled = false; |
137 | internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; | 138 | internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; |
138 | internal float m_ScriptDelayFactor = 1.0f; | 139 | internal float m_ScriptDelayFactor = 1.0f; |
@@ -140,12 +141,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
140 | internal bool m_debuggerSafe = false; | 141 | internal bool m_debuggerSafe = false; |
141 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); | 142 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); |
142 | 143 | ||
143 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 144 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
144 | { | 145 | { |
145 | m_ScriptEngine = ScriptEngine; | 146 | m_ScriptEngine = ScriptEngine; |
146 | m_host = host; | 147 | m_host = host; |
147 | m_localID = localID; | 148 | m_item = item; |
148 | m_itemID = itemID; | ||
149 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); | 149 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); |
150 | 150 | ||
151 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) | 151 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) |
@@ -218,12 +218,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | /// <summary> | ||
222 | /// Initialize the LSL interface. | ||
223 | /// </summary> | ||
224 | /// <remarks> | ||
225 | /// FIXME: This is an abomination. We should be able to set this up earlier but currently we have no | ||
226 | /// guarantee the interface is present on Initialize(). There needs to be another post initialize call from | ||
227 | /// ScriptInstance. | ||
228 | /// </remarks> | ||
221 | private void InitLSL() | 229 | private void InitLSL() |
222 | { | 230 | { |
223 | if (m_LSL_Api != null) | 231 | if (m_LSL_Api != null) |
224 | return; | 232 | return; |
225 | 233 | ||
226 | m_LSL_Api = (ILSL_Api)m_ScriptEngine.GetApi(m_itemID, "LSL"); | 234 | m_LSL_Api = (ILSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "LSL"); |
227 | } | 235 | } |
228 | 236 | ||
229 | // | 237 | // |
@@ -342,22 +350,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
342 | return; | 350 | return; |
343 | } | 351 | } |
344 | 352 | ||
345 | TaskInventoryItem ti = m_host.Inventory.GetInventoryItem(m_itemID); | 353 | UUID ownerID = m_item.OwnerID; |
346 | if (ti == null) | ||
347 | { | ||
348 | OSSLError( | ||
349 | String.Format("{0} permission error. Can't find script in prim inventory.", | ||
350 | function)); | ||
351 | } | ||
352 | |||
353 | UUID ownerID = ti.OwnerID; | ||
354 | 354 | ||
355 | //OSSL only may be used if objet is in the same group as the parcel | 355 | //OSSL only may be used if object is in the same group as the parcel |
356 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) | 356 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) |
357 | { | 357 | { |
358 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 358 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
359 | 359 | ||
360 | if (land.LandData.GroupID == ti.GroupID && land.LandData.GroupID != UUID.Zero) | 360 | if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) |
361 | { | 361 | { |
362 | return; | 362 | return; |
363 | } | 363 | } |
@@ -378,7 +378,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
378 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("ESTATE_MANAGER")) | 378 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("ESTATE_MANAGER")) |
379 | { | 379 | { |
380 | //Only Estate Managers may use the function | 380 | //Only Estate Managers may use the function |
381 | if (World.RegionInfo.EstateSettings.IsEstateManager(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) | 381 | if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) |
382 | { | 382 | { |
383 | return; | 383 | return; |
384 | } | 384 | } |
@@ -393,13 +393,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
393 | } | 393 | } |
394 | } | 394 | } |
395 | 395 | ||
396 | if (!m_FunctionPerms[function].AllowedCreators.Contains(ti.CreatorID)) | 396 | if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) |
397 | OSSLError( | 397 | OSSLError( |
398 | String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", | 398 | String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", |
399 | function)); | 399 | function)); |
400 | if (ti.CreatorID != ownerID) | 400 | |
401 | if (m_item.CreatorID != ownerID) | ||
401 | { | 402 | { |
402 | if ((ti.CurrentPermissions & (uint)PermissionMask.Modify) != 0) | 403 | if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0) |
403 | OSSLError( | 404 | OSSLError( |
404 | String.Format("{0} permission denied. Script permissions error.", | 405 | String.Format("{0} permission denied. Script permissions error.", |
405 | function)); | 406 | function)); |
@@ -730,11 +731,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
730 | 731 | ||
731 | m_host.AddScriptLPS(1); | 732 | m_host.AddScriptLPS(1); |
732 | 733 | ||
734 | // For safety, we add another permission check here, and don't rely only on the standard OSSL permissions | ||
733 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) | 735 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) |
734 | { | 736 | { |
735 | MainConsole.Instance.RunCommand(command); | 737 | MainConsole.Instance.RunCommand(command); |
736 | return true; | 738 | return true; |
737 | } | 739 | } |
740 | |||
738 | return false; | 741 | return false; |
739 | } | 742 | } |
740 | 743 | ||
@@ -1178,7 +1181,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1178 | CheckThreatLevel(ThreatLevel.High, "osSetStateEvents"); | 1181 | CheckThreatLevel(ThreatLevel.High, "osSetStateEvents"); |
1179 | m_host.AddScriptLPS(1); | 1182 | m_host.AddScriptLPS(1); |
1180 | 1183 | ||
1181 | m_host.SetScriptEvents(m_itemID, events); | 1184 | m_host.SetScriptEvents(m_item.ItemID, events); |
1182 | } | 1185 | } |
1183 | 1186 | ||
1184 | public void osSetRegionWaterHeight(double height) | 1187 | public void osSetRegionWaterHeight(double height) |
@@ -1186,12 +1189,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1186 | CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight"); | 1189 | CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight"); |
1187 | 1190 | ||
1188 | m_host.AddScriptLPS(1); | 1191 | m_host.AddScriptLPS(1); |
1189 | //Check to make sure that the script's owner is the estate manager/master | 1192 | |
1190 | //World.Permissions.GenericEstatePermission( | 1193 | World.EventManager.TriggerRequestChangeWaterHeight((float)height); |
1191 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
1192 | { | ||
1193 | World.EventManager.TriggerRequestChangeWaterHeight((float)height); | ||
1194 | } | ||
1195 | } | 1194 | } |
1196 | 1195 | ||
1197 | /// <summary> | 1196 | /// <summary> |
@@ -1202,27 +1201,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1202 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> | 1201 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> |
1203 | public void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour) | 1202 | public void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour) |
1204 | { | 1203 | { |
1205 | CheckThreatLevel(ThreatLevel.Nuisance, "osSetRegionSunSettings"); | 1204 | CheckThreatLevel(ThreatLevel.High, "osSetRegionSunSettings"); |
1206 | 1205 | ||
1207 | m_host.AddScriptLPS(1); | 1206 | m_host.AddScriptLPS(1); |
1208 | //Check to make sure that the script's owner is the estate manager/master | ||
1209 | //World.Permissions.GenericEstatePermission( | ||
1210 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
1211 | { | ||
1212 | while (sunHour > 24.0) | ||
1213 | sunHour -= 24.0; | ||
1214 | 1207 | ||
1215 | while (sunHour < 0) | 1208 | while (sunHour > 24.0) |
1216 | sunHour += 24.0; | 1209 | sunHour -= 24.0; |
1217 | 1210 | ||
1211 | while (sunHour < 0) | ||
1212 | sunHour += 24.0; | ||
1218 | 1213 | ||
1219 | World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; | 1214 | World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; |
1220 | World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 | 1215 | World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 |
1221 | World.RegionInfo.RegionSettings.FixedSun = sunFixed; | 1216 | World.RegionInfo.RegionSettings.FixedSun = sunFixed; |
1222 | World.RegionInfo.RegionSettings.Save(); | 1217 | World.RegionInfo.RegionSettings.Save(); |
1223 | 1218 | ||
1224 | World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour); | 1219 | World.EventManager.TriggerEstateToolsSunUpdate( |
1225 | } | 1220 | World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour); |
1226 | } | 1221 | } |
1227 | 1222 | ||
1228 | /// <summary> | 1223 | /// <summary> |
@@ -1232,26 +1227,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1232 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> | 1227 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> |
1233 | public void osSetEstateSunSettings(bool sunFixed, double sunHour) | 1228 | public void osSetEstateSunSettings(bool sunFixed, double sunHour) |
1234 | { | 1229 | { |
1235 | CheckThreatLevel(ThreatLevel.Nuisance, "osSetEstateSunSettings"); | 1230 | CheckThreatLevel(ThreatLevel.High, "osSetEstateSunSettings"); |
1236 | 1231 | ||
1237 | m_host.AddScriptLPS(1); | 1232 | m_host.AddScriptLPS(1); |
1238 | //Check to make sure that the script's owner is the estate manager/master | ||
1239 | //World.Permissions.GenericEstatePermission( | ||
1240 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
1241 | { | ||
1242 | while (sunHour > 24.0) | ||
1243 | sunHour -= 24.0; | ||
1244 | 1233 | ||
1245 | while (sunHour < 0) | 1234 | while (sunHour > 24.0) |
1246 | sunHour += 24.0; | 1235 | sunHour -= 24.0; |
1247 | 1236 | ||
1248 | World.RegionInfo.EstateSettings.UseGlobalTime = !sunFixed; | 1237 | while (sunHour < 0) |
1249 | World.RegionInfo.EstateSettings.SunPosition = sunHour; | 1238 | sunHour += 24.0; |
1250 | World.RegionInfo.EstateSettings.FixedSun = sunFixed; | ||
1251 | World.RegionInfo.EstateSettings.Save(); | ||
1252 | 1239 | ||
1253 | World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour); | 1240 | World.RegionInfo.EstateSettings.UseGlobalTime = !sunFixed; |
1254 | } | 1241 | World.RegionInfo.EstateSettings.SunPosition = sunHour; |
1242 | World.RegionInfo.EstateSettings.FixedSun = sunFixed; | ||
1243 | World.RegionInfo.EstateSettings.Save(); | ||
1244 | |||
1245 | World.EventManager.TriggerEstateToolsSunUpdate( | ||
1246 | World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour); | ||
1255 | } | 1247 | } |
1256 | 1248 | ||
1257 | /// <summary> | 1249 | /// <summary> |
@@ -1627,7 +1619,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1627 | 1619 | ||
1628 | public Object osParseJSONNew(string JSON) | 1620 | public Object osParseJSONNew(string JSON) |
1629 | { | 1621 | { |
1630 | CheckThreatLevel(ThreatLevel.None, "osParseJSON"); | 1622 | CheckThreatLevel(ThreatLevel.None, "osParseJSONNew"); |
1631 | 1623 | ||
1632 | m_host.AddScriptLPS(1); | 1624 | m_host.AddScriptLPS(1); |
1633 | 1625 | ||
@@ -2042,8 +2034,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2042 | string nick = String.Empty; | 2034 | string nick = String.Empty; |
2043 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2035 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2044 | 2036 | ||
2045 | if (config.Configs["GridInfo"] != null) | 2037 | if (config.Configs[GridInfoServiceConfigSectionName] != null) |
2046 | nick = config.Configs["GridInfo"].GetString("gridnick", nick); | 2038 | nick = config.Configs[GridInfoServiceConfigSectionName].GetString("gridnick", nick); |
2047 | 2039 | ||
2048 | if (String.IsNullOrEmpty(nick)) | 2040 | if (String.IsNullOrEmpty(nick)) |
2049 | nick = GridUserInfo(InfoType.Nick); | 2041 | nick = GridUserInfo(InfoType.Nick); |
@@ -2059,8 +2051,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2059 | string name = String.Empty; | 2051 | string name = String.Empty; |
2060 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2052 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2061 | 2053 | ||
2062 | if (config.Configs["GridInfo"] != null) | 2054 | if (config.Configs[GridInfoServiceConfigSectionName] != null) |
2063 | name = config.Configs["GridInfo"].GetString("gridname", name); | 2055 | name = config.Configs[GridInfoServiceConfigSectionName].GetString("gridname", name); |
2064 | 2056 | ||
2065 | if (String.IsNullOrEmpty(name)) | 2057 | if (String.IsNullOrEmpty(name)) |
2066 | name = GridUserInfo(InfoType.Name); | 2058 | name = GridUserInfo(InfoType.Name); |
@@ -2076,8 +2068,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2076 | string loginURI = String.Empty; | 2068 | string loginURI = String.Empty; |
2077 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2069 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2078 | 2070 | ||
2079 | if (config.Configs["GridInfo"] != null) | 2071 | if (config.Configs[GridInfoServiceConfigSectionName] != null) |
2080 | loginURI = config.Configs["GridInfo"].GetString("login", loginURI); | 2072 | loginURI = config.Configs[GridInfoServiceConfigSectionName].GetString("login", loginURI); |
2081 | 2073 | ||
2082 | if (String.IsNullOrEmpty(loginURI)) | 2074 | if (String.IsNullOrEmpty(loginURI)) |
2083 | loginURI = GridUserInfo(InfoType.Login); | 2075 | loginURI = GridUserInfo(InfoType.Login); |
@@ -2124,8 +2116,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2124 | string retval = String.Empty; | 2116 | string retval = String.Empty; |
2125 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2117 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2126 | 2118 | ||
2127 | if (config.Configs["GridInfo"] != null) | 2119 | if (config.Configs[GridInfoServiceConfigSectionName] != null) |
2128 | retval = config.Configs["GridInfo"].GetString(key, retval); | 2120 | retval = config.Configs[GridInfoServiceConfigSectionName].GetString(key, retval); |
2129 | 2121 | ||
2130 | if (String.IsNullOrEmpty(retval)) | 2122 | if (String.IsNullOrEmpty(retval)) |
2131 | retval = GridUserInfo(InfoType.Custom, key); | 2123 | retval = GridUserInfo(InfoType.Custom, key); |
@@ -2480,7 +2472,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2480 | return; | 2472 | return; |
2481 | 2473 | ||
2482 | Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); | 2474 | Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); |
2483 | module.MoveToTarget(npcId, World, pos, false, true); | 2475 | module.MoveToTarget(npcId, World, pos, false, true, false); |
2484 | } | 2476 | } |
2485 | } | 2477 | } |
2486 | 2478 | ||
@@ -2505,7 +2497,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2505 | World, | 2497 | World, |
2506 | pos, | 2498 | pos, |
2507 | (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0, | 2499 | (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0, |
2508 | (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0); | 2500 | (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0, |
2501 | (options & ScriptBaseClass.OS_NPC_RUNNING) != 0); | ||
2509 | } | 2502 | } |
2510 | } | 2503 | } |
2511 | 2504 | ||
@@ -2555,7 +2548,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2555 | 2548 | ||
2556 | public void osNpcStopMoveToTarget(LSL_Key npc) | 2549 | public void osNpcStopMoveToTarget(LSL_Key npc) |
2557 | { | 2550 | { |
2558 | CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); | 2551 | CheckThreatLevel(ThreatLevel.High, "osNpcStopMoveToTarget"); |
2559 | m_host.AddScriptLPS(1); | 2552 | m_host.AddScriptLPS(1); |
2560 | 2553 | ||
2561 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2554 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
@@ -2572,6 +2565,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2572 | 2565 | ||
2573 | public void osNpcSay(LSL_Key npc, string message) | 2566 | public void osNpcSay(LSL_Key npc, string message) |
2574 | { | 2567 | { |
2568 | osNpcSay(npc, 0, message); | ||
2569 | } | ||
2570 | |||
2571 | public void osNpcSay(LSL_Key npc, int channel, string message) | ||
2572 | { | ||
2575 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); | 2573 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); |
2576 | m_host.AddScriptLPS(1); | 2574 | m_host.AddScriptLPS(1); |
2577 | 2575 | ||
@@ -2583,7 +2581,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2583 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | 2581 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) |
2584 | return; | 2582 | return; |
2585 | 2583 | ||
2586 | module.Say(npcId, World, message); | 2584 | module.Say(npcId, World, message, channel); |
2585 | } | ||
2586 | } | ||
2587 | |||
2588 | public void osNpcShout(LSL_Key npc, int channel, string message) | ||
2589 | { | ||
2590 | CheckThreatLevel(ThreatLevel.High, "osNpcShout"); | ||
2591 | m_host.AddScriptLPS(1); | ||
2592 | |||
2593 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2594 | if (module != null) | ||
2595 | { | ||
2596 | UUID npcId = new UUID(npc.m_string); | ||
2597 | |||
2598 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2599 | return; | ||
2600 | |||
2601 | module.Shout(npcId, World, message, channel); | ||
2587 | } | 2602 | } |
2588 | } | 2603 | } |
2589 | 2604 | ||
@@ -2684,6 +2699,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2684 | } | 2699 | } |
2685 | } | 2700 | } |
2686 | 2701 | ||
2702 | public void osNpcWhisper(LSL_Key npc, int channel, string message) | ||
2703 | { | ||
2704 | CheckThreatLevel(ThreatLevel.High, "osNpcWhisper"); | ||
2705 | m_host.AddScriptLPS(1); | ||
2706 | |||
2707 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2708 | if (module != null) | ||
2709 | { | ||
2710 | UUID npcId = new UUID(npc.m_string); | ||
2711 | |||
2712 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2713 | return; | ||
2714 | |||
2715 | module.Whisper(npcId, World, message, channel); | ||
2716 | } | ||
2717 | } | ||
2718 | |||
2687 | /// <summary> | 2719 | /// <summary> |
2688 | /// Save the current appearance of the script owner permanently to the named notecard. | 2720 | /// Save the current appearance of the script owner permanently to the named notecard. |
2689 | /// </summary> | 2721 | /// </summary> |
@@ -2835,21 +2867,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2835 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); | 2867 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); |
2836 | m_host.AddScriptLPS(1); | 2868 | m_host.AddScriptLPS(1); |
2837 | 2869 | ||
2838 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) | 2870 | World.ForEachRootScenePresence(delegate(ScenePresence sp) |
2839 | { | 2871 | { |
2840 | World.ForEachRootScenePresence(delegate(ScenePresence sp) | 2872 | if (sp.Firstname == FirstName && sp.Lastname == SurName) |
2841 | { | 2873 | { |
2842 | if (sp.Firstname == FirstName && sp.Lastname == SurName) | 2874 | // kick client... |
2843 | { | 2875 | if (alert != null) |
2844 | // kick client... | 2876 | sp.ControllingClient.Kick(alert); |
2845 | if (alert != null) | ||
2846 | sp.ControllingClient.Kick(alert); | ||
2847 | 2877 | ||
2848 | // ...and close on our side | 2878 | // ...and close on our side |
2849 | sp.Scene.IncomingCloseAgent(sp.UUID); | 2879 | sp.Scene.IncomingCloseAgent(sp.UUID); |
2850 | } | 2880 | } |
2851 | }); | 2881 | }); |
2852 | } | ||
2853 | } | 2882 | } |
2854 | 2883 | ||
2855 | public void osCauseDamage(string avatar, double damage) | 2884 | public void osCauseDamage(string avatar, double damage) |
@@ -3095,5 +3124,80 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3095 | 3124 | ||
3096 | return ScriptBaseClass.TRUE; | 3125 | return ScriptBaseClass.TRUE; |
3097 | } | 3126 | } |
3127 | |||
3128 | /// <summary> | ||
3129 | /// Sets terrain estate texture | ||
3130 | /// </summary> | ||
3131 | /// <param name="level"></param> | ||
3132 | /// <param name="texture"></param> | ||
3133 | /// <returns></returns> | ||
3134 | public void osSetTerrainTexture(int level, LSL_Key texture) | ||
3135 | { | ||
3136 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture"); | ||
3137 | |||
3138 | m_host.AddScriptLPS(1); | ||
3139 | //Check to make sure that the script's owner is the estate manager/master | ||
3140 | //World.Permissions.GenericEstatePermission( | ||
3141 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
3142 | { | ||
3143 | if (level < 0 || level > 3) | ||
3144 | return; | ||
3145 | |||
3146 | UUID textureID = new UUID(); | ||
3147 | if (!UUID.TryParse(texture, out textureID)) | ||
3148 | return; | ||
3149 | |||
3150 | // estate module is required | ||
3151 | IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); | ||
3152 | if (estate != null) | ||
3153 | estate.setEstateTerrainBaseTexture(level, textureID); | ||
3154 | } | ||
3155 | } | ||
3156 | |||
3157 | /// <summary> | ||
3158 | /// Sets terrain heights of estate | ||
3159 | /// </summary> | ||
3160 | /// <param name="corner"></param> | ||
3161 | /// <param name="low"></param> | ||
3162 | /// <param name="high"></param> | ||
3163 | /// <returns></returns> | ||
3164 | public void osSetTerrainTextureHeight(int corner, double low, double high) | ||
3165 | { | ||
3166 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight"); | ||
3167 | |||
3168 | m_host.AddScriptLPS(1); | ||
3169 | //Check to make sure that the script's owner is the estate manager/master | ||
3170 | //World.Permissions.GenericEstatePermission( | ||
3171 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
3172 | { | ||
3173 | if (corner < 0 || corner > 3) | ||
3174 | return; | ||
3175 | |||
3176 | // estate module is required | ||
3177 | IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); | ||
3178 | if (estate != null) | ||
3179 | estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high); | ||
3180 | } | ||
3181 | } | ||
3182 | |||
3183 | public void osForceAttachToAvatar(int attachmentPoint) | ||
3184 | { | ||
3185 | CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar"); | ||
3186 | |||
3187 | m_host.AddScriptLPS(1); | ||
3188 | |||
3189 | InitLSL(); | ||
3190 | ((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint); | ||
3191 | } | ||
3192 | |||
3193 | public void osForceDetachFromAvatar() | ||
3194 | { | ||
3195 | CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar"); | ||
3196 | |||
3197 | m_host.AddScriptLPS(1); | ||
3198 | |||
3199 | InitLSL(); | ||
3200 | ((LSL_Api)m_LSL_Api).DetachFromAvatar(); | ||
3201 | } | ||
3098 | } | 3202 | } |
3099 | } | 3203 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 1373971..19f3ce1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -308,7 +308,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
308 | } | 308 | } |
309 | SceneObjectPart SensePoint = ts.host; | 309 | SceneObjectPart SensePoint = ts.host; |
310 | 310 | ||
311 | Vector3 fromRegionPos = SensePoint.AbsolutePosition; | 311 | Vector3 fromRegionPos = SensePoint.GetWorldPosition(); |
312 | 312 | ||
313 | // pre define some things to avoid repeated definitions in the loop body | 313 | // pre define some things to avoid repeated definitions in the loop body |
314 | Vector3 toRegionPos; | 314 | Vector3 toRegionPos; |
@@ -323,13 +323,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
323 | Quaternion q = SensePoint.GetWorldRotation(); // non-attached prim Sensor *always* uses World rotation! | 323 | Quaternion q = SensePoint.GetWorldRotation(); // non-attached prim Sensor *always* uses World rotation! |
324 | if (SensePoint.ParentGroup.IsAttachment) | 324 | if (SensePoint.ParentGroup.IsAttachment) |
325 | { | 325 | { |
326 | // In attachments, the sensor cone always orients with the | 326 | // In attachments, rotate the sensor cone with the |
327 | // avatar rotation. This may include a nonzero elevation if | 327 | // avatar rotation. This may include a nonzero elevation if |
328 | // in mouselook. | 328 | // in mouselook. |
329 | // This will not include the rotation and position of the | ||
330 | // attachment point (e.g. your head when a sensor is in your | ||
331 | // hair attached to your scull. Your hair will turn with | ||
332 | // your head but the sensor will stay with your (global) | ||
333 | // avatar rotation and position. | ||
334 | // Position of a sensor in a child prim attached to an avatar | ||
335 | // will be still wrong. | ||
329 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); | 336 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); |
330 | fromRegionPos = avatar.AbsolutePosition; | 337 | fromRegionPos = avatar.AbsolutePosition; |
331 | q = avatar.Rotation; | 338 | q = avatar.Rotation; |
332 | } | 339 | } |
340 | |||
333 | LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); | 341 | LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); |
334 | LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); | 342 | LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); |
335 | double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); | 343 | double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); |
@@ -441,14 +449,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
441 | return sensedEntities; | 449 | return sensedEntities; |
442 | 450 | ||
443 | SceneObjectPart SensePoint = ts.host; | 451 | SceneObjectPart SensePoint = ts.host; |
444 | Vector3 fromRegionPos = SensePoint.AbsolutePosition; | 452 | Vector3 fromRegionPos = SensePoint.GetWorldPosition(); |
445 | 453 | ||
446 | Quaternion q = SensePoint.RotationOffset; | 454 | Quaternion q = SensePoint.GetWorldRotation(); |
447 | if (SensePoint.ParentGroup.IsAttachment) | 455 | if (SensePoint.ParentGroup.IsAttachment) |
448 | { | 456 | { |
449 | // In attachments, the sensor cone always orients with the | 457 | // In attachments, rotate the sensor cone with the |
450 | // avatar rotation. This may include a nonzero elevation if | 458 | // avatar rotation. This may include a nonzero elevation if |
451 | // in mouselook. | 459 | // in mouselook. |
460 | // This will not include the rotation and position of the | ||
461 | // attachment point (e.g. your head when a sensor is in your | ||
462 | // hair attached to your scull. Your hair will turn with | ||
463 | // your head but the sensor will stay with your (global) | ||
464 | // avatar rotation and position. | ||
465 | // Position of a sensor in a child prim attached to an avatar | ||
466 | // will be still wrong. | ||
452 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); | 467 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); |
453 | if (avatar == null) | 468 | if (avatar == null) |
454 | return sensedEntities; | 469 | return sensedEntities; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index be5740e..048124d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -105,6 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
105 | LSL_Integer llFloor(double f); | 105 | LSL_Integer llFloor(double f); |
106 | void llForceMouselook(int mouselook); | 106 | void llForceMouselook(int mouselook); |
107 | LSL_Float llFrand(double mag); | 107 | LSL_Float llFrand(double mag); |
108 | LSL_Key llGenerateKey(); | ||
108 | LSL_Vector llGetAccel(); | 109 | LSL_Vector llGetAccel(); |
109 | LSL_Integer llGetAgentInfo(string id); | 110 | LSL_Integer llGetAgentInfo(string id); |
110 | LSL_String llGetAgentLanguage(string id); | 111 | LSL_String llGetAgentLanguage(string id); |
@@ -150,7 +151,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
150 | LSL_Rotation llGetLocalRot(); | 151 | LSL_Rotation llGetLocalRot(); |
151 | LSL_Float llGetMass(); | 152 | LSL_Float llGetMass(); |
152 | LSL_Float llGetMassMKS(); | 153 | LSL_Float llGetMassMKS(); |
153 | void llGetNextEmail(string address, string subject); | 154 | LSL_Integer llGetMemoryLimit(); |
155 | void llGetNextEmail(string address, string subject); | ||
154 | LSL_String llGetNotecardLine(string name, int line); | 156 | LSL_String llGetNotecardLine(string name, int line); |
155 | LSL_Key llGetNumberOfNotecardLines(string name); | 157 | LSL_Key llGetNumberOfNotecardLines(string name); |
156 | LSL_Integer llGetNumberOfPrims(); | 158 | LSL_Integer llGetNumberOfPrims(); |
@@ -188,6 +190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
188 | LSL_String llGetScriptName(); | 190 | LSL_String llGetScriptName(); |
189 | LSL_Integer llGetScriptState(string name); | 191 | LSL_Integer llGetScriptState(string name); |
190 | LSL_String llGetSimulatorHostname(); | 192 | LSL_String llGetSimulatorHostname(); |
193 | LSL_Integer llGetSPMaxMemory(); | ||
191 | LSL_Integer llGetStartParameter(); | 194 | LSL_Integer llGetStartParameter(); |
192 | LSL_Integer llGetStatus(int status); | 195 | LSL_Integer llGetStatus(int status); |
193 | LSL_String llGetSubString(string src, int start, int end); | 196 | LSL_String llGetSubString(string src, int start, int end); |
@@ -323,6 +326,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
323 | void llSay(int channelID, string text); | 326 | void llSay(int channelID, string text); |
324 | void llScaleTexture(double u, double v, int face); | 327 | void llScaleTexture(double u, double v, int face); |
325 | LSL_Integer llScriptDanger(LSL_Vector pos); | 328 | LSL_Integer llScriptDanger(LSL_Vector pos); |
329 | void llScriptProfiler(LSL_Integer flag); | ||
326 | LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata); | 330 | LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata); |
327 | void llSensor(string name, string id, int type, double range, double arc); | 331 | void llSensor(string name, string id, int type, double range, double arc); |
328 | void llSensorRemove(); | 332 | void llSensorRemove(); |
@@ -346,6 +350,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
346 | void llSetLinkTexture(int linknumber, string texture, int face); | 350 | void llSetLinkTexture(int linknumber, string texture, int face); |
347 | void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); | 351 | void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); |
348 | void llSetLocalRot(LSL_Rotation rot); | 352 | void llSetLocalRot(LSL_Rotation rot); |
353 | LSL_Integer llSetMemoryLimit(LSL_Integer limit); | ||
349 | void llSetObjectDesc(string desc); | 354 | void llSetObjectDesc(string desc); |
350 | void llSetObjectName(string name); | 355 | void llSetObjectName(string name); |
351 | void llSetObjectPermMask(int mask, int value); | 356 | void llSetObjectPermMask(int mask, int value); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 444a681..7382495 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -98,6 +98,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
98 | void osAvatarPlayAnimation(string avatar, string animation); | 98 | void osAvatarPlayAnimation(string avatar, string animation); |
99 | void osAvatarStopAnimation(string avatar, string animation); | 99 | void osAvatarStopAnimation(string avatar, string animation); |
100 | 100 | ||
101 | // Attachment commands | ||
102 | |||
103 | /// <summary> | ||
104 | /// Attach the object containing this script to the avatar that owns it without checking for PERMISSION_ATTACH | ||
105 | /// </summary> | ||
106 | /// <param name='attachment'>The attachment point. For example, ATTACH_CHEST</param> | ||
107 | void osForceAttachToAvatar(int attachment); | ||
108 | |||
109 | /// <summary> | ||
110 | /// Detach the object containing this script from the avatar it is attached to without checking for PERMISSION_ATTACH | ||
111 | /// </summary> | ||
112 | /// <remarks>Nothing happens if the object is not attached.</remarks> | ||
113 | void osForceDetachFromAvatar(); | ||
114 | |||
101 | //texture draw functions | 115 | //texture draw functions |
102 | string osMovePen(string drawList, int x, int y); | 116 | string osMovePen(string drawList, int x, int y); |
103 | string osDrawLine(string drawList, int startX, int startY, int endX, int endY); | 117 | string osDrawLine(string drawList, int startX, int startY, int endX, int endY); |
@@ -203,11 +217,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
203 | void osNpcSetRot(LSL_Key npc, rotation rot); | 217 | void osNpcSetRot(LSL_Key npc, rotation rot); |
204 | void osNpcStopMoveToTarget(LSL_Key npc); | 218 | void osNpcStopMoveToTarget(LSL_Key npc); |
205 | void osNpcSay(key npc, string message); | 219 | void osNpcSay(key npc, string message); |
220 | void osNpcSay(key npc, int channel, string message); | ||
221 | void osNpcShout(key npc, int channel, string message); | ||
206 | void osNpcSit(key npc, key target, int options); | 222 | void osNpcSit(key npc, key target, int options); |
207 | void osNpcStand(LSL_Key npc); | 223 | void osNpcStand(LSL_Key npc); |
208 | void osNpcRemove(key npc); | 224 | void osNpcRemove(key npc); |
209 | void osNpcPlayAnimation(LSL_Key npc, string animation); | 225 | void osNpcPlayAnimation(LSL_Key npc, string animation); |
210 | void osNpcStopAnimation(LSL_Key npc, string animation); | 226 | void osNpcStopAnimation(LSL_Key npc, string animation); |
227 | void osNpcWhisper(key npc, int channel, string message); | ||
211 | 228 | ||
212 | LSL_Key osOwnerSaveAppearance(string notecard); | 229 | LSL_Key osOwnerSaveAppearance(string notecard); |
213 | LSL_Key osAgentSaveAppearance(key agentId, string notecard); | 230 | LSL_Key osAgentSaveAppearance(key agentId, string notecard); |
@@ -234,5 +251,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
234 | 251 | ||
235 | LSL_Integer osInviteToGroup(LSL_Key agentId); | 252 | LSL_Integer osInviteToGroup(LSL_Key agentId); |
236 | LSL_Integer osEjectFromGroup(LSL_Key agentId); | 253 | LSL_Integer osEjectFromGroup(LSL_Key agentId); |
254 | |||
255 | void osSetTerrainTexture(int level, LSL_Key texture); | ||
256 | void osSetTerrainTextureHeight(int corner, double low, double high); | ||
237 | } | 257 | } |
238 | } | 258 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 278f74e..5c6ad8a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -383,6 +383,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
383 | public const int PRIM_SCULPT_FLAG_INVERT = 64; | 383 | public const int PRIM_SCULPT_FLAG_INVERT = 64; |
384 | public const int PRIM_SCULPT_FLAG_MIRROR = 128; | 384 | public const int PRIM_SCULPT_FLAG_MIRROR = 128; |
385 | 385 | ||
386 | public const int PROFILE_NONE = 0; | ||
387 | public const int PROFILE_SCRIPT_MEMORY = 1; | ||
388 | |||
386 | public const int MASK_BASE = 0; | 389 | public const int MASK_BASE = 0; |
387 | public const int MASK_OWNER = 1; | 390 | public const int MASK_OWNER = 1; |
388 | public const int MASK_GROUP = 2; | 391 | public const int MASK_GROUP = 2; |
@@ -641,6 +644,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
641 | public const int OS_NPC_FLY = 0; | 644 | public const int OS_NPC_FLY = 0; |
642 | public const int OS_NPC_NO_FLY = 1; | 645 | public const int OS_NPC_NO_FLY = 1; |
643 | public const int OS_NPC_LAND_AT_TARGET = 2; | 646 | public const int OS_NPC_LAND_AT_TARGET = 2; |
647 | public const int OS_NPC_RUNNING = 4; | ||
644 | 648 | ||
645 | public const int OS_NPC_SIT_NOW = 0; | 649 | public const int OS_NPC_SIT_NOW = 0; |
646 | 650 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 9ba9561..2d23d30 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -376,6 +376,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
376 | return m_LSL_Functions.llFrand(mag); | 376 | return m_LSL_Functions.llFrand(mag); |
377 | } | 377 | } |
378 | 378 | ||
379 | public LSL_Key llGenerateKey() | ||
380 | { | ||
381 | return m_LSL_Functions.llGenerateKey(); | ||
382 | } | ||
383 | |||
379 | public LSL_Vector llGetAccel() | 384 | public LSL_Vector llGetAccel() |
380 | { | 385 | { |
381 | return m_LSL_Functions.llGetAccel(); | 386 | return m_LSL_Functions.llGetAccel(); |
@@ -591,6 +596,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
591 | return m_LSL_Functions.llGetMassMKS(); | 596 | return m_LSL_Functions.llGetMassMKS(); |
592 | } | 597 | } |
593 | 598 | ||
599 | public LSL_Integer llGetMemoryLimit() | ||
600 | { | ||
601 | return m_LSL_Functions.llGetMemoryLimit(); | ||
602 | } | ||
603 | |||
594 | public void llGetNextEmail(string address, string subject) | 604 | public void llGetNextEmail(string address, string subject) |
595 | { | 605 | { |
596 | m_LSL_Functions.llGetNextEmail(address, subject); | 606 | m_LSL_Functions.llGetNextEmail(address, subject); |
@@ -781,6 +791,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
781 | return m_LSL_Functions.llGetSimulatorHostname(); | 791 | return m_LSL_Functions.llGetSimulatorHostname(); |
782 | } | 792 | } |
783 | 793 | ||
794 | public LSL_Integer llGetSPMaxMemory() | ||
795 | { | ||
796 | return m_LSL_Functions.llGetSPMaxMemory(); | ||
797 | } | ||
798 | |||
784 | public LSL_Integer llGetStartParameter() | 799 | public LSL_Integer llGetStartParameter() |
785 | { | 800 | { |
786 | return m_LSL_Functions.llGetStartParameter(); | 801 | return m_LSL_Functions.llGetStartParameter(); |
@@ -1450,6 +1465,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1450 | return m_LSL_Functions.llScriptDanger(pos); | 1465 | return m_LSL_Functions.llScriptDanger(pos); |
1451 | } | 1466 | } |
1452 | 1467 | ||
1468 | public void llScriptProfiler(LSL_Integer flags) | ||
1469 | { | ||
1470 | m_LSL_Functions.llScriptProfiler(flags); | ||
1471 | } | ||
1472 | |||
1453 | public LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata) | 1473 | public LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata) |
1454 | { | 1474 | { |
1455 | return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); | 1475 | return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); |
@@ -1560,6 +1580,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1560 | m_LSL_Functions.llSetLocalRot(rot); | 1580 | m_LSL_Functions.llSetLocalRot(rot); |
1561 | } | 1581 | } |
1562 | 1582 | ||
1583 | public LSL_Integer llSetMemoryLimit(LSL_Integer limit) | ||
1584 | { | ||
1585 | return m_LSL_Functions.llSetMemoryLimit(limit); | ||
1586 | } | ||
1587 | |||
1563 | public void llSetObjectDesc(string desc) | 1588 | public void llSetObjectDesc(string desc) |
1564 | { | 1589 | { |
1565 | m_LSL_Functions.llSetObjectDesc(desc); | 1590 | m_LSL_Functions.llSetObjectDesc(desc); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 680cefb4..d230662 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -289,8 +289,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
289 | m_OSSL_Functions.osAvatarStopAnimation(avatar, animation); | 289 | m_OSSL_Functions.osAvatarStopAnimation(avatar, animation); |
290 | } | 290 | } |
291 | 291 | ||
292 | // Avatar functions | ||
292 | 293 | ||
293 | //Texture Draw functions | 294 | public void osForceAttachToAvatar(int attachmentPoint) |
295 | { | ||
296 | m_OSSL_Functions.osForceAttachToAvatar(attachmentPoint); | ||
297 | } | ||
298 | |||
299 | public void osForceDetachFromAvatar() | ||
300 | { | ||
301 | m_OSSL_Functions.osForceDetachFromAvatar(); | ||
302 | } | ||
303 | |||
304 | // Texture Draw functions | ||
294 | 305 | ||
295 | public string osMovePen(string drawList, int x, int y) | 306 | public string osMovePen(string drawList, int x, int y) |
296 | { | 307 | { |
@@ -569,6 +580,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
569 | m_OSSL_Functions.osNpcSay(npc, message); | 580 | m_OSSL_Functions.osNpcSay(npc, message); |
570 | } | 581 | } |
571 | 582 | ||
583 | public void osNpcSay(key npc, int channel, string message) | ||
584 | { | ||
585 | m_OSSL_Functions.osNpcSay(npc, channel, message); | ||
586 | } | ||
587 | |||
588 | |||
589 | public void osNpcShout(key npc, int channel, string message) | ||
590 | { | ||
591 | m_OSSL_Functions.osNpcShout(npc, channel, message); | ||
592 | } | ||
593 | |||
572 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) | 594 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) |
573 | { | 595 | { |
574 | m_OSSL_Functions.osNpcSit(npc, target, options); | 596 | m_OSSL_Functions.osNpcSit(npc, target, options); |
@@ -594,6 +616,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
594 | m_OSSL_Functions.osNpcStopAnimation(npc, animation); | 616 | m_OSSL_Functions.osNpcStopAnimation(npc, animation); |
595 | } | 617 | } |
596 | 618 | ||
619 | public void osNpcWhisper(key npc, int channel, string message) | ||
620 | { | ||
621 | m_OSSL_Functions.osNpcWhisper(npc, channel, message); | ||
622 | } | ||
623 | |||
597 | public LSL_Key osOwnerSaveAppearance(string notecard) | 624 | public LSL_Key osOwnerSaveAppearance(string notecard) |
598 | { | 625 | { |
599 | return m_OSSL_Functions.osOwnerSaveAppearance(notecard); | 626 | return m_OSSL_Functions.osOwnerSaveAppearance(notecard); |
@@ -878,5 +905,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
878 | { | 905 | { |
879 | return m_OSSL_Functions.osEjectFromGroup(agentId); | 906 | return m_OSSL_Functions.osEjectFromGroup(agentId); |
880 | } | 907 | } |
908 | |||
909 | public void osSetTerrainTexture(int level, LSL_Key texture) | ||
910 | { | ||
911 | m_OSSL_Functions.osSetTerrainTexture(level, texture); | ||
912 | } | ||
913 | |||
914 | public void osSetTerrainTextureHeight(int corner, double low, double high) | ||
915 | { | ||
916 | m_OSSL_Functions.osSetTerrainTextureHeight(corner, low, high); | ||
917 | } | ||
881 | } | 918 | } |
882 | } | 919 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index ff1f277..5cad883 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -232,7 +232,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
232 | foreach (string api in am.GetApis()) | 232 | foreach (string api in am.GetApis()) |
233 | { | 233 | { |
234 | m_Apis[api] = am.CreateApi(api); | 234 | m_Apis[api] = am.CreateApi(api); |
235 | m_Apis[api].Initialize(engine, part, LocalID, itemID); | 235 | m_Apis[api].Initialize(engine, part, ScriptTask); |
236 | } | 236 | } |
237 | 237 | ||
238 | try | 238 | try |
@@ -964,7 +964,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
964 | public IScriptApi GetApi(string name) | 964 | public IScriptApi GetApi(string name) |
965 | { | 965 | { |
966 | if (m_Apis.ContainsKey(name)) | 966 | if (m_Apis.ContainsKey(name)) |
967 | { | ||
968 | // m_log.DebugFormat("[SCRIPT INSTANCE]: Found api {0} in {1}@{2}", name, ScriptName, PrimName); | ||
969 | |||
967 | return m_Apis[name]; | 970 | return m_Apis[name]; |
971 | } | ||
972 | |||
973 | // m_log.DebugFormat("[SCRIPT INSTANCE]: Did not find api {0} in {1}@{2}", name, ScriptName, PrimName); | ||
974 | |||
968 | return null; | 975 | return null; |
969 | } | 976 | } |
970 | 977 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs index e2d0db2..c73e22f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs | |||
@@ -63,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
63 | IConfig config = initConfigSource.AddConfig("XEngine"); | 63 | IConfig config = initConfigSource.AddConfig("XEngine"); |
64 | config.Set("Enabled", "true"); | 64 | config.Set("Enabled", "true"); |
65 | 65 | ||
66 | m_scene = SceneHelpers.SetupScene(); | 66 | m_scene = new SceneHelpers().SetupScene(); |
67 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource); | 67 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource); |
68 | 68 | ||
69 | m_engine = new XEngine.XEngine(); | 69 | m_engine = new XEngine.XEngine(); |
@@ -91,7 +91,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
91 | TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); | 91 | TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); |
92 | 92 | ||
93 | LSL_Api api = new LSL_Api(); | 93 | LSL_Api api = new LSL_Api(); |
94 | api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID); | 94 | api.Initialize(m_engine, so1.RootPart, null); |
95 | 95 | ||
96 | // Create a second object | 96 | // Create a second object |
97 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100); | 97 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100); |
@@ -124,7 +124,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
124 | SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); | 124 | SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); |
125 | m_scene.AddSceneObject(so1); | 125 | m_scene.AddSceneObject(so1); |
126 | LSL_Api api = new LSL_Api(); | 126 | LSL_Api api = new LSL_Api(); |
127 | api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID); | 127 | api.Initialize(m_engine, so1.RootPart, null); |
128 | 128 | ||
129 | // Create an object embedded inside the first | 129 | // Create an object embedded inside the first |
130 | UUID itemId = TestHelpers.ParseTail(0x20); | 130 | UUID itemId = TestHelpers.ParseTail(0x20); |
@@ -134,7 +134,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
134 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); | 134 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); |
135 | m_scene.AddSceneObject(so2); | 135 | m_scene.AddSceneObject(so2); |
136 | LSL_Api api2 = new LSL_Api(); | 136 | LSL_Api api2 = new LSL_Api(); |
137 | api2.Initialize(m_engine, so2.RootPart, so2.RootPart.LocalId, so2.RootPart.UUID); | 137 | api2.Initialize(m_engine, so2.RootPart, null); |
138 | 138 | ||
139 | // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** | 139 | // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** |
140 | api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); | 140 | api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs new file mode 100644 index 0000000..bc3b790 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs | |||
@@ -0,0 +1,139 @@ | |||
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 log4net; | ||
33 | using Nini.Config; | ||
34 | using NUnit.Framework; | ||
35 | using OpenMetaverse; | ||
36 | using OpenMetaverse.Assets; | ||
37 | using OpenMetaverse.StructuredData; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Region.CoreModules.Avatar.AvatarFactory; | ||
40 | using OpenSim.Region.OptionalModules.World.NPC; | ||
41 | using OpenSim.Region.Framework.Scenes; | ||
42 | using OpenSim.Region.ScriptEngine.Shared; | ||
43 | using OpenSim.Region.ScriptEngine.Shared.Api; | ||
44 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | ||
45 | using OpenSim.Services.Interfaces; | ||
46 | using OpenSim.Tests.Common; | ||
47 | using OpenSim.Tests.Common.Mock; | ||
48 | |||
49 | namespace OpenSim.Region.ScriptEngine.Shared.Tests | ||
50 | { | ||
51 | /// <summary> | ||
52 | /// Tests for linking functions in LSL | ||
53 | /// </summary> | ||
54 | /// <remarks> | ||
55 | /// This relates to LSL. Actual linking functionality should be tested in the main | ||
56 | /// OpenSim.Region.Framework.Scenes.Tests.SceneObjectLinkingTests. | ||
57 | /// </remarks> | ||
58 | [TestFixture] | ||
59 | public class LSL_ApiLinkingTests | ||
60 | { | ||
61 | protected Scene m_scene; | ||
62 | protected XEngine.XEngine m_engine; | ||
63 | |||
64 | [SetUp] | ||
65 | public void SetUp() | ||
66 | { | ||
67 | IConfigSource initConfigSource = new IniConfigSource(); | ||
68 | IConfig config = initConfigSource.AddConfig("XEngine"); | ||
69 | config.Set("Enabled", "true"); | ||
70 | |||
71 | m_scene = new SceneHelpers().SetupScene(); | ||
72 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource); | ||
73 | |||
74 | m_engine = new XEngine.XEngine(); | ||
75 | m_engine.Initialise(initConfigSource); | ||
76 | m_engine.AddRegion(m_scene); | ||
77 | } | ||
78 | |||
79 | [Test] | ||
80 | public void TestllCreateLink() | ||
81 | { | ||
82 | TestHelpers.InMethod(); | ||
83 | |||
84 | UUID ownerId = TestHelpers.ParseTail(0x1); | ||
85 | |||
86 | SceneObjectGroup grp1 = SceneHelpers.CreateSceneObject(2, ownerId, "grp1-", 0x10); | ||
87 | grp1.AbsolutePosition = new Vector3(10, 10, 10); | ||
88 | m_scene.AddSceneObject(grp1); | ||
89 | |||
90 | // FIXME: This should really be a script item (with accompanying script) | ||
91 | TaskInventoryItem grp1Item | ||
92 | = TaskInventoryHelpers.AddNotecard(m_scene, grp1.RootPart); | ||
93 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | ||
94 | |||
95 | SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20); | ||
96 | grp2.AbsolutePosition = new Vector3(20, 20, 20); | ||
97 | |||
98 | // <180,0,0> | ||
99 | grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0)); | ||
100 | |||
101 | m_scene.AddSceneObject(grp2); | ||
102 | |||
103 | LSL_Api apiGrp1 = new LSL_Api(); | ||
104 | apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item); | ||
105 | |||
106 | apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE); | ||
107 | |||
108 | Assert.That(grp1.Parts.Length, Is.EqualTo(4)); | ||
109 | Assert.That(grp2.IsDeleted, Is.True); | ||
110 | } | ||
111 | |||
112 | [Test] | ||
113 | public void TestllBreakLink() | ||
114 | { | ||
115 | TestHelpers.InMethod(); | ||
116 | |||
117 | UUID ownerId = TestHelpers.ParseTail(0x1); | ||
118 | |||
119 | SceneObjectGroup grp1 = SceneHelpers.CreateSceneObject(2, ownerId, "grp1-", 0x10); | ||
120 | grp1.AbsolutePosition = new Vector3(10, 10, 10); | ||
121 | m_scene.AddSceneObject(grp1); | ||
122 | |||
123 | // FIXME: This should really be a script item (with accompanying script) | ||
124 | TaskInventoryItem grp1Item | ||
125 | = TaskInventoryHelpers.AddNotecard(m_scene, grp1.RootPart); | ||
126 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | ||
127 | |||
128 | LSL_Api apiGrp1 = new LSL_Api(); | ||
129 | apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item); | ||
130 | |||
131 | apiGrp1.llBreakLink(2); | ||
132 | |||
133 | Assert.That(grp1.Parts.Length, Is.EqualTo(1)); | ||
134 | |||
135 | SceneObjectGroup grp2 = m_scene.GetSceneObjectGroup("grp1-Part1"); | ||
136 | Assert.That(grp2, Is.Not.Null); | ||
137 | } | ||
138 | } | ||
139 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 9cf9258..f96a156 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
58 | IConfig config = initConfigSource.AddConfig("XEngine"); | 58 | IConfig config = initConfigSource.AddConfig("XEngine"); |
59 | config.Set("Enabled", "true"); | 59 | config.Set("Enabled", "true"); |
60 | 60 | ||
61 | Scene scene = SceneHelpers.SetupScene(); | 61 | Scene scene = new SceneHelpers().SetupScene(); |
62 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | 62 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); |
63 | 63 | ||
64 | XEngine.XEngine engine = new XEngine.XEngine(); | 64 | XEngine.XEngine engine = new XEngine.XEngine(); |
@@ -66,8 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
66 | engine.AddRegion(scene); | 66 | engine.AddRegion(scene); |
67 | 67 | ||
68 | m_lslApi = new LSL_Api(); | 68 | m_lslApi = new LSL_Api(); |
69 | m_lslApi.Initialize(engine, part, part.LocalId, part.UUID); | 69 | m_lslApi.Initialize(engine, part, null); |
70 | |||
71 | } | 70 | } |
72 | 71 | ||
73 | [Test] | 72 | [Test] |
@@ -261,7 +260,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
261 | TestHelpers.InMethod(); | 260 | TestHelpers.InMethod(); |
262 | 261 | ||
263 | // Create Prim1. | 262 | // Create Prim1. |
264 | Scene scene = SceneHelpers.SetupScene(); | 263 | Scene scene = new SceneHelpers().SetupScene(); |
265 | string obj1Name = "Prim1"; | 264 | string obj1Name = "Prim1"; |
266 | UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 265 | UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); |
267 | SceneObjectPart part1 = | 266 | SceneObjectPart part1 = |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index 7573dff..3965734 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
67 | config = initConfigSource.AddConfig("NPC"); | 67 | config = initConfigSource.AddConfig("NPC"); |
68 | config.Set("Enabled", "true"); | 68 | config.Set("Enabled", "true"); |
69 | 69 | ||
70 | m_scene = SceneHelpers.SetupScene(); | 70 | m_scene = new SceneHelpers().SetupScene(); |
71 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); | 71 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); |
72 | 72 | ||
73 | m_engine = new XEngine.XEngine(); | 73 | m_engine = new XEngine.XEngine(); |
@@ -95,7 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
95 | m_scene.AddSceneObject(so); | 95 | m_scene.AddSceneObject(so); |
96 | 96 | ||
97 | OSSL_Api osslApi = new OSSL_Api(); | 97 | OSSL_Api osslApi = new OSSL_Api(); |
98 | osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); | 98 | osslApi.Initialize(m_engine, part, null); |
99 | 99 | ||
100 | string notecardName = "appearanceNc"; | 100 | string notecardName = "appearanceNc"; |
101 | osslApi.osOwnerSaveAppearance(notecardName); | 101 | osslApi.osOwnerSaveAppearance(notecardName); |
@@ -130,7 +130,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
130 | m_scene.AddSceneObject(so); | 130 | m_scene.AddSceneObject(so); |
131 | 131 | ||
132 | OSSL_Api osslApi = new OSSL_Api(); | 132 | OSSL_Api osslApi = new OSSL_Api(); |
133 | osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); | 133 | osslApi.Initialize(m_engine, part, null); |
134 | 134 | ||
135 | string notecardName = "appearanceNc"; | 135 | string notecardName = "appearanceNc"; |
136 | osslApi.osOwnerSaveAppearance(notecardName); | 136 | osslApi.osOwnerSaveAppearance(notecardName); |
@@ -161,7 +161,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
161 | m_scene.AddSceneObject(so); | 161 | m_scene.AddSceneObject(so); |
162 | 162 | ||
163 | OSSL_Api osslApi = new OSSL_Api(); | 163 | OSSL_Api osslApi = new OSSL_Api(); |
164 | osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); | 164 | osslApi.Initialize(m_engine, part, null); |
165 | 165 | ||
166 | string notecardName = "appearanceNc"; | 166 | string notecardName = "appearanceNc"; |
167 | 167 | ||
@@ -202,7 +202,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
202 | m_scene.AddSceneObject(so); | 202 | m_scene.AddSceneObject(so); |
203 | 203 | ||
204 | OSSL_Api osslApi = new OSSL_Api(); | 204 | OSSL_Api osslApi = new OSSL_Api(); |
205 | osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); | 205 | osslApi.Initialize(m_engine, part, null); |
206 | 206 | ||
207 | string notecardName = "appearanceNc"; | 207 | string notecardName = "appearanceNc"; |
208 | 208 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs index 9d9fc51..0ccd889 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | |||
@@ -68,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
68 | config = initConfigSource.AddConfig("NPC"); | 68 | config = initConfigSource.AddConfig("NPC"); |
69 | config.Set("Enabled", "true"); | 69 | config.Set("Enabled", "true"); |
70 | 70 | ||
71 | m_scene = SceneHelpers.SetupScene(); | 71 | m_scene = new SceneHelpers().SetupScene(); |
72 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); | 72 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); |
73 | 73 | ||
74 | m_engine = new XEngine.XEngine(); | 74 | m_engine = new XEngine.XEngine(); |
@@ -104,10 +104,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
104 | m_scene.AddSceneObject(otherSo); | 104 | m_scene.AddSceneObject(otherSo); |
105 | 105 | ||
106 | OSSL_Api osslApi = new OSSL_Api(); | 106 | OSSL_Api osslApi = new OSSL_Api(); |
107 | osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); | 107 | osslApi.Initialize(m_engine, part, null); |
108 | 108 | ||
109 | OSSL_Api otherOsslApi = new OSSL_Api(); | 109 | OSSL_Api otherOsslApi = new OSSL_Api(); |
110 | otherOsslApi.Initialize(m_engine, otherPart, otherPart.LocalId, otherPart.UUID); | 110 | otherOsslApi.Initialize(m_engine, otherPart, null); |
111 | 111 | ||
112 | string notecardName = "appearanceNc"; | 112 | string notecardName = "appearanceNc"; |
113 | osslApi.osOwnerSaveAppearance(notecardName); | 113 | osslApi.osOwnerSaveAppearance(notecardName); |
@@ -151,7 +151,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
151 | m_scene.AddSceneObject(so); | 151 | m_scene.AddSceneObject(so); |
152 | 152 | ||
153 | OSSL_Api osslApi = new OSSL_Api(); | 153 | OSSL_Api osslApi = new OSSL_Api(); |
154 | osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); | 154 | osslApi.Initialize(m_engine, part, null); |
155 | 155 | ||
156 | string notecardName = "appearanceNc"; | 156 | string notecardName = "appearanceNc"; |
157 | osslApi.osOwnerSaveAppearance(notecardName); | 157 | osslApi.osOwnerSaveAppearance(notecardName); |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs index 7d7bd82..a3f848c 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs | |||
@@ -73,7 +73,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests | |||
73 | // to AssemblyResolver.OnAssemblyResolve fails. | 73 | // to AssemblyResolver.OnAssemblyResolve fails. |
74 | xEngineConfig.Set("AppDomainLoading", "false"); | 74 | xEngineConfig.Set("AppDomainLoading", "false"); |
75 | 75 | ||
76 | m_scene = SceneHelpers.SetupScene("My Test", UUID.Random(), 1000, 1000, null, configSource); | 76 | m_scene = new SceneHelpers().SetupScene("My Test", UUID.Random(), 1000, 1000, configSource); |
77 | SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine, wcModule); | 77 | SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine, wcModule); |
78 | m_scene.StartScripts(); | 78 | m_scene.StartScripts(); |
79 | } | 79 | } |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 1e0f01f..eeb125e 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1089,11 +1089,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1089 | 1089 | ||
1090 | AppDomain sandbox; | 1090 | AppDomain sandbox; |
1091 | if (m_AppDomainLoading) | 1091 | if (m_AppDomainLoading) |
1092 | { | ||
1092 | sandbox = AppDomain.CreateDomain( | 1093 | sandbox = AppDomain.CreateDomain( |
1093 | m_Scene.RegionInfo.RegionID.ToString(), | 1094 | m_Scene.RegionInfo.RegionID.ToString(), |
1094 | evidence, appSetup); | 1095 | evidence, appSetup); |
1096 | m_AppDomains[appDomain].AssemblyResolve += | ||
1097 | new ResolveEventHandler( | ||
1098 | AssemblyResolver.OnAssemblyResolve); | ||
1099 | } | ||
1095 | else | 1100 | else |
1101 | { | ||
1096 | sandbox = AppDomain.CurrentDomain; | 1102 | sandbox = AppDomain.CurrentDomain; |
1103 | } | ||
1097 | 1104 | ||
1098 | //PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel(); | 1105 | //PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel(); |
1099 | //AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition(); | 1106 | //AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition(); |
@@ -1105,9 +1112,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1105 | 1112 | ||
1106 | m_AppDomains[appDomain] = sandbox; | 1113 | m_AppDomains[appDomain] = sandbox; |
1107 | 1114 | ||
1108 | m_AppDomains[appDomain].AssemblyResolve += | ||
1109 | new ResolveEventHandler( | ||
1110 | AssemblyResolver.OnAssemblyResolve); | ||
1111 | m_DomainScripts[appDomain] = new List<UUID>(); | 1115 | m_DomainScripts[appDomain] = new List<UUID>(); |
1112 | } | 1116 | } |
1113 | catch (Exception e) | 1117 | catch (Exception e) |
@@ -1898,9 +1902,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1898 | // if there already exists a file at that location, it may be locked. | 1902 | // if there already exists a file at that location, it may be locked. |
1899 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message); | 1903 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message); |
1900 | } | 1904 | } |
1905 | |||
1906 | string textpath = path + ".text"; | ||
1901 | try | 1907 | try |
1902 | { | 1908 | { |
1903 | using (FileStream fs = File.Create(path + ".text")) | 1909 | using (FileStream fs = File.Create(textpath)) |
1904 | { | 1910 | { |
1905 | using (StreamWriter sw = new StreamWriter(fs)) | 1911 | using (StreamWriter sw = new StreamWriter(fs)) |
1906 | { | 1912 | { |
@@ -1913,7 +1919,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1913 | catch (IOException ex) | 1919 | catch (IOException ex) |
1914 | { | 1920 | { |
1915 | // if there already exists a file at that location, it may be locked. | 1921 | // if there already exists a file at that location, it may be locked. |
1916 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message); | 1922 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", textpath, ex.Message); |
1917 | } | 1923 | } |
1918 | } | 1924 | } |
1919 | } | 1925 | } |
@@ -1962,7 +1968,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1962 | catch (IOException ex) | 1968 | catch (IOException ex) |
1963 | { | 1969 | { |
1964 | // if there already exists a file at that location, it may be locked. | 1970 | // if there already exists a file at that location, it may be locked. |
1965 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message); | 1971 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", mappath, ex.Message); |
1966 | } | 1972 | } |
1967 | } | 1973 | } |
1968 | 1974 | ||
@@ -1997,45 +2003,59 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1997 | if (!topScripts.ContainsKey(si.LocalID)) | 2003 | if (!topScripts.ContainsKey(si.LocalID)) |
1998 | topScripts[si.RootLocalID] = 0; | 2004 | topScripts[si.RootLocalID] = 0; |
1999 | 2005 | ||
2000 | // long ticksElapsed = tickNow - si.MeasurementPeriodTickStart; | 2006 | topScripts[si.RootLocalID] += CalculateAdjustedExectionTime(si, tickNow); |
2001 | // float framesElapsed = ticksElapsed / (18.1818 * TimeSpan.TicksPerMillisecond); | 2007 | } |
2002 | 2008 | } | |
2003 | // Execution time of the script adjusted by it's measurement period to make scripts started at | ||
2004 | // different times comparable. | ||
2005 | // float adjustedExecutionTime | ||
2006 | // = (float)si.MeasurementPeriodExecutionTime | ||
2007 | // / ((float)(tickNow - si.MeasurementPeriodTickStart) / ScriptInstance.MaxMeasurementPeriod) | ||
2008 | // / TimeSpan.TicksPerMillisecond; | ||
2009 | |||
2010 | long ticksElapsed = tickNow - si.MeasurementPeriodTickStart; | ||
2011 | |||
2012 | // Avoid divide by zerp | ||
2013 | if (ticksElapsed == 0) | ||
2014 | ticksElapsed = 1; | ||
2015 | 2009 | ||
2016 | // Scale execution time to the ideal 55 fps frame time for these reasons. | 2010 | return topScripts; |
2017 | // | 2011 | } |
2018 | // 1) XEngine does not execute scripts per frame, unlike other script engines. Hence, there is no | ||
2019 | // 'script execution time per frame', which is the original purpose of this value. | ||
2020 | // | ||
2021 | // 2) Giving the raw execution times is misleading since scripts start at different times, making | ||
2022 | // it impossible to compare scripts. | ||
2023 | // | ||
2024 | // 3) Scaling the raw execution time to the time that the script has been running is better but | ||
2025 | // is still misleading since a script that has just been rezzed may appear to have been running | ||
2026 | // for much longer. | ||
2027 | // | ||
2028 | // 4) Hence, we scale execution time to an idealised frame time (55 fps). This is also not perfect | ||
2029 | // since the figure does not represent actual execution time and very hard running scripts will | ||
2030 | // never exceed 18ms (though this is a very high number for script execution so is a warning sign). | ||
2031 | float adjustedExecutionTime | ||
2032 | = ((float)si.MeasurementPeriodExecutionTime / ticksElapsed) * 18.1818f; | ||
2033 | 2012 | ||
2034 | topScripts[si.RootLocalID] += adjustedExecutionTime; | 2013 | public float GetScriptExecutionTime(List<UUID> itemIDs) |
2014 | { | ||
2015 | if (itemIDs == null|| itemIDs.Count == 0) | ||
2016 | { | ||
2017 | return 0.0f; | ||
2018 | } | ||
2019 | float time = 0.0f; | ||
2020 | long tickNow = Util.EnvironmentTickCount(); | ||
2021 | IScriptInstance si; | ||
2022 | // Calculate the time for all scripts that this engine is executing | ||
2023 | // Ignore any others | ||
2024 | foreach (UUID id in itemIDs) | ||
2025 | { | ||
2026 | si = GetInstance(id); | ||
2027 | if (si != null && si.Running) | ||
2028 | { | ||
2029 | time += CalculateAdjustedExectionTime(si, tickNow); | ||
2035 | } | 2030 | } |
2036 | } | 2031 | } |
2032 | return time; | ||
2033 | } | ||
2037 | 2034 | ||
2038 | return topScripts; | 2035 | private float CalculateAdjustedExectionTime(IScriptInstance si, long tickNow) |
2036 | { | ||
2037 | long ticksElapsed = tickNow - si.MeasurementPeriodTickStart; | ||
2038 | |||
2039 | // Avoid divide by zero | ||
2040 | if (ticksElapsed == 0) | ||
2041 | ticksElapsed = 1; | ||
2042 | |||
2043 | // Scale execution time to the ideal 55 fps frame time for these reasons. | ||
2044 | // | ||
2045 | // 1) XEngine does not execute scripts per frame, unlike other script engines. Hence, there is no | ||
2046 | // 'script execution time per frame', which is the original purpose of this value. | ||
2047 | // | ||
2048 | // 2) Giving the raw execution times is misleading since scripts start at different times, making | ||
2049 | // it impossible to compare scripts. | ||
2050 | // | ||
2051 | // 3) Scaling the raw execution time to the time that the script has been running is better but | ||
2052 | // is still misleading since a script that has just been rezzed may appear to have been running | ||
2053 | // for much longer. | ||
2054 | // | ||
2055 | // 4) Hence, we scale execution time to an idealised frame time (55 fps). This is also not perfect | ||
2056 | // since the figure does not represent actual execution time and very hard running scripts will | ||
2057 | // never exceed 18ms (though this is a very high number for script execution so is a warning sign). | ||
2058 | return ((float)si.MeasurementPeriodExecutionTime / ticksElapsed) * 18.1818f; | ||
2039 | } | 2059 | } |
2040 | 2060 | ||
2041 | public void SuspendScript(UUID itemID) | 2061 | public void SuspendScript(UUID itemID) |
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index b9ba4bc..faf746f 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs | |||
@@ -90,7 +90,7 @@ namespace OpenSim.Region.UserStatistics | |||
90 | 90 | ||
91 | dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3"); | 91 | dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3"); |
92 | dbConn.Open(); | 92 | dbConn.Open(); |
93 | CheckAndUpdateDatabase(dbConn); | 93 | CreateTables(dbConn); |
94 | 94 | ||
95 | Prototype_distributor protodep = new Prototype_distributor(); | 95 | Prototype_distributor protodep = new Prototype_distributor(); |
96 | Updater_distributor updatedep = new Updater_distributor(); | 96 | Updater_distributor updatedep = new Updater_distributor(); |
@@ -131,7 +131,7 @@ namespace OpenSim.Region.UserStatistics | |||
131 | } | 131 | } |
132 | } | 132 | } |
133 | 133 | ||
134 | public void ReceiveClassicSimStatsPacket(SimStats stats) | 134 | private void ReceiveClassicSimStatsPacket(SimStats stats) |
135 | { | 135 | { |
136 | if (!enabled) | 136 | if (!enabled) |
137 | { | 137 | { |
@@ -163,7 +163,7 @@ namespace OpenSim.Region.UserStatistics | |||
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | public Hashtable HandleUnknownCAPSRequest(Hashtable request) | 166 | private Hashtable HandleUnknownCAPSRequest(Hashtable request) |
167 | { | 167 | { |
168 | //string regpath = request["uri"].ToString(); | 168 | //string regpath = request["uri"].ToString(); |
169 | int response_code = 200; | 169 | int response_code = 200; |
@@ -178,7 +178,7 @@ namespace OpenSim.Region.UserStatistics | |||
178 | return responsedata; | 178 | return responsedata; |
179 | } | 179 | } |
180 | 180 | ||
181 | public Hashtable HandleStatsRequest(Hashtable request) | 181 | private Hashtable HandleStatsRequest(Hashtable request) |
182 | { | 182 | { |
183 | lastHit = System.Environment.TickCount; | 183 | lastHit = System.Environment.TickCount; |
184 | Hashtable responsedata = new Hashtable(); | 184 | Hashtable responsedata = new Hashtable(); |
@@ -237,36 +237,12 @@ namespace OpenSim.Region.UserStatistics | |||
237 | 237 | ||
238 | return responsedata; | 238 | return responsedata; |
239 | } | 239 | } |
240 | |||
241 | public void CheckAndUpdateDatabase(SqliteConnection db) | ||
242 | { | ||
243 | lock (db) | ||
244 | { | ||
245 | // TODO: FIXME: implement stats migrations | ||
246 | const string SQL = @"SELECT * FROM migrations LIMIT 1"; | ||
247 | |||
248 | using (SqliteCommand cmd = new SqliteCommand(SQL, db)) | ||
249 | { | ||
250 | try | ||
251 | { | ||
252 | cmd.ExecuteNonQuery(); | ||
253 | } | ||
254 | catch (SqliteSyntaxException) | ||
255 | { | ||
256 | CreateTables(db); | ||
257 | } | ||
258 | } | ||
259 | } | ||
260 | } | ||
261 | 240 | ||
262 | public void CreateTables(SqliteConnection db) | 241 | private void CreateTables(SqliteConnection db) |
263 | { | 242 | { |
264 | using (SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db)) | 243 | using (SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db)) |
265 | { | 244 | { |
266 | createcmd.ExecuteNonQuery(); | 245 | createcmd.ExecuteNonQuery(); |
267 | |||
268 | createcmd.CommandText = SQL_MIGRA_TABLE_CREATE; | ||
269 | createcmd.ExecuteNonQuery(); | ||
270 | } | 246 | } |
271 | } | 247 | } |
272 | 248 | ||
@@ -301,22 +277,23 @@ namespace OpenSim.Region.UserStatistics | |||
301 | get { return true; } | 277 | get { return true; } |
302 | } | 278 | } |
303 | 279 | ||
304 | public void OnRegisterCaps(UUID agentID, Caps caps) | 280 | private void OnRegisterCaps(UUID agentID, Caps caps) |
305 | { | 281 | { |
306 | // m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); | 282 | // m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); |
307 | 283 | ||
308 | string capsPath = "/CAPS/VS/" + UUID.Random(); | 284 | string capsPath = "/CAPS/VS/" + UUID.Random(); |
309 | caps.RegisterHandler("ViewerStats", | 285 | caps.RegisterHandler( |
310 | new RestStreamHandler("POST", capsPath, | 286 | "ViewerStats", |
311 | delegate(string request, string path, string param, | 287 | new RestStreamHandler( |
312 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 288 | "POST", |
313 | { | 289 | capsPath, |
314 | return ViewerStatsReport(request, path, param, | 290 | (request, path, param, httpRequest, httpResponse) |
315 | agentID, caps); | 291 | => ViewerStatsReport(request, path, param, agentID, caps), |
316 | })); | 292 | "ViewerStats", |
293 | agentID.ToString())); | ||
317 | } | 294 | } |
318 | 295 | ||
319 | public void OnDeRegisterCaps(UUID agentID, Caps caps) | 296 | private void OnDeRegisterCaps(UUID agentID, Caps caps) |
320 | { | 297 | { |
321 | } | 298 | } |
322 | 299 | ||
@@ -336,7 +313,7 @@ namespace OpenSim.Region.UserStatistics | |||
336 | } | 313 | } |
337 | } | 314 | } |
338 | 315 | ||
339 | public void OnMakeRootAgent(ScenePresence agent) | 316 | private void OnMakeRootAgent(ScenePresence agent) |
340 | { | 317 | { |
341 | UUID regionUUID = GetRegionUUIDFromHandle(agent.RegionHandle); | 318 | UUID regionUUID = GetRegionUUIDFromHandle(agent.RegionHandle); |
342 | 319 | ||
@@ -365,11 +342,11 @@ namespace OpenSim.Region.UserStatistics | |||
365 | } | 342 | } |
366 | } | 343 | } |
367 | 344 | ||
368 | public void OnMakeChildAgent(ScenePresence agent) | 345 | private void OnMakeChildAgent(ScenePresence agent) |
369 | { | 346 | { |
370 | } | 347 | } |
371 | 348 | ||
372 | public void OnClientClosed(UUID agentID, Scene scene) | 349 | private void OnClientClosed(UUID agentID, Scene scene) |
373 | { | 350 | { |
374 | lock (m_sessions) | 351 | lock (m_sessions) |
375 | { | 352 | { |
@@ -380,7 +357,7 @@ namespace OpenSim.Region.UserStatistics | |||
380 | } | 357 | } |
381 | } | 358 | } |
382 | 359 | ||
383 | public string readLogLines(int amount) | 360 | private string readLogLines(int amount) |
384 | { | 361 | { |
385 | Encoding encoding = Encoding.ASCII; | 362 | Encoding encoding = Encoding.ASCII; |
386 | int sizeOfChar = encoding.GetByteCount("\n"); | 363 | int sizeOfChar = encoding.GetByteCount("\n"); |
@@ -418,7 +395,7 @@ namespace OpenSim.Region.UserStatistics | |||
418 | return encoding.GetString(buffer); | 395 | return encoding.GetString(buffer); |
419 | } | 396 | } |
420 | 397 | ||
421 | public UUID GetRegionUUIDFromHandle(ulong regionhandle) | 398 | private UUID GetRegionUUIDFromHandle(ulong regionhandle) |
422 | { | 399 | { |
423 | lock (m_scenes) | 400 | lock (m_scenes) |
424 | { | 401 | { |
@@ -441,17 +418,17 @@ namespace OpenSim.Region.UserStatistics | |||
441 | /// <param name="agentID"></param> | 418 | /// <param name="agentID"></param> |
442 | /// <param name="caps"></param> | 419 | /// <param name="caps"></param> |
443 | /// <returns></returns> | 420 | /// <returns></returns> |
444 | public string ViewerStatsReport(string request, string path, string param, | 421 | private string ViewerStatsReport(string request, string path, string param, |
445 | UUID agentID, Caps caps) | 422 | UUID agentID, Caps caps) |
446 | { | 423 | { |
447 | // m_log.DebugFormat("[WEB STATS MODULE]: Received viewer starts report from {0}", agentID); | 424 | // m_log.DebugFormat("[WEB STATS MODULE]: Received viewer starts report from {0}", agentID); |
448 | 425 | ||
449 | UpdateUserStats(ParseViewerStats(request,agentID), dbConn); | 426 | UpdateUserStats(ParseViewerStats(request, agentID), dbConn); |
450 | 427 | ||
451 | return String.Empty; | 428 | return String.Empty; |
452 | } | 429 | } |
453 | 430 | ||
454 | public UserSessionID ParseViewerStats(string request, UUID agentID) | 431 | private UserSessionID ParseViewerStats(string request, UUID agentID) |
455 | { | 432 | { |
456 | UserSessionID uid = new UserSessionID(); | 433 | UserSessionID uid = new UserSessionID(); |
457 | UserSessionData usd; | 434 | UserSessionData usd; |
@@ -592,14 +569,14 @@ namespace OpenSim.Region.UserStatistics | |||
592 | return uid; | 569 | return uid; |
593 | } | 570 | } |
594 | 571 | ||
595 | public void UpdateUserStats(UserSessionID uid, SqliteConnection db) | 572 | private void UpdateUserStats(UserSessionID uid, SqliteConnection db) |
596 | { | 573 | { |
597 | if (uid.session_id == UUID.Zero) | 574 | if (uid.session_id == UUID.Zero) |
598 | return; | 575 | return; |
599 | 576 | ||
600 | lock (db) | 577 | lock (db) |
601 | { | 578 | { |
602 | using (SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db)) | 579 | using (SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_INSERT, db)) |
603 | { | 580 | { |
604 | updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString())); | 581 | updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString())); |
605 | updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString())); | 582 | updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString())); |
@@ -648,44 +625,26 @@ namespace OpenSim.Region.UserStatistics | |||
648 | updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped)); | 625 | updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped)); |
649 | updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends)); | 626 | updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends)); |
650 | updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid)); | 627 | updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid)); |
651 | |||
652 | updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit)); | 628 | updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit)); |
653 | updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent)); | 629 | updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent)); |
654 | updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet)); | 630 | updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet)); |
655 | |||
656 | updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString())); | ||
657 | updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString())); | ||
658 | updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString())); | ||
659 | 631 | ||
660 | // m_log.DebugFormat("[WEB STATS MODULE]: Database stats update for {0}", uid.session_data.agent_id); | 632 | // StringBuilder parameters = new StringBuilder(); |
661 | 633 | // SqliteParameterCollection spc = updatecmd.Parameters; | |
662 | int result = updatecmd.ExecuteNonQuery(); | 634 | // foreach (SqliteParameter sp in spc) |
663 | 635 | // parameters.AppendFormat("{0}={1},", sp.ParameterName, sp.Value); | |
664 | if (result == 0) | 636 | // |
665 | { | 637 | // m_log.DebugFormat("[WEB STATS MODULE]: Parameters {0}", parameters); |
666 | // m_log.DebugFormat("[WEB STATS MODULE]: Database stats insert for {0}", uid.session_data.agent_id); | ||
667 | 638 | ||
668 | updatecmd.CommandText = SQL_STATS_TABLE_INSERT; | 639 | // m_log.DebugFormat("[WEB STATS MODULE]: Database stats update for {0}", uid.session_data.agent_id); |
669 | 640 | ||
670 | try | 641 | updatecmd.ExecuteNonQuery(); |
671 | { | ||
672 | updatecmd.ExecuteNonQuery(); | ||
673 | } | ||
674 | catch (Exception e) | ||
675 | { | ||
676 | m_log.WarnFormat( | ||
677 | "[WEB STATS MODULE]: failed to write stats for {0}, storage Execution Exception {1}{2}", | ||
678 | uid.session_data.agent_id, e.Message, e.StackTrace); | ||
679 | } | ||
680 | } | ||
681 | } | 642 | } |
682 | } | 643 | } |
683 | } | 644 | } |
684 | 645 | ||
685 | #region SQL | 646 | #region SQL |
686 | private const string SQL_MIGRA_TABLE_CREATE = @"create table migrations(name varchar(100), version int)"; | 647 | private const string SQL_STATS_TABLE_CREATE = @"CREATE TABLE IF NOT EXISTS stats_session_data ( |
687 | |||
688 | private const string SQL_STATS_TABLE_CREATE = @"CREATE TABLE stats_session_data ( | ||
689 | session_id VARCHAR(36) NOT NULL PRIMARY KEY, | 648 | session_id VARCHAR(36) NOT NULL PRIMARY KEY, |
690 | agent_id VARCHAR(36) NOT NULL DEFAULT '', | 649 | agent_id VARCHAR(36) NOT NULL DEFAULT '', |
691 | region_id VARCHAR(36) NOT NULL DEFAULT '', | 650 | region_id VARCHAR(36) NOT NULL DEFAULT '', |
@@ -735,11 +694,11 @@ namespace OpenSim.Region.UserStatistics | |||
735 | f_send_packet INT NOT NULL DEFAULT '0' | 694 | f_send_packet INT NOT NULL DEFAULT '0' |
736 | );"; | 695 | );"; |
737 | 696 | ||
738 | private const string SQL_STATS_TABLE_INSERT = @"INSERT INTO stats_session_data ( | 697 | private const string SQL_STATS_TABLE_INSERT = @"INSERT OR REPLACE INTO stats_session_data ( |
739 | session_id, agent_id, region_id, last_updated, remote_ip, name_f, name_l, avg_agents_in_view, min_agents_in_view, max_agents_in_view, | 698 | session_id, agent_id, region_id, last_updated, remote_ip, name_f, name_l, avg_agents_in_view, min_agents_in_view, max_agents_in_view, |
740 | mode_agents_in_view, avg_fps, min_fps, max_fps, mode_fps, a_language, mem_use, meters_traveled, avg_ping, min_ping, max_ping, mode_ping, | 699 | mode_agents_in_view, avg_fps, min_fps, max_fps, mode_fps, a_language, mem_use, meters_traveled, avg_ping, min_ping, max_ping, mode_ping, |
741 | regions_visited, run_time, avg_sim_fps, min_sim_fps, max_sim_fps, mode_sim_fps, start_time, client_version, s_cpu, s_gpu, s_os, s_ram, | 700 | regions_visited, run_time, avg_sim_fps, min_sim_fps, max_sim_fps, mode_sim_fps, start_time, client_version, s_cpu, s_gpu, s_os, s_ram, |
742 | d_object_kb, d_texture_kb, n_in_kb, n_in_pk, n_out_kb, n_out_pk, f_dropped, f_failed_resends, f_invalid, f_invalid, f_off_circuit, | 701 | d_object_kb, d_texture_kb, d_world_kb, n_in_kb, n_in_pk, n_out_kb, n_out_pk, f_dropped, f_failed_resends, f_invalid, f_off_circuit, |
743 | f_resent, f_send_packet | 702 | f_resent, f_send_packet |
744 | ) | 703 | ) |
745 | VALUES | 704 | VALUES |
@@ -747,62 +706,13 @@ VALUES | |||
747 | :session_id, :agent_id, :region_id, :last_updated, :remote_ip, :name_f, :name_l, :avg_agents_in_view, :min_agents_in_view, :max_agents_in_view, | 706 | :session_id, :agent_id, :region_id, :last_updated, :remote_ip, :name_f, :name_l, :avg_agents_in_view, :min_agents_in_view, :max_agents_in_view, |
748 | :mode_agents_in_view, :avg_fps, :min_fps, :max_fps, :mode_fps, :a_language, :mem_use, :meters_traveled, :avg_ping, :min_ping, :max_ping, :mode_ping, | 707 | :mode_agents_in_view, :avg_fps, :min_fps, :max_fps, :mode_fps, :a_language, :mem_use, :meters_traveled, :avg_ping, :min_ping, :max_ping, :mode_ping, |
749 | :regions_visited, :run_time, :avg_sim_fps, :min_sim_fps, :max_sim_fps, :mode_sim_fps, :start_time, :client_version, :s_cpu, :s_gpu, :s_os, :s_ram, | 708 | :regions_visited, :run_time, :avg_sim_fps, :min_sim_fps, :max_sim_fps, :mode_sim_fps, :start_time, :client_version, :s_cpu, :s_gpu, :s_os, :s_ram, |
750 | :d_object_kb, :d_texture_kb, :n_in_kb, :n_in_pk, :n_out_kb, :n_out_pk, :f_dropped, :f_failed_resends, :f_invalid, :f_invalid, :f_off_circuit, | 709 | :d_object_kb, :d_texture_kb, :d_world_kb, :n_in_kb, :n_in_pk, :n_out_kb, :n_out_pk, :f_dropped, :f_failed_resends, :f_invalid, :f_off_circuit, |
751 | :f_resent, :f_send_packet | 710 | :f_resent, :f_send_packet |
752 | ) | 711 | ) |
753 | "; | 712 | "; |
754 | 713 | ||
755 | private const string SQL_STATS_TABLE_UPDATE = @" | 714 | #endregion |
756 | UPDATE stats_session_data | 715 | |
757 | set session_id=:session_id, | ||
758 | agent_id=:agent_id, | ||
759 | region_id=:region_id, | ||
760 | last_updated=:last_updated, | ||
761 | remote_ip=:remote_ip, | ||
762 | name_f=:name_f, | ||
763 | name_l=:name_l, | ||
764 | avg_agents_in_view=:avg_agents_in_view, | ||
765 | min_agents_in_view=:min_agents_in_view, | ||
766 | max_agents_in_view=:max_agents_in_view, | ||
767 | mode_agents_in_view=:mode_agents_in_view, | ||
768 | avg_fps=:avg_fps, | ||
769 | min_fps=:min_fps, | ||
770 | max_fps=:max_fps, | ||
771 | mode_fps=:mode_fps, | ||
772 | a_language=:a_language, | ||
773 | mem_use=:mem_use, | ||
774 | meters_traveled=:meters_traveled, | ||
775 | avg_ping=:avg_ping, | ||
776 | min_ping=:min_ping, | ||
777 | max_ping=:max_ping, | ||
778 | mode_ping=:mode_ping, | ||
779 | regions_visited=:regions_visited, | ||
780 | run_time=:run_time, | ||
781 | avg_sim_fps=:avg_sim_fps, | ||
782 | min_sim_fps=:min_sim_fps, | ||
783 | max_sim_fps=:max_sim_fps, | ||
784 | mode_sim_fps=:mode_sim_fps, | ||
785 | start_time=:start_time, | ||
786 | client_version=:client_version, | ||
787 | s_cpu=:s_cpu, | ||
788 | s_gpu=:s_gpu, | ||
789 | s_os=:s_os, | ||
790 | s_ram=:s_ram, | ||
791 | d_object_kb=:d_object_kb, | ||
792 | d_texture_kb=:d_texture_kb, | ||
793 | d_world_kb=:d_world_kb, | ||
794 | n_in_kb=:n_in_kb, | ||
795 | n_in_pk=:n_in_pk, | ||
796 | n_out_kb=:n_out_kb, | ||
797 | n_out_pk=:n_out_pk, | ||
798 | f_dropped=:f_dropped, | ||
799 | f_failed_resends=:f_failed_resends, | ||
800 | f_invalid=:f_invalid, | ||
801 | f_off_circuit=:f_off_circuit, | ||
802 | f_resent=:f_resent, | ||
803 | f_send_packet=:f_send_packet | ||
804 | WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"; | ||
805 | #endregion | ||
806 | } | 716 | } |
807 | 717 | ||
808 | public static class UserSessionUtil | 718 | public static class UserSessionUtil |
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 8effdd2..42c82cf 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs | |||
@@ -117,7 +117,10 @@ namespace OpenSim.Server.Base | |||
117 | catch (Exception e) | 117 | catch (Exception e) |
118 | { | 118 | { |
119 | if (!(e is System.MissingMethodException)) | 119 | if (!(e is System.MissingMethodException)) |
120 | m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException); | 120 | { |
121 | m_log.ErrorFormat("Error loading plugin {0} from {1}. Exception: {2}", | ||
122 | interfaceName, dllName, e.InnerException == null ? e.Message : e.InnerException.Message); | ||
123 | } | ||
121 | return null; | 124 | return null; |
122 | } | 125 | } |
123 | 126 | ||
@@ -265,7 +268,7 @@ namespace OpenSim.Server.Base | |||
265 | continue; | 268 | continue; |
266 | 269 | ||
267 | XmlElement elem = parent.OwnerDocument.CreateElement("", | 270 | XmlElement elem = parent.OwnerDocument.CreateElement("", |
268 | kvp.Key, ""); | 271 | XmlConvert.EncodeLocalName(kvp.Key), ""); |
269 | 272 | ||
270 | if (kvp.Value is Dictionary<string, object>) | 273 | if (kvp.Value is Dictionary<string, object>) |
271 | { | 274 | { |
@@ -320,11 +323,11 @@ namespace OpenSim.Server.Base | |||
320 | XmlNode type = part.Attributes.GetNamedItem("type"); | 323 | XmlNode type = part.Attributes.GetNamedItem("type"); |
321 | if (type == null || type.Value != "List") | 324 | if (type == null || type.Value != "List") |
322 | { | 325 | { |
323 | ret[part.Name] = part.InnerText; | 326 | ret[XmlConvert.DecodeName(part.Name)] = part.InnerText; |
324 | } | 327 | } |
325 | else | 328 | else |
326 | { | 329 | { |
327 | ret[part.Name] = ParseElement(part); | 330 | ret[XmlConvert.DecodeName(part.Name)] = ParseElement(part); |
328 | } | 331 | } |
329 | } | 332 | } |
330 | 333 | ||
diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs index dfed761..18cef15 100644 --- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs | |||
@@ -191,6 +191,8 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>. | |||
191 | 191 | ||
192 | #endregion HTML | 192 | #endregion HTML |
193 | 193 | ||
194 | public string Name { get { return "OpenId"; } } | ||
195 | public string Description { get { return null; } } | ||
194 | public string ContentType { get { return m_contentType; } } | 196 | public string ContentType { get { return m_contentType; } } |
195 | public string HttpMethod { get { return m_httpMethod; } } | 197 | public string HttpMethod { get { return m_httpMethod; } } |
196 | public string Path { get { return m_path; } } | 198 | public string Path { get { return m_path; } } |
diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs index 59420f5..ef9b96f 100644 --- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs | |||
@@ -95,7 +95,8 @@ namespace OpenSim.Server.Handlers.Friends | |||
95 | return DeleteFriendString(request); | 95 | return DeleteFriendString(request); |
96 | 96 | ||
97 | } | 97 | } |
98 | m_log.DebugFormat("[FRIENDS HANDLER]: unknown method {0} request {1}", method.Length, method); | 98 | |
99 | m_log.DebugFormat("[FRIENDS HANDLER]: unknown method request {0}", method); | ||
99 | } | 100 | } |
100 | catch (Exception e) | 101 | catch (Exception e) |
101 | { | 102 | { |
@@ -103,7 +104,6 @@ namespace OpenSim.Server.Handlers.Friends | |||
103 | } | 104 | } |
104 | 105 | ||
105 | return FailureResult(); | 106 | return FailureResult(); |
106 | |||
107 | } | 107 | } |
108 | 108 | ||
109 | #region Method-specific handlers | 109 | #region Method-specific handlers |
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index bebf482..91d14cb 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | |||
@@ -116,7 +116,7 @@ namespace OpenSim.Server.Handlers.Grid | |||
116 | return GetRegionFlags(request); | 116 | return GetRegionFlags(request); |
117 | } | 117 | } |
118 | 118 | ||
119 | m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); | 119 | m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method); |
120 | } | 120 | } |
121 | catch (Exception e) | 121 | catch (Exception e) |
122 | { | 122 | { |
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs index 8ef03e7..c2f127c 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs | |||
@@ -122,7 +122,8 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
122 | return GrantRights(request); | 122 | return GrantRights(request); |
123 | */ | 123 | */ |
124 | } | 124 | } |
125 | m_log.DebugFormat("[HGFRIENDS HANDLER]: unknown method {0} request {1}", method.Length, method); | 125 | |
126 | m_log.DebugFormat("[HGFRIENDS HANDLER]: unknown method {0}", method); | ||
126 | } | 127 | } |
127 | catch (Exception e) | 128 | catch (Exception e) |
128 | { | 129 | { |
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index 75dd711..4a61969 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | |||
@@ -33,17 +33,24 @@ using System.Xml; | |||
33 | 33 | ||
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using log4net; | 35 | using log4net; |
36 | using OpenMetaverse; | ||
36 | 37 | ||
38 | using OpenSim.Framework; | ||
37 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
38 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
39 | using OpenSim.Framework.Servers.HttpServer; | 41 | using OpenSim.Framework.Servers.HttpServer; |
40 | using OpenSim.Server.Handlers.Base; | 42 | using OpenSim.Server.Handlers.Base; |
41 | 43 | ||
44 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
45 | |||
42 | namespace OpenSim.Server.Handlers.MapImage | 46 | namespace OpenSim.Server.Handlers.MapImage |
43 | { | 47 | { |
44 | public class MapAddServiceConnector : ServiceConnector | 48 | public class MapAddServiceConnector : ServiceConnector |
45 | { | 49 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
51 | |||
46 | private IMapImageService m_MapService; | 52 | private IMapImageService m_MapService; |
53 | private IGridService m_GridService; | ||
47 | private string m_ConfigName = "MapImageService"; | 54 | private string m_ConfigName = "MapImageService"; |
48 | 55 | ||
49 | public MapAddServiceConnector(IConfigSource config, IHttpServer server, string configName) : | 56 | public MapAddServiceConnector(IConfigSource config, IHttpServer server, string configName) : |
@@ -53,16 +60,27 @@ namespace OpenSim.Server.Handlers.MapImage | |||
53 | if (serverConfig == null) | 60 | if (serverConfig == null) |
54 | throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); | 61 | throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); |
55 | 62 | ||
56 | string gridService = serverConfig.GetString("LocalServiceModule", | 63 | string mapService = serverConfig.GetString("LocalServiceModule", |
57 | String.Empty); | 64 | String.Empty); |
58 | 65 | ||
59 | if (gridService == String.Empty) | 66 | if (mapService == String.Empty) |
60 | throw new Exception("No LocalServiceModule in config file"); | 67 | throw new Exception("No LocalServiceModule in config file"); |
61 | 68 | ||
62 | Object[] args = new Object[] { config }; | 69 | Object[] args = new Object[] { config }; |
63 | m_MapService = ServerUtils.LoadPlugin<IMapImageService>(gridService, args); | 70 | m_MapService = ServerUtils.LoadPlugin<IMapImageService>(mapService, args); |
71 | |||
72 | string gridService = serverConfig.GetString("GridService", String.Empty); | ||
73 | if (gridService != string.Empty) | ||
74 | m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); | ||
75 | |||
76 | if (m_GridService != null) | ||
77 | m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is ON"); | ||
78 | else | ||
79 | m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF"); | ||
80 | |||
81 | bool proxy = serverConfig.GetBoolean("HasProxy", false); | ||
82 | server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy)); | ||
64 | 83 | ||
65 | server.AddStreamHandler(new MapServerPostHandler(m_MapService)); | ||
66 | } | 84 | } |
67 | } | 85 | } |
68 | 86 | ||
@@ -70,11 +88,15 @@ namespace OpenSim.Server.Handlers.MapImage | |||
70 | { | 88 | { |
71 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 89 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
72 | private IMapImageService m_MapService; | 90 | private IMapImageService m_MapService; |
91 | private IGridService m_GridService; | ||
92 | bool m_Proxy; | ||
73 | 93 | ||
74 | public MapServerPostHandler(IMapImageService service) : | 94 | public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy) : |
75 | base("POST", "/map") | 95 | base("POST", "/map") |
76 | { | 96 | { |
77 | m_MapService = service; | 97 | m_MapService = service; |
98 | m_GridService = grid; | ||
99 | m_Proxy = proxy; | ||
78 | } | 100 | } |
79 | 101 | ||
80 | public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 102 | public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
@@ -105,6 +127,27 @@ namespace OpenSim.Server.Handlers.MapImage | |||
105 | // if (request.ContainsKey("TYPE")) | 127 | // if (request.ContainsKey("TYPE")) |
106 | // type = request["TYPE"].ToString(); | 128 | // type = request["TYPE"].ToString(); |
107 | 129 | ||
130 | if (m_GridService != null) | ||
131 | { | ||
132 | System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); | ||
133 | GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, x * (int)Constants.RegionSize, y * (int)Constants.RegionSize); | ||
134 | if (r != null) | ||
135 | { | ||
136 | if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) | ||
137 | { | ||
138 | m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be trying to impersonate region in IP {1}", ipAddr, r.ExternalEndPoint.Address); | ||
139 | return FailureResult("IP address of caller does not match IP address of registered region"); | ||
140 | } | ||
141 | |||
142 | } | ||
143 | else | ||
144 | { | ||
145 | m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}", | ||
146 | ipAddr, x, y); | ||
147 | return FailureResult("Region not found at given coordinates"); | ||
148 | } | ||
149 | } | ||
150 | |||
108 | byte[] data = Convert.FromBase64String(request["DATA"].ToString()); | 151 | byte[] data = Convert.FromBase64String(request["DATA"].ToString()); |
109 | 152 | ||
110 | string reason = string.Empty; | 153 | string reason = string.Empty; |
@@ -183,5 +226,31 @@ namespace OpenSim.Server.Handlers.MapImage | |||
183 | 226 | ||
184 | return ms.ToArray(); | 227 | return ms.ToArray(); |
185 | } | 228 | } |
229 | |||
230 | private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) | ||
231 | { | ||
232 | if (!m_Proxy) | ||
233 | return request.RemoteIPEndPoint.Address; | ||
234 | |||
235 | // We're behind a proxy | ||
236 | string xff = "X-Forwarded-For"; | ||
237 | string xffValue = request.Headers[xff.ToLower()]; | ||
238 | if (xffValue == null || (xffValue != null && xffValue == string.Empty)) | ||
239 | xffValue = request.Headers[xff]; | ||
240 | |||
241 | if (xffValue == null || (xffValue != null && xffValue == string.Empty)) | ||
242 | { | ||
243 | m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header"); | ||
244 | return request.RemoteIPEndPoint.Address; | ||
245 | } | ||
246 | |||
247 | System.Net.IPEndPoint ep = Util.GetClientIPFromXFF(xffValue); | ||
248 | if (ep != null) | ||
249 | return ep.Address; | ||
250 | |||
251 | // Oops | ||
252 | return request.RemoteIPEndPoint.Address; | ||
253 | } | ||
254 | |||
186 | } | 255 | } |
187 | } | 256 | } |
diff --git a/OpenSim/Services/AvatarService/AvatarService.cs b/OpenSim/Services/AvatarService/AvatarService.cs index c59a9e0..423c781 100644 --- a/OpenSim/Services/AvatarService/AvatarService.cs +++ b/OpenSim/Services/AvatarService/AvatarService.cs | |||
@@ -93,7 +93,7 @@ namespace OpenSim.Services.AvatarService | |||
93 | if (kvp.Key.StartsWith("_")) | 93 | if (kvp.Key.StartsWith("_")) |
94 | count++; | 94 | count++; |
95 | 95 | ||
96 | m_log.DebugFormat("[AVATAR SERVICE]: SetAvatar for {0}, attachs={1}", principalID, count); | 96 | // m_log.DebugFormat("[AVATAR SERVICE]: SetAvatar for {0}, attachs={1}", principalID, count); |
97 | m_Database.Delete("PrincipalID", principalID.ToString()); | 97 | m_Database.Delete("PrincipalID", principalID.ToString()); |
98 | 98 | ||
99 | AvatarBaseData av = new AvatarBaseData(); | 99 | AvatarBaseData av = new AvatarBaseData(); |
diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 2882906..2882906 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |||
diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs index 2b77154..2b77154 100644 --- a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs | |||
diff --git a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs index 35b7109..35b7109 100644 --- a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs | |||
diff --git a/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs b/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs index ddfca57..ddfca57 100644 --- a/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs | |||
diff --git a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs index b1dd84e..b1dd84e 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs | |||
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs index 7deaf95..f982cc1 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs | |||
@@ -116,29 +116,36 @@ namespace OpenSim.Services.Connectors | |||
116 | } | 116 | } |
117 | else if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "failure")) | 117 | else if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "failure")) |
118 | { | 118 | { |
119 | m_log.DebugFormat("[GRID CONNECTOR]: Registration failed: {0}", replyData["Message"].ToString()); | 119 | m_log.ErrorFormat( |
120 | "[GRID CONNECTOR]: Registration failed: {0} when contacting {1}", replyData["Message"], uri); | ||
121 | |||
120 | return replyData["Message"].ToString(); | 122 | return replyData["Message"].ToString(); |
121 | } | 123 | } |
122 | else if (!replyData.ContainsKey("Result")) | 124 | else if (!replyData.ContainsKey("Result")) |
123 | { | 125 | { |
124 | m_log.DebugFormat("[GRID CONNECTOR]: reply data does not contain result field"); | 126 | m_log.ErrorFormat( |
127 | "[GRID CONNECTOR]: reply data does not contain result field when contacting {0}", uri); | ||
125 | } | 128 | } |
126 | else | 129 | else |
127 | { | 130 | { |
128 | m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString()); | 131 | m_log.ErrorFormat( |
129 | return "Unexpected result "+replyData["Result"].ToString(); | 132 | "[GRID CONNECTOR]: unexpected result {0} when contacting {1}", replyData["Result"], uri); |
133 | |||
134 | return "Unexpected result " + replyData["Result"].ToString(); | ||
130 | } | 135 | } |
131 | |||
132 | } | 136 | } |
133 | else | 137 | else |
134 | m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply"); | 138 | { |
139 | m_log.ErrorFormat( | ||
140 | "[GRID CONNECTOR]: RegisterRegion received null reply when contacting grid server at {0}", uri); | ||
141 | } | ||
135 | } | 142 | } |
136 | catch (Exception e) | 143 | catch (Exception e) |
137 | { | 144 | { |
138 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message); | 145 | m_log.ErrorFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message); |
139 | } | 146 | } |
140 | 147 | ||
141 | return "Error communicating with grid service"; | 148 | return string.Format("Error communicating with the grid service at {0}", uri); |
142 | } | 149 | } |
143 | 150 | ||
144 | public bool DeregisterRegion(UUID regionID) | 151 | public bool DeregisterRegion(UUID regionID) |
diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs index 20d7eaf..20d7eaf 100644 --- a/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs +++ b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs | |||
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index bc0bc54..4cd933c 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs | |||
@@ -154,17 +154,32 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
154 | 154 | ||
155 | UUID mapTile = m_HGMapImage; | 155 | UUID mapTile = m_HGMapImage; |
156 | string filename = string.Empty; | 156 | string filename = string.Empty; |
157 | Bitmap bitmap = null; | 157 | |
158 | try | 158 | try |
159 | { | 159 | { |
160 | WebClient c = new WebClient(); | 160 | WebClient c = new WebClient(); |
161 | //m_log.Debug("JPEG: " + imageURL); | 161 | //m_log.Debug("JPEG: " + imageURL); |
162 | string name = regionID.ToString(); | 162 | string name = regionID.ToString(); |
163 | filename = Path.Combine(storagePath, name + ".jpg"); | 163 | filename = Path.Combine(storagePath, name + ".jpg"); |
164 | c.DownloadFile(imageURL, filename); | 164 | m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: Map image at {0}, cached at {1}", imageURL, filename); |
165 | bitmap = new Bitmap(filename); | 165 | if (!File.Exists(filename)) |
166 | //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); | 166 | { |
167 | byte[] imageData = OpenJPEG.EncodeFromImage(bitmap, true); | 167 | m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: downloading..."); |
168 | c.DownloadFile(imageURL, filename); | ||
169 | } | ||
170 | else | ||
171 | { | ||
172 | m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: using cached image"); | ||
173 | } | ||
174 | |||
175 | byte[] imageData = null; | ||
176 | |||
177 | using (Bitmap bitmap = new Bitmap(filename)) | ||
178 | { | ||
179 | //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); | ||
180 | imageData = OpenJPEG.EncodeFromImage(bitmap, true); | ||
181 | } | ||
182 | |||
168 | AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString()); | 183 | AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString()); |
169 | 184 | ||
170 | // !!! for now | 185 | // !!! for now |
diff --git a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs index e984a54..e984a54 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs | |||
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs index 5c50936..5c50936 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs | |||
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index 9d96703..9d96703 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs | |||
diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs index 833e22a..833e22a 100644 --- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs | |||
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs index 30bfb70..30bfb70 100644 --- a/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs +++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs | |||
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index 888b072..888b072 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs | |||
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs index 378aab6..378aab6 100644 --- a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs | |||
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index 5731e2f..5731e2f 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs | |||
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index b6ec558..53fbea6 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs | |||
@@ -107,9 +107,8 @@ namespace OpenSim.Services.HypergridService | |||
107 | public override List<InventoryFolderBase> GetInventorySkeleton(UUID principalID) | 107 | public override List<InventoryFolderBase> GetInventorySkeleton(UUID principalID) |
108 | { | 108 | { |
109 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); | 109 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); |
110 | XInventoryFolder root = GetRootXFolder(principalID); | ||
111 | 110 | ||
112 | List<XInventoryFolder> tree = GetFolderTree(suitcase.folderID); | 111 | List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID); |
113 | if (tree == null || (tree != null && tree.Count == 0)) | 112 | if (tree == null || (tree != null && tree.Count == 0)) |
114 | return null; | 113 | return null; |
115 | 114 | ||
@@ -119,7 +118,7 @@ namespace OpenSim.Services.HypergridService | |||
119 | folders.Add(ConvertToOpenSim(x)); | 118 | folders.Add(ConvertToOpenSim(x)); |
120 | } | 119 | } |
121 | 120 | ||
122 | SetAsRootFolder(suitcase, root); | 121 | SetAsNormalFolder(suitcase); |
123 | folders.Add(ConvertToOpenSim(suitcase)); | 122 | folders.Add(ConvertToOpenSim(suitcase)); |
124 | 123 | ||
125 | return folders; | 124 | return folders; |
@@ -134,12 +133,11 @@ namespace OpenSim.Services.HypergridService | |||
134 | userInventory.Items = new List<InventoryItemBase>(); | 133 | userInventory.Items = new List<InventoryItemBase>(); |
135 | 134 | ||
136 | XInventoryFolder suitcase = GetSuitcaseXFolder(userID); | 135 | XInventoryFolder suitcase = GetSuitcaseXFolder(userID); |
137 | XInventoryFolder root = GetRootXFolder(userID); | ||
138 | 136 | ||
139 | List<XInventoryFolder> tree = GetFolderTree(suitcase.folderID); | 137 | List<XInventoryFolder> tree = GetFolderTree(userID, suitcase.folderID); |
140 | if (tree == null || (tree != null && tree.Count == 0)) | 138 | if (tree == null || (tree != null && tree.Count == 0)) |
141 | { | 139 | { |
142 | SetAsRootFolder(suitcase, root); | 140 | SetAsNormalFolder(suitcase); |
143 | userInventory.Folders.Add(ConvertToOpenSim(suitcase)); | 141 | userInventory.Folders.Add(ConvertToOpenSim(suitcase)); |
144 | return userInventory; | 142 | return userInventory; |
145 | } | 143 | } |
@@ -164,7 +162,7 @@ namespace OpenSim.Services.HypergridService | |||
164 | userInventory.Items.AddRange(items); | 162 | userInventory.Items.AddRange(items); |
165 | } | 163 | } |
166 | 164 | ||
167 | SetAsRootFolder(suitcase, root); | 165 | SetAsNormalFolder(suitcase); |
168 | userInventory.Folders.Add(ConvertToOpenSim(suitcase)); | 166 | userInventory.Folders.Add(ConvertToOpenSim(suitcase)); |
169 | 167 | ||
170 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetUserInventory for user {0} returning {1} folders and {2} items", | 168 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetUserInventory for user {0} returning {1} folders and {2} items", |
@@ -175,14 +173,13 @@ namespace OpenSim.Services.HypergridService | |||
175 | public override InventoryFolderBase GetRootFolder(UUID principalID) | 173 | public override InventoryFolderBase GetRootFolder(UUID principalID) |
176 | { | 174 | { |
177 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetRootFolder for {0}", principalID); | 175 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetRootFolder for {0}", principalID); |
178 | if (m_Database == null) | ||
179 | m_log.ErrorFormat("[XXX]: m_Database is NULL!"); | ||
180 | 176 | ||
181 | // Let's find out the local root folder | 177 | // Let's find out the local root folder |
182 | XInventoryFolder root = GetRootXFolder(principalID); ; | 178 | XInventoryFolder root = GetRootXFolder(principalID); ; |
183 | if (root == null) | 179 | if (root == null) |
184 | { | 180 | { |
185 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve local root folder for user {0}", principalID); | 181 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve local root folder for user {0}", principalID); |
182 | return null; | ||
186 | } | 183 | } |
187 | 184 | ||
188 | // Warp! Root folder for travelers is the suitcase folder | 185 | // Warp! Root folder for travelers is the suitcase folder |
@@ -202,7 +199,7 @@ namespace OpenSim.Services.HypergridService | |||
202 | CreateSystemFolders(principalID, suitcase.folderID); | 199 | CreateSystemFolders(principalID, suitcase.folderID); |
203 | } | 200 | } |
204 | 201 | ||
205 | SetAsRootFolder(suitcase, root); | 202 | SetAsNormalFolder(suitcase); |
206 | 203 | ||
207 | return ConvertToOpenSim(suitcase); | 204 | return ConvertToOpenSim(suitcase); |
208 | } | 205 | } |
@@ -271,9 +268,8 @@ namespace OpenSim.Services.HypergridService | |||
271 | public override InventoryCollection GetFolderContent(UUID principalID, UUID folderID) | 268 | public override InventoryCollection GetFolderContent(UUID principalID, UUID folderID) |
272 | { | 269 | { |
273 | InventoryCollection coll = null; | 270 | InventoryCollection coll = null; |
274 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); | ||
275 | 271 | ||
276 | if (!IsWithinSuitcaseTree(folderID, suitcase)) | 272 | if (!IsWithinSuitcaseTree(principalID, folderID)) |
277 | return new InventoryCollection(); | 273 | return new InventoryCollection(); |
278 | 274 | ||
279 | coll = base.GetFolderContent(principalID, folderID); | 275 | coll = base.GetFolderContent(principalID, folderID); |
@@ -290,9 +286,7 @@ namespace OpenSim.Services.HypergridService | |||
290 | { | 286 | { |
291 | // Let's do a bit of sanity checking, more than the base service does | 287 | // Let's do a bit of sanity checking, more than the base service does |
292 | // make sure the given folder exists under the suitcase tree of this user | 288 | // make sure the given folder exists under the suitcase tree of this user |
293 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); | 289 | if (!IsWithinSuitcaseTree(principalID, folderID)) |
294 | |||
295 | if (!IsWithinSuitcaseTree(folderID, suitcase)) | ||
296 | return new List<InventoryItemBase>(); | 290 | return new List<InventoryItemBase>(); |
297 | 291 | ||
298 | return base.GetFolderItems(principalID, folderID); | 292 | return base.GetFolderItems(principalID, folderID); |
@@ -303,21 +297,27 @@ namespace OpenSim.Services.HypergridService | |||
303 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder {0} {1}", folder.Name, folder.ParentID); | 297 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder {0} {1}", folder.Name, folder.ParentID); |
304 | // Let's do a bit of sanity checking, more than the base service does | 298 | // Let's do a bit of sanity checking, more than the base service does |
305 | // make sure the given folder's parent folder exists under the suitcase tree of this user | 299 | // make sure the given folder's parent folder exists under the suitcase tree of this user |
306 | XInventoryFolder suitcase = GetSuitcaseXFolder(folder.Owner); | ||
307 | 300 | ||
308 | if (!IsWithinSuitcaseTree(folder.ParentID, suitcase)) | 301 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) |
309 | return false; | 302 | return false; |
310 | 303 | ||
311 | // OK, it's legit | 304 | // OK, it's legit |
312 | return base.AddFolder(folder); | 305 | if (base.AddFolder(folder)) |
306 | { | ||
307 | List<XInventoryFolder> tree; | ||
308 | if (m_SuitcaseTrees.TryGetValue(folder.Owner, out tree)) | ||
309 | tree.Add(ConvertFromOpenSim(folder)); | ||
310 | |||
311 | return true; | ||
312 | } | ||
313 | |||
314 | return false; | ||
313 | } | 315 | } |
314 | 316 | ||
315 | public override bool UpdateFolder(InventoryFolderBase folder) | 317 | public override bool UpdateFolder(InventoryFolderBase folder) |
316 | { | 318 | { |
317 | XInventoryFolder suitcase = GetSuitcaseXFolder(folder.Owner); | ||
318 | |||
319 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); | 319 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); |
320 | if (!IsWithinSuitcaseTree(folder.ID, suitcase)) | 320 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) |
321 | { | 321 | { |
322 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name); | 322 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name); |
323 | return false; | 323 | return false; |
@@ -329,9 +329,8 @@ namespace OpenSim.Services.HypergridService | |||
329 | 329 | ||
330 | public override bool MoveFolder(InventoryFolderBase folder) | 330 | public override bool MoveFolder(InventoryFolderBase folder) |
331 | { | 331 | { |
332 | XInventoryFolder suitcase = GetSuitcaseXFolder(folder.Owner); | 332 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID) || |
333 | 333 | !IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) | |
334 | if (!IsWithinSuitcaseTree(folder.ID, suitcase) || !IsWithinSuitcaseTree(folder.ParentID, suitcase)) | ||
335 | return false; | 334 | return false; |
336 | 335 | ||
337 | return base.MoveFolder(folder); | 336 | return base.MoveFolder(folder); |
@@ -353,9 +352,7 @@ namespace OpenSim.Services.HypergridService | |||
353 | { | 352 | { |
354 | // Let's do a bit of sanity checking, more than the base service does | 353 | // Let's do a bit of sanity checking, more than the base service does |
355 | // make sure the given folder's parent folder exists under the suitcase tree of this user | 354 | // make sure the given folder's parent folder exists under the suitcase tree of this user |
356 | XInventoryFolder suitcase = GetSuitcaseXFolder(item.Owner); | 355 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) |
357 | |||
358 | if (!IsWithinSuitcaseTree(item.Folder, suitcase)) | ||
359 | return false; | 356 | return false; |
360 | 357 | ||
361 | // OK, it's legit | 358 | // OK, it's legit |
@@ -365,9 +362,7 @@ namespace OpenSim.Services.HypergridService | |||
365 | 362 | ||
366 | public override bool UpdateItem(InventoryItemBase item) | 363 | public override bool UpdateItem(InventoryItemBase item) |
367 | { | 364 | { |
368 | XInventoryFolder suitcase = GetSuitcaseXFolder(item.Owner); | 365 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) |
369 | |||
370 | if (!IsWithinSuitcaseTree(item.Folder, suitcase)) | ||
371 | return false; | 366 | return false; |
372 | 367 | ||
373 | return base.UpdateItem(item); | 368 | return base.UpdateItem(item); |
@@ -377,9 +372,7 @@ namespace OpenSim.Services.HypergridService | |||
377 | { | 372 | { |
378 | // Principal is b0rked. *sigh* | 373 | // Principal is b0rked. *sigh* |
379 | 374 | ||
380 | XInventoryFolder suitcase = GetSuitcaseXFolder(items[0].Owner); | 375 | if (!IsWithinSuitcaseTree(items[0].Owner, items[0].Folder)) |
381 | |||
382 | if (!IsWithinSuitcaseTree(items[0].Folder, suitcase)) | ||
383 | return false; | 376 | return false; |
384 | 377 | ||
385 | return base.MoveItems(principalID, items); | 378 | return base.MoveItems(principalID, items); |
@@ -400,15 +393,8 @@ namespace OpenSim.Services.HypergridService | |||
400 | item.Name, item.ID, item.Folder); | 393 | item.Name, item.ID, item.Folder); |
401 | return null; | 394 | return null; |
402 | } | 395 | } |
403 | XInventoryFolder suitcase = GetSuitcaseXFolder(it.Owner); | ||
404 | if (suitcase == null) | ||
405 | { | ||
406 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Root or Suitcase are null for user {0}", | ||
407 | it.Owner); | ||
408 | return null; | ||
409 | } | ||
410 | 396 | ||
411 | if (!IsWithinSuitcaseTree(it.Folder, suitcase)) | 397 | if (!IsWithinSuitcaseTree(it.Owner, it.Folder)) |
412 | { | 398 | { |
413 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", | 399 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", |
414 | it.Name, it.Folder); | 400 | it.Name, it.Folder); |
@@ -431,9 +417,7 @@ namespace OpenSim.Services.HypergridService | |||
431 | 417 | ||
432 | if (f != null) | 418 | if (f != null) |
433 | { | 419 | { |
434 | XInventoryFolder suitcase = GetSuitcaseXFolder(f.Owner); | 420 | if (!IsWithinSuitcaseTree(f.Owner, f.ID)) |
435 | |||
436 | if (!IsWithinSuitcaseTree(f.ID, suitcase)) | ||
437 | return null; | 421 | return null; |
438 | } | 422 | } |
439 | 423 | ||
@@ -481,22 +465,37 @@ namespace OpenSim.Services.HypergridService | |||
481 | 465 | ||
482 | if (folders != null && folders.Length > 0) | 466 | if (folders != null && folders.Length > 0) |
483 | return folders[0]; | 467 | return folders[0]; |
468 | |||
469 | // check to see if we have the old Suitcase folder | ||
470 | folders = m_Database.GetFolders( | ||
471 | new string[] { "agentID", "folderName", "parentFolderID" }, | ||
472 | new string[] { principalID.ToString(), "My Suitcase", UUID.Zero.ToString() }); | ||
473 | if (folders != null && folders.Length > 0) | ||
474 | { | ||
475 | // Move it to under the root folder | ||
476 | XInventoryFolder root = GetRootXFolder(principalID); | ||
477 | folders[0].parentFolderID = root.folderID; | ||
478 | folders[0].type = 100; | ||
479 | m_Database.StoreFolder(folders[0]); | ||
480 | return folders[0]; | ||
481 | } | ||
482 | |||
484 | return null; | 483 | return null; |
485 | } | 484 | } |
486 | 485 | ||
487 | private void SetAsRootFolder(XInventoryFolder suitcase, XInventoryFolder root) | 486 | private void SetAsNormalFolder(XInventoryFolder suitcase) |
488 | { | 487 | { |
489 | suitcase.type = (short)AssetType.Folder; | 488 | suitcase.type = (short)AssetType.Folder; |
490 | } | 489 | } |
491 | 490 | ||
492 | private List<XInventoryFolder> GetFolderTree(UUID folder) | 491 | private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder) |
493 | { | 492 | { |
494 | List<XInventoryFolder> t = null; | 493 | List<XInventoryFolder> t = null; |
495 | if (m_SuitcaseTrees.TryGetValue(folder, out t)) | 494 | if (m_SuitcaseTrees.TryGetValue(principalID, out t)) |
496 | return t; | 495 | return t; |
497 | 496 | ||
498 | t = GetFolderTreeRecursive(folder); | 497 | t = GetFolderTreeRecursive(folder); |
499 | m_SuitcaseTrees.AddOrUpdate(folder, t, 120); | 498 | m_SuitcaseTrees.AddOrUpdate(principalID, t, 5*60); // 5minutes |
500 | return t; | 499 | return t; |
501 | } | 500 | } |
502 | 501 | ||
@@ -528,11 +527,18 @@ namespace OpenSim.Services.HypergridService | |||
528 | /// <param name="root"></param> | 527 | /// <param name="root"></param> |
529 | /// <param name="suitcase"></param> | 528 | /// <param name="suitcase"></param> |
530 | /// <returns></returns> | 529 | /// <returns></returns> |
531 | private bool IsWithinSuitcaseTree(UUID folderID, XInventoryFolder suitcase) | 530 | private bool IsWithinSuitcaseTree(UUID principalID, UUID folderID) |
532 | { | 531 | { |
532 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); | ||
533 | if (suitcase == null) | ||
534 | { | ||
535 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder", principalID); | ||
536 | return false; | ||
537 | } | ||
538 | |||
533 | List<XInventoryFolder> tree = new List<XInventoryFolder>(); | 539 | List<XInventoryFolder> tree = new List<XInventoryFolder>(); |
534 | tree.Add(suitcase); // Warp! the tree is the real root folder plus the children of the suitcase folder | 540 | tree.Add(suitcase); // Warp! the tree is the real root folder plus the children of the suitcase folder |
535 | tree.AddRange(GetFolderTree(suitcase.folderID)); | 541 | tree.AddRange(GetFolderTree(principalID, suitcase.folderID)); |
536 | XInventoryFolder f = tree.Find(delegate(XInventoryFolder fl) | 542 | XInventoryFolder f = tree.Find(delegate(XInventoryFolder fl) |
537 | { | 543 | { |
538 | if (fl.folderID == folderID) return true; | 544 | if (fl.folderID == folderID) return true; |
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 0e7a358..15156d0 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -52,6 +52,7 @@ namespace OpenSim.Services.InventoryService | |||
52 | : this(config, "InventoryService") | 52 | : this(config, "InventoryService") |
53 | { | 53 | { |
54 | } | 54 | } |
55 | |||
55 | public XInventoryService(IConfigSource config, string configName) : base(config) | 56 | public XInventoryService(IConfigSource config, string configName) : base(config) |
56 | { | 57 | { |
57 | if (configName != string.Empty) | 58 | if (configName != string.Empty) |
@@ -364,6 +365,11 @@ namespace OpenSim.Services.InventoryService | |||
364 | // | 365 | // |
365 | public virtual bool DeleteFolders(UUID principalID, List<UUID> folderIDs) | 366 | public virtual bool DeleteFolders(UUID principalID, List<UUID> folderIDs) |
366 | { | 367 | { |
368 | return DeleteFolders(principalID, folderIDs, true); | ||
369 | } | ||
370 | |||
371 | public virtual bool DeleteFolders(UUID principalID, List<UUID> folderIDs, bool onlyIfTrash) | ||
372 | { | ||
367 | if (!m_AllowDelete) | 373 | if (!m_AllowDelete) |
368 | return false; | 374 | return false; |
369 | 375 | ||
@@ -371,11 +377,12 @@ namespace OpenSim.Services.InventoryService | |||
371 | // | 377 | // |
372 | foreach (UUID id in folderIDs) | 378 | foreach (UUID id in folderIDs) |
373 | { | 379 | { |
374 | if (!ParentIsTrash(id)) | 380 | if (onlyIfTrash && !ParentIsTrash(id)) |
375 | continue; | 381 | continue; |
382 | //m_log.InfoFormat("[XINVENTORY SERVICE]: Delete folder {0}", id); | ||
376 | InventoryFolderBase f = new InventoryFolderBase(); | 383 | InventoryFolderBase f = new InventoryFolderBase(); |
377 | f.ID = id; | 384 | f.ID = id; |
378 | PurgeFolder(f); | 385 | PurgeFolder(f, onlyIfTrash); |
379 | m_Database.DeleteFolders("folderID", id.ToString()); | 386 | m_Database.DeleteFolders("folderID", id.ToString()); |
380 | } | 387 | } |
381 | 388 | ||
@@ -384,10 +391,15 @@ namespace OpenSim.Services.InventoryService | |||
384 | 391 | ||
385 | public virtual bool PurgeFolder(InventoryFolderBase folder) | 392 | public virtual bool PurgeFolder(InventoryFolderBase folder) |
386 | { | 393 | { |
394 | return PurgeFolder(folder, true); | ||
395 | } | ||
396 | |||
397 | public virtual bool PurgeFolder(InventoryFolderBase folder, bool onlyIfTrash) | ||
398 | { | ||
387 | if (!m_AllowDelete) | 399 | if (!m_AllowDelete) |
388 | return false; | 400 | return false; |
389 | 401 | ||
390 | if (!ParentIsTrash(folder.ID)) | 402 | if (onlyIfTrash && !ParentIsTrash(folder.ID)) |
391 | return false; | 403 | return false; |
392 | 404 | ||
393 | XInventoryFolder[] subFolders = m_Database.GetFolders( | 405 | XInventoryFolder[] subFolders = m_Database.GetFolders( |
@@ -396,7 +408,7 @@ namespace OpenSim.Services.InventoryService | |||
396 | 408 | ||
397 | foreach (XInventoryFolder x in subFolders) | 409 | foreach (XInventoryFolder x in subFolders) |
398 | { | 410 | { |
399 | PurgeFolder(ConvertToOpenSim(x)); | 411 | PurgeFolder(ConvertToOpenSim(x), onlyIfTrash); |
400 | m_Database.DeleteFolders("folderID", x.folderID.ToString()); | 412 | m_Database.DeleteFolders("folderID", x.folderID.ToString()); |
401 | } | 413 | } |
402 | 414 | ||
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 079bcb1..a4b3cbd 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs | |||
@@ -231,7 +231,8 @@ namespace OpenSim.Services.LLLoginService | |||
231 | public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, | 231 | public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, |
232 | GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, | 232 | GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, |
233 | string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, | 233 | string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, |
234 | GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency) | 234 | GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency, |
235 | string DSTZone) | ||
235 | : this() | 236 | : this() |
236 | { | 237 | { |
237 | FillOutInventoryData(invSkel, libService); | 238 | FillOutInventoryData(invSkel, libService); |
@@ -260,7 +261,45 @@ namespace OpenSim.Services.LLLoginService | |||
260 | FillOutRegionData(destination); | 261 | FillOutRegionData(destination); |
261 | 262 | ||
262 | FillOutSeedCap(aCircuit, destination, clientIP); | 263 | FillOutSeedCap(aCircuit, destination, clientIP); |
263 | 264 | ||
265 | switch (DSTZone) | ||
266 | { | ||
267 | case "none": | ||
268 | DST = "N"; | ||
269 | break; | ||
270 | case "local": | ||
271 | DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; | ||
272 | break; | ||
273 | default: | ||
274 | TimeZoneInfo dstTimeZone = null; | ||
275 | string[] tzList = DSTZone.Split(';'); | ||
276 | |||
277 | foreach (string tzName in tzList) | ||
278 | { | ||
279 | try | ||
280 | { | ||
281 | dstTimeZone = TimeZoneInfo.FindSystemTimeZoneById(tzName); | ||
282 | } | ||
283 | catch | ||
284 | { | ||
285 | continue; | ||
286 | } | ||
287 | break; | ||
288 | } | ||
289 | |||
290 | if (dstTimeZone == null) | ||
291 | { | ||
292 | m_log.WarnFormat( | ||
293 | "[LLOGIN RESPONSE]: No valid timezone found for DST in {0}, falling back to system time.", tzList); | ||
294 | DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; | ||
295 | } | ||
296 | else | ||
297 | { | ||
298 | DST = dstTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; | ||
299 | } | ||
300 | |||
301 | break; | ||
302 | } | ||
264 | } | 303 | } |
265 | 304 | ||
266 | private void FillOutInventoryData(List<InventoryFolderBase> invSkel, ILibraryService libService) | 305 | private void FillOutInventoryData(List<InventoryFolderBase> invSkel, ILibraryService libService) |
@@ -355,7 +394,31 @@ namespace OpenSim.Services.LLLoginService | |||
355 | 394 | ||
356 | private void SetDefaultValues() | 395 | private void SetDefaultValues() |
357 | { | 396 | { |
358 | DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; | 397 | TimeZoneInfo gridTimeZone; |
398 | |||
399 | // Disabled for now pending making timezone a config value, which can at some point have a default of | ||
400 | // a ; separated list of possible timezones. | ||
401 | // The problem here is that US/Pacific (or even the Olsen America/Los_Angeles) is not universal across | ||
402 | // windows, mac and various distributions of linux, introducing another element of consistency. | ||
403 | // The server operator needs to be able to control this setting | ||
404 | // try | ||
405 | // { | ||
406 | // // First try to fetch DST from Pacific Standard Time, because this is | ||
407 | // // the one expected by the viewer. "US/Pacific" is the string to search | ||
408 | // // on linux and mac, and should work also on Windows (to confirm) | ||
409 | // gridTimeZone = TimeZoneInfo.FindSystemTimeZoneById("US/Pacific"); | ||
410 | // } | ||
411 | // catch (Exception e) | ||
412 | // { | ||
413 | // m_log.WarnFormat( | ||
414 | // "[TIMEZONE]: {0} Falling back to system time. System time should be set to Pacific Standard Time to provide the expected time", | ||
415 | // e.Message); | ||
416 | |||
417 | gridTimeZone = TimeZoneInfo.Local; | ||
418 | // } | ||
419 | |||
420 | DST = gridTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; | ||
421 | |||
359 | StipendSinceLogin = "N"; | 422 | StipendSinceLogin = "N"; |
360 | Gendered = "Y"; | 423 | Gendered = "Y"; |
361 | EverLoggedIn = "Y"; | 424 | EverLoggedIn = "Y"; |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 891c452..06e05a9 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -82,6 +82,8 @@ namespace OpenSim.Services.LLLoginService | |||
82 | protected string m_AllowedClients; | 82 | protected string m_AllowedClients; |
83 | protected string m_DeniedClients; | 83 | protected string m_DeniedClients; |
84 | 84 | ||
85 | protected string m_DSTZone; | ||
86 | |||
85 | IConfig m_LoginServerConfig; | 87 | IConfig m_LoginServerConfig; |
86 | // IConfig m_ClientsConfig; | 88 | // IConfig m_ClientsConfig; |
87 | 89 | ||
@@ -118,6 +120,8 @@ namespace OpenSim.Services.LLLoginService | |||
118 | m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); | 120 | m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); |
119 | m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); | 121 | m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); |
120 | 122 | ||
123 | m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time"); | ||
124 | |||
121 | // Clean up some of these vars | 125 | // Clean up some of these vars |
122 | if (m_MapTileURL != String.Empty) | 126 | if (m_MapTileURL != String.Empty) |
123 | { | 127 | { |
@@ -241,6 +245,7 @@ namespace OpenSim.Services.LLLoginService | |||
241 | 245 | ||
242 | m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}", | 246 | m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}", |
243 | firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0); | 247 | firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0); |
248 | |||
244 | try | 249 | try |
245 | { | 250 | { |
246 | // | 251 | // |
@@ -423,8 +428,11 @@ namespace OpenSim.Services.LLLoginService | |||
423 | // | 428 | // |
424 | // Finally, fill out the response and return it | 429 | // Finally, fill out the response and return it |
425 | // | 430 | // |
426 | LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, | 431 | LLLoginResponse response |
427 | where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency); | 432 | = new LLLoginResponse( |
433 | account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, | ||
434 | where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, | ||
435 | m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone); | ||
428 | 436 | ||
429 | m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); | 437 | m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); |
430 | return response; | 438 | return response; |
@@ -438,7 +446,10 @@ namespace OpenSim.Services.LLLoginService | |||
438 | } | 446 | } |
439 | } | 447 | } |
440 | 448 | ||
441 | protected GridRegion FindDestination(UserAccount account, UUID scopeID, GridUserInfo pinfo, UUID sessionID, string startLocation, GridRegion home, out GridRegion gatekeeper, out string where, out Vector3 position, out Vector3 lookAt, out TeleportFlags flags) | 449 | protected GridRegion FindDestination( |
450 | UserAccount account, UUID scopeID, GridUserInfo pinfo, UUID sessionID, string startLocation, | ||
451 | GridRegion home, out GridRegion gatekeeper, | ||
452 | out string where, out Vector3 position, out Vector3 lookAt, out TeleportFlags flags) | ||
442 | { | 453 | { |
443 | flags = TeleportFlags.ViaLogin; | 454 | flags = TeleportFlags.ViaLogin; |
444 | 455 | ||
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 318758d..78f9434 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs | |||
@@ -58,57 +58,74 @@ namespace OpenSim.Tests.Common | |||
58 | /// </summary> | 58 | /// </summary> |
59 | public class SceneHelpers | 59 | public class SceneHelpers |
60 | { | 60 | { |
61 | public static TestScene SetupScene() | 61 | /// <summary> |
62 | /// We need a scene manager so that test clients can retrieve a scene when performing teleport tests. | ||
63 | /// </summary> | ||
64 | public SceneManager SceneManager { get; private set; } | ||
65 | |||
66 | private AgentCircuitManager m_acm = new AgentCircuitManager(); | ||
67 | private ISimulationDataService m_simDataService | ||
68 | = OpenSim.Server.Base.ServerUtils.LoadPlugin<ISimulationDataService>("OpenSim.Tests.Common.dll", null); | ||
69 | private IEstateDataService m_estateDataService = null; | ||
70 | |||
71 | private LocalAssetServicesConnector m_assetService; | ||
72 | private LocalAuthenticationServicesConnector m_authenticationService; | ||
73 | private LocalInventoryServicesConnector m_inventoryService; | ||
74 | private LocalGridServicesConnector m_gridService; | ||
75 | private LocalUserAccountServicesConnector m_userAccountService; | ||
76 | private LocalPresenceServicesConnector m_presenceService; | ||
77 | |||
78 | private CoreAssetCache m_cache; | ||
79 | |||
80 | public SceneHelpers() : this(null) {} | ||
81 | |||
82 | public SceneHelpers(CoreAssetCache cache) | ||
62 | { | 83 | { |
63 | return SetupScene(null); | 84 | SceneManager = new SceneManager(); |
85 | |||
86 | m_assetService = StartAssetService(cache); | ||
87 | m_authenticationService = StartAuthenticationService(); | ||
88 | m_inventoryService = StartInventoryService(); | ||
89 | m_gridService = StartGridService(); | ||
90 | m_userAccountService = StartUserAccountService(); | ||
91 | m_presenceService = StartPresenceService(); | ||
92 | |||
93 | m_inventoryService.PostInitialise(); | ||
94 | m_assetService.PostInitialise(); | ||
95 | m_userAccountService.PostInitialise(); | ||
96 | m_presenceService.PostInitialise(); | ||
97 | |||
98 | m_cache = cache; | ||
64 | } | 99 | } |
65 | 100 | ||
66 | /// <summary> | 101 | /// <summary> |
67 | /// Set up a test scene | 102 | /// Set up a test scene |
68 | /// </summary> | 103 | /// </summary> |
69 | /// <remarks> | 104 | /// <remarks> |
70 | /// Automatically starts service threads, as would the normal runtime. | 105 | /// Automatically starts services, as would the normal runtime. |
71 | /// </remarks> | 106 | /// </remarks> |
72 | /// <returns></returns> | 107 | /// <returns></returns> |
73 | public static TestScene SetupScene(CoreAssetCache cache) | 108 | public TestScene SetupScene() |
74 | { | 109 | { |
75 | return SetupScene("Unit test region", UUID.Random(), 1000, 1000, cache); | 110 | return SetupScene("Unit test region", UUID.Random(), 1000, 1000); |
76 | } | 111 | } |
77 | 112 | ||
78 | public static TestScene SetupScene(string name, UUID id, uint x, uint y) | 113 | public TestScene SetupScene(string name, UUID id, uint x, uint y) |
79 | { | 114 | { |
80 | return SetupScene(name, id, x, y, null); | 115 | return SetupScene(name, id, x, y, new IniConfigSource()); |
81 | } | 116 | } |
82 | 117 | ||
83 | /// <summary> | 118 | /// <summary> |
84 | /// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions | 119 | /// Set up a scene. |
85 | /// or a different, to get a brand new scene with new shared region modules. | ||
86 | /// </summary> | 120 | /// </summary> |
87 | /// <param name="name">Name of the region</param> | 121 | /// <param name="name">Name of the region</param> |
88 | /// <param name="id">ID of the region</param> | 122 | /// <param name="id">ID of the region</param> |
89 | /// <param name="x">X co-ordinate of the region</param> | 123 | /// <param name="x">X co-ordinate of the region</param> |
90 | /// <param name="y">Y co-ordinate of the region</param> | 124 | /// <param name="y">Y co-ordinate of the region</param> |
91 | /// <param name="cache"></param> | ||
92 | /// <returns></returns> | ||
93 | public static TestScene SetupScene( | ||
94 | string name, UUID id, uint x, uint y, CoreAssetCache cache) | ||
95 | { | ||
96 | return SetupScene(name, id, x, y, cache, new IniConfigSource()); | ||
97 | } | ||
98 | |||
99 | /// <summary> | ||
100 | /// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions | ||
101 | /// or a different, to get a brand new scene with new shared region modules. | ||
102 | /// </summary> | ||
103 | /// <param name="name">Name of the region</param> | ||
104 | /// <param name="id">ID of the region</param> | ||
105 | /// <param name="x">X co-ordinate of the region</param> | ||
106 | /// <param name="y">Y co-ordinate of the region</param> | ||
107 | /// <param name="cache"></param> | ||
108 | /// <param name="configSource"></param> | 125 | /// <param name="configSource"></param> |
109 | /// <returns></returns> | 126 | /// <returns></returns> |
110 | public static TestScene SetupScene( | 127 | public TestScene SetupScene( |
111 | string name, UUID id, uint x, uint y, CoreAssetCache cache, IConfigSource configSource) | 128 | string name, UUID id, uint x, uint y, IConfigSource configSource) |
112 | { | 129 | { |
113 | Console.WriteLine("Setting up test scene {0}", name); | 130 | Console.WriteLine("Setting up test scene {0}", name); |
114 | 131 | ||
@@ -119,30 +136,47 @@ namespace OpenSim.Tests.Common | |||
119 | regInfo.RegionName = name; | 136 | regInfo.RegionName = name; |
120 | regInfo.RegionID = id; | 137 | regInfo.RegionID = id; |
121 | 138 | ||
122 | AgentCircuitManager acm = new AgentCircuitManager(); | ||
123 | SceneCommunicationService scs = new SceneCommunicationService(); | 139 | SceneCommunicationService scs = new SceneCommunicationService(); |
124 | 140 | ||
125 | ISimulationDataService simDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin<ISimulationDataService>("OpenSim.Tests.Common.dll", null); | ||
126 | IEstateDataService estateDataService = null; | ||
127 | |||
128 | TestScene testScene = new TestScene( | 141 | TestScene testScene = new TestScene( |
129 | regInfo, acm, scs, simDataService, estateDataService, null, false, configSource, null); | 142 | regInfo, m_acm, scs, m_simDataService, m_estateDataService, null, false, configSource, null); |
130 | 143 | ||
131 | IRegionModule godsModule = new GodsModule(); | 144 | IRegionModule godsModule = new GodsModule(); |
132 | godsModule.Initialise(testScene, new IniConfigSource()); | 145 | godsModule.Initialise(testScene, new IniConfigSource()); |
133 | testScene.AddModule(godsModule.Name, godsModule); | 146 | testScene.AddModule(godsModule.Name, godsModule); |
134 | 147 | ||
135 | LocalAssetServicesConnector assetService = StartAssetService(testScene, cache); | 148 | // Add scene to services |
136 | StartAuthenticationService(testScene); | 149 | m_assetService.AddRegion(testScene); |
137 | LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); | 150 | |
138 | StartGridService(testScene); | 151 | if (m_cache != null) |
139 | LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); | 152 | { |
140 | LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); | 153 | m_cache.AddRegion(testScene); |
141 | 154 | m_cache.RegionLoaded(testScene); | |
142 | inventoryService.PostInitialise(); | 155 | testScene.AddRegionModule(m_cache.Name, m_cache); |
143 | assetService.PostInitialise(); | 156 | } |
144 | userAccountService.PostInitialise(); | 157 | |
145 | presenceService.PostInitialise(); | 158 | m_assetService.RegionLoaded(testScene); |
159 | testScene.AddRegionModule(m_assetService.Name, m_assetService); | ||
160 | |||
161 | m_authenticationService.AddRegion(testScene); | ||
162 | m_authenticationService.RegionLoaded(testScene); | ||
163 | testScene.AddRegionModule(m_authenticationService.Name, m_authenticationService); | ||
164 | |||
165 | m_inventoryService.AddRegion(testScene); | ||
166 | m_inventoryService.RegionLoaded(testScene); | ||
167 | testScene.AddRegionModule(m_inventoryService.Name, m_inventoryService); | ||
168 | |||
169 | m_gridService.AddRegion(testScene); | ||
170 | m_gridService.RegionLoaded(testScene); | ||
171 | testScene.AddRegionModule(m_gridService.Name, m_gridService); | ||
172 | |||
173 | m_userAccountService.AddRegion(testScene); | ||
174 | m_userAccountService.RegionLoaded(testScene); | ||
175 | testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); | ||
176 | |||
177 | m_presenceService.AddRegion(testScene); | ||
178 | m_presenceService.RegionLoaded(testScene); | ||
179 | testScene.AddRegionModule(m_presenceService.Name, m_presenceService); | ||
146 | 180 | ||
147 | testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); | 181 | testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); |
148 | testScene.SetModuleInterfaces(); | 182 | testScene.SetModuleInterfaces(); |
@@ -153,28 +187,28 @@ namespace OpenSim.Tests.Common | |||
153 | PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); | 187 | PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); |
154 | physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); | 188 | physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); |
155 | testScene.PhysicsScene | 189 | testScene.PhysicsScene |
156 | = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test"); | 190 | = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test"); |
157 | 191 | ||
158 | testScene.RegionInfo.EstateSettings = new EstateSettings(); | 192 | testScene.RegionInfo.EstateSettings = new EstateSettings(); |
159 | testScene.LoginsDisabled = false; | 193 | testScene.LoginsDisabled = false; |
160 | testScene.RegisterRegionWithGrid(); | 194 | testScene.RegisterRegionWithGrid(); |
161 | 195 | ||
196 | SceneManager.Add(testScene); | ||
197 | |||
162 | return testScene; | 198 | return testScene; |
163 | } | 199 | } |
164 | 200 | ||
165 | private static LocalAssetServicesConnector StartAssetService(Scene testScene, CoreAssetCache cache) | 201 | private static LocalAssetServicesConnector StartAssetService(CoreAssetCache cache) |
166 | { | 202 | { |
167 | LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); | ||
168 | IConfigSource config = new IniConfigSource(); | 203 | IConfigSource config = new IniConfigSource(); |
169 | |||
170 | config.AddConfig("Modules"); | 204 | config.AddConfig("Modules"); |
171 | config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); | 205 | config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); |
172 | config.AddConfig("AssetService"); | 206 | config.AddConfig("AssetService"); |
173 | config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); | 207 | config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); |
174 | config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); | 208 | config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); |
175 | 209 | ||
210 | LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); | ||
176 | assetService.Initialise(config); | 211 | assetService.Initialise(config); |
177 | assetService.AddRegion(testScene); | ||
178 | 212 | ||
179 | if (cache != null) | 213 | if (cache != null) |
180 | { | 214 | { |
@@ -184,56 +218,43 @@ namespace OpenSim.Tests.Common | |||
184 | cacheConfig.AddConfig("AssetCache"); | 218 | cacheConfig.AddConfig("AssetCache"); |
185 | 219 | ||
186 | cache.Initialise(cacheConfig); | 220 | cache.Initialise(cacheConfig); |
187 | cache.AddRegion(testScene); | ||
188 | cache.RegionLoaded(testScene); | ||
189 | testScene.AddRegionModule(cache.Name, cache); | ||
190 | } | 221 | } |
191 | |||
192 | assetService.RegionLoaded(testScene); | ||
193 | testScene.AddRegionModule(assetService.Name, assetService); | ||
194 | 222 | ||
195 | return assetService; | 223 | return assetService; |
196 | } | 224 | } |
197 | 225 | ||
198 | private static void StartAuthenticationService(Scene testScene) | 226 | private static LocalAuthenticationServicesConnector StartAuthenticationService() |
199 | { | 227 | { |
200 | ISharedRegionModule service = new LocalAuthenticationServicesConnector(); | ||
201 | IConfigSource config = new IniConfigSource(); | 228 | IConfigSource config = new IniConfigSource(); |
202 | |||
203 | config.AddConfig("Modules"); | 229 | config.AddConfig("Modules"); |
204 | config.AddConfig("AuthenticationService"); | 230 | config.AddConfig("AuthenticationService"); |
205 | config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector"); | 231 | config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector"); |
206 | config.Configs["AuthenticationService"].Set( | 232 | config.Configs["AuthenticationService"].Set( |
207 | "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"); | 233 | "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"); |
208 | config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); | 234 | config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); |
209 | 235 | ||
236 | LocalAuthenticationServicesConnector service = new LocalAuthenticationServicesConnector(); | ||
210 | service.Initialise(config); | 237 | service.Initialise(config); |
211 | service.AddRegion(testScene); | 238 | |
212 | service.RegionLoaded(testScene); | 239 | return service; |
213 | testScene.AddRegionModule(service.Name, service); | ||
214 | //m_authenticationService = service; | ||
215 | } | 240 | } |
216 | 241 | ||
217 | private static LocalInventoryServicesConnector StartInventoryService(Scene testScene) | 242 | private static LocalInventoryServicesConnector StartInventoryService() |
218 | { | 243 | { |
219 | LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector(); | ||
220 | |||
221 | IConfigSource config = new IniConfigSource(); | 244 | IConfigSource config = new IniConfigSource(); |
222 | config.AddConfig("Modules"); | 245 | config.AddConfig("Modules"); |
223 | config.AddConfig("InventoryService"); | 246 | config.AddConfig("InventoryService"); |
224 | config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); | 247 | config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); |
225 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); | 248 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); |
226 | config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); | 249 | config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); |
227 | 250 | ||
251 | LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector(); | ||
228 | inventoryService.Initialise(config); | 252 | inventoryService.Initialise(config); |
229 | inventoryService.AddRegion(testScene); | ||
230 | inventoryService.RegionLoaded(testScene); | ||
231 | testScene.AddRegionModule(inventoryService.Name, inventoryService); | ||
232 | 253 | ||
233 | return inventoryService; | 254 | return inventoryService; |
234 | } | 255 | } |
235 | 256 | ||
236 | private static LocalGridServicesConnector StartGridService(Scene testScene) | 257 | private static LocalGridServicesConnector StartGridService() |
237 | { | 258 | { |
238 | IConfigSource config = new IniConfigSource(); | 259 | IConfigSource config = new IniConfigSource(); |
239 | config.AddConfig("Modules"); | 260 | config.AddConfig("Modules"); |
@@ -245,8 +266,6 @@ namespace OpenSim.Tests.Common | |||
245 | 266 | ||
246 | LocalGridServicesConnector gridService = new LocalGridServicesConnector(); | 267 | LocalGridServicesConnector gridService = new LocalGridServicesConnector(); |
247 | gridService.Initialise(config); | 268 | gridService.Initialise(config); |
248 | gridService.AddRegion(testScene); | ||
249 | gridService.RegionLoaded(testScene); | ||
250 | 269 | ||
251 | return gridService; | 270 | return gridService; |
252 | } | 271 | } |
@@ -256,7 +275,7 @@ namespace OpenSim.Tests.Common | |||
256 | /// </summary> | 275 | /// </summary> |
257 | /// <param name="testScene"></param> | 276 | /// <param name="testScene"></param> |
258 | /// <returns></returns> | 277 | /// <returns></returns> |
259 | private static LocalUserAccountServicesConnector StartUserAccountService(Scene testScene) | 278 | private static LocalUserAccountServicesConnector StartUserAccountService() |
260 | { | 279 | { |
261 | IConfigSource config = new IniConfigSource(); | 280 | IConfigSource config = new IniConfigSource(); |
262 | config.AddConfig("Modules"); | 281 | config.AddConfig("Modules"); |
@@ -268,10 +287,6 @@ namespace OpenSim.Tests.Common | |||
268 | 287 | ||
269 | LocalUserAccountServicesConnector userAccountService = new LocalUserAccountServicesConnector(); | 288 | LocalUserAccountServicesConnector userAccountService = new LocalUserAccountServicesConnector(); |
270 | userAccountService.Initialise(config); | 289 | userAccountService.Initialise(config); |
271 | |||
272 | userAccountService.AddRegion(testScene); | ||
273 | userAccountService.RegionLoaded(testScene); | ||
274 | testScene.AddRegionModule(userAccountService.Name, userAccountService); | ||
275 | 290 | ||
276 | return userAccountService; | 291 | return userAccountService; |
277 | } | 292 | } |
@@ -280,7 +295,7 @@ namespace OpenSim.Tests.Common | |||
280 | /// Start a presence service | 295 | /// Start a presence service |
281 | /// </summary> | 296 | /// </summary> |
282 | /// <param name="testScene"></param> | 297 | /// <param name="testScene"></param> |
283 | private static LocalPresenceServicesConnector StartPresenceService(Scene testScene) | 298 | private static LocalPresenceServicesConnector StartPresenceService() |
284 | { | 299 | { |
285 | IConfigSource config = new IniConfigSource(); | 300 | IConfigSource config = new IniConfigSource(); |
286 | config.AddConfig("Modules"); | 301 | config.AddConfig("Modules"); |
@@ -292,10 +307,6 @@ namespace OpenSim.Tests.Common | |||
292 | 307 | ||
293 | LocalPresenceServicesConnector presenceService = new LocalPresenceServicesConnector(); | 308 | LocalPresenceServicesConnector presenceService = new LocalPresenceServicesConnector(); |
294 | presenceService.Initialise(config); | 309 | presenceService.Initialise(config); |
295 | |||
296 | presenceService.AddRegion(testScene); | ||
297 | presenceService.RegionLoaded(testScene); | ||
298 | testScene.AddRegionModule(presenceService.Name, presenceService); | ||
299 | 310 | ||
300 | return presenceService; | 311 | return presenceService; |
301 | } | 312 | } |
@@ -313,19 +324,52 @@ namespace OpenSim.Tests.Common | |||
313 | /// <summary> | 324 | /// <summary> |
314 | /// Setup modules for a scene. | 325 | /// Setup modules for a scene. |
315 | /// </summary> | 326 | /// </summary> |
316 | /// <param name="scene"></param> | 327 | /// <remarks> |
328 | /// If called directly, then all the modules must be shared modules. | ||
329 | /// </remarks> | ||
330 | /// <param name="scenes"></param> | ||
317 | /// <param name="config"></param> | 331 | /// <param name="config"></param> |
318 | /// <param name="modules"></param> | 332 | /// <param name="modules"></param> |
319 | public static void SetupSceneModules(Scene scene, IConfigSource config, params object[] modules) | 333 | public static void SetupSceneModules(Scene scene, IConfigSource config, params object[] modules) |
320 | { | 334 | { |
335 | SetupSceneModules(new Scene[] { scene }, config, modules); | ||
336 | } | ||
337 | |||
338 | /// <summary> | ||
339 | /// Setup modules for a scene using their default settings. | ||
340 | /// </summary> | ||
341 | /// <param name="scenes"></param> | ||
342 | /// <param name="modules"></param> | ||
343 | public static void SetupSceneModules(Scene[] scenes, params object[] modules) | ||
344 | { | ||
345 | SetupSceneModules(scenes, new IniConfigSource(), modules); | ||
346 | } | ||
347 | |||
348 | /// <summary> | ||
349 | /// Setup modules for scenes. | ||
350 | /// </summary> | ||
351 | /// <remarks> | ||
352 | /// If called directly, then all the modules must be shared modules. | ||
353 | /// </remarks> | ||
354 | /// <param name="scenes"></param> | ||
355 | /// <param name="config"></param> | ||
356 | /// <param name="modules"></param> | ||
357 | public static void SetupSceneModules(Scene[] scenes, IConfigSource config, params object[] modules) | ||
358 | { | ||
321 | List<IRegionModuleBase> newModules = new List<IRegionModuleBase>(); | 359 | List<IRegionModuleBase> newModules = new List<IRegionModuleBase>(); |
322 | foreach (object module in modules) | 360 | foreach (object module in modules) |
323 | { | 361 | { |
362 | // Console.WriteLine("MODULE RAW {0}", module); | ||
324 | if (module is IRegionModule) | 363 | if (module is IRegionModule) |
325 | { | 364 | { |
326 | IRegionModule m = (IRegionModule)module; | 365 | IRegionModule m = (IRegionModule)module; |
327 | m.Initialise(scene, config); | 366 | |
328 | scene.AddModule(m.Name, m); | 367 | foreach (Scene scene in scenes) |
368 | { | ||
369 | m.Initialise(scene, config); | ||
370 | scene.AddModule(m.Name, m); | ||
371 | } | ||
372 | |||
329 | m.PostInitialise(); | 373 | m.PostInitialise(); |
330 | } | 374 | } |
331 | else if (module is IRegionModuleBase) | 375 | else if (module is IRegionModuleBase) |
@@ -333,6 +377,7 @@ namespace OpenSim.Tests.Common | |||
333 | // for the new system, everything has to be initialised first, | 377 | // for the new system, everything has to be initialised first, |
334 | // shared modules have to be post-initialised, then all get an AddRegion with the scene | 378 | // shared modules have to be post-initialised, then all get an AddRegion with the scene |
335 | IRegionModuleBase m = (IRegionModuleBase)module; | 379 | IRegionModuleBase m = (IRegionModuleBase)module; |
380 | // Console.WriteLine("MODULE {0}", m.Name); | ||
336 | m.Initialise(config); | 381 | m.Initialise(config); |
337 | newModules.Add(m); | 382 | newModules.Add(m); |
338 | } | 383 | } |
@@ -345,15 +390,19 @@ namespace OpenSim.Tests.Common | |||
345 | 390 | ||
346 | foreach (IRegionModuleBase module in newModules) | 391 | foreach (IRegionModuleBase module in newModules) |
347 | { | 392 | { |
348 | module.AddRegion(scene); | 393 | foreach (Scene scene in scenes) |
349 | scene.AddRegionModule(module.Name, module); | 394 | { |
395 | module.AddRegion(scene); | ||
396 | scene.AddRegionModule(module.Name, module); | ||
397 | } | ||
350 | } | 398 | } |
351 | 399 | ||
352 | // RegionLoaded is fired after all modules have been appropriately added to all scenes | 400 | // RegionLoaded is fired after all modules have been appropriately added to all scenes |
353 | foreach (IRegionModuleBase module in newModules) | 401 | foreach (IRegionModuleBase module in newModules) |
354 | module.RegionLoaded(scene); | 402 | foreach (Scene scene in scenes) |
403 | module.RegionLoaded(scene); | ||
355 | 404 | ||
356 | scene.SetModuleInterfaces(); | 405 | foreach (Scene scene in scenes) { scene.SetModuleInterfaces(); } |
357 | } | 406 | } |
358 | 407 | ||
359 | /// <summary> | 408 | /// <summary> |
@@ -388,6 +437,10 @@ namespace OpenSim.Tests.Common | |||
388 | /// <summary> | 437 | /// <summary> |
389 | /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test | 438 | /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test |
390 | /// </summary> | 439 | /// </summary> |
440 | /// <remarks> | ||
441 | /// This can be used for tests where there is only one region or where there are multiple non-neighbour regions | ||
442 | /// and teleport doesn't take place. | ||
443 | /// </remarks> | ||
391 | /// <param name="scene"></param> | 444 | /// <param name="scene"></param> |
392 | /// <param name="agentId"></param> | 445 | /// <param name="agentId"></param> |
393 | /// <returns></returns> | 446 | /// <returns></returns> |
@@ -397,6 +450,18 @@ namespace OpenSim.Tests.Common | |||
397 | } | 450 | } |
398 | 451 | ||
399 | /// <summary> | 452 | /// <summary> |
453 | /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test | ||
454 | /// </summary> | ||
455 | /// <param name="scene"></param> | ||
456 | /// <param name="agentId"></param> | ||
457 | /// <param name="sceneManager"></param> | ||
458 | /// <returns></returns> | ||
459 | public static ScenePresence AddScenePresence(Scene scene, UUID agentId, SceneManager sceneManager) | ||
460 | { | ||
461 | return AddScenePresence(scene, GenerateAgentData(agentId), sceneManager); | ||
462 | } | ||
463 | |||
464 | /// <summary> | ||
400 | /// Add a root agent. | 465 | /// Add a root agent. |
401 | /// </summary> | 466 | /// </summary> |
402 | /// <remarks> | 467 | /// <remarks> |
@@ -416,6 +481,30 @@ namespace OpenSim.Tests.Common | |||
416 | /// <returns></returns> | 481 | /// <returns></returns> |
417 | public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData) | 482 | public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData) |
418 | { | 483 | { |
484 | return AddScenePresence(scene, agentData, null); | ||
485 | } | ||
486 | |||
487 | /// <summary> | ||
488 | /// Add a root agent. | ||
489 | /// </summary> | ||
490 | /// <remarks> | ||
491 | /// This function | ||
492 | /// | ||
493 | /// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the | ||
494 | /// userserver if grid) would give initial login data back to the client and separately tell the scene that the | ||
495 | /// agent was coming. | ||
496 | /// | ||
497 | /// 2) Connects the agent with the scene | ||
498 | /// | ||
499 | /// This function performs actions equivalent with notifying the scene that an agent is | ||
500 | /// coming and then actually connecting the agent to the scene. The one step missed out is the very first | ||
501 | /// </remarks> | ||
502 | /// <param name="scene"></param> | ||
503 | /// <param name="agentData"></param> | ||
504 | /// <param name="sceneManager"></param> | ||
505 | /// <returns></returns> | ||
506 | public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData, SceneManager sceneManager) | ||
507 | { | ||
419 | // We emulate the proper login sequence here by doing things in four stages | 508 | // We emulate the proper login sequence here by doing things in four stages |
420 | 509 | ||
421 | // Stage 0: login | 510 | // Stage 0: login |
@@ -425,7 +514,7 @@ namespace OpenSim.Tests.Common | |||
425 | lpsc.m_PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID); | 514 | lpsc.m_PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID); |
426 | 515 | ||
427 | // Stages 1 & 2 | 516 | // Stages 1 & 2 |
428 | ScenePresence sp = IntroduceClientToScene(scene, agentData, TeleportFlags.ViaLogin); | 517 | ScenePresence sp = IntroduceClientToScene(scene, sceneManager, agentData, TeleportFlags.ViaLogin); |
429 | 518 | ||
430 | // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. | 519 | // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. |
431 | sp.CompleteMovement(sp.ControllingClient, true); | 520 | sp.CompleteMovement(sp.ControllingClient, true); |
@@ -433,7 +522,20 @@ namespace OpenSim.Tests.Common | |||
433 | return sp; | 522 | return sp; |
434 | } | 523 | } |
435 | 524 | ||
436 | private static ScenePresence IntroduceClientToScene(Scene scene, AgentCircuitData agentData, TeleportFlags tf) | 525 | /// <summary> |
526 | /// Introduce an agent into the scene by adding a new client. | ||
527 | /// </summary> | ||
528 | /// <returns>The scene presence added</returns> | ||
529 | /// <param name='sceneManager'> | ||
530 | /// Scene manager. Can be null if there is only one region in the test or multiple regions that are not | ||
531 | /// neighbours and where no teleporting takes place. | ||
532 | /// </param> | ||
533 | /// <param name='scene'></param> | ||
534 | /// <param name='sceneManager></param> | ||
535 | /// <param name='agentData'></param> | ||
536 | /// <param name='tf'></param> | ||
537 | private static ScenePresence IntroduceClientToScene( | ||
538 | Scene scene, SceneManager sceneManager, AgentCircuitData agentData, TeleportFlags tf) | ||
437 | { | 539 | { |
438 | string reason; | 540 | string reason; |
439 | 541 | ||
@@ -442,7 +544,7 @@ namespace OpenSim.Tests.Common | |||
442 | Console.WriteLine("NewUserConnection failed: " + reason); | 544 | Console.WriteLine("NewUserConnection failed: " + reason); |
443 | 545 | ||
444 | // Stage 2: add the new client as a child agent to the scene | 546 | // Stage 2: add the new client as a child agent to the scene |
445 | TestClient client = new TestClient(agentData, scene); | 547 | TestClient client = new TestClient(agentData, scene, sceneManager); |
446 | scene.AddNewClient(client, PresenceType.User); | 548 | scene.AddNewClient(client, PresenceType.User); |
447 | 549 | ||
448 | return scene.GetScenePresence(agentData.AgentID); | 550 | return scene.GetScenePresence(agentData.AgentID); |
@@ -454,7 +556,7 @@ namespace OpenSim.Tests.Common | |||
454 | acd.child = true; | 556 | acd.child = true; |
455 | 557 | ||
456 | // XXX: ViaLogin may not be correct for child agents | 558 | // XXX: ViaLogin may not be correct for child agents |
457 | return IntroduceClientToScene(scene, acd, TeleportFlags.ViaLogin); | 559 | return IntroduceClientToScene(scene, null, acd, TeleportFlags.ViaLogin); |
458 | } | 560 | } |
459 | 561 | ||
460 | /// <summary> | 562 | /// <summary> |
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index b2c824c..8cea476f 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -46,12 +46,10 @@ namespace OpenSim.Tests.Common.Mock | |||
46 | 46 | ||
47 | EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing"); | 47 | EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing"); |
48 | 48 | ||
49 | // TODO: This is a really nasty (and temporary) means of telling the test client which scene to invoke setup | ||
50 | // methods on when a teleport is requested | ||
51 | public Scene TeleportTargetScene; | ||
52 | private TestClient TeleportSceneClient; | 49 | private TestClient TeleportSceneClient; |
53 | 50 | ||
54 | private Scene m_scene; | 51 | private Scene m_scene; |
52 | private SceneManager m_sceneManager; | ||
55 | 53 | ||
56 | // Properties so that we can get at received data for test purposes | 54 | // Properties so that we can get at received data for test purposes |
57 | public List<UUID> ReceivedOfflineNotifications { get; private set; } | 55 | public List<UUID> ReceivedOfflineNotifications { get; private set; } |
@@ -435,15 +433,29 @@ namespace OpenSim.Tests.Common.Mock | |||
435 | /// <summary> | 433 | /// <summary> |
436 | /// Constructor | 434 | /// Constructor |
437 | /// </summary> | 435 | /// </summary> |
436 | /// <remarks> | ||
437 | /// Can be used for a test where there is only one region or where there are multiple regions that are not | ||
438 | /// neighbours and where no teleporting takes place. In other situations, the constructor that takes in a | ||
439 | /// scene manager should be used. | ||
440 | /// </remarks> | ||
438 | /// <param name="agentData"></param> | 441 | /// <param name="agentData"></param> |
439 | /// <param name="scene"></param> | 442 | /// <param name="scene"></param> |
440 | public TestClient(AgentCircuitData agentData, Scene scene) | 443 | public TestClient(AgentCircuitData agentData, Scene scene) : this(agentData, scene, null) {} |
444 | |||
445 | /// <summary> | ||
446 | /// Constructor | ||
447 | /// </summary> | ||
448 | /// <param name="agentData"></param> | ||
449 | /// <param name="scene"></param> | ||
450 | /// <param name="sceneManager"></param> | ||
451 | public TestClient(AgentCircuitData agentData, Scene scene, SceneManager sceneManager) | ||
441 | { | 452 | { |
442 | m_agentId = agentData.AgentID; | 453 | m_agentId = agentData.AgentID; |
443 | m_firstName = agentData.firstname; | 454 | m_firstName = agentData.firstname; |
444 | m_lastName = agentData.lastname; | 455 | m_lastName = agentData.lastname; |
445 | m_circuitCode = agentData.circuitcode; | 456 | m_circuitCode = agentData.circuitcode; |
446 | m_scene = scene; | 457 | m_scene = scene; |
458 | m_sceneManager = sceneManager; | ||
447 | SessionId = agentData.SessionID; | 459 | SessionId = agentData.SessionID; |
448 | SecureSessionId = agentData.SecureSessionID; | 460 | SecureSessionId = agentData.SecureSessionID; |
449 | CapsSeedUrl = agentData.CapsPath; | 461 | CapsSeedUrl = agentData.CapsPath; |
@@ -593,8 +605,16 @@ namespace OpenSim.Tests.Common.Mock | |||
593 | AgentCircuitData newAgent = RequestClientInfo(); | 605 | AgentCircuitData newAgent = RequestClientInfo(); |
594 | 606 | ||
595 | // Stage 2: add the new client as a child agent to the scene | 607 | // Stage 2: add the new client as a child agent to the scene |
596 | TeleportSceneClient = new TestClient(newAgent, TeleportTargetScene); | 608 | uint x, y; |
597 | TeleportTargetScene.AddNewClient(TeleportSceneClient, PresenceType.User); | 609 | Utils.LongToUInts(neighbourHandle, out x, out y); |
610 | x /= Constants.RegionSize; | ||
611 | y /= Constants.RegionSize; | ||
612 | |||
613 | Scene neighbourScene; | ||
614 | m_sceneManager.TryGetScene(x, y, out neighbourScene); | ||
615 | |||
616 | TeleportSceneClient = new TestClient(newAgent, neighbourScene, m_sceneManager); | ||
617 | neighbourScene.AddNewClient(TeleportSceneClient, PresenceType.User); | ||
598 | } | 618 | } |
599 | 619 | ||
600 | public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, | 620 | public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, |
@@ -604,6 +624,13 @@ namespace OpenSim.Tests.Common.Mock | |||
604 | 624 | ||
605 | CapsSeedUrl = capsURL; | 625 | CapsSeedUrl = capsURL; |
606 | 626 | ||
627 | // We don't do this here so that the source region can complete processing first in a single-threaded | ||
628 | // regression test scenario. The test itself will have to call CompleteTeleportClientSide() after a teleport | ||
629 | // CompleteTeleportClientSide(); | ||
630 | } | ||
631 | |||
632 | public void CompleteTeleportClientSide() | ||
633 | { | ||
607 | TeleportSceneClient.CompleteMovement(); | 634 | TeleportSceneClient.CompleteMovement(); |
608 | //TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false); | 635 | //TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false); |
609 | } | 636 | } |
diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs index 0e4dfb9..4b4d52d 100644 --- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs +++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs | |||
@@ -46,6 +46,14 @@ namespace OpenSim.Tests.Common.Mock | |||
46 | { | 46 | { |
47 | m_scene = scene; | 47 | m_scene = scene; |
48 | m_parcels = new List<ILandObject>(); | 48 | m_parcels = new List<ILandObject>(); |
49 | SetupDefaultParcel(); | ||
50 | } | ||
51 | |||
52 | private void SetupDefaultParcel() | ||
53 | { | ||
54 | ILandObject obj = new LandObject(UUID.Zero, false, m_scene); | ||
55 | obj.LandData.Name = "Your Parcel"; | ||
56 | m_parcels.Add(obj); | ||
49 | } | 57 | } |
50 | 58 | ||
51 | public List<ILandObject> ParcelsNearPoint(Vector3 position) | 59 | public List<ILandObject> ParcelsNearPoint(Vector3 position) |
@@ -63,11 +71,7 @@ namespace OpenSim.Tests.Common.Mock | |||
63 | m_parcels.Clear(); | 71 | m_parcels.Clear(); |
64 | 72 | ||
65 | if (setupDefaultParcel) | 73 | if (setupDefaultParcel) |
66 | { | 74 | SetupDefaultParcel(); |
67 | ILandObject obj = new LandObject(UUID.Zero, false, m_scene); | ||
68 | obj.LandData.Name = "Your Parcel"; | ||
69 | m_parcels.Add(obj); | ||
70 | } | ||
71 | } | 75 | } |
72 | 76 | ||
73 | protected ILandObject GetNoLand() | 77 | protected ILandObject GetNoLand() |
@@ -102,6 +106,5 @@ namespace OpenSim.Tests.Common.Mock | |||
102 | 106 | ||
103 | public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} | 107 | public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} |
104 | public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} | 108 | public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} |
105 | |||
106 | } | 109 | } |
107 | } | 110 | } \ No newline at end of file |
diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs index ced06de..6744fca 100644 --- a/OpenSim/Tests/Common/TestHelpers.cs +++ b/OpenSim/Tests/Common/TestHelpers.cs | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Diagnostics; | 29 | using System.Diagnostics; |
30 | using System.IO; | ||
31 | using System.Text; | ||
30 | using NUnit.Framework; | 32 | using NUnit.Framework; |
31 | using OpenMetaverse; | 33 | using OpenMetaverse; |
32 | 34 | ||
@@ -34,6 +36,38 @@ namespace OpenSim.Tests.Common | |||
34 | { | 36 | { |
35 | public class TestHelpers | 37 | public class TestHelpers |
36 | { | 38 | { |
39 | private static Stream EnableLoggingConfigStream | ||
40 | = new MemoryStream( | ||
41 | Encoding.UTF8.GetBytes( | ||
42 | @"<log4net> | ||
43 | <!-- A1 is set to be a ConsoleAppender --> | ||
44 | <appender name=""A1"" type=""log4net.Appender.ConsoleAppender""> | ||
45 | |||
46 | <!-- A1 uses PatternLayout --> | ||
47 | <layout type=""log4net.Layout.PatternLayout""> | ||
48 | <!-- Print the date in ISO 8601 format --> | ||
49 | <!-- <conversionPattern value=""%date [%thread] %-5level %logger %ndc - %message%newline"" /> --> | ||
50 | <conversionPattern value=""%date %message%newline"" /> | ||
51 | </layout> | ||
52 | </appender> | ||
53 | |||
54 | <!-- Set root logger level to DEBUG and its only appender to A1 --> | ||
55 | <root> | ||
56 | <level value=""DEBUG"" /> | ||
57 | <appender-ref ref=""A1"" /> | ||
58 | </root> | ||
59 | </log4net>")); | ||
60 | |||
61 | private static Stream DisableLoggingConfigStream | ||
62 | = new MemoryStream( | ||
63 | Encoding.UTF8.GetBytes( | ||
64 | // "<?xml version=\"1.0\" encoding=\"utf-8\" ?><configuration><log4net><root><level value=\"OFF\"/><appender-ref ref=\"A1\"/></root></log4net></configuration>"))); | ||
65 | //"<?xml version=\"1.0\" encoding=\"utf-8\" ?><configuration><log4net><root><level value=\"OFF\"/></root></log4net></configuration>"))); | ||
66 | // "<configuration><log4net><root><level value=\"OFF\"/></root></log4net></configuration>")); | ||
67 | // "<configuration><log4net><root></root></log4net></configuration>"))); | ||
68 | // "<configuration><log4net><root/></log4net></configuration>")); | ||
69 | "<log4net><root/></log4net>")); | ||
70 | |||
37 | public static bool AssertThisDelegateCausesArgumentException(TestDelegate d) | 71 | public static bool AssertThisDelegateCausesArgumentException(TestDelegate d) |
38 | { | 72 | { |
39 | try | 73 | try |
@@ -58,6 +92,19 @@ namespace OpenSim.Tests.Common | |||
58 | Console.WriteLine("===> In Test Method : {0} <===", stackTrace.GetFrame(1).GetMethod().Name); | 92 | Console.WriteLine("===> In Test Method : {0} <===", stackTrace.GetFrame(1).GetMethod().Name); |
59 | } | 93 | } |
60 | 94 | ||
95 | public static void EnableLogging() | ||
96 | { | ||
97 | log4net.Config.XmlConfigurator.Configure(EnableLoggingConfigStream); | ||
98 | } | ||
99 | |||
100 | /// <summary> | ||
101 | /// Disable logging whilst running the tests. | ||
102 | /// </summary> | ||
103 | public static void DisableLogging() | ||
104 | { | ||
105 | log4net.Config.XmlConfigurator.Configure(DisableLoggingConfigStream); | ||
106 | } | ||
107 | |||
61 | /// <summary> | 108 | /// <summary> |
62 | /// Parse tail section into full UUID. | 109 | /// Parse tail section into full UUID. |
63 | /// </summary> | 110 | /// </summary> |
diff --git a/OpenSim/Tests/Torture/NPCTortureTests.cs b/OpenSim/Tests/Torture/NPCTortureTests.cs index 0224505..731df68 100644 --- a/OpenSim/Tests/Torture/NPCTortureTests.cs +++ b/OpenSim/Tests/Torture/NPCTortureTests.cs | |||
@@ -98,7 +98,7 @@ namespace OpenSim.Tests.Torture | |||
98 | umm = new UserManagementModule(); | 98 | umm = new UserManagementModule(); |
99 | am = new AttachmentsModule(); | 99 | am = new AttachmentsModule(); |
100 | 100 | ||
101 | scene = SceneHelpers.SetupScene(); | 101 | scene = new SceneHelpers().SetupScene(); |
102 | SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule()); | 102 | SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule()); |
103 | } | 103 | } |
104 | 104 | ||
diff --git a/OpenSim/Tests/Torture/ObjectTortureTests.cs b/OpenSim/Tests/Torture/ObjectTortureTests.cs index d0d2199..195d47b 100644 --- a/OpenSim/Tests/Torture/ObjectTortureTests.cs +++ b/OpenSim/Tests/Torture/ObjectTortureTests.cs | |||
@@ -126,7 +126,7 @@ namespace OpenSim.Tests.Torture | |||
126 | // Using a local variable for scene, at least on mono 2.6.7, means that it's much more likely to be garbage | 126 | // Using a local variable for scene, at least on mono 2.6.7, means that it's much more likely to be garbage |
127 | // collected when we teardown this test. If it's done in a member variable, even if that is subsequently | 127 | // collected when we teardown this test. If it's done in a member variable, even if that is subsequently |
128 | // nulled out, the garbage collect can be delayed. | 128 | // nulled out, the garbage collect can be delayed. |
129 | TestScene scene = SceneHelpers.SetupScene(); | 129 | TestScene scene = new SceneHelpers().SetupScene(); |
130 | 130 | ||
131 | // Process process = Process.GetCurrentProcess(); | 131 | // Process process = Process.GetCurrentProcess(); |
132 | // long startProcessMemory = process.PrivateMemorySize64; | 132 | // long startProcessMemory = process.PrivateMemorySize64; |
diff --git a/OpenSim/Tests/Torture/ScriptTortureTests.cs b/OpenSim/Tests/Torture/ScriptTortureTests.cs index 2ef55b3..24f278f 100644 --- a/OpenSim/Tests/Torture/ScriptTortureTests.cs +++ b/OpenSim/Tests/Torture/ScriptTortureTests.cs | |||
@@ -84,7 +84,7 @@ namespace OpenSim.Tests.Torture | |||
84 | // to AssemblyResolver.OnAssemblyResolve fails. | 84 | // to AssemblyResolver.OnAssemblyResolve fails. |
85 | xEngineConfig.Set("AppDomainLoading", "false"); | 85 | xEngineConfig.Set("AppDomainLoading", "false"); |
86 | 86 | ||
87 | m_scene = SceneHelpers.SetupScene("My Test", UUID.Random(), 1000, 1000, null, configSource); | 87 | m_scene = new SceneHelpers().SetupScene("My Test", UUID.Random(), 1000, 1000, configSource); |
88 | SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine, wcModule); | 88 | SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine, wcModule); |
89 | 89 | ||
90 | m_scene.EventManager.OnChatFromWorld += OnChatFromWorld; | 90 | m_scene.EventManager.OnChatFromWorld += OnChatFromWorld; |
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs index da090dd..b6cd287 100644 --- a/OpenSim/Tools/pCampBot/Bot.cs +++ b/OpenSim/Tools/pCampBot/Bot.cs | |||
@@ -43,6 +43,14 @@ using Timer = System.Timers.Timer; | |||
43 | 43 | ||
44 | namespace pCampBot | 44 | namespace pCampBot |
45 | { | 45 | { |
46 | public enum ConnectionState | ||
47 | { | ||
48 | Disconnected, | ||
49 | Connecting, | ||
50 | Connected, | ||
51 | Disconnecting | ||
52 | } | ||
53 | |||
46 | public class Bot | 54 | public class Bot |
47 | { | 55 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 56 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -86,7 +94,7 @@ namespace pCampBot | |||
86 | /// <summary> | 94 | /// <summary> |
87 | /// Is this bot connected to the grid? | 95 | /// Is this bot connected to the grid? |
88 | /// </summary> | 96 | /// </summary> |
89 | public bool IsConnected { get; private set; } | 97 | public ConnectionState ConnectionState { get; private set; } |
90 | 98 | ||
91 | public string FirstName { get; private set; } | 99 | public string FirstName { get; private set; } |
92 | public string LastName { get; private set; } | 100 | public string LastName { get; private set; } |
@@ -130,6 +138,8 @@ namespace pCampBot | |||
130 | BotManager bm, List<IBehaviour> behaviours, | 138 | BotManager bm, List<IBehaviour> behaviours, |
131 | string firstName, string lastName, string password, string loginUri) | 139 | string firstName, string lastName, string password, string loginUri) |
132 | { | 140 | { |
141 | ConnectionState = ConnectionState.Disconnected; | ||
142 | |||
133 | behaviours.ForEach(b => b.Initialize(this)); | 143 | behaviours.ForEach(b => b.Initialize(this)); |
134 | 144 | ||
135 | Client = new GridClient(); | 145 | Client = new GridClient(); |
@@ -157,10 +167,10 @@ namespace pCampBot | |||
157 | Behaviours.ForEach( | 167 | Behaviours.ForEach( |
158 | b => | 168 | b => |
159 | { | 169 | { |
170 | Thread.Sleep(Random.Next(3000, 10000)); | ||
171 | |||
160 | // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType()); | 172 | // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType()); |
161 | b.Action(); | 173 | b.Action(); |
162 | |||
163 | Thread.Sleep(Random.Next(1000, 10000)); | ||
164 | } | 174 | } |
165 | ); | 175 | ); |
166 | } | 176 | } |
@@ -178,6 +188,8 @@ namespace pCampBot | |||
178 | /// </summary> | 188 | /// </summary> |
179 | public void shutdown() | 189 | public void shutdown() |
180 | { | 190 | { |
191 | ConnectionState = ConnectionState.Disconnecting; | ||
192 | |||
181 | if (m_actionThread != null) | 193 | if (m_actionThread != null) |
182 | m_actionThread.Abort(); | 194 | m_actionThread.Abort(); |
183 | 195 | ||
@@ -209,9 +221,11 @@ namespace pCampBot | |||
209 | Client.Network.Disconnected += this.Network_OnDisconnected; | 221 | Client.Network.Disconnected += this.Network_OnDisconnected; |
210 | Client.Objects.ObjectUpdate += Objects_NewPrim; | 222 | Client.Objects.ObjectUpdate += Objects_NewPrim; |
211 | 223 | ||
224 | ConnectionState = ConnectionState.Connecting; | ||
225 | |||
212 | if (Client.Network.Login(FirstName, LastName, Password, "pCampBot", "Your name")) | 226 | if (Client.Network.Login(FirstName, LastName, Password, "pCampBot", "Your name")) |
213 | { | 227 | { |
214 | IsConnected = true; | 228 | ConnectionState = ConnectionState.Connected; |
215 | 229 | ||
216 | Thread.Sleep(Random.Next(1000, 10000)); | 230 | Thread.Sleep(Random.Next(1000, 10000)); |
217 | m_actionThread = new Thread(Action); | 231 | m_actionThread = new Thread(Action); |
@@ -241,6 +255,8 @@ namespace pCampBot | |||
241 | } | 255 | } |
242 | else | 256 | else |
243 | { | 257 | { |
258 | ConnectionState = ConnectionState.Disconnected; | ||
259 | |||
244 | m_log.ErrorFormat( | 260 | m_log.ErrorFormat( |
245 | "{0} {1} cannot login: {2}", FirstName, LastName, Client.Network.LoginMessage); | 261 | "{0} {1} cannot login: {2}", FirstName, LastName, Client.Network.LoginMessage); |
246 | 262 | ||
@@ -439,6 +455,8 @@ namespace pCampBot | |||
439 | 455 | ||
440 | public void Network_OnDisconnected(object sender, DisconnectedEventArgs args) | 456 | public void Network_OnDisconnected(object sender, DisconnectedEventArgs args) |
441 | { | 457 | { |
458 | ConnectionState = ConnectionState.Disconnected; | ||
459 | |||
442 | m_log.DebugFormat( | 460 | m_log.DebugFormat( |
443 | "[BOT]: Bot {0} disconnected reason {1}, message {2}", Name, args.Reason, args.Message); | 461 | "[BOT]: Bot {0} disconnected reason {1}, message {2}", Name, args.Reason, args.Message); |
444 | 462 | ||
@@ -456,7 +474,6 @@ namespace pCampBot | |||
456 | && OnDisconnected != null) | 474 | && OnDisconnected != null) |
457 | // if (OnDisconnected != null) | 475 | // if (OnDisconnected != null) |
458 | { | 476 | { |
459 | IsConnected = false; | ||
460 | OnDisconnected(this, EventType.DISCONNECTED); | 477 | OnDisconnected(this, EventType.DISCONNECTED); |
461 | } | 478 | } |
462 | } | 479 | } |
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 0f501b7..d615b3f 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs | |||
@@ -49,6 +49,14 @@ namespace pCampBot | |||
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 | public const int DefaultLoginDelay = 5000; | ||
53 | |||
54 | /// <summary> | ||
55 | /// Delay between logins of multiple bots. | ||
56 | /// </summary> | ||
57 | /// <remarks>TODO: This value needs to be configurable by a command line argument.</remarks> | ||
58 | public int LoginDelay { get; set; } | ||
59 | |||
52 | /// <summary> | 60 | /// <summary> |
53 | /// Command console | 61 | /// Command console |
54 | /// </summary> | 62 | /// </summary> |
@@ -84,6 +92,8 @@ namespace pCampBot | |||
84 | /// </summary> | 92 | /// </summary> |
85 | public BotManager() | 93 | public BotManager() |
86 | { | 94 | { |
95 | LoginDelay = DefaultLoginDelay; | ||
96 | |||
87 | Rng = new Random(Environment.TickCount); | 97 | Rng = new Random(Environment.TickCount); |
88 | AssetsReceived = new Dictionary<UUID, bool>(); | 98 | AssetsReceived = new Dictionary<UUID, bool>(); |
89 | RegionsKnown = new Dictionary<ulong, GridRegion>(); | 99 | RegionsKnown = new Dictionary<ulong, GridRegion>(); |
@@ -151,28 +161,34 @@ namespace pCampBot | |||
151 | Array.ForEach<string>( | 161 | Array.ForEach<string>( |
152 | cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b)); | 162 | cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b)); |
153 | 163 | ||
164 | MainConsole.Instance.OutputFormat( | ||
165 | "[BOT MANAGER]: Starting {0} bots connecting to {1}, named {2} {3}_<n>", | ||
166 | botcount, | ||
167 | loginUri, | ||
168 | firstName, | ||
169 | lastNameStem); | ||
170 | |||
171 | MainConsole.Instance.OutputFormat("[BOT MANAGER]: Delay between logins is {0}ms", LoginDelay); | ||
172 | |||
154 | for (int i = 0; i < botcount; i++) | 173 | for (int i = 0; i < botcount; i++) |
155 | { | 174 | { |
156 | string lastName = string.Format("{0}_{1}", lastNameStem, i); | 175 | string lastName = string.Format("{0}_{1}", lastNameStem, i); |
157 | 176 | ||
177 | // We must give each bot its own list of instantiated behaviours since they store state. | ||
158 | List<IBehaviour> behaviours = new List<IBehaviour>(); | 178 | List<IBehaviour> behaviours = new List<IBehaviour>(); |
159 | 179 | ||
160 | // Hard-coded for now | 180 | // Hard-coded for now |
161 | if (behaviourSwitches.Contains("p")) | 181 | if (behaviourSwitches.Contains("p")) |
162 | behaviours.Add(new PhysicsBehaviour()); | 182 | behaviours.Add(new PhysicsBehaviour()); |
163 | 183 | ||
164 | if (behaviourSwitches.Contains("g")) | 184 | if (behaviourSwitches.Contains("g")) |
165 | behaviours.Add(new GrabbingBehaviour()); | 185 | behaviours.Add(new GrabbingBehaviour()); |
166 | 186 | ||
167 | if (behaviourSwitches.Contains("t")) | 187 | if (behaviourSwitches.Contains("t")) |
168 | behaviours.Add(new TeleportBehaviour()); | 188 | behaviours.Add(new TeleportBehaviour()); |
169 | 189 | ||
170 | if (behaviourSwitches.Contains("c")) | 190 | if (behaviourSwitches.Contains("c")) |
171 | behaviours.Add(new CrossBehaviour()); | 191 | behaviours.Add(new CrossBehaviour()); |
172 | |||
173 | MainConsole.Instance.OutputFormat( | ||
174 | "[BOT MANAGER]: Bot {0} {1} configured for behaviours {2}", | ||
175 | firstName, lastName, string.Join(",", behaviours.ConvertAll<string>(b => b.Name).ToArray())); | ||
176 | 192 | ||
177 | StartBot(this, behaviours, firstName, lastName, password, loginUri); | 193 | StartBot(this, behaviours, firstName, lastName, password, loginUri); |
178 | } | 194 | } |
@@ -211,6 +227,10 @@ namespace pCampBot | |||
211 | BotManager bm, List<IBehaviour> behaviours, | 227 | BotManager bm, List<IBehaviour> behaviours, |
212 | string firstName, string lastName, string password, string loginUri) | 228 | string firstName, string lastName, string password, string loginUri) |
213 | { | 229 | { |
230 | MainConsole.Instance.OutputFormat( | ||
231 | "[BOT MANAGER]: Starting bot {0} {1}, behaviours are {2}", | ||
232 | firstName, lastName, string.Join(",", behaviours.ConvertAll<string>(b => b.Name).ToArray())); | ||
233 | |||
214 | Bot pb = new Bot(bm, behaviours, firstName, lastName, password, loginUri); | 234 | Bot pb = new Bot(bm, behaviours, firstName, lastName, password, loginUri); |
215 | 235 | ||
216 | pb.OnConnected += handlebotEvent; | 236 | pb.OnConnected += handlebotEvent; |
@@ -222,7 +242,11 @@ namespace pCampBot | |||
222 | Thread pbThread = new Thread(pb.startup); | 242 | Thread pbThread = new Thread(pb.startup); |
223 | pbThread.Name = pb.Name; | 243 | pbThread.Name = pb.Name; |
224 | pbThread.IsBackground = true; | 244 | pbThread.IsBackground = true; |
245 | |||
225 | pbThread.Start(); | 246 | pbThread.Start(); |
247 | |||
248 | // Stagger logins | ||
249 | Thread.Sleep(LoginDelay); | ||
226 | } | 250 | } |
227 | 251 | ||
228 | /// <summary> | 252 | /// <summary> |
@@ -242,7 +266,7 @@ namespace pCampBot | |||
242 | 266 | ||
243 | lock (m_lBot) | 267 | lock (m_lBot) |
244 | { | 268 | { |
245 | if (m_lBot.TrueForAll(b => !b.IsConnected)) | 269 | if (m_lBot.TrueForAll(b => b.ConnectionState == ConnectionState.Disconnected)) |
246 | Environment.Exit(0); | 270 | Environment.Exit(0); |
247 | 271 | ||
248 | break; | 272 | break; |
@@ -251,13 +275,21 @@ namespace pCampBot | |||
251 | } | 275 | } |
252 | 276 | ||
253 | /// <summary> | 277 | /// <summary> |
254 | /// Shutting down all bots | 278 | /// Shut down all bots |
255 | /// </summary> | 279 | /// </summary> |
280 | /// <remarks> | ||
281 | /// We launch each shutdown on its own thread so that a slow shutting down bot doesn't hold up all the others. | ||
282 | /// </remarks> | ||
256 | public void doBotShutdown() | 283 | public void doBotShutdown() |
257 | { | 284 | { |
258 | lock (m_lBot) | 285 | lock (m_lBot) |
259 | foreach (Bot pb in m_lBot) | 286 | { |
260 | pb.shutdown(); | 287 | foreach (Bot bot in m_lBot) |
288 | { | ||
289 | Bot thisBot = bot; | ||
290 | Util.FireAndForget(o => thisBot.shutdown()); | ||
291 | } | ||
292 | } | ||
261 | } | 293 | } |
262 | 294 | ||
263 | /// <summary> | 295 | /// <summary> |
@@ -271,11 +303,8 @@ namespace pCampBot | |||
271 | 303 | ||
272 | private void HandleShutdown(string module, string[] cmd) | 304 | private void HandleShutdown(string module, string[] cmd) |
273 | { | 305 | { |
274 | Util.FireAndForget(o => | 306 | m_log.Info("[BOTMANAGER]: Shutting down bots"); |
275 | { | 307 | doBotShutdown(); |
276 | m_log.Warn("[BOTMANAGER]: Shutting down bots"); | ||
277 | doBotShutdown(); | ||
278 | }); | ||
279 | } | 308 | } |
280 | 309 | ||
281 | private void HandleShowRegions(string module, string[] cmd) | 310 | private void HandleShowRegions(string module, string[] cmd) |
@@ -302,9 +331,11 @@ namespace pCampBot | |||
302 | { | 331 | { |
303 | foreach (Bot pb in m_lBot) | 332 | foreach (Bot pb in m_lBot) |
304 | { | 333 | { |
334 | Simulator currentSim = pb.Client.Network.CurrentSim; | ||
335 | |||
305 | MainConsole.Instance.OutputFormat( | 336 | MainConsole.Instance.OutputFormat( |
306 | outputFormat, | 337 | outputFormat, |
307 | pb.Name, pb.Client.Network.CurrentSim.Name, pb.IsConnected ? "Connected" : "Disconnected"); | 338 | pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState); |
308 | } | 339 | } |
309 | } | 340 | } |
310 | } | 341 | } |
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs index ec5ad04..52e7501 100644 --- a/OpenSim/Tools/pCampBot/pCampBot.cs +++ b/OpenSim/Tools/pCampBot/pCampBot.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Threading; | ||
30 | using log4net; | 31 | using log4net; |
31 | using Nini.Config; | 32 | using Nini.Config; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
@@ -67,7 +68,9 @@ namespace pCampBot | |||
67 | BotManager bm = new BotManager(); | 68 | BotManager bm = new BotManager(); |
68 | 69 | ||
69 | //startup specified number of bots. 1 is the default | 70 | //startup specified number of bots. 1 is the default |
70 | bm.dobotStartup(botcount, config); | 71 | Thread startBotThread = new Thread(o => bm.dobotStartup(botcount, config)); |
72 | startBotThread.Name = "Initial start bots thread"; | ||
73 | startBotThread.Start(); | ||
71 | 74 | ||
72 | while (true) | 75 | while (true) |
73 | { | 76 | { |
diff --git a/ThirdPartyLicenses/DotNetZip-bzip2.txt b/ThirdPartyLicenses/DotNetZip-bzip2.txt new file mode 100644 index 0000000..f8b4346 --- /dev/null +++ b/ThirdPartyLicenses/DotNetZip-bzip2.txt | |||
@@ -0,0 +1,29 @@ | |||
1 | |||
2 | The managed BZIP2 code included in Ionic.BZip2.dll and Ionic.Zip.dll is | ||
3 | modified code, based on the bzip2 code in the Apache commons compress | ||
4 | library. | ||
5 | |||
6 | The original BZip2 was created by Julian Seward, and is licensed under | ||
7 | the BSD license. | ||
8 | |||
9 | The following license applies to the Apache code: | ||
10 | ----------------------------------------------------------------------- | ||
11 | |||
12 | /* | ||
13 | * Licensed to the Apache Software Foundation (ASF) under one | ||
14 | * or more contributor license agreements. See the NOTICE file | ||
15 | * distributed with this work for additional information | ||
16 | * regarding copyright ownership. The ASF licenses this file | ||
17 | * to you under the Apache License, Version 2.0 (the | ||
18 | * "License"); you may not use this file except in compliance | ||
19 | * with the License. You may obtain a copy of the License at | ||
20 | * | ||
21 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
22 | * | ||
23 | * Unless required by applicable law or agreed to in writing, | ||
24 | * software distributed under the License is distributed on an | ||
25 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
26 | * KIND, either express or implied. See the License for the | ||
27 | * specific language governing permissions and limitations | ||
28 | * under the License. | ||
29 | */ | ||
diff --git a/ThirdPartyLicenses/DotNetZip-zlib.txt b/ThirdPartyLicenses/DotNetZip-zlib.txt new file mode 100644 index 0000000..801e941 --- /dev/null +++ b/ThirdPartyLicenses/DotNetZip-zlib.txt | |||
@@ -0,0 +1,70 @@ | |||
1 | |||
2 | The following licenses govern use of the accompanying software, the | ||
3 | DotNetZip library ("the software"). If you use the software, you accept | ||
4 | these licenses. If you do not accept the license, do not use the software. | ||
5 | |||
6 | The managed ZLIB code included in Ionic.Zlib.dll and Ionic.Zip.dll is | ||
7 | modified code, based on jzlib. | ||
8 | |||
9 | |||
10 | |||
11 | The following notice applies to jzlib: | ||
12 | ----------------------------------------------------------------------- | ||
13 | |||
14 | Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved. | ||
15 | |||
16 | Redistribution and use in source and binary forms, with or without | ||
17 | modification, are permitted provided that the following conditions are met: | ||
18 | |||
19 | 1. Redistributions of source code must retain the above copyright notice, | ||
20 | this list of conditions and the following disclaimer. | ||
21 | |||
22 | 2. Redistributions in binary form must reproduce the above copyright | ||
23 | notice, this list of conditions and the following disclaimer in | ||
24 | the documentation and/or other materials provided with the distribution. | ||
25 | |||
26 | 3. The names of the authors may not be used to endorse or promote products | ||
27 | derived from this software without specific prior written permission. | ||
28 | |||
29 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||
30 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
31 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, | ||
32 | INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
33 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
35 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
36 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
37 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
38 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
39 | |||
40 | ----------------------------------------------------------------------- | ||
41 | |||
42 | jzlib is based on zlib-1.1.3. | ||
43 | |||
44 | The following notice applies to zlib: | ||
45 | |||
46 | ----------------------------------------------------------------------- | ||
47 | |||
48 | Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler | ||
49 | |||
50 | The ZLIB software is provided 'as-is', without any express or implied | ||
51 | warranty. In no event will the authors be held liable for any damages | ||
52 | arising from the use of this software. | ||
53 | |||
54 | Permission is granted to anyone to use this software for any purpose, | ||
55 | including commercial applications, and to alter it and redistribute it | ||
56 | freely, subject to the following restrictions: | ||
57 | |||
58 | 1. The origin of this software must not be misrepresented; you must not | ||
59 | claim that you wrote the original software. If you use this software | ||
60 | in a product, an acknowledgment in the product documentation would be | ||
61 | appreciated but is not required. | ||
62 | 2. Altered source versions must be plainly marked as such, and must not be | ||
63 | misrepresented as being the original software. | ||
64 | 3. This notice may not be removed or altered from any source distribution. | ||
65 | |||
66 | Jean-loup Gailly jloup@gzip.org | ||
67 | Mark Adler madler@alumni.caltech.edu | ||
68 | |||
69 | |||
70 | ----------------------------------------------------------------------- | ||
diff --git a/ThirdPartyLicenses/DotNetZip.txt b/ThirdPartyLicenses/DotNetZip.txt new file mode 100644 index 0000000..c3103fd --- /dev/null +++ b/ThirdPartyLicenses/DotNetZip.txt | |||
@@ -0,0 +1,33 @@ | |||
1 | Microsoft Public License (Ms-PL) | ||
2 | |||
3 | This license governs use of the accompanying software, the DotNetZip library ("the software"). If you use the software, you accept this license. If you do not accept the license, do not use the software. | ||
4 | |||
5 | 1. Definitions | ||
6 | |||
7 | The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. | ||
8 | |||
9 | A "contribution" is the original software, or any additions or changes to the software. | ||
10 | |||
11 | A "contributor" is any person that distributes its contribution under this license. | ||
12 | |||
13 | "Licensed patents" are a contributor's patent claims that read directly on its contribution. | ||
14 | |||
15 | 2. Grant of Rights | ||
16 | |||
17 | (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. | ||
18 | |||
19 | (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. | ||
20 | |||
21 | 3. Conditions and Limitations | ||
22 | |||
23 | (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. | ||
24 | |||
25 | (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. | ||
26 | |||
27 | (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. | ||
28 | |||
29 | (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. | ||
30 | |||
31 | (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. | ||
32 | |||
33 | |||
diff --git a/bin/Ionic.Zip.dll b/bin/Ionic.Zip.dll new file mode 100755 index 0000000..95fa928 --- /dev/null +++ b/bin/Ionic.Zip.dll | |||
Binary files differ | |||
diff --git a/bin/OpenSim.Framework.Serialization.Tests.dll.config b/bin/OpenSim.Framework.Serialization.Tests.dll.config deleted file mode 100644 index a3f681d..0000000 --- a/bin/OpenSim.Framework.Serialization.Tests.dll.config +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <configuration> | ||
3 | <configSections> | ||
4 | <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> | ||
5 | </configSections> | ||
6 | <runtime> | ||
7 | <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
8 | <dependentAssembly> | ||
9 | <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" /> | ||
10 | <bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" /> | ||
11 | <bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" /> | ||
12 | <bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" /> | ||
13 | </dependentAssembly> | ||
14 | </assemblyBinding> | ||
15 | </runtime> | ||
16 | <log4net> | ||
17 | <!-- A1 is set to be a ConsoleAppender --> | ||
18 | <appender name="A1" type="log4net.Appender.ConsoleAppender"> | ||
19 | |||
20 | <!-- A1 uses PatternLayout --> | ||
21 | <layout type="log4net.Layout.PatternLayout"> | ||
22 | <!-- Print the date in ISO 8601 format --> | ||
23 | <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" /> | ||
24 | </layout> | ||
25 | </appender> | ||
26 | |||
27 | <!-- Set root logger level to DEBUG and its only appender to A1 --> | ||
28 | <root> | ||
29 | <level value="DEBUG" /> | ||
30 | <appender-ref ref="A1" /> | ||
31 | </root> | ||
32 | </log4net> | ||
33 | </configuration> | ||
diff --git a/bin/OpenSim.Region.ClientStack.LindenCaps.Tests.dll.config b/bin/OpenSim.Region.ClientStack.LindenCaps.Tests.dll.config deleted file mode 100644 index a3f681d..0000000 --- a/bin/OpenSim.Region.ClientStack.LindenCaps.Tests.dll.config +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <configuration> | ||
3 | <configSections> | ||
4 | <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> | ||
5 | </configSections> | ||
6 | <runtime> | ||
7 | <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
8 | <dependentAssembly> | ||
9 | <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" /> | ||
10 | <bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" /> | ||
11 | <bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" /> | ||
12 | <bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" /> | ||
13 | </dependentAssembly> | ||
14 | </assemblyBinding> | ||
15 | </runtime> | ||
16 | <log4net> | ||
17 | <!-- A1 is set to be a ConsoleAppender --> | ||
18 | <appender name="A1" type="log4net.Appender.ConsoleAppender"> | ||
19 | |||
20 | <!-- A1 uses PatternLayout --> | ||
21 | <layout type="log4net.Layout.PatternLayout"> | ||
22 | <!-- Print the date in ISO 8601 format --> | ||
23 | <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" /> | ||
24 | </layout> | ||
25 | </appender> | ||
26 | |||
27 | <!-- Set root logger level to DEBUG and its only appender to A1 --> | ||
28 | <root> | ||
29 | <level value="DEBUG" /> | ||
30 | <appender-ref ref="A1" /> | ||
31 | </root> | ||
32 | </log4net> | ||
33 | </configuration> | ||
diff --git a/bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll.config b/bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll.config deleted file mode 100644 index a3f681d..0000000 --- a/bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll.config +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <configuration> | ||
3 | <configSections> | ||
4 | <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> | ||
5 | </configSections> | ||
6 | <runtime> | ||
7 | <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
8 | <dependentAssembly> | ||
9 | <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" /> | ||
10 | <bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" /> | ||
11 | <bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" /> | ||
12 | <bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" /> | ||
13 | </dependentAssembly> | ||
14 | </assemblyBinding> | ||
15 | </runtime> | ||
16 | <log4net> | ||
17 | <!-- A1 is set to be a ConsoleAppender --> | ||
18 | <appender name="A1" type="log4net.Appender.ConsoleAppender"> | ||
19 | |||
20 | <!-- A1 uses PatternLayout --> | ||
21 | <layout type="log4net.Layout.PatternLayout"> | ||
22 | <!-- Print the date in ISO 8601 format --> | ||
23 | <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" /> | ||
24 | </layout> | ||
25 | </appender> | ||
26 | |||
27 | <!-- Set root logger level to DEBUG and its only appender to A1 --> | ||
28 | <root> | ||
29 | <level value="DEBUG" /> | ||
30 | <appender-ref ref="A1" /> | ||
31 | </root> | ||
32 | </log4net> | ||
33 | </configuration> | ||
diff --git a/bin/OpenSim.Region.OptionalModules.Tests.dll.config b/bin/OpenSim.Region.OptionalModules.Tests.dll.config deleted file mode 100644 index a3f681d..0000000 --- a/bin/OpenSim.Region.OptionalModules.Tests.dll.config +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <configuration> | ||
3 | <configSections> | ||
4 | <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> | ||
5 | </configSections> | ||
6 | <runtime> | ||
7 | <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
8 | <dependentAssembly> | ||
9 | <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" /> | ||
10 | <bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" /> | ||
11 | <bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" /> | ||
12 | <bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" /> | ||
13 | </dependentAssembly> | ||
14 | </assemblyBinding> | ||
15 | </runtime> | ||
16 | <log4net> | ||
17 | <!-- A1 is set to be a ConsoleAppender --> | ||
18 | <appender name="A1" type="log4net.Appender.ConsoleAppender"> | ||
19 | |||
20 | <!-- A1 uses PatternLayout --> | ||
21 | <layout type="log4net.Layout.PatternLayout"> | ||
22 | <!-- Print the date in ISO 8601 format --> | ||
23 | <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" /> | ||
24 | </layout> | ||
25 | </appender> | ||
26 | |||
27 | <!-- Set root logger level to DEBUG and its only appender to A1 --> | ||
28 | <root> | ||
29 | <level value="DEBUG" /> | ||
30 | <appender-ref ref="A1" /> | ||
31 | </root> | ||
32 | </log4net> | ||
33 | </configuration> | ||
diff --git a/bin/OpenSim.Tests.Torture.dll.config b/bin/OpenSim.Tests.Torture.dll.config deleted file mode 100644 index a3f681d..0000000 --- a/bin/OpenSim.Tests.Torture.dll.config +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <configuration> | ||
3 | <configSections> | ||
4 | <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> | ||
5 | </configSections> | ||
6 | <runtime> | ||
7 | <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
8 | <dependentAssembly> | ||
9 | <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" /> | ||
10 | <bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" /> | ||
11 | <bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" /> | ||
12 | <bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" /> | ||
13 | </dependentAssembly> | ||
14 | </assemblyBinding> | ||
15 | </runtime> | ||
16 | <log4net> | ||
17 | <!-- A1 is set to be a ConsoleAppender --> | ||
18 | <appender name="A1" type="log4net.Appender.ConsoleAppender"> | ||
19 | |||
20 | <!-- A1 uses PatternLayout --> | ||
21 | <layout type="log4net.Layout.PatternLayout"> | ||
22 | <!-- Print the date in ISO 8601 format --> | ||
23 | <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" /> | ||
24 | </layout> | ||
25 | </appender> | ||
26 | |||
27 | <!-- Set root logger level to DEBUG and its only appender to A1 --> | ||
28 | <root> | ||
29 | <level value="DEBUG" /> | ||
30 | <appender-ref ref="A1" /> | ||
31 | </root> | ||
32 | </log4net> | ||
33 | </configuration> | ||
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 50366a6..9b88816 100755 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -241,6 +241,14 @@ | |||
241 | ;; server to send mail through. | 241 | ;; server to send mail through. |
242 | ; emailmodule = DefaultEmailModule | 242 | ; emailmodule = DefaultEmailModule |
243 | 243 | ||
244 | ;# {SpawnPointRouting} {} {Set routing method for Telehub Spawnpoints} {closest random sequential} closest | ||
245 | ;; SpawnPointRouting adjusts the landing for incoming avatars. | ||
246 | ;; "closest" will place the avatar at the SpawnPoint located in the closest | ||
247 | ;; available spot to the destination (typically map click/landmark). | ||
248 | ;; "random" will place the avatar on a randomly selected spawnpoint; | ||
249 | ;; "sequential" will place the avatar on the next sequential SpawnPoint | ||
250 | ; SpawnPointRouting = closest | ||
251 | |||
244 | [Estates] | 252 | [Estates] |
245 | ; If these values are commented out then the user will be asked for estate details when required (this is the normal case). | 253 | ; If these values are commented out then the user will be asked for estate details when required (this is the normal case). |
246 | ; If these values are uncommented then they will be used to create a default estate as necessary. | 254 | ; If these values are uncommented then they will be used to create a default estate as necessary. |
@@ -273,6 +281,12 @@ | |||
273 | ;# {host_domain_header_from} {[Startup]emailmodule:DefaultEmailModule enabled:true} {From address to use in the sent email header?} {} 127.0.0.1 | 281 | ;# {host_domain_header_from} {[Startup]emailmodule:DefaultEmailModule enabled:true} {From address to use in the sent email header?} {} 127.0.0.1 |
274 | ; host_domain_header_from = "127.0.0.1" | 282 | ; host_domain_header_from = "127.0.0.1" |
275 | 283 | ||
284 | ;# {email_pause_time} {[Startup]emailmodule:DefaultEmailModule enabled:true} {Period in seconds to delay after an email is sent.} {} 20 | ||
285 | ; email_pause_time = 20 | ||
286 | |||
287 | ;# {email_max_size} {[Startup]emailmodule:DefaultEmailModule enabled:true} {Maximum total size of email in bytes.} {} 4096 | ||
288 | ; email_max_size = 4096 | ||
289 | |||
276 | ;# {SMTP_SERVER_HOSTNAME} {[Startup]emailmodule:DefaultEmailModule enabled:true} {SMTP server name?} {} 127.0.0.1 | 290 | ;# {SMTP_SERVER_HOSTNAME} {[Startup]emailmodule:DefaultEmailModule enabled:true} {SMTP server name?} {} 127.0.0.1 |
277 | ; SMTP_SERVER_HOSTNAME = "127.0.0.1" | 291 | ; SMTP_SERVER_HOSTNAME = "127.0.0.1" |
278 | 292 | ||
@@ -285,7 +299,6 @@ | |||
285 | ;# {SMTP_SERVER_PASSWORD} {[Startup]emailmodule:DefaultEmailModule enabled:true} {SMTP server password} {} | 299 | ;# {SMTP_SERVER_PASSWORD} {[Startup]emailmodule:DefaultEmailModule enabled:true} {SMTP server password} {} |
286 | ; SMTP_SERVER_PASSWORD = "" | 300 | ; SMTP_SERVER_PASSWORD = "" |
287 | 301 | ||
288 | |||
289 | [Network] | 302 | [Network] |
290 | ;; Configure the remote console user here. This will not actually be used | 303 | ;; Configure the remote console user here. This will not actually be used |
291 | ;; unless you use -console=rest at startup. | 304 | ;; unless you use -console=rest at startup. |
@@ -677,7 +690,7 @@ | |||
677 | ;; Sets the multiplier for the scripting delays | 690 | ;; Sets the multiplier for the scripting delays |
678 | ; ScriptDelayFactor = 1.0 | 691 | ; ScriptDelayFactor = 1.0 |
679 | 692 | ||
680 | ;; The factor the 10 m distances llimits are multiplied by | 693 | ;; The factor the 10 m distances limits are multiplied by |
681 | ; ScriptDistanceLimitFactor = 1.0 | 694 | ; ScriptDistanceLimitFactor = 1.0 |
682 | 695 | ||
683 | ;; Maximum length of notecard line read | 696 | ;; Maximum length of notecard line read |
@@ -780,7 +793,7 @@ | |||
780 | ;; groups service if the service is using these keys | 793 | ;; groups service if the service is using these keys |
781 | ; XmlRpcServiceReadKey = 1234 | 794 | ; XmlRpcServiceReadKey = 1234 |
782 | ; XmlRpcServiceWriteKey = 1234 | 795 | ; XmlRpcServiceWriteKey = 1234 |
783 | 796 | ||
784 | [InterestManagement] | 797 | [InterestManagement] |
785 | ;# {UpdatePrioritizationScheme} {} {Update prioritization scheme?} {BestAvatarResponsiveness Time Distance SimpleAngularDistance FrontBack} BestAvatarResponsiveness | 798 | ;# {UpdatePrioritizationScheme} {} {Update prioritization scheme?} {BestAvatarResponsiveness Time Distance SimpleAngularDistance FrontBack} BestAvatarResponsiveness |
786 | ;; This section controls how state updates are prioritized for each client | 799 | ;; This section controls how state updates are prioritized for each client |
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 6fb9787..d159960 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -337,6 +337,13 @@ | |||
337 | ; OpenJPEG if false | 337 | ; OpenJPEG if false |
338 | ; UseCSJ2K = true | 338 | ; UseCSJ2K = true |
339 | 339 | ||
340 | |||
341 | ; Use "Trash" folder for items deleted from the scene | ||
342 | ; When set to True (the default) items deleted from the scene will be | ||
343 | ; stored in the user's trash or lost and found folder. When set to | ||
344 | ; False items will be removed from the scene permanently | ||
345 | UseTrashOnDelete = True | ||
346 | |||
340 | ; Persist avatar baked textures | 347 | ; Persist avatar baked textures |
341 | ; Persisting baked textures can speed up login and region border | 348 | ; Persisting baked textures can speed up login and region border |
342 | ; crossings especially with large numbers of users, though it | 349 | ; crossings especially with large numbers of users, though it |
@@ -1129,7 +1136,7 @@ | |||
1129 | 1136 | ||
1130 | ; Maximum number of llListen events we allow over the entire region. | 1137 | ; Maximum number of llListen events we allow over the entire region. |
1131 | ; Set this to 0 to have no limit imposed | 1138 | ; Set this to 0 to have no limit imposed |
1132 | max_listeners_per_region = 1000 | 1139 | max_listens_per_region = 1000 |
1133 | 1140 | ||
1134 | ; Maximum number of llListen events we allow per script | 1141 | ; Maximum number of llListen events we allow per script |
1135 | ; Set this to 0 to have no limit imposed. | 1142 | ; Set this to 0 to have no limit imposed. |
@@ -1561,6 +1568,12 @@ | |||
1561 | RefreshTime = 3600 | 1568 | RefreshTime = 3600 |
1562 | 1569 | ||
1563 | ;; | 1570 | ;; |
1571 | ;; JsonStore module provides structured store for scripts | ||
1572 | ;; | ||
1573 | [JsonStore] | ||
1574 | Enabled = False | ||
1575 | |||
1576 | ;; | ||
1564 | ;; These are defaults that are overwritten below in [Architecture]. | 1577 | ;; These are defaults that are overwritten below in [Architecture]. |
1565 | ;; These defaults allow OpenSim to work out of the box with | 1578 | ;; These defaults allow OpenSim to work out of the box with |
1566 | ;; zero configuration | 1579 | ;; zero configuration |
diff --git a/bin/PrimMesher.dll b/bin/PrimMesher.dll index 249e91c..87022b7 100755 --- a/bin/PrimMesher.dll +++ b/bin/PrimMesher.dll | |||
Binary files differ | |||
diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 2fd9f11..00e2fd7 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example | |||
@@ -275,10 +275,29 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 | |||
275 | ;AllowedClients = "" | 275 | ;AllowedClients = "" |
276 | ;DeniedClients = "" | 276 | ;DeniedClients = "" |
277 | 277 | ||
278 | ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time" | ||
279 | ;; Viewers do not receive timezone information from the server - almost all (?) default to Pacific Standard Time | ||
280 | ;; However, they do rely on the server to tell them whether it's Daylight Saving Time or not. | ||
281 | ;; Hence, calculating DST based on a different timezone can result in a misleading viewer display and inconsistencies between grids. | ||
282 | ;; By default, this setting uses various timezone names to calculate DST with regards to the viewer's standard PST. | ||
283 | ;; Options are | ||
284 | ;; "none" no DST | ||
285 | ;; "local" use the server's only timezone to calculate DST. This is previous OpenSimulator behaviour. | ||
286 | ;; "America/Los_Angeles;Pacific Standard Time" use these timezone names to look up Daylight savings. | ||
287 | ;; 'America/Los_Angeles' is used on Linux/Mac systems whilst 'Pacific Standard Time' is used on Windows | ||
288 | DSTZone = "America/Los_Angeles;Pacific Standard Time" | ||
289 | |||
278 | [MapImageService] | 290 | [MapImageService] |
279 | LocalServiceModule = "OpenSim.Services.MapImageService.dll:MapImageService" | 291 | LocalServiceModule = "OpenSim.Services.MapImageService.dll:MapImageService" |
280 | ; Set this if you want to change the default | 292 | ; Set this if you want to change the default |
281 | ; TilesStoragePath = "maptiles" | 293 | ; TilesStoragePath = "maptiles" |
294 | ; | ||
295 | ; If for some reason you have the AddMapTile service outside the firewall (e.g. 8002), | ||
296 | ; you may want to set this. Otherwise, don't set it, because it's already protected. | ||
297 | ; GridService = "OpenSim.Services.GridService.dll:GridService" | ||
298 | ; | ||
299 | ; Additionally, if you run this server behind a proxy, set this to true | ||
300 | ; HasProxy = false | ||
282 | 301 | ||
283 | [GridInfoService] | 302 | [GridInfoService] |
284 | ; These settings are used to return information on a get_grid_info call. | 303 | ; These settings are used to return information on a get_grid_info call. |
@@ -318,6 +337,14 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 | |||
318 | 337 | ||
319 | ; password help: optional: page providing password assistance for users of your grid | 338 | ; password help: optional: page providing password assistance for users of your grid |
320 | ;password = http://127.0.0.1/password | 339 | ;password = http://127.0.0.1/password |
340 | |||
341 | ; HG address of the gatekeeper, if you have one | ||
342 | ; this is the entry point for all the regions of the world | ||
343 | ; gatekeeper = http://127.0.0.1:8002/ | ||
344 | |||
345 | ; HG user domain, if you have one | ||
346 | ; this is the entry point for all user-related HG services | ||
347 | ; uas = http://127.0.0.1:8002/ | ||
321 | 348 | ||
322 | [GatekeeperService] | 349 | [GatekeeperService] |
323 | LocalServiceModule = "OpenSim.Services.HypergridService.dll:GatekeeperService" | 350 | LocalServiceModule = "OpenSim.Services.HypergridService.dll:GatekeeperService" |
diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 69e94a5..1c04ab5 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example | |||
@@ -250,10 +250,39 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 | |||
250 | ;AllowedClients = "" | 250 | ;AllowedClients = "" |
251 | ;DeniedClients = "" | 251 | ;DeniedClients = "" |
252 | 252 | ||
253 | ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time" | ||
254 | ;; Viewers do not listen to timezone sent by the server. They use Pacific Standard Time instead, | ||
255 | ;; but rely on the server to calculate Daylight Saving Time. Sending another DST than US Pacific | ||
256 | ;; would result in time inconsistencies between grids (during summer and around DST transition period) | ||
257 | ;; default let OpenSim calculate US Pacific DST | ||
258 | ;; "none" disable DST (equivallent to "local" with system set to GMT) | ||
259 | ;; "local" force legacy behaviour (using local system time to calculate DST) | ||
260 | ; DSTZone = "America/Los_Angeles;Pacific Standard Time" | ||
261 | |||
262 | ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time" | ||
263 | ;; Viewers do not receive timezone information from the server - almost all (?) default to Pacific Standard Time | ||
264 | ;; However, they do rely on the server to tell them whether it's Daylight Saving Time or not. | ||
265 | ;; Hence, calculating DST based on a different timezone can result in a misleading viewer display and inconsistencies between grids. | ||
266 | ;; By default, this setting uses various timezone names to calculate DST with regards to the viewer's standard PST. | ||
267 | ;; Options are | ||
268 | ;; "none" no DST | ||
269 | ;; "local" use the server's only timezone to calculate DST. This is previous OpenSimulator behaviour. | ||
270 | ;; "America/Los_Angeles;Pacific Standard Time" use these timezone names to look up Daylight savings. | ||
271 | ;; 'America/Los_Angeles' is used on Linux/Mac systems whilst 'Pacific Standard Time' is used on Windows | ||
272 | DSTZone = "America/Los_Angeles;Pacific Standard Time" | ||
273 | |||
253 | [MapImageService] | 274 | [MapImageService] |
254 | LocalServiceModule = "OpenSim.Services.MapImageService.dll:MapImageService" | 275 | LocalServiceModule = "OpenSim.Services.MapImageService.dll:MapImageService" |
255 | ; Set this if you want to change the default | 276 | ; Set this if you want to change the default |
256 | ; TilesStoragePath = "maptiles" | 277 | ; TilesStoragePath = "maptiles" |
278 | ; | ||
279 | ; If for some reason you have the AddMapTile service outside the firewall (e.g. 8002), | ||
280 | ; you may want to set this. Otherwise, don't set it, because it's already protected. | ||
281 | ; GridService = "OpenSim.Services.GridService.dll:GridService" | ||
282 | ; | ||
283 | ; Additionally, if you run this server behind a proxy, set this to true | ||
284 | ; HasProxy = false | ||
285 | |||
257 | 286 | ||
258 | 287 | ||
259 | [GridInfoService] | 288 | [GridInfoService] |
diff --git a/bin/config-include/FlotsamCache.ini.example b/bin/config-include/FlotsamCache.ini.example index cd39f8c..b9c6d84 100644 --- a/bin/config-include/FlotsamCache.ini.example +++ b/bin/config-include/FlotsamCache.ini.example | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | ; How often {in hours} should the disk be checked for expired filed | 37 | ; How often {in hours} should the disk be checked for expired filed |
38 | ; Specify 0 to disable expiration checking | 38 | ; Specify 0 to disable expiration checking |
39 | FileCleanupTimer = .166 ;roughly every 10 minutes | 39 | FileCleanupTimer = 1.0 ;every hour |
40 | 40 | ||
41 | ; If WAIT_ON_INPROGRESS_REQUESTS has been defined then this specifies how | 41 | ; If WAIT_ON_INPROGRESS_REQUESTS has been defined then this specifies how |
42 | ; long (in miliseconds) to block a request thread while trying to complete | 42 | ; long (in miliseconds) to block a request thread while trying to complete |
@@ -60,4 +60,4 @@ | |||
60 | ; cache, and request all assets that are found that are not already cached (this | 60 | ; cache, and request all assets that are found that are not already cached (this |
61 | ; will cause those assets to be cached) | 61 | ; will cause those assets to be cached) |
62 | ; | 62 | ; |
63 | ; DeepScanBeforePurge = false | 63 | DeepScanBeforePurge = true |
diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index fa6f525..8d7f6fc 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example | |||
@@ -137,6 +137,10 @@ | |||
137 | ;; uncomment the next line. You may want to do this on sims that have licensed content. | 137 | ;; uncomment the next line. You may want to do this on sims that have licensed content. |
138 | ; OutboundPermission = False | 138 | ; OutboundPermission = False |
139 | 139 | ||
140 | [HGFriendsModule] | ||
141 | ; User level required to be able to send friendship invitations to foreign users | ||
142 | ;LevelHGFriends = 0; | ||
143 | |||
140 | [UserAgentService] | 144 | [UserAgentService] |
141 | ; | 145 | ; |
142 | ; === HG ONLY === | 146 | ; === HG ONLY === |
diff --git a/bin/config-include/Standalone.ini b/bin/config-include/Standalone.ini index d307387..74d9d2e 100644 --- a/bin/config-include/Standalone.ini +++ b/bin/config-include/Standalone.ini | |||
@@ -95,6 +95,18 @@ | |||
95 | 95 | ||
96 | WelcomeMessage = "Welcome, Avatar!" | 96 | WelcomeMessage = "Welcome, Avatar!" |
97 | 97 | ||
98 | ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time" | ||
99 | ;; Viewers do not receive timezone information from the server - almost all (?) default to Pacific Standard Time | ||
100 | ;; However, they do rely on the server to tell them whether it's Daylight Saving Time or not. | ||
101 | ;; Hence, calculating DST based on a different timezone can result in a misleading viewer display and inconsistencies between grids. | ||
102 | ;; By default, this setting uses various timezone names to calculate DST with regards to the viewer's standard PST. | ||
103 | ;; Options are | ||
104 | ;; "none" no DST | ||
105 | ;; "local" use the server's only timezone to calculate DST. This is previous OpenSimulator behaviour. | ||
106 | ;; "America/Los_Angeles;Pacific Standard Time" use these timezone names to look up Daylight savings. | ||
107 | ;; 'America/Los_Angeles' is used on Linux/Mac systems whilst 'Pacific Standard Time' is used on Windows | ||
108 | DSTZone = "America/Los_Angeles;Pacific Standard Time" | ||
109 | |||
98 | [MapImageService] | 110 | [MapImageService] |
99 | LocalServiceModule = "OpenSim.Services.MapImageService.dll:MapImageService" | 111 | LocalServiceModule = "OpenSim.Services.MapImageService.dll:MapImageService" |
100 | ; in minutes | 112 | ; in minutes |
diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 8d9842c..e4bc548 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example | |||
@@ -61,6 +61,10 @@ | |||
61 | ;; uncomment the next line. You may want to do this on sims that have licensed content. | 61 | ;; uncomment the next line. You may want to do this on sims that have licensed content. |
62 | ; OutboundPermission = False | 62 | ; OutboundPermission = False |
63 | 63 | ||
64 | [HGFriendsModule] | ||
65 | ; User level required to be able to send friendship invitations to foreign users | ||
66 | ;LevelHGFriends = 0; | ||
67 | |||
64 | [GridService] | 68 | [GridService] |
65 | ;; For in-memory region storage (default) | 69 | ;; For in-memory region storage (default) |
66 | StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" | 70 | StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" |
@@ -231,6 +235,14 @@ | |||
231 | ; currently unused | 235 | ; currently unused |
232 | ;password = http://127.0.0.1/password | 236 | ;password = http://127.0.0.1/password |
233 | 237 | ||
238 | ; HG address of the gatekeeper, if you have one | ||
239 | ; this is the entry point for all the regions of the world | ||
240 | ; gatekeeper = http://127.0.0.1:9000/ | ||
241 | |||
242 | ; HG user domain, if you have one | ||
243 | ; this is the entry point for all user-related HG services | ||
244 | ; uas = http://127.0.0.1:9000/ | ||
245 | |||
234 | [MapImageService] | 246 | [MapImageService] |
235 | ; Set this if you want to change the default | 247 | ; Set this if you want to change the default |
236 | ; TilesStoragePath = "maptiles" | 248 | ; TilesStoragePath = "maptiles" |
diff --git a/prebuild.xml b/prebuild.xml index f9b26ef..c840f03 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | <!-- Core OpenSim Projects --> | 35 | <!-- Core OpenSim Projects --> |
36 | <!-- | 36 | <!-- |
37 | <Project frameworkVersion="v3_5" name="OpenSim.Model" path="OpenSim/Model" type="Library"> | 37 | <Project frameworkVersion="v4_0" name="OpenSim.Model" path="OpenSim/Model" type="Library"> |
38 | <Configuration name="Debug"> | 38 | <Configuration name="Debug"> |
39 | <Options> | 39 | <Options> |
40 | <OutputPath>../../../bin/</OutputPath> | 40 | <OutputPath>../../../bin/</OutputPath> |
@@ -55,7 +55,7 @@ | |||
55 | </Project> | 55 | </Project> |
56 | --> | 56 | --> |
57 | 57 | ||
58 | <Project frameworkVersion="v3_5" name="SmartThreadPool" path="ThirdParty/SmartThreadPool" type="Library"> | 58 | <Project frameworkVersion="v4_0" name="SmartThreadPool" path="ThirdParty/SmartThreadPool" type="Library"> |
59 | <Configuration name="Debug"> | 59 | <Configuration name="Debug"> |
60 | <Options> | 60 | <Options> |
61 | <OutputPath>../../bin/</OutputPath> | 61 | <OutputPath>../../bin/</OutputPath> |
@@ -77,7 +77,7 @@ | |||
77 | </Files> | 77 | </Files> |
78 | </Project> | 78 | </Project> |
79 | 79 | ||
80 | <Project frameworkVersion="v3_5" name="OpenSim.Framework" path="OpenSim/Framework" type="Library"> | 80 | <Project frameworkVersion="v4_0" name="OpenSim.Framework" path="OpenSim/Framework" type="Library"> |
81 | <Configuration name="Debug"> | 81 | <Configuration name="Debug"> |
82 | <Options> | 82 | <Options> |
83 | <OutputPath>../../bin/</OutputPath> | 83 | <OutputPath>../../bin/</OutputPath> |
@@ -112,7 +112,7 @@ | |||
112 | </Files> | 112 | </Files> |
113 | </Project> | 113 | </Project> |
114 | 114 | ||
115 | <Project frameworkVersion="v3_5" name="OpenSim.Framework.Servers.HttpServer" path="OpenSim/Framework/Servers/HttpServer" type="Library"> | 115 | <Project frameworkVersion="v4_0" name="OpenSim.Framework.Servers.HttpServer" path="OpenSim/Framework/Servers/HttpServer" type="Library"> |
116 | <Configuration name="Debug"> | 116 | <Configuration name="Debug"> |
117 | <Options> | 117 | <Options> |
118 | <OutputPath>../../../../bin/</OutputPath> | 118 | <OutputPath>../../../../bin/</OutputPath> |
@@ -150,7 +150,7 @@ | |||
150 | </Files> | 150 | </Files> |
151 | </Project> | 151 | </Project> |
152 | 152 | ||
153 | <Project frameworkVersion="v3_5" name="OpenSim.Framework.Console" path="OpenSim/Framework/Console" type="Library"> | 153 | <Project frameworkVersion="v4_0" name="OpenSim.Framework.Console" path="OpenSim/Framework/Console" type="Library"> |
154 | <Configuration name="Debug"> | 154 | <Configuration name="Debug"> |
155 | <Options> | 155 | <Options> |
156 | <OutputPath>../../../bin/</OutputPath> | 156 | <OutputPath>../../../bin/</OutputPath> |
@@ -177,7 +177,7 @@ | |||
177 | </Files> | 177 | </Files> |
178 | </Project> | 178 | </Project> |
179 | 179 | ||
180 | <Project frameworkVersion="v3_5" name="OpenSim.Services.Interfaces" path="OpenSim/Services/Interfaces" type="Library"> | 180 | <Project frameworkVersion="v4_0" name="OpenSim.Services.Interfaces" path="OpenSim/Services/Interfaces" type="Library"> |
181 | <Configuration name="Debug"> | 181 | <Configuration name="Debug"> |
182 | <Options> | 182 | <Options> |
183 | <OutputPath>../../../bin/</OutputPath> | 183 | <OutputPath>../../../bin/</OutputPath> |
@@ -205,7 +205,7 @@ | |||
205 | </Files> | 205 | </Files> |
206 | </Project> | 206 | </Project> |
207 | 207 | ||
208 | <Project frameworkVersion="v3_5" name="OpenSim.Framework.Serialization" path="OpenSim/Framework/Serialization" type="Library"> | 208 | <Project frameworkVersion="v4_0" name="OpenSim.Framework.Serialization" path="OpenSim/Framework/Serialization" type="Library"> |
209 | <Configuration name="Debug"> | 209 | <Configuration name="Debug"> |
210 | <Options> | 210 | <Options> |
211 | <OutputPath>../../../bin/</OutputPath> | 211 | <OutputPath>../../../bin/</OutputPath> |
@@ -234,7 +234,7 @@ | |||
234 | </Files> | 234 | </Files> |
235 | </Project> | 235 | </Project> |
236 | 236 | ||
237 | <Project frameworkVersion="v3_5" name="OpenSim.Framework.Statistics" path="OpenSim/Framework/Statistics" type="Library"> | 237 | <Project frameworkVersion="v4_0" name="OpenSim.Framework.Statistics" path="OpenSim/Framework/Statistics" type="Library"> |
238 | <Configuration name="Debug"> | 238 | <Configuration name="Debug"> |
239 | <Options> | 239 | <Options> |
240 | <OutputPath>../../../bin/</OutputPath> | 240 | <OutputPath>../../../bin/</OutputPath> |
@@ -258,7 +258,7 @@ | |||
258 | </Files> | 258 | </Files> |
259 | </Project> | 259 | </Project> |
260 | 260 | ||
261 | <Project frameworkVersion="v3_5" name="OpenSim.Data" path="OpenSim/Data" type="Library"> | 261 | <Project frameworkVersion="v4_0" name="OpenSim.Data" path="OpenSim/Data" type="Library"> |
262 | <Configuration name="Debug"> | 262 | <Configuration name="Debug"> |
263 | <Options> | 263 | <Options> |
264 | <OutputPath>../../bin/</OutputPath> | 264 | <OutputPath>../../bin/</OutputPath> |
@@ -287,7 +287,7 @@ | |||
287 | </Files> | 287 | </Files> |
288 | </Project> | 288 | </Project> |
289 | 289 | ||
290 | <Project frameworkVersion="v3_5" name="OpenSim.Framework.Configuration.XML" path="OpenSim/Framework/Configuration/XML" type="Library"> | 290 | <Project frameworkVersion="v4_0" name="OpenSim.Framework.Configuration.XML" path="OpenSim/Framework/Configuration/XML" type="Library"> |
291 | <Configuration name="Debug"> | 291 | <Configuration name="Debug"> |
292 | <Options> | 292 | <Options> |
293 | <OutputPath>../../../../bin/</OutputPath> | 293 | <OutputPath>../../../../bin/</OutputPath> |
@@ -312,7 +312,7 @@ | |||
312 | </Files> | 312 | </Files> |
313 | </Project> | 313 | </Project> |
314 | 314 | ||
315 | <Project frameworkVersion="v3_5" name="OpenSim.Framework.Configuration.HTTP" path="OpenSim/Framework/Configuration/HTTP" type="Library"> | 315 | <Project frameworkVersion="v4_0" name="OpenSim.Framework.Configuration.HTTP" path="OpenSim/Framework/Configuration/HTTP" type="Library"> |
316 | <Configuration name="Debug"> | 316 | <Configuration name="Debug"> |
317 | <Options> | 317 | <Options> |
318 | <OutputPath>../../../../bin/</OutputPath> | 318 | <OutputPath>../../../../bin/</OutputPath> |
@@ -339,7 +339,7 @@ | |||
339 | </Files> | 339 | </Files> |
340 | </Project> | 340 | </Project> |
341 | 341 | ||
342 | <Project frameworkVersion="v3_5" name="OpenSim.Framework.AssetLoader.Filesystem" path="OpenSim/Framework/AssetLoader/Filesystem" type="Library"> | 342 | <Project frameworkVersion="v4_0" name="OpenSim.Framework.AssetLoader.Filesystem" path="OpenSim/Framework/AssetLoader/Filesystem" type="Library"> |
343 | <Configuration name="Debug"> | 343 | <Configuration name="Debug"> |
344 | <Options> | 344 | <Options> |
345 | <OutputPath>../../../../bin/</OutputPath> | 345 | <OutputPath>../../../../bin/</OutputPath> |
@@ -364,7 +364,7 @@ | |||
364 | </Files> | 364 | </Files> |
365 | </Project> | 365 | </Project> |
366 | 366 | ||
367 | <Project frameworkVersion="v3_5" name="OpenSim.Framework.RegionLoader.Web" path="OpenSim/Framework/RegionLoader/Web" type="Library"> | 367 | <Project frameworkVersion="v4_0" name="OpenSim.Framework.RegionLoader.Web" path="OpenSim/Framework/RegionLoader/Web" type="Library"> |
368 | <Configuration name="Debug"> | 368 | <Configuration name="Debug"> |
369 | <Options> | 369 | <Options> |
370 | <OutputPath>../../../../bin/</OutputPath> | 370 | <OutputPath>../../../../bin/</OutputPath> |
@@ -390,7 +390,7 @@ | |||
390 | </Files> | 390 | </Files> |
391 | </Project> | 391 | </Project> |
392 | 392 | ||
393 | <Project frameworkVersion="v3_5" name="OpenSim.Framework.RegionLoader.Filesystem" path="OpenSim/Framework/RegionLoader/Filesystem" type="Library"> | 393 | <Project frameworkVersion="v4_0" name="OpenSim.Framework.RegionLoader.Filesystem" path="OpenSim/Framework/RegionLoader/Filesystem" type="Library"> |
394 | <Configuration name="Debug"> | 394 | <Configuration name="Debug"> |
395 | <Options> | 395 | <Options> |
396 | <OutputPath>../../../../bin/</OutputPath> | 396 | <OutputPath>../../../../bin/</OutputPath> |
@@ -416,7 +416,7 @@ | |||
416 | </Files> | 416 | </Files> |
417 | </Project> | 417 | </Project> |
418 | 418 | ||
419 | <Project frameworkVersion="v3_5" name="OpenSim.Framework.Servers" path="OpenSim/Framework/Servers" type="Library"> | 419 | <Project frameworkVersion="v4_0" name="OpenSim.Framework.Servers" path="OpenSim/Framework/Servers" type="Library"> |
420 | <Configuration name="Debug"> | 420 | <Configuration name="Debug"> |
421 | <Options> | 421 | <Options> |
422 | <OutputPath>../../../bin/</OutputPath> | 422 | <OutputPath>../../../bin/</OutputPath> |
@@ -448,7 +448,7 @@ | |||
448 | </Files> | 448 | </Files> |
449 | </Project> | 449 | </Project> |
450 | 450 | ||
451 | <Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.Manager" path="OpenSim/Region/Physics/Manager" type="Library"> | 451 | <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.Manager" path="OpenSim/Region/Physics/Manager" type="Library"> |
452 | <Configuration name="Debug"> | 452 | <Configuration name="Debug"> |
453 | <Options> | 453 | <Options> |
454 | <OutputPath>../../../../bin/</OutputPath> | 454 | <OutputPath>../../../../bin/</OutputPath> |
@@ -476,7 +476,7 @@ | |||
476 | </Project> | 476 | </Project> |
477 | 477 | ||
478 | <!-- Physics Plug-ins --> | 478 | <!-- Physics Plug-ins --> |
479 | <Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.BasicPhysicsPlugin" path="OpenSim/Region/Physics/BasicPhysicsPlugin" type="Library"> | 479 | <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.BasicPhysicsPlugin" path="OpenSim/Region/Physics/BasicPhysicsPlugin" type="Library"> |
480 | <Configuration name="Debug"> | 480 | <Configuration name="Debug"> |
481 | <Options> | 481 | <Options> |
482 | <OutputPath>../../../../bin/Physics/</OutputPath> | 482 | <OutputPath>../../../../bin/Physics/</OutputPath> |
@@ -499,7 +499,7 @@ | |||
499 | </Files> | 499 | </Files> |
500 | </Project> | 500 | </Project> |
501 | 501 | ||
502 | <Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.POSPlugin" path="OpenSim/Region/Physics/POSPlugin" type="Library"> | 502 | <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.POSPlugin" path="OpenSim/Region/Physics/POSPlugin" type="Library"> |
503 | <Configuration name="Debug"> | 503 | <Configuration name="Debug"> |
504 | <Options> | 504 | <Options> |
505 | <OutputPath>../../../../bin/Physics/</OutputPath> | 505 | <OutputPath>../../../../bin/Physics/</OutputPath> |
@@ -522,7 +522,7 @@ | |||
522 | </Files> | 522 | </Files> |
523 | </Project> | 523 | </Project> |
524 | 524 | ||
525 | <Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.OdePlugin" path="OpenSim/Region/Physics/OdePlugin" type="Library"> | 525 | <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.OdePlugin" path="OpenSim/Region/Physics/OdePlugin" type="Library"> |
526 | <Configuration name="Debug"> | 526 | <Configuration name="Debug"> |
527 | <Options> | 527 | <Options> |
528 | <OutputPath>../../../../bin/Physics/</OutputPath> | 528 | <OutputPath>../../../../bin/Physics/</OutputPath> |
@@ -552,7 +552,7 @@ | |||
552 | </Files> | 552 | </Files> |
553 | </Project> | 553 | </Project> |
554 | 554 | ||
555 | <Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.ConvexDecompositionDotNet" path="OpenSim/Region/Physics/ConvexDecompositionDotNet" type="Library"> | 555 | <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.ConvexDecompositionDotNet" path="OpenSim/Region/Physics/ConvexDecompositionDotNet" type="Library"> |
556 | <Configuration name="Debug"> | 556 | <Configuration name="Debug"> |
557 | <Options> | 557 | <Options> |
558 | <OutputPath>../../../../bin/</OutputPath> | 558 | <OutputPath>../../../../bin/</OutputPath> |
@@ -577,7 +577,7 @@ | |||
577 | </Files> | 577 | </Files> |
578 | </Project> | 578 | </Project> |
579 | 579 | ||
580 | <Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.ChOdePlugin" path="OpenSim/Region/Physics/ChOdePlugin" type="Library"> | 580 | <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.ChOdePlugin" path="OpenSim/Region/Physics/ChOdePlugin" type="Library"> |
581 | <Configuration name="Debug"> | 581 | <Configuration name="Debug"> |
582 | <Options> | 582 | <Options> |
583 | <OutputPath>../../../../bin/Physics/</OutputPath> | 583 | <OutputPath>../../../../bin/Physics/</OutputPath> |
@@ -608,7 +608,7 @@ | |||
608 | </Files> | 608 | </Files> |
609 | </Project> | 609 | </Project> |
610 | 610 | ||
611 | <Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.UbitOdePlugin" path="OpenSim/Region/Physics/UbitOdePlugin" type="Library"> | 611 | <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.UbitOdePlugin" path="OpenSim/Region/Physics/UbitOdePlugin" type="Library"> |
612 | <Configuration name="Debug"> | 612 | <Configuration name="Debug"> |
613 | <Options> | 613 | <Options> |
614 | <OutputPath>../../../../bin/Physics/</OutputPath> | 614 | <OutputPath>../../../../bin/Physics/</OutputPath> |
@@ -639,7 +639,7 @@ | |||
639 | </Files> | 639 | </Files> |
640 | </Project> | 640 | </Project> |
641 | 641 | ||
642 | <Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.BulletSPlugin" path="OpenSim/Region/Physics/BulletSPlugin" type="Library"> | 642 | <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.BulletSPlugin" path="OpenSim/Region/Physics/BulletSPlugin" type="Library"> |
643 | <Configuration name="Debug"> | 643 | <Configuration name="Debug"> |
644 | <Options> | 644 | <Options> |
645 | <OutputPath>../../../../bin/Physics/</OutputPath> | 645 | <OutputPath>../../../../bin/Physics/</OutputPath> |
@@ -672,7 +672,7 @@ | |||
672 | </Files> | 672 | </Files> |
673 | </Project> | 673 | </Project> |
674 | 674 | ||
675 | <Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.Meshing" path="OpenSim/Region/Physics/Meshing" type="Library"> | 675 | <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.Meshing" path="OpenSim/Region/Physics/Meshing" type="Library"> |
676 | <Configuration name="Debug"> | 676 | <Configuration name="Debug"> |
677 | <Options> | 677 | <Options> |
678 | <OutputPath>../../../../bin/Physics/</OutputPath> | 678 | <OutputPath>../../../../bin/Physics/</OutputPath> |
@@ -703,7 +703,7 @@ | |||
703 | </Files> | 703 | </Files> |
704 | </Project> | 704 | </Project> |
705 | 705 | ||
706 | <Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.UbitMeshing" path="OpenSim/Region/Physics/UbitMeshing" type="Library"> | 706 | <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.UbitMeshing" path="OpenSim/Region/Physics/UbitMeshing" type="Library"> |
707 | <Configuration name="Debug"> | 707 | <Configuration name="Debug"> |
708 | <Options> | 708 | <Options> |
709 | <OutputPath>../../../../bin/Physics/</OutputPath> | 709 | <OutputPath>../../../../bin/Physics/</OutputPath> |
@@ -735,7 +735,7 @@ | |||
735 | </Files> | 735 | </Files> |
736 | </Project> | 736 | </Project> |
737 | 737 | ||
738 | <Project frameworkVersion="v3_5" name="OpenSim.Capabilities" path="OpenSim/Capabilities" type="Library"> | 738 | <Project frameworkVersion="v4_0" name="OpenSim.Capabilities" path="OpenSim/Capabilities" type="Library"> |
739 | <Configuration name="Debug"> | 739 | <Configuration name="Debug"> |
740 | <Options> | 740 | <Options> |
741 | <OutputPath>../../bin/</OutputPath> | 741 | <OutputPath>../../bin/</OutputPath> |
@@ -770,7 +770,7 @@ | |||
770 | </Project> | 770 | </Project> |
771 | 771 | ||
772 | 772 | ||
773 | <Project frameworkVersion="v3_5" name="OpenSim.Framework.Communications" path="OpenSim/Framework/Communications" type="Library"> | 773 | <Project frameworkVersion="v4_0" name="OpenSim.Framework.Communications" path="OpenSim/Framework/Communications" type="Library"> |
774 | <Configuration name="Debug"> | 774 | <Configuration name="Debug"> |
775 | <Options> | 775 | <Options> |
776 | <OutputPath>../../../bin/</OutputPath> | 776 | <OutputPath>../../../bin/</OutputPath> |
@@ -811,7 +811,7 @@ | |||
811 | </Project> | 811 | </Project> |
812 | 812 | ||
813 | 813 | ||
814 | <Project frameworkVersion="v3_5" name="OpenSim.Region.Framework" path="OpenSim/Region/Framework" type="Library"> | 814 | <Project frameworkVersion="v4_0" name="OpenSim.Region.Framework" path="OpenSim/Region/Framework" type="Library"> |
815 | <Configuration name="Debug"> | 815 | <Configuration name="Debug"> |
816 | <Options> | 816 | <Options> |
817 | <OutputPath>../../../bin/</OutputPath> | 817 | <OutputPath>../../../bin/</OutputPath> |
@@ -864,7 +864,7 @@ | |||
864 | <!-- OGS projects --> | 864 | <!-- OGS projects --> |
865 | 865 | ||
866 | 866 | ||
867 | <Project frameworkVersion="v3_5" name="OpenSim.Server.Base" path="OpenSim/Server/Base" type="Library"> | 867 | <Project frameworkVersion="v4_0" name="OpenSim.Server.Base" path="OpenSim/Server/Base" type="Library"> |
868 | <Configuration name="Debug"> | 868 | <Configuration name="Debug"> |
869 | <Options> | 869 | <Options> |
870 | <OutputPath>../../../bin/</OutputPath> | 870 | <OutputPath>../../../bin/</OutputPath> |
@@ -894,7 +894,7 @@ | |||
894 | </Files> | 894 | </Files> |
895 | </Project> | 895 | </Project> |
896 | 896 | ||
897 | <Project frameworkVersion="v3_5" name="OpenSim.Services.Base" path="OpenSim/Services/Base" type="Library"> | 897 | <Project frameworkVersion="v4_0" name="OpenSim.Services.Base" path="OpenSim/Services/Base" type="Library"> |
898 | <Configuration name="Debug"> | 898 | <Configuration name="Debug"> |
899 | <Options> | 899 | <Options> |
900 | <OutputPath>../../../bin/</OutputPath> | 900 | <OutputPath>../../../bin/</OutputPath> |
@@ -921,7 +921,7 @@ | |||
921 | </Files> | 921 | </Files> |
922 | </Project> | 922 | </Project> |
923 | 923 | ||
924 | <Project frameworkVersion="v3_5" name="OpenSim.Services.UserAccountService" path="OpenSim/Services/UserAccountService" type="Library"> | 924 | <Project frameworkVersion="v4_0" name="OpenSim.Services.UserAccountService" path="OpenSim/Services/UserAccountService" type="Library"> |
925 | <Configuration name="Debug"> | 925 | <Configuration name="Debug"> |
926 | <Options> | 926 | <Options> |
927 | <OutputPath>../../../bin/</OutputPath> | 927 | <OutputPath>../../../bin/</OutputPath> |
@@ -952,7 +952,7 @@ | |||
952 | </Files> | 952 | </Files> |
953 | </Project> | 953 | </Project> |
954 | 954 | ||
955 | <Project frameworkVersion="v3_5" name="OpenSim.Services.FriendsService" path="OpenSim/Services/Friends" type="Library"> | 955 | <Project frameworkVersion="v4_0" name="OpenSim.Services.FriendsService" path="OpenSim/Services/Friends" type="Library"> |
956 | <Configuration name="Debug"> | 956 | <Configuration name="Debug"> |
957 | <Options> | 957 | <Options> |
958 | <OutputPath>../../../bin/</OutputPath> | 958 | <OutputPath>../../../bin/</OutputPath> |
@@ -983,7 +983,7 @@ | |||
983 | </Files> | 983 | </Files> |
984 | </Project> | 984 | </Project> |
985 | 985 | ||
986 | <Project frameworkVersion="v3_5" name="OpenSim.Services.Connectors" path="OpenSim/Services/Connectors" type="Library"> | 986 | <Project frameworkVersion="v4_0" name="OpenSim.Services.Connectors" path="OpenSim/Services/Connectors" type="Library"> |
987 | <Configuration name="Debug"> | 987 | <Configuration name="Debug"> |
988 | <Options> | 988 | <Options> |
989 | <OutputPath>../../../bin/</OutputPath> | 989 | <OutputPath>../../../bin/</OutputPath> |
@@ -1022,7 +1022,7 @@ | |||
1022 | </Files> | 1022 | </Files> |
1023 | </Project> | 1023 | </Project> |
1024 | 1024 | ||
1025 | <Project frameworkVersion="v3_5" name="OpenSim.Services.AssetService" path="OpenSim/Services/AssetService" type="Library"> | 1025 | <Project frameworkVersion="v4_0" name="OpenSim.Services.AssetService" path="OpenSim/Services/AssetService" type="Library"> |
1026 | <Configuration name="Debug"> | 1026 | <Configuration name="Debug"> |
1027 | <Options> | 1027 | <Options> |
1028 | <OutputPath>../../../bin/</OutputPath> | 1028 | <OutputPath>../../../bin/</OutputPath> |
@@ -1053,7 +1053,7 @@ | |||
1053 | </Files> | 1053 | </Files> |
1054 | </Project> | 1054 | </Project> |
1055 | 1055 | ||
1056 | <Project frameworkVersion="v3_5" name="OpenSim.Services.AuthorizationService" path="OpenSim/Services/AuthorizationService" type="Library"> | 1056 | <Project frameworkVersion="v4_0" name="OpenSim.Services.AuthorizationService" path="OpenSim/Services/AuthorizationService" type="Library"> |
1057 | <Configuration name="Debug"> | 1057 | <Configuration name="Debug"> |
1058 | <Options> | 1058 | <Options> |
1059 | <OutputPath>../../../bin/</OutputPath> | 1059 | <OutputPath>../../../bin/</OutputPath> |
@@ -1084,7 +1084,7 @@ | |||
1084 | </Files> | 1084 | </Files> |
1085 | </Project> | 1085 | </Project> |
1086 | 1086 | ||
1087 | <Project frameworkVersion="v3_5" name="OpenSim.Services.FreeswitchService" path="OpenSim/Services/FreeswitchService" type="Library"> | 1087 | <Project frameworkVersion="v4_0" name="OpenSim.Services.FreeswitchService" path="OpenSim/Services/FreeswitchService" type="Library"> |
1088 | <Configuration name="Debug"> | 1088 | <Configuration name="Debug"> |
1089 | <Options> | 1089 | <Options> |
1090 | <OutputPath>../../../bin/</OutputPath> | 1090 | <OutputPath>../../../bin/</OutputPath> |
@@ -1116,7 +1116,7 @@ | |||
1116 | </Files> | 1116 | </Files> |
1117 | </Project> | 1117 | </Project> |
1118 | 1118 | ||
1119 | <Project frameworkVersion="v3_5" name="OpenSim.Services.AuthenticationService" path="OpenSim/Services/AuthenticationService" type="Library"> | 1119 | <Project frameworkVersion="v4_0" name="OpenSim.Services.AuthenticationService" path="OpenSim/Services/AuthenticationService" type="Library"> |
1120 | <Configuration name="Debug"> | 1120 | <Configuration name="Debug"> |
1121 | <Options> | 1121 | <Options> |
1122 | <OutputPath>../../../bin/</OutputPath> | 1122 | <OutputPath>../../../bin/</OutputPath> |
@@ -1149,7 +1149,7 @@ | |||
1149 | </Files> | 1149 | </Files> |
1150 | </Project> | 1150 | </Project> |
1151 | 1151 | ||
1152 | <Project frameworkVersion="v3_5" name="OpenSim.Services.GridService" path="OpenSim/Services/GridService" type="Library"> | 1152 | <Project frameworkVersion="v4_0" name="OpenSim.Services.GridService" path="OpenSim/Services/GridService" type="Library"> |
1153 | <Configuration name="Debug"> | 1153 | <Configuration name="Debug"> |
1154 | <Options> | 1154 | <Options> |
1155 | <OutputPath>../../../bin/</OutputPath> | 1155 | <OutputPath>../../../bin/</OutputPath> |
@@ -1183,7 +1183,7 @@ | |||
1183 | </Files> | 1183 | </Files> |
1184 | </Project> | 1184 | </Project> |
1185 | 1185 | ||
1186 | <Project frameworkVersion="v3_5" name="OpenSim.Services.PresenceService" path="OpenSim/Services/PresenceService" type="Library"> | 1186 | <Project frameworkVersion="v4_0" name="OpenSim.Services.PresenceService" path="OpenSim/Services/PresenceService" type="Library"> |
1187 | <Configuration name="Debug"> | 1187 | <Configuration name="Debug"> |
1188 | <Options> | 1188 | <Options> |
1189 | <OutputPath>../../../bin/</OutputPath> | 1189 | <OutputPath>../../../bin/</OutputPath> |
@@ -1214,7 +1214,7 @@ | |||
1214 | </Files> | 1214 | </Files> |
1215 | </Project> | 1215 | </Project> |
1216 | 1216 | ||
1217 | <Project frameworkVersion="v3_5" name="OpenSim.Services.AvatarService" path="OpenSim/Services/AvatarService" type="Library"> | 1217 | <Project frameworkVersion="v4_0" name="OpenSim.Services.AvatarService" path="OpenSim/Services/AvatarService" type="Library"> |
1218 | <Configuration name="Debug"> | 1218 | <Configuration name="Debug"> |
1219 | <Options> | 1219 | <Options> |
1220 | <OutputPath>../../../bin/</OutputPath> | 1220 | <OutputPath>../../../bin/</OutputPath> |
@@ -1245,7 +1245,7 @@ | |||
1245 | </Files> | 1245 | </Files> |
1246 | </Project> | 1246 | </Project> |
1247 | 1247 | ||
1248 | <Project frameworkVersion="v3_5" name="OpenSim.Services.InventoryService" path="OpenSim/Services/InventoryService" type="Library"> | 1248 | <Project frameworkVersion="v4_0" name="OpenSim.Services.InventoryService" path="OpenSim/Services/InventoryService" type="Library"> |
1249 | <Configuration name="Debug"> | 1249 | <Configuration name="Debug"> |
1250 | <Options> | 1250 | <Options> |
1251 | <OutputPath>../../../bin/</OutputPath> | 1251 | <OutputPath>../../../bin/</OutputPath> |
@@ -1278,7 +1278,7 @@ | |||
1278 | </Project> | 1278 | </Project> |
1279 | 1279 | ||
1280 | 1280 | ||
1281 | <Project frameworkVersion="v3_5" name="OpenSim.Services.LLLoginService" path="OpenSim/Services/LLLoginService" type="Library"> | 1281 | <Project frameworkVersion="v4_0" name="OpenSim.Services.LLLoginService" path="OpenSim/Services/LLLoginService" type="Library"> |
1282 | <Configuration name="Debug"> | 1282 | <Configuration name="Debug"> |
1283 | <Options> | 1283 | <Options> |
1284 | <OutputPath>../../../bin/</OutputPath> | 1284 | <OutputPath>../../../bin/</OutputPath> |
@@ -1311,7 +1311,7 @@ | |||
1311 | </Files> | 1311 | </Files> |
1312 | </Project> | 1312 | </Project> |
1313 | 1313 | ||
1314 | <Project frameworkVersion="v3_5" name="OpenSim.Services.HypergridService" path="OpenSim/Services/HypergridService" type="Library"> | 1314 | <Project frameworkVersion="v4_0" name="OpenSim.Services.HypergridService" path="OpenSim/Services/HypergridService" type="Library"> |
1315 | <Configuration name="Debug"> | 1315 | <Configuration name="Debug"> |
1316 | <Options> | 1316 | <Options> |
1317 | <OutputPath>../../../bin/</OutputPath> | 1317 | <OutputPath>../../../bin/</OutputPath> |
@@ -1349,7 +1349,7 @@ | |||
1349 | </Files> | 1349 | </Files> |
1350 | </Project> | 1350 | </Project> |
1351 | 1351 | ||
1352 | <Project frameworkVersion="v3_5" name="OpenSim.Services.MapImageService" path="OpenSim/Services/MapImageService" type="Library"> | 1352 | <Project frameworkVersion="v4_0" name="OpenSim.Services.MapImageService" path="OpenSim/Services/MapImageService" type="Library"> |
1353 | <Configuration name="Debug"> | 1353 | <Configuration name="Debug"> |
1354 | <Options> | 1354 | <Options> |
1355 | <OutputPath>../../../bin/</OutputPath> | 1355 | <OutputPath>../../../bin/</OutputPath> |
@@ -1379,7 +1379,7 @@ | |||
1379 | </Files> | 1379 | </Files> |
1380 | </Project> | 1380 | </Project> |
1381 | 1381 | ||
1382 | <Project frameworkVersion="v3_5" name="OpenSim.Server.Handlers" path="OpenSim/Server/Handlers" type="Library"> | 1382 | <Project frameworkVersion="v4_0" name="OpenSim.Server.Handlers" path="OpenSim/Server/Handlers" type="Library"> |
1383 | <Configuration name="Debug"> | 1383 | <Configuration name="Debug"> |
1384 | <Options> | 1384 | <Options> |
1385 | <OutputPath>../../../bin/</OutputPath> | 1385 | <OutputPath>../../../bin/</OutputPath> |
@@ -1418,7 +1418,7 @@ | |||
1418 | </Project> | 1418 | </Project> |
1419 | 1419 | ||
1420 | 1420 | ||
1421 | <Project frameworkVersion="v3_5" name="OpenSim.Capabilities.Handlers" path="OpenSim/Capabilities/Handlers" type="Library"> | 1421 | <Project frameworkVersion="v4_0" name="OpenSim.Capabilities.Handlers" path="OpenSim/Capabilities/Handlers" type="Library"> |
1422 | <Configuration name="Debug"> | 1422 | <Configuration name="Debug"> |
1423 | <Options> | 1423 | <Options> |
1424 | <OutputPath>../../../bin/</OutputPath> | 1424 | <OutputPath>../../../bin/</OutputPath> |
@@ -1459,7 +1459,7 @@ | |||
1459 | </Project> | 1459 | </Project> |
1460 | 1460 | ||
1461 | 1461 | ||
1462 | <Project frameworkVersion="v3_5" name="Robust" path="OpenSim/Server" type="Exe"> | 1462 | <Project frameworkVersion="v4_0" name="Robust" path="OpenSim/Server" type="Exe"> |
1463 | <Configuration name="Debug"> | 1463 | <Configuration name="Debug"> |
1464 | <Options> | 1464 | <Options> |
1465 | <OutputPath>../../bin/</OutputPath> | 1465 | <OutputPath>../../bin/</OutputPath> |
@@ -1492,7 +1492,7 @@ | |||
1492 | </Files> | 1492 | </Files> |
1493 | </Project> | 1493 | </Project> |
1494 | 1494 | ||
1495 | <Project frameworkVersion="v3_5" name="OpenSim.ConsoleClient" path="OpenSim/ConsoleClient" type="Exe"> | 1495 | <Project frameworkVersion="v4_0" name="OpenSim.ConsoleClient" path="OpenSim/ConsoleClient" type="Exe"> |
1496 | <Configuration name="Debug"> | 1496 | <Configuration name="Debug"> |
1497 | <Options> | 1497 | <Options> |
1498 | <OutputPath>../../bin/</OutputPath> | 1498 | <OutputPath>../../bin/</OutputPath> |
@@ -1524,7 +1524,7 @@ | |||
1524 | </Files> | 1524 | </Files> |
1525 | </Project> | 1525 | </Project> |
1526 | 1526 | ||
1527 | <Project frameworkVersion="v3_5" name="OpenSim.Region.CoreModules" path="OpenSim/Region/CoreModules" type="Library"> | 1527 | <Project frameworkVersion="v4_0" name="OpenSim.Region.CoreModules" path="OpenSim/Region/CoreModules" type="Library"> |
1528 | <Configuration name="Debug"> | 1528 | <Configuration name="Debug"> |
1529 | <Options> | 1529 | <Options> |
1530 | <OutputPath>../../../bin/</OutputPath> | 1530 | <OutputPath>../../../bin/</OutputPath> |
@@ -1567,6 +1567,7 @@ | |||
1567 | <Reference name="OpenSim.Services.Connectors"/> | 1567 | <Reference name="OpenSim.Services.Connectors"/> |
1568 | <Reference name="OpenSim.Services.Base"/> | 1568 | <Reference name="OpenSim.Services.Base"/> |
1569 | <Reference name="OpenSim.Services.Interfaces"/> | 1569 | <Reference name="OpenSim.Services.Interfaces"/> |
1570 | <Reference name="Ionic.Zip" path="../../../bin/"/> | ||
1570 | 1571 | ||
1571 | <Reference name="GlynnTucker.Cache" path="../../../bin/"/> | 1572 | <Reference name="GlynnTucker.Cache" path="../../../bin/"/> |
1572 | 1573 | ||
@@ -1589,7 +1590,7 @@ | |||
1589 | </Files> | 1590 | </Files> |
1590 | </Project> | 1591 | </Project> |
1591 | 1592 | ||
1592 | <Project frameworkVersion="v3_5" name="OpenSim.Region.RegionCombinerModule" path="OpenSim/Region/RegionCombinerModule" type="Library"> | 1593 | <Project frameworkVersion="v4_0" name="OpenSim.Region.RegionCombinerModule" path="OpenSim/Region/RegionCombinerModule" type="Library"> |
1593 | <Configuration name="Debug"> | 1594 | <Configuration name="Debug"> |
1594 | <Options> | 1595 | <Options> |
1595 | <OutputPath>../../../bin/</OutputPath> | 1596 | <OutputPath>../../../bin/</OutputPath> |
@@ -1627,7 +1628,7 @@ | |||
1627 | </Files> | 1628 | </Files> |
1628 | </Project> | 1629 | </Project> |
1629 | 1630 | ||
1630 | <Project frameworkVersion="v3_5" name="OpenSim.Region.ClientStack" path="OpenSim/Region/ClientStack" type="Library"> | 1631 | <Project frameworkVersion="v4_0" name="OpenSim.Region.ClientStack" path="OpenSim/Region/ClientStack" type="Library"> |
1631 | <Configuration name="Debug"> | 1632 | <Configuration name="Debug"> |
1632 | <Options> | 1633 | <Options> |
1633 | <OutputPath>../../../bin/</OutputPath> | 1634 | <OutputPath>../../../bin/</OutputPath> |
@@ -1662,7 +1663,7 @@ | |||
1662 | </Project> | 1663 | </Project> |
1663 | 1664 | ||
1664 | <!-- ClientStack Plugins --> | 1665 | <!-- ClientStack Plugins --> |
1665 | <Project frameworkVersion="v3_5" name="OpenSim.Region.ClientStack.LindenUDP" path="OpenSim/Region/ClientStack/Linden/UDP" type="Library"> | 1666 | <Project frameworkVersion="v4_0" name="OpenSim.Region.ClientStack.LindenUDP" path="OpenSim/Region/ClientStack/Linden/UDP" type="Library"> |
1666 | <Configuration name="Debug"> | 1667 | <Configuration name="Debug"> |
1667 | <Options> | 1668 | <Options> |
1668 | <OutputPath>../../../../../bin/</OutputPath> | 1669 | <OutputPath>../../../../../bin/</OutputPath> |
@@ -1705,7 +1706,7 @@ | |||
1705 | </Files> | 1706 | </Files> |
1706 | </Project> | 1707 | </Project> |
1707 | 1708 | ||
1708 | <Project frameworkVersion="v3_5" name="OpenSim.Region.ClientStack.LindenCaps" path="OpenSim/Region/ClientStack/Linden/Caps" type="Library"> | 1709 | <Project frameworkVersion="v4_0" name="OpenSim.Region.ClientStack.LindenCaps" path="OpenSim/Region/ClientStack/Linden/Caps" type="Library"> |
1709 | <Configuration name="Debug"> | 1710 | <Configuration name="Debug"> |
1710 | <Options> | 1711 | <Options> |
1711 | <OutputPath>../../../../../bin/</OutputPath> | 1712 | <OutputPath>../../../../../bin/</OutputPath> |
@@ -1747,7 +1748,7 @@ | |||
1747 | </Files> | 1748 | </Files> |
1748 | </Project> | 1749 | </Project> |
1749 | 1750 | ||
1750 | <Project frameworkVersion="v3_5" name="OpenSim.Region.OptionalModules" path="OpenSim/Region/OptionalModules" type="Library"> | 1751 | <Project frameworkVersion="v4_0" name="OpenSim.Region.OptionalModules" path="OpenSim/Region/OptionalModules" type="Library"> |
1751 | <Configuration name="Debug"> | 1752 | <Configuration name="Debug"> |
1752 | <Options> | 1753 | <Options> |
1753 | <OutputPath>../../../bin/</OutputPath> | 1754 | <OutputPath>../../../bin/</OutputPath> |
@@ -1804,7 +1805,7 @@ | |||
1804 | </Project> | 1805 | </Project> |
1805 | 1806 | ||
1806 | <!-- Datastore Plugins --> | 1807 | <!-- Datastore Plugins --> |
1807 | <Project frameworkVersion="v3_5" name="OpenSim.Data.Null" path="OpenSim/Data/Null" type="Library"> | 1808 | <Project frameworkVersion="v4_0" name="OpenSim.Data.Null" path="OpenSim/Data/Null" type="Library"> |
1808 | <Configuration name="Debug"> | 1809 | <Configuration name="Debug"> |
1809 | <Options> | 1810 | <Options> |
1810 | <OutputPath>../../../bin/</OutputPath> | 1811 | <OutputPath>../../../bin/</OutputPath> |
@@ -1832,7 +1833,7 @@ | |||
1832 | </Project> | 1833 | </Project> |
1833 | 1834 | ||
1834 | <!-- OpenSim app --> | 1835 | <!-- OpenSim app --> |
1835 | <Project frameworkVersion="v3_5" name="OpenSim" path="OpenSim/Region/Application" type="Exe"> | 1836 | <Project frameworkVersion="v4_0" name="OpenSim" path="OpenSim/Region/Application" type="Exe"> |
1836 | <Configuration name="Debug"> | 1837 | <Configuration name="Debug"> |
1837 | <Options> | 1838 | <Options> |
1838 | <OutputPath>../../../bin/</OutputPath> | 1839 | <OutputPath>../../../bin/</OutputPath> |
@@ -1876,7 +1877,7 @@ | |||
1876 | </Files> | 1877 | </Files> |
1877 | </Project> | 1878 | </Project> |
1878 | 1879 | ||
1879 | <Project frameworkVersion="v3_5" name="OpenSim.ApplicationPlugins.LoadRegions" path="OpenSim/ApplicationPlugins/LoadRegions" type="Library"> | 1880 | <Project frameworkVersion="v4_0" name="OpenSim.ApplicationPlugins.LoadRegions" path="OpenSim/ApplicationPlugins/LoadRegions" type="Library"> |
1880 | <Configuration name="Debug"> | 1881 | <Configuration name="Debug"> |
1881 | <Options> | 1882 | <Options> |
1882 | <OutputPath>../../../bin/</OutputPath> | 1883 | <OutputPath>../../../bin/</OutputPath> |
@@ -1911,7 +1912,7 @@ | |||
1911 | </Files> | 1912 | </Files> |
1912 | </Project> | 1913 | </Project> |
1913 | 1914 | ||
1914 | <Project frameworkVersion="v3_5" name="OpenSim.ApplicationPlugins.RegionModulesController" path="OpenSim/ApplicationPlugins/RegionModulesController" type="Library"> | 1915 | <Project frameworkVersion="v4_0" name="OpenSim.ApplicationPlugins.RegionModulesController" path="OpenSim/ApplicationPlugins/RegionModulesController" type="Library"> |
1915 | <Configuration name="Debug"> | 1916 | <Configuration name="Debug"> |
1916 | <Options> | 1917 | <Options> |
1917 | <OutputPath>../../../bin/</OutputPath> | 1918 | <OutputPath>../../../bin/</OutputPath> |
@@ -1941,7 +1942,7 @@ | |||
1941 | </Files> | 1942 | </Files> |
1942 | </Project> | 1943 | </Project> |
1943 | 1944 | ||
1944 | <Project frameworkVersion="v3_5" name="OpenSim.ApplicationPlugins.RemoteController" path="OpenSim/ApplicationPlugins/RemoteController" type="Library"> | 1945 | <Project frameworkVersion="v4_0" name="OpenSim.ApplicationPlugins.RemoteController" path="OpenSim/ApplicationPlugins/RemoteController" type="Library"> |
1945 | <Configuration name="Debug"> | 1946 | <Configuration name="Debug"> |
1946 | <Options> | 1947 | <Options> |
1947 | <OutputPath>../../../bin/</OutputPath> | 1948 | <OutputPath>../../../bin/</OutputPath> |
@@ -1982,7 +1983,7 @@ | |||
1982 | </Project> | 1983 | </Project> |
1983 | 1984 | ||
1984 | <!-- REST plugins --> | 1985 | <!-- REST plugins --> |
1985 | <Project frameworkVersion="v3_5" name="OpenSim.ApplicationPlugins.Rest" path="OpenSim/ApplicationPlugins/Rest" type="Library"> | 1986 | <Project frameworkVersion="v4_0" name="OpenSim.ApplicationPlugins.Rest" path="OpenSim/ApplicationPlugins/Rest" type="Library"> |
1986 | <Configuration name="Debug"> | 1987 | <Configuration name="Debug"> |
1987 | <Options> | 1988 | <Options> |
1988 | <OutputPath>../../../bin/</OutputPath> | 1989 | <OutputPath>../../../bin/</OutputPath> |
@@ -2017,7 +2018,7 @@ | |||
2017 | </Files> | 2018 | </Files> |
2018 | </Project> | 2019 | </Project> |
2019 | 2020 | ||
2020 | <Project frameworkVersion="v3_5" name="OpenSim.ApplicationPlugins.Rest.Regions" path="OpenSim/ApplicationPlugins/Rest/Regions" type="Library"> | 2021 | <Project frameworkVersion="v4_0" name="OpenSim.ApplicationPlugins.Rest.Regions" path="OpenSim/ApplicationPlugins/Rest/Regions" type="Library"> |
2021 | <Configuration name="Debug"> | 2022 | <Configuration name="Debug"> |
2022 | <Options> | 2023 | <Options> |
2023 | <OutputPath>../../../../bin/</OutputPath> | 2024 | <OutputPath>../../../../bin/</OutputPath> |
@@ -2054,7 +2055,7 @@ | |||
2054 | </Files> | 2055 | </Files> |
2055 | </Project> | 2056 | </Project> |
2056 | 2057 | ||
2057 | <Project frameworkVersion="v3_5" name="OpenSim.ApplicationPlugins.Rest.Inventory" path="OpenSim/ApplicationPlugins/Rest/Inventory" type="Library"> | 2058 | <Project frameworkVersion="v4_0" name="OpenSim.ApplicationPlugins.Rest.Inventory" path="OpenSim/ApplicationPlugins/Rest/Inventory" type="Library"> |
2058 | <Configuration name="Debug"> | 2059 | <Configuration name="Debug"> |
2059 | <Options> | 2060 | <Options> |
2060 | <OutputPath>../../../../bin/</OutputPath> | 2061 | <OutputPath>../../../../bin/</OutputPath> |
@@ -2098,7 +2099,7 @@ | |||
2098 | 2099 | ||
2099 | <!-- Scene Server API Example Apps --> | 2100 | <!-- Scene Server API Example Apps --> |
2100 | 2101 | ||
2101 | <Project frameworkVersion="v3_5" name="OpenSim.Region.DataSnapshot" path="OpenSim/Region/DataSnapshot" type="Library"> | 2102 | <Project frameworkVersion="v4_0" name="OpenSim.Region.DataSnapshot" path="OpenSim/Region/DataSnapshot" type="Library"> |
2102 | <Configuration name="Debug"> | 2103 | <Configuration name="Debug"> |
2103 | <Options> | 2104 | <Options> |
2104 | <OutputPath>../../../bin/</OutputPath> | 2105 | <OutputPath>../../../bin/</OutputPath> |
@@ -2135,7 +2136,7 @@ | |||
2135 | </Project> | 2136 | </Project> |
2136 | 2137 | ||
2137 | <!-- Data Base Modules --> | 2138 | <!-- Data Base Modules --> |
2138 | <Project frameworkVersion="v3_5" name="OpenSim.Data.MySQL" path="OpenSim/Data/MySQL" type="Library"> | 2139 | <Project frameworkVersion="v4_0" name="OpenSim.Data.MySQL" path="OpenSim/Data/MySQL" type="Library"> |
2139 | <Configuration name="Debug"> | 2140 | <Configuration name="Debug"> |
2140 | <Options> | 2141 | <Options> |
2141 | <OutputPath>../../../bin/</OutputPath> | 2142 | <OutputPath>../../../bin/</OutputPath> |
@@ -2173,7 +2174,7 @@ | |||
2173 | </Files> | 2174 | </Files> |
2174 | </Project> | 2175 | </Project> |
2175 | 2176 | ||
2176 | <Project frameworkVersion="v3_5" name="OpenSim.Data.MSSQL" path="OpenSim/Data/MSSQL" type="Library"> | 2177 | <Project frameworkVersion="v4_0" name="OpenSim.Data.MSSQL" path="OpenSim/Data/MSSQL" type="Library"> |
2177 | <Configuration name="Debug"> | 2178 | <Configuration name="Debug"> |
2178 | <Options> | 2179 | <Options> |
2179 | <OutputPath>../../../bin/</OutputPath> | 2180 | <OutputPath>../../../bin/</OutputPath> |
@@ -2207,7 +2208,7 @@ | |||
2207 | </Files> | 2208 | </Files> |
2208 | </Project> | 2209 | </Project> |
2209 | 2210 | ||
2210 | <Project frameworkVersion="v3_5" name="OpenSim.Data.SQLite" path="OpenSim/Data/SQLite" type="Library"> | 2211 | <Project frameworkVersion="v4_0" name="OpenSim.Data.SQLite" path="OpenSim/Data/SQLite" type="Library"> |
2211 | <Configuration name="Debug"> | 2212 | <Configuration name="Debug"> |
2212 | <Options> | 2213 | <Options> |
2213 | <OutputPath>../../../bin/</OutputPath> | 2214 | <OutputPath>../../../bin/</OutputPath> |
@@ -2248,7 +2249,7 @@ | |||
2248 | </Project> | 2249 | </Project> |
2249 | 2250 | ||
2250 | 2251 | ||
2251 | <Project frameworkVersion="v3_5" name="OpenSim.Region.ScriptEngine.Shared" path="OpenSim/Region/ScriptEngine/Shared" type="Library"> | 2252 | <Project frameworkVersion="v4_0" name="OpenSim.Region.ScriptEngine.Shared" path="OpenSim/Region/ScriptEngine/Shared" type="Library"> |
2252 | <Configuration name="Debug"> | 2253 | <Configuration name="Debug"> |
2253 | <Options> | 2254 | <Options> |
2254 | <OutputPath>../../../../bin/</OutputPath> | 2255 | <OutputPath>../../../../bin/</OutputPath> |
@@ -2286,7 +2287,7 @@ | |||
2286 | </Files> | 2287 | </Files> |
2287 | </Project> | 2288 | </Project> |
2288 | 2289 | ||
2289 | <Project frameworkVersion="v3_5" name="OpenSim.Region.ScriptEngine.Shared.Api.Runtime" path="OpenSim/Region/ScriptEngine/Shared/Api/Runtime" type="Library"> | 2290 | <Project frameworkVersion="v4_0" name="OpenSim.Region.ScriptEngine.Shared.Api.Runtime" path="OpenSim/Region/ScriptEngine/Shared/Api/Runtime" type="Library"> |
2290 | <Configuration name="Debug"> | 2291 | <Configuration name="Debug"> |
2291 | <Options> | 2292 | <Options> |
2292 | <OutputPath>../../../../../../bin/</OutputPath> | 2293 | <OutputPath>../../../../../../bin/</OutputPath> |
@@ -2319,7 +2320,7 @@ | |||
2319 | </Files> | 2320 | </Files> |
2320 | </Project> | 2321 | </Project> |
2321 | 2322 | ||
2322 | <Project frameworkVersion="v3_5" name="OpenSim.Region.ScriptEngine.Shared.YieldProlog" path="OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/" type="Library"> | 2323 | <Project frameworkVersion="v4_0" name="OpenSim.Region.ScriptEngine.Shared.YieldProlog" path="OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/" type="Library"> |
2323 | <Configuration name="Debug"> | 2324 | <Configuration name="Debug"> |
2324 | <Options> | 2325 | <Options> |
2325 | <OutputPath>../../../../../../../bin/</OutputPath> | 2326 | <OutputPath>../../../../../../../bin/</OutputPath> |
@@ -2351,7 +2352,7 @@ | |||
2351 | </Files> | 2352 | </Files> |
2352 | </Project> | 2353 | </Project> |
2353 | 2354 | ||
2354 | <Project frameworkVersion="v3_5" name="OpenSim.Region.ScriptEngine.Shared.Api" path="OpenSim/Region/ScriptEngine/Shared/Api/Implementation" type="Library"> | 2355 | <Project frameworkVersion="v4_0" name="OpenSim.Region.ScriptEngine.Shared.Api" path="OpenSim/Region/ScriptEngine/Shared/Api/Implementation" type="Library"> |
2355 | <Configuration name="Debug"> | 2356 | <Configuration name="Debug"> |
2356 | <Options> | 2357 | <Options> |
2357 | <OutputPath>../../../../../../bin/</OutputPath> | 2358 | <OutputPath>../../../../../../bin/</OutputPath> |
@@ -2390,7 +2391,7 @@ | |||
2390 | </Files> | 2391 | </Files> |
2391 | </Project> | 2392 | </Project> |
2392 | 2393 | ||
2393 | <Project frameworkVersion="v3_5" name="OpenSim.Region.ScriptEngine.Shared.CodeTools" path="OpenSim/Region/ScriptEngine/Shared/CodeTools" type="Library"> | 2394 | <Project frameworkVersion="v4_0" name="OpenSim.Region.ScriptEngine.Shared.CodeTools" path="OpenSim/Region/ScriptEngine/Shared/CodeTools" type="Library"> |
2394 | <Configuration name="Debug"> | 2395 | <Configuration name="Debug"> |
2395 | <Options> | 2396 | <Options> |
2396 | <OutputPath>../../../../../bin/</OutputPath> | 2397 | <OutputPath>../../../../../bin/</OutputPath> |
@@ -2421,7 +2422,7 @@ | |||
2421 | </Files> | 2422 | </Files> |
2422 | </Project> | 2423 | </Project> |
2423 | 2424 | ||
2424 | <Project frameworkVersion="v3_5" name="OpenSim.Region.ScriptEngine.Shared.Instance" path="OpenSim/Region/ScriptEngine/Shared/Instance" type="Library"> | 2425 | <Project frameworkVersion="v4_0" name="OpenSim.Region.ScriptEngine.Shared.Instance" path="OpenSim/Region/ScriptEngine/Shared/Instance" type="Library"> |
2425 | <Configuration name="Debug"> | 2426 | <Configuration name="Debug"> |
2426 | <Options> | 2427 | <Options> |
2427 | <OutputPath>../../../../../bin/</OutputPath> | 2428 | <OutputPath>../../../../../bin/</OutputPath> |
@@ -2459,7 +2460,7 @@ | |||
2459 | </Files> | 2460 | </Files> |
2460 | </Project> | 2461 | </Project> |
2461 | 2462 | ||
2462 | <Project frameworkVersion="v3_5" name="OpenSim.Region.ScriptEngine.XEngine" path="OpenSim/Region/ScriptEngine/XEngine" type="Library"> | 2463 | <Project frameworkVersion="v4_0" name="OpenSim.Region.ScriptEngine.XEngine" path="OpenSim/Region/ScriptEngine/XEngine" type="Library"> |
2463 | <Configuration name="Debug"> | 2464 | <Configuration name="Debug"> |
2464 | <Options> | 2465 | <Options> |
2465 | <OutputPath>../../../../bin/</OutputPath> | 2466 | <OutputPath>../../../../bin/</OutputPath> |
@@ -2502,7 +2503,7 @@ | |||
2502 | </Project> | 2503 | </Project> |
2503 | 2504 | ||
2504 | 2505 | ||
2505 | <Project frameworkVersion="v3_5" name="OpenSim.Region.UserStatistics" path="OpenSim/Region/UserStatistics" type="Library"> | 2506 | <Project frameworkVersion="v4_0" name="OpenSim.Region.UserStatistics" path="OpenSim/Region/UserStatistics" type="Library"> |
2506 | <Configuration name="Debug"> | 2507 | <Configuration name="Debug"> |
2507 | <Options> | 2508 | <Options> |
2508 | <OutputPath>../../../bin/</OutputPath> | 2509 | <OutputPath>../../../bin/</OutputPath> |
@@ -2553,7 +2554,7 @@ | |||
2553 | 2554 | ||
2554 | <!-- Tools --> | 2555 | <!-- Tools --> |
2555 | 2556 | ||
2556 | <Project frameworkVersion="v3_5" name="pCampBot" path="OpenSim/Tools/pCampBot" type="Exe"> | 2557 | <Project frameworkVersion="v4_0" name="pCampBot" path="OpenSim/Tools/pCampBot" type="Exe"> |
2557 | <Configuration name="Debug"> | 2558 | <Configuration name="Debug"> |
2558 | <Options> | 2559 | <Options> |
2559 | <OutputPath>../../../bin/</OutputPath> | 2560 | <OutputPath>../../../bin/</OutputPath> |
@@ -2580,7 +2581,7 @@ | |||
2580 | </Files> | 2581 | </Files> |
2581 | </Project> | 2582 | </Project> |
2582 | 2583 | ||
2583 | <Project frameworkVersion="v3_5" name="OpenSim.Tools.lslc" path="OpenSim/Tools/Compiler" type="Exe"> | 2584 | <Project frameworkVersion="v4_0" name="OpenSim.Tools.lslc" path="OpenSim/Tools/Compiler" type="Exe"> |
2584 | <Configuration name="Debug"> | 2585 | <Configuration name="Debug"> |
2585 | <Options> | 2586 | <Options> |
2586 | <OutputPath>../../../bin/</OutputPath> | 2587 | <OutputPath>../../../bin/</OutputPath> |
@@ -2607,7 +2608,7 @@ | |||
2607 | </Files> | 2608 | </Files> |
2608 | </Project> | 2609 | </Project> |
2609 | 2610 | ||
2610 | <Project frameworkVersion="v3_5" name="OpenSim.Tools.Configger" path="OpenSim/Tools/Configger" type="Exe"> | 2611 | <Project frameworkVersion="v4_0" name="OpenSim.Tools.Configger" path="OpenSim/Tools/Configger" type="Exe"> |
2611 | <Configuration name="Debug"> | 2612 | <Configuration name="Debug"> |
2612 | <Options> | 2613 | <Options> |
2613 | <OutputPath>../../../bin/</OutputPath> | 2614 | <OutputPath>../../../bin/</OutputPath> |
@@ -2631,7 +2632,7 @@ | |||
2631 | </Project> | 2632 | </Project> |
2632 | 2633 | ||
2633 | <!-- Test Clients --> | 2634 | <!-- Test Clients --> |
2634 | <Project frameworkVersion="v3_5" name="OpenSim.Tests.Clients.GridClient" path="OpenSim/Tests/Clients/Grid" type="Exe"> | 2635 | <Project frameworkVersion="v4_0" name="OpenSim.Tests.Clients.GridClient" path="OpenSim/Tests/Clients/Grid" type="Exe"> |
2635 | <Configuration name="Debug"> | 2636 | <Configuration name="Debug"> |
2636 | <Options> | 2637 | <Options> |
2637 | <OutputPath>../../../../bin/</OutputPath> | 2638 | <OutputPath>../../../../bin/</OutputPath> |
@@ -2658,7 +2659,7 @@ | |||
2658 | </Files> | 2659 | </Files> |
2659 | </Project> | 2660 | </Project> |
2660 | 2661 | ||
2661 | <Project frameworkVersion="v3_5" name="OpenSim.Tests.Clients.PresenceClient" path="OpenSim/Tests/Clients/Presence" type="Exe"> | 2662 | <Project frameworkVersion="v4_0" name="OpenSim.Tests.Clients.PresenceClient" path="OpenSim/Tests/Clients/Presence" type="Exe"> |
2662 | <Configuration name="Debug"> | 2663 | <Configuration name="Debug"> |
2663 | <Options> | 2664 | <Options> |
2664 | <OutputPath>../../../../bin/</OutputPath> | 2665 | <OutputPath>../../../../bin/</OutputPath> |
@@ -2685,7 +2686,7 @@ | |||
2685 | </Files> | 2686 | </Files> |
2686 | </Project> | 2687 | </Project> |
2687 | 2688 | ||
2688 | <Project frameworkVersion="v3_5" name="OpenSim.Tests.Clients.UserAccountClient" path="OpenSim/Tests/Clients/UserAccounts" type="Exe"> | 2689 | <Project frameworkVersion="v4_0" name="OpenSim.Tests.Clients.UserAccountClient" path="OpenSim/Tests/Clients/UserAccounts" type="Exe"> |
2689 | <Configuration name="Debug"> | 2690 | <Configuration name="Debug"> |
2690 | <Options> | 2691 | <Options> |
2691 | <OutputPath>../../../../bin/</OutputPath> | 2692 | <OutputPath>../../../../bin/</OutputPath> |
@@ -2712,7 +2713,7 @@ | |||
2712 | </Files> | 2713 | </Files> |
2713 | </Project> | 2714 | </Project> |
2714 | 2715 | ||
2715 | <Project frameworkVersion="v3_5" name="OpenSim.Tests.Clients.InstantantMessage" path="OpenSim/Tests/Clients/InstantMessage" type="Exe"> | 2716 | <Project frameworkVersion="v4_0" name="OpenSim.Tests.Clients.InstantantMessage" path="OpenSim/Tests/Clients/InstantMessage" type="Exe"> |
2716 | <Configuration name="Debug"> | 2717 | <Configuration name="Debug"> |
2717 | <Options> | 2718 | <Options> |
2718 | <OutputPath>../../../../bin/</OutputPath> | 2719 | <OutputPath>../../../../bin/</OutputPath> |
@@ -2740,7 +2741,7 @@ | |||
2740 | </Project> | 2741 | </Project> |
2741 | 2742 | ||
2742 | <!-- Test assemblies --> | 2743 | <!-- Test assemblies --> |
2743 | <Project frameworkVersion="v3_5" name="OpenSim.Tests.Common" path="OpenSim/Tests/Common" type="Library"> | 2744 | <Project frameworkVersion="v4_0" name="OpenSim.Tests.Common" path="OpenSim/Tests/Common" type="Library"> |
2744 | <Configuration name="Debug"> | 2745 | <Configuration name="Debug"> |
2745 | <Options> | 2746 | <Options> |
2746 | <OutputPath>../../../bin/</OutputPath> | 2747 | <OutputPath>../../../bin/</OutputPath> |
@@ -2784,7 +2785,7 @@ | |||
2784 | </Files> | 2785 | </Files> |
2785 | </Project> | 2786 | </Project> |
2786 | 2787 | ||
2787 | <Project frameworkVersion="v3_5" name="OpenSim.Tests" path="OpenSim/Tests" type="Library"> | 2788 | <Project frameworkVersion="v4_0" name="OpenSim.Tests" path="OpenSim/Tests" type="Library"> |
2788 | <Configuration name="Debug"> | 2789 | <Configuration name="Debug"> |
2789 | <Options> | 2790 | <Options> |
2790 | <OutputPath>../../bin/</OutputPath> | 2791 | <OutputPath>../../bin/</OutputPath> |
@@ -2807,7 +2808,7 @@ | |||
2807 | </Project> | 2808 | </Project> |
2808 | 2809 | ||
2809 | 2810 | ||
2810 | <Project frameworkVersion="v3_5" name="OpenSim.Capabilities.Handlers.Tests" path="OpenSim/Capabilities/Handlers" type="Library"> | 2811 | <Project frameworkVersion="v4_0" name="OpenSim.Capabilities.Handlers.Tests" path="OpenSim/Capabilities/Handlers" type="Library"> |
2811 | <Configuration name="Debug"> | 2812 | <Configuration name="Debug"> |
2812 | <Options> | 2813 | <Options> |
2813 | <OutputPath>../../../bin/</OutputPath> | 2814 | <OutputPath>../../../bin/</OutputPath> |
@@ -2857,7 +2858,7 @@ | |||
2857 | </Project> | 2858 | </Project> |
2858 | 2859 | ||
2859 | 2860 | ||
2860 | <Project frameworkVersion="v3_5" name="OpenSim.Data.Tests" path="OpenSim/Data/Tests" type="Library"> | 2861 | <Project frameworkVersion="v4_0" name="OpenSim.Data.Tests" path="OpenSim/Data/Tests" type="Library"> |
2861 | <Configuration name="Debug"> | 2862 | <Configuration name="Debug"> |
2862 | <Options> | 2863 | <Options> |
2863 | <OutputPath>../../../bin/</OutputPath> | 2864 | <OutputPath>../../../bin/</OutputPath> |
@@ -2899,7 +2900,7 @@ | |||
2899 | </Files> | 2900 | </Files> |
2900 | </Project> | 2901 | </Project> |
2901 | 2902 | ||
2902 | <Project frameworkVersion="v3_5" name="OpenSim.Framework.Tests" path="OpenSim/Framework/Tests" type="Library"> | 2903 | <Project frameworkVersion="v4_0" name="OpenSim.Framework.Tests" path="OpenSim/Framework/Tests" type="Library"> |
2903 | <Configuration name="Debug"> | 2904 | <Configuration name="Debug"> |
2904 | <Options> | 2905 | <Options> |
2905 | <OutputPath>../../../bin/</OutputPath> | 2906 | <OutputPath>../../../bin/</OutputPath> |
@@ -2930,7 +2931,7 @@ | |||
2930 | </Files> | 2931 | </Files> |
2931 | </Project> | 2932 | </Project> |
2932 | 2933 | ||
2933 | <Project frameworkVersion="v3_5" name="OpenSim.Framework.Serialization.Tests" path="OpenSim/Framework/Serialization/Tests" type="Library"> | 2934 | <Project frameworkVersion="v4_0" name="OpenSim.Framework.Serialization.Tests" path="OpenSim/Framework/Serialization/Tests" type="Library"> |
2934 | <Configuration name="Debug"> | 2935 | <Configuration name="Debug"> |
2935 | <Options> | 2936 | <Options> |
2936 | <OutputPath>../../../../bin/</OutputPath> | 2937 | <OutputPath>../../../../bin/</OutputPath> |
@@ -2961,7 +2962,7 @@ | |||
2961 | </Files> | 2962 | </Files> |
2962 | </Project> | 2963 | </Project> |
2963 | 2964 | ||
2964 | <Project frameworkVersion="v3_5" name="OpenSim.Framework.Servers.Tests" path="OpenSim/Framework/Servers/Tests" type="Library"> | 2965 | <Project frameworkVersion="v4_0" name="OpenSim.Framework.Servers.Tests" path="OpenSim/Framework/Servers/Tests" type="Library"> |
2965 | <Configuration name="Debug"> | 2966 | <Configuration name="Debug"> |
2966 | <Options> | 2967 | <Options> |
2967 | <OutputPath>../../../../bin/</OutputPath> | 2968 | <OutputPath>../../../../bin/</OutputPath> |
@@ -2991,7 +2992,7 @@ | |||
2991 | </Files> | 2992 | </Files> |
2992 | </Project> | 2993 | </Project> |
2993 | 2994 | ||
2994 | <Project frameworkVersion="v3_5" name="OpenSim.Region.CoreModules.Tests" path="OpenSim/Region/CoreModules" type="Library"> | 2995 | <Project frameworkVersion="v4_0" name="OpenSim.Region.CoreModules.Tests" path="OpenSim/Region/CoreModules" type="Library"> |
2995 | <Configuration name="Debug"> | 2996 | <Configuration name="Debug"> |
2996 | <Options> | 2997 | <Options> |
2997 | <OutputPath>../../../bin/</OutputPath> | 2998 | <OutputPath>../../../bin/</OutputPath> |
@@ -3062,7 +3063,7 @@ | |||
3062 | </Files> | 3063 | </Files> |
3063 | </Project> | 3064 | </Project> |
3064 | 3065 | ||
3065 | <Project frameworkVersion="v3_5" name="OpenSim.Region.OptionalModules.Tests" path="OpenSim/Region/OptionalModules" type="Library"> | 3066 | <Project frameworkVersion="v4_0" name="OpenSim.Region.OptionalModules.Tests" path="OpenSim/Region/OptionalModules" type="Library"> |
3066 | <Configuration name="Debug"> | 3067 | <Configuration name="Debug"> |
3067 | <Options> | 3068 | <Options> |
3068 | <OutputPath>../../../bin/</OutputPath> | 3069 | <OutputPath>../../../bin/</OutputPath> |
@@ -3121,7 +3122,7 @@ | |||
3121 | </Files> | 3122 | </Files> |
3122 | </Project> | 3123 | </Project> |
3123 | 3124 | ||
3124 | <Project frameworkVersion="v3_5" name="OpenSim.Region.Framework.Tests" path="OpenSim/Region/Framework" type="Library"> | 3125 | <Project frameworkVersion="v4_0" name="OpenSim.Region.Framework.Tests" path="OpenSim/Region/Framework" type="Library"> |
3125 | <Configuration name="Debug"> | 3126 | <Configuration name="Debug"> |
3126 | <Options> | 3127 | <Options> |
3127 | <OutputPath>../../../bin/</OutputPath> | 3128 | <OutputPath>../../../bin/</OutputPath> |
@@ -3179,7 +3180,7 @@ | |||
3179 | </Files> | 3180 | </Files> |
3180 | </Project> | 3181 | </Project> |
3181 | 3182 | ||
3182 | <Project frameworkVersion="v3_5" name="OpenSim.Region.ClientStack.LindenCaps.Tests" path="OpenSim/Region/ClientStack/Linden/Caps" type="Library"> | 3183 | <Project frameworkVersion="v4_0" name="OpenSim.Region.ClientStack.LindenCaps.Tests" path="OpenSim/Region/ClientStack/Linden/Caps" type="Library"> |
3183 | <Configuration name="Debug"> | 3184 | <Configuration name="Debug"> |
3184 | <Options> | 3185 | <Options> |
3185 | <OutputPath>../../../../../bin/</OutputPath> | 3186 | <OutputPath>../../../../../bin/</OutputPath> |
@@ -3216,7 +3217,7 @@ | |||
3216 | </Files> | 3217 | </Files> |
3217 | </Project> | 3218 | </Project> |
3218 | 3219 | ||
3219 | <Project frameworkVersion="v3_5" name="OpenSim.Region.ClientStack.LindenUDP.Tests" path="OpenSim/Region/ClientStack/Linden/UDP/Tests" type="Library"> | 3220 | <Project frameworkVersion="v4_0" name="OpenSim.Region.ClientStack.LindenUDP.Tests" path="OpenSim/Region/ClientStack/Linden/UDP/Tests" type="Library"> |
3220 | <Configuration name="Debug"> | 3221 | <Configuration name="Debug"> |
3221 | <Options> | 3222 | <Options> |
3222 | <OutputPath>../../../../../../bin/</OutputPath> | 3223 | <OutputPath>../../../../../../bin/</OutputPath> |
@@ -3252,7 +3253,7 @@ | |||
3252 | </Files> | 3253 | </Files> |
3253 | </Project> | 3254 | </Project> |
3254 | 3255 | ||
3255 | <Project frameworkVersion="v3_5" name="OpenSim.Region.ScriptEngine.Tests" path="OpenSim/Region/ScriptEngine" type="Library"> | 3256 | <Project frameworkVersion="v4_0" name="OpenSim.Region.ScriptEngine.Tests" path="OpenSim/Region/ScriptEngine" type="Library"> |
3256 | <Configuration name="Debug"> | 3257 | <Configuration name="Debug"> |
3257 | <Options> | 3258 | <Options> |
3258 | <OutputPath>../../../bin/</OutputPath> | 3259 | <OutputPath>../../../bin/</OutputPath> |
@@ -3306,7 +3307,7 @@ | |||
3306 | TODO: this is kind of lame, we basically build a duplicate | 3307 | TODO: this is kind of lame, we basically build a duplicate |
3307 | assembly but with tests added in, just because we can't resolve cross-bin-dir-refs. | 3308 | assembly but with tests added in, just because we can't resolve cross-bin-dir-refs. |
3308 | --> | 3309 | --> |
3309 | <Project frameworkVersion="v3_5" name="OpenSim.Region.Physics.OdePlugin.Tests" path="OpenSim/Region/Physics/OdePlugin/Tests" type="Library"> | 3310 | <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.OdePlugin.Tests" path="OpenSim/Region/Physics/OdePlugin/Tests" type="Library"> |
3310 | <Configuration name="Debug"> | 3311 | <Configuration name="Debug"> |
3311 | <Options> | 3312 | <Options> |
3312 | <OutputPath>../../../../../bin/</OutputPath> | 3313 | <OutputPath>../../../../../bin/</OutputPath> |
@@ -3336,7 +3337,7 @@ | |||
3336 | </Files> | 3337 | </Files> |
3337 | </Project> | 3338 | </Project> |
3338 | 3339 | ||
3339 | <Project frameworkVersion="v3_5" name="OpenSim.Tests.Torture" path="OpenSim/Tests/Torture" type="Library"> | 3340 | <Project frameworkVersion="v4_0" name="OpenSim.Tests.Torture" path="OpenSim/Tests/Torture" type="Library"> |
3340 | <Configuration name="Debug"> | 3341 | <Configuration name="Debug"> |
3341 | <Options> | 3342 | <Options> |
3342 | <OutputPath>../../../bin/</OutputPath> | 3343 | <OutputPath>../../../bin/</OutputPath> |