diff options
author | Diva Canto | 2012-03-28 15:01:37 -0700 |
---|---|---|
committer | Diva Canto | 2012-03-28 15:01:37 -0700 |
commit | 51dc1e709c1941c7a436fa50cf84a6381591b990 (patch) | |
tree | 1896055e4dcc5fba846f8d34ab2322fc916196ff /OpenSim/Region | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-51dc1e709c1941c7a436fa50cf84a6381591b990.zip opensim-SC_OLD-51dc1e709c1941c7a436fa50cf84a6381591b990.tar.gz opensim-SC_OLD-51dc1e709c1941c7a436fa50cf84a6381591b990.tar.bz2 opensim-SC_OLD-51dc1e709c1941c7a436fa50cf84a6381591b990.tar.xz |
HG 2.0: added the beginning of HGSuitcaseInventoryService. Plus moved the hack away from ScenePresence. This is better but it still doesn't restore the inventory upon arrival.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 68 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 16 |
2 files changed, 61 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 4cdf303..e8d821f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -71,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
71 | if (name == Name) | 71 | if (name == Name) |
72 | { | 72 | { |
73 | InitialiseCommon(source); | 73 | InitialiseCommon(source); |
74 | IConfig transferConfig = source.Configs["HGEntityTransfer"]; | 74 | IConfig transferConfig = source.Configs["HGEntityTransferModule"]; |
75 | if (transferConfig != null) | 75 | if (transferConfig != null) |
76 | m_RestrictInventoryAccessAbroad = transferConfig.GetBoolean("RestrictInventoryAccessAbroad", false); | 76 | m_RestrictInventoryAccessAbroad = transferConfig.GetBoolean("RestrictInventoryAccessAbroad", false); |
77 | 77 | ||
@@ -94,6 +94,31 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
94 | client.OnTeleportHomeRequest += TeleportHome; | 94 | client.OnTeleportHomeRequest += TeleportHome; |
95 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 95 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
96 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); | 96 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); |
97 | client.OnCompleteMovementToRegion += new Action<IClientAPI, bool>(OnCompleteMovementToRegion); | ||
98 | } | ||
99 | |||
100 | protected void OnCompleteMovementToRegion(IClientAPI client, bool arg2) | ||
101 | { | ||
102 | // HACK HACK -- just seeing how the viewer responds | ||
103 | // Let's send the Suitcase or the real root folder folder for incoming HG agents | ||
104 | // Visiting agents get their suitcase contents; incoming local users get their real root folder's content | ||
105 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: OnCompleteMovementToRegion of user {0}", client.AgentId); | ||
106 | object sp = null; | ||
107 | if (client.Scene.TryGetScenePresence(client.AgentId, out sp)) | ||
108 | { | ||
109 | if (sp is ScenePresence) | ||
110 | { | ||
111 | AgentCircuitData aCircuit = ((ScenePresence)sp).Scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId); | ||
112 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) | ||
113 | { | ||
114 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: ViaHGLogin"); | ||
115 | if (m_RestrictInventoryAccessAbroad) | ||
116 | { | ||
117 | RestoreRootFolderContents(client); | ||
118 | } | ||
119 | } | ||
120 | } | ||
121 | } | ||
97 | } | 122 | } |
98 | 123 | ||
99 | 124 | ||
@@ -105,6 +130,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
105 | { | 130 | { |
106 | m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService); | 131 | m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService); |
107 | m_Initialized = true; | 132 | m_Initialized = true; |
133 | |||
134 | scene.AddCommand( | ||
135 | "HG", this, "send inventory", | ||
136 | "send inventory", | ||
137 | "Don't use this", | ||
138 | HandleSendInventory); | ||
139 | |||
108 | } | 140 | } |
109 | 141 | ||
110 | } | 142 | } |
@@ -369,7 +401,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
369 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | 401 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); |
370 | if (root != null) | 402 | if (root != null) |
371 | { | 403 | { |
372 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing root inventory"); | 404 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing root inventory for user {0}", client.AgentId); |
373 | InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); | 405 | InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); |
374 | UUID[] ids = new UUID[content.Folders.Count]; | 406 | UUID[] ids = new UUID[content.Folders.Count]; |
375 | int i = 0; | 407 | int i = 0; |
@@ -388,12 +420,25 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
388 | 420 | ||
389 | private void RestoreRootFolderContents(IClientAPI client) | 421 | private void RestoreRootFolderContents(IClientAPI client) |
390 | { | 422 | { |
391 | // Restore the user's inventory, because we removed it earlier on | 423 | if (client is IClientCore) |
392 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | ||
393 | if (root != null) | ||
394 | { | 424 | { |
395 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root inventory"); | 425 | IClientCore core = (IClientCore)client; |
396 | client.SendBulkUpdateInventory(root); | 426 | IClientInventory inv; |
427 | |||
428 | if (core.TryGet<IClientInventory>(out inv)) | ||
429 | { | ||
430 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | ||
431 | if (root != null) | ||
432 | { | ||
433 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root inventory for user {0}", client.AgentId); | ||
434 | InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); | ||
435 | m_log.DebugFormat("[XXX]: Folder name {0}, id {1}, parent {2}", root.Name, root.ID, root.ParentID); | ||
436 | foreach (InventoryItemBase i in content.Items) | ||
437 | m_log.DebugFormat("[XXX]: Name={0}, folderID={1}", i.Name, i.Folder); | ||
438 | |||
439 | inv.SendBulkUpdateInventory(content.Folders.ToArray(), content.Items.ToArray()); | ||
440 | } | ||
441 | } | ||
397 | } | 442 | } |
398 | } | 443 | } |
399 | 444 | ||
@@ -413,5 +458,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
413 | region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); | 458 | region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); |
414 | return region; | 459 | return region; |
415 | } | 460 | } |
461 | |||
462 | protected void HandleSendInventory(string module, string[] cmd) | ||
463 | { | ||
464 | m_Scenes[0].ForEachClient(delegate(IClientAPI client) | ||
465 | { | ||
466 | RestoreRootFolderContents(client); | ||
467 | }); | ||
468 | } | ||
469 | |||
416 | } | 470 | } |
417 | } | 471 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 547f66f..19dab32 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1163,22 +1163,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1163 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); | 1163 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | // HACK HACK -- just seeing how the viewer responds | ||
1167 | // Let's send the Suitcase or the real root folder folder for incoming HG agents | ||
1168 | // Visiting agents get their suitcase contents; incoming local users get their real root folder's content | ||
1169 | AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(UUID); | ||
1170 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) | ||
1171 | { | ||
1172 | // HACK FOR NOW. JUST TESTING, SO KEEPING EVERYONE ELSE OUT OF THESE TESTS | ||
1173 | IConfig config = m_scene.Config.Configs["HGEntityTransferModule"]; | ||
1174 | if (config != null && config.GetBoolean("RestrictInventoryAccessAbroad", false)) | ||
1175 | { | ||
1176 | m_log.DebugFormat("[SCENE]: Sending root folder to viewer..."); | ||
1177 | InventoryFolderBase root = m_scene.InventoryService.GetRootFolder(client.AgentId); | ||
1178 | //InventoryCollection rootContents = InventoryService.GetFolderContent(client.AgentId, root.ID); | ||
1179 | client.SendBulkUpdateInventory(root); | ||
1180 | } | ||
1181 | } | ||
1182 | 1166 | ||
1183 | // m_log.DebugFormat( | 1167 | // m_log.DebugFormat( |
1184 | // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", | 1168 | // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", |