mirror of
https://github.com/opensim/opensim.git
synced 2026-08-13 13:15:44 +08:00
Merge branch 'master' into careminster
This commit is contained in:
@@ -30,6 +30,7 @@ using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Client;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Connectors.Hypergrid;
|
||||
@@ -177,9 +178,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
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
|
||||
}
|
||||
RemoveRootFolderContents(sp.ControllingClient);
|
||||
|
||||
return success;
|
||||
}
|
||||
@@ -304,13 +303,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
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);
|
||||
}
|
||||
RestoreRootFolderContents(sp.ControllingClient);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,6 +361,47 @@ 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");
|
||||
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)
|
||||
{
|
||||
// Restore the user's inventory, because we removed it earlier on
|
||||
InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId);
|
||||
if (root != null)
|
||||
{
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root inventory");
|
||||
client.SendBulkUpdateInventory(root);
|
||||
}
|
||||
}
|
||||
|
||||
private GridRegion MakeRegion(AgentCircuitData aCircuit)
|
||||
{
|
||||
GridRegion region = new GridRegion();
|
||||
|
||||
@@ -297,6 +297,35 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
|
||||
#region IUserManagement
|
||||
|
||||
public UUID GetUserIdByName(string name)
|
||||
{
|
||||
string[] parts = name.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (parts.Length < 2)
|
||||
throw new Exception("Name must have 2 components");
|
||||
|
||||
return GetUserIdByName(parts[0], parts[1]);
|
||||
}
|
||||
|
||||
public UUID GetUserIdByName(string firstName, string lastName)
|
||||
{
|
||||
// TODO: Optimize for reverse lookup if this gets used by non-console commands.
|
||||
lock (m_UserCache)
|
||||
{
|
||||
foreach (UserData user in m_UserCache.Values)
|
||||
{
|
||||
if (user.FirstName == firstName && user.LastName == lastName)
|
||||
return user.Id;
|
||||
}
|
||||
}
|
||||
|
||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName);
|
||||
|
||||
if (account != null)
|
||||
return account.PrincipalID;
|
||||
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
public string GetUserName(UUID uuid)
|
||||
{
|
||||
string[] names = GetUserNames(uuid);
|
||||
|
||||
Reference in New Issue
Block a user