diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
39 files changed, 1639 insertions, 609 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 9adb68b..7cba702 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -262,7 +262,16 @@ namespace Flotsam.RegionModules.AssetCache | |||
262 | // If the file is already cached, don't cache it, just touch it so access time is updated | 262 | // If the file is already cached, don't cache it, just touch it so access time is updated |
263 | if (File.Exists(filename)) | 263 | if (File.Exists(filename)) |
264 | { | 264 | { |
265 | File.SetLastAccessTime(filename, DateTime.Now); | 265 | // We don't really want to know about sharing |
266 | // violations here. If the file is locked, then | ||
267 | // the other thread has updated the time for us. | ||
268 | try | ||
269 | { | ||
270 | File.SetLastAccessTime(filename, DateTime.Now); | ||
271 | } | ||
272 | catch | ||
273 | { | ||
274 | } | ||
266 | } else { | 275 | } else { |
267 | 276 | ||
268 | // Once we start writing, make sure we flag that we're writing | 277 | // Once we start writing, make sure we flag that we're writing |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 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 8a977c9..ded8743 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | |||
@@ -215,4 +215,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
215 | return result; | 215 | return result; |
216 | } | 216 | } |
217 | } | 217 | } |
218 | } \ No newline at end of file | 218 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 5baf078..0cd05e3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -273,7 +273,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
273 | 273 | ||
274 | // Inform the friends that this user is online | 274 | // Inform the friends that this user is online |
275 | StatusChange(agentID, true); | 275 | StatusChange(agentID, true); |
276 | 276 | ||
277 | // Register that we need to send the list of online friends to this user | 277 | // Register that we need to send the list of online friends to this user |
278 | lock (m_NeedsListOfFriends) | 278 | lock (m_NeedsListOfFriends) |
279 | m_NeedsListOfFriends.Add(agentID); | 279 | m_NeedsListOfFriends.Add(agentID); |
@@ -516,6 +516,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
516 | FriendsService.StoreFriend(agentID, friendID.ToString(), 1); | 516 | FriendsService.StoreFriend(agentID, friendID.ToString(), 1); |
517 | FriendsService.StoreFriend(friendID, agentID.ToString(), 1); | 517 | FriendsService.StoreFriend(friendID, agentID.ToString(), 1); |
518 | 518 | ||
519 | ICallingCardModule ccm = client.Scene.RequestModuleInterface<ICallingCardModule>(); | ||
520 | if (ccm != null) | ||
521 | { | ||
522 | ccm.CreateCallingCard(agentID, friendID, UUID.Zero); | ||
523 | } | ||
524 | |||
519 | // Update the local cache | 525 | // Update the local cache |
520 | UpdateFriendsCache(agentID); | 526 | UpdateFriendsCache(agentID); |
521 | 527 | ||
@@ -679,6 +685,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
679 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); | 685 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); |
680 | friendClient.SendInstantMessage(im); | 686 | friendClient.SendInstantMessage(im); |
681 | 687 | ||
688 | ICallingCardModule ccm = friendClient.Scene.RequestModuleInterface<ICallingCardModule>(); | ||
689 | if (ccm != null) | ||
690 | { | ||
691 | ccm.CreateCallingCard(friendID, userID, UUID.Zero); | ||
692 | } | ||
693 | |||
694 | |||
682 | // Update the local cache | 695 | // Update the local cache |
683 | UpdateFriendsCache(friendID); | 696 | UpdateFriendsCache(friendID); |
684 | 697 | ||
@@ -701,7 +714,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
701 | // we're done | 714 | // we're done |
702 | return true; | 715 | return true; |
703 | } | 716 | } |
704 | 717 | ||
705 | return false; | 718 | return false; |
706 | } | 719 | } |
707 | 720 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 5ec64d5..a83b3df 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs | |||
@@ -31,16 +31,40 @@ using OpenMetaverse; | |||
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.Framework.Scenes; | 32 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
34 | using System; | ||
35 | using System.Reflection; | ||
36 | using System.Collections; | ||
37 | using System.Collections.Specialized; | ||
38 | using System.Reflection; | ||
39 | using System.IO; | ||
40 | using System.Web; | ||
41 | using System.Xml; | ||
42 | using log4net; | ||
43 | using Mono.Addins; | ||
44 | using OpenMetaverse.Messages.Linden; | ||
45 | using OpenMetaverse.StructuredData; | ||
46 | using OpenSim.Framework.Capabilities; | ||
47 | using OpenSim.Framework.Servers; | ||
48 | using OpenSim.Framework.Servers.HttpServer; | ||
49 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
50 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; | ||
51 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; | ||
34 | 52 | ||
35 | namespace OpenSim.Region.CoreModules.Avatar.Gods | 53 | namespace OpenSim.Region.CoreModules.Avatar.Gods |
36 | { | 54 | { |
37 | public class GodsModule : IRegionModule, IGodsModule | 55 | public class GodsModule : IRegionModule, IGodsModule |
38 | { | 56 | { |
57 | private static readonly ILog m_log = | ||
58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
59 | |||
39 | /// <summary>Special UUID for actions that apply to all agents</summary> | 60 | /// <summary>Special UUID for actions that apply to all agents</summary> |
40 | private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); | 61 | private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); |
41 | 62 | ||
42 | protected Scene m_scene; | 63 | protected Scene m_scene; |
43 | protected IDialogModule m_dialogModule; | 64 | protected IDialogModule m_dialogModule; |
65 | |||
66 | protected Dictionary<UUID, string> m_capsDict = | ||
67 | new Dictionary<UUID, string>(); | ||
44 | 68 | ||
45 | public void Initialise(Scene scene, IConfigSource source) | 69 | public void Initialise(Scene scene, IConfigSource source) |
46 | { | 70 | { |
@@ -48,6 +72,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
48 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); | 72 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); |
49 | m_scene.RegisterModuleInterface<IGodsModule>(this); | 73 | m_scene.RegisterModuleInterface<IGodsModule>(this); |
50 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | 74 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; |
75 | m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; | ||
76 | m_scene.EventManager.OnClientClosed += OnClientClosed; | ||
77 | scene.EventManager.OnIncomingInstantMessage += | ||
78 | OnIncomingInstantMessage; | ||
51 | } | 79 | } |
52 | 80 | ||
53 | public void PostInitialise() {} | 81 | public void PostInitialise() {} |
@@ -67,6 +95,54 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
67 | client.OnRequestGodlikePowers -= RequestGodlikePowers; | 95 | client.OnRequestGodlikePowers -= RequestGodlikePowers; |
68 | } | 96 | } |
69 | 97 | ||
98 | private void OnClientClosed(UUID agentID, Scene scene) | ||
99 | { | ||
100 | m_capsDict.Remove(agentID); | ||
101 | } | ||
102 | |||
103 | private void OnRegisterCaps(UUID agentID, Caps caps) | ||
104 | { | ||
105 | string uri = "/CAPS/" + UUID.Random(); | ||
106 | m_capsDict[agentID] = uri; | ||
107 | |||
108 | caps.RegisterHandler("UntrustedSimulatorMessage", | ||
109 | new RestStreamHandler("POST", uri, | ||
110 | HandleUntrustedSimulatorMessage)); | ||
111 | } | ||
112 | |||
113 | private string HandleUntrustedSimulatorMessage(string request, | ||
114 | string path, string param, OSHttpRequest httpRequest, | ||
115 | OSHttpResponse httpResponse) | ||
116 | { | ||
117 | OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
118 | |||
119 | string message = osd["message"].AsString(); | ||
120 | |||
121 | if (message == "GodKickUser") | ||
122 | { | ||
123 | OSDMap body = (OSDMap)osd["body"]; | ||
124 | OSDArray userInfo = (OSDArray)body["UserInfo"]; | ||
125 | OSDMap userData = (OSDMap)userInfo[0]; | ||
126 | |||
127 | UUID agentID = userData["AgentID"].AsUUID(); | ||
128 | UUID godID = userData["GodID"].AsUUID(); | ||
129 | UUID godSessionID = userData["GodSessionID"].AsUUID(); | ||
130 | uint kickFlags = userData["KickFlags"].AsUInteger(); | ||
131 | string reason = userData["Reason"].AsString(); | ||
132 | |||
133 | ScenePresence god = m_scene.GetScenePresence(godID); | ||
134 | if (god == null || god.ControllingClient.SessionId != godSessionID) | ||
135 | return String.Empty; | ||
136 | |||
137 | KickUser(godID, godSessionID, agentID, kickFlags, Util.StringToBytes1024(reason)); | ||
138 | } | ||
139 | else | ||
140 | { | ||
141 | m_log.ErrorFormat("[GOD]: Unhandled UntrustedSimulatorMessage: {0}", message); | ||
142 | } | ||
143 | return String.Empty; | ||
144 | } | ||
145 | |||
70 | public void RequestGodlikePowers( | 146 | public void RequestGodlikePowers( |
71 | UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) | 147 | UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) |
72 | { | 148 | { |
@@ -115,71 +191,85 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
115 | /// <param name="reason">The message to send to the user after it's been turned into a field</param> | 191 | /// <param name="reason">The message to send to the user after it's been turned into a field</param> |
116 | public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason) | 192 | public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason) |
117 | { | 193 | { |
118 | UUID kickUserID = ALL_AGENTS; | 194 | if (!m_scene.Permissions.IsGod(godID)) |
119 | 195 | return; | |
196 | |||
120 | ScenePresence sp = m_scene.GetScenePresence(agentID); | 197 | ScenePresence sp = m_scene.GetScenePresence(agentID); |
121 | 198 | ||
122 | if (sp != null || agentID == kickUserID) | 199 | if (sp == null && agentID != ALL_AGENTS) |
123 | { | 200 | { |
124 | if (m_scene.Permissions.IsGod(godID)) | 201 | IMessageTransferModule transferModule = |
202 | m_scene.RequestModuleInterface<IMessageTransferModule>(); | ||
203 | if (transferModule != null) | ||
125 | { | 204 | { |
126 | if (kickflags == 0) | 205 | m_log.DebugFormat("[GODS]: Sending nonlocal kill for agent {0}", agentID); |
127 | { | 206 | transferModule.SendInstantMessage(new GridInstantMessage( |
128 | if (agentID == kickUserID) | 207 | m_scene, godID, "God", agentID, (byte)250, false, |
129 | { | 208 | Utils.BytesToString(reason), UUID.Zero, true, |
130 | string reasonStr = Utils.BytesToString(reason); | 209 | new Vector3(), new byte[] {(byte)kickflags}), |
131 | 210 | delegate(bool success) {} ); | |
132 | m_scene.ForEachClient( | 211 | } |
133 | delegate(IClientAPI controller) | 212 | return; |
134 | { | 213 | } |
135 | if (controller.AgentId != godID) | ||
136 | controller.Kick(reasonStr); | ||
137 | } | ||
138 | ); | ||
139 | |||
140 | // This is a bit crude. It seems the client will be null before it actually stops the thread | ||
141 | // The thread will kill itself eventually :/ | ||
142 | // Is there another way to make sure *all* clients get this 'inter region' message? | ||
143 | m_scene.ForEachScenePresence( | ||
144 | delegate(ScenePresence p) | ||
145 | { | ||
146 | if (p.UUID != godID && !p.IsChildAgent) | ||
147 | { | ||
148 | // Possibly this should really be p.Close() though that method doesn't send a close | ||
149 | // to the client | ||
150 | p.ControllingClient.Close(); | ||
151 | } | ||
152 | } | ||
153 | ); | ||
154 | } | ||
155 | else | ||
156 | { | ||
157 | m_scene.SceneGraph.removeUserCount(!sp.IsChildAgent); | ||
158 | 214 | ||
159 | sp.ControllingClient.Kick(Utils.BytesToString(reason)); | 215 | switch (kickflags) |
160 | sp.ControllingClient.Close(); | 216 | { |
161 | } | 217 | case 0: |
162 | } | 218 | if (sp != null) |
163 | 219 | { | |
164 | if (kickflags == 1) | 220 | KickPresence(sp, Utils.BytesToString(reason)); |
165 | { | ||
166 | sp.AllowMovement = false; | ||
167 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | ||
168 | m_dialogModule.SendAlertToUser(godID, "User Frozen"); | ||
169 | } | ||
170 | |||
171 | if (kickflags == 2) | ||
172 | { | ||
173 | sp.AllowMovement = true; | ||
174 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | ||
175 | m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); | ||
176 | } | ||
177 | } | 221 | } |
178 | else | 222 | else if (agentID == ALL_AGENTS) |
179 | { | 223 | { |
180 | m_dialogModule.SendAlertToUser(godID, "Kick request denied"); | 224 | m_scene.ForEachScenePresence( |
225 | delegate(ScenePresence p) | ||
226 | { | ||
227 | if (p.UUID != godID && (!m_scene.Permissions.IsGod(p.UUID))) | ||
228 | KickPresence(p, Utils.BytesToString(reason)); | ||
229 | } | ||
230 | ); | ||
181 | } | 231 | } |
232 | break; | ||
233 | case 1: | ||
234 | if (sp != null) | ||
235 | { | ||
236 | sp.AllowMovement = false; | ||
237 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | ||
238 | m_dialogModule.SendAlertToUser(godID, "User Frozen"); | ||
239 | } | ||
240 | break; | ||
241 | case 2: | ||
242 | if (sp != null) | ||
243 | { | ||
244 | sp.AllowMovement = true; | ||
245 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | ||
246 | m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); | ||
247 | } | ||
248 | break; | ||
249 | default: | ||
250 | break; | ||
251 | } | ||
252 | } | ||
253 | |||
254 | private void KickPresence(ScenePresence sp, string reason) | ||
255 | { | ||
256 | if (sp.IsChildAgent) | ||
257 | return; | ||
258 | sp.ControllingClient.Kick(reason); | ||
259 | sp.Scene.IncomingCloseAgent(sp.UUID); | ||
260 | } | ||
261 | |||
262 | private void OnIncomingInstantMessage(GridInstantMessage msg) | ||
263 | { | ||
264 | if (msg.dialog == (uint)250) // Nonlocal kick | ||
265 | { | ||
266 | UUID agentID = new UUID(msg.toAgentID); | ||
267 | string reason = msg.message; | ||
268 | UUID godID = new UUID(msg.fromAgentID); | ||
269 | uint kickMode = (uint)msg.binaryBucket[0]; | ||
270 | |||
271 | KickUser(godID, UUID.Zero, agentID, kickMode, Util.StringToBytes1024(reason)); | ||
182 | } | 272 | } |
183 | } | 273 | } |
184 | } | 274 | } |
185 | } \ No newline at end of file | 275 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index af39565..feb5fb8 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | |||
@@ -156,6 +156,32 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
156 | return; | 156 | return; |
157 | } | 157 | } |
158 | 158 | ||
159 | //DateTime dt = DateTime.UtcNow; | ||
160 | |||
161 | // Ticks from UtcNow, but make it look like local. Evil, huh? | ||
162 | //dt = DateTime.SpecifyKind(dt, DateTimeKind.Local); | ||
163 | |||
164 | //try | ||
165 | //{ | ||
166 | // // Convert that to the PST timezone | ||
167 | // TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles"); | ||
168 | // dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo); | ||
169 | //} | ||
170 | //catch | ||
171 | //{ | ||
172 | // //m_log.Info("[OFFLINE MESSAGING]: No PST timezone found on this machine. Saving with local timestamp."); | ||
173 | //} | ||
174 | |||
175 | //// And make it look local again to fool the unix time util | ||
176 | //dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc); | ||
177 | |||
178 | // If client is null, this message comes from storage and IS offline | ||
179 | if (client != null) | ||
180 | im.offline = 0; | ||
181 | |||
182 | if (im.offline == 0) | ||
183 | im.timestamp = (uint)Util.UnixTimeSinceEpoch(); | ||
184 | |||
159 | if (m_TransferModule != null) | 185 | if (m_TransferModule != null) |
160 | { | 186 | { |
161 | if (client != null) | 187 | if (client != null) |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 77c7147..c1caf44 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -47,6 +47,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private bool m_Enabled = false; | 49 | private bool m_Enabled = false; |
50 | protected string m_MessageKey = String.Empty; | ||
50 | protected List<Scene> m_Scenes = new List<Scene>(); | 51 | protected List<Scene> m_Scenes = new List<Scene>(); |
51 | protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>(); | 52 | protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>(); |
52 | 53 | ||
@@ -66,14 +67,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
66 | public virtual void Initialise(IConfigSource config) | 67 | public virtual void Initialise(IConfigSource config) |
67 | { | 68 | { |
68 | IConfig cnf = config.Configs["Messaging"]; | 69 | IConfig cnf = config.Configs["Messaging"]; |
69 | if (cnf != null && cnf.GetString( | 70 | if (cnf != null) |
70 | "MessageTransferModule", "MessageTransferModule") != | ||
71 | "MessageTransferModule") | ||
72 | { | 71 | { |
73 | m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration"); | 72 | if (cnf.GetString("MessageTransferModule", |
74 | return; | 73 | "MessageTransferModule") != "MessageTransferModule") |
75 | } | 74 | { |
75 | return; | ||
76 | } | ||
76 | 77 | ||
78 | m_MessageKey = cnf.GetString("MessageKey", String.Empty); | ||
79 | } | ||
80 | m_log.Debug("[MESSAGE TRANSFER]: Module enabled"); | ||
77 | m_Enabled = true; | 81 | m_Enabled = true; |
78 | } | 82 | } |
79 | 83 | ||
@@ -145,8 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
145 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; | 149 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; |
146 | if (!user.IsChildAgent) | 150 | if (!user.IsChildAgent) |
147 | { | 151 | { |
148 | // Local message | 152 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); |
149 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID); | ||
150 | user.ControllingClient.SendInstantMessage(im); | 153 | user.ControllingClient.SendInstantMessage(im); |
151 | 154 | ||
152 | // Message sent | 155 | // Message sent |
@@ -168,7 +171,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
168 | // Local message | 171 | // Local message |
169 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; | 172 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; |
170 | 173 | ||
171 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); | 174 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); |
172 | user.ControllingClient.SendInstantMessage(im); | 175 | user.ControllingClient.SendInstantMessage(im); |
173 | 176 | ||
174 | // Message sent | 177 | // Message sent |
@@ -251,6 +254,19 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
251 | && requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id") | 254 | && requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id") |
252 | && requestData.ContainsKey("binary_bucket")) | 255 | && requestData.ContainsKey("binary_bucket")) |
253 | { | 256 | { |
257 | if (m_MessageKey != String.Empty) | ||
258 | { | ||
259 | XmlRpcResponse error_resp = new XmlRpcResponse(); | ||
260 | Hashtable error_respdata = new Hashtable(); | ||
261 | error_respdata["success"] = "FALSE"; | ||
262 | error_resp.Value = error_respdata; | ||
263 | |||
264 | if (!requestData.Contains("message_key")) | ||
265 | return error_resp; | ||
266 | if (m_MessageKey != (string)requestData["message_key"]) | ||
267 | return error_resp; | ||
268 | } | ||
269 | |||
254 | // Do the easy way of validating the UUIDs | 270 | // Do the easy way of validating the UUIDs |
255 | UUID.TryParse((string)requestData["from_agent_id"], out fromAgentID); | 271 | UUID.TryParse((string)requestData["from_agent_id"], out fromAgentID); |
256 | UUID.TryParse((string)requestData["to_agent_id"], out toAgentID); | 272 | UUID.TryParse((string)requestData["to_agent_id"], out toAgentID); |
@@ -433,24 +449,37 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
433 | return resp; | 449 | return resp; |
434 | } | 450 | } |
435 | 451 | ||
436 | /// <summary> | 452 | private delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result); |
437 | /// delegate for sending a grid instant message asynchronously | ||
438 | /// </summary> | ||
439 | public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID); | ||
440 | 453 | ||
441 | protected virtual void GridInstantMessageCompleted(IAsyncResult iar) | 454 | private class GIM { |
442 | { | 455 | public GridInstantMessage im; |
443 | GridInstantMessageDelegate icon = | 456 | public MessageResultNotification result; |
444 | (GridInstantMessageDelegate)iar.AsyncState; | 457 | }; |
445 | icon.EndInvoke(iar); | ||
446 | } | ||
447 | 458 | ||
459 | private Queue<GIM> pendingInstantMessages = new Queue<GIM>(); | ||
460 | private int numInstantMessageThreads = 0; | ||
448 | 461 | ||
449 | protected virtual void SendGridInstantMessageViaXMLRPC(GridInstantMessage im, MessageResultNotification result) | 462 | private void SendGridInstantMessageViaXMLRPC(GridInstantMessage im, MessageResultNotification result) |
450 | { | 463 | { |
451 | GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync; | 464 | lock (pendingInstantMessages) { |
465 | if (numInstantMessageThreads >= 4) { | ||
466 | GIM gim = new GIM(); | ||
467 | gim.im = im; | ||
468 | gim.result = result; | ||
469 | pendingInstantMessages.Enqueue(gim); | ||
470 | } else { | ||
471 | ++ numInstantMessageThreads; | ||
472 | //m_log.DebugFormat("[SendGridInstantMessageViaXMLRPC]: ++numInstantMessageThreads={0}", numInstantMessageThreads); | ||
473 | GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsyncMain; | ||
474 | d.BeginInvoke(im, result, GridInstantMessageCompleted, d); | ||
475 | } | ||
476 | } | ||
477 | } | ||
452 | 478 | ||
453 | d.BeginInvoke(im, result, UUID.Zero, GridInstantMessageCompleted, d); | 479 | private void GridInstantMessageCompleted(IAsyncResult iar) |
480 | { | ||
481 | GridInstantMessageDelegate d = (GridInstantMessageDelegate)iar.AsyncState; | ||
482 | d.EndInvoke(iar); | ||
454 | } | 483 | } |
455 | 484 | ||
456 | /// <summary> | 485 | /// <summary> |
@@ -465,8 +494,31 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
465 | /// Pass in 0 the first time this method is called. It will be called recursively with the last | 494 | /// Pass in 0 the first time this method is called. It will be called recursively with the last |
466 | /// regionhandle tried | 495 | /// regionhandle tried |
467 | /// </param> | 496 | /// </param> |
468 | protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID) | 497 | private void SendGridInstantMessageViaXMLRPCAsyncMain(GridInstantMessage im, MessageResultNotification result) |
469 | { | 498 | { |
499 | GIM gim; | ||
500 | do { | ||
501 | try { | ||
502 | SendGridInstantMessageViaXMLRPCAsync(im, result, UUID.Zero); | ||
503 | } catch (Exception e) { | ||
504 | m_log.Error("[SendGridInstantMessageViaXMLRPC]: exception " + e.Message); | ||
505 | } | ||
506 | lock (pendingInstantMessages) { | ||
507 | if (pendingInstantMessages.Count > 0) { | ||
508 | gim = pendingInstantMessages.Dequeue(); | ||
509 | im = gim.im; | ||
510 | result = gim.result; | ||
511 | } else { | ||
512 | gim = null; | ||
513 | -- numInstantMessageThreads; | ||
514 | //m_log.DebugFormat("[SendGridInstantMessageViaXMLRPC]: --numInstantMessageThreads={0}", numInstantMessageThreads); | ||
515 | } | ||
516 | } | ||
517 | } while (gim != null); | ||
518 | } | ||
519 | private void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID) | ||
520 | { | ||
521 | |||
470 | UUID toAgentID = new UUID(im.toAgentID); | 522 | UUID toAgentID = new UUID(im.toAgentID); |
471 | 523 | ||
472 | PresenceInfo upd = null; | 524 | PresenceInfo upd = null; |
@@ -533,7 +585,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
533 | 585 | ||
534 | if (upd != null) | 586 | if (upd != null) |
535 | { | 587 | { |
536 | GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, | 588 | GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(UUID.Zero, |
537 | upd.RegionID); | 589 | upd.RegionID); |
538 | if (reginfo != null) | 590 | if (reginfo != null) |
539 | { | 591 | { |
@@ -682,6 +734,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
682 | gim["position_z"] = msg.Position.Z.ToString(); | 734 | gim["position_z"] = msg.Position.Z.ToString(); |
683 | gim["region_id"] = msg.RegionID.ToString(); | 735 | gim["region_id"] = msg.RegionID.ToString(); |
684 | gim["binary_bucket"] = Convert.ToBase64String(msg.binaryBucket,Base64FormattingOptions.None); | 736 | gim["binary_bucket"] = Convert.ToBase64String(msg.binaryBucket,Base64FormattingOptions.None); |
737 | if (m_MessageKey != String.Empty) | ||
738 | gim["message_key"] = m_MessageKey; | ||
685 | return gim; | 739 | return gim; |
686 | } | 740 | } |
687 | 741 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 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 c039b5a..dd16bfe 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -139,9 +139,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
139 | 139 | ||
140 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) | 140 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) |
141 | { | 141 | { |
142 | if (options.ContainsKey("verbose")) | ||
143 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving item {0} with asset {1}", inventoryItem.ID, inventoryItem.AssetID); | ||
144 | |||
145 | string filename = path + CreateArchiveItemName(inventoryItem); | 142 | string filename = path + CreateArchiveItemName(inventoryItem); |
146 | 143 | ||
147 | // Record the creator of this item for user record purposes (which might go away soon) | 144 | // Record the creator of this item for user record purposes (which might go away soon) |
@@ -165,9 +162,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
165 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, | 162 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, |
166 | Dictionary<string, object> options, IUserAccountService userAccountService) | 163 | Dictionary<string, object> options, IUserAccountService userAccountService) |
167 | { | 164 | { |
168 | if (options.ContainsKey("verbose")) | ||
169 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving folder {0}", inventoryFolder.Name); | ||
170 | |||
171 | if (saveThisFolderItself) | 165 | if (saveThisFolderItself) |
172 | { | 166 | { |
173 | path += CreateArchiveFolderName(inventoryFolder); | 167 | path += CreateArchiveFolderName(inventoryFolder); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 576a154..613f0ed 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -122,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
122 | 122 | ||
123 | scene.AddCommand( | 123 | scene.AddCommand( |
124 | this, "save iar", | 124 | this, "save iar", |
125 | "save iar [--p|-profile=<url>] <first> <last> <inventory path> <password> [<IAR path>] [--v|-verbose]", | 125 | "save iar [--p|-profile=<url>] <first> <last> <inventory path> <password> [<IAR path>]", |
126 | "Save user inventory archive (IAR).", | 126 | "Save user inventory archive (IAR).", |
127 | "<first> is the user's first name." + Environment.NewLine | 127 | "<first> is the user's first name." + Environment.NewLine |
128 | + "<last> is the user's last name." + Environment.NewLine | 128 | + "<last> is the user's last name." + Environment.NewLine |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index e3d4969..528bc8d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -175,8 +175,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
175 | if (im.binaryBucket.Length < 17) // Invalid | 175 | if (im.binaryBucket.Length < 17) // Invalid |
176 | return; | 176 | return; |
177 | 177 | ||
178 | UUID receipientID = new UUID(im.toAgentID); | 178 | UUID recipientID = new UUID(im.toAgentID); |
179 | ScenePresence user = scene.GetScenePresence(receipientID); | 179 | ScenePresence user = scene.GetScenePresence(recipientID); |
180 | UUID copyID; | 180 | UUID copyID; |
181 | 181 | ||
182 | // First byte is the asset type | 182 | // First byte is the asset type |
@@ -191,7 +191,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
191 | folderID, new UUID(im.toAgentID)); | 191 | folderID, new UUID(im.toAgentID)); |
192 | 192 | ||
193 | InventoryFolderBase folderCopy | 193 | InventoryFolderBase folderCopy |
194 | = scene.GiveInventoryFolder(receipientID, client.AgentId, folderID, UUID.Zero); | 194 | = scene.GiveInventoryFolder(recipientID, client.AgentId, folderID, UUID.Zero); |
195 | 195 | ||
196 | if (folderCopy == null) | 196 | if (folderCopy == null) |
197 | { | 197 | { |
@@ -248,6 +248,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
248 | im.imSessionID = itemID.Guid; | 248 | im.imSessionID = itemID.Guid; |
249 | } | 249 | } |
250 | 250 | ||
251 | im.offline = 1; // Remember these | ||
252 | |||
251 | // Send the IM to the recipient. The item is already | 253 | // Send the IM to the recipient. The item is already |
252 | // in their inventory, so it will not be lost if | 254 | // in their inventory, so it will not be lost if |
253 | // they are offline. | 255 | // they are offline. |
@@ -417,22 +419,67 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
417 | /// | 419 | /// |
418 | /// </summary> | 420 | /// </summary> |
419 | /// <param name="msg"></param> | 421 | /// <param name="msg"></param> |
420 | private void OnGridInstantMessage(GridInstantMessage msg) | 422 | private void OnGridInstantMessage(GridInstantMessage im) |
421 | { | 423 | { |
422 | // Check if this is ours to handle | 424 | // Check if this is ours to handle |
423 | // | 425 | // |
424 | Scene scene = FindClientScene(new UUID(msg.toAgentID)); | 426 | Scene scene = FindClientScene(new UUID(im.toAgentID)); |
425 | 427 | ||
426 | if (scene == null) | 428 | if (scene == null) |
427 | return; | 429 | return; |
428 | 430 | ||
429 | // Find agent to deliver to | 431 | // Find agent to deliver to |
430 | // | 432 | // |
431 | ScenePresence user = scene.GetScenePresence(new UUID(msg.toAgentID)); | 433 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); |
434 | if (user == null) | ||
435 | return; | ||
436 | |||
437 | // This requires a little bit of processing because we have to make the | ||
438 | // new item visible in the recipient's inventory here | ||
439 | // | ||
440 | if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) | ||
441 | { | ||
442 | if (im.binaryBucket.Length < 17) // Invalid | ||
443 | return; | ||
444 | |||
445 | UUID recipientID = new UUID(im.toAgentID); | ||
446 | |||
447 | // First byte is the asset type | ||
448 | AssetType assetType = (AssetType)im.binaryBucket[0]; | ||
449 | |||
450 | if (AssetType.Folder == assetType) | ||
451 | { | ||
452 | UUID folderID = new UUID(im.binaryBucket, 1); | ||
453 | |||
454 | InventoryFolderBase given = | ||
455 | new InventoryFolderBase(folderID, recipientID); | ||
456 | InventoryFolderBase folder = | ||
457 | scene.InventoryService.GetFolder(given); | ||
458 | |||
459 | if (folder != null) | ||
460 | user.ControllingClient.SendBulkUpdateInventory(folder); | ||
461 | } | ||
462 | else | ||
463 | { | ||
464 | UUID itemID = new UUID(im.binaryBucket, 1); | ||
432 | 465 | ||
433 | // Just forward to local handling | 466 | InventoryItemBase given = |
434 | OnInstantMessage(user.ControllingClient, msg); | 467 | new InventoryItemBase(itemID, recipientID); |
468 | InventoryItemBase item = | ||
469 | scene.InventoryService.GetItem(given); | ||
435 | 470 | ||
471 | if (item != null) | ||
472 | { | ||
473 | user.ControllingClient.SendBulkUpdateInventory(item); | ||
474 | } | ||
475 | } | ||
476 | user.ControllingClient.SendInstantMessage(im); | ||
477 | } | ||
478 | else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted || | ||
479 | im.dialog == (byte) InstantMessageDialog.InventoryDeclined) | ||
480 | { | ||
481 | user.ControllingClient.SendInstantMessage(im); | ||
482 | } | ||
436 | } | 483 | } |
437 | } | 484 | } |
438 | } | 485 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index d1d7df2..a12b57a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | |||
@@ -146,16 +146,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
146 | scene.RegionInfo.RegionHandle, | 146 | scene.RegionInfo.RegionHandle, |
147 | (uint)presence.AbsolutePosition.X, | 147 | (uint)presence.AbsolutePosition.X, |
148 | (uint)presence.AbsolutePosition.Y, | 148 | (uint)presence.AbsolutePosition.Y, |
149 | (uint)presence.AbsolutePosition.Z); | 149 | (uint)presence.AbsolutePosition.Z + 2); |
150 | 150 | ||
151 | m_log.DebugFormat("TP invite with message {0}", message); | 151 | m_log.DebugFormat("[LURE]: TP invite with message {0}", message); |
152 | |||
153 | GridInstantMessage m; | ||
154 | |||
155 | if (scene.Permissions.IsAdministrator(client.AgentId) && presence.GodLevel >= 200 && (!scene.Permissions.IsAdministrator(targetid))) | ||
156 | { | ||
157 | m = new GridInstantMessage(scene, client.AgentId, | ||
158 | client.FirstName+" "+client.LastName, targetid, | ||
159 | (byte)InstantMessageDialog.GodLikeRequestTeleport, false, | ||
160 | message, dest, false, presence.AbsolutePosition, | ||
161 | new Byte[0]); | ||
162 | } | ||
163 | else | ||
164 | { | ||
165 | m = new GridInstantMessage(scene, client.AgentId, | ||
166 | client.FirstName+" "+client.LastName, targetid, | ||
167 | (byte)InstantMessageDialog.RequestTeleport, false, | ||
168 | message, dest, false, presence.AbsolutePosition, | ||
169 | new Byte[0]); | ||
170 | } | ||
152 | 171 | ||
153 | GridInstantMessage m = new GridInstantMessage(scene, client.AgentId, | ||
154 | client.FirstName+" "+client.LastName, targetid, | ||
155 | (byte)InstantMessageDialog.RequestTeleport, false, | ||
156 | message, dest, false, presence.AbsolutePosition, | ||
157 | new Byte[0]); | ||
158 | |||
159 | if (m_TransferModule != null) | 172 | if (m_TransferModule != null) |
160 | { | 173 | { |
161 | m_TransferModule.SendInstantMessage(m, | 174 | m_TransferModule.SendInstantMessage(m, |
@@ -190,7 +203,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
190 | { | 203 | { |
191 | // Forward remote teleport requests | 204 | // Forward remote teleport requests |
192 | // | 205 | // |
193 | if (msg.dialog != 22) | 206 | if (msg.dialog != (byte)InstantMessageDialog.RequestTeleport && |
207 | msg.dialog != (byte)InstantMessageDialog.GodLikeRequestTeleport) | ||
194 | return; | 208 | return; |
195 | 209 | ||
196 | if (m_TransferModule != null) | 210 | if (m_TransferModule != null) |
diff --git a/OpenSim/Region/CoreModules/Framework/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 6e4ec81..1fb346e 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
102 | 102 | ||
103 | protected virtual void OnNewClient(IClientAPI client) | 103 | protected virtual void OnNewClient(IClientAPI client) |
104 | { | 104 | { |
105 | client.OnTeleportHomeRequest += TeleportHome; | 105 | client.OnTeleportHomeRequest += TeleportHomeFired; |
106 | } | 106 | } |
107 | 107 | ||
108 | public virtual void Close() | 108 | public virtual void Close() |
@@ -180,6 +180,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
180 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 180 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
181 | 181 | ||
182 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 182 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
183 | sp.TeleportFlags = (TeleportFlags)teleportFlags; | ||
183 | sp.Teleport(position); | 184 | sp.Teleport(position); |
184 | 185 | ||
185 | foreach (SceneObjectGroup grp in sp.Attachments) | 186 | foreach (SceneObjectGroup grp in sp.Attachments) |
@@ -271,7 +272,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
271 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | 272 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, |
272 | // it's actually doing a lot of work. | 273 | // it's actually doing a lot of work. |
273 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; | 274 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; |
274 | if (endPoint.Address != null) | 275 | if (endPoint != null && endPoint.Address != null) |
275 | { | 276 | { |
276 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 277 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
277 | // both regions | 278 | // both regions |
@@ -520,7 +521,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
520 | 521 | ||
521 | protected void KillEntity(Scene scene, uint localID) | 522 | protected void KillEntity(Scene scene, uint localID) |
522 | { | 523 | { |
523 | scene.SendKillObject(localID); | 524 | scene.SendKillObject(new List<uint>() { localID }); |
524 | } | 525 | } |
525 | 526 | ||
526 | protected virtual GridRegion GetFinalDestination(GridRegion region) | 527 | protected virtual GridRegion GetFinalDestination(GridRegion region) |
@@ -558,7 +559,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
558 | 559 | ||
559 | #region Teleport Home | 560 | #region Teleport Home |
560 | 561 | ||
561 | public virtual void TeleportHome(UUID id, IClientAPI client) | 562 | public void TeleportHomeFired(UUID id, IClientAPI client) |
563 | { | ||
564 | TeleportHome(id, client); | ||
565 | } | ||
566 | |||
567 | public virtual bool TeleportHome(UUID id, IClientAPI client) | ||
562 | { | 568 | { |
563 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 569 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
564 | 570 | ||
@@ -567,12 +573,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
567 | 573 | ||
568 | if (uinfo != null) | 574 | if (uinfo != null) |
569 | { | 575 | { |
576 | if (uinfo.HomeRegionID == UUID.Zero) | ||
577 | { | ||
578 | // can't find the Home region: Tell viewer and abort | ||
579 | client.SendTeleportFailed("You don't have a home position set."); | ||
580 | return false; | ||
581 | } | ||
570 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); | 582 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); |
571 | if (regionInfo == null) | 583 | if (regionInfo == null) |
572 | { | 584 | { |
573 | // can't find the Home region: Tell viewer and abort | 585 | // can't find the Home region: Tell viewer and abort |
574 | client.SendTeleportFailed("Your home region could not be found."); | 586 | client.SendTeleportFailed("Your home region could not be found."); |
575 | return; | 587 | return false; |
576 | } | 588 | } |
577 | 589 | ||
578 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", | 590 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", |
@@ -583,6 +595,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
583 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, | 595 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, |
584 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); | 596 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); |
585 | } | 597 | } |
598 | else | ||
599 | { | ||
600 | // can't find the Home region: Tell viewer and abort | ||
601 | client.SendTeleportFailed("Your home region could not be found."); | ||
602 | return false; | ||
603 | } | ||
604 | return true; | ||
586 | } | 605 | } |
587 | 606 | ||
588 | #endregion | 607 | #endregion |
@@ -919,15 +938,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
919 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | 938 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); |
920 | 939 | ||
921 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | 940 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); |
922 | if (eq != null) | 941 | IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint; |
923 | { | 942 | if (neighbourExternal != null) |
924 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | ||
925 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
926 | } | ||
927 | else | ||
928 | { | 943 | { |
929 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | 944 | if (eq != null) |
930 | capsPath); | 945 | { |
946 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
947 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
948 | } | ||
949 | else | ||
950 | { | ||
951 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
952 | capsPath); | ||
953 | } | ||
931 | } | 954 | } |
932 | 955 | ||
933 | if (!WaitForCallback(agent.UUID)) | 956 | if (!WaitForCallback(agent.UUID)) |
@@ -1039,10 +1062,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1039 | agent.Id0 = currentAgentCircuit.Id0; | 1062 | agent.Id0 = currentAgentCircuit.Id0; |
1040 | } | 1063 | } |
1041 | 1064 | ||
1042 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1065 | IPEndPoint external = region.ExternalEndPoint; |
1043 | d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true, | 1066 | if (external != null) |
1067 | { | ||
1068 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
1069 | d.BeginInvoke(sp, agent, region, external, true, | ||
1044 | InformClientOfNeighbourCompleted, | 1070 | InformClientOfNeighbourCompleted, |
1045 | d); | 1071 | d); |
1072 | } | ||
1046 | } | 1073 | } |
1047 | #endregion | 1074 | #endregion |
1048 | 1075 | ||
@@ -1175,6 +1202,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1175 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1202 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; |
1176 | try | 1203 | try |
1177 | { | 1204 | { |
1205 | //neighbour.ExternalEndPoint may return null, which will be caught | ||
1178 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, | 1206 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, |
1179 | InformClientOfNeighbourCompleted, | 1207 | InformClientOfNeighbourCompleted, |
1180 | d); | 1208 | d); |
@@ -1278,8 +1306,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1278 | 1306 | ||
1279 | m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); | 1307 | m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); |
1280 | } | 1308 | } |
1281 | if (!regionAccepted) | ||
1282 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Region {0} did not accept agent: {1}", reg.RegionName, reason); | ||
1283 | } | 1309 | } |
1284 | 1310 | ||
1285 | /// <summary> | 1311 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 5c53f78..1ccbcfd 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
86 | 86 | ||
87 | protected override void OnNewClient(IClientAPI client) | 87 | protected override void OnNewClient(IClientAPI client) |
88 | { | 88 | { |
89 | client.OnTeleportHomeRequest += TeleportHome; | 89 | client.OnTeleportHomeRequest += TeleportHomeFired; |
90 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); | 90 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); |
91 | } | 91 | } |
92 | 92 | ||
@@ -178,7 +178,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
178 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | 178 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); |
179 | } | 179 | } |
180 | 180 | ||
181 | public override void TeleportHome(UUID id, IClientAPI client) | 181 | public void TeleportHomeFired(UUID id, IClientAPI client) |
182 | { | ||
183 | TeleportHome(id, client); | ||
184 | } | ||
185 | |||
186 | public override bool TeleportHome(UUID id, IClientAPI client) | ||
182 | { | 187 | { |
183 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 188 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
184 | 189 | ||
@@ -188,8 +193,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
188 | { | 193 | { |
189 | // local grid user | 194 | // local grid user |
190 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); | 195 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); |
191 | base.TeleportHome(id, client); | 196 | return base.TeleportHome(id, client); |
192 | return; | ||
193 | } | 197 | } |
194 | 198 | ||
195 | // Foreign user wants to go home | 199 | // Foreign user wants to go home |
@@ -199,7 +203,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
199 | { | 203 | { |
200 | client.SendTeleportFailed("Your information has been lost"); | 204 | client.SendTeleportFailed("Your information has been lost"); |
201 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); | 205 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); |
202 | return; | 206 | return false; |
203 | } | 207 | } |
204 | 208 | ||
205 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); | 209 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); |
@@ -209,7 +213,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
209 | { | 213 | { |
210 | client.SendTeleportFailed("Your home region could not be found"); | 214 | client.SendTeleportFailed("Your home region could not be found"); |
211 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); | 215 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); |
212 | return; | 216 | return false; |
213 | } | 217 | } |
214 | 218 | ||
215 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); | 219 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); |
@@ -217,7 +221,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
217 | { | 221 | { |
218 | client.SendTeleportFailed("Internal error"); | 222 | client.SendTeleportFailed("Internal error"); |
219 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); | 223 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); |
220 | return; | 224 | return false; |
221 | } | 225 | } |
222 | 226 | ||
223 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | 227 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); |
@@ -227,6 +231,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
227 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); | 231 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); |
228 | 232 | ||
229 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); | 233 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); |
234 | return true; | ||
230 | } | 235 | } |
231 | #endregion | 236 | #endregion |
232 | 237 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 1370b1f..184b223 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
243 | } | 243 | } |
244 | } | 244 | } |
245 | 245 | ||
246 | // This is method scoped and will be returned. It will be the | 246 | // This is pethod scoped and will be returned. It will be the |
247 | // last created asset id | 247 | // last created asset id |
248 | UUID assetID = UUID.Zero; | 248 | UUID assetID = UUID.Zero; |
249 | 249 | ||
@@ -272,6 +272,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
272 | CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero); | 272 | CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero); |
273 | Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>(); | 273 | Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>(); |
274 | 274 | ||
275 | Dictionary<UUID, string> xmlStrings = | ||
276 | new Dictionary<UUID, string>(); | ||
277 | |||
275 | foreach (SceneObjectGroup objectGroup in objlist) | 278 | foreach (SceneObjectGroup objectGroup in objlist) |
276 | { | 279 | { |
277 | Vector3 inventoryStoredPosition = new Vector3 | 280 | Vector3 inventoryStoredPosition = new Vector3 |
@@ -284,7 +287,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
284 | : objectGroup.AbsolutePosition.Y, | 287 | : objectGroup.AbsolutePosition.Y, |
285 | objectGroup.AbsolutePosition.Z); | 288 | objectGroup.AbsolutePosition.Z); |
286 | 289 | ||
287 | originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; | 290 | Vector3 originalPosition = objectGroup.AbsolutePosition; |
291 | |||
292 | // Restore attachment data after trip through the sim | ||
293 | if (objectGroup.RootPart.AttachPoint > 0) | ||
294 | inventoryStoredPosition = objectGroup.RootPart.AttachOffset; | ||
295 | objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint; | ||
288 | 296 | ||
289 | objectGroup.AbsolutePosition = inventoryStoredPosition; | 297 | objectGroup.AbsolutePosition = inventoryStoredPosition; |
290 | 298 | ||
@@ -298,159 +306,60 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
298 | (uint)PermissionMask.Modify); | 306 | (uint)PermissionMask.Modify); |
299 | objectGroup.RootPart.NextOwnerMask |= | 307 | objectGroup.RootPart.NextOwnerMask |= |
300 | (uint)PermissionMask.Move; | 308 | (uint)PermissionMask.Move; |
301 | |||
302 | coa.Add(objectGroup); | ||
303 | } | ||
304 | 309 | ||
305 | string itemXml; | 310 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); |
306 | 311 | ||
307 | if (objlist.Count > 1) | 312 | objectGroup.AbsolutePosition = originalPosition; |
308 | itemXml = CoalescedSceneObjectsSerializer.ToXml(coa); | ||
309 | else | ||
310 | itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0]); | ||
311 | |||
312 | // Restore the position of each group now that it has been stored to inventory. | ||
313 | foreach (SceneObjectGroup objectGroup in objlist) | ||
314 | objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; | ||
315 | 313 | ||
316 | InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID); | 314 | xmlStrings[objectGroup.UUID] = sceneObjectXml; |
317 | if (item == null) | ||
318 | return UUID.Zero; | ||
319 | |||
320 | // Can't know creator is the same, so null it in inventory | ||
321 | if (objlist.Count > 1) | ||
322 | { | ||
323 | item.CreatorId = UUID.Zero.ToString(); | ||
324 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; | ||
325 | } | 315 | } |
326 | else | ||
327 | { | ||
328 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | ||
329 | item.SaleType = objlist[0].RootPart.ObjectSaleType; | ||
330 | item.SalePrice = objlist[0].RootPart.SalePrice; | ||
331 | } | ||
332 | 316 | ||
333 | AssetBase asset = CreateAsset( | 317 | string itemXml; |
334 | objlist[0].GetPartName(objlist[0].RootPart.LocalId), | ||
335 | objlist[0].GetPartDescription(objlist[0].RootPart.LocalId), | ||
336 | (sbyte)AssetType.Object, | ||
337 | Utils.StringToBytes(itemXml), | ||
338 | objlist[0].OwnerID.ToString()); | ||
339 | m_Scene.AssetService.Store(asset); | ||
340 | |||
341 | item.AssetID = asset.FullID; | ||
342 | assetID = asset.FullID; | ||
343 | 318 | ||
344 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | 319 | if (objlist.Count > 1) |
345 | { | ||
346 | m_Scene.InventoryService.UpdateItem(item); | ||
347 | } | ||
348 | else | ||
349 | { | 320 | { |
350 | AddPermissions(item, objlist[0], objlist, remoteClient); | 321 | float minX, minY, minZ; |
322 | float maxX, maxY, maxZ; | ||
351 | 323 | ||
352 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 324 | Vector3[] offsets = Scene.GetCombinedBoundingBox(objlist, |
353 | item.Description = asset.Description; | 325 | out minX, out maxX, out minY, out maxY, |
354 | item.Name = asset.Name; | 326 | out minZ, out maxZ); |
355 | item.AssetType = asset.Type; | ||
356 | 327 | ||
357 | m_Scene.AddInventoryItem(item); | 328 | // CreateWrapper |
329 | XmlDocument itemDoc = new XmlDocument(); | ||
330 | XmlElement root = itemDoc.CreateElement("", "CoalescedObject", ""); | ||
331 | itemDoc.AppendChild(root); | ||
358 | 332 | ||
359 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | 333 | // Embed the offsets into the group XML |
360 | { | 334 | for ( int i = 0 ; i < objlist.Count ; i++ ) |
361 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
362 | } | ||
363 | else | ||
364 | { | 335 | { |
365 | ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); | 336 | XmlDocument doc = new XmlDocument(); |
366 | if (notifyUser != null) | 337 | SceneObjectGroup g = objlist[i]; |
367 | { | 338 | doc.LoadXml(xmlStrings[g.UUID]); |
368 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | 339 | XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup"); |
369 | } | 340 | e.SetAttribute("offsetx", offsets[i].X.ToString()); |
341 | e.SetAttribute("offsety", offsets[i].Y.ToString()); | ||
342 | e.SetAttribute("offsetz", offsets[i].Z.ToString()); | ||
343 | |||
344 | XmlNode objectNode = itemDoc.ImportNode(e, true); | ||
345 | root.AppendChild(objectNode); | ||
370 | } | 346 | } |
371 | } | ||
372 | |||
373 | // This is a hook to do some per-asset post-processing for subclasses that need that | ||
374 | if (remoteClient != null) | ||
375 | ExportAsset(remoteClient.AgentId, assetID); | ||
376 | |||
377 | return assetID; | ||
378 | } | ||
379 | 347 | ||
380 | protected virtual void ExportAsset(UUID agentID, UUID assetID) | 348 | float sizeX = maxX - minX; |
381 | { | 349 | float sizeY = maxY - minY; |
382 | // nothing to do here | 350 | float sizeZ = maxZ - minZ; |
383 | } | ||
384 | 351 | ||
385 | /// <summary> | 352 | root.SetAttribute("x", sizeX.ToString()); |
386 | /// Add relevant permissions for an object to the item. | 353 | root.SetAttribute("y", sizeY.ToString()); |
387 | /// </summary> | 354 | root.SetAttribute("z", sizeZ.ToString()); |
388 | /// <param name="item"></param> | ||
389 | /// <param name="so"></param> | ||
390 | /// <param name="objsForEffectivePermissions"></param> | ||
391 | /// <param name="remoteClient"></param> | ||
392 | /// <returns></returns> | ||
393 | protected InventoryItemBase AddPermissions( | ||
394 | InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions, | ||
395 | IClientAPI remoteClient) | ||
396 | { | ||
397 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; | ||
398 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) | ||
399 | effectivePerms &= grp.GetEffectivePermissions(); | ||
400 | effectivePerms |= (uint)PermissionMask.Move; | ||
401 | 355 | ||
402 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 356 | itemXml = itemDoc.InnerXml; |
403 | { | ||
404 | uint perms = effectivePerms; | ||
405 | uint nextPerms = (perms & 7) << 13; | ||
406 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
407 | perms &= ~(uint)PermissionMask.Copy; | ||
408 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
409 | perms &= ~(uint)PermissionMask.Transfer; | ||
410 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
411 | perms &= ~(uint)PermissionMask.Modify; | ||
412 | |||
413 | item.BasePermissions = perms & so.RootPart.NextOwnerMask; | ||
414 | item.CurrentPermissions = item.BasePermissions; | ||
415 | item.NextPermissions = perms & so.RootPart.NextOwnerMask; | ||
416 | item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; | ||
417 | item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; | ||
418 | |||
419 | // Magic number badness. Maybe this deserves an enum. | ||
420 | // bit 4 (16) is the "Slam" bit, it means treat as passed | ||
421 | // and apply next owner perms on rez | ||
422 | item.CurrentPermissions |= 16; // Slam! | ||
423 | } | 357 | } |
424 | else | 358 | else |
425 | { | 359 | { |
426 | item.BasePermissions = effectivePerms; | 360 | itemXml = xmlStrings[objlist[0].UUID]; |
427 | item.CurrentPermissions = effectivePerms; | 361 | } |
428 | item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms; | ||
429 | item.EveryOnePermissions = so.RootPart.EveryoneMask & effectivePerms; | ||
430 | item.GroupPermissions = so.RootPart.GroupMask & effectivePerms; | ||
431 | 362 | ||
432 | item.CurrentPermissions &= | ||
433 | ((uint)PermissionMask.Copy | | ||
434 | (uint)PermissionMask.Transfer | | ||
435 | (uint)PermissionMask.Modify | | ||
436 | (uint)PermissionMask.Move | | ||
437 | 7); // Preserve folded permissions | ||
438 | } | ||
439 | |||
440 | return item; | ||
441 | } | ||
442 | |||
443 | /// <summary> | ||
444 | /// Create an item using details for the given scene object. | ||
445 | /// </summary> | ||
446 | /// <param name="action"></param> | ||
447 | /// <param name="remoteClient"></param> | ||
448 | /// <param name="so"></param> | ||
449 | /// <param name="folderID"></param> | ||
450 | /// <returns></returns> | ||
451 | protected InventoryItemBase CreateItemForObject( | ||
452 | DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID) | ||
453 | { | ||
454 | // Get the user info of the item destination | 363 | // Get the user info of the item destination |
455 | // | 364 | // |
456 | UUID userID = UUID.Zero; | 365 | UUID userID = UUID.Zero; |
@@ -462,7 +371,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
462 | // Saving changes requires a local user | 371 | // Saving changes requires a local user |
463 | // | 372 | // |
464 | if (remoteClient == null) | 373 | if (remoteClient == null) |
465 | return null; | 374 | return UUID.Zero; |
466 | 375 | ||
467 | userID = remoteClient.AgentId; | 376 | userID = remoteClient.AgentId; |
468 | } | 377 | } |
@@ -470,12 +379,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
470 | { | 379 | { |
471 | // All returns / deletes go to the object owner | 380 | // All returns / deletes go to the object owner |
472 | // | 381 | // |
473 | userID = so.RootPart.OwnerID; | 382 | |
383 | userID = objlist[0].RootPart.OwnerID; | ||
474 | } | 384 | } |
475 | 385 | ||
476 | if (userID == UUID.Zero) // Can't proceed | 386 | if (userID == UUID.Zero) // Can't proceed |
477 | { | 387 | { |
478 | return null; | 388 | return UUID.Zero; |
479 | } | 389 | } |
480 | 390 | ||
481 | // If we're returning someone's item, it goes back to the | 391 | // If we're returning someone's item, it goes back to the |
@@ -483,13 +393,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
483 | // Delete is treated like return in this case | 393 | // Delete is treated like return in this case |
484 | // Deleting your own items makes them go to trash | 394 | // Deleting your own items makes them go to trash |
485 | // | 395 | // |
486 | 396 | ||
487 | InventoryFolderBase folder = null; | 397 | InventoryFolderBase folder = null; |
488 | InventoryItemBase item = null; | 398 | InventoryItemBase item = null; |
489 | 399 | ||
490 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | 400 | if (DeRezAction.SaveToExistingUserInventoryItem == action) |
491 | { | 401 | { |
492 | item = new InventoryItemBase(so.RootPart.FromUserInventoryItemID, userID); | 402 | item = new InventoryItemBase(objlist[0].RootPart.FromUserInventoryItemID, userID); |
493 | item = m_Scene.InventoryService.GetItem(item); | 403 | item = m_Scene.InventoryService.GetItem(item); |
494 | 404 | ||
495 | //item = userInfo.RootFolder.FindItem( | 405 | //item = userInfo.RootFolder.FindItem( |
@@ -499,9 +409,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
499 | { | 409 | { |
500 | m_log.DebugFormat( | 410 | m_log.DebugFormat( |
501 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | 411 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", |
502 | so.Name, so.UUID); | 412 | objlist[0].Name, objlist[0].UUID); |
503 | 413 | return UUID.Zero; | |
504 | return null; | ||
505 | } | 414 | } |
506 | } | 415 | } |
507 | else | 416 | else |
@@ -513,17 +422,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
513 | // Deleting someone else's item | 422 | // Deleting someone else's item |
514 | // | 423 | // |
515 | if (remoteClient == null || | 424 | if (remoteClient == null || |
516 | so.OwnerID != remoteClient.AgentId) | 425 | objlist[0].OwnerID != remoteClient.AgentId) |
517 | { | 426 | { |
427 | |||
518 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 428 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
519 | } | 429 | } |
520 | else | 430 | else |
521 | { | 431 | { |
522 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | 432 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); |
523 | } | 433 | } |
524 | } | 434 | } |
525 | else if (action == DeRezAction.Return) | 435 | else if (action == DeRezAction.Return) |
526 | { | 436 | { |
437 | |||
527 | // Dump to lost + found unconditionally | 438 | // Dump to lost + found unconditionally |
528 | // | 439 | // |
529 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 440 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
@@ -539,7 +450,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
539 | } | 450 | } |
540 | else | 451 | else |
541 | { | 452 | { |
542 | if (remoteClient == null || so.OwnerID != remoteClient.AgentId) | 453 | if (remoteClient == null || |
454 | objlist[0].OwnerID != remoteClient.AgentId) | ||
543 | { | 455 | { |
544 | // Taking copy of another person's item. Take to | 456 | // Taking copy of another person's item. Take to |
545 | // Objects folder. | 457 | // Objects folder. |
@@ -560,9 +472,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
560 | // | 472 | // |
561 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) | 473 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) |
562 | { | 474 | { |
563 | if (so.RootPart.FromFolderID != UUID.Zero) | 475 | if (objlist[0].RootPart.FromFolderID != UUID.Zero && objlist[0].OwnerID == remoteClient.AgentId) |
564 | { | 476 | { |
565 | InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID); | 477 | InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID); |
566 | folder = m_Scene.InventoryService.GetFolder(f); | 478 | folder = m_Scene.InventoryService.GetFolder(f); |
567 | } | 479 | } |
568 | } | 480 | } |
@@ -573,27 +485,133 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
573 | 485 | ||
574 | if (folder == null) // Nowhere to put it | 486 | if (folder == null) // Nowhere to put it |
575 | { | 487 | { |
576 | return null; | 488 | return UUID.Zero; |
577 | } | 489 | } |
578 | } | 490 | } |
579 | 491 | ||
580 | item = new InventoryItemBase(); | 492 | item = new InventoryItemBase(); |
493 | // Can't know creator is the same, so null it in inventory | ||
494 | if (objlist.Count > 1) | ||
495 | { | ||
496 | item.CreatorId = UUID.Zero.ToString(); | ||
497 | item.CreatorData = String.Empty; | ||
498 | } | ||
499 | else | ||
500 | { | ||
501 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | ||
502 | item.CreatorData = objlist[0].RootPart.CreatorData; | ||
503 | } | ||
581 | item.ID = UUID.Random(); | 504 | item.ID = UUID.Random(); |
582 | item.InvType = (int)InventoryType.Object; | 505 | item.InvType = (int)InventoryType.Object; |
583 | item.Folder = folder.ID; | 506 | item.Folder = folder.ID; |
584 | item.Owner = userID; | 507 | item.Owner = userID; |
585 | } | 508 | if (objlist.Count > 1) |
509 | { | ||
510 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; | ||
511 | } | ||
512 | else | ||
513 | { | ||
514 | item.SaleType = objlist[0].RootPart.ObjectSaleType; | ||
515 | item.SalePrice = objlist[0].RootPart.SalePrice; | ||
516 | } | ||
517 | } | ||
518 | |||
519 | AssetBase asset = CreateAsset( | ||
520 | objlist[0].GetPartName(objlist[0].RootPart.LocalId), | ||
521 | objlist[0].GetPartDescription(objlist[0].RootPart.LocalId), | ||
522 | (sbyte)AssetType.Object, | ||
523 | Utils.StringToBytes(itemXml), | ||
524 | objlist[0].OwnerID.ToString()); | ||
525 | m_Scene.AssetService.Store(asset); | ||
526 | assetID = asset.FullID; | ||
527 | |||
528 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
529 | { | ||
530 | item.AssetID = asset.FullID; | ||
531 | m_Scene.InventoryService.UpdateItem(item); | ||
532 | } | ||
533 | else | ||
534 | { | ||
535 | item.AssetID = asset.FullID; | ||
536 | |||
537 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; | ||
538 | foreach (SceneObjectGroup grp in objlist) | ||
539 | effectivePerms &= grp.GetEffectivePermissions(); | ||
540 | effectivePerms |= (uint)PermissionMask.Move; | ||
541 | |||
542 | if (remoteClient != null && (remoteClient.AgentId != objlist[0].RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | ||
543 | { | ||
544 | uint perms = effectivePerms; | ||
545 | uint nextPerms = (perms & 7) << 13; | ||
546 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
547 | perms &= ~(uint)PermissionMask.Copy; | ||
548 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
549 | perms &= ~(uint)PermissionMask.Transfer; | ||
550 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
551 | perms &= ~(uint)PermissionMask.Modify; | ||
552 | |||
553 | item.BasePermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
554 | item.CurrentPermissions = item.BasePermissions; | ||
555 | item.NextPermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
556 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask; | ||
557 | item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask; | ||
558 | |||
559 | item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | ||
560 | } | ||
561 | else | ||
562 | { | ||
563 | item.BasePermissions = effectivePerms; | ||
564 | item.CurrentPermissions = effectivePerms; | ||
565 | item.NextPermissions = objlist[0].RootPart.NextOwnerMask & effectivePerms; | ||
566 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & effectivePerms; | ||
567 | item.GroupPermissions = objlist[0].RootPart.GroupMask & effectivePerms; | ||
568 | |||
569 | item.CurrentPermissions &= | ||
570 | ((uint)PermissionMask.Copy | | ||
571 | (uint)PermissionMask.Transfer | | ||
572 | (uint)PermissionMask.Modify | | ||
573 | (uint)PermissionMask.Move | | ||
574 | 7); // Preserve folded permissions | ||
575 | } | ||
576 | |||
577 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
578 | item.Description = asset.Description; | ||
579 | item.Name = asset.Name; | ||
580 | item.AssetType = asset.Type; | ||
581 | |||
582 | m_Scene.AddInventoryItem(item); | ||
583 | |||
584 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | ||
585 | { | ||
586 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
587 | } | ||
588 | else | ||
589 | { | ||
590 | ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); | ||
591 | if (notifyUser != null) | ||
592 | { | ||
593 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | ||
594 | } | ||
595 | } | ||
596 | } | ||
597 | |||
598 | // This is a hook to do some per-asset post-processing for subclasses that need that | ||
599 | if (remoteClient != null) | ||
600 | ExportAsset(remoteClient.AgentId, assetID); | ||
586 | 601 | ||
587 | return item; | 602 | return assetID; |
603 | } | ||
604 | |||
605 | protected virtual void ExportAsset(UUID agentID, UUID assetID) | ||
606 | { | ||
607 | // nothing to do here | ||
588 | } | 608 | } |
589 | 609 | ||
590 | /// <summary> | 610 | /// <summary> |
591 | /// Rez an object into the scene from the user's inventory | 611 | /// Rez an object into the scene from the user's inventory |
592 | /// </summary> | 612 | /// </summary> |
593 | /// <remarks> | ||
594 | /// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing | 613 | /// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing |
595 | /// things to the scene. The caller should be doing that, I think. | 614 | /// things to the scene. The caller should be doing that, I think. |
596 | /// </remarks> | ||
597 | /// <param name="remoteClient"></param> | 615 | /// <param name="remoteClient"></param> |
598 | /// <param name="itemID"></param> | 616 | /// <param name="itemID"></param> |
599 | /// <param name="RayEnd"></param> | 617 | /// <param name="RayEnd"></param> |
@@ -610,10 +628,21 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
610 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 628 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, |
611 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | 629 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) |
612 | { | 630 | { |
613 | // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); | 631 | // Work out position details |
614 | 632 | byte bRayEndIsIntersection = (byte)0; | |
615 | byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0); | 633 | |
634 | if (RayEndIsIntersection) | ||
635 | { | ||
636 | bRayEndIsIntersection = (byte)1; | ||
637 | } | ||
638 | else | ||
639 | { | ||
640 | bRayEndIsIntersection = (byte)0; | ||
641 | } | ||
642 | |||
616 | Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); | 643 | Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); |
644 | |||
645 | |||
617 | Vector3 pos = m_Scene.GetNewRezLocation( | 646 | Vector3 pos = m_Scene.GetNewRezLocation( |
618 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | 647 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, |
619 | BypassRayCast, bRayEndIsIntersection, true, scale, false); | 648 | BypassRayCast, bRayEndIsIntersection, true, scale, false); |
@@ -624,6 +653,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
624 | 653 | ||
625 | if (item != null) | 654 | if (item != null) |
626 | { | 655 | { |
656 | if (item.ID == UUID.Zero) | ||
657 | { | ||
658 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 1"); | ||
659 | } | ||
627 | item.Owner = remoteClient.AgentId; | 660 | item.Owner = remoteClient.AgentId; |
628 | 661 | ||
629 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); | 662 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); |
@@ -652,6 +685,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
652 | } | 685 | } |
653 | } | 686 | } |
654 | 687 | ||
688 | if (item.ID == UUID.Zero) | ||
689 | { | ||
690 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 2"); | ||
691 | } | ||
692 | |||
655 | string xmlData = Utils.BytesToString(rezAsset.Data); | 693 | string xmlData = Utils.BytesToString(rezAsset.Data); |
656 | List<SceneObjectGroup> objlist = | 694 | List<SceneObjectGroup> objlist = |
657 | new List<SceneObjectGroup>(); | 695 | new List<SceneObjectGroup>(); |
@@ -697,18 +735,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
697 | itemId, n.OuterXml); | 735 | itemId, n.OuterXml); |
698 | objlist.Add(g); | 736 | objlist.Add(g); |
699 | XmlElement el = (XmlElement)n; | 737 | XmlElement el = (XmlElement)n; |
700 | 738 | float x = Convert.ToSingle(el.GetAttribute("offsetx")); | |
701 | string rawX = el.GetAttribute("offsetx"); | 739 | float y = Convert.ToSingle(el.GetAttribute("offsety")); |
702 | string rawY = el.GetAttribute("offsety"); | 740 | float z = Convert.ToSingle(el.GetAttribute("offsetz")); |
703 | string rawZ = el.GetAttribute("offsetz"); | ||
704 | // | ||
705 | // m_log.DebugFormat( | ||
706 | // "[INVENTORY ACCESS MODULE]: Converting coalesced object {0} offset <{1}, {2}, {3}>", | ||
707 | // g.Name, rawX, rawY, rawZ); | ||
708 | |||
709 | float x = Convert.ToSingle(rawX); | ||
710 | float y = Convert.ToSingle(rawY); | ||
711 | float z = Convert.ToSingle(rawZ); | ||
712 | veclist.Add(new Vector3(x, y, z)); | 741 | veclist.Add(new Vector3(x, y, z)); |
713 | } | 742 | } |
714 | } | 743 | } |
@@ -751,21 +780,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
751 | foreach (SceneObjectPart child in group.Parts) | 780 | foreach (SceneObjectPart child in group.Parts) |
752 | child.CreateSelected = true; | 781 | child.CreateSelected = true; |
753 | } | 782 | } |
783 | |||
754 | group.ResetIDs(); | 784 | group.ResetIDs(); |
755 | 785 | ||
756 | if (attachment) | 786 | if (attachment) |
757 | { | 787 | { |
758 | group.RootPart.Flags |= PrimFlags.Phantom; | 788 | group.RootPart.Flags |= PrimFlags.Phantom; |
759 | group.RootPart.IsAttachment = true; | 789 | group.RootPart.IsAttachment = true; |
760 | } | ||
761 | 790 | ||
762 | // If we're rezzing an attachment then don't ask | 791 | // If we're rezzing an attachment then don't ask |
763 | // AddNewSceneObject() to update the client since | 792 | // AddNewSceneObject() to update the client since |
764 | // we'll be doing that later on. Scheduling more than | 793 | // we'll be doing that later on. Scheduling more |
765 | // one full update during the attachment | 794 | // than one full update during the attachment |
766 | // process causes some clients to fail to display the | 795 | // process causes some clients to fail to display |
767 | // attachment properly. | 796 | // the attachment properly. |
768 | m_Scene.AddNewSceneObject(group, true, false); | 797 | // Also, don't persist attachments. |
798 | m_Scene.AddNewSceneObject(group, false, false); | ||
799 | } | ||
800 | else | ||
801 | { | ||
802 | m_Scene.AddNewSceneObject(group, true, false); | ||
803 | } | ||
769 | 804 | ||
770 | // if attachment we set it's asset id so object updates | 805 | // if attachment we set it's asset id so object updates |
771 | // can reflect that, if not, we set it's position in world. | 806 | // can reflect that, if not, we set it's position in world. |
@@ -800,19 +835,24 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
800 | // affect the name stored in the serialization, transfer | 835 | // affect the name stored in the serialization, transfer |
801 | // the correct name from the inventory to the | 836 | // the correct name from the inventory to the |
802 | // object itself before we rez. | 837 | // object itself before we rez. |
803 | // | 838 | // On coalesced objects, do the first one |
804 | // Only do these for the first object if we are rezzing a coalescence. | 839 | if (((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) || i == 0) |
805 | if (i == 0) | ||
806 | { | 840 | { |
807 | rootPart.Name = item.Name; | 841 | rootPart.Name = item.Name; |
808 | rootPart.Description = item.Description; | 842 | rootPart.Description = item.Description; |
843 | } | ||
844 | if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0) | ||
845 | { | ||
809 | rootPart.ObjectSaleType = item.SaleType; | 846 | rootPart.ObjectSaleType = item.SaleType; |
810 | rootPart.SalePrice = item.SalePrice; | 847 | rootPart.SalePrice = item.SalePrice; |
811 | } | 848 | } |
812 | 849 | ||
813 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | 850 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); |
851 | // TODO: Remove the magic number badness | ||
852 | |||
814 | if ((rootPart.OwnerID != item.Owner) || | 853 | if ((rootPart.OwnerID != item.Owner) || |
815 | (item.CurrentPermissions & 16) != 0) | 854 | (item.CurrentPermissions & 16) != 0 || // Magic number |
855 | (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) | ||
816 | { | 856 | { |
817 | //Need to kill the for sale here | 857 | //Need to kill the for sale here |
818 | rootPart.ObjectSaleType = 0; | 858 | rootPart.ObjectSaleType = 0; |
@@ -824,28 +864,34 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
824 | { | 864 | { |
825 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | 865 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) |
826 | { | 866 | { |
827 | part.EveryoneMask = item.EveryOnePermissions; | 867 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) |
828 | part.NextOwnerMask = item.NextPermissions; | 868 | part.EveryoneMask = item.EveryOnePermissions; |
869 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
870 | part.NextOwnerMask = item.NextPermissions; | ||
871 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
872 | part.GroupMask = item.GroupPermissions; | ||
829 | } | 873 | } |
830 | part.GroupMask = 0; // DO NOT propagate here | ||
831 | } | 874 | } |
832 | 875 | ||
876 | foreach (SceneObjectPart part in group.Parts) | ||
877 | { | ||
878 | part.LastOwnerID = part.OwnerID; | ||
879 | part.OwnerID = item.Owner; | ||
880 | part.Inventory.ChangeInventoryOwner(item.Owner); | ||
881 | } | ||
882 | |||
833 | group.ApplyNextOwnerPermissions(); | 883 | group.ApplyNextOwnerPermissions(); |
834 | } | 884 | } |
835 | } | 885 | } |
836 | 886 | ||
837 | foreach (SceneObjectPart part in group.Parts) | 887 | foreach (SceneObjectPart part in group.Parts) |
838 | { | 888 | { |
839 | if ((part.OwnerID != item.Owner) || | 889 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) |
840 | (item.CurrentPermissions & 16) != 0) | 890 | part.EveryoneMask = item.EveryOnePermissions; |
841 | { | 891 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) |
842 | part.LastOwnerID = part.OwnerID; | 892 | part.NextOwnerMask = item.NextPermissions; |
843 | part.OwnerID = item.Owner; | 893 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) |
844 | part.Inventory.ChangeInventoryOwner(item.Owner); | 894 | part.GroupMask = item.GroupPermissions; |
845 | part.GroupMask = 0; // DO NOT propagate here | ||
846 | } | ||
847 | part.EveryoneMask = item.EveryOnePermissions; | ||
848 | part.NextOwnerMask = item.NextPermissions; | ||
849 | } | 895 | } |
850 | 896 | ||
851 | rootPart.TrimPermissions(); | 897 | rootPart.TrimPermissions(); |
@@ -853,7 +899,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
853 | if (!attachment) | 899 | if (!attachment) |
854 | { | 900 | { |
855 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | 901 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) |
902 | { | ||
903 | // Save attachment data | ||
904 | group.RootPart.AttachPoint = group.RootPart.Shape.State; | ||
905 | group.RootPart.AttachOffset = storedPosition; | ||
906 | |||
856 | group.ClearPartAttachmentData(); | 907 | group.ClearPartAttachmentData(); |
908 | } | ||
857 | 909 | ||
858 | // Fire on_rez | 910 | // Fire on_rez |
859 | group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); | 911 | 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..fa17fb6 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, |
@@ -246,10 +246,14 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
246 | if (m_RequestMap.ContainsKey(request)) | 246 | if (m_RequestMap.ContainsKey(request)) |
247 | { | 247 | { |
248 | UrlData urlData = m_RequestMap[request]; | 248 | UrlData urlData = m_RequestMap[request]; |
249 | urlData.requests[request].responseCode = status; | 249 | if (!urlData.requests[request].responseSent) |
250 | urlData.requests[request].responseBody = body; | 250 | { |
251 | //urlData.requests[request].ev.Set(); | 251 | urlData.requests[request].responseCode = status; |
252 | urlData.requests[request].requestDone =true; | 252 | urlData.requests[request].responseBody = body; |
253 | //urlData.requests[request].ev.Set(); | ||
254 | urlData.requests[request].requestDone = true; | ||
255 | urlData.requests[request].responseSent = true; | ||
256 | } | ||
253 | } | 257 | } |
254 | else | 258 | else |
255 | { | 259 | { |
@@ -432,6 +436,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
432 | 436 | ||
433 | return response; | 437 | return response; |
434 | } | 438 | } |
439 | |||
435 | public void HttpRequestHandler(UUID requestID, Hashtable request) | 440 | public void HttpRequestHandler(UUID requestID, Hashtable request) |
436 | { | 441 | { |
437 | lock (request) | 442 | lock (request) |
@@ -447,8 +452,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
447 | 452 | ||
448 | int pos1 = uri.IndexOf("/");// /lslhttp | 453 | int pos1 = uri.IndexOf("/");// /lslhttp |
449 | int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ | 454 | int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ |
450 | int pos3 = uri.IndexOf("/", pos2 + 1);// /lslhttp/<UUID>/ | 455 | int pos3 = pos2 + 37; // /lslhttp/urlcode |
451 | string uri_tmp = uri.Substring(0, pos3 + 1); | 456 | string uri_tmp = uri.Substring(0, pos3); |
452 | //HTTP server code doesn't provide us with QueryStrings | 457 | //HTTP server code doesn't provide us with QueryStrings |
453 | string pathInfo; | 458 | string pathInfo; |
454 | string queryString; | 459 | string queryString; |
@@ -490,7 +495,14 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
490 | if (request.ContainsKey(key)) | 495 | if (request.ContainsKey(key)) |
491 | { | 496 | { |
492 | string val = (String)request[key]; | 497 | string val = (String)request[key]; |
493 | queryString = queryString + key + "=" + val + "&"; | 498 | if (key != "") |
499 | { | ||
500 | queryString = queryString + key + "=" + val + "&"; | ||
501 | } | ||
502 | else | ||
503 | { | ||
504 | queryString = queryString + val + "&"; | ||
505 | } | ||
494 | } | 506 | } |
495 | } | 507 | } |
496 | if (queryString.Length > 1) | 508 | if (queryString.Length > 1) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs index 18db9fa..7128d2b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs | |||
@@ -56,9 +56,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
56 | config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); | 56 | config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); |
57 | config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); | 57 | config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); |
58 | config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); | 58 | config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); |
59 | config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion"); | 59 | config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion"); |
60 | config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion"); | 60 | config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion"); |
61 | config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion"); | 61 | config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion"); |
62 | config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion"); | 62 | config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion"); |
63 | 63 | ||
64 | m_LocalConnector = new LocalGridServicesConnector(config); | 64 | m_LocalConnector = new LocalGridServicesConnector(config); |
@@ -127,8 +127,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
127 | Assert.IsNotNull(result, "Retrieved GetRegionByName is null"); | 127 | Assert.IsNotNull(result, "Retrieved GetRegionByName is null"); |
128 | Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match"); | 128 | Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match"); |
129 | 129 | ||
130 | m_LocalConnector.RegisterRegion(UUID.Zero, r2); | 130 | m_LocalConnector.RegisterRegion(UUID.Zero, r2); |
131 | m_LocalConnector.RegisterRegion(UUID.Zero, r3); | 131 | m_LocalConnector.RegisterRegion(UUID.Zero, r3); |
132 | m_LocalConnector.RegisterRegion(UUID.Zero, r4); | 132 | m_LocalConnector.RegisterRegion(UUID.Zero, r4); |
133 | 133 | ||
134 | result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1)); | 134 | result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1)); |
@@ -153,38 +153,38 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
153 | Assert.IsNotNull(results, "Retrieved GetRegionRange collection is null"); | 153 | Assert.IsNotNull(results, "Retrieved GetRegionRange collection is null"); |
154 | Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected"); | 154 | Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected"); |
155 | 155 | ||
156 | results = m_LocalConnector.GetDefaultRegions(UUID.Zero); | 156 | results = m_LocalConnector.GetDefaultRegions(UUID.Zero); |
157 | Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null"); | 157 | Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null"); |
158 | Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size"); | 158 | Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size"); |
159 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match"); | 159 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match"); |
160 | 160 | ||
161 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY); | 161 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY); |
162 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null"); | 162 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null"); |
163 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size"); | 163 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size"); |
164 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); | 164 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); |
165 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); | 165 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); |
166 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); | 166 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); |
167 | 167 | ||
168 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY); | 168 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY); |
169 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null"); | 169 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null"); |
170 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size"); | 170 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size"); |
171 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3"); | 171 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3"); |
172 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3"); | 172 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3"); |
173 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3"); | 173 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3"); |
174 | 174 | ||
175 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY); | 175 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY); |
176 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null"); | 176 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null"); |
177 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size"); | 177 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size"); |
178 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2"); | 178 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2"); |
179 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2"); | 179 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2"); |
180 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2"); | 180 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2"); |
181 | 181 | ||
182 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY); | 182 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY); |
183 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null"); | 183 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null"); |
184 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size"); | 184 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size"); |
185 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2"); | 185 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2"); |
186 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2"); | 186 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2"); |
187 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2"); | 187 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2"); |
188 | 188 | ||
189 | results = m_LocalConnector.GetHyperlinks(UUID.Zero); | 189 | results = m_LocalConnector.GetHyperlinks(UUID.Zero); |
190 | Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); | 190 | Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 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 82bef48..930a117 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 b888698..5da1656 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -249,18 +249,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
249 | 249 | ||
250 | if (asset != null) | 250 | if (asset != null) |
251 | { | 251 | { |
252 | if (m_options.ContainsKey("verbose")) | 252 | // m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id); |
253 | m_log.InfoFormat("[ARCHIVER]: Writing asset {0}", id); | ||
254 | |||
255 | m_foundAssetUuids.Add(asset.FullID); | 253 | m_foundAssetUuids.Add(asset.FullID); |
256 | 254 | ||
257 | m_assetsArchiver.WriteAsset(PostProcess(asset)); | 255 | m_assetsArchiver.WriteAsset(PostProcess(asset)); |
258 | } | 256 | } |
259 | else | 257 | else |
260 | { | 258 | { |
261 | if (m_options.ContainsKey("verbose")) | 259 | // m_log.DebugFormat("[ARCHIVER]: Recording asset {0} as not found", id); |
262 | m_log.InfoFormat("[ARCHIVER]: Recording asset {0} as not found", id); | ||
263 | |||
264 | m_notFoundAssetUuids.Add(new UUID(id)); | 260 | m_notFoundAssetUuids.Add(new UUID(id)); |
265 | } | 261 | } |
266 | 262 | ||
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 3aed6ba..7d5f109 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 | ||
@@ -256,7 +258,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
256 | timeInSeconds -= 15; | 258 | timeInSeconds -= 15; |
257 | } | 259 | } |
258 | 260 | ||
259 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); | 261 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), false); |
260 | } | 262 | } |
261 | } | 263 | } |
262 | 264 | ||
@@ -463,7 +465,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
463 | { | 465 | { |
464 | if (!s.IsChildAgent) | 466 | if (!s.IsChildAgent) |
465 | { | 467 | { |
466 | Scene.TeleportClientHome(user, s.ControllingClient); | 468 | if (!Scene.TeleportClientHome(user, s.ControllingClient)) |
469 | { | ||
470 | s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out."); | ||
471 | s.ControllingClient.Close(); | ||
472 | } | ||
467 | } | 473 | } |
468 | } | 474 | } |
469 | 475 | ||
@@ -472,7 +478,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
472 | { | 478 | { |
473 | remote_client.SendAlertMessage("User is already on the region ban list"); | 479 | remote_client.SendAlertMessage("User is already on the region ban list"); |
474 | } | 480 | } |
475 | //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | 481 | //Scene.RegionInfo.regionBanlist.Add(Manager(user); |
476 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); | 482 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); |
477 | } | 483 | } |
478 | else | 484 | else |
@@ -527,7 +533,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
527 | remote_client.SendAlertMessage("User is not on the region ban list"); | 533 | remote_client.SendAlertMessage("User is not on the region ban list"); |
528 | } | 534 | } |
529 | 535 | ||
530 | //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | 536 | //Scene.RegionInfo.regionBanlist.Add(Manager(user); |
531 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); | 537 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); |
532 | } | 538 | } |
533 | else | 539 | else |
@@ -648,7 +654,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
648 | ScenePresence s = Scene.GetScenePresence(prey); | 654 | ScenePresence s = Scene.GetScenePresence(prey); |
649 | if (s != null) | 655 | if (s != null) |
650 | { | 656 | { |
651 | Scene.TeleportClientHome(prey, s.ControllingClient); | 657 | if (!Scene.TeleportClientHome(prey, s.ControllingClient)) |
658 | { | ||
659 | s.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); | ||
660 | s.ControllingClient.Close(); | ||
661 | } | ||
652 | } | 662 | } |
653 | } | 663 | } |
654 | } | 664 | } |
@@ -667,7 +677,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
667 | // Also make sure they are actually in the region | 677 | // Also make sure they are actually in the region |
668 | if (p != null && !p.IsChildAgent) | 678 | if (p != null && !p.IsChildAgent) |
669 | { | 679 | { |
670 | Scene.TeleportClientHome(p.UUID, p.ControllingClient); | 680 | if (!Scene.TeleportClientHome(p.UUID, p.ControllingClient)) |
681 | { | ||
682 | p.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); | ||
683 | p.ControllingClient.Close(); | ||
684 | } | ||
671 | } | 685 | } |
672 | } | 686 | } |
673 | }); | 687 | }); |
@@ -918,7 +932,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
918 | 932 | ||
919 | for (int i = 0; i < uuidarr.Length; i++) | 933 | for (int i = 0; i < uuidarr.Length; i++) |
920 | { | 934 | { |
921 | // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); | 935 | // string lookupname = Scene.CommsManager.UUIDNameRequestString(uuidarr[i]); |
922 | 936 | ||
923 | IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>(); | 937 | IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>(); |
924 | if (userManager != null) | 938 | if (userManager != null) |
@@ -1055,6 +1069,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1055 | 1069 | ||
1056 | public void AddRegion(Scene scene) | 1070 | public void AddRegion(Scene scene) |
1057 | { | 1071 | { |
1072 | m_regionChangeTimer.AutoReset = false; | ||
1073 | m_regionChangeTimer.Interval = 2000; | ||
1074 | m_regionChangeTimer.Elapsed += RaiseRegionInfoChange; | ||
1075 | |||
1058 | Scene = scene; | 1076 | Scene = scene; |
1059 | Scene.RegisterModuleInterface<IEstateModule>(this); | 1077 | Scene.RegisterModuleInterface<IEstateModule>(this); |
1060 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; | 1078 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; |
@@ -1161,11 +1179,15 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1161 | flags |= RegionFlags.Sandbox; | 1179 | flags |= RegionFlags.Sandbox; |
1162 | if (Scene.RegionInfo.EstateSettings.AllowVoice) | 1180 | if (Scene.RegionInfo.EstateSettings.AllowVoice) |
1163 | flags |= RegionFlags.AllowVoice; | 1181 | flags |= RegionFlags.AllowVoice; |
1182 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
1183 | flags |= RegionFlags.AllowLandmark; | ||
1184 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
1185 | flags |= RegionFlags.AllowSetHome; | ||
1186 | if (Scene.RegionInfo.EstateSettings.BlockDwell) | ||
1187 | flags |= RegionFlags.BlockDwell; | ||
1188 | if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) | ||
1189 | flags |= RegionFlags.ResetHomeOnTeleport; | ||
1164 | 1190 | ||
1165 | // Fudge these to always on, so the menu options activate | ||
1166 | // | ||
1167 | flags |= RegionFlags.AllowLandmark; | ||
1168 | flags |= RegionFlags.AllowSetHome; | ||
1169 | 1191 | ||
1170 | // TODO: SkipUpdateInterestList | 1192 | // TODO: SkipUpdateInterestList |
1171 | 1193 | ||
@@ -1206,6 +1228,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1206 | flags |= RegionFlags.ResetHomeOnTeleport; | 1228 | flags |= RegionFlags.ResetHomeOnTeleport; |
1207 | if (Scene.RegionInfo.EstateSettings.TaxFree) | 1229 | if (Scene.RegionInfo.EstateSettings.TaxFree) |
1208 | flags |= RegionFlags.TaxFree; | 1230 | flags |= RegionFlags.TaxFree; |
1231 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
1232 | flags |= RegionFlags.AllowLandmark; | ||
1233 | if (Scene.RegionInfo.EstateSettings.AllowParcelChanges) | ||
1234 | flags |= RegionFlags.AllowParcelChanges; | ||
1235 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
1236 | flags |= RegionFlags.AllowSetHome; | ||
1209 | if (Scene.RegionInfo.EstateSettings.DenyMinors) | 1237 | if (Scene.RegionInfo.EstateSettings.DenyMinors) |
1210 | flags |= (RegionFlags)(1 << 30); | 1238 | flags |= (RegionFlags)(1 << 30); |
1211 | 1239 | ||
@@ -1226,6 +1254,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1226 | 1254 | ||
1227 | public void TriggerRegionInfoChange() | 1255 | public void TriggerRegionInfoChange() |
1228 | { | 1256 | { |
1257 | m_regionChangeTimer.Stop(); | ||
1258 | m_regionChangeTimer.Start(); | ||
1259 | } | ||
1260 | |||
1261 | protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e) | ||
1262 | { | ||
1229 | ChangeDelegate change = OnRegionInfoChange; | 1263 | ChangeDelegate change = OnRegionInfoChange; |
1230 | 1264 | ||
1231 | if (change != null) | 1265 | if (change != null) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index bfab7b8..f28faed 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -91,11 +91,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
91 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 91 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
92 | 92 | ||
93 | private bool m_allowedForcefulBans = true; | 93 | private bool m_allowedForcefulBans = true; |
94 | private UUID DefaultGodParcelGroup; | ||
95 | private string DefaultGodParcelName; | ||
94 | 96 | ||
95 | // caches ExtendedLandData | 97 | // caches ExtendedLandData |
96 | private Cache parcelInfoCache; | 98 | private Cache parcelInfoCache; |
97 | private Dictionary<UUID, Vector3> forcedPosition = | ||
98 | new Dictionary<UUID, Vector3>(); | ||
99 | 99 | ||
100 | #region INonSharedRegionModule Members | 100 | #region INonSharedRegionModule Members |
101 | 101 | ||
@@ -106,6 +106,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
106 | 106 | ||
107 | public void Initialise(IConfigSource source) | 107 | public void Initialise(IConfigSource source) |
108 | { | 108 | { |
109 | IConfig cnf = source.Configs["LandManagement"]; | ||
110 | if (cnf != null) | ||
111 | { | ||
112 | DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); | ||
113 | DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel"); | ||
114 | } | ||
109 | } | 115 | } |
110 | 116 | ||
111 | public void AddRegion(Scene scene) | 117 | public void AddRegion(Scene scene) |
@@ -157,13 +163,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
157 | m_scene.UnregisterModuleCommander(m_commander.Name); | 163 | m_scene.UnregisterModuleCommander(m_commander.Name); |
158 | } | 164 | } |
159 | 165 | ||
160 | // private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) | ||
161 | // { | ||
162 | // ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y); | ||
163 | // reason = "You are not allowed to enter this sim."; | ||
164 | // return nearestParcel != null; | ||
165 | // } | ||
166 | |||
167 | /// <summary> | 166 | /// <summary> |
168 | /// Processes commandline input. Do not call directly. | 167 | /// Processes commandline input. Do not call directly. |
169 | /// </summary> | 168 | /// </summary> |
@@ -215,36 +214,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
215 | 214 | ||
216 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | 215 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) |
217 | { | 216 | { |
218 | //If we are forcing a position for them to go | ||
219 | if (forcedPosition.ContainsKey(remoteClient.AgentId)) | ||
220 | { | ||
221 | ScenePresence clientAvatar = m_scene.GetScenePresence(remoteClient.AgentId); | ||
222 | |||
223 | //Putting the user into flying, both keeps the avatar in fligth when it bumps into something and stopped from going another direction AND | ||
224 | //When the avatar walks into a ban line on the ground, it prevents getting stuck | ||
225 | agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
226 | |||
227 | |||
228 | //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines | ||
229 | if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2) | ||
230 | { | ||
231 | Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); | ||
232 | forcedPosition.Remove(remoteClient.AgentId); | ||
233 | } | ||
234 | //if we are far away, teleport | ||
235 | else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3) | ||
236 | { | ||
237 | Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); | ||
238 | clientAvatar.Teleport(forcedPosition[remoteClient.AgentId]); | ||
239 | forcedPosition.Remove(remoteClient.AgentId); | ||
240 | } | ||
241 | else | ||
242 | { | ||
243 | //Forces them toward the forced position we want if they aren't there yet | ||
244 | agentData.UseClientAgentPosition = true; | ||
245 | agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId]; | ||
246 | } | ||
247 | } | ||
248 | } | 217 | } |
249 | 218 | ||
250 | public void Close() | 219 | public void Close() |
@@ -363,10 +332,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
363 | private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) | 332 | private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) |
364 | { | 333 | { |
365 | if (m_scene.Permissions.IsGod(avatar.UUID)) return; | 334 | if (m_scene.Permissions.IsGod(avatar.UUID)) return; |
366 | if (position.HasValue) | 335 | |
367 | { | 336 | if (!position.HasValue) |
368 | forcedPosition[avatar.ControllingClient.AgentId] = (Vector3)position; | 337 | return; |
369 | } | 338 | |
339 | bool isFlying = avatar.PhysicsActor.Flying; | ||
340 | avatar.RemoveFromPhysicalScene(); | ||
341 | |||
342 | avatar.AbsolutePosition = (Vector3)position; | ||
343 | |||
344 | avatar.AddToPhysicalScene(isFlying); | ||
370 | } | 345 | } |
371 | 346 | ||
372 | public void SendYouAreRestrictedNotice(ScenePresence avatar) | 347 | public void SendYouAreRestrictedNotice(ScenePresence avatar) |
@@ -386,29 +361,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
386 | } | 361 | } |
387 | 362 | ||
388 | if (parcelAvatarIsEntering != null) | 363 | if (parcelAvatarIsEntering != null) |
389 | { | 364 | EnforceBans(parcelAvatarIsEntering, avatar); |
390 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) | ||
391 | { | ||
392 | if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) | ||
393 | { | ||
394 | SendYouAreBannedNotice(avatar); | ||
395 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | ||
396 | } | ||
397 | else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID)) | ||
398 | { | ||
399 | SendYouAreRestrictedNotice(avatar); | ||
400 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | ||
401 | } | ||
402 | else | ||
403 | { | ||
404 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | ||
405 | } | ||
406 | } | ||
407 | else | ||
408 | { | ||
409 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | ||
410 | } | ||
411 | } | ||
412 | } | 365 | } |
413 | } | 366 | } |
414 | 367 | ||
@@ -480,43 +433,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
480 | SendOutNearestBanLine(remote_client); | 433 | SendOutNearestBanLine(remote_client); |
481 | ILandObject parcel = GetLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); | 434 | ILandObject parcel = GetLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); |
482 | if (parcel != null) | 435 | if (parcel != null) |
483 | { | 436 | EnforceBans(parcel, clientAvatar); |
484 | if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && | ||
485 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) | ||
486 | { | ||
487 | EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID, | ||
488 | m_scene.RegionInfo.RegionID); | ||
489 | //They are going under the safety line! | ||
490 | if (!parcel.IsBannedFromLand(clientAvatar.UUID)) | ||
491 | { | ||
492 | clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false; | ||
493 | } | ||
494 | } | ||
495 | else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && | ||
496 | parcel.IsBannedFromLand(clientAvatar.UUID)) | ||
497 | { | ||
498 | //once we've sent the message once, keep going toward the target until we are done | ||
499 | if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId)) | ||
500 | { | ||
501 | SendYouAreBannedNotice(clientAvatar); | ||
502 | ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar)); | ||
503 | } | ||
504 | } | ||
505 | else if (parcel.IsRestrictedFromLand(clientAvatar.UUID)) | ||
506 | { | ||
507 | //once we've sent the message once, keep going toward the target until we are done | ||
508 | if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId)) | ||
509 | { | ||
510 | SendYouAreRestrictedNotice(clientAvatar); | ||
511 | ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar)); | ||
512 | } | ||
513 | } | ||
514 | else | ||
515 | { | ||
516 | //when we are finally in a safe place, lets release the forced position lock | ||
517 | forcedPosition.Remove(clientAvatar.ControllingClient.AgentId); | ||
518 | } | ||
519 | } | ||
520 | } | 437 | } |
521 | } | 438 | } |
522 | 439 | ||
@@ -722,7 +639,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
722 | int x; | 639 | int x; |
723 | int y; | 640 | int y; |
724 | 641 | ||
725 | if (x_float >= Constants.RegionSize || x_float < 0 || y_float >= Constants.RegionSize || y_float < 0) | 642 | if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0) |
726 | return null; | 643 | return null; |
727 | 644 | ||
728 | try | 645 | try |
@@ -772,14 +689,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
772 | { | 689 | { |
773 | try | 690 | try |
774 | { | 691 | { |
775 | return m_landList[m_landIDList[x / 4, y / 4]]; | 692 | //if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) |
693 | return m_landList[m_landIDList[x / 4, y / 4]]; | ||
694 | //else | ||
695 | // return null; | ||
776 | } | 696 | } |
777 | catch (IndexOutOfRangeException) | 697 | catch (IndexOutOfRangeException) |
778 | { | 698 | { |
779 | // m_log.WarnFormat( | ||
780 | // "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}", | ||
781 | // x, y, m_scene.RegionInfo.RegionName); | ||
782 | |||
783 | return null; | 699 | return null; |
784 | } | 700 | } |
785 | } | 701 | } |
@@ -1062,6 +978,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1062 | //Owner Flag | 978 | //Owner Flag |
1063 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); | 979 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); |
1064 | } | 980 | } |
981 | else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID)) | ||
982 | { | ||
983 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP); | ||
984 | } | ||
1065 | else if (currentParcelBlock.LandData.SalePrice > 0 && | 985 | else if (currentParcelBlock.LandData.SalePrice > 0 && |
1066 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || | 986 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || |
1067 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) | 987 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) |
@@ -1362,18 +1282,31 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1362 | 1282 | ||
1363 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) | 1283 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) |
1364 | { | 1284 | { |
1365 | for (int i = 0; i < data.Count; i++) | 1285 | lock (m_landList) |
1366 | { | 1286 | { |
1367 | IncomingLandObjectFromStorage(data[i]); | 1287 | //Remove all the land objects in the sim and then process our new data |
1288 | foreach (int n in m_landList.Keys) | ||
1289 | { | ||
1290 | m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID); | ||
1291 | } | ||
1292 | m_landIDList.Initialize(); | ||
1293 | m_landList.Clear(); | ||
1294 | |||
1295 | for (int i = 0; i < data.Count; i++) | ||
1296 | { | ||
1297 | IncomingLandObjectFromStorage(data[i]); | ||
1298 | } | ||
1368 | } | 1299 | } |
1369 | } | 1300 | } |
1370 | 1301 | ||
1371 | public void IncomingLandObjectFromStorage(LandData data) | 1302 | public void IncomingLandObjectFromStorage(LandData data) |
1372 | { | 1303 | { |
1304 | |||
1373 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); | 1305 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); |
1374 | new_land.LandData = data.Copy(); | 1306 | new_land.LandData = data.Copy(); |
1375 | new_land.SetLandBitmapFromByteArray(); | 1307 | new_land.SetLandBitmapFromByteArray(); |
1376 | AddLandObject(new_land); | 1308 | AddLandObject(new_land); |
1309 | new_land.SendLandUpdateToAvatarsOverMe(); | ||
1377 | } | 1310 | } |
1378 | 1311 | ||
1379 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) | 1312 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) |
@@ -1648,6 +1581,322 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1648 | 1581 | ||
1649 | UpdateLandObject(localID, land.LandData); | 1582 | UpdateLandObject(localID, land.LandData); |
1650 | } | 1583 | } |
1584 | |||
1585 | public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID) | ||
1586 | { | ||
1587 | ILandObject land = null; | ||
1588 | List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels(); | ||
1589 | foreach (ILandObject landObject in Land) | ||
1590 | { | ||
1591 | if (landObject.LandData.LocalID == landID) | ||
1592 | { | ||
1593 | land = landObject; | ||
1594 | } | ||
1595 | } | ||
1596 | land.DeedToGroup(DefaultGodParcelGroup); | ||
1597 | land.LandData.Name = DefaultGodParcelName; | ||
1598 | land.SendLandUpdateToAvatarsOverMe(); | ||
1599 | } | ||
1600 | |||
1601 | private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID) | ||
1602 | { | ||
1603 | ScenePresence SP; | ||
1604 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); | ||
1605 | List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); | ||
1606 | if (SP.UserLevel != 0) | ||
1607 | { | ||
1608 | if (flags == 0) //All parcels, scripted or not | ||
1609 | { | ||
1610 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1611 | { | ||
1612 | if (e.OwnerID == targetID) | ||
1613 | { | ||
1614 | returns.Add(e); | ||
1615 | } | ||
1616 | } | ||
1617 | ); | ||
1618 | } | ||
1619 | if (flags == 4) //All parcels, scripted object | ||
1620 | { | ||
1621 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1622 | { | ||
1623 | if (e.OwnerID == targetID) | ||
1624 | { | ||
1625 | if (e.scriptScore >= 0.01) | ||
1626 | { | ||
1627 | returns.Add(e); | ||
1628 | } | ||
1629 | } | ||
1630 | } | ||
1631 | ); | ||
1632 | } | ||
1633 | if (flags == 4) //not target parcel, scripted object | ||
1634 | { | ||
1635 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1636 | { | ||
1637 | if (e.OwnerID == targetID) | ||
1638 | { | ||
1639 | ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y); | ||
1640 | if (landobject.LandData.OwnerID != e.OwnerID) | ||
1641 | { | ||
1642 | if (e.scriptScore >= 0.01) | ||
1643 | { | ||
1644 | returns.Add(e); | ||
1645 | } | ||
1646 | } | ||
1647 | } | ||
1648 | } | ||
1649 | ); | ||
1650 | } | ||
1651 | foreach (SceneObjectGroup ol in returns) | ||
1652 | { | ||
1653 | ReturnObject(ol, client); | ||
1654 | } | ||
1655 | } | ||
1656 | } | ||
1657 | public void ReturnObject(SceneObjectGroup obj, IClientAPI client) | ||
1658 | { | ||
1659 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | ||
1660 | objs[0] = obj; | ||
1661 | ((Scene)client.Scene).returnObjects(objs, client.AgentId); | ||
1662 | } | ||
1663 | |||
1664 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
1665 | |||
1666 | public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1667 | { | ||
1668 | ScenePresence targetAvatar = null; | ||
1669 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1670 | ScenePresence parcelManager = null; | ||
1671 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1672 | System.Threading.Timer Timer; | ||
1673 | |||
1674 | if (targetAvatar.UserLevel == 0) | ||
1675 | { | ||
1676 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1677 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1678 | return; | ||
1679 | if (flags == 0) | ||
1680 | { | ||
1681 | targetAvatar.AllowMovement = false; | ||
1682 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world."); | ||
1683 | parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen."); | ||
1684 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
1685 | Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0); | ||
1686 | Timers.Add(targetAvatar.UUID, Timer); | ||
1687 | } | ||
1688 | else | ||
1689 | { | ||
1690 | targetAvatar.AllowMovement = true; | ||
1691 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you."); | ||
1692 | parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen."); | ||
1693 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1694 | Timers.Remove(targetAvatar.UUID); | ||
1695 | Timer.Dispose(); | ||
1696 | } | ||
1697 | } | ||
1698 | } | ||
1699 | private void OnEndParcelFrozen(object avatar) | ||
1700 | { | ||
1701 | ScenePresence targetAvatar = (ScenePresence)avatar; | ||
1702 | targetAvatar.AllowMovement = true; | ||
1703 | System.Threading.Timer Timer; | ||
1704 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1705 | Timers.Remove(targetAvatar.UUID); | ||
1706 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); | ||
1707 | } | ||
1708 | |||
1709 | |||
1710 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1711 | { | ||
1712 | ScenePresence targetAvatar = null; | ||
1713 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1714 | ScenePresence parcelManager = null; | ||
1715 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1716 | //Just eject | ||
1717 | if (flags == 0) | ||
1718 | { | ||
1719 | if (targetAvatar.UserLevel == 0) | ||
1720 | { | ||
1721 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1722 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1723 | return; | ||
1724 | |||
1725 | Vector3 position = new Vector3(0, 0, 0); | ||
1726 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1727 | allParcels = AllParcels(); | ||
1728 | if (allParcels.Count != 1) | ||
1729 | { | ||
1730 | foreach (ILandObject parcel in allParcels) | ||
1731 | { | ||
1732 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1733 | { | ||
1734 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1735 | { | ||
1736 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1737 | { | ||
1738 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1739 | { | ||
1740 | if (parcel.ContainsPoint(x, y)) | ||
1741 | { | ||
1742 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1743 | targetAvatar.TeleportWithMomentum(position); | ||
1744 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1745 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1746 | return; | ||
1747 | } | ||
1748 | } | ||
1749 | } | ||
1750 | } | ||
1751 | } | ||
1752 | } | ||
1753 | } | ||
1754 | Vector3 targetVector; | ||
1755 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1756 | { | ||
1757 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1758 | { | ||
1759 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1760 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1761 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1762 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1763 | return; | ||
1764 | } | ||
1765 | else | ||
1766 | { | ||
1767 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1768 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1769 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1770 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1771 | return; | ||
1772 | } | ||
1773 | } | ||
1774 | else | ||
1775 | { | ||
1776 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1777 | { | ||
1778 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1779 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1780 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1781 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1782 | return; | ||
1783 | } | ||
1784 | else | ||
1785 | { | ||
1786 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1787 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1788 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1789 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1790 | return; | ||
1791 | } | ||
1792 | } | ||
1793 | } | ||
1794 | } | ||
1795 | //Eject and ban | ||
1796 | if (flags == 1) | ||
1797 | { | ||
1798 | if (targetAvatar.UserLevel == 0) | ||
1799 | { | ||
1800 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1801 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1802 | return; | ||
1803 | |||
1804 | Vector3 position = new Vector3(0, 0, 0); | ||
1805 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1806 | allParcels = AllParcels(); | ||
1807 | if (allParcels.Count != 1) | ||
1808 | { | ||
1809 | foreach (ILandObject parcel in allParcels) | ||
1810 | { | ||
1811 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1812 | { | ||
1813 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1814 | { | ||
1815 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1816 | { | ||
1817 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1818 | { | ||
1819 | if (parcel.ContainsPoint(x, y)) | ||
1820 | { | ||
1821 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1822 | targetAvatar.TeleportWithMomentum(position); | ||
1823 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1824 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1825 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1826 | entry.AgentID = targetAvatar.UUID; | ||
1827 | entry.Flags = AccessList.Ban; | ||
1828 | entry.Time = new DateTime(); | ||
1829 | land.LandData.ParcelAccessList.Add(entry); | ||
1830 | return; | ||
1831 | } | ||
1832 | } | ||
1833 | } | ||
1834 | } | ||
1835 | } | ||
1836 | } | ||
1837 | } | ||
1838 | Vector3 targetVector; | ||
1839 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1840 | { | ||
1841 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1842 | { | ||
1843 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1844 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1845 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1846 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1847 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1848 | entry.AgentID = targetAvatar.UUID; | ||
1849 | entry.Flags = AccessList.Ban; | ||
1850 | entry.Time = new DateTime(); | ||
1851 | land.LandData.ParcelAccessList.Add(entry); | ||
1852 | return; | ||
1853 | } | ||
1854 | else | ||
1855 | { | ||
1856 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1857 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1858 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1859 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1860 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1861 | entry.AgentID = targetAvatar.UUID; | ||
1862 | entry.Flags = AccessList.Ban; | ||
1863 | entry.Time = new DateTime(); | ||
1864 | land.LandData.ParcelAccessList.Add(entry); | ||
1865 | return; | ||
1866 | } | ||
1867 | } | ||
1868 | else | ||
1869 | { | ||
1870 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1871 | { | ||
1872 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1873 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1874 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1875 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1876 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1877 | entry.AgentID = targetAvatar.UUID; | ||
1878 | entry.Flags = AccessList.Ban; | ||
1879 | entry.Time = new DateTime(); | ||
1880 | land.LandData.ParcelAccessList.Add(entry); | ||
1881 | return; | ||
1882 | } | ||
1883 | else | ||
1884 | { | ||
1885 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1886 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1887 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1888 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1889 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1890 | entry.AgentID = targetAvatar.UUID; | ||
1891 | entry.Flags = AccessList.Ban; | ||
1892 | entry.Time = new DateTime(); | ||
1893 | land.LandData.ParcelAccessList.Add(entry); | ||
1894 | return; | ||
1895 | } | ||
1896 | } | ||
1897 | } | ||
1898 | } | ||
1899 | } | ||
1651 | 1900 | ||
1652 | protected void InstallInterfaces() | 1901 | protected void InstallInterfaces() |
1653 | { | 1902 | { |
@@ -1710,5 +1959,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1710 | 1959 | ||
1711 | MainConsole.Instance.Output(report.ToString()); | 1960 | MainConsole.Instance.Output(report.ToString()); |
1712 | } | 1961 | } |
1962 | |||
1963 | public void EnforceBans(ILandObject land, ScenePresence avatar) | ||
1964 | { | ||
1965 | if (avatar.AbsolutePosition.Z > LandChannel.BAN_LINE_SAFETY_HIEGHT) | ||
1966 | return; | ||
1967 | |||
1968 | if (land.IsEitherBannedOrRestricted(avatar.UUID)) | ||
1969 | { | ||
1970 | if (land.ContainsPoint(Convert.ToInt32(avatar.lastKnownAllowedPosition.X), Convert.ToInt32(avatar.lastKnownAllowedPosition.Y))) | ||
1971 | { | ||
1972 | Vector3? pos = m_scene.GetNearestAllowedPosition(avatar); | ||
1973 | if (pos == null) | ||
1974 | m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient); | ||
1975 | else | ||
1976 | ForceAvatarToPosition(avatar, (Vector3)pos); | ||
1977 | } | ||
1978 | else | ||
1979 | { | ||
1980 | ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); | ||
1981 | } | ||
1982 | } | ||
1983 | } | ||
1713 | } | 1984 | } |
1714 | } \ No newline at end of file | 1985 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index c2f104e..0fbc93c 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -415,11 +415,45 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
415 | return false; | 415 | return false; |
416 | } | 416 | } |
417 | 417 | ||
418 | public bool HasGroupAccess(UUID avatar) | ||
419 | { | ||
420 | if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) | ||
421 | { | ||
422 | ScenePresence sp; | ||
423 | if (!m_scene.TryGetScenePresence(avatar, out sp)) | ||
424 | { | ||
425 | IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
426 | if (groupsModule == null) | ||
427 | return false; | ||
428 | |||
429 | GroupMembershipData[] membership = groupsModule.GetMembershipData(avatar); | ||
430 | if (membership == null || membership.Length == 0) | ||
431 | return false; | ||
432 | |||
433 | foreach (GroupMembershipData d in membership) | ||
434 | { | ||
435 | if (d.GroupID == LandData.GroupID) | ||
436 | return true; | ||
437 | } | ||
438 | return false; | ||
439 | } | ||
440 | |||
441 | if (!sp.ControllingClient.IsGroupMember(LandData.GroupID)) | ||
442 | return false; | ||
443 | |||
444 | return true; | ||
445 | } | ||
446 | return false; | ||
447 | } | ||
448 | |||
418 | public bool IsBannedFromLand(UUID avatar) | 449 | public bool IsBannedFromLand(UUID avatar) |
419 | { | 450 | { |
420 | if (m_scene.Permissions.IsAdministrator(avatar)) | 451 | if (m_scene.Permissions.IsAdministrator(avatar)) |
421 | return false; | 452 | return false; |
422 | 453 | ||
454 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | ||
455 | return false; | ||
456 | |||
423 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) | 457 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) |
424 | { | 458 | { |
425 | if (LandData.ParcelAccessList.FindIndex( | 459 | if (LandData.ParcelAccessList.FindIndex( |
@@ -441,6 +475,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
441 | if (m_scene.Permissions.IsAdministrator(avatar)) | 475 | if (m_scene.Permissions.IsAdministrator(avatar)) |
442 | return false; | 476 | return false; |
443 | 477 | ||
478 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | ||
479 | return false; | ||
480 | |||
444 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) | 481 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) |
445 | { | 482 | { |
446 | if (LandData.ParcelAccessList.FindIndex( | 483 | if (LandData.ParcelAccessList.FindIndex( |
@@ -451,9 +488,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
451 | return false; | 488 | return false; |
452 | }) == -1 && LandData.OwnerID != avatar) | 489 | }) == -1 && LandData.OwnerID != avatar) |
453 | { | 490 | { |
454 | return true; | 491 | if (!HasGroupAccess(avatar)) |
492 | { | ||
493 | return true; | ||
494 | } | ||
455 | } | 495 | } |
456 | } | 496 | } |
497 | |||
457 | return false; | 498 | return false; |
458 | } | 499 | } |
459 | 500 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index dca842a..f466194 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | |||
@@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
206 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) | 206 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) |
207 | { | 207 | { |
208 | UUID landOwner = landData.OwnerID; | 208 | UUID landOwner = landData.OwnerID; |
209 | int partCount = obj.Parts.Length; | 209 | int partCount = obj.GetPartCount(); |
210 | 210 | ||
211 | m_SimwideCounts[landOwner] += partCount; | 211 | m_SimwideCounts[landOwner] += partCount; |
212 | if (parcelCounts.Users.ContainsKey(obj.OwnerID)) | 212 | if (parcelCounts.Users.ContainsKey(obj.OwnerID)) |
@@ -593,4 +593,4 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
593 | } | 593 | } |
594 | } | 594 | } |
595 | } | 595 | } |
596 | } \ No newline at end of file | 596 | } |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 170c35f..a098ff6 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -362,7 +362,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
362 | 362 | ||
363 | public string Name | 363 | public string Name |
364 | { | 364 | { |
365 | get { return "PermissionsModule"; } | 365 | get { return "DefaultPermissionsModule"; } |
366 | } | 366 | } |
367 | 367 | ||
368 | public bool IsSharedModule | 368 | public bool IsSharedModule |
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index e983239..c2934cd 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 0cacf2d..cd40c5d 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1057,7 +1057,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1057 | } | 1057 | } |
1058 | else | 1058 | else |
1059 | { | 1059 | { |
1060 | OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount()); | 1060 | OSDArray responsearr = new OSDArray(); // Don't preallocate. MT (m_scene.GetRootAgentCount()); |
1061 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) | 1061 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
1062 | { | 1062 | { |
1063 | OSDMap responsemapdata = new OSDMap(); | 1063 | OSDMap responsemapdata = new OSDMap(); |