diff options
author | Melanie | 2012-03-29 00:27:35 +0100 |
---|---|---|
committer | Melanie | 2012-03-29 00:27:35 +0100 |
commit | 7dad1ded2e969d50dd7a1bce9a219fb8ba6c760f (patch) | |
tree | b09be52d5e7838b7c187c92f08f6c2bc73741a42 /OpenSim/Region/CoreModules/Framework/EntityTransfer | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Add comment about setting client.SceneAgent in AddNewClient() (diff) | |
download | opensim-SC-7dad1ded2e969d50dd7a1bce9a219fb8ba6c760f.zip opensim-SC-7dad1ded2e969d50dd7a1bce9a219fb8ba6c760f.tar.gz opensim-SC-7dad1ded2e969d50dd7a1bce9a219fb8ba6c760f.tar.bz2 opensim-SC-7dad1ded2e969d50dd7a1bce9a219fb8ba6c760f.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 69 |
1 files changed, 62 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index aaba7fd..6fc8e4d 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 += TriggerTeleportHome; | 94 | client.OnTeleportHomeRequest += TriggerTeleportHome; |
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 | } |
@@ -374,7 +406,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
374 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | 406 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); |
375 | if (root != null) | 407 | if (root != null) |
376 | { | 408 | { |
377 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing root inventory"); | 409 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing root inventory for user {0}", client.AgentId); |
378 | InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); | 410 | InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); |
379 | UUID[] ids = new UUID[content.Folders.Count]; | 411 | UUID[] ids = new UUID[content.Folders.Count]; |
380 | int i = 0; | 412 | int i = 0; |
@@ -393,12 +425,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
393 | 425 | ||
394 | private void RestoreRootFolderContents(IClientAPI client) | 426 | private void RestoreRootFolderContents(IClientAPI client) |
395 | { | 427 | { |
396 | // Restore the user's inventory, because we removed it earlier on | 428 | if (client is IClientCore) |
397 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | ||
398 | if (root != null) | ||
399 | { | 429 | { |
400 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root inventory"); | 430 | IClientCore core = (IClientCore)client; |
401 | client.SendBulkUpdateInventory(root); | 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 | } | ||
402 | } | 448 | } |
403 | } | 449 | } |
404 | 450 | ||
@@ -418,5 +464,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
418 | region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); | 464 | region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); |
419 | return region; | 465 | return region; |
420 | } | 466 | } |
467 | |||
468 | protected void HandleSendInventory(string module, string[] cmd) | ||
469 | { | ||
470 | m_Scenes[0].ForEachClient(delegate(IClientAPI client) | ||
471 | { | ||
472 | RestoreRootFolderContents(client); | ||
473 | }); | ||
474 | } | ||
475 | |||
421 | } | 476 | } |
422 | } | 477 | } |