Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-06-07 00:44:36 +01:00
commit 74d62901c8
9 changed files with 252 additions and 142 deletions

View File

@ -268,7 +268,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (m_Friends.ContainsKey(agentID)) if (m_Friends.ContainsKey(agentID))
{ {
if (m_Friends[agentID].RegionID == UUID.Zero && m_Friends[agentID].Friends == null) if (m_Friends[agentID].RegionID == UUID.Zero)
{ {
m_Friends[agentID].Friends = m_Friends[agentID].Friends =
m_FriendsService.GetFriends(agentID); m_FriendsService.GetFriends(agentID);

View File

@ -97,9 +97,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
int successfulAssetRestores = 0; int successfulAssetRestores = 0;
int failedAssetRestores = 0; int failedAssetRestores = 0;
int successfulItemRestores = 0; int successfulItemRestores = 0;
List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
List<InventoryNodeBase> loadedNodes = new List<InventoryNodeBase>();
//InventoryFolderImpl rootDestinationFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);
InventoryFolderBase rootDestinationFolder InventoryFolderBase rootDestinationFolder
= InventoryArchiveUtils.FindFolderByPath( = InventoryArchiveUtils.FindFolderByPath(
m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath); m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath);
@ -109,14 +109,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// Possibly provide an option later on to automatically create this folder if it does not exist // Possibly provide an option later on to automatically create this folder if it does not exist
m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath); m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
return nodesLoaded; return loadedNodes;
} }
archive = new TarArchiveReader(m_loadStream); archive = new TarArchiveReader(m_loadStream);
// In order to load identically named folders, we need to keep track of the folders that we have already // In order to load identically named folders, we need to keep track of the folders that we have already
// created // resolved
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); Dictionary <string, InventoryFolderBase> resolvedFolders = new Dictionary<string, InventoryFolderBase>();
byte[] data; byte[] data;
TarArchiveReader.TarEntryType entryType; TarArchiveReader.TarEntryType entryType;
@ -139,10 +139,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
} }
else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH)) else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH))
{ {
filePath = filePath.Substring(ArchiveConstants.INVENTORY_PATH.Length);
// Trim off the file portion if we aren't already dealing with a directory path
if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
filePath = filePath.Remove(filePath.LastIndexOf("/") + 1);
InventoryFolderBase foundFolder InventoryFolderBase foundFolder
= ReplicateArchivePathToUserInventory( = ReplicateArchivePathToUserInventory(
filePath, TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType, filePath, rootDestinationFolder, resolvedFolders, loadedNodes);
rootDestinationFolder, foldersCreated, nodesLoaded);
if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType) if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
{ {
@ -155,7 +160,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// If we're loading an item directly into the given destination folder then we need to record // If we're loading an item directly into the given destination folder then we need to record
// it separately from any loaded root folders // it separately from any loaded root folders
if (rootDestinationFolder == foundFolder) if (rootDestinationFolder == foundFolder)
nodesLoaded.Add(item); loadedNodes.Add(item);
} }
} }
} }
@ -171,7 +176,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
successfulAssetRestores, failedAssetRestores); successfulAssetRestores, failedAssetRestores);
m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores); m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
return nodesLoaded; return loadedNodes;
} }
public void Close() public void Close()
@ -184,126 +189,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// Replicate the inventory paths in the archive to the user's inventory as necessary. /// Replicate the inventory paths in the archive to the user's inventory as necessary.
/// </summary> /// </summary>
/// <param name="archivePath">The item archive path to replicate</param> /// <param name="archivePath">The item archive path to replicate</param>
/// <param name="isDir">Is the path we're dealing with a directory?</param>
/// <param name="rootDestinationFolder">The root folder for the inventory load</param> /// <param name="rootDestinationFolder">The root folder for the inventory load</param>
/// <param name="foldersCreated"> /// <param name="resolvedFolders">
/// The folders created so far. This method will add more folders if necessary /// The folders that we have resolved so far for a given archive path.
/// This method will add more folders if necessary
/// </param> /// </param>
/// <param name="nodesLoaded"> /// <param name="loadedNodes">
/// Track the inventory nodes created. This is distinct from the folders created since for a particular folder /// Track the inventory nodes created.
/// chain, only the root node needs to be recorded
/// </param> /// </param>
/// <returns>The last user inventory folder created or found for the archive path</returns> /// <returns>The last user inventory folder created or found for the archive path</returns>
public InventoryFolderBase ReplicateArchivePathToUserInventory( public InventoryFolderBase ReplicateArchivePathToUserInventory(
string archivePath, string archivePath,
bool isDir,
InventoryFolderBase rootDestFolder, InventoryFolderBase rootDestFolder,
Dictionary <string, InventoryFolderBase> foldersCreated, Dictionary <string, InventoryFolderBase> resolvedFolders,
List<InventoryNodeBase> nodesLoaded) List<InventoryNodeBase> loadedNodes)
{ {
archivePath = archivePath.Substring(ArchiveConstants.INVENTORY_PATH.Length);
// Remove the file portion if we aren't already dealing with a directory path
if (!isDir)
archivePath = archivePath.Remove(archivePath.LastIndexOf("/") + 1);
string originalArchivePath = archivePath; string originalArchivePath = archivePath;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[INVENTORY ARCHIVER]: Loading folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID); // "[INVENTORY ARCHIVER]: Loading folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID);
InventoryFolderBase destFolder = null; InventoryFolderBase destFolder = ResolveDestinationFolder(rootDestFolder, ref archivePath, resolvedFolders);
// XXX: Nasty way of dealing with a path that has no directory component // m_log.DebugFormat(
if (archivePath.Length > 0) // "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]",
{ // originalArchivePath, archivePath);
while (null == destFolder && archivePath.Length > 0)
{
if (foldersCreated.ContainsKey(archivePath))
{
// m_log.DebugFormat(
// "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath);
destFolder = foldersCreated[archivePath];
}
else
{
// Don't include the last slash
int penultimateSlashIndex = archivePath.LastIndexOf("/", archivePath.Length - 2);
if (penultimateSlashIndex >= 0)
{
archivePath = archivePath.Remove(penultimateSlashIndex + 1);
}
else
{
m_log.DebugFormat(
"[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}",
originalArchivePath);
archivePath = string.Empty;
destFolder = rootDestFolder;
}
}
}
}
else
{
destFolder = rootDestFolder;
}
string archivePathSectionToCreate = originalArchivePath.Substring(archivePath.Length); string archivePathSectionToCreate = originalArchivePath.Substring(archivePath.Length);
string[] rawDirsToCreate CreateFoldersForPath(destFolder, archivePathSectionToCreate, resolvedFolders, loadedNodes);
= archivePathSectionToCreate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
int i = 0;
while (i < rawDirsToCreate.Length)
{
m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading archived folder {0}", rawDirsToCreate[i]);
int identicalNameIdentifierIndex
= rawDirsToCreate[i].LastIndexOf(
ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
if (identicalNameIdentifierIndex < 0)
{
i++;
continue;
}
string newFolderName = rawDirsToCreate[i].Remove(identicalNameIdentifierIndex);
newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName);
UUID newFolderId = UUID.Random();
// Asset type has to be Unknown here rather than Folder, otherwise the created folder can't be
// deleted once the client has relogged.
// The root folder appears to be labelled AssetType.Folder (shows up as "Category" in the client)
// even though there is a AssetType.RootCategory
destFolder
= new InventoryFolderBase(
newFolderId, newFolderName, m_userInfo.PrincipalID,
(short)AssetType.Unknown, destFolder.ID, 1);
m_scene.InventoryService.AddFolder(destFolder);
// UUID newFolderId = UUID.Random();
// m_scene.InventoryService.AddFolder(
// m_userInfo.CreateFolder(
// folderName, newFolderId, (ushort)AssetType.Folder, foundFolder.ID);
// m_log.DebugFormat("[INVENTORY ARCHIVER]: Retrieving newly created folder {0}", folderName);
// foundFolder = foundFolder.GetChildFolder(newFolderId);
// m_log.DebugFormat(
// "[INVENTORY ARCHIVER]: Retrieved newly created folder {0} with ID {1}",
// foundFolder.Name, foundFolder.ID);
// Record that we have now created this folder
archivePath += rawDirsToCreate[i] + "/";
m_log.DebugFormat("[INVENTORY ARCHIVER]: Loaded archive path {0}", archivePath);
foldersCreated[archivePath] = destFolder;
if (0 == i)
nodesLoaded.Add(destFolder);
i++;
}
return destFolder; return destFolder;
@ -342,6 +255,136 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
*/ */
} }
/// <summary>
/// Resolve a destination folder
/// </summary>
///
/// We require here a root destination folder (usually the root of the user's inventory) and the archive
/// path. We also pass in a list of previously resolved folders in case we've found this one previously.
///
/// <param name="archivePath">
/// The item archive path to resolve. The portion of the path passed back is that
/// which corresponds to the resolved desintation folder.
/// <param name="rootDestinationFolder">
/// The root folder for the inventory load
/// </param>
/// <param name="resolvedFolders">
/// The folders that we have resolved so far for a given archive path.
/// </param>
/// <returns>
/// The folder in the user's inventory that matches best the archive path given. If no such folder was found
/// then the passed in root destination folder is returned.
/// </returns>
protected InventoryFolderBase ResolveDestinationFolder(
InventoryFolderBase rootDestFolder,
ref string archivePath,
Dictionary <string, InventoryFolderBase> resolvedFolders)
{
string originalArchivePath = archivePath;
InventoryFolderBase destFolder = null;
if (archivePath.Length > 0)
{
while (null == destFolder && archivePath.Length > 0)
{
if (resolvedFolders.ContainsKey(archivePath))
{
// m_log.DebugFormat(
// "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath);
destFolder = resolvedFolders[archivePath];
}
else
{
// Don't include the last slash so find the penultimate one
int penultimateSlashIndex = archivePath.LastIndexOf("/", archivePath.Length - 2);
if (penultimateSlashIndex >= 0)
{
// Remove the last section of path so that we can see if we've already resolved the parent
archivePath = archivePath.Remove(penultimateSlashIndex + 1);
}
else
{
m_log.DebugFormat(
"[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}",
originalArchivePath);
archivePath = string.Empty;
destFolder = rootDestFolder;
}
}
}
}
if (null == destFolder)
destFolder = rootDestFolder;
return destFolder;
}
/// <summary>
/// Create a set of folders for the given path.
/// </summary>
/// <param name="destFolder">
/// The root folder from which the creation will take place.
/// </param>
/// <param name="path">
/// The path to create
/// </param>
/// <param name="resolvedFolders">
/// The folders that we have resolved so far for a given archive path.
/// </param>
/// <param name="loadedNodes">
/// Track the inventory nodes created.
/// </param>
protected void CreateFoldersForPath(
InventoryFolderBase destFolder, string path, Dictionary <string, InventoryFolderBase> resolvedFolders,
List<InventoryNodeBase> loadedNodes)
{
string pathCreated = "";
string[] rawDirsToCreate = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
int i = 0;
while (i < rawDirsToCreate.Length)
{
// m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0} from IAR", rawDirsToCreate[i]);
int identicalNameIdentifierIndex
= rawDirsToCreate[i].LastIndexOf(
ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
if (identicalNameIdentifierIndex < 0)
{
i++;
continue;
}
string newFolderName = rawDirsToCreate[i].Remove(identicalNameIdentifierIndex);
newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName);
UUID newFolderId = UUID.Random();
// Asset type has to be Unknown here rather than Folder, otherwise the created folder can't be
// deleted once the client has relogged.
// The root folder appears to be labelled AssetType.Folder (shows up as "Category" in the client)
// even though there is a AssetType.RootCategory
destFolder
= new InventoryFolderBase(
newFolderId, newFolderName, m_userInfo.PrincipalID,
(short)AssetType.Unknown, destFolder.ID, 1);
m_scene.InventoryService.AddFolder(destFolder);
// Record that we have now created this folder
pathCreated += rawDirsToCreate[i] + "/";
m_log.DebugFormat("[INVENTORY ARCHIVER]: Created folder {0} from IAR", pathCreated);
resolvedFolders[pathCreated] = destFolder;
if (0 == i)
loadedNodes.Add(destFolder);
i++;
}
}
/// <summary> /// <summary>
/// Load an item from the archive /// Load an item from the archive
/// </summary> /// </summary>
@ -432,4 +475,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
} }
} }
} }
} }

