diff options
author | Melanie | 2012-04-07 04:52:14 +0100 |
---|---|---|
committer | Melanie | 2012-04-07 04:52:14 +0100 |
commit | b39de2425cac4c2a94a7fdd6c77100ef831d66b4 (patch) | |
tree | 9258928681a82d68b408354e534c32bcf283ad3a /OpenSim/Region/CoreModules/Framework/EntityTransfer | |
parent | Merge branch 'ubitwork' (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.zip opensim-SC-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.tar.gz opensim-SC-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.tar.bz2 opensim-SC-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
OpenSim/Region/CoreModules/World/Land/LandObject.cs
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 115 |
2 files changed, 10 insertions, 113 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index b64d372..2b790f4 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -562,12 +562,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
562 | // Finally, kill the agent we just created at the destination. | 562 | // Finally, kill the agent we just created at the destination. |
563 | m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID); | 563 | m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID); |
564 | 564 | ||
565 | sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout); | ||
565 | } | 566 | } |
566 | 567 | ||
567 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) | 568 | protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) |
568 | { | 569 | { |
569 | logout = false; | 570 | logout = false; |
570 | return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); | 571 | bool success = m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); |
572 | |||
573 | if (success) | ||
574 | sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); | ||
575 | |||
576 | return success; | ||
571 | } | 577 | } |
572 | 578 | ||
573 | protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent) | 579 | protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent) |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 6fc8e4d..8b5ad23 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -51,8 +51,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
51 | 51 | ||
52 | private bool m_Initialized = false; | 52 | private bool m_Initialized = false; |
53 | 53 | ||
54 | private bool m_RestrictInventoryAccessAbroad = false; | ||
55 | |||
56 | private GatekeeperServiceConnector m_GatekeeperConnector; | 54 | private GatekeeperServiceConnector m_GatekeeperConnector; |
57 | 55 | ||
58 | #region ISharedRegionModule | 56 | #region ISharedRegionModule |
@@ -71,10 +69,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
71 | if (name == Name) | 69 | if (name == Name) |
72 | { | 70 | { |
73 | InitialiseCommon(source); | 71 | InitialiseCommon(source); |
74 | IConfig transferConfig = source.Configs["HGEntityTransferModule"]; | ||
75 | if (transferConfig != null) | ||
76 | m_RestrictInventoryAccessAbroad = transferConfig.GetBoolean("RestrictInventoryAccessAbroad", false); | ||
77 | |||
78 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); | 72 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); |
79 | } | 73 | } |
80 | } | 74 | } |
@@ -94,34 +88,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
94 | client.OnTeleportHomeRequest += TriggerTeleportHome; | 88 | client.OnTeleportHomeRequest += TriggerTeleportHome; |
95 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 89 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
96 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); | 90 | 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 | } | ||
122 | } | 91 | } |
123 | 92 | ||
124 | |||
125 | public override void RegionLoaded(Scene scene) | 93 | public override void RegionLoaded(Scene scene) |
126 | { | 94 | { |
127 | base.RegionLoaded(scene); | 95 | base.RegionLoaded(scene); |
@@ -131,12 +99,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
131 | m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService); | 99 | m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService); |
132 | m_Initialized = true; | 100 | m_Initialized = true; |
133 | 101 | ||
134 | scene.AddCommand( | ||
135 | "HG", this, "send inventory", | ||
136 | "send inventory", | ||
137 | "Don't use this", | ||
138 | HandleSendInventory); | ||
139 | |||
140 | } | 102 | } |
141 | 103 | ||
142 | } | 104 | } |
@@ -209,8 +171,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
209 | bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); | 171 | bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); |
210 | logout = success; // flag for later logout from this grid; this is an HG TP | 172 | logout = success; // flag for later logout from this grid; this is an HG TP |
211 | 173 | ||
212 | if (success && m_RestrictInventoryAccessAbroad) | 174 | if (success) |
213 | RemoveRootFolderContents(sp.ControllingClient); | 175 | sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); |
214 | 176 | ||
215 | return success; | 177 | return success; |
216 | } | 178 | } |
@@ -221,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
221 | } | 183 | } |
222 | } | 184 | } |
223 | 185 | ||
224 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | 186 | return base.CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout); |
225 | } | 187 | } |
226 | 188 | ||
227 | public void TriggerTeleportHome(UUID id, IClientAPI client) | 189 | public void TriggerTeleportHome(UUID id, IClientAPI client) |
@@ -330,15 +292,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
330 | 292 | ||
331 | } | 293 | } |
332 | 294 | ||
333 | protected override void Fail(ScenePresence sp, GridRegion finalDestination, bool logout) | ||
334 | { | ||
335 | base.Fail(sp, finalDestination, logout); | ||
336 | if (logout && m_RestrictInventoryAccessAbroad) | ||
337 | { | ||
338 | RestoreRootFolderContents(sp.ControllingClient); | ||
339 | } | ||
340 | } | ||
341 | |||
342 | #endregion | 295 | #endregion |
343 | 296 | ||
344 | #region IUserAgentVerificationModule | 297 | #region IUserAgentVerificationModule |
@@ -393,60 +346,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
393 | 346 | ||
394 | #endregion | 347 | #endregion |
395 | 348 | ||
396 | private void RemoveRootFolderContents(IClientAPI client) | ||
397 | { | ||
398 | // TODO tell the viewer to remove the root folder's content | ||
399 | if (client is IClientCore) | ||
400 | { | ||
401 | IClientCore core = (IClientCore)client; | ||
402 | IClientInventory inv; | ||
403 | |||
404 | if (core.TryGet<IClientInventory>(out inv)) | ||
405 | { | ||
406 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | ||
407 | if (root != null) | ||
408 | { | ||
409 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing root inventory for user {0}", client.AgentId); | ||
410 | InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); | ||
411 | UUID[] ids = new UUID[content.Folders.Count]; | ||
412 | int i = 0; | ||
413 | foreach (InventoryFolderBase f in content.Folders) | ||
414 | ids[i++] = f.ID; | ||
415 | inv.SendRemoveInventoryFolders(ids); | ||
416 | ids = new UUID[content.Items.Count]; | ||
417 | i = 0; | ||
418 | foreach (InventoryItemBase it in content.Items) | ||
419 | ids[i++] = it.ID; | ||
420 | inv.SendRemoveInventoryItems(ids); | ||
421 | } | ||
422 | } | ||
423 | } | ||
424 | } | ||
425 | |||
426 | private void RestoreRootFolderContents(IClientAPI client) | ||
427 | { | ||
428 | if (client is IClientCore) | ||
429 | { | ||
430 | IClientCore core = (IClientCore)client; | ||
431 | IClientInventory inv; | ||
432 | |||
433 | if (core.TryGet<IClientInventory>(out inv)) | ||
434 | { | ||
435 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | ||
436 | client.SendBulkUpdateInventory(root); | ||
437 | //if (root != null) | ||
438 | //{ | ||
439 | // m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root inventory for user {0}", client.AgentId); | ||
440 | // InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); | ||
441 | // m_log.DebugFormat("[XXX]: Folder name {0}, id {1}, parent {2}", root.Name, root.ID, root.ParentID); | ||
442 | // foreach (InventoryItemBase i in content.Items) | ||
443 | // m_log.DebugFormat("[XXX]: Name={0}, folderID={1}", i.Name, i.Folder); | ||
444 | |||
445 | // inv.SendBulkUpdateInventory(content.Folders.ToArray(), content.Items.ToArray()); | ||
446 | //} | ||
447 | } | ||
448 | } | ||
449 | } | ||
450 | 349 | ||
451 | private GridRegion MakeRegion(AgentCircuitData aCircuit) | 350 | private GridRegion MakeRegion(AgentCircuitData aCircuit) |
452 | { | 351 | { |
@@ -465,13 +364,5 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
465 | return region; | 364 | return region; |
466 | } | 365 | } |
467 | 366 | ||
468 | protected void HandleSendInventory(string module, string[] cmd) | ||
469 | { | ||
470 | m_Scenes[0].ForEachClient(delegate(IClientAPI client) | ||
471 | { | ||
472 | RestoreRootFolderContents(client); | ||
473 | }); | ||
474 | } | ||
475 | |||
476 | } | 367 | } |
477 | } | 368 | } |