diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
39 files changed, 1735 insertions, 648 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs index 9d8082b..ff4ec4c 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs | |||
@@ -168,6 +168,19 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
168 | { | 168 | { |
169 | if (XferUploaders.ContainsKey(transactionID)) | 169 | if (XferUploaders.ContainsKey(transactionID)) |
170 | { | 170 | { |
171 | // m_log.DebugFormat("[XFER]: Asked to update item {0} ({1})", | ||
172 | // item.Name, item.ID); | ||
173 | |||
174 | // Here we need to get the old asset to extract the | ||
175 | // texture UUIDs if it's a wearable. | ||
176 | if (item.AssetType == (int)AssetType.Bodypart || | ||
177 | item.AssetType == (int)AssetType.Clothing) | ||
178 | { | ||
179 | AssetBase oldAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); | ||
180 | if (oldAsset != null) | ||
181 | XferUploaders[transactionID].SetOldData(oldAsset.Data); | ||
182 | } | ||
183 | |||
171 | AssetBase asset = GetTransactionAsset(transactionID); | 184 | AssetBase asset = GetTransactionAsset(transactionID); |
172 | 185 | ||
173 | if (asset != null) | 186 | if (asset != null) |
@@ -182,6 +195,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
182 | 195 | ||
183 | IInventoryService invService = m_Scene.InventoryService; | 196 | IInventoryService invService = m_Scene.InventoryService; |
184 | invService.UpdateItem(item); | 197 | invService.UpdateItem(item); |
198 | |||
199 | // m_log.DebugFormat("[XFER]: Updated item {0} ({1}) with asset {2}", | ||
200 | // item.Name, item.ID, asset.FullID); | ||
185 | } | 201 | } |
186 | } | 202 | } |
187 | } | 203 | } |
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/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 48ee277..9ef5bc9 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -268,7 +268,16 @@ namespace Flotsam.RegionModules.AssetCache | |||
268 | // If the file is already cached, don't cache it, just touch it so access time is updated | 268 | // If the file is already cached, don't cache it, just touch it so access time is updated |
269 | if (File.Exists(filename)) | 269 | if (File.Exists(filename)) |
270 | { | 270 | { |
271 | File.SetLastAccessTime(filename, DateTime.Now); | 271 | // We don't really want to know about sharing |
272 | // violations here. If the file is locked, then | ||
273 | // the other thread has updated the time for us. | ||
274 | try | ||
275 | { | ||
276 | File.SetLastAccessTime(filename, DateTime.Now); | ||
277 | } | ||
278 | catch | ||
279 | { | ||
280 | } | ||
272 | } else { | 281 | } else { |
273 | 282 | ||
274 | // Once we start writing, make sure we flag that we're writing | 283 | // 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 520d794..47476a9 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> |
@@ -600,15 +609,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
600 | 609 | ||
601 | if (!silent) | 610 | if (!silent) |
602 | { | 611 | { |
603 | // Killing it here will cause the client to deselect it | ||
604 | // It then reappears on the avatar, deselected | ||
605 | // through the full update below | ||
606 | // | ||
607 | if (so.IsSelected) | ||
608 | { | ||
609 | m_scene.SendKillObject(so.RootPart.LocalId); | ||
610 | } | ||
611 | |||
612 | so.IsSelected = false; // fudge.... | 612 | so.IsSelected = false; // fudge.... |
613 | so.ScheduleGroupForFullUpdate(); | 613 | so.ScheduleGroupForFullUpdate(); |
614 | } | 614 | } |
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 0db31eb..8a16582 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | |||
@@ -216,4 +216,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
216 | return result; | 216 | return result; |
217 | } | 217 | } |
218 | } | 218 | } |
219 | } \ No newline at end of file | 219 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index daee4ca..c8167c5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -304,7 +304,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
304 | //m_log.DebugFormat("[XXX]: OnClientLogin!"); | 304 | //m_log.DebugFormat("[XXX]: OnClientLogin!"); |
305 | // Inform the friends that this user is online | 305 | // Inform the friends that this user is online |
306 | StatusChange(agentID, true); | 306 | StatusChange(agentID, true); |
307 | 307 | ||
308 | // Register that we need to send the list of online friends to this user | 308 | // Register that we need to send the list of online friends to this user |
309 | lock (m_NeedsListOfFriends) | 309 | lock (m_NeedsListOfFriends) |
310 | m_NeedsListOfFriends.Add(agentID); | 310 | m_NeedsListOfFriends.Add(agentID); |
@@ -579,6 +579,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
579 | 579 | ||
580 | StoreFriendships(agentID, friendID); | 580 | StoreFriendships(agentID, friendID); |
581 | 581 | ||
582 | ICallingCardModule ccm = client.Scene.RequestModuleInterface<ICallingCardModule>(); | ||
583 | if (ccm != null) | ||
584 | { | ||
585 | ccm.CreateCallingCard(agentID, friendID, UUID.Zero); | ||
586 | } | ||
587 | |||
582 | // Update the local cache | 588 | // Update the local cache |
583 | RefetchFriends(client); | 589 | RefetchFriends(client); |
584 | 590 | ||
@@ -755,6 +761,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
755 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); | 761 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); |
756 | friendClient.SendInstantMessage(im); | 762 | friendClient.SendInstantMessage(im); |
757 | 763 | ||
764 | ICallingCardModule ccm = friendClient.Scene.RequestModuleInterface<ICallingCardModule>(); | ||
765 | if (ccm != null) | ||
766 | { | ||
767 | ccm.CreateCallingCard(friendID, userID, UUID.Zero); | ||
768 | } | ||
769 | |||
770 | |||
758 | // Update the local cache | 771 | // Update the local cache |
759 | RefetchFriends(friendClient); | 772 | RefetchFriends(friendClient); |
760 | 773 | ||
@@ -777,7 +790,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
777 | // we're done | 790 | // we're done |
778 | return true; | 791 | return true; |
779 | } | 792 | } |
780 | 793 | ||
781 | return false; | 794 | return false; |
782 | } | 795 | } |
783 | 796 | ||
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 321b38b..1a0b914 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -171,16 +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); |
179 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); | ||
180 | 178 | ||
181 | if (msglist == null) | 179 | List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( |
182 | m_log.WarnFormat("[OFFLINE MESSAGING]: WARNING null message list."); | 180 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); |
183 | 181 | ||
182 | if (msglist != null) | ||
183 | { | ||
184 | foreach (GridInstantMessage im in msglist) | 184 | foreach (GridInstantMessage im in msglist) |
185 | { | 185 | { |
186 | // client.SendInstantMessage(im); | 186 | // client.SendInstantMessage(im); |
@@ -191,6 +191,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
191 | // Needed for proper state management for stored group | 191 | // Needed for proper state management for stored group |
192 | // invitations | 192 | // invitations |
193 | // | 193 | // |
194 | |||
195 | im.offline = 1; | ||
196 | |||
194 | Scene s = FindScene(client.AgentId); | 197 | Scene s = FindScene(client.AgentId); |
195 | if (s != null) | 198 | if (s != null) |
196 | s.EventManager.TriggerIncomingInstantMessage(im); | 199 | s.EventManager.TriggerIncomingInstantMessage(im); |
@@ -200,26 +203,38 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
200 | 203 | ||
201 | private void UndeliveredMessage(GridInstantMessage im) | 204 | private void UndeliveredMessage(GridInstantMessage im) |
202 | { | 205 | { |
203 | if ((im.offline != 0) | 206 | if (im.dialog != (byte)InstantMessageDialog.MessageFromObject && |
204 | && (!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) | ||
205 | { | 211 | { |
206 | bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( | 212 | return; |
207 | "POST", m_RestURL+"/SaveMessage/", im); | 213 | } |
208 | 214 | ||
209 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) | 215 | // It's not delivered. Make sure the scope id is saved |
210 | { | 216 | // We don't need the imSessionID here anymore, overwrite it |
211 | IClientAPI client = FindClient(new UUID(im.fromAgentID)); | 217 | Scene scene = FindScene(new UUID(im.fromAgentID)); |
212 | if (client == null) | 218 | if (scene == null) |
213 | return; | 219 | scene = m_SceneList[0]; |
214 | 220 | ||
215 | client.SendInstantMessage(new GridInstantMessage( | 221 | bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( |
216 | null, new UUID(im.toAgentID), | 222 | "POST", m_RestURL+"/SaveMessage/?scope=" + |
217 | "System", new UUID(im.fromAgentID), | 223 | scene.RegionInfo.ScopeID.ToString(), im); |
218 | (byte)InstantMessageDialog.MessageFromAgent, | 224 | |
219 | "User is not logged in. "+ | 225 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) |
220 | (success ? "Message saved." : "Message not saved"), | 226 | { |
221 | false, new Vector3())); | 227 | IClientAPI client = FindClient(new UUID(im.fromAgentID)); |
222 | } | 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())); | ||
223 | } | 238 | } |
224 | } | 239 | } |
225 | } | 240 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 6b24718..a19bbfd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -632,4 +632,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
632 | m_assetsLoaded = true; | 632 | m_assetsLoaded = true; |
633 | } | 633 | } |
634 | } | 634 | } |
635 | } \ No newline at end of file | 635 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index c2ad079..93657a8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -146,9 +146,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
146 | 146 | ||
147 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) | 147 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) |
148 | { | 148 | { |
149 | if (options.ContainsKey("verbose")) | ||
150 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving item {0} with asset {1}", inventoryItem.ID, inventoryItem.AssetID); | ||
151 | |||
152 | string filename = path + CreateArchiveItemName(inventoryItem); | 149 | string filename = path + CreateArchiveItemName(inventoryItem); |
153 | 150 | ||
154 | // Record the creator of this item for user record purposes (which might go away soon) | 151 | // Record the creator of this item for user record purposes (which might go away soon) |
@@ -176,9 +173,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
176 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, | 173 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, |
177 | Dictionary<string, object> options, IUserAccountService userAccountService) | 174 | Dictionary<string, object> options, IUserAccountService userAccountService) |
178 | { | 175 | { |
179 | if (options.ContainsKey("verbose")) | ||
180 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving folder {0}", inventoryFolder.Name); | ||
181 | |||
182 | if (saveThisFolderItself) | 176 | if (saveThisFolderItself) |
183 | { | 177 | { |
184 | path += CreateArchiveFolderName(inventoryFolder); | 178 | path += CreateArchiveFolderName(inventoryFolder); |
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 d295384..dcfdf8f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | |||
@@ -155,16 +155,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
155 | scene.RegionInfo.RegionHandle, | 155 | scene.RegionInfo.RegionHandle, |
156 | (uint)presence.AbsolutePosition.X, | 156 | (uint)presence.AbsolutePosition.X, |
157 | (uint)presence.AbsolutePosition.Y, | 157 | (uint)presence.AbsolutePosition.Y, |
158 | (uint)presence.AbsolutePosition.Z); | 158 | (uint)presence.AbsolutePosition.Z + 2); |
159 | 159 | ||
160 | m_log.DebugFormat("TP invite with message {0}", message); | 160 | m_log.DebugFormat("[LURE]: TP invite with message {0}", message); |
161 | |||
162 | GridInstantMessage m; | ||
163 | |||
164 | if (scene.Permissions.IsAdministrator(client.AgentId) && presence.GodLevel >= 200 && (!scene.Permissions.IsAdministrator(targetid))) | ||
165 | { | ||
166 | m = new GridInstantMessage(scene, client.AgentId, | ||
167 | client.FirstName+" "+client.LastName, targetid, | ||
168 | (byte)InstantMessageDialog.GodLikeRequestTeleport, false, | ||
169 | message, dest, false, presence.AbsolutePosition, | ||
170 | new Byte[0]); | ||
171 | } | ||
172 | else | ||
173 | { | ||
174 | m = new GridInstantMessage(scene, client.AgentId, | ||
175 | client.FirstName+" "+client.LastName, targetid, | ||
176 | (byte)InstantMessageDialog.RequestTeleport, false, | ||
177 | message, dest, false, presence.AbsolutePosition, | ||
178 | new Byte[0]); | ||
179 | } | ||
161 | 180 | ||
162 | GridInstantMessage m = new GridInstantMessage(scene, client.AgentId, | ||
163 | client.FirstName+" "+client.LastName, targetid, | ||
164 | (byte)InstantMessageDialog.RequestTeleport, false, | ||
165 | message, dest, false, presence.AbsolutePosition, | ||
166 | new Byte[0]); | ||
167 | |||
168 | if (m_TransferModule != null) | 181 | if (m_TransferModule != null) |
169 | { | 182 | { |
170 | m_TransferModule.SendInstantMessage(m, | 183 | m_TransferModule.SendInstantMessage(m, |
@@ -199,7 +212,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
199 | { | 212 | { |
200 | // Forward remote teleport requests | 213 | // Forward remote teleport requests |
201 | // | 214 | // |
202 | if (msg.dialog != 22) | 215 | if (msg.dialog != (byte)InstantMessageDialog.RequestTeleport && |
216 | msg.dialog != (byte)InstantMessageDialog.GodLikeRequestTeleport) | ||
203 | return; | 217 | return; |
204 | 218 | ||
205 | if (m_TransferModule != null) | 219 | if (m_TransferModule != null) |
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index eb776fe..7ae304c 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs | |||
@@ -97,7 +97,8 @@ namespace OpenSim.Region.CoreModules.Framework | |||
97 | 97 | ||
98 | public void CreateCaps(UUID agentId) | 98 | public void CreateCaps(UUID agentId) |
99 | { | 99 | { |
100 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId)) | 100 | int flags = m_scene.GetUserFlags(agentId); |
101 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) | ||
101 | return; | 102 | return; |
102 | 103 | ||
103 | String capsObjectPath = GetCapsPath(agentId); | 104 | String capsObjectPath = GetCapsPath(agentId); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 1341533..02efcd8 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
104 | 104 | ||
105 | protected virtual void OnNewClient(IClientAPI client) | 105 | protected virtual void OnNewClient(IClientAPI client) |
106 | { | 106 | { |
107 | client.OnTeleportHomeRequest += TeleportHome; | 107 | client.OnTeleportHomeRequest += TriggerTeleportHome; |
108 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 108 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
109 | } | 109 | } |
110 | 110 | ||
@@ -184,6 +184,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
184 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 184 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
185 | 185 | ||
186 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 186 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
187 | sp.TeleportFlags = (TeleportFlags)teleportFlags; | ||
187 | sp.Teleport(position); | 188 | sp.Teleport(position); |
188 | 189 | ||
189 | foreach (SceneObjectGroup grp in sp.Attachments) | 190 | foreach (SceneObjectGroup grp in sp.Attachments) |
@@ -275,7 +276,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
275 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | 276 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, |
276 | // it's actually doing a lot of work. | 277 | // it's actually doing a lot of work. |
277 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; | 278 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; |
278 | if (endPoint.Address != null) | 279 | if (endPoint != null && endPoint.Address != null) |
279 | { | 280 | { |
280 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 281 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
281 | // both regions | 282 | // both regions |
@@ -524,7 +525,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
524 | 525 | ||
525 | protected void KillEntity(Scene scene, uint localID) | 526 | protected void KillEntity(Scene scene, uint localID) |
526 | { | 527 | { |
527 | scene.SendKillObject(localID); | 528 | scene.SendKillObject(new List<uint>() { localID }); |
528 | } | 529 | } |
529 | 530 | ||
530 | protected virtual GridRegion GetFinalDestination(GridRegion region) | 531 | protected virtual GridRegion GetFinalDestination(GridRegion region) |
@@ -585,7 +586,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
585 | 586 | ||
586 | #region Teleport Home | 587 | #region Teleport Home |
587 | 588 | ||
588 | public virtual void TeleportHome(UUID id, IClientAPI client) | 589 | public virtual void TriggerTeleportHome(UUID id, IClientAPI client) |
590 | { | ||
591 | TeleportHome(id, client); | ||
592 | } | ||
593 | |||
594 | public virtual bool TeleportHome(UUID id, IClientAPI client) | ||
589 | { | 595 | { |
590 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 596 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
591 | 597 | ||
@@ -594,12 +600,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
594 | 600 | ||
595 | if (uinfo != null) | 601 | if (uinfo != null) |
596 | { | 602 | { |
603 | if (uinfo.HomeRegionID == UUID.Zero) | ||
604 | { | ||
605 | // can't find the Home region: Tell viewer and abort | ||
606 | client.SendTeleportFailed("You don't have a home position set."); | ||
607 | return false; | ||
608 | } | ||
597 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); | 609 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); |
598 | if (regionInfo == null) | 610 | if (regionInfo == null) |
599 | { | 611 | { |
600 | // can't find the Home region: Tell viewer and abort | 612 | // can't find the Home region: Tell viewer and abort |
601 | client.SendTeleportFailed("Your home region could not be found."); | 613 | client.SendTeleportFailed("Your home region could not be found."); |
602 | return; | 614 | return false; |
603 | } | 615 | } |
604 | 616 | ||
605 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", | 617 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", |
@@ -610,6 +622,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
610 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, | 622 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, |
611 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); | 623 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); |
612 | } | 624 | } |
625 | else | ||
626 | { | ||
627 | // can't find the Home region: Tell viewer and abort | ||
628 | client.SendTeleportFailed("Your home region could not be found."); | ||
629 | return false; | ||
630 | } | ||
631 | return true; | ||
613 | } | 632 | } |
614 | 633 | ||
615 | #endregion | 634 | #endregion |
@@ -946,15 +965,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
946 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | 965 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); |
947 | 966 | ||
948 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | 967 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); |
949 | if (eq != null) | 968 | IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint; |
950 | { | 969 | if (neighbourExternal != null) |
951 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | ||
952 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
953 | } | ||
954 | else | ||
955 | { | 970 | { |
956 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | 971 | if (eq != null) |
957 | capsPath); | 972 | { |
973 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
974 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
975 | } | ||
976 | else | ||
977 | { | ||
978 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
979 | capsPath); | ||
980 | } | ||
958 | } | 981 | } |
959 | 982 | ||
960 | if (!WaitForCallback(agent.UUID)) | 983 | if (!WaitForCallback(agent.UUID)) |
@@ -1066,10 +1089,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1066 | agent.Id0 = currentAgentCircuit.Id0; | 1089 | agent.Id0 = currentAgentCircuit.Id0; |
1067 | } | 1090 | } |
1068 | 1091 | ||
1069 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1092 | IPEndPoint external = region.ExternalEndPoint; |
1070 | d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true, | 1093 | if (external != null) |
1094 | { | ||
1095 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
1096 | d.BeginInvoke(sp, agent, region, external, true, | ||
1071 | InformClientOfNeighbourCompleted, | 1097 | InformClientOfNeighbourCompleted, |
1072 | d); | 1098 | d); |
1099 | } | ||
1073 | } | 1100 | } |
1074 | #endregion | 1101 | #endregion |
1075 | 1102 | ||
@@ -1202,6 +1229,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1202 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1229 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; |
1203 | try | 1230 | try |
1204 | { | 1231 | { |
1232 | //neighbour.ExternalEndPoint may return null, which will be caught | ||
1205 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, | 1233 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, |
1206 | InformClientOfNeighbourCompleted, | 1234 | InformClientOfNeighbourCompleted, |
1207 | d); | 1235 | d); |
@@ -1305,8 +1333,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1305 | 1333 | ||
1306 | m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); | 1334 | m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); |
1307 | } | 1335 | } |
1308 | if (!regionAccepted) | ||
1309 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Region {0} did not accept agent: {1}", reg.RegionName, reason); | ||
1310 | } | 1336 | } |
1311 | 1337 | ||
1312 | /// <summary> | 1338 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 4d77ef4..8858ad5 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 += TriggerTeleportHome; |
90 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 90 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
91 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); | 91 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); |
92 | } | 92 | } |
@@ -181,7 +181,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
181 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | 181 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); |
182 | } | 182 | } |
183 | 183 | ||
184 | public override void TeleportHome(UUID id, IClientAPI client) | 184 | public void TriggerTeleportHome(UUID id, IClientAPI client) |
185 | { | ||
186 | TeleportHome(id, client); | ||
187 | } | ||
188 | |||
189 | public override bool TeleportHome(UUID id, IClientAPI client) | ||
185 | { | 190 | { |
186 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 191 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
187 | 192 | ||
@@ -191,8 +196,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
191 | { | 196 | { |
192 | // local grid user | 197 | // local grid user |
193 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); | 198 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); |
194 | base.TeleportHome(id, client); | 199 | return base.TeleportHome(id, client); |
195 | return; | ||
196 | } | 200 | } |
197 | 201 | ||
198 | // Foreign user wants to go home | 202 | // Foreign user wants to go home |
@@ -202,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
202 | { | 206 | { |
203 | client.SendTeleportFailed("Your information has been lost"); | 207 | client.SendTeleportFailed("Your information has been lost"); |
204 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); | 208 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); |
205 | return; | 209 | return false; |
206 | } | 210 | } |
207 | 211 | ||
208 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); | 212 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); |
@@ -212,7 +216,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
212 | { | 216 | { |
213 | client.SendTeleportFailed("Your home region could not be found"); | 217 | client.SendTeleportFailed("Your home region could not be found"); |
214 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); | 218 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); |
215 | return; | 219 | return false; |
216 | } | 220 | } |
217 | 221 | ||
218 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); | 222 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); |
@@ -220,7 +224,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
220 | { | 224 | { |
221 | client.SendTeleportFailed("Internal error"); | 225 | client.SendTeleportFailed("Internal error"); |
222 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); | 226 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); |
223 | return; | 227 | return false; |
224 | } | 228 | } |
225 | 229 | ||
226 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | 230 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); |
@@ -230,6 +234,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
230 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); | 234 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); |
231 | 235 | ||
232 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); | 236 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); |
237 | return true; | ||
233 | } | 238 | } |
234 | 239 | ||
235 | /// <summary> | 240 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 2930303..7bad814 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -325,7 +325,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
325 | } | 325 | } |
326 | } | 326 | } |
327 | 327 | ||
328 | // This is method scoped and will be returned. It will be the | 328 | // This is pethod scoped and will be returned. It will be the |
329 | // last created asset id | 329 | // last created asset id |
330 | UUID assetID = UUID.Zero; | 330 | UUID assetID = UUID.Zero; |
331 | 331 | ||
@@ -354,6 +354,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
354 | CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero); | 354 | CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero); |
355 | Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>(); | 355 | Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>(); |
356 | 356 | ||
357 | Dictionary<UUID, string> xmlStrings = | ||
358 | new Dictionary<UUID, string>(); | ||
359 | |||
357 | foreach (SceneObjectGroup objectGroup in objlist) | 360 | foreach (SceneObjectGroup objectGroup in objlist) |
358 | { | 361 | { |
359 | Vector3 inventoryStoredPosition = new Vector3 | 362 | Vector3 inventoryStoredPosition = new Vector3 |
@@ -366,7 +369,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
366 | : objectGroup.AbsolutePosition.Y, | 369 | : objectGroup.AbsolutePosition.Y, |
367 | objectGroup.AbsolutePosition.Z); | 370 | objectGroup.AbsolutePosition.Z); |
368 | 371 | ||
369 | originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; | 372 | Vector3 originalPosition = objectGroup.AbsolutePosition; |
373 | |||
374 | // Restore attachment data after trip through the sim | ||
375 | if (objectGroup.RootPart.AttachPoint > 0) | ||
376 | inventoryStoredPosition = objectGroup.RootPart.AttachOffset; | ||
377 | objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint; | ||
370 | 378 | ||
371 | objectGroup.AbsolutePosition = inventoryStoredPosition; | 379 | objectGroup.AbsolutePosition = inventoryStoredPosition; |
372 | 380 | ||
@@ -380,159 +388,60 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
380 | (uint)PermissionMask.Modify); | 388 | (uint)PermissionMask.Modify); |
381 | objectGroup.RootPart.NextOwnerMask |= | 389 | objectGroup.RootPart.NextOwnerMask |= |
382 | (uint)PermissionMask.Move; | 390 | (uint)PermissionMask.Move; |
383 | |||
384 | coa.Add(objectGroup); | ||
385 | } | ||
386 | 391 | ||
387 | string itemXml; | 392 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); |
388 | 393 | ||
389 | if (objlist.Count > 1) | 394 | objectGroup.AbsolutePosition = originalPosition; |
390 | itemXml = CoalescedSceneObjectsSerializer.ToXml(coa); | ||
391 | else | ||
392 | itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0]); | ||
393 | |||
394 | // Restore the position of each group now that it has been stored to inventory. | ||
395 | foreach (SceneObjectGroup objectGroup in objlist) | ||
396 | objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; | ||
397 | 395 | ||
398 | InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID); | 396 | xmlStrings[objectGroup.UUID] = sceneObjectXml; |
399 | if (item == null) | ||
400 | return UUID.Zero; | ||
401 | |||
402 | // Can't know creator is the same, so null it in inventory | ||
403 | if (objlist.Count > 1) | ||
404 | { | ||
405 | item.CreatorId = UUID.Zero.ToString(); | ||
406 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; | ||
407 | } | 397 | } |
408 | else | ||
409 | { | ||
410 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | ||
411 | item.SaleType = objlist[0].RootPart.ObjectSaleType; | ||
412 | item.SalePrice = objlist[0].RootPart.SalePrice; | ||
413 | } | ||
414 | 398 | ||
415 | AssetBase asset = CreateAsset( | 399 | string itemXml; |
416 | objlist[0].GetPartName(objlist[0].RootPart.LocalId), | ||
417 | objlist[0].GetPartDescription(objlist[0].RootPart.LocalId), | ||
418 | (sbyte)AssetType.Object, | ||
419 | Utils.StringToBytes(itemXml), | ||
420 | objlist[0].OwnerID.ToString()); | ||
421 | m_Scene.AssetService.Store(asset); | ||
422 | |||
423 | item.AssetID = asset.FullID; | ||
424 | assetID = asset.FullID; | ||
425 | 400 | ||
426 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | 401 | if (objlist.Count > 1) |
427 | { | ||
428 | m_Scene.InventoryService.UpdateItem(item); | ||
429 | } | ||
430 | else | ||
431 | { | 402 | { |
432 | AddPermissions(item, objlist[0], objlist, remoteClient); | 403 | float minX, minY, minZ; |
404 | float maxX, maxY, maxZ; | ||
433 | 405 | ||
434 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 406 | Vector3[] offsets = Scene.GetCombinedBoundingBox(objlist, |
435 | item.Description = asset.Description; | 407 | out minX, out maxX, out minY, out maxY, |
436 | item.Name = asset.Name; | 408 | out minZ, out maxZ); |
437 | item.AssetType = asset.Type; | ||
438 | 409 | ||
439 | m_Scene.AddInventoryItem(item); | 410 | // CreateWrapper |
411 | XmlDocument itemDoc = new XmlDocument(); | ||
412 | XmlElement root = itemDoc.CreateElement("", "CoalescedObject", ""); | ||
413 | itemDoc.AppendChild(root); | ||
440 | 414 | ||
441 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | 415 | // Embed the offsets into the group XML |
442 | { | 416 | for ( int i = 0 ; i < objlist.Count ; i++ ) |
443 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
444 | } | ||
445 | else | ||
446 | { | 417 | { |
447 | ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); | 418 | XmlDocument doc = new XmlDocument(); |
448 | if (notifyUser != null) | 419 | SceneObjectGroup g = objlist[i]; |
449 | { | 420 | doc.LoadXml(xmlStrings[g.UUID]); |
450 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | 421 | XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup"); |
451 | } | 422 | e.SetAttribute("offsetx", offsets[i].X.ToString()); |
423 | e.SetAttribute("offsety", offsets[i].Y.ToString()); | ||
424 | e.SetAttribute("offsetz", offsets[i].Z.ToString()); | ||
425 | |||
426 | XmlNode objectNode = itemDoc.ImportNode(e, true); | ||
427 | root.AppendChild(objectNode); | ||
452 | } | 428 | } |
453 | } | ||
454 | |||
455 | // This is a hook to do some per-asset post-processing for subclasses that need that | ||
456 | if (remoteClient != null) | ||
457 | ExportAsset(remoteClient.AgentId, assetID); | ||
458 | |||
459 | return assetID; | ||
460 | } | ||
461 | 429 | ||
462 | protected virtual void ExportAsset(UUID agentID, UUID assetID) | 430 | float sizeX = maxX - minX; |
463 | { | 431 | float sizeY = maxY - minY; |
464 | // nothing to do here | 432 | float sizeZ = maxZ - minZ; |
465 | } | ||
466 | 433 | ||
467 | /// <summary> | 434 | root.SetAttribute("x", sizeX.ToString()); |
468 | /// Add relevant permissions for an object to the item. | 435 | root.SetAttribute("y", sizeY.ToString()); |
469 | /// </summary> | 436 | root.SetAttribute("z", sizeZ.ToString()); |
470 | /// <param name="item"></param> | ||
471 | /// <param name="so"></param> | ||
472 | /// <param name="objsForEffectivePermissions"></param> | ||
473 | /// <param name="remoteClient"></param> | ||
474 | /// <returns></returns> | ||
475 | protected InventoryItemBase AddPermissions( | ||
476 | InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions, | ||
477 | IClientAPI remoteClient) | ||
478 | { | ||
479 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; | ||
480 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) | ||
481 | effectivePerms &= grp.GetEffectivePermissions(); | ||
482 | effectivePerms |= (uint)PermissionMask.Move; | ||
483 | 437 | ||
484 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 438 | itemXml = itemDoc.InnerXml; |
485 | { | ||
486 | uint perms = effectivePerms; | ||
487 | uint nextPerms = (perms & 7) << 13; | ||
488 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
489 | perms &= ~(uint)PermissionMask.Copy; | ||
490 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
491 | perms &= ~(uint)PermissionMask.Transfer; | ||
492 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
493 | perms &= ~(uint)PermissionMask.Modify; | ||
494 | |||
495 | item.BasePermissions = perms & so.RootPart.NextOwnerMask; | ||
496 | item.CurrentPermissions = item.BasePermissions; | ||
497 | item.NextPermissions = perms & so.RootPart.NextOwnerMask; | ||
498 | item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; | ||
499 | item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; | ||
500 | |||
501 | // Magic number badness. Maybe this deserves an enum. | ||
502 | // bit 4 (16) is the "Slam" bit, it means treat as passed | ||
503 | // and apply next owner perms on rez | ||
504 | item.CurrentPermissions |= 16; // Slam! | ||
505 | } | 439 | } |
506 | else | 440 | else |
507 | { | 441 | { |
508 | item.BasePermissions = effectivePerms; | 442 | itemXml = xmlStrings[objlist[0].UUID]; |
509 | item.CurrentPermissions = effectivePerms; | 443 | } |
510 | item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms; | ||
511 | item.EveryOnePermissions = so.RootPart.EveryoneMask & effectivePerms; | ||
512 | item.GroupPermissions = so.RootPart.GroupMask & effectivePerms; | ||
513 | 444 | ||
514 | item.CurrentPermissions &= | ||
515 | ((uint)PermissionMask.Copy | | ||
516 | (uint)PermissionMask.Transfer | | ||
517 | (uint)PermissionMask.Modify | | ||
518 | (uint)PermissionMask.Move | | ||
519 | 7); // Preserve folded permissions | ||
520 | } | ||
521 | |||
522 | return item; | ||
523 | } | ||
524 | |||
525 | /// <summary> | ||
526 | /// Create an item using details for the given scene object. | ||
527 | /// </summary> | ||
528 | /// <param name="action"></param> | ||
529 | /// <param name="remoteClient"></param> | ||
530 | /// <param name="so"></param> | ||
531 | /// <param name="folderID"></param> | ||
532 | /// <returns></returns> | ||
533 | protected InventoryItemBase CreateItemForObject( | ||
534 | DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID) | ||
535 | { | ||
536 | // Get the user info of the item destination | 445 | // Get the user info of the item destination |
537 | // | 446 | // |
538 | UUID userID = UUID.Zero; | 447 | UUID userID = UUID.Zero; |
@@ -544,7 +453,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
544 | // Saving changes requires a local user | 453 | // Saving changes requires a local user |
545 | // | 454 | // |
546 | if (remoteClient == null) | 455 | if (remoteClient == null) |
547 | return null; | 456 | return UUID.Zero; |
548 | 457 | ||
549 | userID = remoteClient.AgentId; | 458 | userID = remoteClient.AgentId; |
550 | } | 459 | } |
@@ -552,12 +461,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
552 | { | 461 | { |
553 | // All returns / deletes go to the object owner | 462 | // All returns / deletes go to the object owner |
554 | // | 463 | // |
555 | userID = so.RootPart.OwnerID; | 464 | |
465 | userID = objlist[0].RootPart.OwnerID; | ||
556 | } | 466 | } |
557 | 467 | ||
558 | if (userID == UUID.Zero) // Can't proceed | 468 | if (userID == UUID.Zero) // Can't proceed |
559 | { | 469 | { |
560 | return null; | 470 | return UUID.Zero; |
561 | } | 471 | } |
562 | 472 | ||
563 | // If we're returning someone's item, it goes back to the | 473 | // If we're returning someone's item, it goes back to the |
@@ -565,13 +475,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
565 | // Delete is treated like return in this case | 475 | // Delete is treated like return in this case |
566 | // Deleting your own items makes them go to trash | 476 | // Deleting your own items makes them go to trash |
567 | // | 477 | // |
568 | 478 | ||
569 | InventoryFolderBase folder = null; | 479 | InventoryFolderBase folder = null; |
570 | InventoryItemBase item = null; | 480 | InventoryItemBase item = null; |
571 | 481 | ||
572 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | 482 | if (DeRezAction.SaveToExistingUserInventoryItem == action) |
573 | { | 483 | { |
574 | item = new InventoryItemBase(so.RootPart.FromUserInventoryItemID, userID); | 484 | item = new InventoryItemBase(objlist[0].RootPart.FromUserInventoryItemID, userID); |
575 | item = m_Scene.InventoryService.GetItem(item); | 485 | item = m_Scene.InventoryService.GetItem(item); |
576 | 486 | ||
577 | //item = userInfo.RootFolder.FindItem( | 487 | //item = userInfo.RootFolder.FindItem( |
@@ -581,9 +491,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
581 | { | 491 | { |
582 | m_log.DebugFormat( | 492 | m_log.DebugFormat( |
583 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | 493 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", |
584 | so.Name, so.UUID); | 494 | objlist[0].Name, objlist[0].UUID); |
585 | 495 | return UUID.Zero; | |
586 | return null; | ||
587 | } | 496 | } |
588 | } | 497 | } |
589 | else | 498 | else |
@@ -595,17 +504,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
595 | // Deleting someone else's item | 504 | // Deleting someone else's item |
596 | // | 505 | // |
597 | if (remoteClient == null || | 506 | if (remoteClient == null || |
598 | so.OwnerID != remoteClient.AgentId) | 507 | objlist[0].OwnerID != remoteClient.AgentId) |
599 | { | 508 | { |
509 | |||
600 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 510 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
601 | } | 511 | } |
602 | else | 512 | else |
603 | { | 513 | { |
604 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | 514 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); |
605 | } | 515 | } |
606 | } | 516 | } |
607 | else if (action == DeRezAction.Return) | 517 | else if (action == DeRezAction.Return) |
608 | { | 518 | { |
519 | |||
609 | // Dump to lost + found unconditionally | 520 | // Dump to lost + found unconditionally |
610 | // | 521 | // |
611 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 522 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
@@ -621,7 +532,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
621 | } | 532 | } |
622 | else | 533 | else |
623 | { | 534 | { |
624 | if (remoteClient == null || so.OwnerID != remoteClient.AgentId) | 535 | if (remoteClient == null || |
536 | objlist[0].OwnerID != remoteClient.AgentId) | ||
625 | { | 537 | { |
626 | // Taking copy of another person's item. Take to | 538 | // Taking copy of another person's item. Take to |
627 | // Objects folder. | 539 | // Objects folder. |
@@ -642,9 +554,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
642 | // | 554 | // |
643 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) | 555 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) |
644 | { | 556 | { |
645 | if (so.RootPart.FromFolderID != UUID.Zero) | 557 | if (objlist[0].RootPart.FromFolderID != UUID.Zero && objlist[0].OwnerID == remoteClient.AgentId) |
646 | { | 558 | { |
647 | InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID); | 559 | InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID); |
648 | folder = m_Scene.InventoryService.GetFolder(f); | 560 | folder = m_Scene.InventoryService.GetFolder(f); |
649 | } | 561 | } |
650 | } | 562 | } |
@@ -655,27 +567,133 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
655 | 567 | ||
656 | if (folder == null) // Nowhere to put it | 568 | if (folder == null) // Nowhere to put it |
657 | { | 569 | { |
658 | return null; | 570 | return UUID.Zero; |
659 | } | 571 | } |
660 | } | 572 | } |
661 | 573 | ||
662 | item = new InventoryItemBase(); | 574 | item = new InventoryItemBase(); |
575 | // Can't know creator is the same, so null it in inventory | ||
576 | if (objlist.Count > 1) | ||
577 | { | ||
578 | item.CreatorId = UUID.Zero.ToString(); | ||
579 | item.CreatorData = String.Empty; | ||
580 | } | ||
581 | else | ||
582 | { | ||
583 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | ||
584 | item.CreatorData = objlist[0].RootPart.CreatorData; | ||
585 | } | ||
663 | item.ID = UUID.Random(); | 586 | item.ID = UUID.Random(); |
664 | item.InvType = (int)InventoryType.Object; | 587 | item.InvType = (int)InventoryType.Object; |
665 | item.Folder = folder.ID; | 588 | item.Folder = folder.ID; |
666 | item.Owner = userID; | 589 | item.Owner = userID; |
667 | } | 590 | if (objlist.Count > 1) |
591 | { | ||
592 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; | ||
593 | } | ||
594 | else | ||
595 | { | ||
596 | item.SaleType = objlist[0].RootPart.ObjectSaleType; | ||
597 | item.SalePrice = objlist[0].RootPart.SalePrice; | ||
598 | } | ||
599 | } | ||
600 | |||
601 | AssetBase asset = CreateAsset( | ||
602 | objlist[0].GetPartName(objlist[0].RootPart.LocalId), | ||
603 | objlist[0].GetPartDescription(objlist[0].RootPart.LocalId), | ||
604 | (sbyte)AssetType.Object, | ||
605 | Utils.StringToBytes(itemXml), | ||
606 | objlist[0].OwnerID.ToString()); | ||
607 | m_Scene.AssetService.Store(asset); | ||
608 | assetID = asset.FullID; | ||
609 | |||
610 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
611 | { | ||
612 | item.AssetID = asset.FullID; | ||
613 | m_Scene.InventoryService.UpdateItem(item); | ||
614 | } | ||
615 | else | ||
616 | { | ||
617 | item.AssetID = asset.FullID; | ||
618 | |||
619 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; | ||
620 | foreach (SceneObjectGroup grp in objlist) | ||
621 | effectivePerms &= grp.GetEffectivePermissions(); | ||
622 | effectivePerms |= (uint)PermissionMask.Move; | ||
623 | |||
624 | if (remoteClient != null && (remoteClient.AgentId != objlist[0].RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | ||
625 | { | ||
626 | uint perms = effectivePerms; | ||
627 | uint nextPerms = (perms & 7) << 13; | ||
628 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
629 | perms &= ~(uint)PermissionMask.Copy; | ||
630 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
631 | perms &= ~(uint)PermissionMask.Transfer; | ||
632 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
633 | perms &= ~(uint)PermissionMask.Modify; | ||
634 | |||
635 | item.BasePermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
636 | item.CurrentPermissions = item.BasePermissions; | ||
637 | item.NextPermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
638 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask; | ||
639 | item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask; | ||
640 | |||
641 | item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | ||
642 | } | ||
643 | else | ||
644 | { | ||
645 | item.BasePermissions = effectivePerms; | ||
646 | item.CurrentPermissions = effectivePerms; | ||
647 | item.NextPermissions = objlist[0].RootPart.NextOwnerMask & effectivePerms; | ||
648 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & effectivePerms; | ||
649 | item.GroupPermissions = objlist[0].RootPart.GroupMask & effectivePerms; | ||
650 | |||
651 | item.CurrentPermissions &= | ||
652 | ((uint)PermissionMask.Copy | | ||
653 | (uint)PermissionMask.Transfer | | ||
654 | (uint)PermissionMask.Modify | | ||
655 | (uint)PermissionMask.Move | | ||
656 | 7); // Preserve folded permissions | ||
657 | } | ||
658 | |||
659 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
660 | item.Description = asset.Description; | ||
661 | item.Name = asset.Name; | ||
662 | item.AssetType = asset.Type; | ||
663 | |||
664 | m_Scene.AddInventoryItem(item); | ||
665 | |||
666 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | ||
667 | { | ||
668 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
669 | } | ||
670 | else | ||
671 | { | ||
672 | ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); | ||
673 | if (notifyUser != null) | ||
674 | { | ||
675 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | ||
676 | } | ||
677 | } | ||
678 | } | ||
679 | |||
680 | // This is a hook to do some per-asset post-processing for subclasses that need that | ||
681 | if (remoteClient != null) | ||
682 | ExportAsset(remoteClient.AgentId, assetID); | ||
668 | 683 | ||
669 | return item; | 684 | return assetID; |
685 | } | ||
686 | |||
687 | protected virtual void ExportAsset(UUID agentID, UUID assetID) | ||
688 | { | ||
689 | // nothing to do here | ||
670 | } | 690 | } |
671 | 691 | ||
672 | /// <summary> | 692 | /// <summary> |
673 | /// Rez an object into the scene from the user's inventory | 693 | /// Rez an object into the scene from the user's inventory |
674 | /// </summary> | 694 | /// </summary> |
675 | /// <remarks> | ||
676 | /// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing | 695 | /// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing |
677 | /// things to the scene. The caller should be doing that, I think. | 696 | /// things to the scene. The caller should be doing that, I think. |
678 | /// </remarks> | ||
679 | /// <param name="remoteClient"></param> | 697 | /// <param name="remoteClient"></param> |
680 | /// <param name="itemID"></param> | 698 | /// <param name="itemID"></param> |
681 | /// <param name="RayEnd"></param> | 699 | /// <param name="RayEnd"></param> |
@@ -692,10 +710,21 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
692 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 710 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, |
693 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | 711 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) |
694 | { | 712 | { |
695 | // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); | 713 | // Work out position details |
696 | 714 | byte bRayEndIsIntersection = (byte)0; | |
697 | byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0); | 715 | |
716 | if (RayEndIsIntersection) | ||
717 | { | ||
718 | bRayEndIsIntersection = (byte)1; | ||
719 | } | ||
720 | else | ||
721 | { | ||
722 | bRayEndIsIntersection = (byte)0; | ||
723 | } | ||
724 | |||
698 | Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); | 725 | Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); |
726 | |||
727 | |||
699 | Vector3 pos = m_Scene.GetNewRezLocation( | 728 | Vector3 pos = m_Scene.GetNewRezLocation( |
700 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | 729 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, |
701 | BypassRayCast, bRayEndIsIntersection, true, scale, false); | 730 | BypassRayCast, bRayEndIsIntersection, true, scale, false); |
@@ -706,6 +735,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
706 | 735 | ||
707 | if (item != null) | 736 | if (item != null) |
708 | { | 737 | { |
738 | if (item.ID == UUID.Zero) | ||
739 | { | ||
740 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 1"); | ||
741 | } | ||
709 | item.Owner = remoteClient.AgentId; | 742 | item.Owner = remoteClient.AgentId; |
710 | 743 | ||
711 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); | 744 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); |
@@ -734,6 +767,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
734 | } | 767 | } |
735 | } | 768 | } |
736 | 769 | ||
770 | if (item.ID == UUID.Zero) | ||
771 | { | ||
772 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 2"); | ||
773 | } | ||
774 | |||
737 | string xmlData = Utils.BytesToString(rezAsset.Data); | 775 | string xmlData = Utils.BytesToString(rezAsset.Data); |
738 | List<SceneObjectGroup> objlist = | 776 | List<SceneObjectGroup> objlist = |
739 | new List<SceneObjectGroup>(); | 777 | new List<SceneObjectGroup>(); |
@@ -779,18 +817,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
779 | itemId, n.OuterXml); | 817 | itemId, n.OuterXml); |
780 | objlist.Add(g); | 818 | objlist.Add(g); |
781 | XmlElement el = (XmlElement)n; | 819 | XmlElement el = (XmlElement)n; |
782 | 820 | float x = Convert.ToSingle(el.GetAttribute("offsetx")); | |
783 | string rawX = el.GetAttribute("offsetx"); | 821 | float y = Convert.ToSingle(el.GetAttribute("offsety")); |
784 | string rawY = el.GetAttribute("offsety"); | 822 | float z = Convert.ToSingle(el.GetAttribute("offsetz")); |
785 | string rawZ = el.GetAttribute("offsetz"); | ||
786 | // | ||
787 | // m_log.DebugFormat( | ||
788 | // "[INVENTORY ACCESS MODULE]: Converting coalesced object {0} offset <{1}, {2}, {3}>", | ||
789 | // g.Name, rawX, rawY, rawZ); | ||
790 | |||
791 | float x = Convert.ToSingle(rawX); | ||
792 | float y = Convert.ToSingle(rawY); | ||
793 | float z = Convert.ToSingle(rawZ); | ||
794 | veclist.Add(new Vector3(x, y, z)); | 823 | veclist.Add(new Vector3(x, y, z)); |
795 | } | 824 | } |
796 | } | 825 | } |
@@ -833,21 +862,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
833 | foreach (SceneObjectPart child in group.Parts) | 862 | foreach (SceneObjectPart child in group.Parts) |
834 | child.CreateSelected = true; | 863 | child.CreateSelected = true; |
835 | } | 864 | } |
865 | |||
836 | group.ResetIDs(); | 866 | group.ResetIDs(); |
837 | 867 | ||
838 | if (attachment) | 868 | if (attachment) |
839 | { | 869 | { |
840 | group.RootPart.Flags |= PrimFlags.Phantom; | 870 | group.RootPart.Flags |= PrimFlags.Phantom; |
841 | group.RootPart.IsAttachment = true; | 871 | group.RootPart.IsAttachment = true; |
842 | } | ||
843 | 872 | ||
844 | // If we're rezzing an attachment then don't ask | 873 | // If we're rezzing an attachment then don't ask |
845 | // AddNewSceneObject() to update the client since | 874 | // AddNewSceneObject() to update the client since |
846 | // we'll be doing that later on. Scheduling more than | 875 | // we'll be doing that later on. Scheduling more |
847 | // one full update during the attachment | 876 | // than one full update during the attachment |
848 | // process causes some clients to fail to display the | 877 | // process causes some clients to fail to display |
849 | // attachment properly. | 878 | // the attachment properly. |
850 | m_Scene.AddNewSceneObject(group, true, false); | 879 | // Also, don't persist attachments. |
880 | m_Scene.AddNewSceneObject(group, false, false); | ||
881 | } | ||
882 | else | ||
883 | { | ||
884 | m_Scene.AddNewSceneObject(group, true, false); | ||
885 | } | ||
851 | 886 | ||
852 | // if attachment we set it's asset id so object updates | 887 | // if attachment we set it's asset id so object updates |
853 | // can reflect that, if not, we set it's position in world. | 888 | // can reflect that, if not, we set it's position in world. |
@@ -882,19 +917,24 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
882 | // affect the name stored in the serialization, transfer | 917 | // affect the name stored in the serialization, transfer |
883 | // the correct name from the inventory to the | 918 | // the correct name from the inventory to the |
884 | // object itself before we rez. | 919 | // object itself before we rez. |
885 | // | 920 | // On coalesced objects, do the first one |
886 | // Only do these for the first object if we are rezzing a coalescence. | 921 | if (((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) || i == 0) |
887 | if (i == 0) | ||
888 | { | 922 | { |
889 | rootPart.Name = item.Name; | 923 | rootPart.Name = item.Name; |
890 | rootPart.Description = item.Description; | 924 | rootPart.Description = item.Description; |
925 | } | ||
926 | if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0) | ||
927 | { | ||
891 | rootPart.ObjectSaleType = item.SaleType; | 928 | rootPart.ObjectSaleType = item.SaleType; |
892 | rootPart.SalePrice = item.SalePrice; | 929 | rootPart.SalePrice = item.SalePrice; |
893 | } | 930 | } |
894 | 931 | ||
895 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | 932 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); |
933 | // TODO: Remove the magic number badness | ||
934 | |||
896 | if ((rootPart.OwnerID != item.Owner) || | 935 | if ((rootPart.OwnerID != item.Owner) || |
897 | (item.CurrentPermissions & 16) != 0) | 936 | (item.CurrentPermissions & 16) != 0 || // Magic number |
937 | (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) | ||
898 | { | 938 | { |
899 | //Need to kill the for sale here | 939 | //Need to kill the for sale here |
900 | rootPart.ObjectSaleType = 0; | 940 | rootPart.ObjectSaleType = 0; |
@@ -906,28 +946,34 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
906 | { | 946 | { |
907 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | 947 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) |
908 | { | 948 | { |
909 | part.EveryoneMask = item.EveryOnePermissions; | 949 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) |
910 | part.NextOwnerMask = item.NextPermissions; | 950 | part.EveryoneMask = item.EveryOnePermissions; |
951 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
952 | part.NextOwnerMask = item.NextPermissions; | ||
953 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
954 | part.GroupMask = item.GroupPermissions; | ||
911 | } | 955 | } |
912 | part.GroupMask = 0; // DO NOT propagate here | ||
913 | } | 956 | } |
914 | 957 | ||
958 | foreach (SceneObjectPart part in group.Parts) | ||
959 | { | ||
960 | part.LastOwnerID = part.OwnerID; | ||
961 | part.OwnerID = item.Owner; | ||
962 | part.Inventory.ChangeInventoryOwner(item.Owner); | ||
963 | } | ||
964 | |||
915 | group.ApplyNextOwnerPermissions(); | 965 | group.ApplyNextOwnerPermissions(); |
916 | } | 966 | } |
917 | } | 967 | } |
918 | 968 | ||
919 | foreach (SceneObjectPart part in group.Parts) | 969 | foreach (SceneObjectPart part in group.Parts) |
920 | { | 970 | { |
921 | if ((part.OwnerID != item.Owner) || | 971 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) |
922 | (item.CurrentPermissions & 16) != 0) | 972 | part.EveryoneMask = item.EveryOnePermissions; |
923 | { | 973 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) |
924 | part.LastOwnerID = part.OwnerID; | 974 | part.NextOwnerMask = item.NextPermissions; |
925 | part.OwnerID = item.Owner; | 975 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) |
926 | part.Inventory.ChangeInventoryOwner(item.Owner); | 976 | part.GroupMask = item.GroupPermissions; |
927 | part.GroupMask = 0; // DO NOT propagate here | ||
928 | } | ||
929 | part.EveryoneMask = item.EveryOnePermissions; | ||
930 | part.NextOwnerMask = item.NextPermissions; | ||
931 | } | 977 | } |
932 | 978 | ||
933 | rootPart.TrimPermissions(); | 979 | rootPart.TrimPermissions(); |
@@ -935,7 +981,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
935 | if (!attachment) | 981 | if (!attachment) |
936 | { | 982 | { |
937 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | 983 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) |
984 | { | ||
985 | // Save attachment data | ||
986 | group.RootPart.AttachPoint = group.RootPart.Shape.State; | ||
987 | group.RootPart.AttachOffset = storedPosition; | ||
988 | |||
938 | group.ClearPartAttachmentData(); | 989 | group.ClearPartAttachmentData(); |
990 | } | ||
939 | 991 | ||
940 | // Fire on_rez | 992 | // Fire on_rez |
941 | group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); | 993 | group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); |
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 43672d1..5e28ee1 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -366,6 +366,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
366 | try | 366 | try |
367 | { | 367 | { |
368 | 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 | |||
369 | Request.Method = HttpMethod; | 373 | Request.Method = HttpMethod; |
370 | Request.ContentType = HttpMIMEType; | 374 | Request.ContentType = HttpMIMEType; |
371 | 375 | ||
@@ -440,7 +444,17 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
440 | { | 444 | { |
441 | HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; | 445 | HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; |
442 | Status = (int)webRsp.StatusCode; | 446 | Status = (int)webRsp.StatusCode; |
443 | 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 | } | ||
444 | } | 458 | } |
445 | else | 459 | else |
446 | { | 460 | { |
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index a552a28..b6af1f2 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 uint https_port = 0; | 82 | private uint https_port = 0; |
82 | private IHttpServer m_HttpServer = null; | 83 | private IHttpServer m_HttpServer = null; |
@@ -155,7 +156,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
155 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 156 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); |
156 | return urlcode; | 157 | return urlcode; |
157 | } | 158 | } |
158 | string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/"; | 159 | string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString(); |
159 | 160 | ||
160 | UrlData urlData = new UrlData(); | 161 | UrlData urlData = new UrlData(); |
161 | urlData.hostID = host.UUID; | 162 | urlData.hostID = host.UUID; |
@@ -165,10 +166,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
165 | urlData.urlcode = urlcode; | 166 | urlData.urlcode = urlcode; |
166 | urlData.requests = new Dictionary<UUID, RequestData>(); | 167 | urlData.requests = new Dictionary<UUID, RequestData>(); |
167 | 168 | ||
168 | |||
169 | m_UrlMap[url] = urlData; | 169 | m_UrlMap[url] = urlData; |
170 | 170 | ||
171 | string uri = "/lslhttp/" + urlcode.ToString() + "/"; | 171 | string uri = "/lslhttp/" + urlcode.ToString(); |
172 | 172 | ||
173 | m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, | 173 | m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, |
174 | new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, | 174 | new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, |
@@ -233,9 +233,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
233 | return; | 233 | return; |
234 | } | 234 | } |
235 | 235 | ||
236 | foreach (UUID req in data.requests.Keys) | 236 | lock (m_RequestMap) |
237 | m_RequestMap.Remove(req); | 237 | { |
238 | 238 | foreach (UUID req in data.requests.Keys) | |
239 | m_RequestMap.Remove(req); | ||
240 | } | ||
241 | |||
239 | RemoveUrl(data); | 242 | RemoveUrl(data); |
240 | m_UrlMap.Remove(url); | 243 | m_UrlMap.Remove(url); |
241 | } | 244 | } |
@@ -243,32 +246,42 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
243 | 246 | ||
244 | public void HttpResponse(UUID request, int status, string body) | 247 | public void HttpResponse(UUID request, int status, string body) |
245 | { | 248 | { |
246 | if (m_RequestMap.ContainsKey(request)) | 249 | lock (m_RequestMap) |
247 | { | ||
248 | UrlData urlData = m_RequestMap[request]; | ||
249 | urlData.requests[request].responseCode = status; | ||
250 | urlData.requests[request].responseBody = body; | ||
251 | //urlData.requests[request].ev.Set(); | ||
252 | urlData.requests[request].requestDone =true; | ||
253 | } | ||
254 | else | ||
255 | { | 250 | { |
256 | m_log.Info("[HttpRequestHandler] There is no http-in request with id " + request.ToString()); | 251 | if (m_RequestMap.ContainsKey(request)) |
252 | { | ||
253 | UrlData urlData = m_RequestMap[request]; | ||
254 | if (!urlData.requests[request].responseSent) | ||
255 | { | ||
256 | urlData.requests[request].responseCode = status; | ||
257 | urlData.requests[request].responseBody = body; | ||
258 | //urlData.requests[request].ev.Set(); | ||
259 | urlData.requests[request].requestDone = true; | ||
260 | urlData.requests[request].responseSent = true; | ||
261 | } | ||
262 | } | ||
263 | else | ||
264 | { | ||
265 | m_log.Info("[HttpRequestHandler] There is no http-in request with id " + request.ToString()); | ||
266 | } | ||
257 | } | 267 | } |
258 | } | 268 | } |
259 | 269 | ||
260 | public string GetHttpHeader(UUID requestId, string header) | 270 | public string GetHttpHeader(UUID requestId, string header) |
261 | { | 271 | { |
262 | if (m_RequestMap.ContainsKey(requestId)) | 272 | lock (m_RequestMap) |
263 | { | ||
264 | UrlData urlData=m_RequestMap[requestId]; | ||
265 | string value; | ||
266 | if (urlData.requests[requestId].headers.TryGetValue(header,out value)) | ||
267 | return value; | ||
268 | } | ||
269 | else | ||
270 | { | 273 | { |
271 | m_log.Warn("[HttpRequestHandler] There was no http-in request with id " + requestId); | 274 | if (m_RequestMap.ContainsKey(requestId)) |
275 | { | ||
276 | UrlData urlData = m_RequestMap[requestId]; | ||
277 | string value; | ||
278 | if (urlData.requests[requestId].headers.TryGetValue(header, out value)) | ||
279 | return value; | ||
280 | } | ||
281 | else | ||
282 | { | ||
283 | m_log.Warn("[HttpRequestHandler] There was no http-in request with id " + requestId); | ||
284 | } | ||
272 | } | 285 | } |
273 | return String.Empty; | 286 | return String.Empty; |
274 | } | 287 | } |
@@ -290,8 +303,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
290 | { | 303 | { |
291 | RemoveUrl(url.Value); | 304 | RemoveUrl(url.Value); |
292 | removeURLs.Add(url.Key); | 305 | removeURLs.Add(url.Key); |
293 | foreach (UUID req in url.Value.requests.Keys) | 306 | lock (m_RequestMap) |
294 | m_RequestMap.Remove(req); | 307 | { |
308 | foreach (UUID req in url.Value.requests.Keys) | ||
309 | m_RequestMap.Remove(req); | ||
310 | } | ||
295 | } | 311 | } |
296 | } | 312 | } |
297 | 313 | ||
@@ -312,8 +328,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
312 | { | 328 | { |
313 | RemoveUrl(url.Value); | 329 | RemoveUrl(url.Value); |
314 | removeURLs.Add(url.Key); | 330 | removeURLs.Add(url.Key); |
315 | foreach (UUID req in url.Value.requests.Keys) | 331 | lock (m_RequestMap) |
316 | m_RequestMap.Remove(req); | 332 | { |
333 | foreach (UUID req in url.Value.requests.Keys) | ||
334 | m_RequestMap.Remove(req); | ||
335 | } | ||
317 | } | 336 | } |
318 | } | 337 | } |
319 | 338 | ||
@@ -332,14 +351,16 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
332 | { | 351 | { |
333 | Hashtable response = new Hashtable(); | 352 | Hashtable response = new Hashtable(); |
334 | UrlData url; | 353 | UrlData url; |
354 | int startTime = 0; | ||
335 | lock (m_RequestMap) | 355 | lock (m_RequestMap) |
336 | { | 356 | { |
337 | if (!m_RequestMap.ContainsKey(requestID)) | 357 | if (!m_RequestMap.ContainsKey(requestID)) |
338 | return response; | 358 | return response; |
339 | url = m_RequestMap[requestID]; | 359 | url = m_RequestMap[requestID]; |
360 | startTime = url.requests[requestID].startTime; | ||
340 | } | 361 | } |
341 | 362 | ||
342 | if (System.Environment.TickCount - url.requests[requestID].startTime > 25000) | 363 | if (System.Environment.TickCount - startTime > 25000) |
343 | { | 364 | { |
344 | response["int_response_code"] = 500; | 365 | response["int_response_code"] = 500; |
345 | response["str_response_string"] = "Script timeout"; | 366 | response["str_response_string"] = "Script timeout"; |
@@ -348,9 +369,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
348 | response["reusecontext"] = false; | 369 | response["reusecontext"] = false; |
349 | 370 | ||
350 | //remove from map | 371 | //remove from map |
351 | lock (url) | 372 | lock (url.requests) |
352 | { | 373 | { |
353 | url.requests.Remove(requestID); | 374 | url.requests.Remove(requestID); |
375 | } | ||
376 | lock (m_RequestMap) | ||
377 | { | ||
354 | m_RequestMap.Remove(requestID); | 378 | m_RequestMap.Remove(requestID); |
355 | } | 379 | } |
356 | 380 | ||
@@ -372,22 +396,25 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
372 | return false; | 396 | return false; |
373 | } | 397 | } |
374 | url = m_RequestMap[requestID]; | 398 | url = m_RequestMap[requestID]; |
399 | } | ||
400 | lock (url.requests) | ||
401 | { | ||
375 | if (!url.requests.ContainsKey(requestID)) | 402 | if (!url.requests.ContainsKey(requestID)) |
376 | { | 403 | { |
377 | return false; | 404 | return false; |
378 | } | 405 | } |
406 | else | ||
407 | { | ||
408 | if (System.Environment.TickCount - url.requests[requestID].startTime > 25000) | ||
409 | { | ||
410 | return true; | ||
411 | } | ||
412 | if (url.requests[requestID].requestDone) | ||
413 | return true; | ||
414 | else | ||
415 | return false; | ||
416 | } | ||
379 | } | 417 | } |
380 | |||
381 | if (System.Environment.TickCount-url.requests[requestID].startTime>25000) | ||
382 | { | ||
383 | return true; | ||
384 | } | ||
385 | |||
386 | if (url.requests[requestID].requestDone) | ||
387 | return true; | ||
388 | else | ||
389 | return false; | ||
390 | |||
391 | } | 418 | } |
392 | private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) | 419 | private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) |
393 | { | 420 | { |
@@ -399,9 +426,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
399 | if (!m_RequestMap.ContainsKey(requestID)) | 426 | if (!m_RequestMap.ContainsKey(requestID)) |
400 | return NoEvents(requestID,sessionID); | 427 | return NoEvents(requestID,sessionID); |
401 | url = m_RequestMap[requestID]; | 428 | url = m_RequestMap[requestID]; |
429 | } | ||
430 | lock (url.requests) | ||
431 | { | ||
402 | requestData = url.requests[requestID]; | 432 | requestData = url.requests[requestID]; |
403 | } | 433 | } |
404 | 434 | ||
405 | if (!requestData.requestDone) | 435 | if (!requestData.requestDone) |
406 | return NoEvents(requestID,sessionID); | 436 | return NoEvents(requestID,sessionID); |
407 | 437 | ||
@@ -424,14 +454,18 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
424 | response["reusecontext"] = false; | 454 | response["reusecontext"] = false; |
425 | 455 | ||
426 | //remove from map | 456 | //remove from map |
427 | lock (url) | 457 | lock (url.requests) |
428 | { | 458 | { |
429 | url.requests.Remove(requestID); | 459 | url.requests.Remove(requestID); |
460 | } | ||
461 | lock (m_RequestMap) | ||
462 | { | ||
430 | m_RequestMap.Remove(requestID); | 463 | m_RequestMap.Remove(requestID); |
431 | } | 464 | } |
432 | 465 | ||
433 | return response; | 466 | return response; |
434 | } | 467 | } |
468 | |||
435 | public void HttpRequestHandler(UUID requestID, Hashtable request) | 469 | public void HttpRequestHandler(UUID requestID, Hashtable request) |
436 | { | 470 | { |
437 | lock (request) | 471 | lock (request) |
@@ -447,8 +481,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
447 | 481 | ||
448 | int pos1 = uri.IndexOf("/");// /lslhttp | 482 | int pos1 = uri.IndexOf("/");// /lslhttp |
449 | int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ | 483 | int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ |
450 | int pos3 = uri.IndexOf("/", pos2 + 1);// /lslhttp/<UUID>/ | 484 | int pos3 = pos2 + 37; // /lslhttp/urlcode |
451 | string uri_tmp = uri.Substring(0, pos3 + 1); | 485 | string uri_tmp = uri.Substring(0, pos3); |
452 | //HTTP server code doesn't provide us with QueryStrings | 486 | //HTTP server code doesn't provide us with QueryStrings |
453 | string pathInfo; | 487 | string pathInfo; |
454 | string queryString; | 488 | string queryString; |
@@ -457,10 +491,21 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
457 | pathInfo = uri.Substring(pos3); | 491 | pathInfo = uri.Substring(pos3); |
458 | 492 | ||
459 | UrlData url = null; | 493 | UrlData url = null; |
494 | string urlkey; | ||
460 | if (!is_ssl) | 495 | if (!is_ssl) |
461 | url = m_UrlMap["http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp]; | 496 | urlkey = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp; |
497 | //m_UrlMap[]; | ||
462 | else | 498 | else |
463 | url = m_UrlMap["https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp]; | 499 | urlkey = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp; |
500 | |||
501 | if (m_UrlMap.ContainsKey(urlkey)) | ||
502 | { | ||
503 | url = m_UrlMap[urlkey]; | ||
504 | } | ||
505 | else | ||
506 | { | ||
507 | m_log.Warn("[HttpRequestHandler]: http-in request failed; no such url: "+urlkey.ToString()); | ||
508 | } | ||
464 | 509 | ||
465 | //for llGetHttpHeader support we need to store original URI here | 510 | //for llGetHttpHeader support we need to store original URI here |
466 | //to make x-path-info / x-query-string / x-script-url / x-remote-ip headers | 511 | //to make x-path-info / x-query-string / x-script-url / x-remote-ip headers |
@@ -490,7 +535,14 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
490 | if (request.ContainsKey(key)) | 535 | if (request.ContainsKey(key)) |
491 | { | 536 | { |
492 | string val = (String)request[key]; | 537 | string val = (String)request[key]; |
493 | queryString = queryString + key + "=" + val + "&"; | 538 | if (key != "") |
539 | { | ||
540 | queryString = queryString + key + "=" + val + "&"; | ||
541 | } | ||
542 | else | ||
543 | { | ||
544 | queryString = queryString + val + "&"; | ||
545 | } | ||
494 | } | 546 | } |
495 | } | 547 | } |
496 | if (queryString.Length > 1) | 548 | 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 c044407..150a4d5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs | |||
@@ -55,9 +55,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
55 | config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); | 55 | config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); |
56 | config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); | 56 | config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); |
57 | config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); | 57 | config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); |
58 | config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion"); | 58 | config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion"); |
59 | config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion"); | 59 | config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion"); |
60 | config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion"); | 60 | config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion"); |
61 | config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion"); | 61 | config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion"); |
62 | 62 | ||
63 | m_LocalConnector = new LocalGridServicesConnector(config); | 63 | m_LocalConnector = new LocalGridServicesConnector(config); |
@@ -126,8 +126,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
126 | Assert.IsNotNull(result, "Retrieved GetRegionByName is null"); | 126 | Assert.IsNotNull(result, "Retrieved GetRegionByName is null"); |
127 | Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match"); | 127 | Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match"); |
128 | 128 | ||
129 | m_LocalConnector.RegisterRegion(UUID.Zero, r2); | 129 | m_LocalConnector.RegisterRegion(UUID.Zero, r2); |
130 | m_LocalConnector.RegisterRegion(UUID.Zero, r3); | 130 | m_LocalConnector.RegisterRegion(UUID.Zero, r3); |
131 | m_LocalConnector.RegisterRegion(UUID.Zero, r4); | 131 | m_LocalConnector.RegisterRegion(UUID.Zero, r4); |
132 | 132 | ||
133 | result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1)); | 133 | result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1)); |
@@ -152,38 +152,38 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
152 | Assert.IsNotNull(results, "Retrieved GetRegionRange collection is null"); | 152 | Assert.IsNotNull(results, "Retrieved GetRegionRange collection is null"); |
153 | Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected"); | 153 | Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected"); |
154 | 154 | ||
155 | results = m_LocalConnector.GetDefaultRegions(UUID.Zero); | 155 | results = m_LocalConnector.GetDefaultRegions(UUID.Zero); |
156 | Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null"); | 156 | Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null"); |
157 | Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size"); | 157 | Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size"); |
158 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match"); | 158 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match"); |
159 | 159 | ||
160 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY); | 160 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY); |
161 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null"); | 161 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null"); |
162 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size"); | 162 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size"); |
163 | 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"); | 163 | 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[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); | 164 | 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[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); | 165 | 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 | 166 | ||
167 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY); | 167 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY); |
168 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null"); | 168 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null"); |
169 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size"); | 169 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size"); |
170 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3"); | 170 | 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[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3"); | 171 | 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[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3"); | 172 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3"); |
173 | 173 | ||
174 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY); | 174 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY); |
175 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null"); | 175 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null"); |
176 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size"); | 176 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size"); |
177 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2"); | 177 | 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[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2"); | 178 | 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[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2"); | 179 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2"); |
180 | 180 | ||
181 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY); | 181 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY); |
182 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null"); | 182 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null"); |
183 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size"); | 183 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size"); |
184 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2"); | 184 | 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[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2"); | 185 | 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[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2"); | 186 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2"); |
187 | 187 | ||
188 | results = m_LocalConnector.GetHyperlinks(UUID.Zero); | 188 | results = m_LocalConnector.GetHyperlinks(UUID.Zero); |
189 | Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); | 189 | 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 2cf02b5..9714c36 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -272,7 +272,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
272 | if (s.RegionInfo.RegionID == destination.RegionID) | 272 | if (s.RegionInfo.RegionID == destination.RegionID) |
273 | return s.QueryAccess(id, position, out reason); | 273 | return s.QueryAccess(id, position, out reason); |
274 | } | 274 | } |
275 | //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); | ||
276 | return false; | 275 | return false; |
277 | } | 276 | } |
278 | 277 | ||
@@ -302,10 +301,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
302 | if (s.RegionInfo.RegionID == destination.RegionID) | 301 | if (s.RegionInfo.RegionID == destination.RegionID) |
303 | { | 302 | { |
304 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); | 303 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); |
305 | // Let's spawn a threadlet right here, because this may take | 304 | return s.IncomingCloseAgent(id); |
306 | // a while | 305 | } |
307 | Util.FireAndForget(delegate { s.IncomingCloseAgent(id); }); | 306 | } |
308 | return true; | 307 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); |
308 | return false; | ||
309 | } | ||
310 | |||
311 | public bool CloseChildAgent(GridRegion destination, UUID id) | ||
312 | { | ||
313 | if (destination == null) | ||
314 | return false; | ||
315 | |||
316 | foreach (Scene s in m_sceneList) | ||
317 | { | ||
318 | if (s.RegionInfo.RegionID == destination.RegionID) | ||
319 | { | ||
320 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); | ||
321 | return s.IncomingCloseChildAgent(id); | ||
309 | } | 322 | } |
310 | } | 323 | } |
311 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); | 324 | //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 f8cea71..391b1a1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -261,6 +261,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
261 | return false; | 261 | return false; |
262 | } | 262 | } |
263 | 263 | ||
264 | public bool CloseChildAgent(GridRegion destination, UUID id) | ||
265 | { | ||
266 | if (destination == null) | ||
267 | return false; | ||
268 | |||
269 | // Try local first | ||
270 | if (m_localBackend.CloseChildAgent(destination, id)) | ||
271 | return true; | ||
272 | |||
273 | // else do the remote thing | ||
274 | if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) | ||
275 | return m_remoteConnector.CloseChildAgent(destination, id); | ||
276 | |||
277 | return false; | ||
278 | } | ||
264 | 279 | ||
265 | public bool CloseAgent(GridRegion destination, UUID id) | 280 | public bool CloseAgent(GridRegion destination, UUID id) |
266 | { | 281 | { |
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 48130e7..f85a917 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -292,6 +292,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
292 | // being no copy/no mod for everyone | 292 | // being no copy/no mod for everyone |
293 | lock (part.TaskInventory) | 293 | lock (part.TaskInventory) |
294 | { | 294 | { |
295 | if (!ResolveUserUuid(part.CreatorID)) | ||
296 | part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
297 | |||
298 | if (!ResolveUserUuid(part.OwnerID)) | ||
299 | part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
300 | |||
301 | if (!ResolveUserUuid(part.LastOwnerID)) | ||
302 | part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
303 | |||
304 | // And zap any troublesome sit target information | ||
305 | part.SitTargetOrientation = new Quaternion(0, 0, 0, 1); | ||
306 | part.SitTargetPosition = new Vector3(0, 0, 0); | ||
307 | |||
308 | // Fix ownership/creator of inventory items | ||
309 | // Not doing so results in inventory items | ||
310 | // being no copy/no mod for everyone | ||
311 | part.TaskInventory.LockItemsForRead(true); | ||
295 | TaskInventoryDictionary inv = part.TaskInventory; | 312 | TaskInventoryDictionary inv = part.TaskInventory; |
296 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) | 313 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) |
297 | { | 314 | { |
@@ -307,6 +324,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
307 | if (UserManager != null) | 324 | if (UserManager != null) |
308 | UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); | 325 | UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); |
309 | } | 326 | } |
327 | part.TaskInventory.LockItemsForRead(false); | ||
310 | } | 328 | } |
311 | } | 329 | } |
312 | 330 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index 3078ab3..eb00de8 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -251,18 +251,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
251 | 251 | ||
252 | if (asset != null) | 252 | if (asset != null) |
253 | { | 253 | { |
254 | if (m_options.ContainsKey("verbose")) | 254 | // m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id); |
255 | m_log.InfoFormat("[ARCHIVER]: Writing asset {0}", id); | ||
256 | |||
257 | m_foundAssetUuids.Add(asset.FullID); | 255 | m_foundAssetUuids.Add(asset.FullID); |
258 | 256 | ||
259 | m_assetsArchiver.WriteAsset(PostProcess(asset)); | 257 | m_assetsArchiver.WriteAsset(PostProcess(asset)); |
260 | } | 258 | } |
261 | else | 259 | else |
262 | { | 260 | { |
263 | if (m_options.ContainsKey("verbose")) | 261 | // m_log.DebugFormat("[ARCHIVER]: Recording asset {0} as not found", id); |
264 | m_log.InfoFormat("[ARCHIVER]: Recording asset {0} as not found", id); | ||
265 | |||
266 | m_notFoundAssetUuids.Add(new UUID(id)); | 262 | m_notFoundAssetUuids.Add(new UUID(id)); |
267 | } | 263 | } |
268 | 264 | ||
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 3aed6ba..bc76a7c 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 | ||
@@ -60,8 +62,15 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
60 | 62 | ||
61 | #region Packet Data Responders | 63 | #region Packet Data Responders |
62 | 64 | ||
65 | private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice) | ||
66 | { | ||
67 | sendDetailedEstateData(remote_client, invoice); | ||
68 | sendEstateLists(remote_client, invoice); | ||
69 | } | ||
70 | |||
63 | private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) | 71 | private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) |
64 | { | 72 | { |
73 | m_log.DebugFormat("[ESTATE]: Invoice is {0}", invoice.ToString()); | ||
65 | uint sun = 0; | 74 | uint sun = 0; |
66 | 75 | ||
67 | if (!Scene.RegionInfo.EstateSettings.UseGlobalTime) | 76 | if (!Scene.RegionInfo.EstateSettings.UseGlobalTime) |
@@ -81,7 +90,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
81 | Scene.RegionInfo.RegionSettings.Covenant, | 90 | Scene.RegionInfo.RegionSettings.Covenant, |
82 | Scene.RegionInfo.EstateSettings.AbuseEmail, | 91 | Scene.RegionInfo.EstateSettings.AbuseEmail, |
83 | estateOwner); | 92 | estateOwner); |
93 | } | ||
84 | 94 | ||
95 | private void sendEstateLists(IClientAPI remote_client, UUID invoice) | ||
96 | { | ||
85 | remote_client.SendEstateList(invoice, | 97 | remote_client.SendEstateList(invoice, |
86 | (int)Constants.EstateAccessCodex.EstateManagers, | 98 | (int)Constants.EstateAccessCodex.EstateManagers, |
87 | Scene.RegionInfo.EstateSettings.EstateManagers, | 99 | Scene.RegionInfo.EstateSettings.EstateManagers, |
@@ -256,7 +268,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
256 | timeInSeconds -= 15; | 268 | timeInSeconds -= 15; |
257 | } | 269 | } |
258 | 270 | ||
259 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); | 271 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), false); |
260 | } | 272 | } |
261 | } | 273 | } |
262 | 274 | ||
@@ -463,7 +475,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
463 | { | 475 | { |
464 | if (!s.IsChildAgent) | 476 | if (!s.IsChildAgent) |
465 | { | 477 | { |
466 | Scene.TeleportClientHome(user, s.ControllingClient); | 478 | if (!Scene.TeleportClientHome(user, s.ControllingClient)) |
479 | { | ||
480 | s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out."); | ||
481 | s.ControllingClient.Close(); | ||
482 | } | ||
467 | } | 483 | } |
468 | } | 484 | } |
469 | 485 | ||
@@ -472,7 +488,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
472 | { | 488 | { |
473 | remote_client.SendAlertMessage("User is already on the region ban list"); | 489 | remote_client.SendAlertMessage("User is already on the region ban list"); |
474 | } | 490 | } |
475 | //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | 491 | //Scene.RegionInfo.regionBanlist.Add(Manager(user); |
476 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); | 492 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); |
477 | } | 493 | } |
478 | else | 494 | else |
@@ -527,7 +543,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
527 | remote_client.SendAlertMessage("User is not on the region ban list"); | 543 | remote_client.SendAlertMessage("User is not on the region ban list"); |
528 | } | 544 | } |
529 | 545 | ||
530 | //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | 546 | //Scene.RegionInfo.regionBanlist.Add(Manager(user); |
531 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); | 547 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); |
532 | } | 548 | } |
533 | else | 549 | else |
@@ -648,7 +664,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
648 | ScenePresence s = Scene.GetScenePresence(prey); | 664 | ScenePresence s = Scene.GetScenePresence(prey); |
649 | if (s != null) | 665 | if (s != null) |
650 | { | 666 | { |
651 | Scene.TeleportClientHome(prey, s.ControllingClient); | 667 | if (!Scene.TeleportClientHome(prey, s.ControllingClient)) |
668 | { | ||
669 | s.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); | ||
670 | s.ControllingClient.Close(); | ||
671 | } | ||
652 | } | 672 | } |
653 | } | 673 | } |
654 | } | 674 | } |
@@ -667,7 +687,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
667 | // Also make sure they are actually in the region | 687 | // Also make sure they are actually in the region |
668 | if (p != null && !p.IsChildAgent) | 688 | if (p != null && !p.IsChildAgent) |
669 | { | 689 | { |
670 | Scene.TeleportClientHome(p.UUID, p.ControllingClient); | 690 | if (!Scene.TeleportClientHome(p.UUID, p.ControllingClient)) |
691 | { | ||
692 | p.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); | ||
693 | p.ControllingClient.Close(); | ||
694 | } | ||
671 | } | 695 | } |
672 | } | 696 | } |
673 | }); | 697 | }); |
@@ -918,7 +942,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
918 | 942 | ||
919 | for (int i = 0; i < uuidarr.Length; i++) | 943 | for (int i = 0; i < uuidarr.Length; i++) |
920 | { | 944 | { |
921 | // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); | 945 | // string lookupname = Scene.CommsManager.UUIDNameRequestString(uuidarr[i]); |
922 | 946 | ||
923 | IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>(); | 947 | IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>(); |
924 | if (userManager != null) | 948 | if (userManager != null) |
@@ -1055,6 +1079,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1055 | 1079 | ||
1056 | public void AddRegion(Scene scene) | 1080 | public void AddRegion(Scene scene) |
1057 | { | 1081 | { |
1082 | m_regionChangeTimer.AutoReset = false; | ||
1083 | m_regionChangeTimer.Interval = 2000; | ||
1084 | m_regionChangeTimer.Elapsed += RaiseRegionInfoChange; | ||
1085 | |||
1058 | Scene = scene; | 1086 | Scene = scene; |
1059 | Scene.RegisterModuleInterface<IEstateModule>(this); | 1087 | Scene.RegisterModuleInterface<IEstateModule>(this); |
1060 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; | 1088 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; |
@@ -1103,7 +1131,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1103 | 1131 | ||
1104 | private void EventManager_OnNewClient(IClientAPI client) | 1132 | private void EventManager_OnNewClient(IClientAPI client) |
1105 | { | 1133 | { |
1106 | client.OnDetailedEstateDataRequest += sendDetailedEstateData; | 1134 | client.OnDetailedEstateDataRequest += clientSendDetailedEstateData; |
1107 | client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler; | 1135 | client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler; |
1108 | // client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; | 1136 | // client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; |
1109 | client.OnSetEstateTerrainDetailTexture += setEstateTerrainBaseTexture; | 1137 | client.OnSetEstateTerrainDetailTexture += setEstateTerrainBaseTexture; |
@@ -1161,11 +1189,15 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1161 | flags |= RegionFlags.Sandbox; | 1189 | flags |= RegionFlags.Sandbox; |
1162 | if (Scene.RegionInfo.EstateSettings.AllowVoice) | 1190 | if (Scene.RegionInfo.EstateSettings.AllowVoice) |
1163 | flags |= RegionFlags.AllowVoice; | 1191 | flags |= RegionFlags.AllowVoice; |
1192 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
1193 | flags |= RegionFlags.AllowLandmark; | ||
1194 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
1195 | flags |= RegionFlags.AllowSetHome; | ||
1196 | if (Scene.RegionInfo.EstateSettings.BlockDwell) | ||
1197 | flags |= RegionFlags.BlockDwell; | ||
1198 | if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) | ||
1199 | flags |= RegionFlags.ResetHomeOnTeleport; | ||
1164 | 1200 | ||
1165 | // Fudge these to always on, so the menu options activate | ||
1166 | // | ||
1167 | flags |= RegionFlags.AllowLandmark; | ||
1168 | flags |= RegionFlags.AllowSetHome; | ||
1169 | 1201 | ||
1170 | // TODO: SkipUpdateInterestList | 1202 | // TODO: SkipUpdateInterestList |
1171 | 1203 | ||
@@ -1206,6 +1238,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1206 | flags |= RegionFlags.ResetHomeOnTeleport; | 1238 | flags |= RegionFlags.ResetHomeOnTeleport; |
1207 | if (Scene.RegionInfo.EstateSettings.TaxFree) | 1239 | if (Scene.RegionInfo.EstateSettings.TaxFree) |
1208 | flags |= RegionFlags.TaxFree; | 1240 | flags |= RegionFlags.TaxFree; |
1241 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
1242 | flags |= RegionFlags.AllowLandmark; | ||
1243 | if (Scene.RegionInfo.EstateSettings.AllowParcelChanges) | ||
1244 | flags |= RegionFlags.AllowParcelChanges; | ||
1245 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
1246 | flags |= RegionFlags.AllowSetHome; | ||
1209 | if (Scene.RegionInfo.EstateSettings.DenyMinors) | 1247 | if (Scene.RegionInfo.EstateSettings.DenyMinors) |
1210 | flags |= (RegionFlags)(1 << 30); | 1248 | flags |= (RegionFlags)(1 << 30); |
1211 | 1249 | ||
@@ -1226,6 +1264,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1226 | 1264 | ||
1227 | public void TriggerRegionInfoChange() | 1265 | public void TriggerRegionInfoChange() |
1228 | { | 1266 | { |
1267 | m_regionChangeTimer.Stop(); | ||
1268 | m_regionChangeTimer.Start(); | ||
1269 | } | ||
1270 | |||
1271 | protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e) | ||
1272 | { | ||
1229 | ChangeDelegate change = OnRegionInfoChange; | 1273 | ChangeDelegate change = OnRegionInfoChange; |
1230 | 1274 | ||
1231 | if (change != null) | 1275 | if (change != null) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 63dec15..4e7c76f 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 | ||
@@ -725,7 +642,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
725 | int x; | 642 | int x; |
726 | int y; | 643 | int y; |
727 | 644 | ||
728 | if (x_float >= Constants.RegionSize || x_float < 0 || y_float >= Constants.RegionSize || y_float < 0) | 645 | if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0) |
729 | return null; | 646 | return null; |
730 | 647 | ||
731 | try | 648 | try |
@@ -775,14 +692,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
775 | { | 692 | { |
776 | try | 693 | try |
777 | { | 694 | { |
778 | return m_landList[m_landIDList[x / 4, y / 4]]; | 695 | //if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) |
696 | return m_landList[m_landIDList[x / 4, y / 4]]; | ||
697 | //else | ||
698 | // return null; | ||
779 | } | 699 | } |
780 | catch (IndexOutOfRangeException) | 700 | catch (IndexOutOfRangeException) |
781 | { | 701 | { |
782 | // m_log.WarnFormat( | ||
783 | // "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}", | ||
784 | // x, y, m_scene.RegionInfo.RegionName); | ||
785 | |||
786 | return null; | 702 | return null; |
787 | } | 703 | } |
788 | } | 704 | } |
@@ -1065,6 +981,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1065 | //Owner Flag | 981 | //Owner Flag |
1066 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); | 982 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); |
1067 | } | 983 | } |
984 | else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID)) | ||
985 | { | ||
986 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP); | ||
987 | } | ||
1068 | else if (currentParcelBlock.LandData.SalePrice > 0 && | 988 | else if (currentParcelBlock.LandData.SalePrice > 0 && |
1069 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || | 989 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || |
1070 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) | 990 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) |
@@ -1365,18 +1285,31 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1365 | 1285 | ||
1366 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) | 1286 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) |
1367 | { | 1287 | { |
1368 | for (int i = 0; i < data.Count; i++) | 1288 | lock (m_landList) |
1369 | { | 1289 | { |
1370 | IncomingLandObjectFromStorage(data[i]); | 1290 | //Remove all the land objects in the sim and then process our new data |
1291 | foreach (int n in m_landList.Keys) | ||
1292 | { | ||
1293 | m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID); | ||
1294 | } | ||
1295 | m_landIDList.Initialize(); | ||
1296 | m_landList.Clear(); | ||
1297 | |||
1298 | for (int i = 0; i < data.Count; i++) | ||
1299 | { | ||
1300 | IncomingLandObjectFromStorage(data[i]); | ||
1301 | } | ||
1371 | } | 1302 | } |
1372 | } | 1303 | } |
1373 | 1304 | ||
1374 | public void IncomingLandObjectFromStorage(LandData data) | 1305 | public void IncomingLandObjectFromStorage(LandData data) |
1375 | { | 1306 | { |
1307 | |||
1376 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); | 1308 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); |
1377 | new_land.LandData = data.Copy(); | 1309 | new_land.LandData = data.Copy(); |
1378 | new_land.SetLandBitmapFromByteArray(); | 1310 | new_land.SetLandBitmapFromByteArray(); |
1379 | AddLandObject(new_land); | 1311 | AddLandObject(new_land); |
1312 | new_land.SendLandUpdateToAvatarsOverMe(); | ||
1380 | } | 1313 | } |
1381 | 1314 | ||
1382 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) | 1315 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) |
@@ -1654,6 +1587,322 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1654 | 1587 | ||
1655 | UpdateLandObject(localID, land.LandData); | 1588 | UpdateLandObject(localID, land.LandData); |
1656 | } | 1589 | } |
1590 | |||
1591 | public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID) | ||
1592 | { | ||
1593 | ILandObject land = null; | ||
1594 | List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels(); | ||
1595 | foreach (ILandObject landObject in Land) | ||
1596 | { | ||
1597 | if (landObject.LandData.LocalID == landID) | ||
1598 | { | ||
1599 | land = landObject; | ||
1600 | } | ||
1601 | } | ||
1602 | land.DeedToGroup(DefaultGodParcelGroup); | ||
1603 | land.LandData.Name = DefaultGodParcelName; | ||
1604 | land.SendLandUpdateToAvatarsOverMe(); | ||
1605 | } | ||
1606 | |||
1607 | private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID) | ||
1608 | { | ||
1609 | ScenePresence SP; | ||
1610 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); | ||
1611 | List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); | ||
1612 | if (SP.UserLevel != 0) | ||
1613 | { | ||
1614 | if (flags == 0) //All parcels, scripted or not | ||
1615 | { | ||
1616 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1617 | { | ||
1618 | if (e.OwnerID == targetID) | ||
1619 | { | ||
1620 | returns.Add(e); | ||
1621 | } | ||
1622 | } | ||
1623 | ); | ||
1624 | } | ||
1625 | if (flags == 4) //All parcels, scripted object | ||
1626 | { | ||
1627 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1628 | { | ||
1629 | if (e.OwnerID == targetID) | ||
1630 | { | ||
1631 | if (e.scriptScore >= 0.01) | ||
1632 | { | ||
1633 | returns.Add(e); | ||
1634 | } | ||
1635 | } | ||
1636 | } | ||
1637 | ); | ||
1638 | } | ||
1639 | if (flags == 4) //not target parcel, scripted object | ||
1640 | { | ||
1641 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1642 | { | ||
1643 | if (e.OwnerID == targetID) | ||
1644 | { | ||
1645 | ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y); | ||
1646 | if (landobject.LandData.OwnerID != e.OwnerID) | ||
1647 | { | ||
1648 | if (e.scriptScore >= 0.01) | ||
1649 | { | ||
1650 | returns.Add(e); | ||
1651 | } | ||
1652 | } | ||
1653 | } | ||
1654 | } | ||
1655 | ); | ||
1656 | } | ||
1657 | foreach (SceneObjectGroup ol in returns) | ||
1658 | { | ||
1659 | ReturnObject(ol, client); | ||
1660 | } | ||
1661 | } | ||
1662 | } | ||
1663 | public void ReturnObject(SceneObjectGroup obj, IClientAPI client) | ||
1664 | { | ||
1665 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | ||
1666 | objs[0] = obj; | ||
1667 | ((Scene)client.Scene).returnObjects(objs, client.AgentId); | ||
1668 | } | ||
1669 | |||
1670 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
1671 | |||
1672 | public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1673 | { | ||
1674 | ScenePresence targetAvatar = null; | ||
1675 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1676 | ScenePresence parcelManager = null; | ||
1677 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1678 | System.Threading.Timer Timer; | ||
1679 | |||
1680 | if (targetAvatar.UserLevel == 0) | ||
1681 | { | ||
1682 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1683 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1684 | return; | ||
1685 | if (flags == 0) | ||
1686 | { | ||
1687 | targetAvatar.AllowMovement = false; | ||
1688 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world."); | ||
1689 | parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen."); | ||
1690 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
1691 | Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0); | ||
1692 | Timers.Add(targetAvatar.UUID, Timer); | ||
1693 | } | ||
1694 | else | ||
1695 | { | ||
1696 | targetAvatar.AllowMovement = true; | ||
1697 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you."); | ||
1698 | parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen."); | ||
1699 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1700 | Timers.Remove(targetAvatar.UUID); | ||
1701 | Timer.Dispose(); | ||
1702 | } | ||
1703 | } | ||
1704 | } | ||
1705 | private void OnEndParcelFrozen(object avatar) | ||
1706 | { | ||
1707 | ScenePresence targetAvatar = (ScenePresence)avatar; | ||
1708 | targetAvatar.AllowMovement = true; | ||
1709 | System.Threading.Timer Timer; | ||
1710 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1711 | Timers.Remove(targetAvatar.UUID); | ||
1712 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); | ||
1713 | } | ||
1714 | |||
1715 | |||
1716 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1717 | { | ||
1718 | ScenePresence targetAvatar = null; | ||
1719 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1720 | ScenePresence parcelManager = null; | ||
1721 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1722 | //Just eject | ||
1723 | if (flags == 0) | ||
1724 | { | ||
1725 | if (targetAvatar.UserLevel == 0) | ||
1726 | { | ||
1727 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1728 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1729 | return; | ||
1730 | |||
1731 | Vector3 position = new Vector3(0, 0, 0); | ||
1732 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1733 | allParcels = AllParcels(); | ||
1734 | if (allParcels.Count != 1) | ||
1735 | { | ||
1736 | foreach (ILandObject parcel in allParcels) | ||
1737 | { | ||
1738 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1739 | { | ||
1740 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1741 | { | ||
1742 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1743 | { | ||
1744 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1745 | { | ||
1746 | if (parcel.ContainsPoint(x, y)) | ||
1747 | { | ||
1748 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1749 | targetAvatar.TeleportWithMomentum(position); | ||
1750 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1751 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1752 | return; | ||
1753 | } | ||
1754 | } | ||
1755 | } | ||
1756 | } | ||
1757 | } | ||
1758 | } | ||
1759 | } | ||
1760 | Vector3 targetVector; | ||
1761 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1762 | { | ||
1763 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1764 | { | ||
1765 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1766 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1767 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1768 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1769 | return; | ||
1770 | } | ||
1771 | else | ||
1772 | { | ||
1773 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1774 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1775 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1776 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1777 | return; | ||
1778 | } | ||
1779 | } | ||
1780 | else | ||
1781 | { | ||
1782 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1783 | { | ||
1784 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1785 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1786 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1787 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1788 | return; | ||
1789 | } | ||
1790 | else | ||
1791 | { | ||
1792 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1793 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1794 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1795 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1796 | return; | ||
1797 | } | ||
1798 | } | ||
1799 | } | ||
1800 | } | ||
1801 | //Eject and ban | ||
1802 | if (flags == 1) | ||
1803 | { | ||
1804 | if (targetAvatar.UserLevel == 0) | ||
1805 | { | ||
1806 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1807 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1808 | return; | ||
1809 | |||
1810 | Vector3 position = new Vector3(0, 0, 0); | ||
1811 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1812 | allParcels = AllParcels(); | ||
1813 | if (allParcels.Count != 1) | ||
1814 | { | ||
1815 | foreach (ILandObject parcel in allParcels) | ||
1816 | { | ||
1817 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1818 | { | ||
1819 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1820 | { | ||
1821 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1822 | { | ||
1823 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1824 | { | ||
1825 | if (parcel.ContainsPoint(x, y)) | ||
1826 | { | ||
1827 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1828 | targetAvatar.TeleportWithMomentum(position); | ||
1829 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1830 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1831 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1832 | entry.AgentID = targetAvatar.UUID; | ||
1833 | entry.Flags = AccessList.Ban; | ||
1834 | entry.Time = new DateTime(); | ||
1835 | land.LandData.ParcelAccessList.Add(entry); | ||
1836 | return; | ||
1837 | } | ||
1838 | } | ||
1839 | } | ||
1840 | } | ||
1841 | } | ||
1842 | } | ||
1843 | } | ||
1844 | Vector3 targetVector; | ||
1845 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1846 | { | ||
1847 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1848 | { | ||
1849 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1850 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1851 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1852 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1853 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1854 | entry.AgentID = targetAvatar.UUID; | ||
1855 | entry.Flags = AccessList.Ban; | ||
1856 | entry.Time = new DateTime(); | ||
1857 | land.LandData.ParcelAccessList.Add(entry); | ||
1858 | return; | ||
1859 | } | ||
1860 | else | ||
1861 | { | ||
1862 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1863 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1864 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1865 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1866 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1867 | entry.AgentID = targetAvatar.UUID; | ||
1868 | entry.Flags = AccessList.Ban; | ||
1869 | entry.Time = new DateTime(); | ||
1870 | land.LandData.ParcelAccessList.Add(entry); | ||
1871 | return; | ||
1872 | } | ||
1873 | } | ||
1874 | else | ||
1875 | { | ||
1876 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1877 | { | ||
1878 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1879 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1880 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1881 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1882 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1883 | entry.AgentID = targetAvatar.UUID; | ||
1884 | entry.Flags = AccessList.Ban; | ||
1885 | entry.Time = new DateTime(); | ||
1886 | land.LandData.ParcelAccessList.Add(entry); | ||
1887 | return; | ||
1888 | } | ||
1889 | else | ||
1890 | { | ||
1891 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1892 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1893 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1894 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1895 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1896 | entry.AgentID = targetAvatar.UUID; | ||
1897 | entry.Flags = AccessList.Ban; | ||
1898 | entry.Time = new DateTime(); | ||
1899 | land.LandData.ParcelAccessList.Add(entry); | ||
1900 | return; | ||
1901 | } | ||
1902 | } | ||
1903 | } | ||
1904 | } | ||
1905 | } | ||
1657 | 1906 | ||
1658 | protected void InstallInterfaces() | 1907 | protected void InstallInterfaces() |
1659 | { | 1908 | { |
@@ -1716,5 +1965,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1716 | 1965 | ||
1717 | MainConsole.Instance.Output(report.ToString()); | 1966 | MainConsole.Instance.Output(report.ToString()); |
1718 | } | 1967 | } |
1968 | |||
1969 | public void EnforceBans(ILandObject land, ScenePresence avatar) | ||
1970 | { | ||
1971 | if (avatar.AbsolutePosition.Z > LandChannel.BAN_LINE_SAFETY_HIEGHT) | ||
1972 | return; | ||
1973 | |||
1974 | if (land.IsEitherBannedOrRestricted(avatar.UUID)) | ||
1975 | { | ||
1976 | if (land.ContainsPoint(Convert.ToInt32(avatar.lastKnownAllowedPosition.X), Convert.ToInt32(avatar.lastKnownAllowedPosition.Y))) | ||
1977 | { | ||
1978 | Vector3? pos = m_scene.GetNearestAllowedPosition(avatar); | ||
1979 | if (pos == null) | ||
1980 | m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient); | ||
1981 | else | ||
1982 | ForceAvatarToPosition(avatar, (Vector3)pos); | ||
1983 | } | ||
1984 | else | ||
1985 | { | ||
1986 | ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); | ||
1987 | } | ||
1988 | } | ||
1989 | } | ||
1719 | } | 1990 | } |
1720 | } \ No newline at end of file | 1991 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 560b862..6c9bb10 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -416,11 +416,45 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
416 | return false; | 416 | return false; |
417 | } | 417 | } |
418 | 418 | ||
419 | public bool HasGroupAccess(UUID avatar) | ||
420 | { | ||
421 | if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) | ||
422 | { | ||
423 | ScenePresence sp; | ||
424 | if (!m_scene.TryGetScenePresence(avatar, out sp)) | ||
425 | { | ||
426 | IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
427 | if (groupsModule == null) | ||
428 | return false; | ||
429 | |||
430 | GroupMembershipData[] membership = groupsModule.GetMembershipData(avatar); | ||
431 | if (membership == null || membership.Length == 0) | ||
432 | return false; | ||
433 | |||
434 | foreach (GroupMembershipData d in membership) | ||
435 | { | ||
436 | if (d.GroupID == LandData.GroupID) | ||
437 | return true; | ||
438 | } | ||
439 | return false; | ||
440 | } | ||
441 | |||
442 | if (!sp.ControllingClient.IsGroupMember(LandData.GroupID)) | ||
443 | return false; | ||
444 | |||
445 | return true; | ||
446 | } | ||
447 | return false; | ||
448 | } | ||
449 | |||
419 | public bool IsBannedFromLand(UUID avatar) | 450 | public bool IsBannedFromLand(UUID avatar) |
420 | { | 451 | { |
421 | if (m_scene.Permissions.IsAdministrator(avatar)) | 452 | if (m_scene.Permissions.IsAdministrator(avatar)) |
422 | return false; | 453 | return false; |
423 | 454 | ||
455 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | ||
456 | return false; | ||
457 | |||
424 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) | 458 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) |
425 | { | 459 | { |
426 | if (LandData.ParcelAccessList.FindIndex( | 460 | if (LandData.ParcelAccessList.FindIndex( |
@@ -442,6 +476,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
442 | if (m_scene.Permissions.IsAdministrator(avatar)) | 476 | if (m_scene.Permissions.IsAdministrator(avatar)) |
443 | return false; | 477 | return false; |
444 | 478 | ||
479 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | ||
480 | return false; | ||
481 | |||
445 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) | 482 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) |
446 | { | 483 | { |
447 | if (LandData.ParcelAccessList.FindIndex( | 484 | if (LandData.ParcelAccessList.FindIndex( |
@@ -452,9 +489,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
452 | return false; | 489 | return false; |
453 | }) == -1 && LandData.OwnerID != avatar) | 490 | }) == -1 && LandData.OwnerID != avatar) |
454 | { | 491 | { |
455 | return true; | 492 | if (!HasGroupAccess(avatar)) |
493 | { | ||
494 | return true; | ||
495 | } | ||
456 | } | 496 | } |
457 | } | 497 | } |
498 | |||
458 | return false; | 499 | return false; |
459 | } | 500 | } |
460 | 501 | ||
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/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index be399ff..516189f 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | |||
@@ -179,6 +179,13 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
179 | return false; | 179 | return false; |
180 | } | 180 | } |
181 | 181 | ||
182 | if ((perms & (uint)PermissionMask.Copy) == 0) | ||
183 | { | ||
184 | if (m_dialogModule != null) | ||
185 | m_dialogModule.SendAlertToUser(remoteClient, "This sale has been blocked by the permissions system"); | ||
186 | return false; | ||
187 | } | ||
188 | |||
182 | AssetBase asset = m_scene.CreateAsset( | 189 | AssetBase asset = m_scene.CreateAsset( |
183 | group.GetPartName(localID), | 190 | group.GetPartName(localID), |
184 | group.GetPartDescription(localID), | 191 | group.GetPartDescription(localID), |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index d7324c6..43b37c7 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 0f37ddd..7f6f4df 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 | 79 | ||
68 | scene.RegisterModuleInterface<IRestartModule>(this); | 80 | scene.RegisterModuleInterface<IRestartModule>(this); |
@@ -121,6 +133,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
121 | 133 | ||
122 | if (alerts == null) | 134 | if (alerts == null) |
123 | { | 135 | { |
136 | CreateMarkerFile(); | ||
124 | m_Scene.RestartNow(); | 137 | m_Scene.RestartNow(); |
125 | return; | 138 | return; |
126 | } | 139 | } |
@@ -134,6 +147,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
134 | 147 | ||
135 | if (m_Alerts[0] == 0) | 148 | if (m_Alerts[0] == 0) |
136 | { | 149 | { |
150 | CreateMarkerFile(); | ||
137 | m_Scene.RestartNow(); | 151 | m_Scene.RestartNow(); |
138 | return; | 152 | return; |
139 | } | 153 | } |
@@ -147,6 +161,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
147 | { | 161 | { |
148 | if (m_Alerts.Count == 0 || m_Alerts[0] == 0) | 162 | if (m_Alerts.Count == 0 || m_Alerts[0] == 0) |
149 | { | 163 | { |
164 | CreateMarkerFile(); | ||
150 | m_Scene.RestartNow(); | 165 | m_Scene.RestartNow(); |
151 | return 0; | 166 | return 0; |
152 | } | 167 | } |
@@ -266,5 +281,25 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
266 | 281 | ||
267 | ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); | 282 | ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); |
268 | } | 283 | } |
284 | |||
285 | protected void CreateMarkerFile() | ||
286 | { | ||
287 | if (m_MarkerPath == String.Empty) | ||
288 | return; | ||
289 | |||
290 | string path = Path.Combine(m_MarkerPath, m_Scene.RegionInfo.RegionID.ToString()); | ||
291 | try | ||
292 | { | ||
293 | string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); | ||
294 | FileStream fs = File.Create(path); | ||
295 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
296 | Byte[] buf = enc.GetBytes(pidstring); | ||
297 | fs.Write(buf, 0, buf.Length); | ||
298 | fs.Close(); | ||
299 | } | ||
300 | catch (Exception) | ||
301 | { | ||
302 | } | ||
303 | } | ||
269 | } | 304 | } |
270 | } | 305 | } |
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 00959b0..56c59bd 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, uint flags) | 87 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) |
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. Flags={2}", mapName, regionInfos.Count, flags); | 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; |
@@ -135,7 +135,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
135 | data.Agents = 0; | 135 | data.Agents = 0; |
136 | data.Access = 255; | 136 | data.Access = 255; |
137 | data.MapImageId = UUID.Zero; | 137 | data.MapImageId = UUID.Zero; |
138 | data.Name = ""; // mapName; | 138 | data.Name = mapName; |
139 | data.RegionFlags = 0; | 139 | data.RegionFlags = 0; |
140 | data.WaterHeight = 0; // not used | 140 | data.WaterHeight = 0; // not used |
141 | data.X = 0; | 141 | data.X = 0; |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 6e142bb..ca5529d9 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1078,7 +1078,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1078 | } | 1078 | } |
1079 | else | 1079 | else |
1080 | { | 1080 | { |
1081 | OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount()); | 1081 | OSDArray responsearr = new OSDArray(); // Don't preallocate. MT (m_scene.GetRootAgentCount()); |
1082 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) | 1082 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
1083 | { | 1083 | { |
1084 | OSDMap responsemapdata = new OSDMap(); | 1084 | OSDMap responsemapdata = new OSDMap(); |