diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
39 files changed, 1588 insertions, 414 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 22c301b..8e2dba4 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -257,53 +257,66 @@ namespace Flotsam.RegionModules.AssetCache | |||
257 | 257 | ||
258 | private void UpdateFileCache(string key, AssetBase asset) | 258 | private void UpdateFileCache(string key, AssetBase asset) |
259 | { | 259 | { |
260 | string filename = GetFileName(asset.ID); | 260 | // TODO: Spawn this off to some seperate thread to do the actual writing |
261 | 261 | if (asset != null) | |
262 | try | ||
263 | { | 262 | { |
264 | // If the file is already cached, don't cache it, just touch it so access time is updated | 263 | string filename = GetFileName(key); |
265 | if (File.Exists(filename)) | 264 | |
266 | { | 265 | try |
267 | File.SetLastAccessTime(filename, DateTime.Now); | ||
268 | } | ||
269 | else | ||
270 | { | 266 | { |
271 | // Once we start writing, make sure we flag that we're writing | 267 | // If the file is already cached, don't cache it, just touch it so access time is updated |
272 | // that object to the cache so that we don't try to write the | 268 | if (File.Exists(filename)) |
273 | // same file multiple times. | ||
274 | lock (m_CurrentlyWriting) | ||
275 | { | 269 | { |
276 | #if WAIT_ON_INPROGRESS_REQUESTS | 270 | // We don't really want to know about sharing |
277 | if (m_CurrentlyWriting.ContainsKey(filename)) | 271 | // violations here. If the file is locked, then |
272 | // the other thread has updated the time for us. | ||
273 | try | ||
278 | { | 274 | { |
279 | return; | 275 | File.SetLastAccessTime(filename, DateTime.Now); |
280 | } | 276 | } |
281 | else | 277 | catch |
282 | { | ||
283 | m_CurrentlyWriting.Add(filename, new ManualResetEvent(false)); | ||
284 | } | ||
285 | |||
286 | #else | ||
287 | if (m_CurrentlyWriting.Contains(filename)) | ||
288 | { | 278 | { |
289 | return; | ||
290 | } | 279 | } |
291 | else | 280 | } else { |
281 | |||
282 | // Once we start writing, make sure we flag that we're writing | ||
283 | // that object to the cache so that we don't try to write the | ||
284 | // same file multiple times. | ||
285 | lock (m_CurrentlyWriting) | ||
292 | { | 286 | { |
293 | m_CurrentlyWriting.Add(filename); | 287 | #if WAIT_ON_INPROGRESS_REQUESTS |
294 | } | 288 | if (m_CurrentlyWriting.ContainsKey(filename)) |
289 | { | ||
290 | return; | ||
291 | } | ||
292 | else | ||
293 | { | ||
294 | m_CurrentlyWriting.Add(filename, new ManualResetEvent(false)); | ||
295 | } | ||
296 | |||
297 | #else | ||
298 | if (m_CurrentlyWriting.Contains(filename)) | ||
299 | { | ||
300 | return; | ||
301 | } | ||
302 | else | ||
303 | { | ||
304 | m_CurrentlyWriting.Add(filename); | ||
305 | } | ||
295 | #endif | 306 | #endif |
296 | } | ||
297 | 307 | ||
298 | Util.FireAndForget( | 308 | } |
299 | delegate { WriteFileCache(filename, asset); }); | 309 | |
310 | Util.FireAndForget( | ||
311 | delegate { WriteFileCache(filename, asset); }); | ||
312 | } | ||
313 | } | ||
314 | catch (Exception e) | ||
315 | { | ||
316 | m_log.ErrorFormat( | ||
317 | "[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}", | ||
318 | asset.ID, e.Message, e.StackTrace); | ||
300 | } | 319 | } |
301 | } | ||
302 | catch (Exception e) | ||
303 | { | ||
304 | m_log.ErrorFormat( | ||
305 | "[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}", | ||
306 | asset.ID, e.Message, e.StackTrace); | ||
307 | } | 320 | } |
308 | } | 321 | } |
309 | 322 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index b965d75..a130ed2 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; |
@@ -130,7 +131,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
130 | // If we're an NPC then skip all the item checks and manipulations since we don't have an | 131 | // If we're an NPC then skip all the item checks and manipulations since we don't have an |
131 | // inventory right now. | 132 | // inventory right now. |
132 | if (sp.PresenceType == PresenceType.Npc) | 133 | if (sp.PresenceType == PresenceType.Npc) |
133 | RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p); | 134 | RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null); |
134 | else | 135 | else |
135 | RezSingleAttachmentFromInventory(sp.ControllingClient, attach.ItemID, p); | 136 | RezSingleAttachmentFromInventory(sp.ControllingClient, attach.ItemID, p); |
136 | } | 137 | } |
@@ -208,6 +209,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
208 | return; | 209 | return; |
209 | } | 210 | } |
210 | 211 | ||
212 | if (part.OwnerID != remoteClient.AgentId) // Not ours | ||
213 | { | ||
214 | remoteClient.SendAgentAlertMessage( | ||
215 | "You don't have sufficient permissions to attach this object", false); | ||
216 | return; | ||
217 | } | ||
218 | |||
211 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should | 219 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should |
212 | // be removed when that functionality is implemented in opensim | 220 | // be removed when that functionality is implemented in opensim |
213 | AttachmentPt &= 0x7f; | 221 | AttachmentPt &= 0x7f; |
@@ -354,10 +362,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
354 | 362 | ||
355 | public ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 363 | public ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) |
356 | { | 364 | { |
357 | // m_log.DebugFormat( | 365 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null); |
358 | // "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", | 366 | } |
359 | // (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); | ||
360 | 367 | ||
368 | public ISceneEntity RezSingleAttachmentFromInventory( | ||
369 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) | ||
370 | { | ||
361 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); | 371 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); |
362 | 372 | ||
363 | if (sp == null) | 373 | if (sp == null) |
@@ -407,7 +417,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
407 | return null; | 417 | return null; |
408 | } | 418 | } |
409 | 419 | ||
410 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt); | 420 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, null); |
411 | 421 | ||
412 | if (att == null) | 422 | if (att == null) |
413 | DetachSingleAttachmentToInv(itemID, sp.ControllingClient); | 423 | DetachSingleAttachmentToInv(itemID, sp.ControllingClient); |
@@ -415,8 +425,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
415 | return att; | 425 | return att; |
416 | } | 426 | } |
417 | 427 | ||
418 | private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 428 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
419 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt) | 429 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc) |
420 | { | 430 | { |
421 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 431 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
422 | if (invAccess != null) | 432 | if (invAccess != null) |
@@ -482,6 +492,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
482 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | 492 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", |
483 | itemID, sp.Name, attachmentPt); | 493 | itemID, sp.Name, attachmentPt); |
484 | } | 494 | } |
495 | |||
496 | if (doc != null) | ||
497 | { | ||
498 | objatt.LoadScriptState(doc); | ||
499 | objatt.ResetOwnerChangeFlag(); | ||
500 | } | ||
501 | |||
502 | // Fire after attach, so we don't get messy perms dialogs | ||
503 | // 4 == AttachedRez | ||
504 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | ||
505 | objatt.ResumeScripts(); | ||
506 | |||
507 | // Do this last so that event listeners have access to all the effects of the attachment | ||
508 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID); | ||
485 | } | 509 | } |
486 | } | 510 | } |
487 | 511 | ||
@@ -514,7 +538,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
514 | return; | 538 | return; |
515 | } | 539 | } |
516 | 540 | ||
541 | if (null == att.RootPart) | ||
542 | { | ||
543 | m_log.Error("[ATTACHMENTS MODULE]: Unable to save attachment for a prim without the rootpart!"); | ||
544 | return; | ||
545 | } | ||
517 | InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); | 546 | InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); |
547 | |||
548 | |||
549 | |||
550 | |||
551 | |||
552 | |||
518 | item = m_scene.InventoryService.GetItem(item); | 553 | item = m_scene.InventoryService.GetItem(item); |
519 | bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); | 554 | bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); |
520 | if (changed && m_scene.AvatarFactory != null) | 555 | if (changed && m_scene.AvatarFactory != null) |
@@ -645,11 +680,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
645 | { | 680 | { |
646 | if (entity is SceneObjectGroup) | 681 | if (entity is SceneObjectGroup) |
647 | { | 682 | { |
648 | group = (SceneObjectGroup)entity; | 683 | group = (SceneObjectGroup)entity; if (group.GetFromItemID() == itemID) { m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
649 | if (group.GetFromItemID() == itemID) | 684 | // CM / XMREngine!!!! Needed to conclude attach event |
650 | { | 685 | //SceneObjectSerializer.ToOriginalXmlFormat(group); |
651 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 686 | group.DetachToInventoryPrep(); |
652 | sp.RemoveAttachment(group); | 687 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); |
653 | 688 | ||
654 | // Prepare sog for storage | 689 | // Prepare sog for storage |
655 | group.AttachedAvatar = UUID.Zero; | 690 | group.AttachedAvatar = UUID.Zero; |
@@ -779,15 +814,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
779 | 814 | ||
780 | if (!silent) | 815 | if (!silent) |
781 | { | 816 | { |
782 | // Killing it here will cause the client to deselect it | ||
783 | // It then reappears on the avatar, deselected | ||
784 | // through the full update below | ||
785 | // | ||
786 | if (so.IsSelected) | ||
787 | { | ||
788 | m_scene.SendKillObject(so.RootPart.LocalId); | ||
789 | } | ||
790 | |||
791 | so.IsSelected = false; // fudge.... | 817 | so.IsSelected = false; // fudge.... |
792 | so.ScheduleGroupForFullUpdate(); | 818 | so.ScheduleGroupForFullUpdate(); |
793 | } | 819 | } |
@@ -808,14 +834,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
808 | // m_log.DebugFormat( | 834 | // m_log.DebugFormat( |
809 | // "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}", | 835 | // "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}", |
810 | // grp.Name, grp.LocalId, remoteClient.Name); | 836 | // grp.Name, grp.LocalId, remoteClient.Name); |
811 | 837 | uint regionSize = Constants.RegionSize; //Avoid VS error "The operation overflows at compile time in checked mode" | |
812 | Vector3 inventoryStoredPosition = new Vector3 | 838 | Vector3 inventoryStoredPosition = new Vector3 |
813 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | 839 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) |
814 | ? Constants.RegionSize - 6 | 840 | ? regionSize - 6 |
815 | : grp.AbsolutePosition.X) | 841 | : grp.AbsolutePosition.X) |
816 | , | 842 | , |
817 | (grp.AbsolutePosition.Y > (int)Constants.RegionSize) | 843 | (grp.AbsolutePosition.Y > (int)Constants.RegionSize) |
818 | ? Constants.RegionSize - 6 | 844 | ? regionSize - 6 |
819 | : grp.AbsolutePosition.Y, | 845 | : grp.AbsolutePosition.Y, |
820 | grp.AbsolutePosition.Z); | 846 | grp.AbsolutePosition.Z); |
821 | 847 | ||
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 36fe040..f343f80 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | |||
@@ -218,4 +218,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
218 | return result; | 218 | return result; |
219 | } | 219 | } |
220 | } | 220 | } |
221 | } \ No newline at end of file | 221 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 3a7178c..4350cde 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -304,7 +304,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
304 | //m_log.DebugFormat("[XXX]: OnClientLogin!"); | 304 | //m_log.DebugFormat("[XXX]: OnClientLogin!"); |
305 | // Inform the friends that this user is online | 305 | // Inform the friends that this user is online |
306 | StatusChange(agentID, true); | 306 | StatusChange(agentID, true); |
307 | 307 | ||
308 | // Register that we need to send the list of online friends to this user | 308 | // Register that we need to send the list of online friends to this user |
309 | lock (m_NeedsListOfFriends) | 309 | lock (m_NeedsListOfFriends) |
310 | m_NeedsListOfFriends.Add(agentID); | 310 | m_NeedsListOfFriends.Add(agentID); |
@@ -579,6 +579,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
579 | 579 | ||
580 | StoreFriendships(agentID, friendID); | 580 | StoreFriendships(agentID, friendID); |
581 | 581 | ||
582 | ICallingCardModule ccm = client.Scene.RequestModuleInterface<ICallingCardModule>(); | ||
583 | if (ccm != null) | ||
584 | { | ||
585 | ccm.CreateCallingCard(agentID, friendID, UUID.Zero); | ||
586 | } | ||
587 | |||
582 | // Update the local cache | 588 | // Update the local cache |
583 | RefetchFriends(client); | 589 | RefetchFriends(client); |
584 | 590 | ||
@@ -755,6 +761,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
755 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); | 761 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); |
756 | friendClient.SendInstantMessage(im); | 762 | friendClient.SendInstantMessage(im); |
757 | 763 | ||
764 | ICallingCardModule ccm = friendClient.Scene.RequestModuleInterface<ICallingCardModule>(); | ||
765 | if (ccm != null) | ||
766 | { | ||
767 | ccm.CreateCallingCard(friendID, userID, UUID.Zero); | ||
768 | } | ||
769 | |||
770 | |||
758 | // Update the local cache | 771 | // Update the local cache |
759 | RefetchFriends(friendClient); | 772 | RefetchFriends(friendClient); |
760 | 773 | ||
@@ -777,7 +790,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
777 | // we're done | 790 | // we're done |
778 | return true; | 791 | return true; |
779 | } | 792 | } |
780 | 793 | ||
781 | return false; | 794 | return false; |
782 | } | 795 | } |
783 | 796 | ||
@@ -830,7 +843,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
830 | 843 | ||
831 | public bool LocalStatusNotification(UUID userID, UUID friendID, bool online) | 844 | public bool LocalStatusNotification(UUID userID, UUID friendID, bool online) |
832 | { | 845 | { |
833 | // m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online); | 846 | //m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online); |
834 | IClientAPI friendClient = LocateClientObject(friendID); | 847 | IClientAPI friendClient = LocateClientObject(friendID); |
835 | if (friendClient != null) | 848 | if (friendClient != null) |
836 | { | 849 | { |
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 8d055d4..3373bd5 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -171,7 +171,11 @@ 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 | { | ||
176 | return; | ||
177 | } | ||
178 | else | ||
175 | { | 179 | { |
176 | m_log.DebugFormat("[OFFLINE MESSAGING]: Retrieving stored messages for {0}", client.AgentId); | 180 | m_log.DebugFormat("[OFFLINE MESSAGING]: Retrieving stored messages for {0}", client.AgentId); |
177 | 181 | ||
@@ -179,22 +183,25 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
179 | = SynchronousRestObjectRequester.MakeRequest<UUID, List<GridInstantMessage>>( | 183 | = SynchronousRestObjectRequester.MakeRequest<UUID, List<GridInstantMessage>>( |
180 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); | 184 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); |
181 | 185 | ||
182 | if (msglist == null) | 186 | if (msglist != null) |
183 | m_log.WarnFormat("[OFFLINE MESSAGING]: WARNING null message list."); | ||
184 | |||
185 | foreach (GridInstantMessage im in msglist) | ||
186 | { | 187 | { |
187 | // client.SendInstantMessage(im); | 188 | foreach (GridInstantMessage im in msglist) |
188 | 189 | { | |
189 | // Send through scene event manager so all modules get a chance | 190 | // client.SendInstantMessage(im); |
190 | // to look at this message before it gets delivered. | 191 | |
191 | // | 192 | // Send through scene event manager so all modules get a chance |
192 | // Needed for proper state management for stored group | 193 | // to look at this message before it gets delivered. |
193 | // invitations | 194 | // |
194 | // | 195 | // Needed for proper state management for stored group |
195 | Scene s = FindScene(client.AgentId); | 196 | // invitations |
196 | if (s != null) | 197 | // |
197 | s.EventManager.TriggerIncomingInstantMessage(im); | 198 | |
199 | im.offline = 1; | ||
200 | |||
201 | Scene s = FindScene(client.AgentId); | ||
202 | if (s != null) | ||
203 | s.EventManager.TriggerIncomingInstantMessage(im); | ||
204 | } | ||
198 | } | 205 | } |
199 | } | 206 | } |
200 | } | 207 | } |
@@ -205,7 +212,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
205 | && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) | 212 | && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) |
206 | { | 213 | { |
207 | bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>( | 214 | bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>( |
208 | "POST", m_RestURL+"/SaveMessage/", im); | 215 | "POST", m_RestURL + "/SaveMessage/", im); |
209 | 216 | ||
210 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) | 217 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) |
211 | { | 218 | { |
@@ -217,7 +224,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
217 | null, new UUID(im.toAgentID), | 224 | null, new UUID(im.toAgentID), |
218 | "System", new UUID(im.fromAgentID), | 225 | "System", new UUID(im.fromAgentID), |
219 | (byte)InstantMessageDialog.MessageFromAgent, | 226 | (byte)InstantMessageDialog.MessageFromAgent, |
220 | "User is not logged in. "+ | 227 | "User is not logged in. " + |
221 | (success ? "Message saved." : "Message not saved"), | 228 | (success ? "Message saved." : "Message not saved"), |
222 | false, new Vector3())); | 229 | false, new Vector3())); |
223 | } | 230 | } |
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 36ecb3b..63fde07 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -178,9 +178,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
178 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, | 178 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, |
179 | Dictionary<string, object> options, IUserAccountService userAccountService) | 179 | Dictionary<string, object> options, IUserAccountService userAccountService) |
180 | { | 180 | { |
181 | if (options.ContainsKey("verbose")) | ||
182 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving folder {0}", inventoryFolder.Name); | ||
183 | |||
184 | if (saveThisFolderItself) | 181 | if (saveThisFolderItself) |
185 | { | 182 | { |
186 | path += CreateArchiveFolderName(inventoryFolder); | 183 | path += CreateArchiveFolderName(inventoryFolder); |
@@ -449,4 +446,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
449 | return s; | 446 | return s; |
450 | } | 447 | } |
451 | } | 448 | } |
452 | } \ No newline at end of file | 449 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index f46d9f7..120fd43 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 | { |
@@ -244,6 +244,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
244 | im.imSessionID = itemID.Guid; | 244 | im.imSessionID = itemID.Guid; |
245 | } | 245 | } |
246 | 246 | ||
247 | im.offline = 1; // Remember these | ||
248 | |||
247 | // Send the IM to the recipient. The item is already | 249 | // Send the IM to the recipient. The item is already |
248 | // in their inventory, so it will not be lost if | 250 | // in their inventory, so it will not be lost if |
249 | // they are offline. | 251 | // they are offline. |
@@ -427,22 +429,67 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
427 | /// | 429 | /// |
428 | /// </summary> | 430 | /// </summary> |
429 | /// <param name="msg"></param> | 431 | /// <param name="msg"></param> |
430 | private void OnGridInstantMessage(GridInstantMessage msg) | 432 | private void OnGridInstantMessage(GridInstantMessage im) |
431 | { | 433 | { |
432 | // Check if this is ours to handle | 434 | // Check if this is ours to handle |
433 | // | 435 | // |
434 | Scene scene = FindClientScene(new UUID(msg.toAgentID)); | 436 | Scene scene = FindClientScene(new UUID(im.toAgentID)); |
435 | 437 | ||
436 | if (scene == null) | 438 | if (scene == null) |
437 | return; | 439 | return; |
438 | 440 | ||
439 | // Find agent to deliver to | 441 | // Find agent to deliver to |
440 | // | 442 | // |
441 | ScenePresence user = scene.GetScenePresence(new UUID(msg.toAgentID)); | 443 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); |
444 | if (user == null) | ||
445 | return; | ||
446 | |||
447 | // This requires a little bit of processing because we have to make the | ||
448 | // new item visible in the recipient's inventory here | ||
449 | // | ||
450 | if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) | ||
451 | { | ||
452 | if (im.binaryBucket.Length < 17) // Invalid | ||
453 | return; | ||
454 | |||
455 | UUID recipientID = new UUID(im.toAgentID); | ||
456 | |||
457 | // First byte is the asset type | ||
458 | AssetType assetType = (AssetType)im.binaryBucket[0]; | ||
459 | |||
460 | if (AssetType.Folder == assetType) | ||
461 | { | ||
462 | UUID folderID = new UUID(im.binaryBucket, 1); | ||
463 | |||
464 | InventoryFolderBase given = | ||
465 | new InventoryFolderBase(folderID, recipientID); | ||
466 | InventoryFolderBase folder = | ||
467 | scene.InventoryService.GetFolder(given); | ||
468 | |||
469 | if (folder != null) | ||
470 | user.ControllingClient.SendBulkUpdateInventory(folder); | ||
471 | } | ||
472 | else | ||
473 | { | ||
474 | UUID itemID = new UUID(im.binaryBucket, 1); | ||
442 | 475 | ||
443 | // Just forward to local handling | 476 | InventoryItemBase given = |
444 | OnInstantMessage(user.ControllingClient, msg); | 477 | new InventoryItemBase(itemID, recipientID); |
478 | InventoryItemBase item = | ||
479 | scene.InventoryService.GetItem(given); | ||
445 | 480 | ||
481 | if (item != null) | ||
482 | { | ||
483 | user.ControllingClient.SendBulkUpdateInventory(item); | ||
484 | } | ||
485 | } | ||
486 | user.ControllingClient.SendInstantMessage(im); | ||
487 | } | ||
488 | else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted || | ||
489 | im.dialog == (byte) InstantMessageDialog.InventoryDeclined) | ||
490 | { | ||
491 | user.ControllingClient.SendInstantMessage(im); | ||
492 | } | ||
446 | } | 493 | } |
447 | } | 494 | } |
448 | } | 495 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index d295384..dcfdf8f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | |||
@@ -155,16 +155,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
155 | scene.RegionInfo.RegionHandle, | 155 | scene.RegionInfo.RegionHandle, |
156 | (uint)presence.AbsolutePosition.X, | 156 | (uint)presence.AbsolutePosition.X, |
157 | (uint)presence.AbsolutePosition.Y, | 157 | (uint)presence.AbsolutePosition.Y, |
158 | (uint)presence.AbsolutePosition.Z); | 158 | (uint)presence.AbsolutePosition.Z + 2); |
159 | 159 | ||
160 | m_log.DebugFormat("TP invite with message {0}", message); | 160 | m_log.DebugFormat("[LURE]: TP invite with message {0}", message); |
161 | |||
162 | GridInstantMessage m; | ||
163 | |||
164 | if (scene.Permissions.IsAdministrator(client.AgentId) && presence.GodLevel >= 200 && (!scene.Permissions.IsAdministrator(targetid))) | ||
165 | { | ||
166 | m = new GridInstantMessage(scene, client.AgentId, | ||
167 | client.FirstName+" "+client.LastName, targetid, | ||
168 | (byte)InstantMessageDialog.GodLikeRequestTeleport, false, | ||
169 | message, dest, false, presence.AbsolutePosition, | ||
170 | new Byte[0]); | ||
171 | } | ||
172 | else | ||
173 | { | ||
174 | m = new GridInstantMessage(scene, client.AgentId, | ||
175 | client.FirstName+" "+client.LastName, targetid, | ||
176 | (byte)InstantMessageDialog.RequestTeleport, false, | ||
177 | message, dest, false, presence.AbsolutePosition, | ||
178 | new Byte[0]); | ||
179 | } | ||
161 | 180 | ||
162 | GridInstantMessage m = new GridInstantMessage(scene, client.AgentId, | ||
163 | client.FirstName+" "+client.LastName, targetid, | ||
164 | (byte)InstantMessageDialog.RequestTeleport, false, | ||
165 | message, dest, false, presence.AbsolutePosition, | ||
166 | new Byte[0]); | ||
167 | |||
168 | if (m_TransferModule != null) | 181 | if (m_TransferModule != null) |
169 | { | 182 | { |
170 | m_TransferModule.SendInstantMessage(m, | 183 | m_TransferModule.SendInstantMessage(m, |
@@ -199,7 +212,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
199 | { | 212 | { |
200 | // Forward remote teleport requests | 213 | // Forward remote teleport requests |
201 | // | 214 | // |
202 | if (msg.dialog != 22) | 215 | if (msg.dialog != (byte)InstantMessageDialog.RequestTeleport && |
216 | msg.dialog != (byte)InstantMessageDialog.GodLikeRequestTeleport) | ||
203 | return; | 217 | return; |
204 | 218 | ||
205 | if (m_TransferModule != null) | 219 | if (m_TransferModule != null) |
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index eb776fe..7ae304c 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs | |||
@@ -97,7 +97,8 @@ namespace OpenSim.Region.CoreModules.Framework | |||
97 | 97 | ||
98 | public void CreateCaps(UUID agentId) | 98 | public void CreateCaps(UUID agentId) |
99 | { | 99 | { |
100 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId)) | 100 | int flags = m_scene.GetUserFlags(agentId); |
101 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) | ||
101 | return; | 102 | return; |
102 | 103 | ||
103 | String capsObjectPath = GetCapsPath(agentId); | 104 | String capsObjectPath = GetCapsPath(agentId); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 8924c0a..25d5e0e 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -126,7 +126,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
126 | 126 | ||
127 | protected virtual void OnNewClient(IClientAPI client) | 127 | protected virtual void OnNewClient(IClientAPI client) |
128 | { | 128 | { |
129 | client.OnTeleportHomeRequest += TeleportHome; | 129 | client.OnTeleportHomeRequest += TriggerTeleportHome; |
130 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 130 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
131 | } | 131 | } |
132 | 132 | ||
@@ -204,6 +204,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
204 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 204 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
205 | 205 | ||
206 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 206 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
207 | sp.TeleportFlags = (TeleportFlags)teleportFlags; | ||
207 | sp.Teleport(position); | 208 | sp.Teleport(position); |
208 | 209 | ||
209 | foreach (SceneObjectGroup grp in sp.GetAttachments()) | 210 | foreach (SceneObjectGroup grp in sp.GetAttachments()) |
@@ -320,7 +321,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
320 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | 321 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, |
321 | // it's actually doing a lot of work. | 322 | // it's actually doing a lot of work. |
322 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; | 323 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; |
323 | if (endPoint.Address != null) | 324 | if (endPoint != null && endPoint.Address != null) |
324 | { | 325 | { |
325 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 326 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
326 | // both regions | 327 | // both regions |
@@ -570,7 +571,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
570 | 571 | ||
571 | protected void KillEntity(Scene scene, uint localID) | 572 | protected void KillEntity(Scene scene, uint localID) |
572 | { | 573 | { |
573 | scene.SendKillObject(localID); | 574 | scene.SendKillObject(new List<uint>() { localID }); |
574 | } | 575 | } |
575 | 576 | ||
576 | protected virtual GridRegion GetFinalDestination(GridRegion region) | 577 | protected virtual GridRegion GetFinalDestination(GridRegion region) |
@@ -631,7 +632,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
631 | 632 | ||
632 | #region Teleport Home | 633 | #region Teleport Home |
633 | 634 | ||
634 | public virtual void TeleportHome(UUID id, IClientAPI client) | 635 | public virtual void TriggerTeleportHome(UUID id, IClientAPI client) |
636 | { | ||
637 | TeleportHome(id, client); | ||
638 | } | ||
639 | |||
640 | public virtual bool TeleportHome(UUID id, IClientAPI client) | ||
635 | { | 641 | { |
636 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 642 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
637 | 643 | ||
@@ -640,12 +646,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
640 | 646 | ||
641 | if (uinfo != null) | 647 | if (uinfo != null) |
642 | { | 648 | { |
649 | if (uinfo.HomeRegionID == UUID.Zero) | ||
650 | { | ||
651 | // can't find the Home region: Tell viewer and abort | ||
652 | client.SendTeleportFailed("You don't have a home position set."); | ||
653 | return false; | ||
654 | } | ||
643 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); | 655 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); |
644 | if (regionInfo == null) | 656 | if (regionInfo == null) |
645 | { | 657 | { |
646 | // can't find the Home region: Tell viewer and abort | 658 | // can't find the Home region: Tell viewer and abort |
647 | client.SendTeleportFailed("Your home region could not be found."); | 659 | client.SendTeleportFailed("Your home region could not be found."); |
648 | return; | 660 | return false; |
649 | } | 661 | } |
650 | 662 | ||
651 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", | 663 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", |
@@ -656,6 +668,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
656 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, | 668 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, |
657 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); | 669 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); |
658 | } | 670 | } |
671 | else | ||
672 | { | ||
673 | // can't find the Home region: Tell viewer and abort | ||
674 | client.SendTeleportFailed("Your home region could not be found."); | ||
675 | return false; | ||
676 | } | ||
677 | return true; | ||
659 | } | 678 | } |
660 | 679 | ||
661 | #endregion | 680 | #endregion |
@@ -999,15 +1018,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
999 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | 1018 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); |
1000 | 1019 | ||
1001 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | 1020 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); |
1002 | if (eq != null) | 1021 | IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint; |
1003 | { | 1022 | if (neighbourExternal != null) |
1004 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | ||
1005 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
1006 | } | ||
1007 | else | ||
1008 | { | 1023 | { |
1009 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | 1024 | if (eq != null) |
1010 | capsPath); | 1025 | { |
1026 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
1027 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
1028 | } | ||
1029 | else | ||
1030 | { | ||
1031 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
1032 | capsPath); | ||
1033 | } | ||
1011 | } | 1034 | } |
1012 | 1035 | ||
1013 | if (!WaitForCallback(agent.UUID)) | 1036 | if (!WaitForCallback(agent.UUID)) |
@@ -1122,10 +1145,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1122 | agent.Id0 = currentAgentCircuit.Id0; | 1145 | agent.Id0 = currentAgentCircuit.Id0; |
1123 | } | 1146 | } |
1124 | 1147 | ||
1125 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1148 | IPEndPoint external = region.ExternalEndPoint; |
1126 | d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true, | 1149 | if (external != null) |
1150 | { | ||
1151 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
1152 | d.BeginInvoke(sp, agent, region, external, true, | ||
1127 | InformClientOfNeighbourCompleted, | 1153 | InformClientOfNeighbourCompleted, |
1128 | d); | 1154 | d); |
1155 | } | ||
1129 | } | 1156 | } |
1130 | #endregion | 1157 | #endregion |
1131 | 1158 | ||
@@ -1259,6 +1286,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1259 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1286 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; |
1260 | try | 1287 | try |
1261 | { | 1288 | { |
1289 | //neighbour.ExternalEndPoint may return null, which will be caught | ||
1262 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, | 1290 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, |
1263 | InformClientOfNeighbourCompleted, | 1291 | InformClientOfNeighbourCompleted, |
1264 | d); | 1292 | d); |
@@ -1362,8 +1390,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1362 | 1390 | ||
1363 | m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); | 1391 | m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); |
1364 | } | 1392 | } |
1365 | if (!regionAccepted) | ||
1366 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Region {0} did not accept agent: {1}", reg.RegionName, reason); | ||
1367 | } | 1393 | } |
1368 | 1394 | ||
1369 | /// <summary> | 1395 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index a87279a..6daae62 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
84 | 84 | ||
85 | protected override void OnNewClient(IClientAPI client) | 85 | protected override void OnNewClient(IClientAPI client) |
86 | { | 86 | { |
87 | client.OnTeleportHomeRequest += TeleportHome; | 87 | client.OnTeleportHomeRequest += TriggerTeleportHome; |
88 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 88 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
89 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); | 89 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); |
90 | } | 90 | } |
@@ -179,7 +179,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
179 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | 179 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); |
180 | } | 180 | } |
181 | 181 | ||
182 | public override void TeleportHome(UUID id, IClientAPI client) | 182 | public void TriggerTeleportHome(UUID id, IClientAPI client) |
183 | { | ||
184 | TeleportHome(id, client); | ||
185 | } | ||
186 | |||
187 | public override bool TeleportHome(UUID id, IClientAPI client) | ||
183 | { | 188 | { |
184 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 189 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
185 | 190 | ||
@@ -189,8 +194,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
189 | { | 194 | { |
190 | // local grid user | 195 | // local grid user |
191 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); | 196 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); |
192 | base.TeleportHome(id, client); | 197 | return base.TeleportHome(id, client); |
193 | return; | ||
194 | } | 198 | } |
195 | 199 | ||
196 | // Foreign user wants to go home | 200 | // Foreign user wants to go home |
@@ -200,7 +204,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
200 | { | 204 | { |
201 | client.SendTeleportFailed("Your information has been lost"); | 205 | client.SendTeleportFailed("Your information has been lost"); |
202 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); | 206 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); |
203 | return; | 207 | return false; |
204 | } | 208 | } |
205 | 209 | ||
206 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); | 210 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); |
@@ -210,7 +214,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
210 | { | 214 | { |
211 | client.SendTeleportFailed("Your home region could not be found"); | 215 | client.SendTeleportFailed("Your home region could not be found"); |
212 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); | 216 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); |
213 | return; | 217 | return false; |
214 | } | 218 | } |
215 | 219 | ||
216 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); | 220 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); |
@@ -218,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
218 | { | 222 | { |
219 | client.SendTeleportFailed("Internal error"); | 223 | client.SendTeleportFailed("Internal error"); |
220 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); | 224 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); |
221 | return; | 225 | return false; |
222 | } | 226 | } |
223 | 227 | ||
224 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | 228 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); |
@@ -228,6 +232,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
228 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); | 232 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); |
229 | 233 | ||
230 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); | 234 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); |
235 | return true; | ||
231 | } | 236 | } |
232 | 237 | ||
233 | /// <summary> | 238 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 03238d9..f05b090 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -675,19 +675,21 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
675 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | 675 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) |
676 | { | 676 | { |
677 | // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); | 677 | // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); |
678 | |||
679 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 678 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
680 | item = m_Scene.InventoryService.GetItem(item); | 679 | item = m_Scene.InventoryService.GetItem(item); |
681 | 680 | ||
682 | if (item == null) | 681 | if (item == null) |
683 | { | 682 | { |
684 | m_log.WarnFormat( | ||
685 | "[InventoryAccessModule]: Could not find item {0} for {1} in RezObject()", | ||
686 | itemID, remoteClient.Name); | ||
687 | 683 | ||
688 | return null; | 684 | return null; |
689 | } | 685 | } |
690 | 686 | ||
687 | |||
688 | |||
689 | |||
690 | |||
691 | |||
692 | |||
691 | item.Owner = remoteClient.AgentId; | 693 | item.Owner = remoteClient.AgentId; |
692 | 694 | ||
693 | return RezObject( | 695 | return RezObject( |
@@ -785,7 +787,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
785 | 787 | ||
786 | if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment)) | 788 | if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment)) |
787 | return null; | 789 | return null; |
788 | 790 | SceneObjectPart rootPart = group.RootPart; | |
789 | for (int i = 0; i < objlist.Count; i++) | 791 | for (int i = 0; i < objlist.Count; i++) |
790 | { | 792 | { |
791 | group = objlist[i]; | 793 | group = objlist[i]; |
@@ -843,8 +845,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
843 | 845 | ||
844 | if (!attachment) | 846 | if (!attachment) |
845 | { | 847 | { |
846 | SceneObjectPart rootPart = group.RootPart; | ||
847 | |||
848 | if (rootPart.Shape.PCode == (byte)PCode.Prim) | 848 | if (rootPart.Shape.PCode == (byte)PCode.Prim) |
849 | group.ClearPartAttachmentData(); | 849 | group.ClearPartAttachmentData(); |
850 | 850 | ||
@@ -860,9 +860,63 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
860 | // group.Name, group.LocalId, group.UUID, remoteClient.Name); | 860 | // group.Name, group.LocalId, group.UUID, remoteClient.Name); |
861 | } | 861 | } |
862 | 862 | ||
863 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | ||
864 | // TODO: Remove the magic number badness | ||
863 | if (item != null) | 865 | if (item != null) |
864 | DoPostRezWhenFromItem(item, attachment); | 866 | DoPostRezWhenFromItem(item, attachment); |
865 | 867 | ||
868 | if ((rootPart.OwnerID != item.Owner) || | ||
869 | (item.CurrentPermissions & 16) != 0 || // Magic number | ||
870 | (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) | ||
871 | { | ||
872 | //Need to kill the for sale here | ||
873 | rootPart.ObjectSaleType = 0; | ||
874 | rootPart.SalePrice = 10; | ||
875 | |||
876 | if (m_Scene.Permissions.PropagatePermissions()) | ||
877 | { | ||
878 | foreach (SceneObjectPart part in group.Parts) | ||
879 | { | ||
880 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | ||
881 | { | ||
882 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
883 | part.EveryoneMask = item.EveryOnePermissions; | ||
884 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
885 | part.NextOwnerMask = item.NextPermissions; | ||
886 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
887 | part.GroupMask = item.GroupPermissions; | ||
888 | } | ||
889 | } | ||
890 | |||
891 | foreach (SceneObjectPart part in group.Parts) | ||
892 | { | ||
893 | part.LastOwnerID = part.OwnerID; | ||
894 | part.OwnerID = item.Owner; | ||
895 | part.Inventory.ChangeInventoryOwner(item.Owner); | ||
896 | } | ||
897 | |||
898 | group.ApplyNextOwnerPermissions(); | ||
899 | } | ||
900 | } | ||
901 | foreach (SceneObjectPart part in group.Parts) | ||
902 | { | ||
903 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
904 | part.EveryoneMask = item.EveryOnePermissions; | ||
905 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
906 | part.NextOwnerMask = item.NextPermissions; | ||
907 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
908 | part.GroupMask = item.GroupPermissions; | ||
909 | } | ||
910 | |||
911 | if ((rootPart.OwnerID != item.Owner) || | ||
912 | (item.CurrentPermissions & 16) != 0 || // Magic number | ||
913 | (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) | ||
914 | { | ||
915 | //Need to kill the for sale here | ||
916 | rootPart.ObjectSaleType = 0; | ||
917 | rootPart.SalePrice = 10; | ||
918 | } | ||
919 | |||
866 | return group; | 920 | return group; |
867 | } | 921 | } |
868 | 922 | ||
diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs index 2de8d7a..93e65c3 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs | |||
@@ -181,7 +181,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
181 | } | 181 | } |
182 | private void EventManager_OnMakeRootAgent(ScenePresence presence) | 182 | private void EventManager_OnMakeRootAgent(ScenePresence presence) |
183 | { | 183 | { |
184 | m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client"); | 184 | if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) |
185 | m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client"); | ||
185 | SendProfileToClient(presence); | 186 | SendProfileToClient(presence); |
186 | } | 187 | } |
187 | private void EventManager_OnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID pUUID) | 188 | private void EventManager_OnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID pUUID) |
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 43672d1..5e28ee1 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -366,6 +366,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
366 | try | 366 | try |
367 | { | 367 | { |
368 | Request = (HttpWebRequest) WebRequest.Create(Url); | 368 | Request = (HttpWebRequest) WebRequest.Create(Url); |
369 | |||
370 | //This works around some buggy HTTP Servers like Lighttpd | ||
371 | Request.ServicePoint.Expect100Continue = false; | ||
372 | |||
369 | Request.Method = HttpMethod; | 373 | Request.Method = HttpMethod; |
370 | Request.ContentType = HttpMIMEType; | 374 | Request.ContentType = HttpMIMEType; |
371 | 375 | ||
@@ -440,7 +444,17 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
440 | { | 444 | { |
441 | HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; | 445 | HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; |
442 | Status = (int)webRsp.StatusCode; | 446 | Status = (int)webRsp.StatusCode; |
443 | ResponseBody = webRsp.StatusDescription; | 447 | try |
448 | { | ||
449 | using (Stream responseStream = webRsp.GetResponseStream()) | ||
450 | { | ||
451 | ResponseBody = responseStream.GetStreamString(); | ||
452 | } | ||
453 | } | ||
454 | catch | ||
455 | { | ||
456 | ResponseBody = webRsp.StatusDescription; | ||
457 | } | ||
444 | } | 458 | } |
445 | else | 459 | else |
446 | { | 460 | { |
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index a552a28..b6af1f2 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -60,6 +60,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
60 | //public ManualResetEvent ev; | 60 | //public ManualResetEvent ev; |
61 | public bool requestDone; | 61 | public bool requestDone; |
62 | public int startTime; | 62 | public int startTime; |
63 | public bool responseSent; | ||
63 | public string uri; | 64 | public string uri; |
64 | } | 65 | } |
65 | 66 | ||
@@ -76,7 +77,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
76 | new Dictionary<string, UrlData>(); | 77 | new Dictionary<string, UrlData>(); |
77 | 78 | ||
78 | 79 | ||
79 | private int m_TotalUrls = 100; | 80 | private int m_TotalUrls = 5000; |
80 | 81 | ||
81 | private uint https_port = 0; | 82 | private uint https_port = 0; |
82 | private IHttpServer m_HttpServer = null; | 83 | private IHttpServer m_HttpServer = null; |
@@ -155,7 +156,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
155 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 156 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); |
156 | return urlcode; | 157 | return urlcode; |
157 | } | 158 | } |
158 | string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/"; | 159 | string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString(); |
159 | 160 | ||
160 | UrlData urlData = new UrlData(); | 161 | UrlData urlData = new UrlData(); |
161 | urlData.hostID = host.UUID; | 162 | urlData.hostID = host.UUID; |
@@ -165,10 +166,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
165 | urlData.urlcode = urlcode; | 166 | urlData.urlcode = urlcode; |
166 | urlData.requests = new Dictionary<UUID, RequestData>(); | 167 | urlData.requests = new Dictionary<UUID, RequestData>(); |
167 | 168 | ||
168 | |||
169 | m_UrlMap[url] = urlData; | 169 | m_UrlMap[url] = urlData; |
170 | 170 | ||
171 | string uri = "/lslhttp/" + urlcode.ToString() + "/"; | 171 | string uri = "/lslhttp/" + urlcode.ToString(); |
172 | 172 | ||
173 | m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, | 173 | m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, |
174 | new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, | 174 | new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, |
@@ -233,9 +233,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
233 | return; | 233 | return; |
234 | } | 234 | } |
235 | 235 | ||
236 | foreach (UUID req in data.requests.Keys) | 236 | lock (m_RequestMap) |
237 | m_RequestMap.Remove(req); | 237 | { |
238 | 238 | foreach (UUID req in data.requests.Keys) | |
239 | m_RequestMap.Remove(req); | ||
240 | } | ||
241 | |||
239 | RemoveUrl(data); | 242 | RemoveUrl(data); |
240 | m_UrlMap.Remove(url); | 243 | m_UrlMap.Remove(url); |
241 | } | 244 | } |
@@ -243,32 +246,42 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
243 | 246 | ||
244 | public void HttpResponse(UUID request, int status, string body) | 247 | public void HttpResponse(UUID request, int status, string body) |
245 | { | 248 | { |
246 | if (m_RequestMap.ContainsKey(request)) | 249 | lock (m_RequestMap) |
247 | { | ||
248 | UrlData urlData = m_RequestMap[request]; | ||
249 | urlData.requests[request].responseCode = status; | ||
250 | urlData.requests[request].responseBody = body; | ||
251 | //urlData.requests[request].ev.Set(); | ||
252 | urlData.requests[request].requestDone =true; | ||
253 | } | ||
254 | else | ||
255 | { | 250 | { |
256 | m_log.Info("[HttpRequestHandler] There is no http-in request with id " + request.ToString()); | 251 | if (m_RequestMap.ContainsKey(request)) |
252 | { | ||
253 | UrlData urlData = m_RequestMap[request]; | ||
254 | if (!urlData.requests[request].responseSent) | ||
255 | { | ||
256 | urlData.requests[request].responseCode = status; | ||
257 | urlData.requests[request].responseBody = body; | ||
258 | //urlData.requests[request].ev.Set(); | ||
259 | urlData.requests[request].requestDone = true; | ||
260 | urlData.requests[request].responseSent = true; | ||
261 | } | ||
262 | } | ||
263 | else | ||
264 | { | ||
265 | m_log.Info("[HttpRequestHandler] There is no http-in request with id " + request.ToString()); | ||
266 | } | ||
257 | } | 267 | } |
258 | } | 268 | } |
259 | 269 | ||
260 | public string GetHttpHeader(UUID requestId, string header) | 270 | public string GetHttpHeader(UUID requestId, string header) |
261 | { | 271 | { |
262 | if (m_RequestMap.ContainsKey(requestId)) | 272 | lock (m_RequestMap) |
263 | { | ||
264 | UrlData urlData=m_RequestMap[requestId]; | ||
265 | string value; | ||
266 | if (urlData.requests[requestId].headers.TryGetValue(header,out value)) | ||
267 | return value; | ||
268 | } | ||
269 | else | ||
270 | { | 273 | { |
271 | m_log.Warn("[HttpRequestHandler] There was no http-in request with id " + requestId); | 274 | if (m_RequestMap.ContainsKey(requestId)) |
275 | { | ||
276 | UrlData urlData = m_RequestMap[requestId]; | ||
277 | string value; | ||
278 | if (urlData.requests[requestId].headers.TryGetValue(header, out value)) | ||
279 | return value; | ||
280 | } | ||
281 | else | ||
282 | { | ||
283 | m_log.Warn("[HttpRequestHandler] There was no http-in request with id " + requestId); | ||
284 | } | ||
272 | } | 285 | } |
273 | return String.Empty; | 286 | return String.Empty; |
274 | } | 287 | } |
@@ -290,8 +303,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
290 | { | 303 | { |
291 | RemoveUrl(url.Value); | 304 | RemoveUrl(url.Value); |
292 | removeURLs.Add(url.Key); | 305 | removeURLs.Add(url.Key); |
293 | foreach (UUID req in url.Value.requests.Keys) | 306 | lock (m_RequestMap) |
294 | m_RequestMap.Remove(req); | 307 | { |
308 | foreach (UUID req in url.Value.requests.Keys) | ||
309 | m_RequestMap.Remove(req); | ||
310 | } | ||
295 | } | 311 | } |
296 | } | 312 | } |
297 | 313 | ||
@@ -312,8 +328,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
312 | { | 328 | { |
313 | RemoveUrl(url.Value); | 329 | RemoveUrl(url.Value); |
314 | removeURLs.Add(url.Key); | 330 | removeURLs.Add(url.Key); |
315 | foreach (UUID req in url.Value.requests.Keys) | 331 | lock (m_RequestMap) |
316 | m_RequestMap.Remove(req); | 332 | { |
333 | foreach (UUID req in url.Value.requests.Keys) | ||
334 | m_RequestMap.Remove(req); | ||
335 | } | ||
317 | } | 336 | } |
318 | } | 337 | } |
319 | 338 | ||
@@ -332,14 +351,16 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
332 | { | 351 | { |
333 | Hashtable response = new Hashtable(); | 352 | Hashtable response = new Hashtable(); |
334 | UrlData url; | 353 | UrlData url; |
354 | int startTime = 0; | ||
335 | lock (m_RequestMap) | 355 | lock (m_RequestMap) |
336 | { | 356 | { |
337 | if (!m_RequestMap.ContainsKey(requestID)) | 357 | if (!m_RequestMap.ContainsKey(requestID)) |
338 | return response; | 358 | return response; |
339 | url = m_RequestMap[requestID]; | 359 | url = m_RequestMap[requestID]; |
360 | startTime = url.requests[requestID].startTime; | ||
340 | } | 361 | } |
341 | 362 | ||
342 | if (System.Environment.TickCount - url.requests[requestID].startTime > 25000) | 363 | if (System.Environment.TickCount - startTime > 25000) |
343 | { | 364 | { |
344 | response["int_response_code"] = 500; | 365 | response["int_response_code"] = 500; |
345 | response["str_response_string"] = "Script timeout"; | 366 | response["str_response_string"] = "Script timeout"; |
@@ -348,9 +369,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
348 | response["reusecontext"] = false; | 369 | response["reusecontext"] = false; |
349 | 370 | ||
350 | //remove from map | 371 | //remove from map |
351 | lock (url) | 372 | lock (url.requests) |
352 | { | 373 | { |
353 | url.requests.Remove(requestID); | 374 | url.requests.Remove(requestID); |
375 | } | ||
376 | lock (m_RequestMap) | ||
377 | { | ||
354 | m_RequestMap.Remove(requestID); | 378 | m_RequestMap.Remove(requestID); |
355 | } | 379 | } |
356 | 380 | ||
@@ -372,22 +396,25 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
372 | return false; | 396 | return false; |
373 | } | 397 | } |
374 | url = m_RequestMap[requestID]; | 398 | url = m_RequestMap[requestID]; |
399 | } | ||
400 | lock (url.requests) | ||
401 | { | ||
375 | if (!url.requests.ContainsKey(requestID)) | 402 | if (!url.requests.ContainsKey(requestID)) |
376 | { | 403 | { |
377 | return false; | 404 | return false; |
378 | } | 405 | } |
406 | else | ||
407 | { | ||
408 | if (System.Environment.TickCount - url.requests[requestID].startTime > 25000) | ||
409 | { | ||
410 | return true; | ||
411 | } | ||
412 | if (url.requests[requestID].requestDone) | ||
413 | return true; | ||
414 | else | ||
415 | return false; | ||
416 | } | ||
379 | } | 417 | } |
380 | |||
381 | if (System.Environment.TickCount-url.requests[requestID].startTime>25000) | ||
382 | { | ||
383 | return true; | ||
384 | } | ||
385 | |||
386 | if (url.requests[requestID].requestDone) | ||
387 | return true; | ||
388 | else | ||
389 | return false; | ||
390 | |||
391 | } | 418 | } |
392 | private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) | 419 | private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) |
393 | { | 420 | { |
@@ -399,9 +426,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
399 | if (!m_RequestMap.ContainsKey(requestID)) | 426 | if (!m_RequestMap.ContainsKey(requestID)) |
400 | return NoEvents(requestID,sessionID); | 427 | return NoEvents(requestID,sessionID); |
401 | url = m_RequestMap[requestID]; | 428 | url = m_RequestMap[requestID]; |
429 | } | ||
430 | lock (url.requests) | ||
431 | { | ||
402 | requestData = url.requests[requestID]; | 432 | requestData = url.requests[requestID]; |
403 | } | 433 | } |
404 | 434 | ||
405 | if (!requestData.requestDone) | 435 | if (!requestData.requestDone) |
406 | return NoEvents(requestID,sessionID); | 436 | return NoEvents(requestID,sessionID); |
407 | 437 | ||
@@ -424,14 +454,18 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
424 | response["reusecontext"] = false; | 454 | response["reusecontext"] = false; |
425 | 455 | ||
426 | //remove from map | 456 | //remove from map |
427 | lock (url) | 457 | lock (url.requests) |
428 | { | 458 | { |
429 | url.requests.Remove(requestID); | 459 | url.requests.Remove(requestID); |
460 | } | ||
461 | lock (m_RequestMap) | ||
462 | { | ||
430 | m_RequestMap.Remove(requestID); | 463 | m_RequestMap.Remove(requestID); |
431 | } | 464 | } |
432 | 465 | ||
433 | return response; | 466 | return response; |
434 | } | 467 | } |
468 | |||
435 | public void HttpRequestHandler(UUID requestID, Hashtable request) | 469 | public void HttpRequestHandler(UUID requestID, Hashtable request) |
436 | { | 470 | { |
437 | lock (request) | 471 | lock (request) |
@@ -447,8 +481,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
447 | 481 | ||
448 | int pos1 = uri.IndexOf("/");// /lslhttp | 482 | int pos1 = uri.IndexOf("/");// /lslhttp |
449 | int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ | 483 | int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ |
450 | int pos3 = uri.IndexOf("/", pos2 + 1);// /lslhttp/<UUID>/ | 484 | int pos3 = pos2 + 37; // /lslhttp/urlcode |
451 | string uri_tmp = uri.Substring(0, pos3 + 1); | 485 | string uri_tmp = uri.Substring(0, pos3); |
452 | //HTTP server code doesn't provide us with QueryStrings | 486 | //HTTP server code doesn't provide us with QueryStrings |
453 | string pathInfo; | 487 | string pathInfo; |
454 | string queryString; | 488 | string queryString; |
@@ -457,10 +491,21 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
457 | pathInfo = uri.Substring(pos3); | 491 | pathInfo = uri.Substring(pos3); |
458 | 492 | ||
459 | UrlData url = null; | 493 | UrlData url = null; |
494 | string urlkey; | ||
460 | if (!is_ssl) | 495 | if (!is_ssl) |
461 | url = m_UrlMap["http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp]; | 496 | urlkey = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp; |
497 | //m_UrlMap[]; | ||
462 | else | 498 | else |
463 | url = m_UrlMap["https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp]; | 499 | urlkey = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp; |
500 | |||
501 | if (m_UrlMap.ContainsKey(urlkey)) | ||
502 | { | ||
503 | url = m_UrlMap[urlkey]; | ||
504 | } | ||
505 | else | ||
506 | { | ||
507 | m_log.Warn("[HttpRequestHandler]: http-in request failed; no such url: "+urlkey.ToString()); | ||
508 | } | ||
464 | 509 | ||
465 | //for llGetHttpHeader support we need to store original URI here | 510 | //for llGetHttpHeader support we need to store original URI here |
466 | //to make x-path-info / x-query-string / x-script-url / x-remote-ip headers | 511 | //to make x-path-info / x-query-string / x-script-url / x-remote-ip headers |
@@ -490,7 +535,14 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
490 | if (request.ContainsKey(key)) | 535 | if (request.ContainsKey(key)) |
491 | { | 536 | { |
492 | string val = (String)request[key]; | 537 | string val = (String)request[key]; |
493 | queryString = queryString + key + "=" + val + "&"; | 538 | if (key != "") |
539 | { | ||
540 | queryString = queryString + key + "=" + val + "&"; | ||
541 | } | ||
542 | else | ||
543 | { | ||
544 | queryString = queryString + val + "&"; | ||
545 | } | ||
494 | } | 546 | } |
495 | } | 547 | } |
496 | if (queryString.Length > 1) | 548 | if (queryString.Length > 1) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/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 0a0ce3c..1ffd480 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs | |||
@@ -127,6 +127,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
127 | // FIXME: Why do we bother setting this module and caching up if we just end up registering the inner | 127 | // FIXME: Why do we bother setting this module and caching up if we just end up registering the inner |
128 | // user account service?! | 128 | // user account service?! |
129 | scene.RegisterModuleInterface<IUserAccountService>(UserAccountService); | 129 | scene.RegisterModuleInterface<IUserAccountService>(UserAccountService); |
130 | scene.RegisterModuleInterface<IUserAccountCacheModule>(m_Cache); | ||
130 | } | 131 | } |
131 | 132 | ||
132 | public void RemoveRegion(Scene scene) | 133 | public void RemoveRegion(Scene scene) |
@@ -179,6 +180,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
179 | return UserAccountService.GetUserAccount(scopeID, Email); | 180 | return UserAccountService.GetUserAccount(scopeID, Email); |
180 | } | 181 | } |
181 | 182 | ||
183 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) | ||
184 | { | ||
185 | return null; | ||
186 | } | ||
187 | |||
182 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) | 188 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) |
183 | { | 189 | { |
184 | return UserAccountService.GetUserAccounts(scopeID, query); | 190 | return UserAccountService.GetUserAccounts(scopeID, query); |
@@ -193,4 +199,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
193 | 199 | ||
194 | #endregion | 200 | #endregion |
195 | } | 201 | } |
196 | } \ No newline at end of file | 202 | } |
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 587d260..238863e 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 6a9c3d0..f8f3713 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -251,18 +251,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
251 | 251 | ||
252 | if (asset != null) | 252 | if (asset != null) |
253 | { | 253 | { |
254 | if (m_options.ContainsKey("verbose")) | 254 | // m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id); |
255 | m_log.InfoFormat("[ARCHIVER]: Writing asset {0}", id); | ||
256 | |||
257 | m_foundAssetUuids.Add(asset.FullID); | 255 | m_foundAssetUuids.Add(asset.FullID); |
258 | 256 | ||
259 | m_assetsArchiver.WriteAsset(PostProcess(asset)); | 257 | m_assetsArchiver.WriteAsset(PostProcess(asset)); |
260 | } | 258 | } |
261 | else | 259 | else |
262 | { | 260 | { |
263 | if (m_options.ContainsKey("verbose")) | 261 | // m_log.DebugFormat("[ARCHIVER]: Recording asset {0} as not found", id); |
264 | m_log.InfoFormat("[ARCHIVER]: Recording asset {0} as not found", id); | ||
265 | |||
266 | m_notFoundAssetUuids.Add(new UUID(id)); | 262 | m_notFoundAssetUuids.Add(new UUID(id)); |
267 | } | 263 | } |
268 | 264 | ||
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index c199a77..321f6b6 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Security; | 32 | using System.Security; |
33 | using System.Timers; | ||
33 | using log4net; | 34 | using log4net; |
34 | using Mono.Addins; | 35 | using Mono.Addins; |
35 | using Nini.Config; | 36 | using Nini.Config; |
@@ -47,6 +48,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
47 | 48 | ||
48 | private delegate void LookupUUIDS(List<UUID> uuidLst); | 49 | private delegate void LookupUUIDS(List<UUID> uuidLst); |
49 | 50 | ||
51 | private Timer m_regionChangeTimer = new Timer(); | ||
50 | public Scene Scene { get; private set; } | 52 | public Scene Scene { get; private set; } |
51 | public IUserManagement UserManager { get; private set; } | 53 | public IUserManagement UserManager { get; private set; } |
52 | 54 | ||
@@ -60,8 +62,15 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
60 | 62 | ||
61 | #region Packet Data Responders | 63 | #region Packet Data Responders |
62 | 64 | ||
65 | private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice) | ||
66 | { | ||
67 | sendDetailedEstateData(remote_client, invoice); | ||
68 | sendEstateLists(remote_client, invoice); | ||
69 | } | ||
70 | |||
63 | private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) | 71 | private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) |
64 | { | 72 | { |
73 | m_log.DebugFormat("[ESTATE]: Invoice is {0}", invoice.ToString()); | ||
65 | uint sun = 0; | 74 | uint sun = 0; |
66 | 75 | ||
67 | if (!Scene.RegionInfo.EstateSettings.UseGlobalTime) | 76 | if (!Scene.RegionInfo.EstateSettings.UseGlobalTime) |
@@ -81,7 +90,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
81 | Scene.RegionInfo.RegionSettings.Covenant, | 90 | Scene.RegionInfo.RegionSettings.Covenant, |
82 | Scene.RegionInfo.EstateSettings.AbuseEmail, | 91 | Scene.RegionInfo.EstateSettings.AbuseEmail, |
83 | estateOwner); | 92 | estateOwner); |
93 | } | ||
84 | 94 | ||
95 | private void sendEstateLists(IClientAPI remote_client, UUID invoice) | ||
96 | { | ||
85 | remote_client.SendEstateList(invoice, | 97 | remote_client.SendEstateList(invoice, |
86 | (int)Constants.EstateAccessCodex.EstateManagers, | 98 | (int)Constants.EstateAccessCodex.EstateManagers, |
87 | Scene.RegionInfo.EstateSettings.EstateManagers, | 99 | Scene.RegionInfo.EstateSettings.EstateManagers, |
@@ -256,7 +268,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
256 | timeInSeconds -= 15; | 268 | timeInSeconds -= 15; |
257 | } | 269 | } |
258 | 270 | ||
259 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); | 271 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), false); |
260 | } | 272 | } |
261 | } | 273 | } |
262 | 274 | ||
@@ -463,7 +475,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
463 | { | 475 | { |
464 | if (!s.IsChildAgent) | 476 | if (!s.IsChildAgent) |
465 | { | 477 | { |
466 | Scene.TeleportClientHome(user, s.ControllingClient); | 478 | if (!Scene.TeleportClientHome(user, s.ControllingClient)) |
479 | { | ||
480 | s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out."); | ||
481 | s.ControllingClient.Close(); | ||
482 | } | ||
467 | } | 483 | } |
468 | } | 484 | } |
469 | 485 | ||
@@ -472,7 +488,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
472 | { | 488 | { |
473 | remote_client.SendAlertMessage("User is already on the region ban list"); | 489 | remote_client.SendAlertMessage("User is already on the region ban list"); |
474 | } | 490 | } |
475 | //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | 491 | //Scene.RegionInfo.regionBanlist.Add(Manager(user); |
476 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); | 492 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); |
477 | } | 493 | } |
478 | else | 494 | else |
@@ -527,7 +543,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
527 | remote_client.SendAlertMessage("User is not on the region ban list"); | 543 | remote_client.SendAlertMessage("User is not on the region ban list"); |
528 | } | 544 | } |
529 | 545 | ||
530 | //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | 546 | //Scene.RegionInfo.regionBanlist.Add(Manager(user); |
531 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); | 547 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); |
532 | } | 548 | } |
533 | else | 549 | else |
@@ -648,7 +664,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
648 | ScenePresence s = Scene.GetScenePresence(prey); | 664 | ScenePresence s = Scene.GetScenePresence(prey); |
649 | if (s != null) | 665 | if (s != null) |
650 | { | 666 | { |
651 | Scene.TeleportClientHome(prey, s.ControllingClient); | 667 | if (!Scene.TeleportClientHome(prey, s.ControllingClient)) |
668 | { | ||
669 | s.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); | ||
670 | s.ControllingClient.Close(); | ||
671 | } | ||
652 | } | 672 | } |
653 | } | 673 | } |
654 | } | 674 | } |
@@ -667,7 +687,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
667 | // Also make sure they are actually in the region | 687 | // Also make sure they are actually in the region |
668 | if (p != null && !p.IsChildAgent) | 688 | if (p != null && !p.IsChildAgent) |
669 | { | 689 | { |
670 | Scene.TeleportClientHome(p.UUID, p.ControllingClient); | 690 | if (!Scene.TeleportClientHome(p.UUID, p.ControllingClient)) |
691 | { | ||
692 | p.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); | ||
693 | p.ControllingClient.Close(); | ||
694 | } | ||
671 | } | 695 | } |
672 | } | 696 | } |
673 | }); | 697 | }); |
@@ -912,7 +936,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
912 | 936 | ||
913 | for (int i = 0; i < uuidarr.Length; i++) | 937 | for (int i = 0; i < uuidarr.Length; i++) |
914 | { | 938 | { |
915 | // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); | 939 | // string lookupname = Scene.CommsManager.UUIDNameRequestString(uuidarr[i]); |
916 | 940 | ||
917 | IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>(); | 941 | IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>(); |
918 | if (userManager != null) | 942 | if (userManager != null) |
@@ -1054,6 +1078,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1054 | 1078 | ||
1055 | public void AddRegion(Scene scene) | 1079 | public void AddRegion(Scene scene) |
1056 | { | 1080 | { |
1081 | m_regionChangeTimer.AutoReset = false; | ||
1082 | m_regionChangeTimer.Interval = 2000; | ||
1083 | m_regionChangeTimer.Elapsed += RaiseRegionInfoChange; | ||
1084 | |||
1057 | Scene = scene; | 1085 | Scene = scene; |
1058 | Scene.RegisterModuleInterface<IEstateModule>(this); | 1086 | Scene.RegisterModuleInterface<IEstateModule>(this); |
1059 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; | 1087 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; |
@@ -1102,7 +1130,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1102 | 1130 | ||
1103 | private void EventManager_OnNewClient(IClientAPI client) | 1131 | private void EventManager_OnNewClient(IClientAPI client) |
1104 | { | 1132 | { |
1105 | client.OnDetailedEstateDataRequest += sendDetailedEstateData; | 1133 | client.OnDetailedEstateDataRequest += clientSendDetailedEstateData; |
1106 | client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler; | 1134 | client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler; |
1107 | // client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; | 1135 | // client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; |
1108 | client.OnSetEstateTerrainDetailTexture += setEstateTerrainBaseTexture; | 1136 | client.OnSetEstateTerrainDetailTexture += setEstateTerrainBaseTexture; |
@@ -1153,6 +1181,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1153 | flags |= RegionFlags.AllowParcelChanges; | 1181 | flags |= RegionFlags.AllowParcelChanges; |
1154 | if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) | 1182 | if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) |
1155 | flags |= RegionFlags.BlockParcelSearch; | 1183 | flags |= RegionFlags.BlockParcelSearch; |
1184 | if (Scene.RegionInfo.RegionSettings.GodBlockSearch) | ||
1185 | flags |= (RegionFlags)(1 << 11); | ||
1186 | if (Scene.RegionInfo.RegionSettings.Casino) | ||
1187 | flags |= (RegionFlags)(1 << 10); | ||
1156 | 1188 | ||
1157 | if (Scene.RegionInfo.RegionSettings.FixedSun) | 1189 | if (Scene.RegionInfo.RegionSettings.FixedSun) |
1158 | flags |= RegionFlags.SunFixed; | 1190 | flags |= RegionFlags.SunFixed; |
@@ -1160,11 +1192,15 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1160 | flags |= RegionFlags.Sandbox; | 1192 | flags |= RegionFlags.Sandbox; |
1161 | if (Scene.RegionInfo.EstateSettings.AllowVoice) | 1193 | if (Scene.RegionInfo.EstateSettings.AllowVoice) |
1162 | flags |= RegionFlags.AllowVoice; | 1194 | flags |= RegionFlags.AllowVoice; |
1195 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
1196 | flags |= RegionFlags.AllowLandmark; | ||
1197 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
1198 | flags |= RegionFlags.AllowSetHome; | ||
1199 | if (Scene.RegionInfo.EstateSettings.BlockDwell) | ||
1200 | flags |= RegionFlags.BlockDwell; | ||
1201 | if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) | ||
1202 | flags |= RegionFlags.ResetHomeOnTeleport; | ||
1163 | 1203 | ||
1164 | // Fudge these to always on, so the menu options activate | ||
1165 | // | ||
1166 | flags |= RegionFlags.AllowLandmark; | ||
1167 | flags |= RegionFlags.AllowSetHome; | ||
1168 | 1204 | ||
1169 | // TODO: SkipUpdateInterestList | 1205 | // TODO: SkipUpdateInterestList |
1170 | 1206 | ||
@@ -1205,6 +1241,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1205 | flags |= RegionFlags.ResetHomeOnTeleport; | 1241 | flags |= RegionFlags.ResetHomeOnTeleport; |
1206 | if (Scene.RegionInfo.EstateSettings.TaxFree) | 1242 | if (Scene.RegionInfo.EstateSettings.TaxFree) |
1207 | flags |= RegionFlags.TaxFree; | 1243 | flags |= RegionFlags.TaxFree; |
1244 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
1245 | flags |= RegionFlags.AllowLandmark; | ||
1246 | if (Scene.RegionInfo.EstateSettings.AllowParcelChanges) | ||
1247 | flags |= RegionFlags.AllowParcelChanges; | ||
1248 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
1249 | flags |= RegionFlags.AllowSetHome; | ||
1208 | if (Scene.RegionInfo.EstateSettings.DenyMinors) | 1250 | if (Scene.RegionInfo.EstateSettings.DenyMinors) |
1209 | flags |= (RegionFlags)(1 << 30); | 1251 | flags |= (RegionFlags)(1 << 30); |
1210 | 1252 | ||
@@ -1225,6 +1267,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1225 | 1267 | ||
1226 | public void TriggerRegionInfoChange() | 1268 | public void TriggerRegionInfoChange() |
1227 | { | 1269 | { |
1270 | m_regionChangeTimer.Stop(); | ||
1271 | m_regionChangeTimer.Start(); | ||
1272 | } | ||
1273 | |||
1274 | protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e) | ||
1275 | { | ||
1228 | ChangeDelegate change = OnRegionInfoChange; | 1276 | ChangeDelegate change = OnRegionInfoChange; |
1229 | 1277 | ||
1230 | if (change != null) | 1278 | if (change != null) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 2117827..474905a 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -91,6 +91,8 @@ 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; |
@@ -106,6 +108,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
106 | 108 | ||
107 | public void Initialise(IConfigSource source) | 109 | public void Initialise(IConfigSource source) |
108 | { | 110 | { |
111 | IConfig cnf = source.Configs["LandManagement"]; | ||
112 | if (cnf != null) | ||
113 | { | ||
114 | DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); | ||
115 | DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel"); | ||
116 | } | ||
109 | } | 117 | } |
110 | 118 | ||
111 | public void AddRegion(Scene scene) | 119 | public void AddRegion(Scene scene) |
@@ -157,13 +165,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
157 | m_scene.UnregisterModuleCommander(m_commander.Name); | 165 | m_scene.UnregisterModuleCommander(m_commander.Name); |
158 | } | 166 | } |
159 | 167 | ||
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> | 168 | /// <summary> |
168 | /// Processes commandline input. Do not call directly. | 169 | /// Processes commandline input. Do not call directly. |
169 | /// </summary> | 170 | /// </summary> |
@@ -215,36 +216,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
215 | 216 | ||
216 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | 217 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) |
217 | { | 218 | { |
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 | } | 219 | } |
249 | 220 | ||
250 | public void Close() | 221 | public void Close() |
@@ -363,10 +334,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
363 | private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) | 334 | private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) |
364 | { | 335 | { |
365 | if (m_scene.Permissions.IsGod(avatar.UUID)) return; | 336 | if (m_scene.Permissions.IsGod(avatar.UUID)) return; |
366 | if (position.HasValue) | 337 | |
367 | { | 338 | if (!position.HasValue) |
368 | forcedPosition[avatar.ControllingClient.AgentId] = (Vector3)position; | 339 | return; |
369 | } | 340 | |
341 | bool isFlying = avatar.PhysicsActor.Flying; | ||
342 | avatar.RemoveFromPhysicalScene(); | ||
343 | |||
344 | avatar.AbsolutePosition = (Vector3)position; | ||
345 | |||
346 | avatar.AddToPhysicalScene(isFlying); | ||
370 | } | 347 | } |
371 | 348 | ||
372 | public void SendYouAreRestrictedNotice(ScenePresence avatar) | 349 | public void SendYouAreRestrictedNotice(ScenePresence avatar) |
@@ -386,29 +363,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
386 | } | 363 | } |
387 | 364 | ||
388 | if (parcelAvatarIsEntering != null) | 365 | if (parcelAvatarIsEntering != null) |
389 | { | 366 | 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 | } | 367 | } |
413 | } | 368 | } |
414 | 369 | ||
@@ -512,6 +467,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
512 | //when we are finally in a safe place, lets release the forced position lock | 467 | //when we are finally in a safe place, lets release the forced position lock |
513 | forcedPosition.Remove(clientAvatar.ControllingClient.AgentId); | 468 | forcedPosition.Remove(clientAvatar.ControllingClient.AgentId); |
514 | } | 469 | } |
470 | EnforceBans(parcel, clientAvatar); | ||
515 | } | 471 | } |
516 | } | 472 | } |
517 | 473 | ||
@@ -720,7 +676,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
720 | int x; | 676 | int x; |
721 | int y; | 677 | int y; |
722 | 678 | ||
723 | if (x_float >= Constants.RegionSize || x_float < 0 || y_float >= Constants.RegionSize || y_float < 0) | 679 | if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0) |
724 | return null; | 680 | return null; |
725 | 681 | ||
726 | try | 682 | try |
@@ -770,14 +726,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
770 | { | 726 | { |
771 | try | 727 | try |
772 | { | 728 | { |
773 | return m_landList[m_landIDList[x / 4, y / 4]]; | 729 | //if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) |
730 | return m_landList[m_landIDList[x / 4, y / 4]]; | ||
731 | //else | ||
732 | // return null; | ||
774 | } | 733 | } |
775 | catch (IndexOutOfRangeException) | 734 | catch (IndexOutOfRangeException) |
776 | { | 735 | { |
777 | // m_log.WarnFormat( | ||
778 | // "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}", | ||
779 | // x, y, m_scene.RegionInfo.RegionName); | ||
780 | |||
781 | return null; | 736 | return null; |
782 | } | 737 | } |
783 | } | 738 | } |
@@ -1060,6 +1015,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1060 | //Owner Flag | 1015 | //Owner Flag |
1061 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); | 1016 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); |
1062 | } | 1017 | } |
1018 | else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID)) | ||
1019 | { | ||
1020 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP); | ||
1021 | } | ||
1063 | else if (currentParcelBlock.LandData.SalePrice > 0 && | 1022 | else if (currentParcelBlock.LandData.SalePrice > 0 && |
1064 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || | 1023 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || |
1065 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) | 1024 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) |
@@ -1360,18 +1319,31 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1360 | 1319 | ||
1361 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) | 1320 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) |
1362 | { | 1321 | { |
1363 | for (int i = 0; i < data.Count; i++) | 1322 | lock (m_landList) |
1364 | { | 1323 | { |
1365 | IncomingLandObjectFromStorage(data[i]); | 1324 | //Remove all the land objects in the sim and then process our new data |
1325 | foreach (int n in m_landList.Keys) | ||
1326 | { | ||
1327 | m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID); | ||
1328 | } | ||
1329 | m_landIDList.Initialize(); | ||
1330 | m_landList.Clear(); | ||
1331 | |||
1332 | for (int i = 0; i < data.Count; i++) | ||
1333 | { | ||
1334 | IncomingLandObjectFromStorage(data[i]); | ||
1335 | } | ||
1366 | } | 1336 | } |
1367 | } | 1337 | } |
1368 | 1338 | ||
1369 | public void IncomingLandObjectFromStorage(LandData data) | 1339 | public void IncomingLandObjectFromStorage(LandData data) |
1370 | { | 1340 | { |
1341 | |||
1371 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); | 1342 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); |
1372 | new_land.LandData = data.Copy(); | 1343 | new_land.LandData = data.Copy(); |
1373 | new_land.SetLandBitmapFromByteArray(); | 1344 | new_land.SetLandBitmapFromByteArray(); |
1374 | AddLandObject(new_land); | 1345 | AddLandObject(new_land); |
1346 | new_land.SendLandUpdateToAvatarsOverMe(); | ||
1375 | } | 1347 | } |
1376 | 1348 | ||
1377 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) | 1349 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) |
@@ -1649,6 +1621,322 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1649 | 1621 | ||
1650 | UpdateLandObject(localID, land.LandData); | 1622 | UpdateLandObject(localID, land.LandData); |
1651 | } | 1623 | } |
1624 | |||
1625 | public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID) | ||
1626 | { | ||
1627 | ILandObject land = null; | ||
1628 | List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels(); | ||
1629 | foreach (ILandObject landObject in Land) | ||
1630 | { | ||
1631 | if (landObject.LandData.LocalID == landID) | ||
1632 | { | ||
1633 | land = landObject; | ||
1634 | } | ||
1635 | } | ||
1636 | land.DeedToGroup(DefaultGodParcelGroup); | ||
1637 | land.LandData.Name = DefaultGodParcelName; | ||
1638 | land.SendLandUpdateToAvatarsOverMe(); | ||
1639 | } | ||
1640 | |||
1641 | private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID) | ||
1642 | { | ||
1643 | ScenePresence SP; | ||
1644 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); | ||
1645 | List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); | ||
1646 | if (SP.UserLevel != 0) | ||
1647 | { | ||
1648 | if (flags == 0) //All parcels, scripted or not | ||
1649 | { | ||
1650 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1651 | { | ||
1652 | if (e.OwnerID == targetID) | ||
1653 | { | ||
1654 | returns.Add(e); | ||
1655 | } | ||
1656 | } | ||
1657 | ); | ||
1658 | } | ||
1659 | if (flags == 4) //All parcels, scripted object | ||
1660 | { | ||
1661 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1662 | { | ||
1663 | if (e.OwnerID == targetID) | ||
1664 | { | ||
1665 | if (e.scriptScore >= 0.01) | ||
1666 | { | ||
1667 | returns.Add(e); | ||
1668 | } | ||
1669 | } | ||
1670 | } | ||
1671 | ); | ||
1672 | } | ||
1673 | if (flags == 4) //not target parcel, scripted object | ||
1674 | { | ||
1675 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1676 | { | ||
1677 | if (e.OwnerID == targetID) | ||
1678 | { | ||
1679 | ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y); | ||
1680 | if (landobject.LandData.OwnerID != e.OwnerID) | ||
1681 | { | ||
1682 | if (e.scriptScore >= 0.01) | ||
1683 | { | ||
1684 | returns.Add(e); | ||
1685 | } | ||
1686 | } | ||
1687 | } | ||
1688 | } | ||
1689 | ); | ||
1690 | } | ||
1691 | foreach (SceneObjectGroup ol in returns) | ||
1692 | { | ||
1693 | ReturnObject(ol, client); | ||
1694 | } | ||
1695 | } | ||
1696 | } | ||
1697 | public void ReturnObject(SceneObjectGroup obj, IClientAPI client) | ||
1698 | { | ||
1699 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | ||
1700 | objs[0] = obj; | ||
1701 | ((Scene)client.Scene).returnObjects(objs, client.AgentId); | ||
1702 | } | ||
1703 | |||
1704 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
1705 | |||
1706 | public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1707 | { | ||
1708 | ScenePresence targetAvatar = null; | ||
1709 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1710 | ScenePresence parcelManager = null; | ||
1711 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1712 | System.Threading.Timer Timer; | ||
1713 | |||
1714 | if (targetAvatar.UserLevel == 0) | ||
1715 | { | ||
1716 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1717 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1718 | return; | ||
1719 | if (flags == 0) | ||
1720 | { | ||
1721 | targetAvatar.AllowMovement = false; | ||
1722 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world."); | ||
1723 | parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen."); | ||
1724 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
1725 | Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0); | ||
1726 | Timers.Add(targetAvatar.UUID, Timer); | ||
1727 | } | ||
1728 | else | ||
1729 | { | ||
1730 | targetAvatar.AllowMovement = true; | ||
1731 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you."); | ||
1732 | parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen."); | ||
1733 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1734 | Timers.Remove(targetAvatar.UUID); | ||
1735 | Timer.Dispose(); | ||
1736 | } | ||
1737 | } | ||
1738 | } | ||
1739 | private void OnEndParcelFrozen(object avatar) | ||
1740 | { | ||
1741 | ScenePresence targetAvatar = (ScenePresence)avatar; | ||
1742 | targetAvatar.AllowMovement = true; | ||
1743 | System.Threading.Timer Timer; | ||
1744 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1745 | Timers.Remove(targetAvatar.UUID); | ||
1746 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); | ||
1747 | } | ||
1748 | |||
1749 | |||
1750 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1751 | { | ||
1752 | ScenePresence targetAvatar = null; | ||
1753 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1754 | ScenePresence parcelManager = null; | ||
1755 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1756 | //Just eject | ||
1757 | if (flags == 0) | ||
1758 | { | ||
1759 | if (targetAvatar.UserLevel == 0) | ||
1760 | { | ||
1761 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1762 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1763 | return; | ||
1764 | |||
1765 | Vector3 position = new Vector3(0, 0, 0); | ||
1766 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1767 | allParcels = AllParcels(); | ||
1768 | if (allParcels.Count != 1) | ||
1769 | { | ||
1770 | foreach (ILandObject parcel in allParcels) | ||
1771 | { | ||
1772 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1773 | { | ||
1774 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1775 | { | ||
1776 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1777 | { | ||
1778 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1779 | { | ||
1780 | if (parcel.ContainsPoint(x, y)) | ||
1781 | { | ||
1782 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1783 | targetAvatar.TeleportWithMomentum(position); | ||
1784 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1785 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1786 | return; | ||
1787 | } | ||
1788 | } | ||
1789 | } | ||
1790 | } | ||
1791 | } | ||
1792 | } | ||
1793 | } | ||
1794 | Vector3 targetVector; | ||
1795 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1796 | { | ||
1797 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1798 | { | ||
1799 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1800 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1801 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1802 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1803 | return; | ||
1804 | } | ||
1805 | else | ||
1806 | { | ||
1807 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1808 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1809 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1810 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1811 | return; | ||
1812 | } | ||
1813 | } | ||
1814 | else | ||
1815 | { | ||
1816 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1817 | { | ||
1818 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1819 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1820 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1821 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1822 | return; | ||
1823 | } | ||
1824 | else | ||
1825 | { | ||
1826 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1827 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1828 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1829 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1830 | return; | ||
1831 | } | ||
1832 | } | ||
1833 | } | ||
1834 | } | ||
1835 | //Eject and ban | ||
1836 | if (flags == 1) | ||
1837 | { | ||
1838 | if (targetAvatar.UserLevel == 0) | ||
1839 | { | ||
1840 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1841 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1842 | return; | ||
1843 | |||
1844 | Vector3 position = new Vector3(0, 0, 0); | ||
1845 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1846 | allParcels = AllParcels(); | ||
1847 | if (allParcels.Count != 1) | ||
1848 | { | ||
1849 | foreach (ILandObject parcel in allParcels) | ||
1850 | { | ||
1851 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1852 | { | ||
1853 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1854 | { | ||
1855 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1856 | { | ||
1857 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1858 | { | ||
1859 | if (parcel.ContainsPoint(x, y)) | ||
1860 | { | ||
1861 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1862 | targetAvatar.TeleportWithMomentum(position); | ||
1863 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1864 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1865 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1866 | entry.AgentID = targetAvatar.UUID; | ||
1867 | entry.Flags = AccessList.Ban; | ||
1868 | entry.Time = new DateTime(); | ||
1869 | land.LandData.ParcelAccessList.Add(entry); | ||
1870 | return; | ||
1871 | } | ||
1872 | } | ||
1873 | } | ||
1874 | } | ||
1875 | } | ||
1876 | } | ||
1877 | } | ||
1878 | Vector3 targetVector; | ||
1879 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1880 | { | ||
1881 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1882 | { | ||
1883 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1884 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1885 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1886 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1887 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1888 | entry.AgentID = targetAvatar.UUID; | ||
1889 | entry.Flags = AccessList.Ban; | ||
1890 | entry.Time = new DateTime(); | ||
1891 | land.LandData.ParcelAccessList.Add(entry); | ||
1892 | return; | ||
1893 | } | ||
1894 | else | ||
1895 | { | ||
1896 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1897 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1898 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1899 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1900 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1901 | entry.AgentID = targetAvatar.UUID; | ||
1902 | entry.Flags = AccessList.Ban; | ||
1903 | entry.Time = new DateTime(); | ||
1904 | land.LandData.ParcelAccessList.Add(entry); | ||
1905 | return; | ||
1906 | } | ||
1907 | } | ||
1908 | else | ||
1909 | { | ||
1910 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1911 | { | ||
1912 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1913 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1914 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1915 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1916 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1917 | entry.AgentID = targetAvatar.UUID; | ||
1918 | entry.Flags = AccessList.Ban; | ||
1919 | entry.Time = new DateTime(); | ||
1920 | land.LandData.ParcelAccessList.Add(entry); | ||
1921 | return; | ||
1922 | } | ||
1923 | else | ||
1924 | { | ||
1925 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1926 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1927 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1928 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1929 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1930 | entry.AgentID = targetAvatar.UUID; | ||
1931 | entry.Flags = AccessList.Ban; | ||
1932 | entry.Time = new DateTime(); | ||
1933 | land.LandData.ParcelAccessList.Add(entry); | ||
1934 | return; | ||
1935 | } | ||
1936 | } | ||
1937 | } | ||
1938 | } | ||
1939 | } | ||
1652 | 1940 | ||
1653 | protected void InstallInterfaces() | 1941 | protected void InstallInterfaces() |
1654 | { | 1942 | { |
@@ -1711,5 +1999,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1711 | 1999 | ||
1712 | MainConsole.Instance.Output(report.ToString()); | 2000 | MainConsole.Instance.Output(report.ToString()); |
1713 | } | 2001 | } |
2002 | |||
2003 | public void EnforceBans(ILandObject land, ScenePresence avatar) | ||
2004 | { | ||
2005 | if (avatar.AbsolutePosition.Z > LandChannel.BAN_LINE_SAFETY_HIEGHT) | ||
2006 | return; | ||
2007 | |||
2008 | if (land.IsEitherBannedOrRestricted(avatar.UUID)) | ||
2009 | { | ||
2010 | if (land.ContainsPoint(Convert.ToInt32(avatar.lastKnownAllowedPosition.X), Convert.ToInt32(avatar.lastKnownAllowedPosition.Y))) | ||
2011 | { | ||
2012 | Vector3? pos = m_scene.GetNearestAllowedPosition(avatar); | ||
2013 | if (pos == null) | ||
2014 | m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient); | ||
2015 | else | ||
2016 | ForceAvatarToPosition(avatar, (Vector3)pos); | ||
2017 | } | ||
2018 | else | ||
2019 | { | ||
2020 | ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); | ||
2021 | } | ||
2022 | } | ||
2023 | } | ||
1714 | } | 2024 | } |
1715 | } \ No newline at end of file | 2025 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 8c40171..950dff7 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -190,10 +190,26 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
190 | else | 190 | else |
191 | { | 191 | { |
192 | // Normal Calculations | 192 | // Normal Calculations |
193 | int parcelMax = (int)(((float)LandData.Area / 65536.0f) | 193 | int parcelMax = (int)((double)(LandData.Area |
194 | * (float)m_scene.RegionInfo.ObjectCapacity | 194 | * m_scene.RegionInfo.ObjectCapacity) |
195 | * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); | 195 | * m_scene.RegionInfo.RegionSettings.ObjectBonus) |
196 | // TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL! | 196 | / 65536; |
197 | return parcelMax; | ||
198 | } | ||
199 | } | ||
200 | |||
201 | private int GetParcelBasePrimCount() | ||
202 | { | ||
203 | if (overrideParcelMaxPrimCount != null) | ||
204 | { | ||
205 | return overrideParcelMaxPrimCount(this); | ||
206 | } | ||
207 | else | ||
208 | { | ||
209 | // Normal Calculations | ||
210 | int parcelMax = LandData.Area | ||
211 | * m_scene.RegionInfo.ObjectCapacity | ||
212 | / 65536; | ||
197 | return parcelMax; | 213 | return parcelMax; |
198 | } | 214 | } |
199 | } | 215 | } |
@@ -245,7 +261,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
245 | remote_client.SendLandProperties(seq_id, | 261 | remote_client.SendLandProperties(seq_id, |
246 | snap_selection, request_result, this, | 262 | snap_selection, request_result, this, |
247 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, | 263 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, |
248 | GetParcelMaxPrimCount(), | 264 | GetParcelBasePrimCount(), |
249 | GetSimulatorMaxPrimCount(), regionFlags); | 265 | GetSimulatorMaxPrimCount(), regionFlags); |
250 | } | 266 | } |
251 | 267 | ||
@@ -304,7 +320,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
304 | 320 | ||
305 | allowedDelta |= (uint)(ParcelFlags.ShowDirectory | | 321 | allowedDelta |= (uint)(ParcelFlags.ShowDirectory | |
306 | ParcelFlags.AllowPublish | | 322 | ParcelFlags.AllowPublish | |
307 | ParcelFlags.MaturePublish); | 323 | ParcelFlags.MaturePublish) | (uint)(1 << 23); |
308 | } | 324 | } |
309 | 325 | ||
310 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity)) | 326 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity)) |
@@ -416,9 +432,43 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
416 | return false; | 432 | return false; |
417 | } | 433 | } |
418 | 434 | ||
435 | public bool HasGroupAccess(UUID avatar) | ||
436 | { | ||
437 | if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) | ||
438 | { | ||
439 | ScenePresence sp; | ||
440 | if (!m_scene.TryGetScenePresence(avatar, out sp)) | ||
441 | { | ||
442 | IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
443 | if (groupsModule == null) | ||
444 | return false; | ||
445 | |||
446 | GroupMembershipData[] membership = groupsModule.GetMembershipData(avatar); | ||
447 | if (membership == null || membership.Length == 0) | ||
448 | return false; | ||
449 | |||
450 | foreach (GroupMembershipData d in membership) | ||
451 | { | ||
452 | if (d.GroupID == LandData.GroupID) | ||
453 | return true; | ||
454 | } | ||
455 | return false; | ||
456 | } | ||
457 | |||
458 | if (!sp.ControllingClient.IsGroupMember(LandData.GroupID)) | ||
459 | return false; | ||
460 | |||
461 | return true; | ||
462 | } | ||
463 | return false; | ||
464 | } | ||
465 | |||
419 | public bool IsBannedFromLand(UUID avatar) | 466 | public bool IsBannedFromLand(UUID avatar) |
420 | { | 467 | { |
421 | if (m_scene.Permissions.CanEditParcelProperties(avatar, this, 0)) | 468 | if (m_scene.Permissions.IsAdministrator(avatar)) |
469 | return false; | ||
470 | |||
471 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | ||
422 | return false; | 472 | return false; |
423 | 473 | ||
424 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) | 474 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) |
@@ -429,7 +479,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
429 | if (e.AgentID == avatar && e.Flags == AccessList.Ban) | 479 | if (e.AgentID == avatar && e.Flags == AccessList.Ban) |
430 | return true; | 480 | return true; |
431 | return false; | 481 | return false; |
432 | }) != -1) | 482 | }) != -1 && LandData.OwnerID != avatar) |
433 | { | 483 | { |
434 | return true; | 484 | return true; |
435 | } | 485 | } |
@@ -439,7 +489,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
439 | 489 | ||
440 | public bool IsRestrictedFromLand(UUID avatar) | 490 | public bool IsRestrictedFromLand(UUID avatar) |
441 | { | 491 | { |
442 | if (m_scene.Permissions.CanEditParcelProperties(avatar, this, 0)) | 492 | if (m_scene.Permissions.IsAdministrator(avatar)) |
493 | return false; | ||
494 | |||
495 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | ||
443 | return false; | 496 | return false; |
444 | 497 | ||
445 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) | 498 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) |
@@ -450,11 +503,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
450 | if (e.AgentID == avatar && e.Flags == AccessList.Access) | 503 | if (e.AgentID == avatar && e.Flags == AccessList.Access) |
451 | return true; | 504 | return true; |
452 | return false; | 505 | return false; |
453 | }) == -1) | 506 | }) == -1 && LandData.OwnerID != avatar) |
454 | { | 507 | { |
455 | return true; | 508 | if (!HasGroupAccess(avatar)) |
509 | { | ||
510 | return true; | ||
511 | } | ||
456 | } | 512 | } |
457 | } | 513 | } |
514 | |||
458 | return false; | 515 | return false; |
459 | } | 516 | } |
460 | 517 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index efede5c..5122734 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | |||
@@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
206 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) | 206 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) |
207 | { | 207 | { |
208 | UUID landOwner = landData.OwnerID; | 208 | UUID landOwner = landData.OwnerID; |
209 | int partCount = obj.Parts.Length; | 209 | int partCount = obj.GetPartCount(); |
210 | 210 | ||
211 | m_SimwideCounts[landOwner] += partCount; | 211 | m_SimwideCounts[landOwner] += partCount; |
212 | if (parcelCounts.Users.ContainsKey(obj.OwnerID)) | 212 | if (parcelCounts.Users.ContainsKey(obj.OwnerID)) |
@@ -593,4 +593,4 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
593 | } | 593 | } |
594 | } | 594 | } |
595 | } | 595 | } |
596 | } \ No newline at end of file | 596 | } |
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 1e4f0a4..eb4731c 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | |||
@@ -176,6 +176,13 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
176 | return false; | 176 | return false; |
177 | } | 177 | } |
178 | 178 | ||
179 | if ((perms & (uint)PermissionMask.Copy) == 0) | ||
180 | { | ||
181 | if (m_dialogModule != null) | ||
182 | m_dialogModule.SendAlertToUser(remoteClient, "This sale has been blocked by the permissions system"); | ||
183 | return false; | ||
184 | } | ||
185 | |||
179 | AssetBase asset = m_scene.CreateAsset( | 186 | AssetBase asset = m_scene.CreateAsset( |
180 | group.GetPartName(localID), | 187 | group.GetPartName(localID), |
181 | group.GetPartDescription(localID), | 188 | group.GetPartDescription(localID), |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 3b661ed..2e877f0 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -364,7 +364,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
364 | 364 | ||
365 | public string Name | 365 | public string Name |
366 | { | 366 | { |
367 | get { return "PermissionsModule"; } | 367 | get { return "DefaultPermissionsModule"; } |
368 | } | 368 | } |
369 | 369 | ||
370 | public bool IsSharedModule | 370 | public bool IsSharedModule |
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index 0f37ddd..7f6f4df 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs | |||
@@ -28,6 +28,8 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Timers; | 30 | using System.Timers; |
31 | using System.IO; | ||
32 | using System.Diagnostics; | ||
31 | using System.Threading; | 33 | using System.Threading; |
32 | using System.Collections.Generic; | 34 | using System.Collections.Generic; |
33 | using log4net; | 35 | using log4net; |
@@ -56,13 +58,23 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
56 | protected UUID m_Initiator; | 58 | protected UUID m_Initiator; |
57 | protected bool m_Notice = false; | 59 | protected bool m_Notice = false; |
58 | protected IDialogModule m_DialogModule = null; | 60 | protected IDialogModule m_DialogModule = null; |
61 | protected string m_MarkerPath = String.Empty; | ||
59 | 62 | ||
60 | public void Initialise(IConfigSource config) | 63 | public void Initialise(IConfigSource config) |
61 | { | 64 | { |
65 | IConfig restartConfig = config.Configs["RestartModule"]; | ||
66 | if (restartConfig != null) | ||
67 | { | ||
68 | m_MarkerPath = restartConfig.GetString("MarkerPath", String.Empty); | ||
69 | } | ||
62 | } | 70 | } |
63 | 71 | ||
64 | public void AddRegion(Scene scene) | 72 | public void AddRegion(Scene scene) |
65 | { | 73 | { |
74 | if (m_MarkerPath != String.Empty) | ||
75 | File.Delete(Path.Combine(m_MarkerPath, | ||
76 | scene.RegionInfo.RegionID.ToString())); | ||
77 | |||
66 | m_Scene = scene; | 78 | m_Scene = scene; |
67 | 79 | ||
68 | scene.RegisterModuleInterface<IRestartModule>(this); | 80 | scene.RegisterModuleInterface<IRestartModule>(this); |
@@ -121,6 +133,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
121 | 133 | ||
122 | if (alerts == null) | 134 | if (alerts == null) |
123 | { | 135 | { |
136 | CreateMarkerFile(); | ||
124 | m_Scene.RestartNow(); | 137 | m_Scene.RestartNow(); |
125 | return; | 138 | return; |
126 | } | 139 | } |
@@ -134,6 +147,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
134 | 147 | ||
135 | if (m_Alerts[0] == 0) | 148 | if (m_Alerts[0] == 0) |
136 | { | 149 | { |
150 | CreateMarkerFile(); | ||
137 | m_Scene.RestartNow(); | 151 | m_Scene.RestartNow(); |
138 | return; | 152 | return; |
139 | } | 153 | } |
@@ -147,6 +161,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
147 | { | 161 | { |
148 | if (m_Alerts.Count == 0 || m_Alerts[0] == 0) | 162 | if (m_Alerts.Count == 0 || m_Alerts[0] == 0) |
149 | { | 163 | { |
164 | CreateMarkerFile(); | ||
150 | m_Scene.RestartNow(); | 165 | m_Scene.RestartNow(); |
151 | return 0; | 166 | return 0; |
152 | } | 167 | } |
@@ -266,5 +281,25 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
266 | 281 | ||
267 | ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); | 282 | ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); |
268 | } | 283 | } |
284 | |||
285 | protected void CreateMarkerFile() | ||
286 | { | ||
287 | if (m_MarkerPath == String.Empty) | ||
288 | return; | ||
289 | |||
290 | string path = Path.Combine(m_MarkerPath, m_Scene.RegionInfo.RegionID.ToString()); | ||
291 | try | ||
292 | { | ||
293 | string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); | ||
294 | FileStream fs = File.Create(path); | ||
295 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
296 | Byte[] buf = enc.GetBytes(pidstring); | ||
297 | fs.Write(buf, 0, buf.Length); | ||
298 | fs.Close(); | ||
299 | } | ||
300 | catch (Exception) | ||
301 | { | ||
302 | } | ||
303 | } | ||
269 | } | 304 | } |
270 | } | 305 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index c832520..a93ffaa 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 3804017..c13e9c6 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 | ||
@@ -99,7 +99,7 @@ m_log.DebugFormat("MAP NAME=({0})", mapName); | |||
99 | if (regionInfos.Count == 0) | 99 | if (regionInfos.Count == 0) |
100 | remoteClient.SendAlertMessage("Hyperlink could not be established."); | 100 | remoteClient.SendAlertMessage("Hyperlink could not be established."); |
101 | 101 | ||
102 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); | 102 | //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); |
103 | List<MapBlockData> blocks = new List<MapBlockData>(); | 103 | List<MapBlockData> blocks = new List<MapBlockData>(); |
104 | 104 | ||
105 | MapBlockData data; | 105 | MapBlockData data; |
@@ -128,7 +128,7 @@ m_log.DebugFormat("MAP NAME=({0})", mapName); | |||
128 | data.Agents = 0; | 128 | data.Agents = 0; |
129 | data.Access = 255; | 129 | data.Access = 255; |
130 | data.MapImageId = UUID.Zero; | 130 | data.MapImageId = UUID.Zero; |
131 | data.Name = ""; // mapName; | 131 | data.Name = mapName; |
132 | data.RegionFlags = 0; | 132 | data.RegionFlags = 0; |
133 | data.WaterHeight = 0; // not used | 133 | data.WaterHeight = 0; // not used |
134 | data.X = 0; | 134 | data.X = 0; |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 857079c..21e3ecb 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1179,7 +1179,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1179 | } | 1179 | } |
1180 | else | 1180 | else |
1181 | { | 1181 | { |
1182 | OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount()); | 1182 | OSDArray responsearr = new OSDArray(); // Don't preallocate. MT (m_scene.GetRootAgentCount()); |
1183 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) | 1183 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
1184 | { | 1184 | { |
1185 | OSDMap responsemapdata = new OSDMap(); | 1185 | OSDMap responsemapdata = new OSDMap(); |