aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
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
parentAdd a corresponding method for items. HG v2 (diff)
downloadopensim-SC-300968e9339786611c9ac5c2ff3b58dec1c0c30e.zip
opensim-SC-300968e9339786611c9ac5c2ff3b58dec1c0c30e.tar.gz
opensim-SC-300968e9339786611c9ac5c2ff3b58dec1c0c30e.tar.bz2
opensim-SC-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 '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs54
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs15
2 files changed, 55 insertions, 14 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();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0b31e0c..1f5cddd 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2675,12 +2675,19 @@ namespace OpenSim.Region.Framework.Scenes
2675 // Cache the user's name 2675 // Cache the user's name
2676 CacheUserName(sp, aCircuit); 2676 CacheUserName(sp, aCircuit);
2677 2677
2678 // Let's send the Suitcase folder for incoming HG agents 2678 // Let's send the Suitcase or the real root folder folder for incoming HG agents
2679 // Visiting agents get their suitcase contents; incoming local users get their real root folder's content
2679 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) 2680 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
2680 { 2681 {
2681 m_log.DebugFormat("[SCENE]: Sending root folder to viewer..."); 2682 // HACK FOR NOW. JUST TESTING, SO KEEPING EVERYONE ELSE OUT OF THESE TESTS
2682 InventoryFolderBase suitcase = InventoryService.GetRootFolder(client.AgentId); 2683 IConfig config = m_config.Configs["HGEntityTransfer"];
2683 client.SendBulkUpdateInventory(suitcase); 2684 if (config != null && config.GetBoolean("RestrictInventoryAccessAbroad", false))
2685 {
2686 m_log.DebugFormat("[SCENE]: Sending root folder to viewer...");
2687 InventoryFolderBase root = InventoryService.GetRootFolder(client.AgentId);
2688 //InventoryCollection rootContents = InventoryService.GetFolderContent(client.AgentId, root.ID);
2689 client.SendBulkUpdateInventory(root);
2690 }
2684 } 2691 }
2685 2692
2686 EventManager.TriggerOnNewClient(client); 2693 EventManager.TriggerOnNewClient(client);