diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 78 |
1 files changed, 56 insertions, 22 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index ec260b4..0f422ae 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -114,7 +114,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
114 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: ViaHGLogin"); | 114 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: ViaHGLogin"); |
115 | if (m_RestrictInventoryAccessAbroad) | 115 | if (m_RestrictInventoryAccessAbroad) |
116 | { | 116 | { |
117 | RestoreRootFolderContents(client); | 117 | IUserManagement uMan = m_Scenes[0].RequestModuleInterface<IUserManagement>(); |
118 | if (uMan.IsLocalGridUser(client.AgentId)) | ||
119 | { | ||
120 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); | ||
121 | RestoreRootFolderContents(client); | ||
122 | } | ||
123 | else | ||
124 | { | ||
125 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is foreign"); | ||
126 | RestoreSuitcaseFolderContents(client); | ||
127 | } | ||
118 | } | 128 | } |
119 | } | 129 | } |
120 | } | 130 | } |
@@ -210,7 +220,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
210 | logout = success; // flag for later logout from this grid; this is an HG TP | 220 | logout = success; // flag for later logout from this grid; this is an HG TP |
211 | 221 | ||
212 | if (success && m_RestrictInventoryAccessAbroad) | 222 | if (success && m_RestrictInventoryAccessAbroad) |
213 | RemoveRootFolderContents(sp.ControllingClient); | 223 | { |
224 | IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>(); | ||
225 | if (uMan != null && uMan.IsLocalGridUser(sp.UUID)) | ||
226 | { | ||
227 | // local grid user | ||
228 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); | ||
229 | RemoveRootFolderContents(sp.ControllingClient); | ||
230 | } | ||
231 | else | ||
232 | { | ||
233 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is foreign"); | ||
234 | RemoveSuitcaseFolderContents(sp.ControllingClient); | ||
235 | } | ||
236 | } | ||
214 | 237 | ||
215 | return success; | 238 | return success; |
216 | } | 239 | } |
@@ -401,25 +424,40 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
401 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | 424 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); |
402 | if (root != null) | 425 | if (root != null) |
403 | { | 426 | { |
404 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing root inventory for user {0}", client.AgentId); | 427 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing root inventory for user {0}", client.Name); |
405 | InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); | 428 | InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); |
406 | UUID[] ids = new UUID[content.Folders.Count]; | 429 | List<UUID> fids = new List<UUID>(); |
407 | int i = 0; | 430 | List<UUID> iids = new List<UUID>(); |
431 | List<InventoryFolderBase> keep = new List<InventoryFolderBase>(); | ||
432 | |||
408 | foreach (InventoryFolderBase f in content.Folders) | 433 | foreach (InventoryFolderBase f in content.Folders) |
409 | ids[i++] = f.ID; | 434 | { |
410 | inv.SendRemoveInventoryFolders(ids); | 435 | if (f.Name != "My Suitcase") |
411 | ids = new UUID[content.Items.Count]; | 436 | { |
412 | i = 0; | 437 | f.Name = f.Name + " (Unavailable)"; |
438 | keep.Add(f); | ||
439 | } | ||
440 | } | ||
441 | |||
442 | // items directly under the root folder | ||
413 | foreach (InventoryItemBase it in content.Items) | 443 | foreach (InventoryItemBase it in content.Items) |
414 | ids[i++] = it.ID; | 444 | it.Name = it.Name + " (Unavailable)"; ; |
415 | inv.SendRemoveInventoryItems(ids); | 445 | |
446 | // Send the new names | ||
447 | inv.SendBulkUpdateInventory(keep.ToArray(), content.Items.ToArray()); | ||
448 | |||
416 | } | 449 | } |
417 | } | 450 | } |
418 | } | 451 | } |
419 | } | 452 | } |
420 | 453 | ||
454 | private void RemoveSuitcaseFolderContents(IClientAPI client) | ||
455 | { | ||
456 | } | ||
457 | |||
421 | private void RestoreRootFolderContents(IClientAPI client) | 458 | private void RestoreRootFolderContents(IClientAPI client) |
422 | { | 459 | { |
460 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root folder"); | ||
423 | if (client is IClientCore) | 461 | if (client is IClientCore) |
424 | { | 462 | { |
425 | IClientCore core = (IClientCore)client; | 463 | IClientCore core = (IClientCore)client; |
@@ -428,21 +466,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
428 | if (core.TryGet<IClientInventory>(out inv)) | 466 | if (core.TryGet<IClientInventory>(out inv)) |
429 | { | 467 | { |
430 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | 468 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); |
431 | client.SendBulkUpdateInventory(root); | 469 | InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); |
432 | //if (root != null) | 470 | |
433 | //{ | 471 | inv.SendBulkUpdateInventory(content.Folders.ToArray(), content.Items.ToArray()); |
434 | // m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root inventory for user {0}", client.AgentId); | ||
435 | // InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); | ||
436 | // m_log.DebugFormat("[XXX]: Folder name {0}, id {1}, parent {2}", root.Name, root.ID, root.ParentID); | ||
437 | // foreach (InventoryItemBase i in content.Items) | ||
438 | // m_log.DebugFormat("[XXX]: Name={0}, folderID={1}", i.Name, i.Folder); | ||
439 | |||
440 | // inv.SendBulkUpdateInventory(content.Folders.ToArray(), content.Items.ToArray()); | ||
441 | //} | ||
442 | } | 472 | } |
443 | } | 473 | } |
444 | } | 474 | } |
445 | 475 | ||
476 | private void RestoreSuitcaseFolderContents(IClientAPI client) | ||
477 | { | ||
478 | } | ||
479 | |||
446 | private GridRegion MakeRegion(AgentCircuitData aCircuit) | 480 | private GridRegion MakeRegion(AgentCircuitData aCircuit) |
447 | { | 481 | { |
448 | GridRegion region = new GridRegion(); | 482 | GridRegion region = new GridRegion(); |