diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
27 files changed, 1489 insertions, 492 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs index c66a4ea..d7f3f2c 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs | |||
@@ -167,6 +167,19 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
167 | { | 167 | { |
168 | if (XferUploaders.ContainsKey(transactionID)) | 168 | if (XferUploaders.ContainsKey(transactionID)) |
169 | { | 169 | { |
170 | m_log.DebugFormat("[XFER]: Asked to update item {0} ({1})", | ||
171 | item.Name, item.ID); | ||
172 | |||
173 | // Here we need to get the old asset to extract the | ||
174 | // texture UUIDs if it's a wearable. | ||
175 | if (item.AssetType == (int)AssetType.Bodypart || | ||
176 | item.AssetType == (int)AssetType.Clothing) | ||
177 | { | ||
178 | AssetBase oldAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); | ||
179 | if (oldAsset != null) | ||
180 | XferUploaders[transactionID].SetOldData(oldAsset.Data); | ||
181 | } | ||
182 | |||
170 | AssetBase asset = GetTransactionAsset(transactionID); | 183 | AssetBase asset = GetTransactionAsset(transactionID); |
171 | 184 | ||
172 | if (asset != null) | 185 | if (asset != null) |
@@ -181,6 +194,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
181 | 194 | ||
182 | IInventoryService invService = m_Scene.InventoryService; | 195 | IInventoryService invService = m_Scene.InventoryService; |
183 | invService.UpdateItem(item); | 196 | invService.UpdateItem(item); |
197 | |||
198 | m_log.DebugFormat("[XFER]: Updated item {0} ({1}) with asset {2}", | ||
199 | item.Name, item.ID, asset.FullID); | ||
184 | } | 200 | } |
185 | } | 201 | } |
186 | } | 202 | } |
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index a7929ba..a5dcdcc 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Collections.Generic; | ||
31 | using log4net; | 32 | using log4net; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
@@ -38,6 +39,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
38 | { | 39 | { |
39 | public class AssetXferUploader | 40 | public class AssetXferUploader |
40 | { | 41 | { |
42 | // Viewer's notion of the default texture | ||
43 | private List<UUID> defaultIDs = new List<UUID> { | ||
44 | new UUID("5748decc-f629-461c-9a36-a35a221fe21f"), | ||
45 | new UUID("7ca39b4c-bd19-4699-aff7-f93fd03d3e7b"), | ||
46 | new UUID("6522e74d-1660-4e7f-b601-6f48c1659a77"), | ||
47 | new UUID("c228d1cf-4b5d-4ba8-84f4-899a0796aa97") | ||
48 | }; | ||
41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 50 | ||
43 | private AssetBase m_asset; | 51 | private AssetBase m_asset; |
@@ -55,6 +63,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
55 | private UUID TransactionID = UUID.Zero; | 63 | private UUID TransactionID = UUID.Zero; |
56 | private sbyte type = 0; | 64 | private sbyte type = 0; |
57 | private byte wearableType = 0; | 65 | private byte wearableType = 0; |
66 | private byte[] m_oldData = null; | ||
58 | public ulong XferID; | 67 | public ulong XferID; |
59 | private Scene m_Scene; | 68 | private Scene m_Scene; |
60 | 69 | ||
@@ -219,6 +228,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
219 | 228 | ||
220 | private void DoCreateItem(uint callbackID) | 229 | private void DoCreateItem(uint callbackID) |
221 | { | 230 | { |
231 | ValidateAssets(); | ||
222 | m_Scene.AssetService.Store(m_asset); | 232 | m_Scene.AssetService.Store(m_asset); |
223 | 233 | ||
224 | InventoryItemBase item = new InventoryItemBase(); | 234 | InventoryItemBase item = new InventoryItemBase(); |
@@ -239,12 +249,84 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
239 | item.Flags = (uint) wearableType; | 249 | item.Flags = (uint) wearableType; |
240 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 250 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
241 | 251 | ||
252 | m_log.DebugFormat("[XFER]: Created item {0} with asset {1}", | ||
253 | item.ID, item.AssetID); | ||
254 | |||
242 | if (m_Scene.AddInventoryItem(item)) | 255 | if (m_Scene.AddInventoryItem(item)) |
243 | ourClient.SendInventoryItemCreateUpdate(item, callbackID); | 256 | ourClient.SendInventoryItemCreateUpdate(item, callbackID); |
244 | else | 257 | else |
245 | ourClient.SendAlertMessage("Unable to create inventory item"); | 258 | ourClient.SendAlertMessage("Unable to create inventory item"); |
246 | } | 259 | } |
247 | 260 | ||
261 | private void ValidateAssets() | ||
262 | { | ||
263 | if (m_asset.Type == (sbyte)AssetType.Clothing || | ||
264 | m_asset.Type == (sbyte)AssetType.Bodypart) | ||
265 | { | ||
266 | string content = System.Text.Encoding.ASCII.GetString(m_asset.Data); | ||
267 | string[] lines = content.Split(new char[] {'\n'}); | ||
268 | |||
269 | List<string> validated = new List<string>(); | ||
270 | |||
271 | Dictionary<int, UUID> allowed = ExtractTexturesFromOldData(); | ||
272 | |||
273 | int textures = 0; | ||
274 | |||
275 | foreach (string line in lines) | ||
276 | { | ||
277 | try | ||
278 | { | ||
279 | if (line.StartsWith("textures ")) | ||
280 | { | ||
281 | textures = Convert.ToInt32(line.Substring(9)); | ||
282 | validated.Add(line); | ||
283 | } | ||
284 | else if (textures > 0) | ||
285 | { | ||
286 | string[] parts = line.Split(new char[] {' '}); | ||
287 | |||
288 | UUID tx = new UUID(parts[1]); | ||
289 | int id = Convert.ToInt32(parts[0]); | ||
290 | |||
291 | if (defaultIDs.Contains(tx) || tx == UUID.Zero || | ||
292 | (allowed.ContainsKey(id) && allowed[id] == tx)) | ||
293 | { | ||
294 | validated.Add(parts[0] + " " + tx.ToString()); | ||
295 | } | ||
296 | else | ||
297 | { | ||
298 | int perms = m_Scene.InventoryService.GetAssetPermissions(ourClient.AgentId, tx); | ||
299 | int full = (int)(PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Copy); | ||
300 | |||
301 | if ((perms & full) != full) | ||
302 | { | ||
303 | m_log.ErrorFormat("[ASSET UPLOADER]: REJECTED update with texture {0} from {1} because they do not own the texture", tx, ourClient.AgentId); | ||
304 | validated.Add(parts[0] + " " + UUID.Zero.ToString()); | ||
305 | } | ||
306 | else | ||
307 | { | ||
308 | validated.Add(line); | ||
309 | } | ||
310 | } | ||
311 | textures--; | ||
312 | } | ||
313 | else | ||
314 | { | ||
315 | validated.Add(line); | ||
316 | } | ||
317 | } | ||
318 | catch | ||
319 | { | ||
320 | // If it's malformed, skip it | ||
321 | } | ||
322 | } | ||
323 | |||
324 | string final = String.Join("\n", validated.ToArray()); | ||
325 | |||
326 | m_asset.Data = System.Text.Encoding.ASCII.GetBytes(final); | ||
327 | } | ||
328 | } | ||
329 | |||
248 | /// <summary> | 330 | /// <summary> |
249 | /// Get the asset data uploaded in this transfer. | 331 | /// Get the asset data uploaded in this transfer. |
250 | /// </summary> | 332 | /// </summary> |
@@ -253,10 +335,55 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
253 | { | 335 | { |
254 | if (m_finished) | 336 | if (m_finished) |
255 | { | 337 | { |
338 | ValidateAssets(); | ||
256 | return m_asset; | 339 | return m_asset; |
257 | } | 340 | } |
258 | 341 | ||
259 | return null; | 342 | return null; |
260 | } | 343 | } |
344 | |||
345 | public void SetOldData(byte[] d) | ||
346 | { | ||
347 | m_oldData = d; | ||
348 | } | ||
349 | |||
350 | private Dictionary<int,UUID> ExtractTexturesFromOldData() | ||
351 | { | ||
352 | Dictionary<int,UUID> result = new Dictionary<int,UUID>(); | ||
353 | if (m_oldData == null) | ||
354 | return result; | ||
355 | |||
356 | string content = System.Text.Encoding.ASCII.GetString(m_oldData); | ||
357 | string[] lines = content.Split(new char[] {'\n'}); | ||
358 | |||
359 | int textures = 0; | ||
360 | |||
361 | foreach (string line in lines) | ||
362 | { | ||
363 | try | ||
364 | { | ||
365 | if (line.StartsWith("textures ")) | ||
366 | { | ||
367 | textures = Convert.ToInt32(line.Substring(9)); | ||
368 | } | ||
369 | else if (textures > 0) | ||
370 | { | ||
371 | string[] parts = line.Split(new char[] {' '}); | ||
372 | |||
373 | UUID tx = new UUID(parts[1]); | ||
374 | int id = Convert.ToInt32(parts[0]); | ||
375 | result[id] = tx; | ||
376 | textures--; | ||
377 | } | ||
378 | } | ||
379 | catch | ||
380 | { | ||
381 | // If it's malformed, skip it | ||
382 | } | ||
383 | } | ||
384 | |||
385 | return result; | ||
386 | } | ||
261 | } | 387 | } |
262 | } | 388 | } |
389 | |||
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 360a014..25d4f21 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; |
@@ -228,15 +229,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
228 | public UUID RezSingleAttachmentFromInventory( | 229 | public UUID RezSingleAttachmentFromInventory( |
229 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) | 230 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) |
230 | { | 231 | { |
231 | m_log.DebugFormat( | 232 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null); |
232 | "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", | 233 | } |
233 | (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); | 234 | |
234 | 235 | public UUID RezSingleAttachmentFromInventory( | |
236 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) | ||
237 | { | ||
235 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should | 238 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should |
236 | // be removed when that functionality is implemented in opensim | 239 | // be removed when that functionality is implemented in opensim |
237 | AttachmentPt &= 0x7f; | 240 | AttachmentPt &= 0x7f; |
238 | 241 | ||
239 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); | 242 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); |
240 | 243 | ||
241 | if (updateInventoryStatus) | 244 | if (updateInventoryStatus) |
242 | { | 245 | { |
@@ -253,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
253 | } | 256 | } |
254 | 257 | ||
255 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 258 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
256 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 259 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) |
257 | { | 260 | { |
258 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 261 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
259 | if (invAccess != null) | 262 | if (invAccess != null) |
@@ -291,13 +294,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
291 | if (tainted) | 294 | if (tainted) |
292 | objatt.HasGroupChanged = true; | 295 | objatt.HasGroupChanged = true; |
293 | 296 | ||
297 | if (doc != null) | ||
298 | { | ||
299 | objatt.LoadScriptState(doc); | ||
300 | objatt.ResetOwnerChangeFlag(); | ||
301 | } | ||
302 | |||
294 | // Fire after attach, so we don't get messy perms dialogs | 303 | // Fire after attach, so we don't get messy perms dialogs |
295 | // 4 == AttachedRez | 304 | // 4 == AttachedRez |
296 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | 305 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); |
297 | objatt.ResumeScripts(); | 306 | objatt.ResumeScripts(); |
298 | 307 | ||
299 | // Do this last so that event listeners have access to all the effects of the attachment | 308 | // Do this last so that event listeners have access to all the effects of the attachment |
300 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); | 309 | //m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); |
301 | } | 310 | } |
302 | else | 311 | else |
303 | { | 312 | { |
@@ -334,9 +343,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
334 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 343 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
335 | { | 344 | { |
336 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 345 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
337 | item = m_scene.InventoryService.GetItem(item); | 346 | if (m_scene.InventoryService != null) |
347 | item = m_scene.InventoryService.GetItem(item); | ||
338 | 348 | ||
339 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | 349 | if (presence.Appearance != null) |
350 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | ||
340 | } | 351 | } |
341 | 352 | ||
342 | return att.UUID; | 353 | return att.UUID; |
@@ -379,6 +390,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
379 | { | 390 | { |
380 | // XXYY!! | 391 | // XXYY!! |
381 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 392 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
393 | if (item == null) | ||
394 | m_log.Error("[ATTACHMENT]: item == null"); | ||
395 | if (m_scene == null) | ||
396 | m_log.Error("[ATTACHMENT]: m_scene == null"); | ||
397 | if (m_scene.InventoryService == null) | ||
398 | m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null"); | ||
382 | item = m_scene.InventoryService.GetItem(item); | 399 | item = m_scene.InventoryService.GetItem(item); |
383 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); | 400 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); |
384 | 401 | ||
@@ -467,6 +484,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
467 | if (group.GetFromItemID() == itemID) | 484 | if (group.GetFromItemID() == itemID) |
468 | { | 485 | { |
469 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 486 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
487 | // CM / XMREngine!!!! Needed to conclude attach event | ||
488 | //SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
470 | group.DetachToInventoryPrep(); | 489 | group.DetachToInventoryPrep(); |
471 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | 490 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); |
472 | 491 | ||
@@ -484,22 +503,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
484 | } | 503 | } |
485 | } | 504 | } |
486 | 505 | ||
487 | public void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos) | ||
488 | { | ||
489 | // First we save the | ||
490 | // attachment point information, then we update the relative | ||
491 | // positioning. Then we have to mark the object as NOT an | ||
492 | // attachment. This is necessary in order to correctly save | ||
493 | // and retrieve GroupPosition information for the attachment. | ||
494 | // Finally, we restore the object's attachment status. | ||
495 | byte attachmentPoint = sog.GetAttachmentPoint(); | ||
496 | sog.UpdateGroupPosition(pos); | ||
497 | sog.RootPart.IsAttachment = false; | ||
498 | sog.AbsolutePosition = sog.RootPart.AttachedPos; | ||
499 | sog.SetAttachmentPoint(attachmentPoint); | ||
500 | sog.HasGroupChanged = true; | ||
501 | } | ||
502 | |||
503 | /// <summary> | 506 | /// <summary> |
504 | /// Update the attachment asset for the new sog details if they have changed. | 507 | /// Update the attachment asset for the new sog details if they have changed. |
505 | /// </summary> | 508 | /// </summary> |
@@ -603,15 +606,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
603 | 606 | ||
604 | if (!silent) | 607 | if (!silent) |
605 | { | 608 | { |
606 | // Killing it here will cause the client to deselect it | ||
607 | // It then reappears on the avatar, deselected | ||
608 | // through the full update below | ||
609 | // | ||
610 | if (so.IsSelected) | ||
611 | { | ||
612 | m_scene.SendKillObject(so.RootPart.LocalId); | ||
613 | } | ||
614 | |||
615 | so.IsSelected = false; // fudge.... | 609 | so.IsSelected = false; // fudge.... |
616 | so.ScheduleGroupForFullUpdate(); | 610 | so.ScheduleGroupForFullUpdate(); |
617 | } | 611 | } |
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 2b3d2a9..a514a83 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | |||
@@ -239,4 +239,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
239 | return result; | 239 | return result; |
240 | } | 240 | } |
241 | } | 241 | } |
242 | } \ No newline at end of file | 242 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index b3f0a25..613a054 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -273,7 +273,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
273 | 273 | ||
274 | // Inform the friends that this user is online | 274 | // Inform the friends that this user is online |
275 | StatusChange(agentID, true); | 275 | StatusChange(agentID, true); |
276 | 276 | ||
277 | // Register that we need to send the list of online friends to this user | 277 | // Register that we need to send the list of online friends to this user |
278 | lock (m_NeedsListOfFriends) | 278 | lock (m_NeedsListOfFriends) |
279 | m_NeedsListOfFriends.Add(agentID); | 279 | m_NeedsListOfFriends.Add(agentID); |
@@ -516,6 +516,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
516 | FriendsService.StoreFriend(agentID, friendID.ToString(), 1); | 516 | FriendsService.StoreFriend(agentID, friendID.ToString(), 1); |
517 | FriendsService.StoreFriend(friendID, agentID.ToString(), 1); | 517 | FriendsService.StoreFriend(friendID, agentID.ToString(), 1); |
518 | 518 | ||
519 | ICallingCardModule ccm = client.Scene.RequestModuleInterface<ICallingCardModule>(); | ||
520 | if (ccm != null) | ||
521 | { | ||
522 | ccm.CreateCallingCard(agentID, friendID, UUID.Zero); | ||
523 | } | ||
524 | |||
519 | // Update the local cache | 525 | // Update the local cache |
520 | UpdateFriendsCache(agentID); | 526 | UpdateFriendsCache(agentID); |
521 | 527 | ||
@@ -679,6 +685,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
679 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); | 685 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); |
680 | friendClient.SendInstantMessage(im); | 686 | friendClient.SendInstantMessage(im); |
681 | 687 | ||
688 | ICallingCardModule ccm = friendClient.Scene.RequestModuleInterface<ICallingCardModule>(); | ||
689 | if (ccm != null) | ||
690 | { | ||
691 | ccm.CreateCallingCard(friendID, userID, UUID.Zero); | ||
692 | } | ||
693 | |||
694 | |||
682 | // Update the local cache | 695 | // Update the local cache |
683 | UpdateFriendsCache(friendID); | 696 | UpdateFriendsCache(friendID); |
684 | 697 | ||
@@ -701,7 +714,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
701 | // we're done | 714 | // we're done |
702 | return true; | 715 | return true; |
703 | } | 716 | } |
704 | 717 | ||
705 | return false; | 718 | return false; |
706 | } | 719 | } |
707 | 720 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index af39565..347708d 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | |||
@@ -156,6 +156,31 @@ 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 | im.timestamp = (uint)Util.ToUnixTime(dt); | ||
179 | |||
180 | // If client is null, this message comes from storage and IS offline | ||
181 | if (client != null) | ||
182 | im.offline = 0; | ||
183 | |||
159 | if (m_TransferModule != null) | 184 | if (m_TransferModule != null) |
160 | { | 185 | { |
161 | if (client != null) | 186 | if (client != null) |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index fdc48c6..80adc46 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -145,8 +145,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
145 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; | 145 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; |
146 | if (!user.IsChildAgent) | 146 | if (!user.IsChildAgent) |
147 | { | 147 | { |
148 | // Local message | 148 | // 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); | 149 | user.ControllingClient.SendInstantMessage(im); |
151 | 150 | ||
152 | // Message sent | 151 | // Message sent |
@@ -168,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
168 | // Local message | 167 | // Local message |
169 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; | 168 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; |
170 | 169 | ||
171 | m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); | 170 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); |
172 | user.ControllingClient.SendInstantMessage(im); | 171 | user.ControllingClient.SendInstantMessage(im); |
173 | 172 | ||
174 | // Message sent | 173 | // Message sent |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index fdfcd10..164ae50 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -172,13 +172,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
172 | 172 | ||
173 | private void RetrieveInstantMessages(IClientAPI client) | 173 | private void RetrieveInstantMessages(IClientAPI client) |
174 | { | 174 | { |
175 | if (m_RestURL != "") | 175 | if (m_RestURL == String.Empty) |
176 | { | 176 | return; |
177 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); | ||
178 | 177 | ||
179 | List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( | 178 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); |
179 | |||
180 | List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( | ||
180 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); | 181 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); |
181 | 182 | ||
183 | if (msglist != null) | ||
184 | { | ||
182 | foreach (GridInstantMessage im in msglist) | 185 | foreach (GridInstantMessage im in msglist) |
183 | { | 186 | { |
184 | // client.SendInstantMessage(im); | 187 | // client.SendInstantMessage(im); |
@@ -189,6 +192,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
189 | // Needed for proper state management for stored group | 192 | // Needed for proper state management for stored group |
190 | // invitations | 193 | // invitations |
191 | // | 194 | // |
195 | |||
196 | im.offline = 1; | ||
197 | |||
192 | Scene s = FindScene(client.AgentId); | 198 | Scene s = FindScene(client.AgentId); |
193 | if (s != null) | 199 | if (s != null) |
194 | s.EventManager.TriggerIncomingInstantMessage(im); | 200 | s.EventManager.TriggerIncomingInstantMessage(im); |
@@ -198,26 +204,38 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
198 | 204 | ||
199 | private void UndeliveredMessage(GridInstantMessage im) | 205 | private void UndeliveredMessage(GridInstantMessage im) |
200 | { | 206 | { |
201 | if ((im.offline != 0) | 207 | if (im.dialog != (byte)InstantMessageDialog.MessageFromObject && |
202 | && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) | 208 | im.dialog != (byte)InstantMessageDialog.MessageFromAgent && |
209 | im.dialog != (byte)InstantMessageDialog.GroupNotice && | ||
210 | im.dialog != (byte)InstantMessageDialog.GroupInvitation && | ||
211 | im.dialog != (byte)InstantMessageDialog.InventoryOffered) | ||
203 | { | 212 | { |
204 | bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( | 213 | return; |
205 | "POST", m_RestURL+"/SaveMessage/", im); | 214 | } |
206 | 215 | ||
207 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) | 216 | // It's not delivered. Make sure the scope id is saved |
208 | { | 217 | // We don't need the imSessionID here anymore, overwrite it |
209 | IClientAPI client = FindClient(new UUID(im.fromAgentID)); | 218 | Scene scene = FindScene(new UUID(im.fromAgentID)); |
210 | if (client == null) | 219 | if (scene == null) |
211 | return; | 220 | scene = m_SceneList[0]; |
212 | 221 | ||
213 | client.SendInstantMessage(new GridInstantMessage( | 222 | bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( |
214 | null, new UUID(im.toAgentID), | 223 | "POST", m_RestURL+"/SaveMessage/?scope=" + |
215 | "System", new UUID(im.fromAgentID), | 224 | scene.RegionInfo.ScopeID.ToString(), im); |
216 | (byte)InstantMessageDialog.MessageFromAgent, | 225 | |
217 | "User is not logged in. "+ | 226 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) |
218 | (success ? "Message saved." : "Message not saved"), | 227 | { |
219 | false, new Vector3())); | 228 | IClientAPI client = FindClient(new UUID(im.fromAgentID)); |
220 | } | 229 | if (client == null) |
230 | return; | ||
231 | |||
232 | client.SendInstantMessage(new GridInstantMessage( | ||
233 | null, new UUID(im.toAgentID), | ||
234 | "System", new UUID(im.fromAgentID), | ||
235 | (byte)InstantMessageDialog.MessageFromAgent, | ||
236 | "User is not logged in. "+ | ||
237 | (success ? "Message saved." : "Message not saved"), | ||
238 | false, new Vector3())); | ||
221 | } | 239 | } |
222 | } | 240 | } |
223 | } | 241 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index e3d4969..528bc8d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -175,8 +175,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
175 | if (im.binaryBucket.Length < 17) // Invalid | 175 | if (im.binaryBucket.Length < 17) // Invalid |
176 | return; | 176 | return; |
177 | 177 | ||
178 | UUID receipientID = new UUID(im.toAgentID); | 178 | UUID recipientID = new UUID(im.toAgentID); |
179 | ScenePresence user = scene.GetScenePresence(receipientID); | 179 | ScenePresence user = scene.GetScenePresence(recipientID); |
180 | UUID copyID; | 180 | UUID copyID; |
181 | 181 | ||
182 | // First byte is the asset type | 182 | // First byte is the asset type |
@@ -191,7 +191,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
191 | folderID, new UUID(im.toAgentID)); | 191 | folderID, new UUID(im.toAgentID)); |
192 | 192 | ||
193 | InventoryFolderBase folderCopy | 193 | InventoryFolderBase folderCopy |
194 | = scene.GiveInventoryFolder(receipientID, client.AgentId, folderID, UUID.Zero); | 194 | = scene.GiveInventoryFolder(recipientID, client.AgentId, folderID, UUID.Zero); |
195 | 195 | ||
196 | if (folderCopy == null) | 196 | if (folderCopy == null) |
197 | { | 197 | { |
@@ -248,6 +248,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
248 | im.imSessionID = itemID.Guid; | 248 | im.imSessionID = itemID.Guid; |
249 | } | 249 | } |
250 | 250 | ||
251 | im.offline = 1; // Remember these | ||
252 | |||
251 | // Send the IM to the recipient. The item is already | 253 | // Send the IM to the recipient. The item is already |
252 | // in their inventory, so it will not be lost if | 254 | // in their inventory, so it will not be lost if |
253 | // they are offline. | 255 | // they are offline. |
@@ -417,22 +419,67 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
417 | /// | 419 | /// |
418 | /// </summary> | 420 | /// </summary> |
419 | /// <param name="msg"></param> | 421 | /// <param name="msg"></param> |
420 | private void OnGridInstantMessage(GridInstantMessage msg) | 422 | private void OnGridInstantMessage(GridInstantMessage im) |
421 | { | 423 | { |
422 | // Check if this is ours to handle | 424 | // Check if this is ours to handle |
423 | // | 425 | // |
424 | Scene scene = FindClientScene(new UUID(msg.toAgentID)); | 426 | Scene scene = FindClientScene(new UUID(im.toAgentID)); |
425 | 427 | ||
426 | if (scene == null) | 428 | if (scene == null) |
427 | return; | 429 | return; |
428 | 430 | ||
429 | // Find agent to deliver to | 431 | // Find agent to deliver to |
430 | // | 432 | // |
431 | ScenePresence user = scene.GetScenePresence(new UUID(msg.toAgentID)); | 433 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); |
434 | if (user == null) | ||
435 | return; | ||
436 | |||
437 | // This requires a little bit of processing because we have to make the | ||
438 | // new item visible in the recipient's inventory here | ||
439 | // | ||
440 | if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) | ||
441 | { | ||
442 | if (im.binaryBucket.Length < 17) // Invalid | ||
443 | return; | ||
444 | |||
445 | UUID recipientID = new UUID(im.toAgentID); | ||
446 | |||
447 | // First byte is the asset type | ||
448 | AssetType assetType = (AssetType)im.binaryBucket[0]; | ||
449 | |||
450 | if (AssetType.Folder == assetType) | ||
451 | { | ||
452 | UUID folderID = new UUID(im.binaryBucket, 1); | ||
453 | |||
454 | InventoryFolderBase given = | ||
455 | new InventoryFolderBase(folderID, recipientID); | ||
456 | InventoryFolderBase folder = | ||
457 | scene.InventoryService.GetFolder(given); | ||
458 | |||
459 | if (folder != null) | ||
460 | user.ControllingClient.SendBulkUpdateInventory(folder); | ||
461 | } | ||
462 | else | ||
463 | { | ||
464 | UUID itemID = new UUID(im.binaryBucket, 1); | ||
432 | 465 | ||
433 | // Just forward to local handling | 466 | InventoryItemBase given = |
434 | OnInstantMessage(user.ControllingClient, msg); | 467 | new InventoryItemBase(itemID, recipientID); |
468 | InventoryItemBase item = | ||
469 | scene.InventoryService.GetItem(given); | ||
435 | 470 | ||
471 | if (item != null) | ||
472 | { | ||
473 | user.ControllingClient.SendBulkUpdateInventory(item); | ||
474 | } | ||
475 | } | ||
476 | user.ControllingClient.SendInstantMessage(im); | ||
477 | } | ||
478 | else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted || | ||
479 | im.dialog == (byte) InstantMessageDialog.InventoryDeclined) | ||
480 | { | ||
481 | user.ControllingClient.SendInstantMessage(im); | ||
482 | } | ||
436 | } | 483 | } |
437 | } | 484 | } |
438 | } | 485 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index d1d7df2..6532bbb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | |||
@@ -148,14 +148,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
148 | (uint)presence.AbsolutePosition.Y, | 148 | (uint)presence.AbsolutePosition.Y, |
149 | (uint)presence.AbsolutePosition.Z); | 149 | (uint)presence.AbsolutePosition.Z); |
150 | 150 | ||
151 | m_log.DebugFormat("TP invite with message {0}", message); | 151 | m_log.DebugFormat("[LURE]: TP invite with message {0}", message); |
152 | 152 | ||
153 | GridInstantMessage m = new GridInstantMessage(scene, client.AgentId, | 153 | GridInstantMessage m; |
154 | client.FirstName+" "+client.LastName, targetid, | 154 | |
155 | (byte)InstantMessageDialog.RequestTeleport, false, | 155 | if (scene.Permissions.IsAdministrator(client.AgentId) && presence.GodLevel >= 200 && (!scene.Permissions.IsAdministrator(targetid))) |
156 | message, dest, false, presence.AbsolutePosition, | 156 | { |
157 | new Byte[0]); | 157 | m = new GridInstantMessage(scene, client.AgentId, |
158 | 158 | client.FirstName+" "+client.LastName, targetid, | |
159 | (byte)InstantMessageDialog.GodLikeRequestTeleport, false, | ||
160 | message, dest, false, presence.AbsolutePosition, | ||
161 | new Byte[0]); | ||
162 | } | ||
163 | else | ||
164 | { | ||
165 | m = new GridInstantMessage(scene, client.AgentId, | ||
166 | client.FirstName+" "+client.LastName, targetid, | ||
167 | (byte)InstantMessageDialog.RequestTeleport, false, | ||
168 | message, dest, false, presence.AbsolutePosition, | ||
169 | new Byte[0]); | ||
170 | } | ||
171 | |||
159 | if (m_TransferModule != null) | 172 | if (m_TransferModule != null) |
160 | { | 173 | { |
161 | m_TransferModule.SendInstantMessage(m, | 174 | m_TransferModule.SendInstantMessage(m, |
@@ -190,7 +203,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
190 | { | 203 | { |
191 | // Forward remote teleport requests | 204 | // Forward remote teleport requests |
192 | // | 205 | // |
193 | if (msg.dialog != 22) | 206 | if (msg.dialog != (byte)InstantMessageDialog.RequestTeleport && |
207 | msg.dialog != (byte)InstantMessageDialog.GodLikeRequestTeleport) | ||
194 | return; | 208 | return; |
195 | 209 | ||
196 | if (m_TransferModule != null) | 210 | if (m_TransferModule != null) |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index a3251aa..0c59ba1 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
99 | 99 | ||
100 | protected virtual void OnNewClient(IClientAPI client) | 100 | protected virtual void OnNewClient(IClientAPI client) |
101 | { | 101 | { |
102 | client.OnTeleportHomeRequest += TeleportHome; | 102 | client.OnTeleportHomeRequest += TeleportHomeFired; |
103 | } | 103 | } |
104 | 104 | ||
105 | public virtual void Close() | 105 | public virtual void Close() |
@@ -268,7 +268,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
268 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | 268 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, |
269 | // it's actually doing a lot of work. | 269 | // it's actually doing a lot of work. |
270 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; | 270 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; |
271 | if (endPoint.Address != null) | 271 | if (endPoint != null && endPoint.Address != null) |
272 | { | 272 | { |
273 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 273 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
274 | // both regions | 274 | // both regions |
@@ -505,7 +505,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
505 | 505 | ||
506 | protected void KillEntity(Scene scene, uint localID) | 506 | protected void KillEntity(Scene scene, uint localID) |
507 | { | 507 | { |
508 | scene.SendKillObject(localID); | 508 | scene.SendKillObject(new List<uint>() { localID }); |
509 | } | 509 | } |
510 | 510 | ||
511 | protected virtual GridRegion GetFinalDestination(GridRegion region) | 511 | protected virtual GridRegion GetFinalDestination(GridRegion region) |
@@ -543,7 +543,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
543 | 543 | ||
544 | #region Teleport Home | 544 | #region Teleport Home |
545 | 545 | ||
546 | public virtual void TeleportHome(UUID id, IClientAPI client) | 546 | public void TeleportHomeFired(UUID id, IClientAPI client) |
547 | { | ||
548 | TeleportHome(id, client); | ||
549 | } | ||
550 | |||
551 | public virtual bool TeleportHome(UUID id, IClientAPI client) | ||
547 | { | 552 | { |
548 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 553 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
549 | 554 | ||
@@ -552,12 +557,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
552 | 557 | ||
553 | if (uinfo != null) | 558 | if (uinfo != null) |
554 | { | 559 | { |
560 | if (uinfo.HomeRegionID == UUID.Zero) | ||
561 | { | ||
562 | // can't find the Home region: Tell viewer and abort | ||
563 | client.SendTeleportFailed("You don't have a home position set."); | ||
564 | return false; | ||
565 | } | ||
555 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); | 566 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); |
556 | if (regionInfo == null) | 567 | if (regionInfo == null) |
557 | { | 568 | { |
558 | // can't find the Home region: Tell viewer and abort | 569 | // can't find the Home region: Tell viewer and abort |
559 | client.SendTeleportFailed("Your home region could not be found."); | 570 | client.SendTeleportFailed("Your home region could not be found."); |
560 | return; | 571 | return false; |
561 | } | 572 | } |
562 | 573 | ||
563 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", | 574 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", |
@@ -568,6 +579,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
568 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, | 579 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, |
569 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); | 580 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); |
570 | } | 581 | } |
582 | else | ||
583 | { | ||
584 | // can't find the Home region: Tell viewer and abort | ||
585 | client.SendTeleportFailed("Your home region could not be found."); | ||
586 | return false; | ||
587 | } | ||
588 | return true; | ||
571 | } | 589 | } |
572 | 590 | ||
573 | #endregion | 591 | #endregion |
@@ -852,15 +870,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
852 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | 870 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); |
853 | 871 | ||
854 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | 872 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); |
855 | if (eq != null) | 873 | IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint; |
874 | if (neighbourExternal != null) | ||
856 | { | 875 | { |
857 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | 876 | if (eq != null) |
858 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | 877 | { |
859 | } | 878 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, |
860 | else | 879 | capsPath, agent.UUID, agent.ControllingClient.SessionId); |
861 | { | 880 | } |
862 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | 881 | else |
863 | capsPath); | 882 | { |
883 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
884 | capsPath); | ||
885 | } | ||
864 | } | 886 | } |
865 | 887 | ||
866 | if (!WaitForCallback(agent.UUID)) | 888 | if (!WaitForCallback(agent.UUID)) |
@@ -964,10 +986,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
964 | agent.Id0 = currentAgentCircuit.Id0; | 986 | agent.Id0 = currentAgentCircuit.Id0; |
965 | } | 987 | } |
966 | 988 | ||
967 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 989 | IPEndPoint external = region.ExternalEndPoint; |
968 | d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true, | 990 | if (external != null) |
991 | { | ||
992 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
993 | d.BeginInvoke(sp, agent, region, external, true, | ||
969 | InformClientOfNeighbourCompleted, | 994 | InformClientOfNeighbourCompleted, |
970 | d); | 995 | d); |
996 | } | ||
971 | } | 997 | } |
972 | #endregion | 998 | #endregion |
973 | 999 | ||
@@ -1100,6 +1126,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1100 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1126 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; |
1101 | try | 1127 | try |
1102 | { | 1128 | { |
1129 | //neighbour.ExternalEndPoint may return null, which will be caught | ||
1103 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, | 1130 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, |
1104 | InformClientOfNeighbourCompleted, | 1131 | InformClientOfNeighbourCompleted, |
1105 | d); | 1132 | d); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 35dcd95..c75bc0a 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
86 | 86 | ||
87 | protected override void OnNewClient(IClientAPI client) | 87 | protected override void OnNewClient(IClientAPI client) |
88 | { | 88 | { |
89 | client.OnTeleportHomeRequest += TeleportHome; | 89 | client.OnTeleportHomeRequest += TeleportHomeFired; |
90 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); | 90 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); |
91 | } | 91 | } |
92 | 92 | ||
@@ -177,7 +177,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
177 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | 177 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); |
178 | } | 178 | } |
179 | 179 | ||
180 | public override void TeleportHome(UUID id, IClientAPI client) | 180 | public void TeleportHomeFired(UUID id, IClientAPI client) |
181 | { | ||
182 | TeleportHome(id, client); | ||
183 | } | ||
184 | |||
185 | public override bool TeleportHome(UUID id, IClientAPI client) | ||
181 | { | 186 | { |
182 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 187 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
183 | 188 | ||
@@ -187,8 +192,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
187 | { | 192 | { |
188 | // local grid user | 193 | // local grid user |
189 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); | 194 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); |
190 | base.TeleportHome(id, client); | 195 | return base.TeleportHome(id, client); |
191 | return; | ||
192 | } | 196 | } |
193 | 197 | ||
194 | // Foreign user wants to go home | 198 | // Foreign user wants to go home |
@@ -198,7 +202,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
198 | { | 202 | { |
199 | client.SendTeleportFailed("Your information has been lost"); | 203 | client.SendTeleportFailed("Your information has been lost"); |
200 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); | 204 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); |
201 | return; | 205 | return false; |
202 | } | 206 | } |
203 | 207 | ||
204 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); | 208 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); |
@@ -208,7 +212,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
208 | { | 212 | { |
209 | client.SendTeleportFailed("Your home region could not be found"); | 213 | client.SendTeleportFailed("Your home region could not be found"); |
210 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); | 214 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); |
211 | return; | 215 | return false; |
212 | } | 216 | } |
213 | 217 | ||
214 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); | 218 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); |
@@ -216,7 +220,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
216 | { | 220 | { |
217 | client.SendTeleportFailed("Internal error"); | 221 | client.SendTeleportFailed("Internal error"); |
218 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); | 222 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); |
219 | return; | 223 | return false; |
220 | } | 224 | } |
221 | 225 | ||
222 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | 226 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); |
@@ -226,6 +230,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
226 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); | 230 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); |
227 | 231 | ||
228 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); | 232 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); |
233 | return true; | ||
229 | } | 234 | } |
230 | #endregion | 235 | #endregion |
231 | 236 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 1ebccd1..623cd3a 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Xml; | ||
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using System.Threading; | 33 | using System.Threading; |
33 | 34 | ||
@@ -202,11 +203,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
202 | public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, | 203 | public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, |
203 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient) | 204 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient) |
204 | { | 205 | { |
205 | // HACK: This is only working for lists containing a single item! | ||
206 | // It's just a hack to make this WIP compile and run. Nothing | ||
207 | // currently calls this with multiple items. | ||
208 | UUID ret = UUID.Zero; | 206 | UUID ret = UUID.Zero; |
209 | 207 | ||
208 | // The following code groups the SOG's by owner. No objects | ||
209 | // belonging to different people can be coalesced, for obvious | ||
210 | // reasons. | ||
210 | Dictionary<UUID, List<SceneObjectGroup>> deletes = | 211 | Dictionary<UUID, List<SceneObjectGroup>> deletes = |
211 | new Dictionary<UUID, List<SceneObjectGroup>>(); | 212 | new Dictionary<UUID, List<SceneObjectGroup>>(); |
212 | 213 | ||
@@ -218,265 +219,340 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
218 | deletes[g.OwnerID].Add(g); | 219 | deletes[g.OwnerID].Add(g); |
219 | } | 220 | } |
220 | 221 | ||
222 | // This is pethod scoped and will be returned. It will be the | ||
223 | // last created asset id | ||
224 | UUID assetID = UUID.Zero; | ||
225 | |||
226 | // Each iteration is really a separate asset being created, | ||
227 | // with distinct destinations as well. | ||
221 | foreach (List<SceneObjectGroup> objlist in deletes.Values) | 228 | foreach (List<SceneObjectGroup> objlist in deletes.Values) |
222 | { | 229 | { |
223 | foreach (SceneObjectGroup g in objlist) | 230 | Dictionary<UUID, string> xmlStrings = |
224 | ret = DeleteToInventory(action, folderID, g, remoteClient); | 231 | new Dictionary<UUID, string>(); |
225 | } | ||
226 | |||
227 | return ret; | ||
228 | } | ||
229 | 232 | ||
230 | private UUID DeleteToInventory(DeRezAction action, UUID folderID, | 233 | foreach (SceneObjectGroup objectGroup in objlist) |
231 | SceneObjectGroup objectGroup, IClientAPI remoteClient) | 234 | { |
232 | { | 235 | Vector3 inventoryStoredPosition = new Vector3 |
233 | UUID assetID = UUID.Zero; | 236 | (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) |
237 | ? 250 | ||
238 | : objectGroup.AbsolutePosition.X) | ||
239 | , | ||
240 | (objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | ||
241 | ? 250 | ||
242 | : objectGroup.AbsolutePosition.X, | ||
243 | objectGroup.AbsolutePosition.Z); | ||
234 | 244 | ||
235 | Vector3 inventoryStoredPosition = new Vector3 | 245 | Vector3 originalPosition = objectGroup.AbsolutePosition; |
236 | (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | ||
237 | ? 250 | ||
238 | : objectGroup.AbsolutePosition.X) | ||
239 | , | ||
240 | (objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | ||
241 | ? 250 | ||
242 | : objectGroup.AbsolutePosition.X, | ||
243 | objectGroup.AbsolutePosition.Z); | ||
244 | 246 | ||
245 | Vector3 originalPosition = objectGroup.AbsolutePosition; | 247 | // Restore attachment data after trip through the sim |
248 | if (objectGroup.RootPart.AttachPoint > 0) | ||
249 | inventoryStoredPosition = objectGroup.RootPart.AttachOffset; | ||
250 | objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint; | ||
246 | 251 | ||
247 | objectGroup.AbsolutePosition = inventoryStoredPosition; | 252 | objectGroup.AbsolutePosition = inventoryStoredPosition; |
248 | 253 | ||
249 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); | 254 | // Make sure all bits but the ones we want are clear |
255 | // on take. | ||
256 | // This will be applied to the current perms, so | ||
257 | // it will do what we want. | ||
258 | objectGroup.RootPart.NextOwnerMask &= | ||
259 | ((uint)PermissionMask.Copy | | ||
260 | (uint)PermissionMask.Transfer | | ||
261 | (uint)PermissionMask.Modify); | ||
262 | objectGroup.RootPart.NextOwnerMask |= | ||
263 | (uint)PermissionMask.Move; | ||
250 | 264 | ||
251 | objectGroup.AbsolutePosition = originalPosition; | 265 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); |
252 | 266 | ||
253 | // Get the user info of the item destination | 267 | objectGroup.AbsolutePosition = originalPosition; |
254 | // | ||
255 | UUID userID = UUID.Zero; | ||
256 | 268 | ||
257 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || | 269 | xmlStrings[objectGroup.UUID] = sceneObjectXml; |
258 | action == DeRezAction.SaveToExistingUserInventoryItem) | 270 | } |
259 | { | ||
260 | // Take or take copy require a taker | ||
261 | // Saving changes requires a local user | ||
262 | // | ||
263 | if (remoteClient == null) | ||
264 | return UUID.Zero; | ||
265 | 271 | ||
266 | userID = remoteClient.AgentId; | 272 | string itemXml; |
267 | } | ||
268 | else | ||
269 | { | ||
270 | // All returns / deletes go to the object owner | ||
271 | // | ||
272 | 273 | ||
273 | userID = objectGroup.RootPart.OwnerID; | 274 | if (objlist.Count > 1) |
274 | } | 275 | { |
276 | float minX, minY, minZ; | ||
277 | float maxX, maxY, maxZ; | ||
275 | 278 | ||
276 | if (userID == UUID.Zero) // Can't proceed | 279 | Vector3[] offsets = m_Scene.GetCombinedBoundingBox(objlist, |
277 | { | 280 | out minX, out maxX, out minY, out maxY, |
278 | return UUID.Zero; | 281 | out minZ, out maxZ); |
279 | } | ||
280 | 282 | ||
281 | // If we're returning someone's item, it goes back to the | 283 | // CreateWrapper |
282 | // owner's Lost And Found folder. | 284 | XmlDocument itemDoc = new XmlDocument(); |
283 | // Delete is treated like return in this case | 285 | XmlElement root = itemDoc.CreateElement("", "CoalescedObject", ""); |
284 | // Deleting your own items makes them go to trash | 286 | itemDoc.AppendChild(root); |
285 | // | ||
286 | 287 | ||
287 | InventoryFolderBase folder = null; | 288 | // Embed the offsets into the group XML |
288 | InventoryItemBase item = null; | 289 | for ( int i = 0 ; i < objlist.Count ; i++ ) |
290 | { | ||
291 | XmlDocument doc = new XmlDocument(); | ||
292 | SceneObjectGroup g = objlist[i]; | ||
293 | doc.LoadXml(xmlStrings[g.UUID]); | ||
294 | XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup"); | ||
295 | e.SetAttribute("offsetx", offsets[i].X.ToString()); | ||
296 | e.SetAttribute("offsety", offsets[i].Y.ToString()); | ||
297 | e.SetAttribute("offsetz", offsets[i].Z.ToString()); | ||
298 | |||
299 | XmlNode objectNode = itemDoc.ImportNode(e, true); | ||
300 | root.AppendChild(objectNode); | ||
301 | } | ||
289 | 302 | ||
290 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | 303 | float sizeX = maxX - minX; |
291 | { | 304 | float sizeY = maxY - minY; |
292 | item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID, userID); | 305 | float sizeZ = maxZ - minZ; |
293 | item = m_Scene.InventoryService.GetItem(item); | ||
294 | 306 | ||
295 | //item = userInfo.RootFolder.FindItem( | 307 | root.SetAttribute("x", sizeX.ToString()); |
296 | // objectGroup.RootPart.FromUserInventoryItemID); | 308 | root.SetAttribute("y", sizeY.ToString()); |
309 | root.SetAttribute("z", sizeZ.ToString()); | ||
297 | 310 | ||
298 | if (null == item) | 311 | itemXml = itemDoc.InnerXml; |
312 | } | ||
313 | else | ||
299 | { | 314 | { |
300 | m_log.DebugFormat( | 315 | itemXml = xmlStrings[objlist[0].UUID]; |
301 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | ||
302 | objectGroup.Name, objectGroup.UUID); | ||
303 | return UUID.Zero; | ||
304 | } | 316 | } |
305 | } | 317 | |
306 | else | 318 | // Get the user info of the item destination |
307 | { | ||
308 | // Folder magic | ||
309 | // | 319 | // |
310 | if (action == DeRezAction.Delete) | 320 | UUID userID = UUID.Zero; |
321 | |||
322 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || | ||
323 | action == DeRezAction.SaveToExistingUserInventoryItem) | ||
311 | { | 324 | { |
312 | // Deleting someone else's item | 325 | // Take or take copy require a taker |
326 | // Saving changes requires a local user | ||
313 | // | 327 | // |
314 | if (remoteClient == null || | 328 | if (remoteClient == null) |
315 | objectGroup.OwnerID != remoteClient.AgentId) | 329 | return UUID.Zero; |
316 | { | ||
317 | 330 | ||
318 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 331 | userID = remoteClient.AgentId; |
319 | } | ||
320 | else | ||
321 | { | ||
322 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
323 | } | ||
324 | } | 332 | } |
325 | else if (action == DeRezAction.Return) | 333 | else |
326 | { | 334 | { |
327 | 335 | // All returns / deletes go to the object owner | |
328 | // Dump to lost + found unconditionally | ||
329 | // | 336 | // |
330 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 337 | |
338 | userID = objlist[0].RootPart.OwnerID; | ||
331 | } | 339 | } |
332 | 340 | ||
333 | if (folderID == UUID.Zero && folder == null) | 341 | if (userID == UUID.Zero) // Can't proceed |
334 | { | 342 | { |
335 | if (action == DeRezAction.Delete) | 343 | return UUID.Zero; |
344 | } | ||
345 | |||
346 | // If we're returning someone's item, it goes back to the | ||
347 | // owner's Lost And Found folder. | ||
348 | // Delete is treated like return in this case | ||
349 | // Deleting your own items makes them go to trash | ||
350 | // | ||
351 | |||
352 | InventoryFolderBase folder = null; | ||
353 | InventoryItemBase item = null; | ||
354 | |||
355 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
356 | { | ||
357 | item = new InventoryItemBase(objlist[0].RootPart.FromUserInventoryItemID, userID); | ||
358 | item = m_Scene.InventoryService.GetItem(item); | ||
359 | |||
360 | //item = userInfo.RootFolder.FindItem( | ||
361 | // objectGroup.RootPart.FromUserInventoryItemID); | ||
362 | |||
363 | if (null == item) | ||
336 | { | 364 | { |
337 | // Deletes go to trash by default | 365 | m_log.DebugFormat( |
338 | // | 366 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", |
339 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | 367 | objlist[0].Name, objlist[0].UUID); |
368 | return UUID.Zero; | ||
340 | } | 369 | } |
341 | else | 370 | } |
371 | else | ||
372 | { | ||
373 | // Folder magic | ||
374 | // | ||
375 | if (action == DeRezAction.Delete) | ||
342 | { | 376 | { |
377 | // Deleting someone else's item | ||
378 | // | ||
343 | if (remoteClient == null || | 379 | if (remoteClient == null || |
344 | objectGroup.OwnerID != remoteClient.AgentId) | 380 | objlist[0].OwnerID != remoteClient.AgentId) |
345 | { | 381 | { |
346 | // Taking copy of another person's item. Take to | 382 | |
347 | // Objects folder. | 383 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
348 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); | ||
349 | } | 384 | } |
350 | else | 385 | else |
351 | { | 386 | { |
352 | // Catch all. Use lost & found | 387 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); |
388 | } | ||
389 | } | ||
390 | else if (action == DeRezAction.Return) | ||
391 | { | ||
392 | |||
393 | // Dump to lost + found unconditionally | ||
394 | // | ||
395 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
396 | } | ||
397 | |||
398 | if (folderID == UUID.Zero && folder == null) | ||
399 | { | ||
400 | if (action == DeRezAction.Delete) | ||
401 | { | ||
402 | // Deletes go to trash by default | ||
353 | // | 403 | // |
404 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
405 | } | ||
406 | else | ||
407 | { | ||
408 | if (remoteClient == null || | ||
409 | objlist[0].OwnerID != remoteClient.AgentId) | ||
410 | { | ||
411 | // Taking copy of another person's item. Take to | ||
412 | // Objects folder. | ||
413 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); | ||
414 | } | ||
415 | else | ||
416 | { | ||
417 | // Catch all. Use lost & found | ||
418 | // | ||
354 | 419 | ||
355 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 420 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
421 | } | ||
356 | } | 422 | } |
357 | } | 423 | } |
358 | } | ||
359 | 424 | ||
360 | // Override and put into where it came from, if it came | 425 | // Override and put into where it came from, if it came |
361 | // from anywhere in inventory | 426 | // from anywhere in inventory |
362 | // | 427 | // |
363 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) | 428 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) |
364 | { | ||
365 | if (objectGroup.RootPart.FromFolderID != UUID.Zero) | ||
366 | { | 429 | { |
367 | InventoryFolderBase f = new InventoryFolderBase(objectGroup.RootPart.FromFolderID, userID); | 430 | if (objlist[0].RootPart.FromFolderID != UUID.Zero && objlist[0].OwnerID == remoteClient.AgentId) |
368 | folder = m_Scene.InventoryService.GetFolder(f); | 431 | { |
432 | InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID); | ||
433 | folder = m_Scene.InventoryService.GetFolder(f); | ||
434 | } | ||
369 | } | 435 | } |
370 | } | ||
371 | 436 | ||
372 | if (folder == null) // None of the above | 437 | if (folder == null) // None of the above |
373 | { | 438 | { |
374 | folder = new InventoryFolderBase(folderID); | 439 | folder = new InventoryFolderBase(folderID); |
375 | 440 | ||
376 | if (folder == null) // Nowhere to put it | 441 | if (folder == null) // Nowhere to put it |
442 | { | ||
443 | return UUID.Zero; | ||
444 | } | ||
445 | } | ||
446 | |||
447 | item = new InventoryItemBase(); | ||
448 | // Can't know creator is the same, so null it in inventory | ||
449 | if (objlist.Count > 1) | ||
377 | { | 450 | { |
378 | return UUID.Zero; | 451 | item.CreatorId = UUID.Zero.ToString(); |
452 | item.CreatorData = String.Empty; | ||
453 | } | ||
454 | else | ||
455 | { | ||
456 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | ||
457 | item.CreatorData = objlist[0].RootPart.CreatorData; | ||
458 | } | ||
459 | item.ID = UUID.Random(); | ||
460 | item.InvType = (int)InventoryType.Object; | ||
461 | item.Folder = folder.ID; | ||
462 | item.Owner = userID; | ||
463 | if (objlist.Count > 1) | ||
464 | { | ||
465 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; | ||
466 | } | ||
467 | else | ||
468 | { | ||
469 | item.SaleType = objlist[0].RootPart.ObjectSaleType; | ||
470 | item.SalePrice = objlist[0].RootPart.SalePrice; | ||
379 | } | 471 | } |
380 | } | 472 | } |
381 | 473 | ||
382 | item = new InventoryItemBase(); | 474 | AssetBase asset = CreateAsset( |
383 | item.CreatorId = objectGroup.RootPart.CreatorID.ToString(); | 475 | objlist[0].GetPartName(objlist[0].RootPart.LocalId), |
384 | item.CreatorData = objectGroup.RootPart.CreatorData; | 476 | objlist[0].GetPartDescription(objlist[0].RootPart.LocalId), |
385 | item.ID = UUID.Random(); | 477 | (sbyte)AssetType.Object, |
386 | item.InvType = (int)InventoryType.Object; | 478 | Utils.StringToBytes(itemXml), |
387 | item.Folder = folder.ID; | 479 | objlist[0].OwnerID.ToString()); |
388 | item.Owner = userID; | 480 | m_Scene.AssetService.Store(asset); |
389 | } | 481 | assetID = asset.FullID; |
390 | |||
391 | AssetBase asset = CreateAsset( | ||
392 | objectGroup.GetPartName(objectGroup.RootPart.LocalId), | ||
393 | objectGroup.GetPartDescription(objectGroup.RootPart.LocalId), | ||
394 | (sbyte)AssetType.Object, | ||
395 | Utils.StringToBytes(sceneObjectXml), | ||
396 | objectGroup.OwnerID.ToString()); | ||
397 | m_Scene.AssetService.Store(asset); | ||
398 | assetID = asset.FullID; | ||
399 | |||
400 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
401 | { | ||
402 | item.AssetID = asset.FullID; | ||
403 | m_Scene.InventoryService.UpdateItem(item); | ||
404 | } | ||
405 | else | ||
406 | { | ||
407 | item.AssetID = asset.FullID; | ||
408 | 482 | ||
409 | if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 483 | if (DeRezAction.SaveToExistingUserInventoryItem == action) |
410 | { | 484 | { |
411 | uint perms = objectGroup.GetEffectivePermissions(); | 485 | item.AssetID = asset.FullID; |
412 | uint nextPerms = (perms & 7) << 13; | 486 | m_Scene.InventoryService.UpdateItem(item); |
413 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
414 | perms &= ~(uint)PermissionMask.Copy; | ||
415 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
416 | perms &= ~(uint)PermissionMask.Transfer; | ||
417 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
418 | perms &= ~(uint)PermissionMask.Modify; | ||
419 | |||
420 | // Make sure all bits but the ones we want are clear | ||
421 | // on take. | ||
422 | // This will be applied to the current perms, so | ||
423 | // it will do what we want. | ||
424 | objectGroup.RootPart.NextOwnerMask &= | ||
425 | ((uint)PermissionMask.Copy | | ||
426 | (uint)PermissionMask.Transfer | | ||
427 | (uint)PermissionMask.Modify); | ||
428 | objectGroup.RootPart.NextOwnerMask |= | ||
429 | (uint)PermissionMask.Move; | ||
430 | |||
431 | item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; | ||
432 | item.CurrentPermissions = item.BasePermissions; | ||
433 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
434 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; | ||
435 | item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask; | ||
436 | |||
437 | // Magic number badness. Maybe this deserves an enum. | ||
438 | // bit 4 (16) is the "Slam" bit, it means treat as passed | ||
439 | // and apply next owner perms on rez | ||
440 | item.CurrentPermissions |= 16; // Slam! | ||
441 | } | 487 | } |
442 | else | 488 | else |
443 | { | 489 | { |
444 | item.BasePermissions = objectGroup.GetEffectivePermissions(); | 490 | item.AssetID = asset.FullID; |
445 | item.CurrentPermissions = objectGroup.GetEffectivePermissions(); | ||
446 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
447 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; | ||
448 | item.GroupPermissions = objectGroup.RootPart.GroupMask; | ||
449 | 491 | ||
450 | item.CurrentPermissions &= | 492 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; |
451 | ((uint)PermissionMask.Copy | | 493 | foreach (SceneObjectGroup grp in objlist) |
452 | (uint)PermissionMask.Transfer | | 494 | effectivePerms &= grp.GetEffectivePermissions(); |
453 | (uint)PermissionMask.Modify | | 495 | effectivePerms |= (uint)PermissionMask.Move; |
454 | (uint)PermissionMask.Move | | ||
455 | 7); // Preserve folded permissions | ||
456 | } | ||
457 | 496 | ||
458 | // TODO: add the new fields (Flags, Sale info, etc) | 497 | if (remoteClient != null && (remoteClient.AgentId != objlist[0].RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
459 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 498 | { |
460 | item.Description = asset.Description; | 499 | uint perms = effectivePerms; |
461 | item.Name = asset.Name; | 500 | uint nextPerms = (perms & 7) << 13; |
462 | item.AssetType = asset.Type; | 501 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) |
502 | perms &= ~(uint)PermissionMask.Copy; | ||
503 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
504 | perms &= ~(uint)PermissionMask.Transfer; | ||
505 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
506 | perms &= ~(uint)PermissionMask.Modify; | ||
507 | |||
508 | item.BasePermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
509 | item.CurrentPermissions = item.BasePermissions; | ||
510 | item.NextPermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
511 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask; | ||
512 | item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask; | ||
513 | |||
514 | // Magic number badness. Maybe this deserves an enum. | ||
515 | // bit 4 (16) is the "Slam" bit, it means treat as passed | ||
516 | // and apply next owner perms on rez | ||
517 | item.CurrentPermissions |= 16; // Slam! | ||
518 | } | ||
519 | else | ||
520 | { | ||
521 | item.BasePermissions = effectivePerms; | ||
522 | item.CurrentPermissions = effectivePerms; | ||
523 | item.NextPermissions = objlist[0].RootPart.NextOwnerMask & effectivePerms; | ||
524 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & effectivePerms; | ||
525 | item.GroupPermissions = objlist[0].RootPart.GroupMask & effectivePerms; | ||
526 | |||
527 | item.CurrentPermissions &= | ||
528 | ((uint)PermissionMask.Copy | | ||
529 | (uint)PermissionMask.Transfer | | ||
530 | (uint)PermissionMask.Modify | | ||
531 | (uint)PermissionMask.Move | | ||
532 | 7); // Preserve folded permissions | ||
533 | } | ||
463 | 534 | ||
464 | m_Scene.AddInventoryItem(item); | 535 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
536 | item.Description = asset.Description; | ||
537 | item.Name = asset.Name; | ||
538 | item.AssetType = asset.Type; | ||
465 | 539 | ||
466 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | 540 | m_Scene.AddInventoryItem(item); |
467 | { | 541 | |
468 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | 542 | if (remoteClient != null && item.Owner == remoteClient.AgentId) |
469 | } | ||
470 | else | ||
471 | { | ||
472 | ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); | ||
473 | if (notifyUser != null) | ||
474 | { | 543 | { |
475 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | 544 | remoteClient.SendInventoryItemCreateUpdate(item, 0); |
545 | } | ||
546 | else | ||
547 | { | ||
548 | ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); | ||
549 | if (notifyUser != null) | ||
550 | { | ||
551 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | ||
552 | } | ||
476 | } | 553 | } |
477 | } | 554 | } |
478 | } | 555 | } |
479 | |||
480 | return assetID; | 556 | return assetID; |
481 | } | 557 | } |
482 | 558 | ||
@@ -527,8 +603,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
527 | 603 | ||
528 | if (item != null) | 604 | if (item != null) |
529 | { | 605 | { |
606 | if (item.ID == UUID.Zero) | ||
607 | { | ||
608 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 1"); | ||
609 | } | ||
610 | |||
530 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); | 611 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); |
531 | 612 | ||
613 | SceneObjectGroup group = null; | ||
614 | |||
532 | if (rezAsset != null) | 615 | if (rezAsset != null) |
533 | { | 616 | { |
534 | UUID itemId = UUID.Zero; | 617 | UUID itemId = UUID.Zero; |
@@ -537,34 +620,83 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
537 | // item that it came from. This allows us to enable 'save object to inventory' | 620 | // item that it came from. This allows us to enable 'save object to inventory' |
538 | if (!m_Scene.Permissions.BypassPermissions()) | 621 | if (!m_Scene.Permissions.BypassPermissions()) |
539 | { | 622 | { |
540 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy) | 623 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy && (item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) |
541 | { | 624 | { |
542 | itemId = item.ID; | 625 | itemId = item.ID; |
543 | } | 626 | } |
544 | } | 627 | } |
545 | else | 628 | else |
546 | { | 629 | { |
547 | // Brave new fullperm world | 630 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) |
548 | // | 631 | { |
549 | itemId = item.ID; | 632 | // Brave new fullperm world |
633 | itemId = item.ID; | ||
634 | } | ||
635 | } | ||
636 | |||
637 | if (item.ID == UUID.Zero) | ||
638 | { | ||
639 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 2"); | ||
550 | } | 640 | } |
551 | 641 | ||
552 | string xmlData = Utils.BytesToString(rezAsset.Data); | 642 | string xmlData = Utils.BytesToString(rezAsset.Data); |
553 | SceneObjectGroup group | 643 | List<SceneObjectGroup> objlist = |
554 | = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); | 644 | new List<SceneObjectGroup>(); |
645 | List<Vector3> veclist = new List<Vector3>(); | ||
646 | |||
647 | XmlDocument doc = new XmlDocument(); | ||
648 | doc.LoadXml(xmlData); | ||
649 | XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); | ||
650 | if (e == null || attachment) // Single | ||
651 | { | ||
652 | SceneObjectGroup g = | ||
653 | SceneObjectSerializer.FromOriginalXmlFormat( | ||
654 | itemId, xmlData); | ||
655 | objlist.Add(g); | ||
656 | veclist.Add(new Vector3(0, 0, 0)); | ||
657 | |||
658 | float offsetHeight = 0; | ||
659 | pos = m_Scene.GetNewRezLocation( | ||
660 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | ||
661 | BypassRayCast, bRayEndIsIntersection, true, g.GetAxisAlignedBoundingBox(out offsetHeight), false); | ||
662 | pos.Z += offsetHeight; | ||
663 | } | ||
664 | else | ||
665 | { | ||
666 | XmlElement coll = (XmlElement)e; | ||
667 | float bx = Convert.ToSingle(coll.GetAttribute("x")); | ||
668 | float by = Convert.ToSingle(coll.GetAttribute("y")); | ||
669 | float bz = Convert.ToSingle(coll.GetAttribute("z")); | ||
670 | Vector3 bbox = new Vector3(bx, by, bz); | ||
555 | 671 | ||
556 | Util.FireAndForget(delegate { AddUserData(group); }); | 672 | pos = m_Scene.GetNewRezLocation(RayStart, RayEnd, |
557 | 673 | RayTargetID, Quaternion.Identity, | |
558 | group.RootPart.FromFolderID = item.Folder; | 674 | BypassRayCast, bRayEndIsIntersection, true, |
675 | bbox, false); | ||
559 | 676 | ||
560 | // If it's rezzed in world, select it. Much easier to | 677 | pos -= bbox / 2; |
561 | // find small items. | 678 | |
562 | // | 679 | XmlNodeList groups = e.SelectNodes("SceneObjectGroup"); |
563 | if (!attachment) | 680 | foreach (XmlNode n in groups) |
564 | group.RootPart.CreateSelected = true; | 681 | { |
682 | SceneObjectGroup g = | ||
683 | SceneObjectSerializer.FromOriginalXmlFormat( | ||
684 | itemId, n.OuterXml); | ||
685 | objlist.Add(g); | ||
686 | XmlElement el = (XmlElement)n; | ||
687 | float x = Convert.ToSingle(el.GetAttribute("offsetx")); | ||
688 | float y = Convert.ToSingle(el.GetAttribute("offsety")); | ||
689 | float z = Convert.ToSingle(el.GetAttribute("offsetz")); | ||
690 | veclist.Add(new Vector3(x, y, z)); | ||
691 | } | ||
692 | } | ||
693 | |||
694 | int primcount = 0; | ||
695 | foreach (SceneObjectGroup g in objlist) | ||
696 | primcount += g.PrimCount; | ||
565 | 697 | ||
566 | if (!m_Scene.Permissions.CanRezObject( | 698 | if (!m_Scene.Permissions.CanRezObject( |
567 | group.PrimCount, remoteClient.AgentId, pos) | 699 | primcount, remoteClient.AgentId, pos) |
568 | && !attachment) | 700 | && !attachment) |
569 | { | 701 | { |
570 | // The client operates in no fail mode. It will | 702 | // The client operates in no fail mode. It will |
@@ -577,116 +709,147 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
577 | return null; | 709 | return null; |
578 | } | 710 | } |
579 | 711 | ||
580 | group.ResetIDs(); | 712 | for (int i = 0 ; i < objlist.Count ; i++ ) |
581 | |||
582 | if (attachment) | ||
583 | { | ||
584 | group.RootPart.Flags |= PrimFlags.Phantom; | ||
585 | group.RootPart.IsAttachment = true; | ||
586 | |||
587 | // If we're rezzing an attachment then don't ask | ||
588 | // AddNewSceneObject() to update the client since | ||
589 | // we'll be doing that later on. Scheduling more | ||
590 | // than one full update during the attachment | ||
591 | // process causes some clients to fail to display | ||
592 | // the attachment properly. | ||
593 | // Also, don't persist attachments. | ||
594 | m_Scene.AddNewSceneObject(group, false, false); | ||
595 | } | ||
596 | else | ||
597 | { | 713 | { |
598 | m_Scene.AddNewSceneObject(group, true, false); | 714 | group = objlist[i]; |
599 | } | ||
600 | 715 | ||
601 | // m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z); | 716 | Vector3 storedPosition = group.AbsolutePosition; |
602 | // if attachment we set it's asset id so object updates can reflect that | 717 | if (group.UUID == UUID.Zero) |
603 | // if not, we set it's position in world. | 718 | { |
604 | if (!attachment) | 719 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 3"); |
605 | { | 720 | } |
606 | group.ScheduleGroupForFullUpdate(); | 721 | group.RootPart.FromFolderID = item.Folder; |
607 | |||
608 | float offsetHeight = 0; | ||
609 | pos = m_Scene.GetNewRezLocation( | ||
610 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | ||
611 | BypassRayCast, bRayEndIsIntersection, true, group.GetAxisAlignedBoundingBox(out offsetHeight), false); | ||
612 | pos.Z += offsetHeight; | ||
613 | group.AbsolutePosition = pos; | ||
614 | // m_log.InfoFormat("rezx point for inventory rezz is {0} {1} {2} and offsetheight was {3}", pos.X, pos.Y, pos.Z, offsetHeight); | ||
615 | 722 | ||
616 | } | 723 | // If it's rezzed in world, select it. Much easier to |
617 | else | 724 | // find small items. |
618 | { | 725 | // |
619 | group.SetFromItemID(itemID); | 726 | if (!attachment) |
620 | } | 727 | { |
728 | group.RootPart.CreateSelected = true; | ||
729 | foreach (SceneObjectPart child in group.Parts) | ||
730 | child.CreateSelected = true; | ||
731 | } | ||
621 | 732 | ||
622 | SceneObjectPart rootPart = null; | 733 | group.ResetIDs(); |
623 | try | ||
624 | { | ||
625 | rootPart = group.GetChildPart(group.UUID); | ||
626 | } | ||
627 | catch (NullReferenceException) | ||
628 | { | ||
629 | string isAttachment = ""; | ||
630 | 734 | ||
631 | if (attachment) | 735 | if (attachment) |
632 | isAttachment = " Object was an attachment"; | 736 | { |
737 | group.RootPart.Flags |= PrimFlags.Phantom; | ||
738 | group.RootPart.IsAttachment = true; | ||
739 | |||
740 | // If we're rezzing an attachment then don't ask | ||
741 | // AddNewSceneObject() to update the client since | ||
742 | // we'll be doing that later on. Scheduling more | ||
743 | // than one full update during the attachment | ||
744 | // process causes some clients to fail to display | ||
745 | // the attachment properly. | ||
746 | // Also, don't persist attachments. | ||
747 | m_Scene.AddNewSceneObject(group, false, false); | ||
748 | } | ||
749 | else | ||
750 | { | ||
751 | m_Scene.AddNewSceneObject(group, true, false); | ||
752 | } | ||
633 | 753 | ||
634 | m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment); | 754 | // if attachment we set it's asset id so object updates |
635 | } | 755 | // can reflect that, if not, we set it's position in world. |
756 | if (!attachment) | ||
757 | { | ||
758 | group.ScheduleGroupForFullUpdate(); | ||
759 | |||
760 | group.AbsolutePosition = pos + veclist[i]; | ||
761 | } | ||
762 | else | ||
763 | { | ||
764 | group.SetFromItemID(itemID); | ||
765 | } | ||
636 | 766 | ||
637 | // Since renaming the item in the inventory does not affect the name stored | 767 | SceneObjectPart rootPart = null; |
638 | // in the serialization, transfer the correct name from the inventory to the | ||
639 | // object itself before we rez. | ||
640 | rootPart.Name = item.Name; | ||
641 | rootPart.Description = item.Description; | ||
642 | 768 | ||
643 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | 769 | try |
644 | if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0) | 770 | { |
645 | { | 771 | rootPart = group.GetChildPart(group.UUID); |
646 | //Need to kill the for sale here | 772 | } |
647 | rootPart.ObjectSaleType = 0; | 773 | catch (NullReferenceException) |
648 | rootPart.SalePrice = 10; | 774 | { |
775 | string isAttachment = ""; | ||
649 | 776 | ||
650 | if (m_Scene.Permissions.PropagatePermissions()) | 777 | if (attachment) |
778 | isAttachment = " Object was an attachment"; | ||
779 | |||
780 | m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment); | ||
781 | } | ||
782 | |||
783 | // Since renaming the item in the inventory does not | ||
784 | // affect the name stored in the serialization, transfer | ||
785 | // the correct name from the inventory to the | ||
786 | // object itself before we rez. | ||
787 | // On coalesced objects, this has no effect. | ||
788 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | ||
789 | { | ||
790 | rootPart.Name = item.Name; | ||
791 | rootPart.Description = item.Description; | ||
792 | rootPart.ObjectSaleType = item.SaleType; | ||
793 | rootPart.SalePrice = item.SalePrice; | ||
794 | } | ||
795 | |||
796 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | ||
797 | if ((rootPart.OwnerID != item.Owner) || | ||
798 | (item.CurrentPermissions & 16) != 0) | ||
651 | { | 799 | { |
652 | foreach (SceneObjectPart part in group.Parts) | 800 | //Need to kill the for sale here |
801 | rootPart.ObjectSaleType = 0; | ||
802 | rootPart.SalePrice = 10; | ||
803 | |||
804 | if (m_Scene.Permissions.PropagatePermissions()) | ||
653 | { | 805 | { |
654 | part.EveryoneMask = item.EveryOnePermissions; | 806 | foreach (SceneObjectPart part in group.Parts) |
655 | part.NextOwnerMask = item.NextPermissions; | 807 | { |
656 | part.GroupMask = 0; // DO NOT propagate here | 808 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) |
809 | { | ||
810 | part.EveryoneMask = item.EveryOnePermissions; | ||
811 | part.NextOwnerMask = item.NextPermissions; | ||
812 | } | ||
813 | part.GroupMask = 0; // DO NOT propagate here | ||
814 | } | ||
815 | |||
816 | group.ApplyNextOwnerPermissions(); | ||
657 | } | 817 | } |
658 | |||
659 | group.ApplyNextOwnerPermissions(); | ||
660 | } | 818 | } |
661 | } | ||
662 | 819 | ||
663 | foreach (SceneObjectPart part in group.Parts) | 820 | foreach (SceneObjectPart part in group.Parts) |
664 | { | ||
665 | if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0) | ||
666 | { | 821 | { |
667 | part.LastOwnerID = part.OwnerID; | 822 | if ((part.OwnerID != item.Owner) || |
668 | part.OwnerID = item.Owner; | 823 | (item.CurrentPermissions & 16) != 0) |
669 | part.Inventory.ChangeInventoryOwner(item.Owner); | 824 | { |
670 | part.GroupMask = 0; // DO NOT propagate here | 825 | part.LastOwnerID = part.OwnerID; |
826 | part.OwnerID = item.Owner; | ||
827 | part.Inventory.ChangeInventoryOwner(item.Owner); | ||
828 | part.GroupMask = 0; // DO NOT propagate here | ||
829 | } | ||
830 | part.EveryoneMask = item.EveryOnePermissions; | ||
831 | part.NextOwnerMask = item.NextPermissions; | ||
671 | } | 832 | } |
672 | part.EveryoneMask = item.EveryOnePermissions; | ||
673 | part.NextOwnerMask = item.NextPermissions; | ||
674 | } | ||
675 | 833 | ||
676 | rootPart.TrimPermissions(); | 834 | rootPart.TrimPermissions(); |
677 | 835 | ||
678 | if (!attachment) | 836 | if (!attachment) |
679 | { | ||
680 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | ||
681 | { | 837 | { |
682 | group.ClearPartAttachmentData(); | 838 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) |
683 | } | 839 | { |
684 | 840 | // Save attachment data | |
685 | // Fire on_rez | 841 | group.RootPart.AttachPoint = group.RootPart.Shape.State; |
686 | group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); | 842 | group.RootPart.AttachOffset = storedPosition; |
687 | rootPart.ParentGroup.ResumeScripts(); | ||
688 | 843 | ||
689 | rootPart.ScheduleFullUpdate(); | 844 | group.ClearPartAttachmentData(); |
845 | } | ||
846 | |||
847 | // Fire on_rez | ||
848 | group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); | ||
849 | rootPart.ParentGroup.ResumeScripts(); | ||
850 | |||
851 | rootPart.ScheduleFullUpdate(); | ||
852 | } | ||
690 | } | 853 | } |
691 | 854 | ||
692 | if (!m_Scene.Permissions.BypassPermissions()) | 855 | if (!m_Scene.Permissions.BypassPermissions()) |
@@ -704,9 +867,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
704 | } | 867 | } |
705 | } | 868 | } |
706 | } | 869 | } |
707 | |||
708 | return rootPart.ParentGroup; | ||
709 | } | 870 | } |
871 | return group; | ||
710 | } | 872 | } |
711 | 873 | ||
712 | return null; | 874 | return null; |
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 9b565ed..1fd1f47 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -142,7 +142,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
142 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 142 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); |
143 | return urlcode; | 143 | return urlcode; |
144 | } | 144 | } |
145 | string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/"; | 145 | string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString(); |
146 | 146 | ||
147 | UrlData urlData = new UrlData(); | 147 | UrlData urlData = new UrlData(); |
148 | urlData.hostID = host.UUID; | 148 | urlData.hostID = host.UUID; |
@@ -152,10 +152,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
152 | urlData.urlcode = urlcode; | 152 | urlData.urlcode = urlcode; |
153 | urlData.requests = new Dictionary<UUID, RequestData>(); | 153 | urlData.requests = new Dictionary<UUID, RequestData>(); |
154 | 154 | ||
155 | |||
156 | m_UrlMap[url] = urlData; | 155 | m_UrlMap[url] = urlData; |
157 | 156 | ||
158 | string uri = "/lslhttp/" + urlcode.ToString() + "/"; | 157 | string uri = "/lslhttp/" + urlcode.ToString(); |
159 | 158 | ||
160 | m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, | 159 | m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, |
161 | new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, | 160 | new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, |
@@ -386,6 +385,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
386 | 385 | ||
387 | return response; | 386 | return response; |
388 | } | 387 | } |
388 | |||
389 | public void HttpRequestHandler(UUID requestID, Hashtable request) | 389 | public void HttpRequestHandler(UUID requestID, Hashtable request) |
390 | { | 390 | { |
391 | lock (request) | 391 | lock (request) |
@@ -400,8 +400,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
400 | 400 | ||
401 | int pos1 = uri.IndexOf("/");// /lslhttp | 401 | int pos1 = uri.IndexOf("/");// /lslhttp |
402 | int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ | 402 | int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ |
403 | int pos3 = uri.IndexOf("/", pos2 + 1);// /lslhttp/<UUID>/ | 403 | int pos3 = pos2 + 37; // /lslhttp/urlcode |
404 | string uri_tmp = uri.Substring(0, pos3 + 1); | 404 | string uri_tmp = uri.Substring(0, pos3); |
405 | //HTTP server code doesn't provide us with QueryStrings | 405 | //HTTP server code doesn't provide us with QueryStrings |
406 | string pathInfo; | 406 | string pathInfo; |
407 | string queryString; | 407 | string queryString; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs index e54ee02..ebfba2b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs | |||
@@ -57,9 +57,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
57 | config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); | 57 | config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); |
58 | config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); | 58 | config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); |
59 | config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); | 59 | config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); |
60 | config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion"); | 60 | config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion"); |
61 | config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion"); | 61 | config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion"); |
62 | config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion"); | 62 | config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion"); |
63 | config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion"); | 63 | config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion"); |
64 | 64 | ||
65 | m_LocalConnector = new LocalGridServicesConnector(config); | 65 | m_LocalConnector = new LocalGridServicesConnector(config); |
@@ -128,8 +128,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
128 | Assert.IsNotNull(result, "Retrieved GetRegionByName is null"); | 128 | Assert.IsNotNull(result, "Retrieved GetRegionByName is null"); |
129 | Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match"); | 129 | Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match"); |
130 | 130 | ||
131 | m_LocalConnector.RegisterRegion(UUID.Zero, r2); | 131 | m_LocalConnector.RegisterRegion(UUID.Zero, r2); |
132 | m_LocalConnector.RegisterRegion(UUID.Zero, r3); | 132 | m_LocalConnector.RegisterRegion(UUID.Zero, r3); |
133 | m_LocalConnector.RegisterRegion(UUID.Zero, r4); | 133 | m_LocalConnector.RegisterRegion(UUID.Zero, r4); |
134 | 134 | ||
135 | result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1)); | 135 | result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1)); |
@@ -154,38 +154,38 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
154 | Assert.IsNotNull(results, "Retrieved GetRegionRange collection is null"); | 154 | Assert.IsNotNull(results, "Retrieved GetRegionRange collection is null"); |
155 | Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected"); | 155 | Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected"); |
156 | 156 | ||
157 | results = m_LocalConnector.GetDefaultRegions(UUID.Zero); | 157 | results = m_LocalConnector.GetDefaultRegions(UUID.Zero); |
158 | Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null"); | 158 | Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null"); |
159 | Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size"); | 159 | Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size"); |
160 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match"); | 160 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match"); |
161 | 161 | ||
162 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY); | 162 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY); |
163 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null"); | 163 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null"); |
164 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size"); | 164 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size"); |
165 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); | 165 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); |
166 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); | 166 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); |
167 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); | 167 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); |
168 | 168 | ||
169 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY); | 169 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY); |
170 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null"); | 170 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null"); |
171 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size"); | 171 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size"); |
172 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3"); | 172 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3"); |
173 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3"); | 173 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3"); |
174 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3"); | 174 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3"); |
175 | 175 | ||
176 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY); | 176 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY); |
177 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null"); | 177 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null"); |
178 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size"); | 178 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size"); |
179 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2"); | 179 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2"); |
180 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2"); | 180 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2"); |
181 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2"); | 181 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2"); |
182 | 182 | ||
183 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY); | 183 | results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY); |
184 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null"); | 184 | Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null"); |
185 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size"); | 185 | Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size"); |
186 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2"); | 186 | Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2"); |
187 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2"); | 187 | Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2"); |
188 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2"); | 188 | Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2"); |
189 | 189 | ||
190 | results = m_LocalConnector.GetHyperlinks(UUID.Zero); | 190 | results = m_LocalConnector.GetHyperlinks(UUID.Zero); |
191 | Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); | 191 | Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 37b403e..5be6486 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -307,6 +307,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
307 | return false; | 307 | return false; |
308 | } | 308 | } |
309 | 309 | ||
310 | public bool CloseChildAgent(GridRegion destination, UUID id) | ||
311 | { | ||
312 | if (destination == null) | ||
313 | return false; | ||
314 | |||
315 | foreach (Scene s in m_sceneList) | ||
316 | { | ||
317 | if (s.RegionInfo.RegionID == destination.RegionID) | ||
318 | { | ||
319 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); | ||
320 | return s.IncomingCloseChildAgent(id); | ||
321 | } | ||
322 | } | ||
323 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); | ||
324 | return false; | ||
325 | } | ||
326 | |||
310 | /** | 327 | /** |
311 | * Object-related communications | 328 | * Object-related communications |
312 | */ | 329 | */ |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 387a9b8..27792c8 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -269,6 +269,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
269 | return false; | 269 | return false; |
270 | } | 270 | } |
271 | 271 | ||
272 | public bool CloseChildAgent(GridRegion destination, UUID id) | ||
273 | { | ||
274 | if (destination == null) | ||
275 | return false; | ||
276 | |||
277 | // Try local first | ||
278 | if (m_localBackend.CloseChildAgent(destination, id)) | ||
279 | return true; | ||
280 | |||
281 | // else do the remote thing | ||
282 | if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) | ||
283 | return m_remoteConnector.CloseChildAgent(destination, id); | ||
284 | |||
285 | return false; | ||
286 | } | ||
272 | 287 | ||
273 | public bool CloseAgent(GridRegion destination, UUID id) | 288 | public bool CloseAgent(GridRegion destination, UUID id) |
274 | { | 289 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index 30ebb21..9ecbcc6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs | |||
@@ -172,6 +172,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
172 | return m_UserService.GetUserAccount(scopeID, Email); | 172 | return m_UserService.GetUserAccount(scopeID, Email); |
173 | } | 173 | } |
174 | 174 | ||
175 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) | ||
176 | { | ||
177 | return null; | ||
178 | } | ||
179 | |||
175 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) | 180 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) |
176 | { | 181 | { |
177 | return m_UserService.GetUserAccounts(scopeID, query); | 182 | return m_UserService.GetUserAccounts(scopeID, query); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 3238a81..d948b82 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -287,6 +287,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
287 | // being no copy/no mod for everyone | 287 | // being no copy/no mod for everyone |
288 | lock (part.TaskInventory) | 288 | lock (part.TaskInventory) |
289 | { | 289 | { |
290 | if (!ResolveUserUuid(part.CreatorID)) | ||
291 | part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
292 | |||
293 | if (!ResolveUserUuid(part.OwnerID)) | ||
294 | part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
295 | |||
296 | if (!ResolveUserUuid(part.LastOwnerID)) | ||
297 | part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
298 | |||
299 | // And zap any troublesome sit target information | ||
300 | part.SitTargetOrientation = new Quaternion(0, 0, 0, 1); | ||
301 | part.SitTargetPosition = new Vector3(0, 0, 0); | ||
302 | |||
303 | // Fix ownership/creator of inventory items | ||
304 | // Not doing so results in inventory items | ||
305 | // being no copy/no mod for everyone | ||
306 | part.TaskInventory.LockItemsForRead(true); | ||
290 | TaskInventoryDictionary inv = part.TaskInventory; | 307 | TaskInventoryDictionary inv = part.TaskInventory; |
291 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) | 308 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) |
292 | { | 309 | { |
@@ -302,6 +319,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
302 | if (UserManager != null) | 319 | if (UserManager != null) |
303 | UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); | 320 | UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); |
304 | } | 321 | } |
322 | part.TaskInventory.LockItemsForRead(false); | ||
305 | } | 323 | } |
306 | } | 324 | } |
307 | 325 | ||
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index ddae20f..60e8c1a 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -29,6 +29,7 @@ using System.Collections.Generic; | |||
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Security; | 31 | using System.Security; |
32 | using System.Timers; | ||
32 | using log4net; | 33 | using log4net; |
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
@@ -45,6 +46,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
45 | private delegate void LookupUUIDS(List<UUID> uuidLst); | 46 | private delegate void LookupUUIDS(List<UUID> uuidLst); |
46 | 47 | ||
47 | private Scene m_scene; | 48 | private Scene m_scene; |
49 | private Timer m_regionChangeTimer = new Timer(); | ||
48 | 50 | ||
49 | private EstateTerrainXferHandler TerrainUploader; | 51 | private EstateTerrainXferHandler TerrainUploader; |
50 | 52 | ||
@@ -246,7 +248,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
246 | timeInSeconds -= 15; | 248 | timeInSeconds -= 15; |
247 | } | 249 | } |
248 | 250 | ||
249 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); | 251 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), false); |
250 | } | 252 | } |
251 | } | 253 | } |
252 | 254 | ||
@@ -266,7 +268,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
266 | 268 | ||
267 | if ((estateAccessType & 4) != 0) // User add | 269 | if ((estateAccessType & 4) != 0) // User add |
268 | { | 270 | { |
269 | if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) | 271 | if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) |
270 | { | 272 | { |
271 | m_scene.RegionInfo.EstateSettings.AddEstateUser(user); | 273 | m_scene.RegionInfo.EstateSettings.AddEstateUser(user); |
272 | m_scene.RegionInfo.EstateSettings.Save(); | 274 | m_scene.RegionInfo.EstateSettings.Save(); |
@@ -281,7 +283,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
281 | } | 283 | } |
282 | if ((estateAccessType & 8) != 0) // User remove | 284 | if ((estateAccessType & 8) != 0) // User remove |
283 | { | 285 | { |
284 | if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) | 286 | if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) |
285 | { | 287 | { |
286 | m_scene.RegionInfo.EstateSettings.RemoveEstateUser(user); | 288 | m_scene.RegionInfo.EstateSettings.RemoveEstateUser(user); |
287 | m_scene.RegionInfo.EstateSettings.Save(); | 289 | m_scene.RegionInfo.EstateSettings.Save(); |
@@ -296,7 +298,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
296 | } | 298 | } |
297 | if ((estateAccessType & 16) != 0) // Group add | 299 | if ((estateAccessType & 16) != 0) // Group add |
298 | { | 300 | { |
299 | if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) | 301 | if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) |
300 | { | 302 | { |
301 | m_scene.RegionInfo.EstateSettings.AddEstateGroup(user); | 303 | m_scene.RegionInfo.EstateSettings.AddEstateGroup(user); |
302 | m_scene.RegionInfo.EstateSettings.Save(); | 304 | m_scene.RegionInfo.EstateSettings.Save(); |
@@ -310,7 +312,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
310 | } | 312 | } |
311 | if ((estateAccessType & 32) != 0) // Group remove | 313 | if ((estateAccessType & 32) != 0) // Group remove |
312 | { | 314 | { |
313 | if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) | 315 | if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) |
314 | { | 316 | { |
315 | m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); | 317 | m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); |
316 | m_scene.RegionInfo.EstateSettings.Save(); | 318 | m_scene.RegionInfo.EstateSettings.Save(); |
@@ -359,7 +361,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
359 | { | 361 | { |
360 | if (!s.IsChildAgent) | 362 | if (!s.IsChildAgent) |
361 | { | 363 | { |
362 | m_scene.TeleportClientHome(user, s.ControllingClient); | 364 | if (!m_scene.TeleportClientHome(user, s.ControllingClient)) |
365 | { | ||
366 | s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out."); | ||
367 | s.ControllingClient.Close(); | ||
368 | } | ||
363 | } | 369 | } |
364 | } | 370 | } |
365 | 371 | ||
@@ -493,7 +499,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
493 | ScenePresence s = m_scene.GetScenePresence(prey); | 499 | ScenePresence s = m_scene.GetScenePresence(prey); |
494 | if (s != null) | 500 | if (s != null) |
495 | { | 501 | { |
496 | m_scene.TeleportClientHome(prey, s.ControllingClient); | 502 | if (!m_scene.TeleportClientHome(prey, s.ControllingClient)) |
503 | { | ||
504 | s.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); | ||
505 | s.ControllingClient.Close(); | ||
506 | } | ||
497 | } | 507 | } |
498 | } | 508 | } |
499 | } | 509 | } |
@@ -512,7 +522,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
512 | // Also make sure they are actually in the region | 522 | // Also make sure they are actually in the region |
513 | if (p != null && !p.IsChildAgent) | 523 | if (p != null && !p.IsChildAgent) |
514 | { | 524 | { |
515 | m_scene.TeleportClientHome(p.UUID, p.ControllingClient); | 525 | if (!m_scene.TeleportClientHome(p.UUID, p.ControllingClient)) |
526 | { | ||
527 | p.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); | ||
528 | p.ControllingClient.Close(); | ||
529 | } | ||
516 | } | 530 | } |
517 | } | 531 | } |
518 | }); | 532 | }); |
@@ -921,6 +935,9 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
921 | m_scene.RegisterModuleInterface<IEstateModule>(this); | 935 | m_scene.RegisterModuleInterface<IEstateModule>(this); |
922 | m_scene.EventManager.OnNewClient += EventManager_OnNewClient; | 936 | m_scene.EventManager.OnNewClient += EventManager_OnNewClient; |
923 | m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; | 937 | m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; |
938 | m_regionChangeTimer.AutoReset = false; | ||
939 | m_regionChangeTimer.Interval = 2000; | ||
940 | m_regionChangeTimer.Elapsed += RaiseRegionInfoChange; | ||
924 | 941 | ||
925 | m_scene.AddCommand(this, "set terrain texture", | 942 | m_scene.AddCommand(this, "set terrain texture", |
926 | "set terrain texture <number> <uuid> [<x>] [<y>]", | 943 | "set terrain texture <number> <uuid> [<x>] [<y>]", |
@@ -1193,6 +1210,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1193 | 1210 | ||
1194 | protected void TriggerRegionInfoChange() | 1211 | protected void TriggerRegionInfoChange() |
1195 | { | 1212 | { |
1213 | m_regionChangeTimer.Stop(); | ||
1214 | m_regionChangeTimer.Start(); | ||
1215 | } | ||
1216 | |||
1217 | protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e) | ||
1218 | { | ||
1196 | ChangeDelegate change = OnRegionInfoChange; | 1219 | ChangeDelegate change = OnRegionInfoChange; |
1197 | 1220 | ||
1198 | if (change != null) | 1221 | if (change != null) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index ac4705c..8449cc1 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -85,6 +85,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
85 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 85 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
86 | 86 | ||
87 | private bool m_allowedForcefulBans = true; | 87 | private bool m_allowedForcefulBans = true; |
88 | private UUID DefaultGodParcelGroup; | ||
89 | private string DefaultGodParcelName; | ||
88 | 90 | ||
89 | // caches ExtendedLandData | 91 | // caches ExtendedLandData |
90 | private Cache parcelInfoCache; | 92 | private Cache parcelInfoCache; |
@@ -100,6 +102,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
100 | 102 | ||
101 | public void Initialise(IConfigSource source) | 103 | public void Initialise(IConfigSource source) |
102 | { | 104 | { |
105 | IConfig cnf = source.Configs["LandManagement"]; | ||
106 | if (cnf != null) | ||
107 | { | ||
108 | DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); | ||
109 | DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel"); | ||
110 | } | ||
103 | } | 111 | } |
104 | 112 | ||
105 | public void AddRegion(Scene scene) | 113 | public void AddRegion(Scene scene) |
@@ -351,7 +359,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
351 | { | 359 | { |
352 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) | 360 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) |
353 | { | 361 | { |
354 | if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) | 362 | if (parcelAvatarIsEntering.IsEitherBannedOrRestricted(avatar.UUID)) |
355 | { | 363 | { |
356 | SendYouAreBannedNotice(avatar); | 364 | SendYouAreBannedNotice(avatar); |
357 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | 365 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); |
@@ -662,7 +670,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
662 | int x; | 670 | int x; |
663 | int y; | 671 | int y; |
664 | 672 | ||
665 | if (x_float > Constants.RegionSize || x_float <= 0 || y_float > Constants.RegionSize || y_float <= 0) | 673 | if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0) |
666 | return null; | 674 | return null; |
667 | 675 | ||
668 | try | 676 | try |
@@ -1005,6 +1013,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1005 | //Owner Flag | 1013 | //Owner Flag |
1006 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); | 1014 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); |
1007 | } | 1015 | } |
1016 | else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID)) | ||
1017 | { | ||
1018 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP); | ||
1019 | } | ||
1008 | else if (currentParcelBlock.LandData.SalePrice > 0 && | 1020 | else if (currentParcelBlock.LandData.SalePrice > 0 && |
1009 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || | 1021 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || |
1010 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) | 1022 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) |
@@ -1299,7 +1311,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1299 | { | 1311 | { |
1300 | land.DeedToGroup(groupID); | 1312 | land.DeedToGroup(groupID); |
1301 | } | 1313 | } |
1302 | 1314 | EventManagerOnParcelPrimCountTainted(); | |
1303 | } | 1315 | } |
1304 | 1316 | ||
1305 | 1317 | ||
@@ -1307,18 +1319,31 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1307 | 1319 | ||
1308 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) | 1320 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) |
1309 | { | 1321 | { |
1310 | for (int i = 0; i < data.Count; i++) | 1322 | lock (m_landList) |
1311 | { | 1323 | { |
1312 | 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 | } | ||
1313 | } | 1336 | } |
1314 | } | 1337 | } |
1315 | 1338 | ||
1316 | public void IncomingLandObjectFromStorage(LandData data) | 1339 | public void IncomingLandObjectFromStorage(LandData data) |
1317 | { | 1340 | { |
1341 | |||
1318 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); | 1342 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); |
1319 | new_land.LandData = data.Copy(); | 1343 | new_land.LandData = data.Copy(); |
1320 | new_land.SetLandBitmapFromByteArray(); | 1344 | new_land.SetLandBitmapFromByteArray(); |
1321 | AddLandObject(new_land); | 1345 | AddLandObject(new_land); |
1346 | new_land.SendLandUpdateToAvatarsOverMe(); | ||
1322 | } | 1347 | } |
1323 | 1348 | ||
1324 | 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) |
@@ -1591,5 +1616,321 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1591 | 1616 | ||
1592 | UpdateLandObject(localID, land.LandData); | 1617 | UpdateLandObject(localID, land.LandData); |
1593 | } | 1618 | } |
1619 | |||
1620 | public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID) | ||
1621 | { | ||
1622 | ILandObject land = null; | ||
1623 | List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels(); | ||
1624 | foreach (ILandObject landObject in Land) | ||
1625 | { | ||
1626 | if (landObject.LandData.LocalID == landID) | ||
1627 | { | ||
1628 | land = landObject; | ||
1629 | } | ||
1630 | } | ||
1631 | land.DeedToGroup(DefaultGodParcelGroup); | ||
1632 | land.LandData.Name = DefaultGodParcelName; | ||
1633 | land.SendLandUpdateToAvatarsOverMe(); | ||
1634 | } | ||
1635 | |||
1636 | private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID) | ||
1637 | { | ||
1638 | ScenePresence SP; | ||
1639 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); | ||
1640 | List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); | ||
1641 | if (SP.UserLevel != 0) | ||
1642 | { | ||
1643 | if (flags == 0) //All parcels, scripted or not | ||
1644 | { | ||
1645 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1646 | { | ||
1647 | if (e.OwnerID == targetID) | ||
1648 | { | ||
1649 | returns.Add(e); | ||
1650 | } | ||
1651 | } | ||
1652 | ); | ||
1653 | } | ||
1654 | if (flags == 4) //All parcels, scripted object | ||
1655 | { | ||
1656 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1657 | { | ||
1658 | if (e.OwnerID == targetID) | ||
1659 | { | ||
1660 | if (e.scriptScore >= 0.01) | ||
1661 | { | ||
1662 | returns.Add(e); | ||
1663 | } | ||
1664 | } | ||
1665 | } | ||
1666 | ); | ||
1667 | } | ||
1668 | if (flags == 4) //not target parcel, scripted object | ||
1669 | { | ||
1670 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1671 | { | ||
1672 | if (e.OwnerID == targetID) | ||
1673 | { | ||
1674 | ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y); | ||
1675 | if (landobject.LandData.OwnerID != e.OwnerID) | ||
1676 | { | ||
1677 | if (e.scriptScore >= 0.01) | ||
1678 | { | ||
1679 | returns.Add(e); | ||
1680 | } | ||
1681 | } | ||
1682 | } | ||
1683 | } | ||
1684 | ); | ||
1685 | } | ||
1686 | foreach (SceneObjectGroup ol in returns) | ||
1687 | { | ||
1688 | ReturnObject(ol, client); | ||
1689 | } | ||
1690 | } | ||
1691 | } | ||
1692 | public void ReturnObject(SceneObjectGroup obj, IClientAPI client) | ||
1693 | { | ||
1694 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | ||
1695 | objs[0] = obj; | ||
1696 | ((Scene)client.Scene).returnObjects(objs, client.AgentId); | ||
1697 | } | ||
1698 | |||
1699 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
1700 | |||
1701 | public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1702 | { | ||
1703 | ScenePresence targetAvatar = null; | ||
1704 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1705 | ScenePresence parcelManager = null; | ||
1706 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1707 | System.Threading.Timer Timer; | ||
1708 | |||
1709 | if (targetAvatar.UserLevel == 0) | ||
1710 | { | ||
1711 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1712 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1713 | return; | ||
1714 | if (flags == 0) | ||
1715 | { | ||
1716 | targetAvatar.AllowMovement = false; | ||
1717 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world."); | ||
1718 | parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen."); | ||
1719 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
1720 | Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0); | ||
1721 | Timers.Add(targetAvatar.UUID, Timer); | ||
1722 | } | ||
1723 | else | ||
1724 | { | ||
1725 | targetAvatar.AllowMovement = true; | ||
1726 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you."); | ||
1727 | parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen."); | ||
1728 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1729 | Timers.Remove(targetAvatar.UUID); | ||
1730 | Timer.Dispose(); | ||
1731 | } | ||
1732 | } | ||
1733 | } | ||
1734 | private void OnEndParcelFrozen(object avatar) | ||
1735 | { | ||
1736 | ScenePresence targetAvatar = (ScenePresence)avatar; | ||
1737 | targetAvatar.AllowMovement = true; | ||
1738 | System.Threading.Timer Timer; | ||
1739 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1740 | Timers.Remove(targetAvatar.UUID); | ||
1741 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); | ||
1742 | } | ||
1743 | |||
1744 | |||
1745 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1746 | { | ||
1747 | ScenePresence targetAvatar = null; | ||
1748 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1749 | ScenePresence parcelManager = null; | ||
1750 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1751 | //Just eject | ||
1752 | if (flags == 0) | ||
1753 | { | ||
1754 | if (targetAvatar.UserLevel == 0) | ||
1755 | { | ||
1756 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1757 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1758 | return; | ||
1759 | |||
1760 | Vector3 position = new Vector3(0, 0, 0); | ||
1761 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1762 | allParcels = AllParcels(); | ||
1763 | if (allParcels.Count != 1) | ||
1764 | { | ||
1765 | foreach (ILandObject parcel in allParcels) | ||
1766 | { | ||
1767 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1768 | { | ||
1769 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1770 | { | ||
1771 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1772 | { | ||
1773 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1774 | { | ||
1775 | if (parcel.ContainsPoint(x, y)) | ||
1776 | { | ||
1777 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1778 | targetAvatar.TeleportWithMomentum(position); | ||
1779 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1780 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1781 | return; | ||
1782 | } | ||
1783 | } | ||
1784 | } | ||
1785 | } | ||
1786 | } | ||
1787 | } | ||
1788 | } | ||
1789 | Vector3 targetVector; | ||
1790 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1791 | { | ||
1792 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1793 | { | ||
1794 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1795 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1796 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1797 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1798 | return; | ||
1799 | } | ||
1800 | else | ||
1801 | { | ||
1802 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1803 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1804 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1805 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1806 | return; | ||
1807 | } | ||
1808 | } | ||
1809 | else | ||
1810 | { | ||
1811 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1812 | { | ||
1813 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1814 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1815 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1816 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1817 | return; | ||
1818 | } | ||
1819 | else | ||
1820 | { | ||
1821 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1822 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1823 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1824 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1825 | return; | ||
1826 | } | ||
1827 | } | ||
1828 | } | ||
1829 | } | ||
1830 | //Eject and ban | ||
1831 | if (flags == 1) | ||
1832 | { | ||
1833 | if (targetAvatar.UserLevel == 0) | ||
1834 | { | ||
1835 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1836 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1837 | return; | ||
1838 | |||
1839 | Vector3 position = new Vector3(0, 0, 0); | ||
1840 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1841 | allParcels = AllParcels(); | ||
1842 | if (allParcels.Count != 1) | ||
1843 | { | ||
1844 | foreach (ILandObject parcel in allParcels) | ||
1845 | { | ||
1846 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1847 | { | ||
1848 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1849 | { | ||
1850 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1851 | { | ||
1852 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1853 | { | ||
1854 | if (parcel.ContainsPoint(x, y)) | ||
1855 | { | ||
1856 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1857 | targetAvatar.TeleportWithMomentum(position); | ||
1858 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1859 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1860 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1861 | entry.AgentID = targetAvatar.UUID; | ||
1862 | entry.Flags = AccessList.Ban; | ||
1863 | entry.Time = new DateTime(); | ||
1864 | land.LandData.ParcelAccessList.Add(entry); | ||
1865 | return; | ||
1866 | } | ||
1867 | } | ||
1868 | } | ||
1869 | } | ||
1870 | } | ||
1871 | } | ||
1872 | } | ||
1873 | Vector3 targetVector; | ||
1874 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1875 | { | ||
1876 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1877 | { | ||
1878 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1879 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1880 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1881 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1882 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1883 | entry.AgentID = targetAvatar.UUID; | ||
1884 | entry.Flags = AccessList.Ban; | ||
1885 | entry.Time = new DateTime(); | ||
1886 | land.LandData.ParcelAccessList.Add(entry); | ||
1887 | return; | ||
1888 | } | ||
1889 | else | ||
1890 | { | ||
1891 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1892 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1893 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1894 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1895 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1896 | entry.AgentID = targetAvatar.UUID; | ||
1897 | entry.Flags = AccessList.Ban; | ||
1898 | entry.Time = new DateTime(); | ||
1899 | land.LandData.ParcelAccessList.Add(entry); | ||
1900 | return; | ||
1901 | } | ||
1902 | } | ||
1903 | else | ||
1904 | { | ||
1905 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1906 | { | ||
1907 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1908 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1909 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1910 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1911 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1912 | entry.AgentID = targetAvatar.UUID; | ||
1913 | entry.Flags = AccessList.Ban; | ||
1914 | entry.Time = new DateTime(); | ||
1915 | land.LandData.ParcelAccessList.Add(entry); | ||
1916 | return; | ||
1917 | } | ||
1918 | else | ||
1919 | { | ||
1920 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1921 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1922 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1923 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1924 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1925 | entry.AgentID = targetAvatar.UUID; | ||
1926 | entry.Flags = AccessList.Ban; | ||
1927 | entry.Time = new DateTime(); | ||
1928 | land.LandData.ParcelAccessList.Add(entry); | ||
1929 | return; | ||
1930 | } | ||
1931 | } | ||
1932 | } | ||
1933 | } | ||
1934 | } | ||
1594 | } | 1935 | } |
1595 | } | 1936 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 3e41c55..f4ebbf0 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -364,6 +364,37 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
364 | return false; | 364 | return false; |
365 | } | 365 | } |
366 | 366 | ||
367 | public bool HasGroupAccess(UUID avatar) | ||
368 | { | ||
369 | if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) | ||
370 | { | ||
371 | ScenePresence sp; | ||
372 | if (!m_scene.TryGetScenePresence(avatar, out sp)) | ||
373 | { | ||
374 | IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
375 | if (groupsModule == null) | ||
376 | return false; | ||
377 | |||
378 | GroupMembershipData[] membership = groupsModule.GetMembershipData(avatar); | ||
379 | if (membership == null || membership.Length == 0) | ||
380 | return false; | ||
381 | |||
382 | foreach (GroupMembershipData d in membership) | ||
383 | { | ||
384 | if (d.GroupID == LandData.GroupID) | ||
385 | return true; | ||
386 | } | ||
387 | return false; | ||
388 | } | ||
389 | |||
390 | if (!sp.ControllingClient.IsGroupMember(LandData.GroupID)) | ||
391 | return false; | ||
392 | |||
393 | return true; | ||
394 | } | ||
395 | return false; | ||
396 | } | ||
397 | |||
367 | public bool IsBannedFromLand(UUID avatar) | 398 | public bool IsBannedFromLand(UUID avatar) |
368 | { | 399 | { |
369 | if (m_scene.Permissions.IsAdministrator(avatar)) | 400 | if (m_scene.Permissions.IsAdministrator(avatar)) |
@@ -400,9 +431,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
400 | return false; | 431 | return false; |
401 | }) == -1 && LandData.OwnerID != avatar) | 432 | }) == -1 && LandData.OwnerID != avatar) |
402 | { | 433 | { |
403 | return true; | 434 | if (!HasGroupAccess(avatar)) |
435 | { | ||
436 | return true; | ||
437 | } | ||
404 | } | 438 | } |
405 | } | 439 | } |
440 | |||
406 | return false; | 441 | return false; |
407 | } | 442 | } |
408 | 443 | ||
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 364dd6c..f9b2384 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -362,7 +362,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
362 | 362 | ||
363 | public string Name | 363 | public string Name |
364 | { | 364 | { |
365 | get { return "PermissionsModule"; } | 365 | get { return "DefaultPermissionsModule"; } |
366 | } | 366 | } |
367 | 367 | ||
368 | public bool IsSharedModule | 368 | public bool IsSharedModule |
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index c65aa6a..2e82e7e 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs | |||
@@ -28,6 +28,8 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Timers; | 30 | using System.Timers; |
31 | using System.IO; | ||
32 | using System.Diagnostics; | ||
31 | using System.Threading; | 33 | using System.Threading; |
32 | using System.Collections.Generic; | 34 | using System.Collections.Generic; |
33 | using log4net; | 35 | using log4net; |
@@ -56,13 +58,23 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
56 | protected UUID m_Initiator; | 58 | protected UUID m_Initiator; |
57 | protected bool m_Notice = false; | 59 | protected bool m_Notice = false; |
58 | protected IDialogModule m_DialogModule = null; | 60 | protected IDialogModule m_DialogModule = null; |
61 | protected string m_MarkerPath = String.Empty; | ||
59 | 62 | ||
60 | public void Initialise(IConfigSource config) | 63 | public void Initialise(IConfigSource config) |
61 | { | 64 | { |
65 | IConfig restartConfig = config.Configs["RestartModule"]; | ||
66 | if (restartConfig != null) | ||
67 | { | ||
68 | m_MarkerPath = restartConfig.GetString("MarkerPath", String.Empty); | ||
69 | } | ||
62 | } | 70 | } |
63 | 71 | ||
64 | public void AddRegion(Scene scene) | 72 | public void AddRegion(Scene scene) |
65 | { | 73 | { |
74 | if (m_MarkerPath != String.Empty) | ||
75 | File.Delete(Path.Combine(m_MarkerPath, | ||
76 | scene.RegionInfo.RegionID.ToString())); | ||
77 | |||
66 | m_Scene = scene; | 78 | m_Scene = scene; |
67 | scene.RegisterModuleInterface<IRestartModule>(this); | 79 | scene.RegisterModuleInterface<IRestartModule>(this); |
68 | MainConsole.Instance.Commands.AddCommand("RestartModule", | 80 | MainConsole.Instance.Commands.AddCommand("RestartModule", |
@@ -114,6 +126,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
114 | 126 | ||
115 | if (alerts == null) | 127 | if (alerts == null) |
116 | { | 128 | { |
129 | CreateMarkerFile(); | ||
117 | m_Scene.RestartNow(); | 130 | m_Scene.RestartNow(); |
118 | return; | 131 | return; |
119 | } | 132 | } |
@@ -127,6 +140,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
127 | 140 | ||
128 | if (m_Alerts[0] == 0) | 141 | if (m_Alerts[0] == 0) |
129 | { | 142 | { |
143 | CreateMarkerFile(); | ||
130 | m_Scene.RestartNow(); | 144 | m_Scene.RestartNow(); |
131 | return; | 145 | return; |
132 | } | 146 | } |
@@ -140,6 +154,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
140 | { | 154 | { |
141 | if (m_Alerts.Count == 0 || m_Alerts[0] == 0) | 155 | if (m_Alerts.Count == 0 || m_Alerts[0] == 0) |
142 | { | 156 | { |
157 | CreateMarkerFile(); | ||
143 | m_Scene.RestartNow(); | 158 | m_Scene.RestartNow(); |
144 | return 0; | 159 | return 0; |
145 | } | 160 | } |
@@ -259,5 +274,25 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
259 | 274 | ||
260 | ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); | 275 | ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); |
261 | } | 276 | } |
277 | |||
278 | protected void CreateMarkerFile() | ||
279 | { | ||
280 | if (m_MarkerPath == String.Empty) | ||
281 | return; | ||
282 | |||
283 | string path = Path.Combine(m_MarkerPath, m_Scene.RegionInfo.RegionID.ToString()); | ||
284 | try | ||
285 | { | ||
286 | string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); | ||
287 | FileStream fs = File.Create(path); | ||
288 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
289 | Byte[] buf = enc.GetBytes(pidstring); | ||
290 | fs.Write(buf, 0, buf.Length); | ||
291 | fs.Close(); | ||
292 | } | ||
293 | catch (Exception) | ||
294 | { | ||
295 | } | ||
296 | } | ||
262 | } | 297 | } |
263 | } | 298 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 25d73c2..4611352 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -549,6 +549,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
549 | m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised()); | 549 | m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised()); |
550 | m_scene.SaveTerrain(); | 550 | m_scene.SaveTerrain(); |
551 | 551 | ||
552 | m_scene.EventManager.TriggerTerrainUpdate(); | ||
553 | |||
552 | // Clients who look at the map will never see changes after they looked at the map, so i've commented this out. | 554 | // Clients who look at the map will never see changes after they looked at the map, so i've commented this out. |
553 | //m_scene.CreateTerrainTexture(true); | 555 | //m_scene.CreateTerrainTexture(true); |
554 | } | 556 | } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 9f88517..d2c3afb 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -86,9 +86,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
86 | 86 | ||
87 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName) | 87 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName) |
88 | { | 88 | { |
89 | if (mapName.Length < 3) | 89 | if (mapName.Length < 2) |
90 | { | 90 | { |
91 | remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); | 91 | remoteClient.SendAlertMessage("Use a search string with at least 2 characters"); |
92 | return; | 92 | return; |
93 | } | 93 | } |
94 | 94 | ||