aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
diff options
context:
space:
mode:
authorDiva Canto2012-03-27 19:08:29 -0700
committerDiva Canto2012-03-27 19:08:29 -0700
commit300968e9339786611c9ac5c2ff3b58dec1c0c30e (patch)
tree85e4631fb95f94ea78ba3510e24627d3186664c5 /OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
parentAdd a corresponding method for items. HG v2 (diff)
downloadopensim-SC_OLD-300968e9339786611c9ac5c2ff3b58dec1c0c30e.zip
opensim-SC_OLD-300968e9339786611c9ac5c2ff3b58dec1c0c30e.tar.gz
opensim-SC_OLD-300968e9339786611c9ac5c2ff3b58dec1c0c30e.tar.bz2
opensim-SC_OLD-300968e9339786611c9ac5c2ff3b58dec1c0c30e.tar.xz
HG: Switch root folders from under the viewer. Towards HG 2.0. This is guarded by an obscure config that no one but me should be using at this point.
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs54
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;
30using System.Reflection; 30using System.Reflection;
31 31
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Client;
33using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
35using OpenSim.Services.Connectors.Hypergrid; 36using 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();