HG: beginning of a more restrictive inventory access procedure (optional). Experimental: we'll try switching the root folder from under the viewer.

0.7.3-extended
Diva Canto 2012-03-27 11:54:13 -07:00 committed by Justin Clark-Casey (justincc)
parent 79d1d3ca55
commit 89ee03a24d
3 changed files with 37 additions and 3 deletions

View File

@ -467,7 +467,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
"[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Returning avatar to source region.",
sp.Name, finalDestination.RegionName);
Fail(sp, finalDestination);
Fail(sp, finalDestination, logout);
return;
}
@ -499,7 +499,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
"[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} failed due to no callback from destination region. Returning avatar to source region.",
sp.Name, finalDestination.RegionName);
Fail(sp, finalDestination);
Fail(sp, finalDestination, logout);
return;
}
@ -550,7 +550,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
}
private void Fail(ScenePresence sp, GridRegion finalDestination)
protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout)
{
// Client never contacted destination. Let's restore everything back
sp.ControllingClient.SendTeleportFailed("Problems connecting to destination.");

View File

@ -50,6 +50,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
private bool m_Initialized = false;
private bool m_RestrictInventoryAccessAbroad = false;
private GatekeeperServiceConnector m_GatekeeperConnector;
#region ISharedRegionModule
@ -68,6 +70,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (name == Name)
{
InitialiseCommon(source);
IConfig transferConfig = source.Configs["HGEntityTransfer"];
if (transferConfig != null)
m_RestrictInventoryAccessAbroad = transferConfig.GetBoolean("RestrictInventoryAccessAbroad", false);
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
}
}
@ -170,6 +176,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason);
logout = success; // flag for later logout from this grid; this is an HG TP
if (success && m_RestrictInventoryAccessAbroad)
{
// TODO tell the viewer to remove the root folder
}
return success;
}
else
@ -284,6 +295,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
protected override void Fail(ScenePresence sp, GridRegion finalDestination, bool logout)
{
base.Fail(sp, finalDestination, logout);
if (logout && m_RestrictInventoryAccessAbroad)
{
// Restore the user's inventory, because we removed it earlier on
InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(sp.UUID);
if (root != null)
{
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring");
sp.ControllingClient.SendBulkUpdateInventory(root);
}
}
}
#endregion
#region IUserAgentVerificationModule

View File

@ -2664,6 +2664,14 @@ namespace OpenSim.Region.Framework.Scenes
// Cache the user's name
CacheUserName(sp, aCircuit);
// Let's send the Suitcase folder for incoming HG agents
if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
{
m_log.DebugFormat("[SCENE]: Sending root folder to viewer...");
InventoryFolderBase suitcase = InventoryService.GetRootFolder(client.AgentId);
client.SendBulkUpdateInventory(suitcase);
}
EventManager.TriggerOnNewClient(client);
if (vialogin)
EventManager.TriggerOnClientLogin(client);