diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 54 |
1 files changed, 44 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index b277095..4cdf303 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | 31 | ||
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Client; | ||
33 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenSim.Services.Connectors.Hypergrid; | 36 | using OpenSim.Services.Connectors.Hypergrid; |
@@ -177,9 +178,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
177 | logout = success; // flag for later logout from this grid; this is an HG TP | 178 | logout = success; // flag for later logout from this grid; this is an HG TP |
178 | 179 | ||
179 | if (success && m_RestrictInventoryAccessAbroad) | 180 | if (success && m_RestrictInventoryAccessAbroad) |
180 | { | 181 | RemoveRootFolderContents(sp.ControllingClient); |
181 | // TODO tell the viewer to remove the root folder | ||
182 | } | ||
183 | 182 | ||
184 | return success; | 183 | return success; |
185 | } | 184 | } |
@@ -299,13 +298,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
299 | base.Fail(sp, finalDestination, logout); | 298 | base.Fail(sp, finalDestination, logout); |
300 | if (logout && m_RestrictInventoryAccessAbroad) | 299 | if (logout && m_RestrictInventoryAccessAbroad) |
301 | { | 300 | { |
302 | // Restore the user's inventory, because we removed it earlier on | 301 | RestoreRootFolderContents(sp.ControllingClient); |
303 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(sp.UUID); | ||
304 | if (root != null) | ||
305 | { | ||
306 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring"); | ||
307 | sp.ControllingClient.SendBulkUpdateInventory(root); | ||
308 | } | ||
309 | } | 302 | } |
310 | } | 303 | } |
311 | 304 | ||
@@ -363,6 +356,47 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
363 | 356 | ||
364 | #endregion | 357 | #endregion |
365 | 358 | ||
359 | private void RemoveRootFolderContents(IClientAPI client) | ||
360 | { | ||
361 | // TODO tell the viewer to remove the root folder's content | ||
362 | if (client is IClientCore) | ||
363 | { | ||
364 | IClientCore core = (IClientCore)client; | ||
365 | IClientInventory inv; | ||
366 | |||
367 | if (core.TryGet<IClientInventory>(out inv)) | ||
368 | { | ||
369 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | ||
370 | if (root != null) | ||
371 | { | ||
372 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing root inventory"); | ||
373 | InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); | ||
374 | UUID[] ids = new UUID[content.Folders.Count]; | ||
375 | int i = 0; | ||
376 | foreach (InventoryFolderBase f in content.Folders) | ||
377 | ids[i++] = f.ID; | ||
378 | inv.SendRemoveInventoryFolders(ids); | ||
379 | ids = new UUID[content.Items.Count]; | ||
380 | i = 0; | ||
381 | foreach (InventoryItemBase it in content.Items) | ||
382 | ids[i++] = it.ID; | ||
383 | inv.SendRemoveInventoryItems(ids); | ||
384 | } | ||
385 | } | ||
386 | } | ||
387 | } | ||
388 | |||
389 | private void RestoreRootFolderContents(IClientAPI client) | ||
390 | { | ||
391 | // Restore the user's inventory, because we removed it earlier on | ||
392 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | ||
393 | if (root != null) | ||
394 | { | ||
395 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root inventory"); | ||
396 | client.SendBulkUpdateInventory(root); | ||
397 | } | ||
398 | } | ||
399 | |||
366 | private GridRegion MakeRegion(AgentCircuitData aCircuit) | 400 | private GridRegion MakeRegion(AgentCircuitData aCircuit) |
367 | { | 401 | { |
368 | GridRegion region = new GridRegion(); | 402 | GridRegion region = new GridRegion(); |