diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
39 files changed, 1722 insertions, 701 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs index 771038e..4255c79 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs | |||
@@ -167,6 +167,19 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
167 | { | 167 | { |
168 | if (XferUploaders.ContainsKey(transactionID)) | 168 | if (XferUploaders.ContainsKey(transactionID)) |
169 | { | 169 | { |
170 | // m_log.DebugFormat("[XFER]: Asked to update item {0} ({1})", | ||
171 | // item.Name, item.ID); | ||
172 | |||
173 | // Here we need to get the old asset to extract the | ||
174 | // texture UUIDs if it's a wearable. | ||
175 | if (item.AssetType == (int)AssetType.Bodypart || | ||
176 | item.AssetType == (int)AssetType.Clothing) | ||
177 | { | ||
178 | AssetBase oldAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); | ||
179 | if (oldAsset != null) | ||
180 | XferUploaders[transactionID].SetOldData(oldAsset.Data); | ||
181 | } | ||
182 | |||
170 | AssetBase asset = GetTransactionAsset(transactionID); | 183 | AssetBase asset = GetTransactionAsset(transactionID); |
171 | 184 | ||
172 | if (asset != null) | 185 | if (asset != null) |
@@ -181,6 +194,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
181 | 194 | ||
182 | IInventoryService invService = m_Scene.InventoryService; | 195 | IInventoryService invService = m_Scene.InventoryService; |
183 | invService.UpdateItem(item); | 196 | invService.UpdateItem(item); |
197 | |||
198 | // m_log.DebugFormat("[XFER]: Updated item {0} ({1}) with asset {2}", | ||
199 | // item.Name, item.ID, asset.FullID); | ||
184 | } | 200 | } |
185 | } | 201 | } |
186 | } | 202 | } |
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index a7929ba..a5dcdcc 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Collections.Generic; | ||
31 | using log4net; | 32 | using log4net; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
@@ -38,6 +39,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
38 | { | 39 | { |
39 | public class AssetXferUploader | 40 | public class AssetXferUploader |
40 | { | 41 | { |
42 | // Viewer's notion of the default texture | ||
43 | private List<UUID> defaultIDs = new List<UUID> { | ||
44 | new UUID("5748decc-f629-461c-9a36-a35a221fe21f"), | ||
45 | new UUID("7ca39b4c-bd19-4699-aff7-f93fd03d3e7b"), | ||
46 | new UUID("6522e74d-1660-4e7f-b601-6f48c1659a77"), | ||
47 | new UUID("c228d1cf-4b5d-4ba8-84f4-899a0796aa97") | ||
48 | }; | ||
41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 50 | ||
43 | private AssetBase m_asset; | 51 | private AssetBase m_asset; |
@@ -55,6 +63,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
55 | private UUID TransactionID = UUID.Zero; | 63 | private UUID TransactionID = UUID.Zero; |
56 | private sbyte type = 0; | 64 | private sbyte type = 0; |
57 | private byte wearableType = 0; | 65 | private byte wearableType = 0; |
66 | private byte[] m_oldData = null; | ||
58 | public ulong XferID; | 67 | public ulong XferID; |
59 | private Scene m_Scene; | 68 | private Scene m_Scene; |
60 | 69 | ||
@@ -219,6 +228,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
219 | 228 | ||
220 | private void DoCreateItem(uint callbackID) | 229 | private void DoCreateItem(uint callbackID) |
221 | { | 230 | { |
231 | ValidateAssets(); | ||
222 | m_Scene.AssetService.Store(m_asset); | 232 | m_Scene.AssetService.Store(m_asset); |
223 | 233 | ||
224 | InventoryItemBase item = new InventoryItemBase(); | 234 | InventoryItemBase item = new InventoryItemBase(); |
@@ -239,12 +249,84 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
239 | item.Flags = (uint) wearableType; | 249 | item.Flags = (uint) wearableType; |
240 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 250 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
241 | 251 | ||
252 | m_log.DebugFormat("[XFER]: Created item {0} with asset {1}", | ||
253 | item.ID, item.AssetID); | ||
254 | |||
242 | if (m_Scene.AddInventoryItem(item)) | 255 | if (m_Scene.AddInventoryItem(item)) |
243 | ourClient.SendInventoryItemCreateUpdate(item, callbackID); | 256 | ourClient.SendInventoryItemCreateUpdate(item, callbackID); |
244 | else | 257 | else |
245 | ourClient.SendAlertMessage("Unable to create inventory item"); | 258 | ourClient.SendAlertMessage("Unable to create inventory item"); |
246 | } | 259 | } |
247 | 260 | ||
261 | private void ValidateAssets() | ||
262 | { | ||
263 | if (m_asset.Type == (sbyte)AssetType.Clothing || | ||
264 | m_asset.Type == (sbyte)AssetType.Bodypart) | ||
265 | { | ||
266 | string content = System.Text.Encoding.ASCII.GetString(m_asset.Data); | ||
267 | string[] lines = content.Split(new char[] {'\n'}); | ||
268 | |||
269 | List<string> validated = new List<string>(); | ||
270 | |||
271 | Dictionary<int, UUID> allowed = ExtractTexturesFromOldData(); | ||
272 | |||
273 | int textures = 0; | ||
274 | |||
275 | foreach (string line in lines) | ||
276 | { | ||
277 | try | ||
278 | { | ||
279 | if (line.StartsWith("textures ")) | ||
280 | { | ||
281 | textures = Convert.ToInt32(line.Substring(9)); | ||
282 | validated.Add(line); | ||
283 | } | ||
284 | else if (textures > 0) | ||
285 | { | ||
286 | string[] parts = line.Split(new char[] {' '}); | ||
287 | |||
288 | UUID tx = new UUID(parts[1]); | ||
289 | int id = Convert.ToInt32(parts[0]); | ||
290 | |||
291 | if (defaultIDs.Contains(tx) || tx == UUID.Zero || | ||
292 | (allowed.ContainsKey(id) && allowed[id] == tx)) | ||
293 | { | ||
294 | validated.Add(parts[0] + " " + tx.ToString()); | ||
295 | } | ||
296 | else | ||
297 | { | ||
298 | int perms = m_Scene.InventoryService.GetAssetPermissions(ourClient.AgentId, tx); | ||
299 | int full = (int)(PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Copy); | ||
300 | |||
301 | if ((perms & full) != full) | ||
302 | { | ||
303 | m_log.ErrorFormat("[ASSET UPLOADER]: REJECTED update with texture {0} from {1} because they do not own the texture", tx, ourClient.AgentId); | ||
304 | validated.Add(parts[0] + " " + UUID.Zero.ToString()); | ||
305 | } | ||
306 | else | ||
307 | { | ||
308 | validated.Add(line); | ||
309 | } | ||
310 | } | ||
311 | textures--; | ||
312 | } | ||
313 | else | ||
314 | { | ||
315 | validated.Add(line); | ||
316 | } | ||
317 | } | ||
318 | catch | ||
319 | { | ||
320 | // If it's malformed, skip it | ||
321 | } | ||
322 | } | ||
323 | |||
324 | string final = String.Join("\n", validated.ToArray()); | ||
325 | |||
326 | m_asset.Data = System.Text.Encoding.ASCII.GetBytes(final); | ||
327 | } | ||
328 | } | ||
329 | |||
248 | /// <summary> | 330 | /// <summary> |
249 | /// Get the asset data uploaded in this transfer. | 331 | /// Get the asset data uploaded in this transfer. |
250 | /// </summary> | 332 | /// </summary> |
@@ -253,10 +335,55 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
253 | { | 335 | { |
254 | if (m_finished) | 336 | if (m_finished) |
255 | { | 337 | { |
338 | ValidateAssets(); | ||
256 | return m_asset; | 339 | return m_asset; |
257 | } | 340 | } |
258 | 341 | ||
259 | return null; | 342 | return null; |
260 | } | 343 | } |
344 | |||
345 | public void SetOldData(byte[] d) | ||
346 | { | ||
347 | m_oldData = d; | ||
348 | } | ||
349 | |||
350 | private Dictionary<int,UUID> ExtractTexturesFromOldData() | ||
351 | { | ||
352 | Dictionary<int,UUID> result = new Dictionary<int,UUID>(); | ||
353 | if (m_oldData == null) | ||
354 | return result; | ||
355 | |||
356 | string content = System.Text.Encoding.ASCII.GetString(m_oldData); | ||
357 | string[] lines = content.Split(new char[] {'\n'}); | ||
358 | |||
359 | int textures = 0; | ||
360 | |||
361 | foreach (string line in lines) | ||
362 | { | ||
363 | try | ||
364 | { | ||
365 | if (line.StartsWith("textures ")) | ||
366 | { | ||
367 | textures = Convert.ToInt32(line.Substring(9)); | ||
368 | } | ||
369 | else if (textures > 0) | ||
370 | { | ||
371 | string[] parts = line.Split(new char[] {' '}); | ||
372 | |||
373 | UUID tx = new UUID(parts[1]); | ||
374 | int id = Convert.ToInt32(parts[0]); | ||
375 | result[id] = tx; | ||
376 | textures--; | ||
377 | } | ||
378 | } | ||
379 | catch | ||
380 | { | ||
381 | // If it's malformed, skip it | ||
382 | } | ||
383 | } | ||
384 | |||
385 | return result; | ||
386 | } | ||
261 | } | 387 | } |
262 | } | 388 | } |
389 | |||
diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs index 1d8e70e..7526bd2 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs | |||
@@ -95,7 +95,8 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
95 | 95 | ||
96 | public void AddCapsHandler(UUID agentId) | 96 | public void AddCapsHandler(UUID agentId) |
97 | { | 97 | { |
98 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId)) | 98 | int flags = m_scene.GetUserFlags(agentId); |
99 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) | ||
99 | return; | 100 | return; |
100 | 101 | ||
101 | String capsObjectPath = GetCapsPath(agentId); | 102 | String capsObjectPath = GetCapsPath(agentId); |
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 9adb68b..7cba702 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -262,7 +262,16 @@ namespace Flotsam.RegionModules.AssetCache | |||
262 | // If the file is already cached, don't cache it, just touch it so access time is updated | 262 | // If the file is already cached, don't cache it, just touch it so access time is updated |
263 | if (File.Exists(filename)) | 263 | if (File.Exists(filename)) |
264 | { | 264 | { |
265 | File.SetLastAccessTime(filename, DateTime.Now); | 265 | // We don't really want to know about sharing |
266 | // violations here. If the file is locked, then | ||
267 | // the other thread has updated the time for us. | ||
268 | try | ||
269 | { | ||
270 | File.SetLastAccessTime(filename, DateTime.Now); | ||
271 | } | ||
272 | catch | ||
273 | { | ||
274 | } | ||
266 | } else { | 275 | } else { |
267 | 276 | ||
268 | // Once we start writing, make sure we flag that we're writing | 277 | // Once we start writing, make sure we flag that we're writing |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index ff26264..dc33dbb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Xml; | ||
31 | using log4net; | 32 | using log4net; |
32 | using Mono.Addins; | 33 | using Mono.Addins; |
33 | using Nini.Config; | 34 | using Nini.Config; |
@@ -118,6 +119,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
118 | return; | 119 | return; |
119 | } | 120 | } |
120 | 121 | ||
122 | if (part.OwnerID != remoteClient.AgentId) // Not ours | ||
123 | { | ||
124 | remoteClient.SendAgentAlertMessage( | ||
125 | "You don't have sufficient permissions to attach this object", false); | ||
126 | return; | ||
127 | } | ||
128 | |||
121 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should | 129 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should |
122 | // be removed when that functionality is implemented in opensim | 130 | // be removed when that functionality is implemented in opensim |
123 | AttachmentPt &= 0x7f; | 131 | AttachmentPt &= 0x7f; |
@@ -226,15 +234,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
226 | public UUID RezSingleAttachmentFromInventory( | 234 | public UUID RezSingleAttachmentFromInventory( |
227 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) | 235 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) |
228 | { | 236 | { |
229 | m_log.DebugFormat( | 237 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null); |
230 | "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", | 238 | } |
231 | (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); | 239 | |
232 | 240 | public UUID RezSingleAttachmentFromInventory( | |
241 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) | ||
242 | { | ||
233 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should | 243 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should |
234 | // be removed when that functionality is implemented in opensim | 244 | // be removed when that functionality is implemented in opensim |
235 | AttachmentPt &= 0x7f; | 245 | AttachmentPt &= 0x7f; |
236 | 246 | ||
237 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); | 247 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); |
238 | 248 | ||
239 | if (updateInventoryStatus) | 249 | if (updateInventoryStatus) |
240 | { | 250 | { |
@@ -251,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
251 | } | 261 | } |
252 | 262 | ||
253 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 263 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
254 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 264 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) |
255 | { | 265 | { |
256 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 266 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
257 | if (invAccess != null) | 267 | if (invAccess != null) |
@@ -289,13 +299,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
289 | if (tainted) | 299 | if (tainted) |
290 | objatt.HasGroupChanged = true; | 300 | objatt.HasGroupChanged = true; |
291 | 301 | ||
302 | if (doc != null) | ||
303 | { | ||
304 | objatt.LoadScriptState(doc); | ||
305 | objatt.ResetOwnerChangeFlag(); | ||
306 | } | ||
307 | |||
292 | // Fire after attach, so we don't get messy perms dialogs | 308 | // Fire after attach, so we don't get messy perms dialogs |
293 | // 4 == AttachedRez | 309 | // 4 == AttachedRez |
294 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | 310 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); |
295 | objatt.ResumeScripts(); | 311 | objatt.ResumeScripts(); |
296 | 312 | ||
297 | // Do this last so that event listeners have access to all the effects of the attachment | 313 | // Do this last so that event listeners have access to all the effects of the attachment |
298 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); | 314 | //m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); |
299 | } | 315 | } |
300 | else | 316 | else |
301 | { | 317 | { |
@@ -332,7 +348,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
332 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 348 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
333 | { | 349 | { |
334 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 350 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
335 | item = m_scene.InventoryService.GetItem(item); | 351 | if (m_scene.InventoryService != null) |
352 | item = m_scene.InventoryService.GetItem(item); | ||
336 | 353 | ||
337 | bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); | 354 | bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); |
338 | if (changed && m_scene.AvatarFactory != null) | 355 | if (changed && m_scene.AvatarFactory != null) |
@@ -379,6 +396,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
379 | { | 396 | { |
380 | // XXYY!! | 397 | // XXYY!! |
381 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 398 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
399 | if (item == null) | ||
400 | m_log.Error("[ATTACHMENT]: item == null"); | ||
401 | if (m_scene == null) | ||
402 | m_log.Error("[ATTACHMENT]: m_scene == null"); | ||
403 | if (m_scene.InventoryService == null) | ||
404 | m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null"); | ||
382 | item = m_scene.InventoryService.GetItem(item); | 405 | item = m_scene.InventoryService.GetItem(item); |
383 | bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); | 406 | bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); |
384 | if (changed && m_scene.AvatarFactory != null) | 407 | if (changed && m_scene.AvatarFactory != null) |
@@ -465,6 +488,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
465 | if (group.GetFromItemID() == itemID) | 488 | if (group.GetFromItemID() == itemID) |
466 | { | 489 | { |
467 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 490 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
491 | // CM / XMREngine!!!! Needed to conclude attach event | ||
492 | //SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
468 | group.DetachToInventoryPrep(); | 493 | group.DetachToInventoryPrep(); |
469 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | 494 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); |
470 | 495 | ||
@@ -482,22 +507,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
482 | } | 507 | } |
483 | } | 508 | } |
484 | 509 | ||
485 | public void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos) | ||
486 | { | ||
487 | // First we save the | ||
488 | // attachment point information, then we update the relative | ||
489 | // positioning. Then we have to mark the object as NOT an | ||
490 | // attachment. This is necessary in order to correctly save | ||
491 | // and retrieve GroupPosition information for the attachment. | ||
492 | // Finally, we restore the object's attachment status. | ||
493 | byte attachmentPoint = sog.GetAttachmentPoint(); | ||
494 | sog.UpdateGroupPosition(pos); | ||
495 | sog.RootPart.IsAttachment = false; | ||
496 | sog.AbsolutePosition = sog.RootPart.AttachedPos; | ||
497 | sog.SetAttachmentPoint(attachmentPoint); | ||
498 | sog.HasGroupChanged = true; | ||
499 | } | ||
500 | |||
501 | /// <summary> | 510 | /// <summary> |
502 | /// Update the attachment asset for the new sog details if they have changed. | 511 | /// Update the attachment asset for the new sog details if they have changed. |
503 | /// </summary> | 512 | /// </summary> |
@@ -601,15 +610,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
601 | 610 | ||
602 | if (!silent) | 611 | if (!silent) |
603 | { | 612 | { |
604 | // Killing it here will cause the client to deselect it | ||
605 | // It then reappears on the avatar, deselected | ||
606 | // through the full update below | ||
607 | // | ||
608 | if (so.IsSelected) | ||
609 | { | ||
610 | m_scene.SendKillObject(so.RootPart.LocalId); | ||
611 | } | ||
612 | |||
613 | so.IsSelected = false; // fudge.... | 613 | so.IsSelected = false; // fudge.... |
614 | so.ScheduleGroupForFullUpdate(); | 614 | so.ScheduleGroupForFullUpdate(); |
615 | } | 615 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 4359c01..35a3f43 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -49,7 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
49 | private int m_shoutdistance = 100; | 49 | private int m_shoutdistance = 100; |
50 | private int m_whisperdistance = 10; | 50 | private int m_whisperdistance = 10; |
51 | private List<Scene> m_scenes = new List<Scene>(); | 51 | private List<Scene> m_scenes = new List<Scene>(); |
52 | 52 | private List<string> FreezeCache = new List<string>(); | |
53 | private string m_adminPrefix = ""; | ||
53 | internal object m_syncy = new object(); | 54 | internal object m_syncy = new object(); |
54 | 55 | ||
55 | internal IConfig m_config; | 56 | internal IConfig m_config; |
@@ -76,6 +77,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
76 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); | 77 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); |
77 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); | 78 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); |
78 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); | 79 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); |
80 | m_adminPrefix = config.Configs["Chat"].GetString("admin_prefix", ""); | ||
79 | } | 81 | } |
80 | 82 | ||
81 | public virtual void AddRegion(Scene scene) | 83 | public virtual void AddRegion(Scene scene) |
@@ -171,7 +173,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
171 | return; | 173 | return; |
172 | } | 174 | } |
173 | 175 | ||
174 | DeliverChatToAvatars(ChatSourceType.Agent, c); | 176 | if (FreezeCache.Contains(c.Sender.AgentId.ToString())) |
177 | { | ||
178 | if (c.Type != ChatTypeEnum.StartTyping || c.Type != ChatTypeEnum.StopTyping) | ||
179 | c.Sender.SendAgentAlertMessage("You may not talk as you are frozen.", false); | ||
180 | } | ||
181 | else | ||
182 | { | ||
183 | DeliverChatToAvatars(ChatSourceType.Agent, c); | ||
184 | } | ||
175 | } | 185 | } |
176 | 186 | ||
177 | public virtual void OnChatFromWorld(Object sender, OSChatMessage c) | 187 | public virtual void OnChatFromWorld(Object sender, OSChatMessage c) |
@@ -185,6 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
185 | protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) | 195 | protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) |
186 | { | 196 | { |
187 | string fromName = c.From; | 197 | string fromName = c.From; |
198 | string fromNamePrefix = ""; | ||
188 | UUID fromID = UUID.Zero; | 199 | UUID fromID = UUID.Zero; |
189 | string message = c.Message; | 200 | string message = c.Message; |
190 | IScene scene = c.Scene; | 201 | IScene scene = c.Scene; |
@@ -207,7 +218,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
207 | fromPos = avatar.AbsolutePosition; | 218 | fromPos = avatar.AbsolutePosition; |
208 | fromName = avatar.Name; | 219 | fromName = avatar.Name; |
209 | fromID = c.Sender.AgentId; | 220 | fromID = c.Sender.AgentId; |
210 | 221 | if (avatar.GodLevel >= 200) | |
222 | { | ||
223 | fromNamePrefix = m_adminPrefix; | ||
224 | } | ||
211 | break; | 225 | break; |
212 | 226 | ||
213 | case ChatSourceType.Object: | 227 | case ChatSourceType.Object: |
@@ -231,8 +245,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
231 | s.ForEachScenePresence( | 245 | s.ForEachScenePresence( |
232 | delegate(ScenePresence presence) | 246 | delegate(ScenePresence presence) |
233 | { | 247 | { |
234 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType)) | 248 | ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); |
235 | receiverIDs.Add(presence.UUID); | 249 | if (Presencecheck != null) |
250 | { | ||
251 | // This will pass all chat from objects. Not | ||
252 | // perfect, but it will do. For now. Better | ||
253 | // than the prior behavior of muting all | ||
254 | // objects on a parcel with access restrictions | ||
255 | if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) | ||
256 | { | ||
257 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType)) | ||
258 | receiverIDs.Add(presence.UUID); | ||
259 | } | ||
260 | } | ||
261 | |||
236 | } | 262 | } |
237 | ); | 263 | ); |
238 | } | 264 | } |
@@ -276,31 +302,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
276 | } | 302 | } |
277 | 303 | ||
278 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); | 304 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); |
279 | |||
280 | HashSet<UUID> receiverIDs = new HashSet<UUID>(); | 305 | HashSet<UUID> receiverIDs = new HashSet<UUID>(); |
281 | 306 | ||
282 | ((Scene)c.Scene).ForEachScenePresence( | 307 | if (c.Scene != null) |
283 | delegate(ScenePresence presence) | 308 | { |
284 | { | 309 | ((Scene)c.Scene).ForEachScenePresence |
285 | // ignore chat from child agents | 310 | ( |
286 | if (presence.IsChildAgent) return; | 311 | delegate(ScenePresence presence) |
287 | 312 | { | |
288 | IClientAPI client = presence.ControllingClient; | 313 | // ignore chat from child agents |
289 | 314 | if (presence.IsChildAgent) return; | |
290 | // don't forward SayOwner chat from objects to | 315 | |
291 | // non-owner agents | 316 | IClientAPI client = presence.ControllingClient; |
292 | if ((c.Type == ChatTypeEnum.Owner) && | 317 | |
293 | (null != c.SenderObject) && | 318 | // don't forward SayOwner chat from objects to |
294 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | 319 | // non-owner agents |
295 | return; | 320 | if ((c.Type == ChatTypeEnum.Owner) && |
296 | 321 | (null != c.SenderObject) && | |
297 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, | 322 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) |
298 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | 323 | return; |
299 | receiverIDs.Add(presence.UUID); | 324 | |
300 | }); | 325 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, |
301 | 326 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | |
302 | (c.Scene as Scene).EventManager.TriggerOnChatToClients( | 327 | receiverIDs.Add(presence.UUID); |
303 | fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully); | 328 | } |
329 | ); | ||
330 | (c.Scene as Scene).EventManager.TriggerOnChatToClients( | ||
331 | fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully); | ||
332 | } | ||
304 | } | 333 | } |
305 | 334 | ||
306 | /// <summary> | 335 | /// <summary> |
@@ -343,5 +372,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
343 | 372 | ||
344 | return true; | 373 | return true; |
345 | } | 374 | } |
375 | |||
376 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
377 | public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
378 | { | ||
379 | System.Threading.Timer Timer; | ||
380 | if (flags == 0) | ||
381 | { | ||
382 | FreezeCache.Add(target.ToString()); | ||
383 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
384 | Timer = new System.Threading.Timer(timeCB, target, 30000, 0); | ||
385 | Timers.Add(target, Timer); | ||
386 | } | ||
387 | else | ||
388 | { | ||
389 | FreezeCache.Remove(target.ToString()); | ||
390 | Timers.TryGetValue(target, out Timer); | ||
391 | Timers.Remove(target); | ||
392 | Timer.Dispose(); | ||
393 | } | ||
394 | } | ||
395 | |||
396 | private void OnEndParcelFrozen(object avatar) | ||
397 | { | ||
398 | UUID target = (UUID)avatar; | ||
399 | FreezeCache.Remove(target.ToString()); | ||
400 | System.Threading.Timer Timer; | ||
401 | Timers.TryGetValue(target, out Timer); | ||
402 | Timers.Remove(target); | ||
403 | Timer.Dispose(); | ||
404 | } | ||
346 | } | 405 | } |
347 | } | 406 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 8a977c9..ded8743 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | |||
@@ -215,4 +215,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
215 | return result; | 215 | return result; |
216 | } | 216 | } |
217 | } | 217 | } |
218 | } \ No newline at end of file | 218 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 5baf078..0cd05e3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -273,7 +273,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
273 | 273 | ||
274 | // Inform the friends that this user is online | 274 | // Inform the friends that this user is online |
275 | StatusChange(agentID, true); | 275 | StatusChange(agentID, true); |
276 | 276 | ||
277 | // Register that we need to send the list of online friends to this user | 277 | // Register that we need to send the list of online friends to this user |
278 | lock (m_NeedsListOfFriends) | 278 | lock (m_NeedsListOfFriends) |
279 | m_NeedsListOfFriends.Add(agentID); | 279 | m_NeedsListOfFriends.Add(agentID); |
@@ -516,6 +516,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
516 | FriendsService.StoreFriend(agentID, friendID.ToString(), 1); | 516 | FriendsService.StoreFriend(agentID, friendID.ToString(), 1); |
517 | FriendsService.StoreFriend(friendID, agentID.ToString(), 1); | 517 | FriendsService.StoreFriend(friendID, agentID.ToString(), 1); |
518 | 518 | ||
519 | ICallingCardModule ccm = client.Scene.RequestModuleInterface<ICallingCardModule>(); | ||
520 | if (ccm != null) | ||
521 | { | ||
522 | ccm.CreateCallingCard(agentID, friendID, UUID.Zero); | ||
523 | } | ||
524 | |||
519 | // Update the local cache | 525 | // Update the local cache |
520 | UpdateFriendsCache(agentID); | 526 | UpdateFriendsCache(agentID); |
521 | 527 | ||
@@ -679,6 +685,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
679 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); | 685 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); |
680 | friendClient.SendInstantMessage(im); | 686 | friendClient.SendInstantMessage(im); |
681 | 687 | ||
688 | ICallingCardModule ccm = friendClient.Scene.RequestModuleInterface<ICallingCardModule>(); | ||
689 | if (ccm != null) | ||
690 | { | ||
691 | ccm.CreateCallingCard(friendID, userID, UUID.Zero); | ||
692 | } | ||
693 | |||
694 | |||
682 | // Update the local cache | 695 | // Update the local cache |
683 | UpdateFriendsCache(friendID); | 696 | UpdateFriendsCache(friendID); |
684 | 697 | ||
@@ -701,7 +714,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
701 | // we're done | 714 | // we're done |
702 | return true; | 715 | return true; |
703 | } | 716 | } |
704 | 717 | ||
705 | return false; | 718 | return false; |
706 | } | 719 | } |
707 | 720 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 5ec64d5..a83b3df 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs | |||
@@ -31,16 +31,40 @@ using OpenMetaverse; | |||
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.Framework.Scenes; | 32 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
34 | using System; | ||
35 | using System.Reflection; | ||
36 | using System.Collections; | ||
37 | using System.Collections.Specialized; | ||
38 | using System.Reflection; | ||
39 | using System.IO; | ||
40 | using System.Web; | ||
41 | using System.Xml; | ||
42 | using log4net; | ||
43 | using Mono.Addins; | ||
44 | using OpenMetaverse.Messages.Linden; | ||
45 | using OpenMetaverse.StructuredData; | ||
46 | using OpenSim.Framework.Capabilities; | ||
47 | using OpenSim.Framework.Servers; | ||
48 | using OpenSim.Framework.Servers.HttpServer; | ||
49 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
50 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; | ||
51 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; | ||
34 | 52 | ||
35 | namespace OpenSim.Region.CoreModules.Avatar.Gods | 53 | namespace OpenSim.Region.CoreModules.Avatar.Gods |
36 | { | 54 | { |
37 | public class GodsModule : IRegionModule, IGodsModule | 55 | public class GodsModule : IRegionModule, IGodsModule |
38 | { | 56 | { |
57 | private static readonly ILog m_log = | ||
58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
59 | |||
39 | /// <summary>Special UUID for actions that apply to all agents</summary> | 60 | /// <summary>Special UUID for actions that apply to all agents</summary> |
40 | private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); | 61 | private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); |
41 | 62 | ||
42 | protected Scene m_scene; | 63 | protected Scene m_scene; |
43 | protected IDialogModule m_dialogModule; | 64 | protected IDialogModule m_dialogModule; |
65 | |||
66 | protected Dictionary<UUID, string> m_capsDict = | ||
67 | new Dictionary<UUID, string>(); | ||
44 | 68 | ||
45 | public void Initialise(Scene scene, IConfigSource source) | 69 | public void Initialise(Scene scene, IConfigSource source) |
46 | { | 70 | { |
@@ -48,6 +72,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
48 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); | 72 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); |
49 | m_scene.RegisterModuleInterface<IGodsModule>(this); | 73 | m_scene.RegisterModuleInterface<IGodsModule>(this); |
50 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | 74 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; |
75 | m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; | ||
76 | m_scene.EventManager.OnClientClosed += OnClientClosed; | ||
77 | scene.EventManager.OnIncomingInstantMessage += | ||
78 | OnIncomingInstantMessage; | ||
51 | } | 79 | } |
52 | 80 | ||
53 | public void PostInitialise() {} | 81 | public void PostInitialise() {} |
@@ -67,6 +95,54 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
67 | client.OnRequestGodlikePowers -= RequestGodlikePowers; | 95 | client.OnRequestGodlikePowers -= RequestGodlikePowers; |
68 | } | 96 | } |
69 | 97 | ||
98 | private void OnClientClosed(UUID agentID, Scene scene) | ||
99 | { | ||
100 | m_capsDict.Remove(agentID); | ||
101 | } | ||
102 | |||
103 | private void OnRegisterCaps(UUID agentID, Caps caps) | ||
104 | { | ||
105 | string uri = "/CAPS/" + UUID.Random(); | ||
106 | m_capsDict[agentID] = uri; | ||
107 | |||
108 | caps.RegisterHandler("UntrustedSimulatorMessage", | ||
109 | new RestStreamHandler("POST", uri, | ||
110 | HandleUntrustedSimulatorMessage)); | ||
111 | } | ||
112 | |||
113 | private string HandleUntrustedSimulatorMessage(string request, | ||
114 | string path, string param, OSHttpRequest httpRequest, | ||
115 | OSHttpResponse httpResponse) | ||
116 | { | ||
117 | OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
118 | |||
119 | string message = osd["message"].AsString(); | ||
120 | |||
121 | if (message == "GodKickUser") | ||
122 | { | ||
123 | OSDMap body = (OSDMap)osd["body"]; | ||
124 | OSDArray userInfo = (OSDArray)body["UserInfo"]; | ||
125 | OSDMap userData = (OSDMap)userInfo[0]; | ||
126 | |||
127 | UUID agentID = userData["AgentID"].AsUUID(); | ||
128 | UUID godID = userData["GodID"].AsUUID(); | ||
129 | UUID godSessionID = userData["GodSessionID"].AsUUID(); | ||
130 | uint kickFlags = userData["KickFlags"].AsUInteger(); | ||
131 | string reason = userData["Reason"].AsString(); | ||
132 | |||
133 | ScenePresence god = m_scene.GetScenePresence(godID); | ||
134 | if (god == null || god.ControllingClient.SessionId != godSessionID) | ||
135 | return String.Empty; | ||
136 | |||
137 | KickUser(godID, godSessionID, agentID, kickFlags, Util.StringToBytes1024(reason)); | ||
138 | } | ||
139 | else | ||
140 | { | ||
141 | m_log.ErrorFormat("[GOD]: Unhandled UntrustedSimulatorMessage: {0}", message); | ||
142 | } | ||
143 | return String.Empty; | ||
144 | } | ||
145 | |||
70 | public void RequestGodlikePowers( | 146 | public void RequestGodlikePowers( |
71 | UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) | 147 | UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) |
72 | { | 148 | { |
@@ -115,71 +191,85 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
115 | /// <param name="reason">The message to send to the user after it's been turned into a field</param> | 191 | /// <param name="reason">The message to send to the user after it's been turned into a field</param> |
116 | public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason) | 192 | public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason) |
117 | { | 193 | { |
118 | UUID kickUserID = ALL_AGENTS; | 194 | if (!m_scene.Permissions.IsGod(godID)) |
119 | 195 | return; | |
196 | |||
120 | ScenePresence sp = m_scene.GetScenePresence(agentID); | 197 | ScenePresence sp = m_scene.GetScenePresence(agentID); |
121 | 198 | ||
122 | if (sp != null || agentID == kickUserID) | 199 | if (sp == null && agentID != ALL_AGENTS) |
123 | { | 200 | { |
124 | if (m_scene.Permissions.IsGod(godID)) | 201 | IMessageTransferModule transferModule = |
202 | m_scene.RequestModuleInterface<IMessageTransferModule>(); | ||
203 | if (transferModule != null) | ||
125 | { | 204 | { |
126 | if (kickflags == 0) | 205 | m_log.DebugFormat("[GODS]: Sending nonlocal kill for agent {0}", agentID); |
127 | { | 206 | transferModule.SendInstantMessage(new GridInstantMessage( |
128 | if (agentID == kickUserID) | 207 | m_scene, godID, "God", agentID, (byte)250, false, |
129 | { | 208 | Utils.BytesToString(reason), UUID.Zero, true, |
130 | string reasonStr = Utils.BytesToString(reason); | 209 | new Vector3(), new byte[] {(byte)kickflags}), |
131 | 210 | delegate(bool success) {} ); | |
132 | m_scene.ForEachClient( | 211 | } |
133 | delegate(IClientAPI controller) | 212 | return; |
134 | { | 213 | } |
135 | if (controller.AgentId != godID) | ||
136 | controller.Kick(reasonStr); | ||
137 | } | ||
138 | ); | ||
139 | |||
140 | // This is a bit crude. It seems the client will be null before it actually stops the thread | ||
141 | // The thread will kill itself eventually :/ | ||
142 | // Is there another way to make sure *all* clients get this 'inter region' message? | ||
143 | m_scene.ForEachScenePresence( | ||
144 | delegate(ScenePresence p) | ||
145 | { | ||
146 | if (p.UUID != godID && !p.IsChildAgent) | ||
147 | { | ||
148 | // Possibly this should really be p.Close() though that method doesn't send a close | ||
149 | // to the client | ||
150 | p.ControllingClient.Close(); | ||
151 | } | ||
152 | } | ||
153 | ); | ||
154 | } | ||
155 | else | ||
156 | { | ||
157 | m_scene.SceneGraph.removeUserCount(!sp.IsChildAgent); | ||
158 | 214 | ||
159 | sp.ControllingClient.Kick(Utils.BytesToString(reason)); | 215 | switch (kickflags) |
160 | sp.ControllingClient.Close(); | 216 | { |
161 | } | 217 | case 0: |
162 | } | 218 | if (sp != null) |
163 | 219 | { | |
164 | if (kickflags == 1) | 220 | KickPresence(sp, Utils.BytesToString(reason)); |
165 | { | ||
166 | sp.AllowMovement = false; | ||
167 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | ||
168 | m_dialogModule.SendAlertToUser(godID, "User Frozen"); | ||
169 | } | ||
170 | |||
171 | if (kickflags == 2) | ||
172 | { | ||
173 | sp.AllowMovement = true; | ||
174 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | ||
175 | m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); | ||
176 | } | ||
177 | } | 221 | } |
178 | else | 222 | else if (agentID == ALL_AGENTS) |
179 | { | 223 | { |
180 | m_dialogModule.SendAlertToUser(godID, "Kick request denied"); | 224 | m_scene.ForEachScenePresence( |
225 | delegate(ScenePresence p) | ||
226 | { | ||
227 | if (p.UUID != godID && (!m_scene.Permissions.IsGod(p.UUID))) | ||
228 | KickPresence(p, Utils.BytesToString(reason)); | ||
229 | } | ||
230 | ); | ||
181 | } | 231 | } |
232 | break; | ||
233 | case 1: | ||
234 | if (sp != null) | ||
235 | { | ||
236 | sp.AllowMovement = false; | ||
237 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | ||
238 | m_dialogModule.SendAlertToUser(godID, "User Frozen"); | ||
239 | } | ||
240 | break; | ||
241 | case 2: | ||
242 | if (sp != null) | ||
243 | { | ||
244 | sp.AllowMovement = true; | ||
245 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | ||
246 | m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); | ||
247 | } | ||
248 | break; | ||
249 | default: | ||
250 | break; | ||
251 | } | ||
252 | } | ||
253 | |||
254 | private void KickPresence(ScenePresence sp, string reason) | ||
255 | { | ||
256 | if (sp.IsChildAgent) | ||
257 | return; | ||
258 | sp.ControllingClient.Kick(reason); | ||
259 | sp.Scene.IncomingCloseAgent(sp.UUID); | ||
260 | } | ||
261 | |||
262 | private void OnIncomingInstantMessage(GridInstantMessage msg) | ||
263 | { | ||
264 | if (msg.dialog == (uint)250) // Nonlocal kick | ||
265 | { | ||
266 | UUID agentID = new UUID(msg.toAgentID); | ||
267 | string reason = msg.message; | ||
268 | UUID godID = new UUID(msg.fromAgentID); | ||
269 | uint kickMode = (uint)msg.binaryBucket[0]; | ||
270 | |||
271 | KickUser(godID, UUID.Zero, agentID, kickMode, Util.StringToBytes1024(reason)); | ||
182 | } | 272 | } |
183 | } | 273 | } |
184 | } | 274 | } |
185 | } \ No newline at end of file | 275 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index af39565..feb5fb8 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | |||
@@ -156,6 +156,32 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
156 | return; | 156 | return; |
157 | } | 157 | } |
158 | 158 | ||
159 | //DateTime dt = DateTime.UtcNow; | ||
160 | |||
161 | // Ticks from UtcNow, but make it look like local. Evil, huh? | ||
162 | //dt = DateTime.SpecifyKind(dt, DateTimeKind.Local); | ||
163 | |||
164 | //try | ||
165 | //{ | ||
166 | // // Convert that to the PST timezone | ||
167 | // TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles"); | ||
168 | // dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo); | ||
169 | //} | ||
170 | //catch | ||
171 | //{ | ||
172 | // //m_log.Info("[OFFLINE MESSAGING]: No PST timezone found on this machine. Saving with local timestamp."); | ||
173 | //} | ||
174 | |||
175 | //// And make it look local again to fool the unix time util | ||
176 | //dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc); | ||
177 | |||
178 | // If client is null, this message comes from storage and IS offline | ||
179 | if (client != null) | ||
180 | im.offline = 0; | ||
181 | |||
182 | if (im.offline == 0) | ||
183 | im.timestamp = (uint)Util.UnixTimeSinceEpoch(); | ||
184 | |||
159 | if (m_TransferModule != null) | 185 | if (m_TransferModule != null) |
160 | { | 186 | { |
161 | if (client != null) | 187 | if (client != null) |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 77c7147..c1caf44 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -47,6 +47,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
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 | private bool m_Enabled = false; | 49 | private bool m_Enabled = false; |
50 | protected string m_MessageKey = String.Empty; | ||
50 | protected List<Scene> m_Scenes = new List<Scene>(); | 51 | protected List<Scene> m_Scenes = new List<Scene>(); |
51 | protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>(); | 52 | protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>(); |
52 | 53 | ||
@@ -66,14 +67,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
66 | public virtual void Initialise(IConfigSource config) | 67 | public virtual void Initialise(IConfigSource config) |
67 | { | 68 | { |
68 | IConfig cnf = config.Configs["Messaging"]; | 69 | IConfig cnf = config.Configs["Messaging"]; |
69 | if (cnf != null && cnf.GetString( | 70 | if (cnf != null) |
70 | "MessageTransferModule", "MessageTransferModule") != | ||
71 | "MessageTransferModule") | ||
72 | { | 71 | { |
73 | m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration"); | 72 | if (cnf.GetString("MessageTransferModule", |
74 | return; | 73 | "MessageTransferModule") != "MessageTransferModule") |
75 | } | 74 | { |
75 | return; | ||
76 | } | ||
76 | 77 | ||
78 | m_MessageKey = cnf.GetString("MessageKey", String.Empty); | ||
79 | } | ||
80 | m_log.Debug("[MESSAGE TRANSFER]: Module enabled"); | ||
77 | m_Enabled = true; | 81 | m_Enabled = true; |
78 | } | 82 | } |
79 | 83 | ||
@@ -145,8 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
145 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; | 149 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; |
146 | if (!user.IsChildAgent) | 150 | if (!user.IsChildAgent) |
147 | { | 151 | { |
148 | // Local message | 152 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); |
149 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID); | ||
150 | user.ControllingClient.SendInstantMessage(im); | 153 | user.ControllingClient.SendInstantMessage(im); |
151 | 154 | ||
152 | // Message sent | 155 | // Message sent |
@@ -168,7 +171,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
168 | // Local message | 171 | // Local message |
169 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; | 172 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; |
170 | 173 | ||
171 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); | 174 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); |
172 | user.ControllingClient.SendInstantMessage(im); | 175 | user.ControllingClient.SendInstantMessage(im); |
173 | 176 | ||
174 | // Message sent | 177 | // Message sent |
@@ -251,6 +254,19 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
251 | && requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id") | 254 | && requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id") |
252 | && requestData.ContainsKey("binary_bucket")) | 255 | && requestData.ContainsKey("binary_bucket")) |
253 | { | 256 | { |
257 | if (m_MessageKey != String.Empty) | ||
258 | { | ||
259 | XmlRpcResponse error_resp = new XmlRpcResponse(); | ||
260 | Hashtable error_respdata = new Hashtable(); | ||
261 | error_respdata["success"] = "FALSE"; | ||
262 | error_resp.Value = error_respdata; | ||
263 | |||
264 | if (!requestData.Contains("message_key")) | ||
265 | return error_resp; | ||
266 | if (m_MessageKey != (string)requestData["message_key"]) | ||
267 | return error_resp; | ||
268 | } | ||
269 | |||
254 | // Do the easy way of validating the UUIDs | 270 | // Do the easy way of validating the UUIDs |
255 | UUID.TryParse((string)requestData["from_agent_id"], out fromAgentID); | 271 | UUID.TryParse((string)requestData["from_agent_id"], out fromAgentID); |
256 | UUID.TryParse((string)requestData["to_agent_id"], out toAgentID); | 272 | UUID.TryParse((string)requestData["to_agent_id"], out toAgentID); |
@@ -433,24 +449,37 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
433 | return resp; | 449 | return resp; |
434 | } | 450 | } |
435 | 451 | ||
436 | /// <summary> | 452 | private delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result); |
437 | /// delegate for sending a grid instant message asynchronously | ||
438 | /// </summary> | ||
439 | public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID); | ||
440 | 453 | ||
441 | protected virtual void GridInstantMessageCompleted(IAsyncResult iar) | 454 | private class GIM { |
442 | { | 455 | public GridInstantMessage im; |
443 | GridInstantMessageDelegate icon = | 456 | public MessageResultNotification result; |
444 | (GridInstantMessageDelegate)iar.AsyncState; | 457 | }; |
445 | icon.EndInvoke(iar); | ||
446 | } | ||
447 | 458 | ||
459 | private Queue<GIM> pendingInstantMessages = new Queue<GIM>(); | ||
460 | private int numInstantMessageThreads = 0; | ||
448 | 461 | ||
449 | protected virtual void SendGridInstantMessageViaXMLRPC(GridInstantMessage im, MessageResultNotification result) | 462 | private void SendGridInstantMessageViaXMLRPC(GridInstantMessage im, MessageResultNotification result) |
450 | { | 463 | { |
451 | GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync; | 464 | lock (pendingInstantMessages) { |
465 | if (numInstantMessageThreads >= 4) { | ||
466 | GIM gim = new GIM(); | ||
467 | gim.im = im; | ||
468 | gim.result = result; | ||
469 | pendingInstantMessages.Enqueue(gim); | ||
470 | } else { | ||
471 | ++ numInstantMessageThreads; | ||
472 | //m_log.DebugFormat("[SendGridInstantMessageViaXMLRPC]: ++numInstantMessageThreads={0}", numInstantMessageThreads); | ||
473 | GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsyncMain; | ||
474 | d.BeginInvoke(im, result, GridInstantMessageCompleted, d); | ||
475 | } | ||
476 | } | ||
477 | } | ||
452 | 478 | ||
453 | d.BeginInvoke(im, result, UUID.Zero, GridInstantMessageCompleted, d); | 479 | private void GridInstantMessageCompleted(IAsyncResult iar) |
480 | { | ||
481 | GridInstantMessageDelegate d = (GridInstantMessageDelegate)iar.AsyncState; | ||
482 | d.EndInvoke(iar); | ||
454 | } | 483 | } |
455 | 484 | ||
456 | /// <summary> | 485 | /// <summary> |
@@ -465,8 +494,31 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
465 | /// Pass in 0 the first time this method is called. It will be called recursively with the last | 494 | /// Pass in 0 the first time this method is called. It will be called recursively with the last |
466 | /// regionhandle tried | 495 | /// regionhandle tried |
467 | /// </param> | 496 | /// </param> |
468 | protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID) | 497 | private void SendGridInstantMessageViaXMLRPCAsyncMain(GridInstantMessage im, MessageResultNotification result) |
469 | { | 498 | { |
499 | GIM gim; | ||
500 | do { | ||
501 | try { | ||
502 | SendGridInstantMessageViaXMLRPCAsync(im, result, UUID.Zero); | ||
503 | } catch (Exception e) { | ||
504 | m_log.Error("[SendGridInstantMessageViaXMLRPC]: exception " + e.Message); | ||
505 | } | ||
506 | lock (pendingInstantMessages) { | ||
507 | if (pendingInstantMessages.Count > 0) { | ||
508 | gim = pendingInstantMessages.Dequeue(); | ||
509 | im = gim.im; | ||
510 | result = gim.result; | ||
511 | } else { | ||
512 | gim = null; | ||
513 | -- numInstantMessageThreads; | ||
514 | //m_log.DebugFormat("[SendGridInstantMessageViaXMLRPC]: --numInstantMessageThreads={0}", numInstantMessageThreads); | ||
515 | } | ||
516 | } | ||
517 | } while (gim != null); | ||
518 | } | ||
519 | private void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID) | ||
520 | { | ||
521 | |||
470 | UUID toAgentID = new UUID(im.toAgentID); | 522 | UUID toAgentID = new UUID(im.toAgentID); |
471 | 523 | ||
472 | PresenceInfo upd = null; | 524 | PresenceInfo upd = null; |
@@ -533,7 +585,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
533 | 585 | ||
534 | if (upd != null) | 586 | if (upd != null) |
535 | { | 587 | { |
536 | GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, | 588 | GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(UUID.Zero, |
537 | upd.RegionID); | 589 | upd.RegionID); |
538 | if (reginfo != null) | 590 | if (reginfo != null) |
539 | { | 591 | { |
@@ -682,6 +734,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
682 | gim["position_z"] = msg.Position.Z.ToString(); | 734 | gim["position_z"] = msg.Position.Z.ToString(); |
683 | gim["region_id"] = msg.RegionID.ToString(); | 735 | gim["region_id"] = msg.RegionID.ToString(); |
684 | gim["binary_bucket"] = Convert.ToBase64String(msg.binaryBucket,Base64FormattingOptions.None); | 736 | gim["binary_bucket"] = Convert.ToBase64String(msg.binaryBucket,Base64FormattingOptions.None); |
737 | if (m_MessageKey != String.Empty) | ||
738 | gim["message_key"] = m_MessageKey; | ||
685 | return gim; | 739 | return gim; |
686 | } | 740 | } |
687 | 741 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 919ea33..1a0b914 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -171,13 +171,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
171 | 171 | ||
172 | private void RetrieveInstantMessages(IClientAPI client) | 172 | private void RetrieveInstantMessages(IClientAPI client) |
173 | { | 173 | { |
174 | if (m_RestURL != "") | 174 | if (m_RestURL == String.Empty) |
175 | { | 175 | return; |
176 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); | ||
177 | 176 | ||
178 | List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( | 177 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); |
178 | |||
179 | List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( | ||
179 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); | 180 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); |
180 | 181 | ||
182 | if (msglist != null) | ||
183 | { | ||
181 | foreach (GridInstantMessage im in msglist) | 184 | foreach (GridInstantMessage im in msglist) |
182 | { | 185 | { |
183 | // client.SendInstantMessage(im); | 186 | // client.SendInstantMessage(im); |
@@ -188,6 +191,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
188 | // Needed for proper state management for stored group | 191 | // Needed for proper state management for stored group |
189 | // invitations | 192 | // invitations |
190 | // | 193 | // |
194 | |||
195 | im.offline = 1; | ||
196 | |||
191 | Scene s = FindScene(client.AgentId); | 197 | Scene s = FindScene(client.AgentId); |
192 | if (s != null) | 198 | if (s != null) |
193 | s.EventManager.TriggerIncomingInstantMessage(im); | 199 | s.EventManager.TriggerIncomingInstantMessage(im); |
@@ -197,26 +203,38 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
197 | 203 | ||
198 | private void UndeliveredMessage(GridInstantMessage im) | 204 | private void UndeliveredMessage(GridInstantMessage im) |
199 | { | 205 | { |
200 | if ((im.offline != 0) | 206 | if (im.dialog != (byte)InstantMessageDialog.MessageFromObject && |
201 | && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) | 207 | im.dialog != (byte)InstantMessageDialog.MessageFromAgent && |
208 | im.dialog != (byte)InstantMessageDialog.GroupNotice && | ||
209 | im.dialog != (byte)InstantMessageDialog.GroupInvitation && | ||
210 | im.dialog != (byte)InstantMessageDialog.InventoryOffered) | ||
202 | { | 211 | { |
203 | bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( | 212 | return; |
204 | "POST", m_RestURL+"/SaveMessage/", im); | 213 | } |
205 | 214 | ||
206 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) | 215 | // It's not delivered. Make sure the scope id is saved |
207 | { | 216 | // We don't need the imSessionID here anymore, overwrite it |
208 | IClientAPI client = FindClient(new UUID(im.fromAgentID)); | 217 | Scene scene = FindScene(new UUID(im.fromAgentID)); |
209 | if (client == null) | 218 | if (scene == null) |
210 | return; | 219 | scene = m_SceneList[0]; |
211 | 220 | ||
212 | client.SendInstantMessage(new GridInstantMessage( | 221 | bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( |
213 | null, new UUID(im.toAgentID), | 222 | "POST", m_RestURL+"/SaveMessage/?scope=" + |
214 | "System", new UUID(im.fromAgentID), | 223 | scene.RegionInfo.ScopeID.ToString(), im); |
215 | (byte)InstantMessageDialog.MessageFromAgent, | 224 | |
216 | "User is not logged in. "+ | 225 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) |
217 | (success ? "Message saved." : "Message not saved"), | 226 | { |
218 | false, new Vector3())); | 227 | IClientAPI client = FindClient(new UUID(im.fromAgentID)); |
219 | } | 228 | if (client == null) |
229 | return; | ||
230 | |||
231 | client.SendInstantMessage(new GridInstantMessage( | ||
232 | null, new UUID(im.toAgentID), | ||
233 | "System", new UUID(im.fromAgentID), | ||
234 | (byte)InstantMessageDialog.MessageFromAgent, | ||
235 | "User is not logged in. "+ | ||
236 | (success ? "Message saved." : "Message not saved"), | ||
237 | false, new Vector3())); | ||
220 | } | 238 | } |
221 | } | 239 | } |
222 | } | 240 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index f3d2f26..2fff533 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -77,12 +77,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
77 | /// </value> | 77 | /// </value> |
78 | private Stream m_loadStream; | 78 | private Stream m_loadStream; |
79 | 79 | ||
80 | /// <summary> | 80 | protected bool m_controlFileLoaded; |
81 | /// FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things | ||
82 | /// (I thought they weren't). We will need to bump the version number and perform this check on all | ||
83 | /// subsequent IAR versions only | ||
84 | /// </summary> | ||
85 | protected bool m_controlFileLoaded = true; | ||
86 | protected bool m_assetsLoaded; | 81 | protected bool m_assetsLoaded; |
87 | protected bool m_inventoryNodesLoaded; | 82 | protected bool m_inventoryNodesLoaded; |
88 | 83 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index dc4900f..5e5f6c0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -139,9 +139,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
139 | 139 | ||
140 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) | 140 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) |
141 | { | 141 | { |
142 | if (options.ContainsKey("verbose")) | ||
143 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving item {0} with asset {1}", inventoryItem.ID, inventoryItem.AssetID); | ||
144 | |||
145 | string filename = path + CreateArchiveItemName(inventoryItem); | 142 | string filename = path + CreateArchiveItemName(inventoryItem); |
146 | 143 | ||
147 | // Record the creator of this item for user record purposes (which might go away soon) | 144 | // Record the creator of this item for user record purposes (which might go away soon) |
@@ -165,9 +162,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
165 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, | 162 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, |
166 | Dictionary<string, object> options, IUserAccountService userAccountService) | 163 | Dictionary<string, object> options, IUserAccountService userAccountService) |
167 | { | 164 | { |
168 | if (options.ContainsKey("verbose")) | ||
169 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving folder {0}", inventoryFolder.Name); | ||
170 | |||
171 | if (saveThisFolderItself) | 165 | if (saveThisFolderItself) |
172 | { | 166 | { |
173 | path += CreateArchiveFolderName(inventoryFolder); | 167 | path += CreateArchiveFolderName(inventoryFolder); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 576a154..613f0ed 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -122,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
122 | 122 | ||
123 | scene.AddCommand( | 123 | scene.AddCommand( |
124 | this, "save iar", | 124 | this, "save iar", |
125 | "save iar [--p|-profile=<url>] <first> <last> <inventory path> <password> [<IAR path>] [--v|-verbose]", | 125 | "save iar [--p|-profile=<url>] <first> <last> <inventory path> <password> [<IAR path>]", |
126 | "Save user inventory archive (IAR).", | 126 | "Save user inventory archive (IAR).", |
127 | "<first> is the user's first name." + Environment.NewLine | 127 | "<first> is the user's first name." + Environment.NewLine |
128 | + "<last> is the user's last name." + Environment.NewLine | 128 | + "<last> is the user's last name." + Environment.NewLine |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index e3d4969..528bc8d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -175,8 +175,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
175 | if (im.binaryBucket.Length < 17) // Invalid | 175 | if (im.binaryBucket.Length < 17) // Invalid |
176 | return; | 176 | return; |
177 | 177 | ||
178 | UUID receipientID = new UUID(im.toAgentID); | 178 | UUID recipientID = new UUID(im.toAgentID); |
179 | ScenePresence user = scene.GetScenePresence(receipientID); | 179 | ScenePresence user = scene.GetScenePresence(recipientID); |
180 | UUID copyID; | 180 | UUID copyID; |
181 | 181 | ||
182 | // First byte is the asset type | 182 | // First byte is the asset type |
@@ -191,7 +191,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
191 | folderID, new UUID(im.toAgentID)); | 191 | folderID, new UUID(im.toAgentID)); |
192 | 192 | ||
193 | InventoryFolderBase folderCopy | 193 | InventoryFolderBase folderCopy |
194 | = scene.GiveInventoryFolder(receipientID, client.AgentId, folderID, UUID.Zero); | 194 | = scene.GiveInventoryFolder(recipientID, client.AgentId, folderID, UUID.Zero); |
195 | 195 | ||
196 | if (folderCopy == null) | 196 | if (folderCopy == null) |
197 | { | 197 | { |
@@ -248,6 +248,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
248 | im.imSessionID = itemID.Guid; | 248 | im.imSessionID = itemID.Guid; |
249 | } | 249 | } |
250 | 250 | ||
251 | im.offline = 1; // Remember these | ||
252 | |||
251 | // Send the IM to the recipient. The item is already | 253 | // Send the IM to the recipient. The item is already |
252 | // in their inventory, so it will not be lost if | 254 | // in their inventory, so it will not be lost if |
253 | // they are offline. | 255 | // they are offline. |
@@ -417,22 +419,67 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
417 | /// | 419 | /// |
418 | /// </summary> | 420 | /// </summary> |
419 | /// <param name="msg"></param> | 421 | /// <param name="msg"></param> |
420 | private void OnGridInstantMessage(GridInstantMessage msg) | 422 | private void OnGridInstantMessage(GridInstantMessage im) |
421 | { | 423 | { |
422 | // Check if this is ours to handle | 424 | // Check if this is ours to handle |
423 | // | 425 | // |
424 | Scene scene = FindClientScene(new UUID(msg.toAgentID)); | 426 | Scene scene = FindClientScene(new UUID(im.toAgentID)); |
425 | 427 | ||
426 | if (scene == null) | 428 | if (scene == null) |
427 | return; | 429 | return; |
428 | 430 | ||
429 | // Find agent to deliver to | 431 | // Find agent to deliver to |
430 | // | 432 | // |
431 | ScenePresence user = scene.GetScenePresence(new UUID(msg.toAgentID)); | 433 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); |
434 | if (user == null) | ||
435 | return; | ||
436 | |||
437 | // This requires a little bit of processing because we have to make the | ||
438 | // new item visible in the recipient's inventory here | ||
439 | // | ||
440 | if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) | ||
441 | { | ||
442 | if (im.binaryBucket.Length < 17) // Invalid | ||
443 | return; | ||
444 | |||
445 | UUID recipientID = new UUID(im.toAgentID); | ||
446 | |||
447 | // First byte is the asset type | ||
448 | AssetType assetType = (AssetType)im.binaryBucket[0]; | ||
449 | |||
450 | if (AssetType.Folder == assetType) | ||
451 | { | ||
452 | UUID folderID = new UUID(im.binaryBucket, 1); | ||
453 | |||
454 | InventoryFolderBase given = | ||
455 | new InventoryFolderBase(folderID, recipientID); | ||
456 | InventoryFolderBase folder = | ||
457 | scene.InventoryService.GetFolder(given); | ||
458 | |||
459 | if (folder != null) | ||
460 | user.ControllingClient.SendBulkUpdateInventory(folder); | ||
461 | } | ||
462 | else | ||
463 | { | ||
464 | UUID itemID = new UUID(im.binaryBucket, 1); | ||
432 | 465 | ||
433 | // Just forward to local handling | 466 | InventoryItemBase given = |
434 | OnInstantMessage(user.ControllingClient, msg); | 467 | new InventoryItemBase(itemID, recipientID); |
468 | InventoryItemBase item = | ||
469 | scene.InventoryService.GetItem(given); | ||
435 | 470 | ||
471 | if (item != null) | ||
472 | { | ||
473 | user.ControllingClient.SendBulkUpdateInventory(item); | ||
474 | } | ||
475 | } | ||
476 | user.ControllingClient.SendInstantMessage(im); | ||
477 | } | ||
478 | else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted || | ||
479 | im.dialog == (byte) InstantMessageDialog.InventoryDeclined) | ||
480 | { | ||
481 | user.ControllingClient.SendInstantMessage(im); | ||
482 | } | ||
436 | } | 483 | } |
437 | } | 484 | } |
438 | } | 485 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index d1d7df2..a12b57a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | |||
@@ -146,16 +146,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
146 | scene.RegionInfo.RegionHandle, | 146 | scene.RegionInfo.RegionHandle, |
147 | (uint)presence.AbsolutePosition.X, | 147 | (uint)presence.AbsolutePosition.X, |
148 | (uint)presence.AbsolutePosition.Y, | 148 | (uint)presence.AbsolutePosition.Y, |
149 | (uint)presence.AbsolutePosition.Z); | 149 | (uint)presence.AbsolutePosition.Z + 2); |
150 | 150 | ||
151 | m_log.DebugFormat("TP invite with message {0}", message); | 151 | m_log.DebugFormat("[LURE]: TP invite with message {0}", message); |
152 | |||
153 | GridInstantMessage m; | ||
154 | |||
155 | if (scene.Permissions.IsAdministrator(client.AgentId) && presence.GodLevel >= 200 && (!scene.Permissions.IsAdministrator(targetid))) | ||
156 | { | ||
157 | m = new GridInstantMessage(scene, client.AgentId, | ||
158 | client.FirstName+" "+client.LastName, targetid, | ||
159 | (byte)InstantMessageDialog.GodLikeRequestTeleport, false, | ||
160 | message, dest, false, presence.AbsolutePosition, | ||
161 | new Byte[0]); | ||
162 | } | ||
163 | else | ||
164 | { | ||
165 | m = new GridInstantMessage(scene, client.AgentId, | ||
166 | client.FirstName+" "+client.LastName, targetid, | ||
167 | (byte)InstantMessageDialog.RequestTeleport, false, | ||
168 | message, dest, false, presence.AbsolutePosition, | ||
169 | new Byte[0]); | ||
170 | } | ||
152 | 171 | ||
153 | GridInstantMessage m = new GridInstantMessage(scene, client.AgentId, | ||
154 | client.FirstName+" "+client.LastName, targetid, | ||
155 | (byte)InstantMessageDialog.RequestTeleport, false, | ||
156 | message, dest, false, presence.AbsolutePosition, | ||
157 | new Byte[0]); | ||
158 | |||
159 | if (m_TransferModule != null) | 172 | if (m_TransferModule != null) |
160 | { | 173 | { |
161 | m_TransferModule.SendInstantMessage(m, | 174 | m_TransferModule.SendInstantMessage(m, |
@@ -190,7 +203,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
190 | { | 203 | { |
191 | // Forward remote teleport requests | 204 | // Forward remote teleport requests |
192 | // | 205 | // |
193 | if (msg.dialog != 22) | 206 | if (msg.dialog != (byte)InstantMessageDialog.RequestTeleport && |
207 | msg.dialog != (byte)InstantMessageDialog.GodLikeRequestTeleport) | ||
194 | return; | 208 | return; |
195 | 209 | ||
196 | if (m_TransferModule != null) | 210 | if (m_TransferModule != null) |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index c88be7d..138556f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
102 | 102 | ||
103 | protected virtual void OnNewClient(IClientAPI client) | 103 | protected virtual void OnNewClient(IClientAPI client) |
104 | { | 104 | { |
105 | client.OnTeleportHomeRequest += TeleportHome; | 105 | client.OnTeleportHomeRequest += TeleportHomeFired; |
106 | } | 106 | } |
107 | 107 | ||
108 | public virtual void Close() | 108 | public virtual void Close() |
@@ -180,6 +180,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
180 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 180 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
181 | 181 | ||
182 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 182 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
183 | sp.TeleportFlags = (TeleportFlags)teleportFlags; | ||
183 | sp.Teleport(position); | 184 | sp.Teleport(position); |
184 | 185 | ||
185 | foreach (SceneObjectGroup grp in sp.Attachments) | 186 | foreach (SceneObjectGroup grp in sp.Attachments) |
@@ -271,7 +272,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
271 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | 272 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, |
272 | // it's actually doing a lot of work. | 273 | // it's actually doing a lot of work. |
273 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; | 274 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; |
274 | if (endPoint.Address != null) | 275 | if (endPoint != null && endPoint.Address != null) |
275 | { | 276 | { |
276 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 277 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
277 | // both regions | 278 | // both regions |
@@ -519,7 +520,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
519 | 520 | ||
520 | protected void KillEntity(Scene scene, uint localID) | 521 | protected void KillEntity(Scene scene, uint localID) |
521 | { | 522 | { |
522 | scene.SendKillObject(localID); | 523 | scene.SendKillObject(new List<uint>() { localID }); |
523 | } | 524 | } |
524 | 525 | ||
525 | protected virtual GridRegion GetFinalDestination(GridRegion region) | 526 | protected virtual GridRegion GetFinalDestination(GridRegion region) |
@@ -557,7 +558,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
557 | 558 | ||
558 | #region Teleport Home | 559 | #region Teleport Home |
559 | 560 | ||
560 | public virtual void TeleportHome(UUID id, IClientAPI client) | 561 | public void TeleportHomeFired(UUID id, IClientAPI client) |
562 | { | ||
563 | TeleportHome(id, client); | ||
564 | } | ||
565 | |||
566 | public virtual bool TeleportHome(UUID id, IClientAPI client) | ||
561 | { | 567 | { |
562 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 568 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
563 | 569 | ||
@@ -566,12 +572,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
566 | 572 | ||
567 | if (uinfo != null) | 573 | if (uinfo != null) |
568 | { | 574 | { |
575 | if (uinfo.HomeRegionID == UUID.Zero) | ||
576 | { | ||
577 | // can't find the Home region: Tell viewer and abort | ||
578 | client.SendTeleportFailed("You don't have a home position set."); | ||
579 | return false; | ||
580 | } | ||
569 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); | 581 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); |
570 | if (regionInfo == null) | 582 | if (regionInfo == null) |
571 | { | 583 | { |
572 | // can't find the Home region: Tell viewer and abort | 584 | // can't find the Home region: Tell viewer and abort |
573 | client.SendTeleportFailed("Your home region could not be found."); | 585 | client.SendTeleportFailed("Your home region could not be found."); |
574 | return; | 586 | return false; |
575 | } | 587 | } |
576 | 588 | ||
577 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", | 589 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", |
@@ -582,6 +594,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
582 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, | 594 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, |
583 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); | 595 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); |
584 | } | 596 | } |
597 | else | ||
598 | { | ||
599 | // can't find the Home region: Tell viewer and abort | ||
600 | client.SendTeleportFailed("Your home region could not be found."); | ||
601 | return false; | ||
602 | } | ||
603 | return true; | ||
585 | } | 604 | } |
586 | 605 | ||
587 | #endregion | 606 | #endregion |
@@ -916,15 +935,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
916 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | 935 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); |
917 | 936 | ||
918 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | 937 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); |
919 | if (eq != null) | 938 | IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint; |
920 | { | 939 | if (neighbourExternal != null) |
921 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | ||
922 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
923 | } | ||
924 | else | ||
925 | { | 940 | { |
926 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | 941 | if (eq != null) |
927 | capsPath); | 942 | { |
943 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
944 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
945 | } | ||
946 | else | ||
947 | { | ||
948 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
949 | capsPath); | ||
950 | } | ||
928 | } | 951 | } |
929 | 952 | ||
930 | if (!WaitForCallback(agent.UUID)) | 953 | if (!WaitForCallback(agent.UUID)) |
@@ -1028,10 +1051,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1028 | agent.Id0 = currentAgentCircuit.Id0; | 1051 | agent.Id0 = currentAgentCircuit.Id0; |
1029 | } | 1052 | } |
1030 | 1053 | ||
1031 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1054 | IPEndPoint external = region.ExternalEndPoint; |
1032 | d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true, | 1055 | if (external != null) |
1056 | { | ||
1057 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
1058 | d.BeginInvoke(sp, agent, region, external, true, | ||
1033 | InformClientOfNeighbourCompleted, | 1059 | InformClientOfNeighbourCompleted, |
1034 | d); | 1060 | d); |
1061 | } | ||
1035 | } | 1062 | } |
1036 | #endregion | 1063 | #endregion |
1037 | 1064 | ||
@@ -1164,6 +1191,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1164 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1191 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; |
1165 | try | 1192 | try |
1166 | { | 1193 | { |
1194 | //neighbour.ExternalEndPoint may return null, which will be caught | ||
1167 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, | 1195 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, |
1168 | InformClientOfNeighbourCompleted, | 1196 | InformClientOfNeighbourCompleted, |
1169 | d); | 1197 | d); |
@@ -1267,8 +1295,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1267 | 1295 | ||
1268 | m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); | 1296 | m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); |
1269 | } | 1297 | } |
1270 | if (!regionAccepted) | ||
1271 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Region {0} did not accept agent: {1}", reg.RegionName, reason); | ||
1272 | } | 1298 | } |
1273 | 1299 | ||
1274 | /// <summary> | 1300 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 79e76b4..5a80100 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
86 | 86 | ||
87 | protected override void OnNewClient(IClientAPI client) | 87 | protected override void OnNewClient(IClientAPI client) |
88 | { | 88 | { |
89 | client.OnTeleportHomeRequest += TeleportHome; | 89 | client.OnTeleportHomeRequest += TeleportHomeFired; |
90 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); | 90 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); |
91 | } | 91 | } |
92 | 92 | ||
@@ -177,7 +177,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
177 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | 177 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); |
178 | } | 178 | } |
179 | 179 | ||
180 | public override void TeleportHome(UUID id, IClientAPI client) | 180 | public void TeleportHomeFired(UUID id, IClientAPI client) |
181 | { | ||
182 | TeleportHome(id, client); | ||
183 | } | ||
184 | |||
185 | public override bool TeleportHome(UUID id, IClientAPI client) | ||
181 | { | 186 | { |
182 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 187 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
183 | 188 | ||
@@ -187,8 +192,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
187 | { | 192 | { |
188 | // local grid user | 193 | // local grid user |
189 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); | 194 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); |
190 | base.TeleportHome(id, client); | 195 | return base.TeleportHome(id, client); |
191 | return; | ||
192 | } | 196 | } |
193 | 197 | ||
194 | // Foreign user wants to go home | 198 | // Foreign user wants to go home |
@@ -198,7 +202,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
198 | { | 202 | { |
199 | client.SendTeleportFailed("Your information has been lost"); | 203 | client.SendTeleportFailed("Your information has been lost"); |
200 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); | 204 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); |
201 | return; | 205 | return false; |
202 | } | 206 | } |
203 | 207 | ||
204 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); | 208 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); |
@@ -208,7 +212,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
208 | { | 212 | { |
209 | client.SendTeleportFailed("Your home region could not be found"); | 213 | client.SendTeleportFailed("Your home region could not be found"); |
210 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); | 214 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); |
211 | return; | 215 | return false; |
212 | } | 216 | } |
213 | 217 | ||
214 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); | 218 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); |
@@ -216,7 +220,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
216 | { | 220 | { |
217 | client.SendTeleportFailed("Internal error"); | 221 | client.SendTeleportFailed("Internal error"); |
218 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); | 222 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); |
219 | return; | 223 | return false; |
220 | } | 224 | } |
221 | 225 | ||
222 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | 226 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); |
@@ -226,6 +230,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
226 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); | 230 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); |
227 | 231 | ||
228 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); | 232 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); |
233 | return true; | ||
229 | } | 234 | } |
230 | #endregion | 235 | #endregion |
231 | 236 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 326ef28..6d40e12 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -251,7 +251,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | // This is method scoped and will be returned. It will be the | 254 | // This is pethod scoped and will be returned. It will be the |
255 | // last created asset id | 255 | // last created asset id |
256 | UUID assetID = UUID.Zero; | 256 | UUID assetID = UUID.Zero; |
257 | 257 | ||
@@ -259,8 +259,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
259 | // with distinct destinations as well. | 259 | // with distinct destinations as well. |
260 | foreach (List<SceneObjectGroup> objlist in deletes.Values) | 260 | foreach (List<SceneObjectGroup> objlist in deletes.Values) |
261 | { | 261 | { |
262 | CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero); | 262 | Dictionary<UUID, string> xmlStrings = |
263 | Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>(); | 263 | new Dictionary<UUID, string>(); |
264 | 264 | ||
265 | foreach (SceneObjectGroup objectGroup in objlist) | 265 | foreach (SceneObjectGroup objectGroup in objlist) |
266 | { | 266 | { |
@@ -274,7 +274,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
274 | : objectGroup.AbsolutePosition.Y, | 274 | : objectGroup.AbsolutePosition.Y, |
275 | objectGroup.AbsolutePosition.Z); | 275 | objectGroup.AbsolutePosition.Z); |
276 | 276 | ||
277 | originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; | 277 | Vector3 originalPosition = objectGroup.AbsolutePosition; |
278 | |||
279 | // Restore attachment data after trip through the sim | ||
280 | if (objectGroup.RootPart.AttachPoint > 0) | ||
281 | inventoryStoredPosition = objectGroup.RootPart.AttachOffset; | ||
282 | objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint; | ||
278 | 283 | ||
279 | objectGroup.AbsolutePosition = inventoryStoredPosition; | 284 | objectGroup.AbsolutePosition = inventoryStoredPosition; |
280 | 285 | ||
@@ -288,302 +293,304 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
288 | (uint)PermissionMask.Modify); | 293 | (uint)PermissionMask.Modify); |
289 | objectGroup.RootPart.NextOwnerMask |= | 294 | objectGroup.RootPart.NextOwnerMask |= |
290 | (uint)PermissionMask.Move; | 295 | (uint)PermissionMask.Move; |
291 | |||
292 | coa.Add(objectGroup); | ||
293 | } | ||
294 | 296 | ||
295 | string itemXml; | 297 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); |
296 | 298 | ||
297 | if (objlist.Count > 1) | 299 | objectGroup.AbsolutePosition = originalPosition; |
298 | itemXml = CoalescedSceneObjectsSerializer.ToXml(coa); | ||
299 | else | ||
300 | itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0]); | ||
301 | |||
302 | // Restore the position of each group now that it has been stored to inventory. | ||
303 | foreach (SceneObjectGroup objectGroup in objlist) | ||
304 | objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; | ||
305 | 300 | ||
306 | InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID); | 301 | xmlStrings[objectGroup.UUID] = sceneObjectXml; |
307 | if (item == null) | ||
308 | return UUID.Zero; | ||
309 | |||
310 | // Can't know creator is the same, so null it in inventory | ||
311 | if (objlist.Count > 1) | ||
312 | { | ||
313 | item.CreatorId = UUID.Zero.ToString(); | ||
314 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; | ||
315 | } | 302 | } |
316 | else | ||
317 | { | ||
318 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | ||
319 | item.SaleType = objlist[0].RootPart.ObjectSaleType; | ||
320 | item.SalePrice = objlist[0].RootPart.SalePrice; | ||
321 | } | ||
322 | 303 | ||
323 | AssetBase asset = CreateAsset( | 304 | string itemXml; |
324 | objlist[0].GetPartName(objlist[0].RootPart.LocalId), | ||
325 | objlist[0].GetPartDescription(objlist[0].RootPart.LocalId), | ||
326 | (sbyte)AssetType.Object, | ||
327 | Utils.StringToBytes(itemXml), | ||
328 | objlist[0].OwnerID.ToString()); | ||
329 | m_Scene.AssetService.Store(asset); | ||
330 | |||
331 | item.AssetID = asset.FullID; | ||
332 | assetID = asset.FullID; | ||
333 | 305 | ||
334 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | 306 | if (objlist.Count > 1) |
335 | { | ||
336 | m_Scene.InventoryService.UpdateItem(item); | ||
337 | } | ||
338 | else | ||
339 | { | 307 | { |
340 | AddPermissions(item, objlist[0], objlist, remoteClient); | 308 | float minX, minY, minZ; |
309 | float maxX, maxY, maxZ; | ||
341 | 310 | ||
342 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 311 | Vector3[] offsets = Scene.GetCombinedBoundingBox(objlist, |
343 | item.Description = asset.Description; | 312 | out minX, out maxX, out minY, out maxY, |
344 | item.Name = asset.Name; | 313 | out minZ, out maxZ); |
345 | item.AssetType = asset.Type; | ||
346 | 314 | ||
347 | m_Scene.AddInventoryItem(item); | 315 | // CreateWrapper |
316 | XmlDocument itemDoc = new XmlDocument(); | ||
317 | XmlElement root = itemDoc.CreateElement("", "CoalescedObject", ""); | ||
318 | itemDoc.AppendChild(root); | ||
348 | 319 | ||
349 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | 320 | // Embed the offsets into the group XML |
350 | { | 321 | for ( int i = 0 ; i < objlist.Count ; i++ ) |
351 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
352 | } | ||
353 | else | ||
354 | { | 322 | { |
355 | ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); | 323 | XmlDocument doc = new XmlDocument(); |
356 | if (notifyUser != null) | 324 | SceneObjectGroup g = objlist[i]; |
357 | { | 325 | doc.LoadXml(xmlStrings[g.UUID]); |
358 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | 326 | XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup"); |
359 | } | 327 | e.SetAttribute("offsetx", offsets[i].X.ToString()); |
328 | e.SetAttribute("offsety", offsets[i].Y.ToString()); | ||
329 | e.SetAttribute("offsetz", offsets[i].Z.ToString()); | ||
330 | |||
331 | XmlNode objectNode = itemDoc.ImportNode(e, true); | ||
332 | root.AppendChild(objectNode); | ||
360 | } | 333 | } |
361 | } | ||
362 | 334 | ||
363 | // This is a hook to do some per-asset post-processing for subclasses that need that | 335 | float sizeX = maxX - minX; |
364 | ExportAsset(remoteClient.AgentId, assetID); | 336 | float sizeY = maxY - minY; |
365 | } | 337 | float sizeZ = maxZ - minZ; |
366 | |||
367 | return assetID; | ||
368 | } | ||
369 | 338 | ||
370 | protected virtual void ExportAsset(UUID agentID, UUID assetID) | 339 | root.SetAttribute("x", sizeX.ToString()); |
371 | { | 340 | root.SetAttribute("y", sizeY.ToString()); |
372 | // nothing to do here | 341 | root.SetAttribute("z", sizeZ.ToString()); |
373 | } | ||
374 | |||
375 | /// <summary> | ||
376 | /// Add relevant permissions for an object to the item. | ||
377 | /// </summary> | ||
378 | /// <param name="item"></param> | ||
379 | /// <param name="so"></param> | ||
380 | /// <param name="objsForEffectivePermissions"></param> | ||
381 | /// <param name="remoteClient"></param> | ||
382 | /// <returns></returns> | ||
383 | protected InventoryItemBase AddPermissions( | ||
384 | InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions, | ||
385 | IClientAPI remoteClient) | ||
386 | { | ||
387 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; | ||
388 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) | ||
389 | effectivePerms &= grp.GetEffectivePermissions(); | ||
390 | effectivePerms |= (uint)PermissionMask.Move; | ||
391 | |||
392 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | ||
393 | { | ||
394 | uint perms = effectivePerms; | ||
395 | uint nextPerms = (perms & 7) << 13; | ||
396 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
397 | perms &= ~(uint)PermissionMask.Copy; | ||
398 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
399 | perms &= ~(uint)PermissionMask.Transfer; | ||
400 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
401 | perms &= ~(uint)PermissionMask.Modify; | ||
402 | |||
403 | item.BasePermissions = perms & so.RootPart.NextOwnerMask; | ||
404 | item.CurrentPermissions = item.BasePermissions; | ||
405 | item.NextPermissions = perms & so.RootPart.NextOwnerMask; | ||
406 | item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; | ||
407 | item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; | ||
408 | |||
409 | // Magic number badness. Maybe this deserves an enum. | ||
410 | // bit 4 (16) is the "Slam" bit, it means treat as passed | ||
411 | // and apply next owner perms on rez | ||
412 | item.CurrentPermissions |= 16; // Slam! | ||
413 | } | ||
414 | else | ||
415 | { | ||
416 | item.BasePermissions = effectivePerms; | ||
417 | item.CurrentPermissions = effectivePerms; | ||
418 | item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms; | ||
419 | item.EveryOnePermissions = so.RootPart.EveryoneMask & effectivePerms; | ||
420 | item.GroupPermissions = so.RootPart.GroupMask & effectivePerms; | ||
421 | |||
422 | item.CurrentPermissions &= | ||
423 | ((uint)PermissionMask.Copy | | ||
424 | (uint)PermissionMask.Transfer | | ||
425 | (uint)PermissionMask.Modify | | ||
426 | (uint)PermissionMask.Move | | ||
427 | 7); // Preserve folded permissions | ||
428 | } | ||
429 | |||
430 | return item; | ||
431 | } | ||
432 | |||
433 | /// <summary> | ||
434 | /// Create an item using details for the given scene object. | ||
435 | /// </summary> | ||
436 | /// <param name="action"></param> | ||
437 | /// <param name="remoteClient"></param> | ||
438 | /// <param name="so"></param> | ||
439 | /// <param name="folderID"></param> | ||
440 | /// <returns></returns> | ||
441 | protected InventoryItemBase CreateItemForObject( | ||
442 | DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID) | ||
443 | { | ||
444 | // Get the user info of the item destination | ||
445 | // | ||
446 | UUID userID = UUID.Zero; | ||
447 | 342 | ||
448 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || | 343 | itemXml = itemDoc.InnerXml; |
449 | action == DeRezAction.SaveToExistingUserInventoryItem) | 344 | } |
450 | { | 345 | else |
451 | // Take or take copy require a taker | 346 | { |
452 | // Saving changes requires a local user | 347 | itemXml = xmlStrings[objlist[0].UUID]; |
453 | // | 348 | } |
454 | if (remoteClient == null) | ||
455 | return null; | ||
456 | 349 | ||
457 | userID = remoteClient.AgentId; | 350 | // Get the user info of the item destination |
458 | } | ||
459 | else | ||
460 | { | ||
461 | // All returns / deletes go to the object owner | ||
462 | // | 351 | // |
463 | userID = so.RootPart.OwnerID; | 352 | UUID userID = UUID.Zero; |
464 | } | ||
465 | |||
466 | if (userID == UUID.Zero) // Can't proceed | ||
467 | { | ||
468 | return null; | ||
469 | } | ||
470 | 353 | ||
471 | // If we're returning someone's item, it goes back to the | 354 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || |
472 | // owner's Lost And Found folder. | 355 | action == DeRezAction.SaveToExistingUserInventoryItem) |
473 | // Delete is treated like return in this case | 356 | { |
474 | // Deleting your own items makes them go to trash | 357 | // Take or take copy require a taker |
475 | // | 358 | // Saving changes requires a local user |
476 | 359 | // | |
477 | InventoryFolderBase folder = null; | 360 | if (remoteClient == null) |
478 | InventoryItemBase item = null; | 361 | return UUID.Zero; |
479 | 362 | ||
480 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | 363 | userID = remoteClient.AgentId; |
481 | { | 364 | } |
482 | item = new InventoryItemBase(so.RootPart.FromUserInventoryItemID, userID); | 365 | else |
483 | item = m_Scene.InventoryService.GetItem(item); | 366 | { |
367 | // All returns / deletes go to the object owner | ||
368 | // | ||
484 | 369 | ||
485 | //item = userInfo.RootFolder.FindItem( | 370 | userID = objlist[0].RootPart.OwnerID; |
486 | // objectGroup.RootPart.FromUserInventoryItemID); | 371 | } |
487 | 372 | ||
488 | if (null == item) | 373 | if (userID == UUID.Zero) // Can't proceed |
489 | { | 374 | { |
490 | m_log.DebugFormat( | 375 | return UUID.Zero; |
491 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | ||
492 | so.Name, so.UUID); | ||
493 | |||
494 | return null; | ||
495 | } | 376 | } |
496 | } | 377 | |
497 | else | 378 | // If we're returning someone's item, it goes back to the |
498 | { | 379 | // owner's Lost And Found folder. |
499 | // Folder magic | 380 | // Delete is treated like return in this case |
381 | // Deleting your own items makes them go to trash | ||
500 | // | 382 | // |
501 | if (action == DeRezAction.Delete) | 383 | |
384 | InventoryFolderBase folder = null; | ||
385 | InventoryItemBase item = null; | ||
386 | |||
387 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
502 | { | 388 | { |
503 | // Deleting someone else's item | 389 | item = new InventoryItemBase(objlist[0].RootPart.FromUserInventoryItemID, userID); |
504 | // | 390 | item = m_Scene.InventoryService.GetItem(item); |
505 | if (remoteClient == null || | 391 | |
506 | so.OwnerID != remoteClient.AgentId) | 392 | //item = userInfo.RootFolder.FindItem( |
507 | { | 393 | // objectGroup.RootPart.FromUserInventoryItemID); |
508 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 394 | |
509 | } | 395 | if (null == item) |
510 | else | ||
511 | { | 396 | { |
512 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | 397 | m_log.DebugFormat( |
398 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | ||
399 | objlist[0].Name, objlist[0].UUID); | ||
400 | return UUID.Zero; | ||
513 | } | 401 | } |
514 | } | 402 | } |
515 | else if (action == DeRezAction.Return) | 403 | else |
516 | { | 404 | { |
517 | // Dump to lost + found unconditionally | 405 | // Folder magic |
518 | // | 406 | // |
519 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
520 | } | ||
521 | |||
522 | if (folderID == UUID.Zero && folder == null) | ||
523 | { | ||
524 | if (action == DeRezAction.Delete) | 407 | if (action == DeRezAction.Delete) |
525 | { | 408 | { |
526 | // Deletes go to trash by default | 409 | // Deleting someone else's item |
527 | // | 410 | // |
528 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | 411 | if (remoteClient == null || |
412 | objlist[0].OwnerID != remoteClient.AgentId) | ||
413 | { | ||
414 | |||
415 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
416 | } | ||
417 | else | ||
418 | { | ||
419 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
420 | } | ||
529 | } | 421 | } |
530 | else | 422 | else if (action == DeRezAction.Return) |
423 | { | ||
424 | |||
425 | // Dump to lost + found unconditionally | ||
426 | // | ||
427 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
428 | } | ||
429 | |||
430 | if (folderID == UUID.Zero && folder == null) | ||
531 | { | 431 | { |
532 | if (remoteClient == null || so.OwnerID != remoteClient.AgentId) | 432 | if (action == DeRezAction.Delete) |
533 | { | 433 | { |
534 | // Taking copy of another person's item. Take to | 434 | // Deletes go to trash by default |
535 | // Objects folder. | 435 | // |
536 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); | 436 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); |
537 | } | 437 | } |
538 | else | 438 | else |
539 | { | 439 | { |
540 | // Catch all. Use lost & found | 440 | if (remoteClient == null || |
541 | // | 441 | objlist[0].OwnerID != remoteClient.AgentId) |
442 | { | ||
443 | // Taking copy of another person's item. Take to | ||
444 | // Objects folder. | ||
445 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); | ||
446 | } | ||
447 | else | ||
448 | { | ||
449 | // Catch all. Use lost & found | ||
450 | // | ||
542 | 451 | ||
543 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 452 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
453 | } | ||
544 | } | 454 | } |
545 | } | 455 | } |
546 | } | ||
547 | 456 | ||
548 | // Override and put into where it came from, if it came | 457 | // Override and put into where it came from, if it came |
549 | // from anywhere in inventory | 458 | // from anywhere in inventory |
550 | // | 459 | // |
551 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) | 460 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) |
552 | { | 461 | { |
553 | if (so.RootPart.FromFolderID != UUID.Zero) | 462 | if (objlist[0].RootPart.FromFolderID != UUID.Zero && objlist[0].OwnerID == remoteClient.AgentId) |
463 | { | ||
464 | InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID); | ||
465 | folder = m_Scene.InventoryService.GetFolder(f); | ||
466 | } | ||
467 | } | ||
468 | |||
469 | if (folder == null) // None of the above | ||
470 | { | ||
471 | folder = new InventoryFolderBase(folderID); | ||
472 | |||
473 | if (folder == null) // Nowhere to put it | ||
474 | { | ||
475 | return UUID.Zero; | ||
476 | } | ||
477 | } | ||
478 | |||
479 | item = new InventoryItemBase(); | ||
480 | // Can't know creator is the same, so null it in inventory | ||
481 | if (objlist.Count > 1) | ||
482 | { | ||
483 | item.CreatorId = UUID.Zero.ToString(); | ||
484 | item.CreatorData = String.Empty; | ||
485 | } | ||
486 | else | ||
487 | { | ||
488 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | ||
489 | item.CreatorData = objlist[0].RootPart.CreatorData; | ||
490 | } | ||
491 | item.ID = UUID.Random(); | ||
492 | item.InvType = (int)InventoryType.Object; | ||
493 | item.Folder = folder.ID; | ||
494 | item.Owner = userID; | ||
495 | if (objlist.Count > 1) | ||
554 | { | 496 | { |
555 | InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID); | 497 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; |
556 | folder = m_Scene.InventoryService.GetFolder(f); | 498 | } |
499 | else | ||
500 | { | ||
501 | item.SaleType = objlist[0].RootPart.ObjectSaleType; | ||
502 | item.SalePrice = objlist[0].RootPart.SalePrice; | ||
557 | } | 503 | } |
558 | } | 504 | } |
559 | 505 | ||
560 | if (folder == null) // None of the above | 506 | AssetBase asset = CreateAsset( |
507 | objlist[0].GetPartName(objlist[0].RootPart.LocalId), | ||
508 | objlist[0].GetPartDescription(objlist[0].RootPart.LocalId), | ||
509 | (sbyte)AssetType.Object, | ||
510 | Utils.StringToBytes(itemXml), | ||
511 | objlist[0].OwnerID.ToString()); | ||
512 | m_Scene.AssetService.Store(asset); | ||
513 | assetID = asset.FullID; | ||
514 | |||
515 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
561 | { | 516 | { |
562 | folder = new InventoryFolderBase(folderID); | 517 | item.AssetID = asset.FullID; |
518 | m_Scene.InventoryService.UpdateItem(item); | ||
519 | } | ||
520 | else | ||
521 | { | ||
522 | item.AssetID = asset.FullID; | ||
563 | 523 | ||
564 | if (folder == null) // Nowhere to put it | 524 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; |
525 | foreach (SceneObjectGroup grp in objlist) | ||
526 | effectivePerms &= grp.GetEffectivePermissions(); | ||
527 | effectivePerms |= (uint)PermissionMask.Move; | ||
528 | |||
529 | if (remoteClient != null && (remoteClient.AgentId != objlist[0].RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | ||
565 | { | 530 | { |
566 | return null; | 531 | uint perms = effectivePerms; |
532 | uint nextPerms = (perms & 7) << 13; | ||
533 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
534 | perms &= ~(uint)PermissionMask.Copy; | ||
535 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
536 | perms &= ~(uint)PermissionMask.Transfer; | ||
537 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
538 | perms &= ~(uint)PermissionMask.Modify; | ||
539 | |||
540 | item.BasePermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
541 | item.CurrentPermissions = item.BasePermissions; | ||
542 | item.NextPermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
543 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask; | ||
544 | item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask; | ||
545 | |||
546 | item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | ||
547 | } | ||
548 | else | ||
549 | { | ||
550 | item.BasePermissions = effectivePerms; | ||
551 | item.CurrentPermissions = effectivePerms; | ||
552 | item.NextPermissions = objlist[0].RootPart.NextOwnerMask & effectivePerms; | ||
553 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & effectivePerms; | ||
554 | item.GroupPermissions = objlist[0].RootPart.GroupMask & effectivePerms; | ||
555 | |||
556 | item.CurrentPermissions &= | ||
557 | ((uint)PermissionMask.Copy | | ||
558 | (uint)PermissionMask.Transfer | | ||
559 | (uint)PermissionMask.Modify | | ||
560 | (uint)PermissionMask.Move | | ||
561 | 7); // Preserve folded permissions | ||
567 | } | 562 | } |
568 | } | ||
569 | 563 | ||
570 | item = new InventoryItemBase(); | 564 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
571 | item.ID = UUID.Random(); | 565 | item.Description = asset.Description; |
572 | item.InvType = (int)InventoryType.Object; | 566 | item.Name = asset.Name; |
573 | item.Folder = folder.ID; | 567 | item.AssetType = asset.Type; |
574 | item.Owner = userID; | 568 | |
575 | } | 569 | m_Scene.AddInventoryItem(item); |
576 | 570 | ||
577 | return item; | 571 | if (remoteClient != null && item.Owner == remoteClient.AgentId) |
572 | { | ||
573 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
574 | } | ||
575 | else | ||
576 | { | ||
577 | ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); | ||
578 | if (notifyUser != null) | ||
579 | { | ||
580 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | ||
581 | } | ||
582 | } | ||
583 | } | ||
584 | } | ||
585 | return assetID; | ||
578 | } | 586 | } |
579 | 587 | ||
588 | |||
580 | /// <summary> | 589 | /// <summary> |
581 | /// Rez an object into the scene from the user's inventory | 590 | /// Rez an object into the scene from the user's inventory |
582 | /// </summary> | 591 | /// </summary> |
583 | /// <remarks> | ||
584 | /// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing | 592 | /// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing |
585 | /// things to the scene. The caller should be doing that, I think. | 593 | /// things to the scene. The caller should be doing that, I think. |
586 | /// </remarks> | ||
587 | /// <param name="remoteClient"></param> | 594 | /// <param name="remoteClient"></param> |
588 | /// <param name="itemID"></param> | 595 | /// <param name="itemID"></param> |
589 | /// <param name="RayEnd"></param> | 596 | /// <param name="RayEnd"></param> |
@@ -600,10 +607,21 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
600 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 607 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, |
601 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | 608 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) |
602 | { | 609 | { |
603 | // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); | 610 | // Work out position details |
604 | 611 | byte bRayEndIsIntersection = (byte)0; | |
605 | byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0); | 612 | |
613 | if (RayEndIsIntersection) | ||
614 | { | ||
615 | bRayEndIsIntersection = (byte)1; | ||
616 | } | ||
617 | else | ||
618 | { | ||
619 | bRayEndIsIntersection = (byte)0; | ||
620 | } | ||
621 | |||
606 | Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); | 622 | Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); |
623 | |||
624 | |||
607 | Vector3 pos = m_Scene.GetNewRezLocation( | 625 | Vector3 pos = m_Scene.GetNewRezLocation( |
608 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | 626 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, |
609 | BypassRayCast, bRayEndIsIntersection, true, scale, false); | 627 | BypassRayCast, bRayEndIsIntersection, true, scale, false); |
@@ -614,6 +632,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
614 | 632 | ||
615 | if (item != null) | 633 | if (item != null) |
616 | { | 634 | { |
635 | if (item.ID == UUID.Zero) | ||
636 | { | ||
637 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 1"); | ||
638 | } | ||
617 | item.Owner = remoteClient.AgentId; | 639 | item.Owner = remoteClient.AgentId; |
618 | 640 | ||
619 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); | 641 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); |
@@ -642,6 +664,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
642 | } | 664 | } |
643 | } | 665 | } |
644 | 666 | ||
667 | if (item.ID == UUID.Zero) | ||
668 | { | ||
669 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 2"); | ||
670 | } | ||
671 | |||
645 | string xmlData = Utils.BytesToString(rezAsset.Data); | 672 | string xmlData = Utils.BytesToString(rezAsset.Data); |
646 | List<SceneObjectGroup> objlist = | 673 | List<SceneObjectGroup> objlist = |
647 | new List<SceneObjectGroup>(); | 674 | new List<SceneObjectGroup>(); |
@@ -687,18 +714,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
687 | itemId, n.OuterXml); | 714 | itemId, n.OuterXml); |
688 | objlist.Add(g); | 715 | objlist.Add(g); |
689 | XmlElement el = (XmlElement)n; | 716 | XmlElement el = (XmlElement)n; |
690 | 717 | float x = Convert.ToSingle(el.GetAttribute("offsetx")); | |
691 | string rawX = el.GetAttribute("offsetx"); | 718 | float y = Convert.ToSingle(el.GetAttribute("offsety")); |
692 | string rawY = el.GetAttribute("offsety"); | 719 | float z = Convert.ToSingle(el.GetAttribute("offsetz")); |
693 | string rawZ = el.GetAttribute("offsetz"); | ||
694 | // | ||
695 | // m_log.DebugFormat( | ||
696 | // "[INVENTORY ACCESS MODULE]: Converting coalesced object {0} offset <{1}, {2}, {3}>", | ||
697 | // g.Name, rawX, rawY, rawZ); | ||
698 | |||
699 | float x = Convert.ToSingle(rawX); | ||
700 | float y = Convert.ToSingle(rawY); | ||
701 | float z = Convert.ToSingle(rawZ); | ||
702 | veclist.Add(new Vector3(x, y, z)); | 720 | veclist.Add(new Vector3(x, y, z)); |
703 | } | 721 | } |
704 | } | 722 | } |
@@ -741,21 +759,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
741 | foreach (SceneObjectPart child in group.Parts) | 759 | foreach (SceneObjectPart child in group.Parts) |
742 | child.CreateSelected = true; | 760 | child.CreateSelected = true; |
743 | } | 761 | } |
762 | |||
744 | group.ResetIDs(); | 763 | group.ResetIDs(); |
745 | 764 | ||
746 | if (attachment) | 765 | if (attachment) |
747 | { | 766 | { |
748 | group.RootPart.Flags |= PrimFlags.Phantom; | 767 | group.RootPart.Flags |= PrimFlags.Phantom; |
749 | group.RootPart.IsAttachment = true; | 768 | group.RootPart.IsAttachment = true; |
750 | } | ||
751 | 769 | ||
752 | // If we're rezzing an attachment then don't ask | 770 | // If we're rezzing an attachment then don't ask |
753 | // AddNewSceneObject() to update the client since | 771 | // AddNewSceneObject() to update the client since |
754 | // we'll be doing that later on. Scheduling more than | 772 | // we'll be doing that later on. Scheduling more |
755 | // one full update during the attachment | 773 | // than one full update during the attachment |
756 | // process causes some clients to fail to display the | 774 | // process causes some clients to fail to display |
757 | // attachment properly. | 775 | // the attachment properly. |
758 | m_Scene.AddNewSceneObject(group, true, false); | 776 | // Also, don't persist attachments. |
777 | m_Scene.AddNewSceneObject(group, false, false); | ||
778 | } | ||
779 | else | ||
780 | { | ||
781 | m_Scene.AddNewSceneObject(group, true, false); | ||
782 | } | ||
759 | 783 | ||
760 | // if attachment we set it's asset id so object updates | 784 | // if attachment we set it's asset id so object updates |
761 | // can reflect that, if not, we set it's position in world. | 785 | // can reflect that, if not, we set it's position in world. |
@@ -790,19 +814,24 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
790 | // affect the name stored in the serialization, transfer | 814 | // affect the name stored in the serialization, transfer |
791 | // the correct name from the inventory to the | 815 | // the correct name from the inventory to the |
792 | // object itself before we rez. | 816 | // object itself before we rez. |
793 | // | 817 | // On coalesced objects, do the first one |
794 | // Only do these for the first object if we are rezzing a coalescence. | 818 | if (((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) || i == 0) |
795 | if (i == 0) | ||
796 | { | 819 | { |
797 | rootPart.Name = item.Name; | 820 | rootPart.Name = item.Name; |
798 | rootPart.Description = item.Description; | 821 | rootPart.Description = item.Description; |
822 | } | ||
823 | if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0) | ||
824 | { | ||
799 | rootPart.ObjectSaleType = item.SaleType; | 825 | rootPart.ObjectSaleType = item.SaleType; |
800 | rootPart.SalePrice = item.SalePrice; | 826 | rootPart.SalePrice = item.SalePrice; |
801 | } | 827 | } |
802 | 828 | ||
803 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | 829 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); |
830 | // TODO: Remove the magic number badness | ||
831 | |||
804 | if ((rootPart.OwnerID != item.Owner) || | 832 | if ((rootPart.OwnerID != item.Owner) || |
805 | (item.CurrentPermissions & 16) != 0) | 833 | (item.CurrentPermissions & 16) != 0 || // Magic number |
834 | (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) | ||
806 | { | 835 | { |
807 | //Need to kill the for sale here | 836 | //Need to kill the for sale here |
808 | rootPart.ObjectSaleType = 0; | 837 | rootPart.ObjectSaleType = 0; |
@@ -814,28 +843,34 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
814 | { | 843 | { |
815 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | 844 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) |
816 | { | 845 | { |
817 | part.EveryoneMask = item.EveryOnePermissions; | 846 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) |
818 | part.NextOwnerMask = item.NextPermissions; | 847 | part.EveryoneMask = item.EveryOnePermissions; |
848 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
849 | part.NextOwnerMask = item.NextPermissions; | ||
850 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
851 | part.GroupMask = item.GroupPermissions; | ||
819 | } | 852 | } |
820 | part.GroupMask = 0; // DO NOT propagate here | ||
821 | } | 853 | } |
822 | 854 | ||
855 | foreach (SceneObjectPart part in group.Parts) | ||
856 | { | ||
857 | part.LastOwnerID = part.OwnerID; | ||
858 | part.OwnerID = item.Owner; | ||
859 | part.Inventory.ChangeInventoryOwner(item.Owner); | ||
860 | } | ||
861 | |||
823 | group.ApplyNextOwnerPermissions(); | 862 | group.ApplyNextOwnerPermissions(); |
824 | } | 863 | } |
825 | } | 864 | } |
826 | 865 | ||
827 | foreach (SceneObjectPart part in group.Parts) | 866 | foreach (SceneObjectPart part in group.Parts) |
828 | { | 867 | { |
829 | if ((part.OwnerID != item.Owner) || | 868 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) |
830 | (item.CurrentPermissions & 16) != 0) | 869 | part.EveryoneMask = item.EveryOnePermissions; |
831 | { | 870 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) |
832 | part.LastOwnerID = part.OwnerID; | 871 | part.NextOwnerMask = item.NextPermissions; |
833 | part.OwnerID = item.Owner; | 872 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) |
834 | part.Inventory.ChangeInventoryOwner(item.Owner); | 873 | part.GroupMask = item.GroupPermissions; |
835 | part.GroupMask = 0; // DO NOT propagate here | ||
836 | } | ||
837 | part.EveryoneMask = item.EveryOnePermissions; | ||
838 | part.NextOwnerMask = item.NextPermissions; | ||
839 | } | 874 | } |
840 | 875 | ||
841 | rootPart.TrimPermissions(); | 876 | rootPart.TrimPermissions(); |
@@ -843,7 +878,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
843 | if (!attachment) | 878 | if (!attachment) |
844 | { | 879 | { |
845 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | 880 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) |
881 | { | ||
882 | // Save attachment data | ||
883 | group.RootPart.AttachPoint = group.RootPart.Shape.State; | ||
884 | group.RootPart.AttachOffset = storedPosition; | ||
885 | |||
846 | group.ClearPartAttachmentData(); | 886 | group.ClearPartAttachmentData(); |
887 | } | ||
847 | 888 | ||
848 | // Fire on_rez | 889 | // Fire on_rez |
849 | group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); | 890 | group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); |
@@ -972,5 +1013,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
972 | } | 1013 | } |
973 | 1014 | ||
974 | #endregion | 1015 | #endregion |
1016 | |||
1017 | protected virtual void ExportAsset(UUID agentID, UUID assetID) | ||
1018 | { | ||
1019 | } | ||
975 | } | 1020 | } |
976 | } | 1021 | } |
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 4c8424d..5e28ee1 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -118,7 +118,15 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
118 | return true; | 118 | return true; |
119 | } | 119 | } |
120 | 120 | ||
121 | return chain.Build(new X509Certificate2(certificate)); | 121 | if ((((int)sslPolicyErrors) & ~4) != 0) |
122 | return false; | ||
123 | |||
124 | if (ServicePointManager.CertificatePolicy != null) | ||
125 | { | ||
126 | ServicePoint sp = Request.ServicePoint; | ||
127 | return ServicePointManager.CertificatePolicy.CheckValidationResult (sp, certificate, Request, 0); | ||
128 | } | ||
129 | return true; | ||
122 | } | 130 | } |
123 | #region IHttpRequestModule Members | 131 | #region IHttpRequestModule Members |
124 | 132 | ||
@@ -358,6 +366,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
358 | try | 366 | try |
359 | { | 367 | { |
360 | Request = (HttpWebRequest) WebRequest.Create(Url); | 368 | Request = (HttpWebRequest) WebRequest.Create(Url); |
369 | |||
370 | //This works around some buggy HTTP Servers like Lighttpd | ||
371 | Request.ServicePoint.Expect100Continue = false; | ||
372 | |||
361 | Request.Method = HttpMethod; | 373 | Request.Method = HttpMethod; |
362 | Request.ContentType = HttpMIMEType; | 374 | Request.ContentType = HttpMIMEType; |
363 | 375 | ||
@@ -432,7 +444,17 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
432 | { | 444 | { |
433 | HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; | 445 | HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; |
434 | Status = (int)webRsp.StatusCode; | 446 | Status = (int)webRsp.StatusCode; |
435 | ResponseBody = webRsp.StatusDescription; | 447 | try |
448 | { | ||
449 | using (Stream responseStream = webRsp.GetResponseStream()) | ||
450 | { | ||
451 | ResponseBody = responseStream.GetStreamString(); | ||
452 | } | ||
453 | } | ||
454 | catch | ||
455 | { | ||
456 | ResponseBody = webRsp.StatusDescription; | ||
457 | } | ||
436 | } | 458 | } |
437 | else | 459 | else |
438 | { | 460 | { |
@@ -464,4 +486,4 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
464 | } | 486 | } |
465 | } | 487 | } |
466 | } | 488 | } |
467 | } \ No newline at end of file | 489 | } |
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 9b565ed..bdbd0c2 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -60,6 +60,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
60 | //public ManualResetEvent ev; | 60 | //public ManualResetEvent ev; |
61 | public bool requestDone; | 61 | public bool requestDone; |
62 | public int startTime; | 62 | public int startTime; |
63 | public bool responseSent; | ||
63 | public string uri; | 64 | public string uri; |
64 | } | 65 | } |
65 | 66 | ||
@@ -76,7 +77,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
76 | new Dictionary<string, UrlData>(); | 77 | new Dictionary<string, UrlData>(); |
77 | 78 | ||
78 | 79 | ||
79 | private int m_TotalUrls = 100; | 80 | private int m_TotalUrls = 5000; |
80 | 81 | ||
81 | private IHttpServer m_HttpServer = null; | 82 | private IHttpServer m_HttpServer = null; |
82 | 83 | ||
@@ -142,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
142 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 143 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); |
143 | return urlcode; | 144 | return urlcode; |
144 | } | 145 | } |
145 | string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/"; | 146 | string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString(); |
146 | 147 | ||
147 | UrlData urlData = new UrlData(); | 148 | UrlData urlData = new UrlData(); |
148 | urlData.hostID = host.UUID; | 149 | urlData.hostID = host.UUID; |
@@ -152,10 +153,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
152 | urlData.urlcode = urlcode; | 153 | urlData.urlcode = urlcode; |
153 | urlData.requests = new Dictionary<UUID, RequestData>(); | 154 | urlData.requests = new Dictionary<UUID, RequestData>(); |
154 | 155 | ||
155 | |||
156 | m_UrlMap[url] = urlData; | 156 | m_UrlMap[url] = urlData; |
157 | 157 | ||
158 | string uri = "/lslhttp/" + urlcode.ToString() + "/"; | 158 | string uri = "/lslhttp/" + urlcode.ToString(); |
159 | 159 | ||
160 | m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, | 160 | m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, |
161 | new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, | 161 | new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, |
@@ -200,10 +200,14 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
200 | if (m_RequestMap.ContainsKey(request)) | 200 | if (m_RequestMap.ContainsKey(request)) |
201 | { | 201 | { |
202 | UrlData urlData = m_RequestMap[request]; | 202 | UrlData urlData = m_RequestMap[request]; |
203 | urlData.requests[request].responseCode = status; | 203 | if (!urlData.requests[request].responseSent) |
204 | urlData.requests[request].responseBody = body; | 204 | { |
205 | //urlData.requests[request].ev.Set(); | 205 | urlData.requests[request].responseCode = status; |
206 | urlData.requests[request].requestDone =true; | 206 | urlData.requests[request].responseBody = body; |
207 | //urlData.requests[request].ev.Set(); | ||
208 | urlData.requests[request].requestDone = true; | ||
209 | urlData.requests[request].responseSent = true; | ||
210 | } | ||
207 | } | 211 | } |
208 | else | 212 | else |
209 | { | 213 | { |
@@ -386,6 +390,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
386 | 390 | ||
387 | return response; | 391 | return response; |
388 | } | 392 | } |
393 | |||
389 | public void HttpRequestHandler(UUID requestID, Hashtable request) | 394 | public void HttpRequestHandler(UUID requestID, Hashtable request) |
390 | { | 395 | { |
391 | lock (request) | 396 | lock (request) |
@@ -400,8 +405,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
400 | 405 | ||
401 | int pos1 = uri.IndexOf("/");// /lslhttp | 406 | int pos1 = uri.IndexOf("/");// /lslhttp |
402 | int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ | 407 | int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ |
403 | int pos3 = uri.IndexOf("/", pos2 + 1);// /lslhttp/<UUID>/ | 408 | int pos3 = pos2 + 37; // /lslhttp/urlcode |
404 | string uri_tmp = uri.Substring(0, pos3 + 1); | 409 | string uri_tmp = uri.Substring(0, pos3); |
405 | //HTTP server code doesn't provide us with QueryStrings | 410 | //HTTP server code doesn't provide us with QueryStrings |
406 | string pathInfo; | 411 | string pathInfo; |
407 | string queryString; | 412 | string queryString; |
@@ -439,7 +444,14 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
439 | if (request.ContainsKey(key)) | 444 | if (request.ContainsKey(key)) |
440 | { | 445 | { |
441 | string val = (String)request[key]; | 446 | string val = (String)request[key]; |
442 | queryString = queryString + key + "=" + val + "&"; | 447 | if (key != "") |
448 | { | ||
449 | queryString = queryString + key + "=" + val + "&"; | ||
450 | } | ||
451 | else | ||
452 | { | ||
453 | queryString = queryString + val + "&"; | ||
454 | } | ||
443 | } | 455 | } |
444 | } | 456 | } |
445 | if (queryString.Length > 1) | 457 | if (queryString.Length > 1) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs index 18db9fa..7128d2b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs | |||
@@ -56,9 +56,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
56 | config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); | 56 | config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); |
57 | config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); | 57 | config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); |
58 | config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); | 58 | config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); |
59 | config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion"); | 59 | config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion"); |
60 | config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion"); | 60 | config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion"); |
61 | config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion"); | 61 | config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion"); |
62 | config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion"); | 62 | config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion"); |
63 | 63 | ||
64 | m_LocalConnector = new LocalGridServicesConnector(config); | 64 | m_LocalConnector = new LocalGridServicesConnector(config); |
@@ -127,8 +127,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
127 | Assert.IsNotNull(result, "Retrieved GetRegionByName is null"); | 127 | Assert.IsNotNull(result, "Retrieved GetRegionByName is null"); |
128 | Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match"); | 128 | Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match"); |
129 | 129 | ||
130 | m_LocalConnector.RegisterRegion(UUID.Zero, r2); | 130 | m_LocalConnector.RegisterRegion(UUID.Zero, r2); |
131 | m_LocalConnector.RegisterRegion(UUID.Zero, r3); | 131 | m_LocalConnector.RegisterRegion(UUID.Zero, r3); |
132 | m_LocalConnector.RegisterRegion(UUID.Zero, r4); | 132 | m_LocalConnector.RegisterRegion(UUID.Zero, r4); |
133 | 133 | ||
134 | result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1)); | 134 | result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1)); |
@@ -153,38 +153,38 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
153 | Assert.IsNotNull(results, "Retrieved GetRegionRange collection is null"); | 153 | Assert.IsNotNull(results, "Retrieved GetRegionRange collection is null"); |
154 | Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected"); | 154 | Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected"); |
155 | 155 | ||
156 | results = m_LocalConnector.GetDefaultRegions(UUID.Zero); | 156 | results = m_LocalConnector.GetDefaultRegions(UUID.Zero); |
157 | Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null"); | 157 | Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null"); |
158 | Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size"); | 158 | Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size"); |
159 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match"); | 159 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match"); |
160 | 160 | ||
161 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY); | 161 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY); |
162 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null"); | 162 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null"); |
163 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size"); | 163 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size"); |
164 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); | 164 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); |
165 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); | 165 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); |
166 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); | 166 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); |
167 | 167 | ||
168 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY); | 168 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY); |
169 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null"); | 169 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null"); |
170 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size"); | 170 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size"); |
171 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3"); | 171 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3"); |
172 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3"); | 172 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3"); |
173 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3"); | 173 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3"); |
174 | 174 | ||
175 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY); | 175 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY); |
176 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null"); | 176 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null"); |
177 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size"); | 177 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size"); |
178 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2"); | 178 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2"); |
179 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2"); | 179 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2"); |
180 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2"); | 180 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2"); |
181 | 181 | ||
182 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY); | 182 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY); |
183 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null"); | 183 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null"); |
184 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size"); | 184 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size"); |
185 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2"); | 185 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2"); |
186 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2"); | 186 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2"); |
187 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2"); | 187 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2"); |
188 | 188 | ||
189 | results = m_LocalConnector.GetHyperlinks(UUID.Zero); | 189 | results = m_LocalConnector.GetHyperlinks(UUID.Zero); |
190 | Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); | 190 | Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index a298b65..41dbffb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -268,7 +268,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
268 | if (s.RegionInfo.RegionID == destination.RegionID) | 268 | if (s.RegionInfo.RegionID == destination.RegionID) |
269 | return s.QueryAccess(id, position, out reason); | 269 | return s.QueryAccess(id, position, out reason); |
270 | } | 270 | } |
271 | //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); | ||
272 | return false; | 271 | return false; |
273 | } | 272 | } |
274 | 273 | ||
@@ -298,10 +297,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
298 | if (s.RegionInfo.RegionID == destination.RegionID) | 297 | if (s.RegionInfo.RegionID == destination.RegionID) |
299 | { | 298 | { |
300 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); | 299 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); |
301 | // Let's spawn a threadlet right here, because this may take | 300 | return s.IncomingCloseAgent(id); |
302 | // a while | 301 | } |
303 | Util.FireAndForget(delegate { s.IncomingCloseAgent(id); }); | 302 | } |
304 | return true; | 303 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); |
304 | return false; | ||
305 | } | ||
306 | |||
307 | public bool CloseChildAgent(GridRegion destination, UUID id) | ||
308 | { | ||
309 | if (destination == null) | ||
310 | return false; | ||
311 | |||
312 | foreach (Scene s in m_sceneList) | ||
313 | { | ||
314 | if (s.RegionInfo.RegionID == destination.RegionID) | ||
315 | { | ||
316 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); | ||
317 | return s.IncomingCloseChildAgent(id); | ||
305 | } | 318 | } |
306 | } | 319 | } |
307 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); | 320 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 67f4d60..97833f3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -260,6 +260,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
260 | return false; | 260 | return false; |
261 | } | 261 | } |
262 | 262 | ||
263 | public bool CloseChildAgent(GridRegion destination, UUID id) | ||
264 | { | ||
265 | if (destination == null) | ||
266 | return false; | ||
267 | |||
268 | // Try local first | ||
269 | if (m_localBackend.CloseChildAgent(destination, id)) | ||
270 | return true; | ||
271 | |||
272 | // else do the remote thing | ||
273 | if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) | ||
274 | return m_remoteConnector.CloseChildAgent(destination, id); | ||
275 | |||
276 | return false; | ||
277 | } | ||
263 | 278 | ||
264 | public bool CloseAgent(GridRegion destination, UUID id) | 279 | public bool CloseAgent(GridRegion destination, UUID id) |
265 | { | 280 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index 30ebb21..535a637 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs | |||
@@ -120,6 +120,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
120 | return; | 120 | return; |
121 | 121 | ||
122 | scene.RegisterModuleInterface<IUserAccountService>(m_UserService); | 122 | scene.RegisterModuleInterface<IUserAccountService>(m_UserService); |
123 | scene.RegisterModuleInterface<IUserAccountCacheModule>(m_Cache); | ||
123 | } | 124 | } |
124 | 125 | ||
125 | public void RemoveRegion(Scene scene) | 126 | public void RemoveRegion(Scene scene) |
@@ -172,6 +173,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
172 | return m_UserService.GetUserAccount(scopeID, Email); | 173 | return m_UserService.GetUserAccount(scopeID, Email); |
173 | } | 174 | } |
174 | 175 | ||
176 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) | ||
177 | { | ||
178 | return null; | ||
179 | } | ||
180 | |||
175 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) | 181 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) |
176 | { | 182 | { |
177 | return m_UserService.GetUserAccounts(scopeID, query); | 183 | return m_UserService.GetUserAccounts(scopeID, query); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs index 3321b38..f6b6aeb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs | |||
@@ -33,6 +33,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
33 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
35 | using OpenSim.Services.Connectors; | 35 | using OpenSim.Services.Connectors; |
36 | using OpenSim.Framework; | ||
36 | 37 | ||
37 | using OpenMetaverse; | 38 | using OpenMetaverse; |
38 | 39 | ||
@@ -101,6 +102,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
101 | return; | 102 | return; |
102 | 103 | ||
103 | scene.RegisterModuleInterface<IUserAccountService>(this); | 104 | scene.RegisterModuleInterface<IUserAccountService>(this); |
105 | scene.RegisterModuleInterface<IUserAccountCacheModule>(m_Cache); | ||
106 | |||
107 | scene.EventManager.OnNewClient += OnNewClient; | ||
104 | } | 108 | } |
105 | 109 | ||
106 | public void RemoveRegion(Scene scene) | 110 | public void RemoveRegion(Scene scene) |
@@ -115,6 +119,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
115 | return; | 119 | return; |
116 | } | 120 | } |
117 | 121 | ||
122 | // When a user actually enters the sim, clear them from | ||
123 | // cache so the sim will have the current values for | ||
124 | // flags, title, etc. And country, don't forget country! | ||
125 | private void OnNewClient(IClientAPI client) | ||
126 | { | ||
127 | m_Cache.Remove(client.Name); | ||
128 | } | ||
129 | |||
118 | #region Overwritten methods from IUserAccountService | 130 | #region Overwritten methods from IUserAccountService |
119 | 131 | ||
120 | public override UserAccount GetUserAccount(UUID scopeID, UUID userID) | 132 | public override UserAccount GetUserAccount(UUID scopeID, UUID userID) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index ddef75f..cbe2eaa 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | |||
@@ -34,7 +34,7 @@ using log4net; | |||
34 | 34 | ||
35 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | 35 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts |
36 | { | 36 | { |
37 | public class UserAccountCache | 37 | public class UserAccountCache : IUserAccountCacheModule |
38 | { | 38 | { |
39 | private const double CACHE_EXPIRATION_SECONDS = 120000.0; // 33 hours! | 39 | private const double CACHE_EXPIRATION_SECONDS = 120000.0; // 33 hours! |
40 | 40 | ||
@@ -92,5 +92,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
92 | 92 | ||
93 | return null; | 93 | return null; |
94 | } | 94 | } |
95 | |||
96 | public void Remove(string name) | ||
97 | { | ||
98 | if (!m_NameCache.Contains(name)) | ||
99 | return; | ||
100 | |||
101 | UUID uuid = UUID.Zero; | ||
102 | if (m_NameCache.TryGetValue(name, out uuid)) | ||
103 | { | ||
104 | m_NameCache.Remove(name); | ||
105 | m_UUIDCache.Remove(uuid); | ||
106 | } | ||
107 | } | ||
95 | } | 108 | } |
96 | } | 109 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index fd8f546..b1dec4c 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -287,6 +287,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
287 | // being no copy/no mod for everyone | 287 | // being no copy/no mod for everyone |
288 | lock (part.TaskInventory) | 288 | lock (part.TaskInventory) |
289 | { | 289 | { |
290 | if (!ResolveUserUuid(part.CreatorID)) | ||
291 | part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
292 | |||
293 | if (!ResolveUserUuid(part.OwnerID)) | ||
294 | part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
295 | |||
296 | if (!ResolveUserUuid(part.LastOwnerID)) | ||
297 | part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
298 | |||
299 | // And zap any troublesome sit target information | ||
300 | part.SitTargetOrientation = new Quaternion(0, 0, 0, 1); | ||
301 | part.SitTargetPosition = new Vector3(0, 0, 0); | ||
302 | |||
303 | // Fix ownership/creator of inventory items | ||
304 | // Not doing so results in inventory items | ||
305 | // being no copy/no mod for everyone | ||
306 | part.TaskInventory.LockItemsForRead(true); | ||
290 | TaskInventoryDictionary inv = part.TaskInventory; | 307 | TaskInventoryDictionary inv = part.TaskInventory; |
291 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) | 308 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) |
292 | { | 309 | { |
@@ -302,6 +319,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
302 | if (UserManager != null) | 319 | if (UserManager != null) |
303 | UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); | 320 | UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); |
304 | } | 321 | } |
322 | part.TaskInventory.LockItemsForRead(false); | ||
305 | } | 323 | } |
306 | } | 324 | } |
307 | 325 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index b888698..5da1656 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -249,18 +249,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
249 | 249 | ||
250 | if (asset != null) | 250 | if (asset != null) |
251 | { | 251 | { |
252 | if (m_options.ContainsKey("verbose")) | 252 | // m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id); |
253 | m_log.InfoFormat("[ARCHIVER]: Writing asset {0}", id); | ||
254 | |||
255 | m_foundAssetUuids.Add(asset.FullID); | 253 | m_foundAssetUuids.Add(asset.FullID); |
256 | 254 | ||
257 | m_assetsArchiver.WriteAsset(PostProcess(asset)); | 255 | m_assetsArchiver.WriteAsset(PostProcess(asset)); |
258 | } | 256 | } |
259 | else | 257 | else |
260 | { | 258 | { |
261 | if (m_options.ContainsKey("verbose")) | 259 | // m_log.DebugFormat("[ARCHIVER]: Recording asset {0} as not found", id); |
262 | m_log.InfoFormat("[ARCHIVER]: Recording asset {0} as not found", id); | ||
263 | |||
264 | m_notFoundAssetUuids.Add(new UUID(id)); | 260 | m_notFoundAssetUuids.Add(new UUID(id)); |
265 | } | 261 | } |
266 | 262 | ||
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index ab90e90..598948a 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Security; | 32 | using System.Security; |
33 | using System.Timers; | ||
33 | using log4net; | 34 | using log4net; |
34 | using Mono.Addins; | 35 | using Mono.Addins; |
35 | using Nini.Config; | 36 | using Nini.Config; |
@@ -47,6 +48,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
47 | 48 | ||
48 | private delegate void LookupUUIDS(List<UUID> uuidLst); | 49 | private delegate void LookupUUIDS(List<UUID> uuidLst); |
49 | 50 | ||
51 | private Timer m_regionChangeTimer = new Timer(); | ||
50 | public Scene Scene { get; private set; } | 52 | public Scene Scene { get; private set; } |
51 | public IUserManagement UserManager { get; private set; } | 53 | public IUserManagement UserManager { get; private set; } |
52 | 54 | ||
@@ -253,7 +255,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
253 | timeInSeconds -= 15; | 255 | timeInSeconds -= 15; |
254 | } | 256 | } |
255 | 257 | ||
256 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); | 258 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), false); |
257 | } | 259 | } |
258 | } | 260 | } |
259 | 261 | ||
@@ -460,7 +462,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
460 | { | 462 | { |
461 | if (!s.IsChildAgent) | 463 | if (!s.IsChildAgent) |
462 | { | 464 | { |
463 | Scene.TeleportClientHome(user, s.ControllingClient); | 465 | if (!Scene.TeleportClientHome(user, s.ControllingClient)) |
466 | { | ||
467 | s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out."); | ||
468 | s.ControllingClient.Close(); | ||
469 | } | ||
464 | } | 470 | } |
465 | } | 471 | } |
466 | 472 | ||
@@ -469,7 +475,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
469 | { | 475 | { |
470 | remote_client.SendAlertMessage("User is already on the region ban list"); | 476 | remote_client.SendAlertMessage("User is already on the region ban list"); |
471 | } | 477 | } |
472 | //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | 478 | //Scene.RegionInfo.regionBanlist.Add(Manager(user); |
473 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); | 479 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); |
474 | } | 480 | } |
475 | else | 481 | else |
@@ -524,7 +530,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
524 | remote_client.SendAlertMessage("User is not on the region ban list"); | 530 | remote_client.SendAlertMessage("User is not on the region ban list"); |
525 | } | 531 | } |
526 | 532 | ||
527 | //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | 533 | //Scene.RegionInfo.regionBanlist.Add(Manager(user); |
528 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); | 534 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); |
529 | } | 535 | } |
530 | else | 536 | else |
@@ -645,7 +651,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
645 | ScenePresence s = Scene.GetScenePresence(prey); | 651 | ScenePresence s = Scene.GetScenePresence(prey); |
646 | if (s != null) | 652 | if (s != null) |
647 | { | 653 | { |
648 | Scene.TeleportClientHome(prey, s.ControllingClient); | 654 | if (!Scene.TeleportClientHome(prey, s.ControllingClient)) |
655 | { | ||
656 | s.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); | ||
657 | s.ControllingClient.Close(); | ||
658 | } | ||
649 | } | 659 | } |
650 | } | 660 | } |
651 | } | 661 | } |
@@ -664,7 +674,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
664 | // Also make sure they are actually in the region | 674 | // Also make sure they are actually in the region |
665 | if (p != null && !p.IsChildAgent) | 675 | if (p != null && !p.IsChildAgent) |
666 | { | 676 | { |
667 | Scene.TeleportClientHome(p.UUID, p.ControllingClient); | 677 | if (!Scene.TeleportClientHome(p.UUID, p.ControllingClient)) |
678 | { | ||
679 | p.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); | ||
680 | p.ControllingClient.Close(); | ||
681 | } | ||
668 | } | 682 | } |
669 | } | 683 | } |
670 | }); | 684 | }); |
@@ -915,7 +929,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
915 | 929 | ||
916 | for (int i = 0; i < uuidarr.Length; i++) | 930 | for (int i = 0; i < uuidarr.Length; i++) |
917 | { | 931 | { |
918 | // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); | 932 | // string lookupname = Scene.CommsManager.UUIDNameRequestString(uuidarr[i]); |
919 | 933 | ||
920 | IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>(); | 934 | IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>(); |
921 | if (userManager != null) | 935 | if (userManager != null) |
@@ -1052,6 +1066,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1052 | 1066 | ||
1053 | public void AddRegion(Scene scene) | 1067 | public void AddRegion(Scene scene) |
1054 | { | 1068 | { |
1069 | m_regionChangeTimer.AutoReset = false; | ||
1070 | m_regionChangeTimer.Interval = 2000; | ||
1071 | m_regionChangeTimer.Elapsed += RaiseRegionInfoChange; | ||
1072 | |||
1055 | Scene = scene; | 1073 | Scene = scene; |
1056 | Scene.RegisterModuleInterface<IEstateModule>(this); | 1074 | Scene.RegisterModuleInterface<IEstateModule>(this); |
1057 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; | 1075 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; |
@@ -1158,11 +1176,15 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1158 | flags |= RegionFlags.Sandbox; | 1176 | flags |= RegionFlags.Sandbox; |
1159 | if (Scene.RegionInfo.EstateSettings.AllowVoice) | 1177 | if (Scene.RegionInfo.EstateSettings.AllowVoice) |
1160 | flags |= RegionFlags.AllowVoice; | 1178 | flags |= RegionFlags.AllowVoice; |
1179 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
1180 | flags |= RegionFlags.AllowLandmark; | ||
1181 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
1182 | flags |= RegionFlags.AllowSetHome; | ||
1183 | if (Scene.RegionInfo.EstateSettings.BlockDwell) | ||
1184 | flags |= RegionFlags.BlockDwell; | ||
1185 | if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) | ||
1186 | flags |= RegionFlags.ResetHomeOnTeleport; | ||
1161 | 1187 | ||
1162 | // Fudge these to always on, so the menu options activate | ||
1163 | // | ||
1164 | flags |= RegionFlags.AllowLandmark; | ||
1165 | flags |= RegionFlags.AllowSetHome; | ||
1166 | 1188 | ||
1167 | // TODO: SkipUpdateInterestList | 1189 | // TODO: SkipUpdateInterestList |
1168 | 1190 | ||
@@ -1203,6 +1225,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1203 | flags |= RegionFlags.ResetHomeOnTeleport; | 1225 | flags |= RegionFlags.ResetHomeOnTeleport; |
1204 | if (Scene.RegionInfo.EstateSettings.TaxFree) | 1226 | if (Scene.RegionInfo.EstateSettings.TaxFree) |
1205 | flags |= RegionFlags.TaxFree; | 1227 | flags |= RegionFlags.TaxFree; |
1228 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
1229 | flags |= RegionFlags.AllowLandmark; | ||
1230 | if (Scene.RegionInfo.EstateSettings.AllowParcelChanges) | ||
1231 | flags |= RegionFlags.AllowParcelChanges; | ||
1232 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
1233 | flags |= RegionFlags.AllowSetHome; | ||
1206 | if (Scene.RegionInfo.EstateSettings.DenyMinors) | 1234 | if (Scene.RegionInfo.EstateSettings.DenyMinors) |
1207 | flags |= (RegionFlags)(1 << 30); | 1235 | flags |= (RegionFlags)(1 << 30); |
1208 | 1236 | ||
@@ -1223,6 +1251,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1223 | 1251 | ||
1224 | public void TriggerRegionInfoChange() | 1252 | public void TriggerRegionInfoChange() |
1225 | { | 1253 | { |
1254 | m_regionChangeTimer.Stop(); | ||
1255 | m_regionChangeTimer.Start(); | ||
1256 | } | ||
1257 | |||
1258 | protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e) | ||
1259 | { | ||
1226 | ChangeDelegate change = OnRegionInfoChange; | 1260 | ChangeDelegate change = OnRegionInfoChange; |
1227 | 1261 | ||
1228 | if (change != null) | 1262 | if (change != null) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index bfab7b8..f28faed 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -91,11 +91,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
91 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 91 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
92 | 92 | ||
93 | private bool m_allowedForcefulBans = true; | 93 | private bool m_allowedForcefulBans = true; |
94 | private UUID DefaultGodParcelGroup; | ||
95 | private string DefaultGodParcelName; | ||
94 | 96 | ||
95 | // caches ExtendedLandData | 97 | // caches ExtendedLandData |
96 | private Cache parcelInfoCache; | 98 | private Cache parcelInfoCache; |
97 | private Dictionary<UUID, Vector3> forcedPosition = | ||
98 | new Dictionary<UUID, Vector3>(); | ||
99 | 99 | ||
100 | #region INonSharedRegionModule Members | 100 | #region INonSharedRegionModule Members |
101 | 101 | ||
@@ -106,6 +106,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
106 | 106 | ||
107 | public void Initialise(IConfigSource source) | 107 | public void Initialise(IConfigSource source) |
108 | { | 108 | { |
109 | IConfig cnf = source.Configs["LandManagement"]; | ||
110 | if (cnf != null) | ||
111 | { | ||
112 | DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); | ||
113 | DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel"); | ||
114 | } | ||
109 | } | 115 | } |
110 | 116 | ||
111 | public void AddRegion(Scene scene) | 117 | public void AddRegion(Scene scene) |
@@ -157,13 +163,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
157 | m_scene.UnregisterModuleCommander(m_commander.Name); | 163 | m_scene.UnregisterModuleCommander(m_commander.Name); |
158 | } | 164 | } |
159 | 165 | ||
160 | // private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) | ||
161 | // { | ||
162 | // ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y); | ||
163 | // reason = "You are not allowed to enter this sim."; | ||
164 | // return nearestParcel != null; | ||
165 | // } | ||
166 | |||
167 | /// <summary> | 166 | /// <summary> |
168 | /// Processes commandline input. Do not call directly. | 167 | /// Processes commandline input. Do not call directly. |
169 | /// </summary> | 168 | /// </summary> |
@@ -215,36 +214,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
215 | 214 | ||
216 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | 215 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) |
217 | { | 216 | { |
218 | //If we are forcing a position for them to go | ||
219 | if (forcedPosition.ContainsKey(remoteClient.AgentId)) | ||
220 | { | ||
221 | ScenePresence clientAvatar = m_scene.GetScenePresence(remoteClient.AgentId); | ||
222 | |||
223 | //Putting the user into flying, both keeps the avatar in fligth when it bumps into something and stopped from going another direction AND | ||
224 | //When the avatar walks into a ban line on the ground, it prevents getting stuck | ||
225 | agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
226 | |||
227 | |||
228 | //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines | ||
229 | if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2) | ||
230 | { | ||
231 | Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); | ||
232 | forcedPosition.Remove(remoteClient.AgentId); | ||
233 | } | ||
234 | //if we are far away, teleport | ||
235 | else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3) | ||
236 | { | ||
237 | Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); | ||
238 | clientAvatar.Teleport(forcedPosition[remoteClient.AgentId]); | ||
239 | forcedPosition.Remove(remoteClient.AgentId); | ||
240 | } | ||
241 | else | ||
242 | { | ||
243 | //Forces them toward the forced position we want if they aren't there yet | ||
244 | agentData.UseClientAgentPosition = true; | ||
245 | agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId]; | ||
246 | } | ||
247 | } | ||
248 | } | 217 | } |
249 | 218 | ||
250 | public void Close() | 219 | public void Close() |
@@ -363,10 +332,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
363 | private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) | 332 | private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) |
364 | { | 333 | { |
365 | if (m_scene.Permissions.IsGod(avatar.UUID)) return; | 334 | if (m_scene.Permissions.IsGod(avatar.UUID)) return; |
366 | if (position.HasValue) | 335 | |
367 | { | 336 | if (!position.HasValue) |
368 | forcedPosition[avatar.ControllingClient.AgentId] = (Vector3)position; | 337 | return; |
369 | } | 338 | |
339 | bool isFlying = avatar.PhysicsActor.Flying; | ||
340 | avatar.RemoveFromPhysicalScene(); | ||
341 | |||
342 | avatar.AbsolutePosition = (Vector3)position; | ||
343 | |||
344 | avatar.AddToPhysicalScene(isFlying); | ||
370 | } | 345 | } |
371 | 346 | ||
372 | public void SendYouAreRestrictedNotice(ScenePresence avatar) | 347 | public void SendYouAreRestrictedNotice(ScenePresence avatar) |
@@ -386,29 +361,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
386 | } | 361 | } |
387 | 362 | ||
388 | if (parcelAvatarIsEntering != null) | 363 | if (parcelAvatarIsEntering != null) |
389 | { | 364 | EnforceBans(parcelAvatarIsEntering, avatar); |
390 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) | ||
391 | { | ||
392 | if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) | ||
393 | { | ||
394 | SendYouAreBannedNotice(avatar); | ||
395 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | ||
396 | } | ||
397 | else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID)) | ||
398 | { | ||
399 | SendYouAreRestrictedNotice(avatar); | ||
400 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | ||
401 | } | ||
402 | else | ||
403 | { | ||
404 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | ||
405 | } | ||
406 | } | ||
407 | else | ||
408 | { | ||
409 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | ||
410 | } | ||
411 | } | ||
412 | } | 365 | } |
413 | } | 366 | } |
414 | 367 | ||
@@ -480,43 +433,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
480 | SendOutNearestBanLine(remote_client); | 433 | SendOutNearestBanLine(remote_client); |
481 | ILandObject parcel = GetLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); | 434 | ILandObject parcel = GetLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); |
482 | if (parcel != null) | 435 | if (parcel != null) |
483 | { | 436 | EnforceBans(parcel, clientAvatar); |
484 | if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && | ||
485 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) | ||
486 | { | ||
487 | EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID, | ||
488 | m_scene.RegionInfo.RegionID); | ||
489 | //They are going under the safety line! | ||
490 | if (!parcel.IsBannedFromLand(clientAvatar.UUID)) | ||
491 | { | ||
492 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false; | ||
493 | } | ||
494 | } | ||
495 | else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && | ||
496 | parcel.IsBannedFromLand(clientAvatar.UUID)) | ||
497 | { | ||
498 | //once we've sent the message once, keep going toward the target until we are done | ||
499 | if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId)) | ||
500 | { | ||
501 | SendYouAreBannedNotice(clientAvatar); | ||
502 | ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar)); | ||
503 | } | ||
504 | } | ||
505 | else if (parcel.IsRestrictedFromLand(clientAvatar.UUID)) | ||
506 | { | ||
507 | //once we've sent the message once, keep going toward the target until we are done | ||
508 | if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId)) | ||
509 | { | ||
510 | SendYouAreRestrictedNotice(clientAvatar); | ||
511 | ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar)); | ||
512 | } | ||
513 | } | ||
514 | else | ||
515 | { | ||
516 | //when we are finally in a safe place, lets release the forced position lock | ||
517 | forcedPosition.Remove(clientAvatar.ControllingClient.AgentId); | ||
518 | } | ||
519 | } | ||
520 | } | 437 | } |
521 | } | 438 | } |
522 | 439 | ||
@@ -722,7 +639,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
722 | int x; | 639 | int x; |
723 | int y; | 640 | int y; |
724 | 641 | ||
725 | if (x_float >= Constants.RegionSize || x_float < 0 || y_float >= Constants.RegionSize || y_float < 0) | 642 | if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0) |
726 | return null; | 643 | return null; |
727 | 644 | ||
728 | try | 645 | try |
@@ -772,14 +689,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
772 | { | 689 | { |
773 | try | 690 | try |
774 | { | 691 | { |
775 | return m_landList[m_landIDList[x / 4, y / 4]]; | 692 | //if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) |
693 | return m_landList[m_landIDList[x / 4, y / 4]]; | ||
694 | //else | ||
695 | // return null; | ||
776 | } | 696 | } |
777 | catch (IndexOutOfRangeException) | 697 | catch (IndexOutOfRangeException) |
778 | { | 698 | { |
779 | // m_log.WarnFormat( | ||
780 | // "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}", | ||
781 | // x, y, m_scene.RegionInfo.RegionName); | ||
782 | |||
783 | return null; | 699 | return null; |
784 | } | 700 | } |
785 | } | 701 | } |
@@ -1062,6 +978,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1062 | //Owner Flag | 978 | //Owner Flag |
1063 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); | 979 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); |
1064 | } | 980 | } |
981 | else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID)) | ||
982 | { | ||
983 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP); | ||
984 | } | ||
1065 | else if (currentParcelBlock.LandData.SalePrice > 0 && | 985 | else if (currentParcelBlock.LandData.SalePrice > 0 && |
1066 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || | 986 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || |
1067 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) | 987 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) |
@@ -1362,18 +1282,31 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1362 | 1282 | ||
1363 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) | 1283 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) |
1364 | { | 1284 | { |
1365 | for (int i = 0; i < data.Count; i++) | 1285 | lock (m_landList) |
1366 | { | 1286 | { |
1367 | IncomingLandObjectFromStorage(data[i]); | 1287 | //Remove all the land objects in the sim and then process our new data |
1288 | foreach (int n in m_landList.Keys) | ||
1289 | { | ||
1290 | m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID); | ||
1291 | } | ||
1292 | m_landIDList.Initialize(); | ||
1293 | m_landList.Clear(); | ||
1294 | |||
1295 | for (int i = 0; i < data.Count; i++) | ||
1296 | { | ||
1297 | IncomingLandObjectFromStorage(data[i]); | ||
1298 | } | ||
1368 | } | 1299 | } |
1369 | } | 1300 | } |
1370 | 1301 | ||
1371 | public void IncomingLandObjectFromStorage(LandData data) | 1302 | public void IncomingLandObjectFromStorage(LandData data) |
1372 | { | 1303 | { |
1304 | |||
1373 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); | 1305 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); |
1374 | new_land.LandData = data.Copy(); | 1306 | new_land.LandData = data.Copy(); |
1375 | new_land.SetLandBitmapFromByteArray(); | 1307 | new_land.SetLandBitmapFromByteArray(); |
1376 | AddLandObject(new_land); | 1308 | AddLandObject(new_land); |
1309 | new_land.SendLandUpdateToAvatarsOverMe(); | ||
1377 | } | 1310 | } |
1378 | 1311 | ||
1379 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) | 1312 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) |
@@ -1648,6 +1581,322 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1648 | 1581 | ||
1649 | UpdateLandObject(localID, land.LandData); | 1582 | UpdateLandObject(localID, land.LandData); |
1650 | } | 1583 | } |
1584 | |||
1585 | public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID) | ||
1586 | { | ||
1587 | ILandObject land = null; | ||
1588 | List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels(); | ||
1589 | foreach (ILandObject landObject in Land) | ||
1590 | { | ||
1591 | if (landObject.LandData.LocalID == landID) | ||
1592 | { | ||
1593 | land = landObject; | ||
1594 | } | ||
1595 | } | ||
1596 | land.DeedToGroup(DefaultGodParcelGroup); | ||
1597 | land.LandData.Name = DefaultGodParcelName; | ||
1598 | land.SendLandUpdateToAvatarsOverMe(); | ||
1599 | } | ||
1600 | |||
1601 | private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID) | ||
1602 | { | ||
1603 | ScenePresence SP; | ||
1604 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); | ||
1605 | List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); | ||
1606 | if (SP.UserLevel != 0) | ||
1607 | { | ||
1608 | if (flags == 0) //All parcels, scripted or not | ||
1609 | { | ||
1610 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1611 | { | ||
1612 | if (e.OwnerID == targetID) | ||
1613 | { | ||
1614 | returns.Add(e); | ||
1615 | } | ||
1616 | } | ||
1617 | ); | ||
1618 | } | ||
1619 | if (flags == 4) //All parcels, scripted object | ||
1620 | { | ||
1621 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1622 | { | ||
1623 | if (e.OwnerID == targetID) | ||
1624 | { | ||
1625 | if (e.scriptScore >= 0.01) | ||
1626 | { | ||
1627 | returns.Add(e); | ||
1628 | } | ||
1629 | } | ||
1630 | } | ||
1631 | ); | ||
1632 | } | ||
1633 | if (flags == 4) //not target parcel, scripted object | ||
1634 | { | ||
1635 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1636 | { | ||
1637 | if (e.OwnerID == targetID) | ||
1638 | { | ||
1639 | ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y); | ||
1640 | if (landobject.LandData.OwnerID != e.OwnerID) | ||
1641 | { | ||
1642 | if (e.scriptScore >= 0.01) | ||
1643 | { | ||
1644 | returns.Add(e); | ||
1645 | } | ||
1646 | } | ||
1647 | } | ||
1648 | } | ||
1649 | ); | ||
1650 | } | ||
1651 | foreach (SceneObjectGroup ol in returns) | ||
1652 | { | ||
1653 | ReturnObject(ol, client); | ||
1654 | } | ||
1655 | } | ||
1656 | } | ||
1657 | public void ReturnObject(SceneObjectGroup obj, IClientAPI client) | ||
1658 | { | ||
1659 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | ||
1660 | objs[0] = obj; | ||
1661 | ((Scene)client.Scene).returnObjects(objs, client.AgentId); | ||
1662 | } | ||
1663 | |||
1664 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
1665 | |||
1666 | public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1667 | { | ||
1668 | ScenePresence targetAvatar = null; | ||
1669 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1670 | ScenePresence parcelManager = null; | ||
1671 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1672 | System.Threading.Timer Timer; | ||
1673 | |||
1674 | if (targetAvatar.UserLevel == 0) | ||
1675 | { | ||
1676 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1677 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1678 | return; | ||
1679 | if (flags == 0) | ||
1680 | { | ||
1681 | targetAvatar.AllowMovement = false; | ||
1682 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world."); | ||
1683 | parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen."); | ||
1684 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
1685 | Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0); | ||
1686 | Timers.Add(targetAvatar.UUID, Timer); | ||
1687 | } | ||
1688 | else | ||
1689 | { | ||
1690 | targetAvatar.AllowMovement = true; | ||
1691 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you."); | ||
1692 | parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen."); | ||
1693 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1694 | Timers.Remove(targetAvatar.UUID); | ||
1695 | Timer.Dispose(); | ||
1696 | } | ||
1697 | } | ||
1698 | } | ||
1699 | private void OnEndParcelFrozen(object avatar) | ||
1700 | { | ||
1701 | ScenePresence targetAvatar = (ScenePresence)avatar; | ||
1702 | targetAvatar.AllowMovement = true; | ||
1703 | System.Threading.Timer Timer; | ||
1704 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1705 | Timers.Remove(targetAvatar.UUID); | ||
1706 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); | ||
1707 | } | ||
1708 | |||
1709 | |||
1710 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1711 | { | ||
1712 | ScenePresence targetAvatar = null; | ||
1713 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1714 | ScenePresence parcelManager = null; | ||
1715 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1716 | //Just eject | ||
1717 | if (flags == 0) | ||
1718 | { | ||
1719 | if (targetAvatar.UserLevel == 0) | ||
1720 | { | ||
1721 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1722 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1723 | return; | ||
1724 | |||
1725 | Vector3 position = new Vector3(0, 0, 0); | ||
1726 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1727 | allParcels = AllParcels(); | ||
1728 | if (allParcels.Count != 1) | ||
1729 | { | ||
1730 | foreach (ILandObject parcel in allParcels) | ||
1731 | { | ||
1732 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1733 | { | ||
1734 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1735 | { | ||
1736 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1737 | { | ||
1738 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1739 | { | ||
1740 | if (parcel.ContainsPoint(x, y)) | ||
1741 | { | ||
1742 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1743 | targetAvatar.TeleportWithMomentum(position); | ||
1744 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1745 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1746 | return; | ||
1747 | } | ||
1748 | } | ||
1749 | } | ||
1750 | } | ||
1751 | } | ||
1752 | } | ||
1753 | } | ||
1754 | Vector3 targetVector; | ||
1755 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1756 | { | ||
1757 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1758 | { | ||
1759 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1760 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1761 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1762 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1763 | return; | ||
1764 | } | ||
1765 | else | ||
1766 | { | ||
1767 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1768 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1769 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1770 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1771 | return; | ||
1772 | } | ||
1773 | } | ||
1774 | else | ||
1775 | { | ||
1776 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1777 | { | ||
1778 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1779 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1780 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1781 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1782 | return; | ||
1783 | } | ||
1784 | else | ||
1785 | { | ||
1786 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1787 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1788 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1789 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1790 | return; | ||
1791 | } | ||
1792 | } | ||
1793 | } | ||
1794 | } | ||
1795 | //Eject and ban | ||
1796 | if (flags == 1) | ||
1797 | { | ||
1798 | if (targetAvatar.UserLevel == 0) | ||
1799 | { | ||
1800 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1801 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1802 | return; | ||
1803 | |||
1804 | Vector3 position = new Vector3(0, 0, 0); | ||
1805 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1806 | allParcels = AllParcels(); | ||
1807 | if (allParcels.Count != 1) | ||
1808 | { | ||
1809 | foreach (ILandObject parcel in allParcels) | ||
1810 | { | ||
1811 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1812 | { | ||
1813 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1814 | { | ||
1815 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1816 | { | ||
1817 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1818 | { | ||
1819 | if (parcel.ContainsPoint(x, y)) | ||
1820 | { | ||
1821 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1822 | targetAvatar.TeleportWithMomentum(position); | ||
1823 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1824 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1825 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1826 | entry.AgentID = targetAvatar.UUID; | ||
1827 | entry.Flags = AccessList.Ban; | ||
1828 | entry.Time = new DateTime(); | ||
1829 | land.LandData.ParcelAccessList.Add(entry); | ||
1830 | return; | ||
1831 | } | ||
1832 | } | ||
1833 | } | ||
1834 | } | ||
1835 | } | ||
1836 | } | ||
1837 | } | ||
1838 | Vector3 targetVector; | ||
1839 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1840 | { | ||
1841 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1842 | { | ||
1843 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1844 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1845 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1846 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1847 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1848 | entry.AgentID = targetAvatar.UUID; | ||
1849 | entry.Flags = AccessList.Ban; | ||
1850 | entry.Time = new DateTime(); | ||
1851 | land.LandData.ParcelAccessList.Add(entry); | ||
1852 | return; | ||
1853 | } | ||
1854 | else | ||
1855 | { | ||
1856 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1857 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1858 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1859 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1860 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1861 | entry.AgentID = targetAvatar.UUID; | ||
1862 | entry.Flags = AccessList.Ban; | ||
1863 | entry.Time = new DateTime(); | ||
1864 | land.LandData.ParcelAccessList.Add(entry); | ||
1865 | return; | ||
1866 | } | ||
1867 | } | ||
1868 | else | ||
1869 | { | ||
1870 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1871 | { | ||
1872 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1873 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1874 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1875 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1876 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1877 | entry.AgentID = targetAvatar.UUID; | ||
1878 | entry.Flags = AccessList.Ban; | ||
1879 | entry.Time = new DateTime(); | ||
1880 | land.LandData.ParcelAccessList.Add(entry); | ||
1881 | return; | ||
1882 | } | ||
1883 | else | ||
1884 | { | ||
1885 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1886 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1887 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1888 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1889 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1890 | entry.AgentID = targetAvatar.UUID; | ||
1891 | entry.Flags = AccessList.Ban; | ||
1892 | entry.Time = new DateTime(); | ||
1893 | land.LandData.ParcelAccessList.Add(entry); | ||
1894 | return; | ||
1895 | } | ||
1896 | } | ||
1897 | } | ||
1898 | } | ||
1899 | } | ||
1651 | 1900 | ||
1652 | protected void InstallInterfaces() | 1901 | protected void InstallInterfaces() |
1653 | { | 1902 | { |
@@ -1710,5 +1959,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1710 | 1959 | ||
1711 | MainConsole.Instance.Output(report.ToString()); | 1960 | MainConsole.Instance.Output(report.ToString()); |
1712 | } | 1961 | } |
1962 | |||
1963 | public void EnforceBans(ILandObject land, ScenePresence avatar) | ||
1964 | { | ||
1965 | if (avatar.AbsolutePosition.Z > LandChannel.BAN_LINE_SAFETY_HIEGHT) | ||
1966 | return; | ||
1967 | |||
1968 | if (land.IsEitherBannedOrRestricted(avatar.UUID)) | ||
1969 | { | ||
1970 | if (land.ContainsPoint(Convert.ToInt32(avatar.lastKnownAllowedPosition.X), Convert.ToInt32(avatar.lastKnownAllowedPosition.Y))) | ||
1971 | { | ||
1972 | Vector3? pos = m_scene.GetNearestAllowedPosition(avatar); | ||
1973 | if (pos == null) | ||
1974 | m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient); | ||
1975 | else | ||
1976 | ForceAvatarToPosition(avatar, (Vector3)pos); | ||
1977 | } | ||
1978 | else | ||
1979 | { | ||
1980 | ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); | ||
1981 | } | ||
1982 | } | ||
1983 | } | ||
1713 | } | 1984 | } |
1714 | } \ No newline at end of file | 1985 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index c2f104e..fe6b83a 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -415,6 +415,37 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
415 | return false; | 415 | return false; |
416 | } | 416 | } |
417 | 417 | ||
418 | public bool HasGroupAccess(UUID avatar) | ||
419 | { | ||
420 | if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) | ||
421 | { | ||
422 | ScenePresence sp; | ||
423 | if (!m_scene.TryGetScenePresence(avatar, out sp)) | ||
424 | { | ||
425 | IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
426 | if (groupsModule == null) | ||
427 | return false; | ||
428 | |||
429 | GroupMembershipData[] membership = groupsModule.GetMembershipData(avatar); | ||
430 | if (membership == null || membership.Length == 0) | ||
431 | return false; | ||
432 | |||
433 | foreach (GroupMembershipData d in membership) | ||
434 | { | ||
435 | if (d.GroupID == LandData.GroupID) | ||
436 | return true; | ||
437 | } | ||
438 | return false; | ||
439 | } | ||
440 | |||
441 | if (!sp.ControllingClient.IsGroupMember(LandData.GroupID)) | ||
442 | return false; | ||
443 | |||
444 | return true; | ||
445 | } | ||
446 | return false; | ||
447 | } | ||
448 | |||
418 | public bool IsBannedFromLand(UUID avatar) | 449 | public bool IsBannedFromLand(UUID avatar) |
419 | { | 450 | { |
420 | if (m_scene.Permissions.IsAdministrator(avatar)) | 451 | if (m_scene.Permissions.IsAdministrator(avatar)) |
@@ -451,9 +482,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
451 | return false; | 482 | return false; |
452 | }) == -1 && LandData.OwnerID != avatar) | 483 | }) == -1 && LandData.OwnerID != avatar) |
453 | { | 484 | { |
454 | return true; | 485 | if (!HasGroupAccess(avatar)) |
486 | { | ||
487 | return true; | ||
488 | } | ||
455 | } | 489 | } |
456 | } | 490 | } |
491 | |||
457 | return false; | 492 | return false; |
458 | } | 493 | } |
459 | 494 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index dca842a..f466194 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | |||
@@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
206 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) | 206 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) |
207 | { | 207 | { |
208 | UUID landOwner = landData.OwnerID; | 208 | UUID landOwner = landData.OwnerID; |
209 | int partCount = obj.Parts.Length; | 209 | int partCount = obj.GetPartCount(); |
210 | 210 | ||
211 | m_SimwideCounts[landOwner] += partCount; | 211 | m_SimwideCounts[landOwner] += partCount; |
212 | if (parcelCounts.Users.ContainsKey(obj.OwnerID)) | 212 | if (parcelCounts.Users.ContainsKey(obj.OwnerID)) |
@@ -593,4 +593,4 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
593 | } | 593 | } |
594 | } | 594 | } |
595 | } | 595 | } |
596 | } \ No newline at end of file | 596 | } |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 170c35f..a098ff6 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -362,7 +362,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
362 | 362 | ||
363 | public string Name | 363 | public string Name |
364 | { | 364 | { |
365 | get { return "PermissionsModule"; } | 365 | get { return "DefaultPermissionsModule"; } |
366 | } | 366 | } |
367 | 367 | ||
368 | public bool IsSharedModule | 368 | public bool IsSharedModule |
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index ab6a598..19ee7f5 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs | |||
@@ -28,6 +28,8 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Timers; | 30 | using System.Timers; |
31 | using System.IO; | ||
32 | using System.Diagnostics; | ||
31 | using System.Threading; | 33 | using System.Threading; |
32 | using System.Collections.Generic; | 34 | using System.Collections.Generic; |
33 | using log4net; | 35 | using log4net; |
@@ -56,13 +58,23 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
56 | protected UUID m_Initiator; | 58 | protected UUID m_Initiator; |
57 | protected bool m_Notice = false; | 59 | protected bool m_Notice = false; |
58 | protected IDialogModule m_DialogModule = null; | 60 | protected IDialogModule m_DialogModule = null; |
61 | protected string m_MarkerPath = String.Empty; | ||
59 | 62 | ||
60 | public void Initialise(IConfigSource config) | 63 | public void Initialise(IConfigSource config) |
61 | { | 64 | { |
65 | IConfig restartConfig = config.Configs["RestartModule"]; | ||
66 | if (restartConfig != null) | ||
67 | { | ||
68 | m_MarkerPath = restartConfig.GetString("MarkerPath", String.Empty); | ||
69 | } | ||
62 | } | 70 | } |
63 | 71 | ||
64 | public void AddRegion(Scene scene) | 72 | public void AddRegion(Scene scene) |
65 | { | 73 | { |
74 | if (m_MarkerPath != String.Empty) | ||
75 | File.Delete(Path.Combine(m_MarkerPath, | ||
76 | scene.RegionInfo.RegionID.ToString())); | ||
77 | |||
66 | m_Scene = scene; | 78 | m_Scene = scene; |
67 | scene.RegisterModuleInterface<IRestartModule>(this); | 79 | scene.RegisterModuleInterface<IRestartModule>(this); |
68 | MainConsole.Instance.Commands.AddCommand("RestartModule", | 80 | MainConsole.Instance.Commands.AddCommand("RestartModule", |
@@ -114,6 +126,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
114 | 126 | ||
115 | if (alerts == null) | 127 | if (alerts == null) |
116 | { | 128 | { |
129 | CreateMarkerFile(); | ||
117 | m_Scene.RestartNow(); | 130 | m_Scene.RestartNow(); |
118 | return; | 131 | return; |
119 | } | 132 | } |
@@ -127,6 +140,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
127 | 140 | ||
128 | if (m_Alerts[0] == 0) | 141 | if (m_Alerts[0] == 0) |
129 | { | 142 | { |
143 | CreateMarkerFile(); | ||
130 | m_Scene.RestartNow(); | 144 | m_Scene.RestartNow(); |
131 | return; | 145 | return; |
132 | } | 146 | } |
@@ -140,6 +154,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
140 | { | 154 | { |
141 | if (m_Alerts.Count == 0 || m_Alerts[0] == 0) | 155 | if (m_Alerts.Count == 0 || m_Alerts[0] == 0) |
142 | { | 156 | { |
157 | CreateMarkerFile(); | ||
143 | m_Scene.RestartNow(); | 158 | m_Scene.RestartNow(); |
144 | return 0; | 159 | return 0; |
145 | } | 160 | } |
@@ -259,5 +274,25 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
259 | 274 | ||
260 | ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); | 275 | ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); |
261 | } | 276 | } |
277 | |||
278 | protected void CreateMarkerFile() | ||
279 | { | ||
280 | if (m_MarkerPath == String.Empty) | ||
281 | return; | ||
282 | |||
283 | string path = Path.Combine(m_MarkerPath, m_Scene.RegionInfo.RegionID.ToString()); | ||
284 | try | ||
285 | { | ||
286 | string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); | ||
287 | FileStream fs = File.Create(path); | ||
288 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
289 | Byte[] buf = enc.GetBytes(pidstring); | ||
290 | fs.Write(buf, 0, buf.Length); | ||
291 | fs.Close(); | ||
292 | } | ||
293 | catch (Exception) | ||
294 | { | ||
295 | } | ||
296 | } | ||
262 | } | 297 | } |
263 | } | 298 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 9c7b2fa..2da6458 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -584,6 +584,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
584 | m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised()); | 584 | m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised()); |
585 | m_scene.SaveTerrain(); | 585 | m_scene.SaveTerrain(); |
586 | 586 | ||
587 | m_scene.EventManager.TriggerTerrainUpdate(); | ||
588 | |||
587 | // Clients who look at the map will never see changes after they looked at the map, so i've commented this out. | 589 | // Clients who look at the map will never see changes after they looked at the map, so i've commented this out. |
588 | //m_scene.CreateTerrainTexture(true); | 590 | //m_scene.CreateTerrainTexture(true); |
589 | } | 591 | } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index f9ef286..d0aa53e 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -86,9 +86,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
86 | 86 | ||
87 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName) | 87 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName) |
88 | { | 88 | { |
89 | if (mapName.Length < 3) | 89 | if (mapName.Length < 2) |
90 | { | 90 | { |
91 | remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); | 91 | remoteClient.SendAlertMessage("Use a search string with at least 2 characters"); |
92 | return; | 92 | return; |
93 | } | 93 | } |
94 | 94 | ||
@@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
106 | else if (regionInfos.Count == 0 && mapName.StartsWith("http://")) | 106 | else if (regionInfos.Count == 0 && mapName.StartsWith("http://")) |
107 | remoteClient.SendAlertMessage("Hyperlink could not be established."); | 107 | remoteClient.SendAlertMessage("Hyperlink could not be established."); |
108 | 108 | ||
109 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); | 109 | //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); |
110 | List<MapBlockData> blocks = new List<MapBlockData>(); | 110 | List<MapBlockData> blocks = new List<MapBlockData>(); |
111 | 111 | ||
112 | MapBlockData data; | 112 | MapBlockData data; |
@@ -132,15 +132,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
132 | data.Agents = 0; | 132 | data.Agents = 0; |
133 | data.Access = 255; | 133 | data.Access = 255; |
134 | data.MapImageId = UUID.Zero; | 134 | data.MapImageId = UUID.Zero; |
135 | data.Name = ""; // mapName; | 135 | data.Name = mapName; |
136 | data.RegionFlags = 0; | 136 | data.RegionFlags = 0; |
137 | data.WaterHeight = 0; // not used | 137 | data.WaterHeight = 0; // not used |
138 | data.X = 0; | 138 | data.X = 0; |
139 | data.Y = 0; | 139 | data.Y = 0; |
140 | blocks.Add(data); | 140 | blocks.Add(data); |
141 | 141 | ||
142 | // not sure what the flags do here, but seems to be necessary | ||
143 | // to set to "2" for viewer 2 | ||
144 | remoteClient.SendMapBlock(blocks, 2); | 142 | remoteClient.SendMapBlock(blocks, 2); |
145 | } | 143 | } |
146 | 144 | ||
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 1094970..b05aef8 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1056,7 +1056,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1056 | } | 1056 | } |
1057 | else | 1057 | else |
1058 | { | 1058 | { |
1059 | OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount()); | 1059 | OSDArray responsearr = new OSDArray(); // Don't preallocate. MT (m_scene.GetRootAgentCount()); |
1060 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) | 1060 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
1061 | { | 1061 | { |
1062 | OSDMap responsemapdata = new OSDMap(); | 1062 | OSDMap responsemapdata = new OSDMap(); |