View File

@ -30,11 +30,11 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using NDesk.Options;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
@ -91,9 +91,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
scene.AddCommand( scene.AddCommand(
this, "load iar", this, "load iar",
"load iar <first> <last> <inventory path> <password> [<IAR path>]", "load iar <first> <last> <inventory path> <password> [<IAR path>]",
//"load iar [--merge] <first> <last> <inventory path> <password> [<IAR path>]",
"Load user inventory archive (IAR).", "Load user inventory archive (IAR).",
"<first> is user's first name." + Environment.NewLine //"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
//+ "<first> is user's first name." + Environment.NewLine
"<first> is user's first name." + Environment.NewLine
+ "<last> is user's last name." + Environment.NewLine + "<last> is user's last name." + Environment.NewLine
+ "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine + "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine
+ "<password> is the user's password." + Environment.NewLine + "<password> is the user's password." + Environment.NewLine
@ -133,8 +136,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (handlerInventoryArchiveSaved != null) if (handlerInventoryArchiveSaved != null)
handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException);
} }
public bool ArchiveInventory(
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream)
{
return ArchiveInventory(id, firstName, lastName, invPath, pass, saveStream, new Dictionary<string, object>());
}
public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) public bool ArchiveInventory(
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
Dictionary<string, object> options)
{ {
if (m_scenes.Count > 0) if (m_scenes.Count > 0)
{ {
@ -172,7 +183,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
return false; return false;
} }
public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, string savePath) public bool ArchiveInventory(
Guid id, string firstName, string lastName, string invPath, string pass, string savePath,
Dictionary<string, object> options)
{ {
if (m_scenes.Count > 0) if (m_scenes.Count > 0)
{ {
@ -209,8 +222,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
return false; return false;
} }
public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream) public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream)
{
return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>());
}
public bool DearchiveInventory(
string firstName, string lastName, string invPath, string pass, Stream loadStream,
Dictionary<string, object> options)
{ {
if (m_scenes.Count > 0) if (m_scenes.Count > 0)
{ {
@ -252,7 +272,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
return false; return false;
} }
public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, string loadPath) public bool DearchiveInventory(
string firstName, string lastName, string invPath, string pass, string loadPath,
Dictionary<string, object> options)
{ {
if (m_scenes.Count > 0) if (m_scenes.Count > 0)
{ {
@ -300,29 +322,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// <param name="cmdparams"></param> /// <param name="cmdparams"></param>
protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams) protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
{ {
if (cmdparams.Length < 6) m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
Dictionary<string, object> options = new Dictionary<string, object>();
OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
List<string> mainParams = optionSet.Parse(cmdparams);
if (mainParams.Count < 6)
{ {
m_log.Error( m_log.Error(
"[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <user password> [<load file path>]"); "[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <user password> [<load file path>]");
return; return;
} }
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); string firstName = mainParams[2];
string lastName = mainParams[3];
string firstName = cmdparams[2]; string invPath = mainParams[4];
string lastName = cmdparams[3]; string pass = mainParams[5];
string invPath = cmdparams[4]; string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME);
string pass = cmdparams[5];
string loadPath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
m_log.InfoFormat( m_log.InfoFormat(
"[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
loadPath, invPath, firstName, lastName); loadPath, invPath, firstName, lastName);
if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath)) if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
m_log.InfoFormat( m_log.InfoFormat(
"[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
loadPath, firstName, lastName); loadPath, firstName, lastName);
} }
/// <summary> /// <summary>
@ -351,7 +378,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
savePath, invPath, firstName, lastName); savePath, invPath, firstName, lastName);
Guid id = Guid.NewGuid(); Guid id = Guid.NewGuid();
ArchiveInventory(id, firstName, lastName, invPath, pass, savePath); ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
lock (m_pendingConsoleSaves) lock (m_pendingConsoleSaves)
m_pendingConsoleSaves.Add(id); m_pendingConsoleSaves.Add(id);

