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
This commit is contained in:
Melanie
2012-04-07 04:52:14 +01:00
27 changed files with 963 additions and 376 deletions

View File

@@ -562,12 +562,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Finally, kill the agent we just created at the destination.
m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID);
sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout);
}
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
{
logout = false;
return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
bool success = m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
if (success)
sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout);
return success;
}
protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent)

View File

@@ -51,8 +51,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
private bool m_Initialized = false;
private bool m_RestrictInventoryAccessAbroad = false;
private GatekeeperServiceConnector m_GatekeeperConnector;
#region ISharedRegionModule
@@ -71,10 +69,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (name == Name)
{
InitialiseCommon(source);
IConfig transferConfig = source.Configs["HGEntityTransferModule"];
if (transferConfig != null)
m_RestrictInventoryAccessAbroad = transferConfig.GetBoolean("RestrictInventoryAccessAbroad", false);
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
}
}
@@ -94,34 +88,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
client.OnTeleportHomeRequest += TriggerTeleportHome;
client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed);
client.OnCompleteMovementToRegion += new Action<IClientAPI, bool>(OnCompleteMovementToRegion);
}
protected void OnCompleteMovementToRegion(IClientAPI client, bool arg2)
{
// HACK HACK -- just seeing how the viewer responds
// Let's send the Suitcase or the real root folder folder for incoming HG agents
// Visiting agents get their suitcase contents; incoming local users get their real root folder's content
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: OnCompleteMovementToRegion of user {0}", client.AgentId);
object sp = null;
if (client.Scene.TryGetScenePresence(client.AgentId, out sp))
{
if (sp is ScenePresence)
{
AgentCircuitData aCircuit = ((ScenePresence)sp).Scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId);
if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
{
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: ViaHGLogin");
if (m_RestrictInventoryAccessAbroad)
{
RestoreRootFolderContents(client);
}
}
}
}
}
public override void RegionLoaded(Scene scene)
{
base.RegionLoaded(scene);
@@ -131,12 +99,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService);
m_Initialized = true;
scene.AddCommand(
"HG", this, "send inventory",
"send inventory",
"Don't use this",
HandleSendInventory);
}
}
@@ -209,8 +171,8 @@ 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)
RemoveRootFolderContents(sp.ControllingClient);
if (success)
sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout);
return success;
}
@@ -221,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
}
return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason);
return base.CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout);
}
public void TriggerTeleportHome(UUID id, IClientAPI client)
@@ -330,15 +292,6 @@ 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)
{
RestoreRootFolderContents(sp.ControllingClient);
}
}
#endregion
#region IUserAgentVerificationModule
@@ -393,60 +346,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
#endregion
private void RemoveRootFolderContents(IClientAPI client)
{
// TODO tell the viewer to remove the root folder's content
if (client is IClientCore)
{
IClientCore core = (IClientCore)client;
IClientInventory inv;
if (core.TryGet<IClientInventory>(out inv))
{
InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId);
if (root != null)
{
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing root inventory for user {0}", client.AgentId);
InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID);
UUID[] ids = new UUID[content.Folders.Count];
int i = 0;
foreach (InventoryFolderBase f in content.Folders)
ids[i++] = f.ID;
inv.SendRemoveInventoryFolders(ids);
ids = new UUID[content.Items.Count];
i = 0;
foreach (InventoryItemBase it in content.Items)
ids[i++] = it.ID;
inv.SendRemoveInventoryItems(ids);
}
}
}
}
private void RestoreRootFolderContents(IClientAPI client)
{
if (client is IClientCore)
{
IClientCore core = (IClientCore)client;
IClientInventory inv;
if (core.TryGet<IClientInventory>(out inv))
{
InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId);
client.SendBulkUpdateInventory(root);
//if (root != null)
//{
// m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root inventory for user {0}", client.AgentId);
// InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID);
// m_log.DebugFormat("[XXX]: Folder name {0}, id {1}, parent {2}", root.Name, root.ID, root.ParentID);
// foreach (InventoryItemBase i in content.Items)
// m_log.DebugFormat("[XXX]: Name={0}, folderID={1}", i.Name, i.Folder);
// inv.SendBulkUpdateInventory(content.Folders.ToArray(), content.Items.ToArray());
//}
}
}
}
private GridRegion MakeRegion(AgentCircuitData aCircuit)
{
@@ -465,13 +364,5 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return region;
}
protected void HandleSendInventory(string module, string[] cmd)
{
m_Scenes[0].ForEachClient(delegate(IClientAPI client)
{
RestoreRootFolderContents(client);
});
}
}
}