View File

@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
public void TestIarV0_1WithEscapedChars() public void TestIarV0_1WithEscapedChars()
{ {
TestHelper.InMethod(); TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure(); log4net.Config.XmlConfigurator.Configure();
string itemName = "You & you are a mean/man/"; string itemName = "You & you are a mean/man/";
string humanEscapedItemName = @"You & you are a mean\/man\/"; string humanEscapedItemName = @"You & you are a mean\/man\/";
@ -531,7 +531,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null) new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
.ReplicateArchivePathToUserInventory( .ReplicateArchivePathToUserInventory(
itemArchivePath, false, scene.InventoryService.GetRootFolder(ua1.PrincipalID), itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
foldersCreated, nodesLoaded); foldersCreated, nodesLoaded);
InventoryFolderBase folder1 InventoryFolderBase folder1

View File

@ -410,6 +410,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
teleportFlags, capsPath); teleportFlags, capsPath);
} }
// Let's set this to true tentatively. This does not trigger OnChildAgent
sp.IsChildAgent = true;
// TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
// trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
// that the client contacted the destination before we send the attachments and close things here. // that the client contacted the destination before we send the attachments and close things here.
@ -418,6 +421,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Client never contacted destination. Let's restore everything back // Client never contacted destination. Let's restore everything back
sp.ControllingClient.SendTeleportFailed("Problems connecting to destination."); sp.ControllingClient.SendTeleportFailed("Problems connecting to destination.");
// Fail. Reset it back
sp.IsChildAgent = false;
ResetFromTransit(sp.UUID); ResetFromTransit(sp.UUID);
// Yikes! We should just have a ref to scene here. // Yikes! We should just have a ref to scene here.
@ -436,7 +442,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
KillEntity(sp.Scene, sp.LocalId); KillEntity(sp.Scene, sp.LocalId);
// Now let's make it officially a child agent
sp.MakeChildAgent(); sp.MakeChildAgent();
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
@ -538,6 +546,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
client.SendTeleportFailed("Your home region could not be found."); client.SendTeleportFailed("Your home region could not be found.");
return; return;
} }
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})",
regionInfo.RegionName, regionInfo.RegionID, regionInfo.RegionLocX / Constants.RegionSize, regionInfo.RegionLocY / Constants.RegionSize);
// a little eekie that this goes back to Scene and with a forced cast, will fix that at some point... // a little eekie that this goes back to Scene and with a forced cast, will fix that at some point...
((Scene)(client.Scene)).RequestTeleportLocation( ((Scene)(client.Scene)).RequestTeleportLocation(
client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt,

View File

@ -26,6 +26,7 @@
*/ */
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
@ -59,6 +60,20 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="loadStream">The stream from which the inventory archive will be loaded</param> /// <param name="loadStream">The stream from which the inventory archive will be loaded</param>
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns> /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream); bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream);
/// <summary>
/// Dearchive a user's inventory folder from the given stream
/// </summary>
/// <param name="firstName"></param>
/// <param name="lastName"></param>
/// <param name="invPath">The inventory path in which to place the loaded folders and items</param>
/// <param name="loadStream">The stream from which the inventory archive will be loaded</param>
/// <param name="options">Dearchiving options. At the moment, the only option is ("merge", true). This merges
/// the loaded IAR with existing folders where possible.</param>
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
bool DearchiveInventory(
string firstName, string lastName, string invPath, string pass, Stream loadStream,
Dictionary<string, object> options);
/// <summary> /// <summary>
/// Archive a user's inventory folder to the given stream /// Archive a user's inventory folder to the given stream
@ -70,5 +85,19 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="saveStream">The stream to which the inventory archive will be saved</param> /// <param name="saveStream">The stream to which the inventory archive will be saved</param>
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns> /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream); bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream);
/// <summary>
/// Archive a user's inventory folder to the given stream
/// </summary>
/// <param name="id">ID representing this request. This will later be returned in the save event</param>
/// <param name="firstName"></param>
/// <param name="lastName"></param>
/// <param name="invPath">The inventory path from which the inventory should be saved.</param>
/// <param name="saveStream">The stream to which the inventory archive will be saved</param>
/// <param name="options">Archiving options. Currently, there are none.</param>
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
bool ArchiveInventory(
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
Dictionary<string, object> options);
} }
} }

View File

@ -4039,7 +4039,9 @@ namespace OpenSim.Region.Framework.Scenes
// bordercross if position is outside of region // bordercross if position is outside of region
if (!result) if (!result)
{
regionHandle = m_regInfo.RegionHandle; regionHandle = m_regInfo.RegionHandle;
}
else else
{ {
// not in this region, undo the shift! // not in this region, undo the shift!

View File

@ -206,9 +206,7 @@ namespace OpenSim.Services.Connectors
if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null)) if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null))
{ {
if (replyData["result"] is Dictionary<string, object>) if (replyData["result"] is Dictionary<string, object>)
{
guinfo = new GridUserInfo((Dictionary<string, object>)replyData["result"]); guinfo = new GridUserInfo((Dictionary<string, object>)replyData["result"]);
}
} }
return guinfo; return guinfo;

View File

@ -65,7 +65,7 @@ namespace OpenSim.Services.Interfaces
Vector3.TryParse(kvp["HomeLookAt"].ToString(), out HomeLookAt); Vector3.TryParse(kvp["HomeLookAt"].ToString(), out HomeLookAt);
if (kvp.ContainsKey("LastRegionID")) if (kvp.ContainsKey("LastRegionID"))
UUID.TryParse(kvp["LastRegionID"].ToString(), out HomeRegionID); UUID.TryParse(kvp["LastRegionID"].ToString(), out LastRegionID);
if (kvp.ContainsKey("LastPosition")) if (kvp.ContainsKey("LastPosition"))
Vector3.TryParse(kvp["LastPosition"].ToString(), out LastPosition); Vector3.TryParse(kvp["LastPosition"].ToString(), out LastPosition);
if (kvp.ContainsKey("LastLookAt")) if (kvp.ContainsKey("LastLookAt"))