Merge branch 'master' into danmerge
Conflicts: OpenSim/Region/Framework/Scenes/ScenePresence.cs bin/OpenSim.exe.configdsg
commit
c7923338bc
|
@ -106,8 +106,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
|
m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
|
||||||
m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule...");
|
m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule...");
|
||||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
|
m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
|
||||||
m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
|
// m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
|
||||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
|
// m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
|
||||||
m_log.Info("[LOADREGIONSPLUGIN]: Done.");
|
m_log.Info("[LOADREGIONSPLUGIN]: Done.");
|
||||||
|
|
||||||
if (!CheckRegionsForSanity(regionsToLoad))
|
if (!CheckRegionsForSanity(regionsToLoad))
|
||||||
|
|
|
@ -91,66 +91,24 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||||
{
|
{
|
||||||
if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null)
|
if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null)
|
||||||
{
|
{
|
||||||
// Get the config string
|
if (CheckModuleEnabled(node, modulesConfig))
|
||||||
string moduleString =
|
|
||||||
modulesConfig.GetString("Setup_" + node.Id, String.Empty);
|
|
||||||
|
|
||||||
// We have a selector
|
|
||||||
if (moduleString != String.Empty)
|
|
||||||
{
|
{
|
||||||
// Allow disabling modules even if they don't have
|
m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type);
|
||||||
// support for it
|
m_sharedModules.Add(node);
|
||||||
if (moduleString == "disabled")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Split off port, if present
|
|
||||||
string[] moduleParts = moduleString.Split(new char[] { '/' }, 2);
|
|
||||||
// Format is [port/][class]
|
|
||||||
string className = moduleParts[0];
|
|
||||||
if (moduleParts.Length > 1)
|
|
||||||
className = moduleParts[1];
|
|
||||||
|
|
||||||
// Match the class name if given
|
|
||||||
if (className != String.Empty &&
|
|
||||||
node.Type.ToString() != className)
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type);
|
|
||||||
m_sharedModules.Add(node);
|
|
||||||
}
|
}
|
||||||
else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null)
|
else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null)
|
||||||
{
|
{
|
||||||
// Get the config string
|
if (CheckModuleEnabled(node, modulesConfig))
|
||||||
string moduleString =
|
|
||||||
modulesConfig.GetString("Setup_" + node.Id, String.Empty);
|
|
||||||
|
|
||||||
// We have a selector
|
|
||||||
if (moduleString != String.Empty)
|
|
||||||
{
|
{
|
||||||
// Allow disabling modules even if they don't have
|
m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type);
|
||||||
// support for it
|
m_nonSharedModules.Add(node);
|
||||||
if (moduleString == "disabled")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Split off port, if present
|
|
||||||
string[] moduleParts = moduleString.Split(new char[] { '/' }, 2);
|
|
||||||
// Format is [port/][class]
|
|
||||||
string className = moduleParts[0];
|
|
||||||
if (moduleParts.Length > 1)
|
|
||||||
className = moduleParts[1];
|
|
||||||
|
|
||||||
// Match the class name if given
|
|
||||||
if (className != String.Empty &&
|
|
||||||
node.Type.ToString() != className)
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type);
|
|
||||||
m_nonSharedModules.Add(node);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_log.DebugFormat("[REGIONMODULES]: Found unknown type of module {0}, class {1}", node.Id, node.Type);
|
m_log.DebugFormat("[REGIONMODULES]: Found unknown type of module {0}, class {1}", node.Id, node.Type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load and init the module. We try a constructor with a port
|
// Load and init the module. We try a constructor with a port
|
||||||
|
@ -197,8 +155,6 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||||
m_sharedInstances.Add(module);
|
m_sharedInstances.Add(module);
|
||||||
module.Initialise(m_openSim.ConfigSource.Source);
|
module.Initialise(m_openSim.ConfigSource.Source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise ()
|
public void PostInitialise ()
|
||||||
|
@ -210,7 +166,6 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||||
{
|
{
|
||||||
module.PostInitialise();
|
module.PostInitialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -244,7 +199,6 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
public string Version
|
public string Version
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -263,6 +217,42 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||||
|
|
||||||
#region IRegionModulesController implementation
|
#region IRegionModulesController implementation
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check that the given module is no disabled in the [Modules] section of the config files.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="node"></param>
|
||||||
|
/// <param name="modulesConfig">The config section</param>
|
||||||
|
/// <returns>true if the module is enabled, false if it is disabled</returns>
|
||||||
|
protected bool CheckModuleEnabled(TypeExtensionNode node, IConfig modulesConfig)
|
||||||
|
{
|
||||||
|
// Get the config string
|
||||||
|
string moduleString =
|
||||||
|
modulesConfig.GetString("Setup_" + node.Id, String.Empty);
|
||||||
|
|
||||||
|
// We have a selector
|
||||||
|
if (moduleString != String.Empty)
|
||||||
|
{
|
||||||
|
// Allow disabling modules even if they don't have
|
||||||
|
// support for it
|
||||||
|
if (moduleString == "disabled")
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Split off port, if present
|
||||||
|
string[] moduleParts = moduleString.Split(new char[] { '/' }, 2);
|
||||||
|
// Format is [port/][class]
|
||||||
|
string className = moduleParts[0];
|
||||||
|
if (moduleParts.Length > 1)
|
||||||
|
className = moduleParts[1];
|
||||||
|
|
||||||
|
// Match the class name if given
|
||||||
|
if (className != String.Empty &&
|
||||||
|
node.Type.ToString() != className)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// The root of all evil.
|
// The root of all evil.
|
||||||
// This is where we handle adding the modules to scenes when they
|
// This is where we handle adding the modules to scenes when they
|
||||||
// load. This means that here we deal with replaceable interfaces,
|
// load. This means that here we deal with replaceable interfaces,
|
||||||
|
|
|
@ -208,18 +208,25 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
UUID regionID = new UUID((string) requestData["regionID"]);
|
UUID regionID = new UUID((string) requestData["regionID"]);
|
||||||
|
|
||||||
responseData["accepted"] = true;
|
|
||||||
responseData["success"] = true;
|
|
||||||
response.Value = responseData;
|
|
||||||
|
|
||||||
Scene rebootedScene;
|
Scene rebootedScene;
|
||||||
|
|
||||||
|
responseData["success"] = false;
|
||||||
|
responseData["accepted"] = true;
|
||||||
if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene))
|
if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene))
|
||||||
throw new Exception("region not found");
|
throw new Exception("region not found");
|
||||||
|
|
||||||
responseData["rebooting"] = true;
|
responseData["rebooting"] = true;
|
||||||
|
|
||||||
|
IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>();
|
||||||
|
if (restartModule != null)
|
||||||
|
{
|
||||||
|
List<int> times = new List<int> { 30, 15 };
|
||||||
|
|
||||||
|
restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true);
|
||||||
|
responseData["success"] = true;
|
||||||
|
}
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
rebootedScene.Restart(30);
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -212,8 +212,8 @@ namespace OpenSim.Data.MySQL
|
||||||
if (data.Data.ContainsKey("locY"))
|
if (data.Data.ContainsKey("locY"))
|
||||||
data.Data.Remove("locY");
|
data.Data.Remove("locY");
|
||||||
|
|
||||||
if (data.RegionName.Length > 32)
|
if (data.RegionName.Length > 128)
|
||||||
data.RegionName = data.RegionName.Substring(0, 32);
|
data.RegionName = data.RegionName.Substring(0, 128);
|
||||||
|
|
||||||
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
||||||
|
|
||||||
|
|
|
@ -87,3 +87,10 @@ ALTER TABLE `regions` ADD COLUMN `Token` varchar(255) NOT NULL;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
|
||||||
|
:VERSION 8 # ------------
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
alter table regions modify column regionName varchar(128) default NULL;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
|
@ -323,7 +323,7 @@ namespace OpenSim.Data.Tests
|
||||||
.IgnoreProperty(x => x.InvType)
|
.IgnoreProperty(x => x.InvType)
|
||||||
.IgnoreProperty(x => x.CreatorIdAsUuid)
|
.IgnoreProperty(x => x.CreatorIdAsUuid)
|
||||||
.IgnoreProperty(x => x.Description)
|
.IgnoreProperty(x => x.Description)
|
||||||
.IgnoreProperty(x => x.CreatorId)
|
.IgnoreProperty(x => x.CreatorIdentification)
|
||||||
.IgnoreProperty(x => x.CreatorData));
|
.IgnoreProperty(x => x.CreatorData));
|
||||||
|
|
||||||
inventoryScrambler.Scramble(expected);
|
inventoryScrambler.Scramble(expected);
|
||||||
|
@ -334,7 +334,7 @@ namespace OpenSim.Data.Tests
|
||||||
.IgnoreProperty(x => x.InvType)
|
.IgnoreProperty(x => x.InvType)
|
||||||
.IgnoreProperty(x => x.CreatorIdAsUuid)
|
.IgnoreProperty(x => x.CreatorIdAsUuid)
|
||||||
.IgnoreProperty(x => x.Description)
|
.IgnoreProperty(x => x.Description)
|
||||||
.IgnoreProperty(x => x.CreatorId)
|
.IgnoreProperty(x => x.CreatorIdentification)
|
||||||
.IgnoreProperty(x => x.CreatorData));
|
.IgnoreProperty(x => x.CreatorData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,31 +302,26 @@ namespace OpenSim.Framework
|
||||||
if (args["start_pos"] != null)
|
if (args["start_pos"] != null)
|
||||||
Vector3.TryParse(args["start_pos"].AsString(), out startpos);
|
Vector3.TryParse(args["start_pos"].AsString(), out startpos);
|
||||||
|
|
||||||
// DEBUG ON
|
m_log.InfoFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString());
|
||||||
m_log.WarnFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString());
|
|
||||||
// DEBUG OFF
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Unpack various appearance elements
|
// Unpack various appearance elements
|
||||||
Appearance = new AvatarAppearance(AgentID);
|
Appearance = new AvatarAppearance(AgentID);
|
||||||
|
|
||||||
// Eventually this code should be deprecated, use full appearance
|
// Eventually this code should be deprecated, use full appearance
|
||||||
// packing in packed_appearance
|
// packing in packed_appearance
|
||||||
if (args["appearance_serial"] != null)
|
if (args["appearance_serial"] != null)
|
||||||
Appearance.Serial = args["appearance_serial"].AsInteger();
|
Appearance.Serial = args["appearance_serial"].AsInteger();
|
||||||
|
|
||||||
if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map))
|
if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map))
|
||||||
{
|
{
|
||||||
Appearance.Unpack((OSDMap)args["packed_appearance"]);
|
Appearance.Unpack((OSDMap)args["packed_appearance"]);
|
||||||
// DEBUG ON
|
m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance");
|
||||||
m_log.WarnFormat("[AGENTCIRCUITDATA] unpacked appearance");
|
}
|
||||||
// DEBUG OFF
|
else
|
||||||
|
m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance");
|
||||||
}
|
}
|
||||||
// DEBUG ON
|
catch (Exception e)
|
||||||
else
|
|
||||||
m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance");
|
|
||||||
// DEBUG OFF
|
|
||||||
} catch (Exception e)
|
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[AGENTCIRCUITDATA] failed to unpack appearance; {0}",e.Message);
|
m_log.ErrorFormat("[AGENTCIRCUITDATA] failed to unpack appearance; {0}",e.Message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,16 @@ namespace OpenSim.Framework
|
||||||
string[] parts = temp.Split('\n');
|
string[] parts = temp.Split('\n');
|
||||||
int.TryParse(parts[0].Substring(17, 1), out Version);
|
int.TryParse(parts[0].Substring(17, 1), out Version);
|
||||||
UUID.TryParse(parts[1].Substring(10, 36), out RegionID);
|
UUID.TryParse(parts[1].Substring(10, 36), out RegionID);
|
||||||
// the vector is stored with spaces as separators, not with commas ("10.3 32.5 43" instead of "10.3, 32.5, 43")
|
// The position is a vector with spaces as separators ("10.3 32.5 43").
|
||||||
Vector3.TryParse(parts[2].Substring(10, parts[2].Length - 10).Replace(" ", ","), out Position);
|
// Parse each scalar separately to take into account the system's culture setting.
|
||||||
|
string[] scalars = parts[2].Substring(10, parts[2].Length - 10).Split(' ');
|
||||||
|
if (scalars.Length > 0)
|
||||||
|
System.Single.TryParse(scalars[0], out Position.X);
|
||||||
|
if (scalars.Length > 1)
|
||||||
|
System.Single.TryParse(scalars[1], out Position.Y);
|
||||||
|
if (scalars.Length > 2)
|
||||||
|
System.Single.TryParse(scalars[2], out Position.Z);
|
||||||
|
|
||||||
ulong.TryParse(parts[3].Substring(14, parts[3].Length - 14), out RegionHandle);
|
ulong.TryParse(parts[3].Substring(14, parts[3].Length - 14), out RegionHandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace OpenSim.Framework
|
||||||
public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
|
public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
|
||||||
|
|
||||||
protected UUID m_owner;
|
protected UUID m_owner;
|
||||||
protected int m_serial = 1;
|
protected int m_serial = 0;
|
||||||
protected byte[] m_visualparams;
|
protected byte[] m_visualparams;
|
||||||
protected Primitive.TextureEntry m_texture;
|
protected Primitive.TextureEntry m_texture;
|
||||||
protected AvatarWearable[] m_wearables;
|
protected AvatarWearable[] m_wearables;
|
||||||
|
@ -103,7 +103,7 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance for {0}",owner);
|
// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance for {0}",owner);
|
||||||
|
|
||||||
m_serial = 1;
|
m_serial = 0;
|
||||||
m_owner = owner;
|
m_owner = owner;
|
||||||
|
|
||||||
SetDefaultWearables();
|
SetDefaultWearables();
|
||||||
|
@ -127,7 +127,7 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID);
|
// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID);
|
||||||
|
|
||||||
m_serial = 1;
|
m_serial = 0;
|
||||||
m_owner = avatarID;
|
m_owner = avatarID;
|
||||||
|
|
||||||
if (wearables != null)
|
if (wearables != null)
|
||||||
|
@ -160,7 +160,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
if (appearance == null)
|
if (appearance == null)
|
||||||
{
|
{
|
||||||
m_serial = 1;
|
m_serial = 0;
|
||||||
m_owner = UUID.Zero;
|
m_owner = UUID.Zero;
|
||||||
|
|
||||||
SetDefaultWearables();
|
SetDefaultWearables();
|
||||||
|
@ -229,6 +229,24 @@ namespace OpenSim.Framework
|
||||||
m_wearables = AvatarWearable.DefaultWearables;
|
m_wearables = AvatarWearable.DefaultWearables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invalidate all of the baked textures in the appearance, useful
|
||||||
|
/// if you know that none are valid
|
||||||
|
/// </summary>
|
||||||
|
public virtual void ResetAppearance()
|
||||||
|
{
|
||||||
|
m_serial = 0;
|
||||||
|
|
||||||
|
SetDefaultParams();
|
||||||
|
SetDefaultTexture();
|
||||||
|
|
||||||
|
//for (int i = 0; i < BAKE_INDICES.Length; i++)
|
||||||
|
// {
|
||||||
|
// int idx = BAKE_INDICES[i];
|
||||||
|
// m_texture.FaceTextures[idx].TextureID = UUID.Zero;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void SetDefaultParams()
|
protected virtual void SetDefaultParams()
|
||||||
{
|
{
|
||||||
m_visualparams = new byte[] { 33,61,85,23,58,127,63,85,63,42,0,85,63,36,85,95,153,63,34,0,63,109,88,132,63,136,81,85,103,136,127,0,150,150,150,127,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,104,0,0,0,0,0,0,0,0,0,145,216,133,0,127,0,127,170,0,0,127,127,109,85,127,127,63,85,42,150,150,150,150,150,150,150,25,150,150,150,0,127,0,0,144,85,127,132,127,85,0,127,127,127,127,127,127,59,127,85,127,127,106,47,79,127,127,204,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,36,85,131,127,127,127,153,95,0,140,75,27,127,127,0,150,150,198,0,0,63,30,127,165,209,198,127,127,153,204,51,51,255,255,255,204,0,255,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,127,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150 };
|
m_visualparams = new byte[] { 33,61,85,23,58,127,63,85,63,42,0,85,63,36,85,95,153,63,34,0,63,109,88,132,63,136,81,85,103,136,127,0,150,150,150,127,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,104,0,0,0,0,0,0,0,0,0,145,216,133,0,127,0,127,170,0,0,127,127,109,85,127,127,63,85,42,150,150,150,150,150,150,150,25,150,150,150,0,127,0,0,144,85,127,132,127,85,0,127,127,127,127,127,127,59,127,85,127,127,106,47,79,127,127,204,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,36,85,131,127,127,127,153,95,0,140,75,27,127,127,0,150,150,198,0,0,63,30,127,165,209,198,127,127,153,204,51,51,255,255,255,204,0,255,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,127,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150 };
|
||||||
|
@ -240,9 +258,10 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
protected virtual void SetDefaultTexture()
|
protected virtual void SetDefaultTexture()
|
||||||
{
|
{
|
||||||
m_texture = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97"));
|
m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE));
|
||||||
for (uint i = 0; i < TEXTURE_COUNT; i++)
|
|
||||||
m_texture.CreateFace(i).TextureID = new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE);
|
// for (uint i = 0; i < TEXTURE_COUNT; i++)
|
||||||
|
// m_texture.CreateFace(i).TextureID = new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -274,9 +293,6 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
|
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
// if (newface != null)
|
|
||||||
// m_log.WarnFormat("[AVATAR APPEARANCE]: index {0}, new texture id {1}",i,newface.TextureID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_texture = textureEntry;
|
m_texture = textureEntry;
|
||||||
|
|
|
@ -990,6 +990,7 @@ namespace OpenSim.Framework.Capabilities
|
||||||
public void BakedTextureUploaded(UUID assetID, byte[] data)
|
public void BakedTextureUploaded(UUID assetID, byte[] data)
|
||||||
{
|
{
|
||||||
// m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
|
// m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
|
||||||
|
|
||||||
AssetBase asset;
|
AssetBase asset;
|
||||||
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString());
|
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString());
|
||||||
asset.Data = data;
|
asset.Data = data;
|
||||||
|
@ -1331,6 +1332,7 @@ namespace OpenSim.Framework.Capabilities
|
||||||
newAssetID = UUID.Random();
|
newAssetID = UUID.Random();
|
||||||
uploaderPath = path;
|
uploaderPath = path;
|
||||||
httpListener = httpServer;
|
httpListener = httpServer;
|
||||||
|
m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1358,6 +1360,8 @@ namespace OpenSim.Framework.Capabilities
|
||||||
handlerUpLoad(newAssetID, data);
|
handlerUpLoad(newAssetID, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace OpenSim.Framework.Capabilities
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string GetCapsSeedPath(string capsObjectPath)
|
public static string GetCapsSeedPath(string capsObjectPath)
|
||||||
{
|
{
|
||||||
return "/CAPS/" + capsObjectPath + "0000/";
|
return "CAPS/" + capsObjectPath + "0000/";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -331,9 +331,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public virtual OSDMap Pack()
|
public virtual OSDMap Pack()
|
||||||
{
|
{
|
||||||
// DEBUG ON
|
m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
|
||||||
m_log.WarnFormat("[CHILDAGENTDATAUPDATE] Pack data");
|
|
||||||
// DEBUG OFF
|
|
||||||
|
|
||||||
OSDMap args = new OSDMap();
|
OSDMap args = new OSDMap();
|
||||||
args["message_type"] = OSD.FromString("AgentData");
|
args["message_type"] = OSD.FromString("AgentData");
|
||||||
|
@ -454,9 +452,7 @@ namespace OpenSim.Framework
|
||||||
/// <param name="hash"></param>
|
/// <param name="hash"></param>
|
||||||
public virtual void Unpack(OSDMap args)
|
public virtual void Unpack(OSDMap args)
|
||||||
{
|
{
|
||||||
// DEBUG ON
|
m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data");
|
||||||
m_log.WarnFormat("[CHILDAGENTDATAUPDATE] Unpack data");
|
|
||||||
// DEBUG OFF
|
|
||||||
|
|
||||||
if (args.ContainsKey("region_id"))
|
if (args.ContainsKey("region_id"))
|
||||||
UUID.TryParse(args["region_id"].AsString(), out RegionID);
|
UUID.TryParse(args["region_id"].AsString(), out RegionID);
|
||||||
|
@ -613,10 +609,8 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
|
if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
|
||||||
Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]);
|
Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]);
|
||||||
// DEBUG ON
|
|
||||||
else
|
else
|
||||||
m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
|
m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
|
||||||
// DEBUG OFF
|
|
||||||
|
|
||||||
if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
|
if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,104 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of the OpenSimulator Project nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using OpenSim.Data;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenSim.Services.Interfaces;
|
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications.Osp
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Wrap other inventory data plugins so that we can perform OSP related post processing for items
|
|
||||||
/// </summary>
|
|
||||||
public class OspInventoryWrapperPlugin : IInventoryDataPlugin
|
|
||||||
{
|
|
||||||
protected IInventoryDataPlugin m_wrappedPlugin;
|
|
||||||
//protected CommunicationsManager m_commsManager;
|
|
||||||
protected IUserAccountService m_userAccountService;
|
|
||||||
|
|
||||||
public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin, IUserAccountService userService)
|
|
||||||
{
|
|
||||||
m_wrappedPlugin = wrappedPlugin;
|
|
||||||
m_userAccountService = userService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Name { get { return "OspInventoryWrapperPlugin"; } }
|
|
||||||
public string Version { get { return "0.1"; } }
|
|
||||||
public void Initialise() {}
|
|
||||||
public void Initialise(string connect) {}
|
|
||||||
public void Dispose() {}
|
|
||||||
|
|
||||||
public InventoryItemBase getInventoryItem(UUID item)
|
|
||||||
{
|
|
||||||
return PostProcessItem(m_wrappedPlugin.getInventoryItem(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
// XXX: Why on earth does this exist as it appears to duplicate getInventoryItem?
|
|
||||||
public InventoryItemBase queryInventoryItem(UUID item)
|
|
||||||
{
|
|
||||||
return PostProcessItem(m_wrappedPlugin.queryInventoryItem(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
|
|
||||||
{
|
|
||||||
List<InventoryItemBase> items = m_wrappedPlugin.getInventoryInFolder(folderID);
|
|
||||||
|
|
||||||
foreach (InventoryItemBase item in items)
|
|
||||||
PostProcessItem(item);
|
|
||||||
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<InventoryItemBase> fetchActiveGestures(UUID avatarID)
|
|
||||||
{
|
|
||||||
return m_wrappedPlugin.fetchActiveGestures(avatarID);
|
|
||||||
|
|
||||||
// Presuming that no post processing is needed here as gestures don't refer to creator information (?)
|
|
||||||
}
|
|
||||||
|
|
||||||
protected InventoryItemBase PostProcessItem(InventoryItemBase item)
|
|
||||||
{
|
|
||||||
item.CreatorIdAsUuid = OspResolver.ResolveOspa(item.CreatorId, m_userAccountService);
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) { return m_wrappedPlugin.getFolderHierarchy(parentID); }
|
|
||||||
public List<InventoryFolderBase> getUserRootFolders(UUID user) { return m_wrappedPlugin.getUserRootFolders(user); }
|
|
||||||
public InventoryFolderBase getUserRootFolder(UUID user) { return m_wrappedPlugin.getUserRootFolder(user); }
|
|
||||||
public List<InventoryFolderBase> getInventoryFolders(UUID parentID) { return m_wrappedPlugin.getInventoryFolders(parentID); }
|
|
||||||
public InventoryFolderBase getInventoryFolder(UUID folder) { return m_wrappedPlugin.getInventoryFolder(folder); }
|
|
||||||
public void addInventoryItem(InventoryItemBase item) { m_wrappedPlugin.addInventoryItem(item); }
|
|
||||||
public void updateInventoryItem(InventoryItemBase item) { m_wrappedPlugin.updateInventoryItem(item); }
|
|
||||||
public void deleteInventoryItem(UUID item) { m_wrappedPlugin.deleteInventoryItem(item); }
|
|
||||||
public InventoryFolderBase queryInventoryFolder(UUID folder) { return m_wrappedPlugin.queryInventoryFolder(folder); }
|
|
||||||
public void addInventoryFolder(InventoryFolderBase folder) { m_wrappedPlugin.addInventoryFolder(folder); }
|
|
||||||
public void updateInventoryFolder(InventoryFolderBase folder) { m_wrappedPlugin.updateInventoryFolder(folder); }
|
|
||||||
public void moveInventoryFolder(InventoryFolderBase folder) { m_wrappedPlugin.moveInventoryFolder(folder); }
|
|
||||||
public void deleteInventoryFolder(UUID folder) { m_wrappedPlugin.deleteInventoryFolder(folder); }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -73,7 +73,7 @@ namespace OpenSim.Framework
|
||||||
void AddNewClient(IClientAPI client);
|
void AddNewClient(IClientAPI client);
|
||||||
void RemoveClient(UUID agentID);
|
void RemoveClient(UUID agentID);
|
||||||
|
|
||||||
void Restart(int seconds);
|
void Restart();
|
||||||
//RegionInfo OtherRegionUp(RegionInfo thisRegion);
|
//RegionInfo OtherRegionUp(RegionInfo thisRegion);
|
||||||
|
|
||||||
string GetSimulatorVersion();
|
string GetSimulatorVersion();
|
||||||
|
|
|
@ -116,8 +116,20 @@ namespace OpenSim.Framework
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ServerURI
|
public string ServerURI
|
||||||
{
|
{
|
||||||
get { return m_serverURI; }
|
get {
|
||||||
set { m_serverURI = value; }
|
if ( m_serverURI != string.Empty ) {
|
||||||
|
return m_serverURI;
|
||||||
|
} else {
|
||||||
|
return "http://" + m_externalHostName + ":" + m_httpPort + "/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if ( value.EndsWith("/") ) {
|
||||||
|
m_serverURI = value;
|
||||||
|
} else {
|
||||||
|
m_serverURI = value + '/';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
protected string m_serverURI;
|
protected string m_serverURI;
|
||||||
|
|
||||||
|
@ -142,6 +154,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public SimpleRegionInfo()
|
public SimpleRegionInfo()
|
||||||
{
|
{
|
||||||
|
m_serverURI = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
|
public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
|
||||||
|
@ -151,6 +164,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
m_internalEndPoint = internalEndPoint;
|
m_internalEndPoint = internalEndPoint;
|
||||||
m_externalHostName = externalUri;
|
m_externalHostName = externalUri;
|
||||||
|
m_serverURI = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port)
|
public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port)
|
||||||
|
@ -161,6 +175,7 @@ namespace OpenSim.Framework
|
||||||
m_externalHostName = externalUri;
|
m_externalHostName = externalUri;
|
||||||
|
|
||||||
m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port);
|
m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port);
|
||||||
|
m_serverURI = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleRegionInfo(RegionInfo ConvertFrom)
|
public SimpleRegionInfo(RegionInfo ConvertFrom)
|
||||||
|
@ -450,6 +465,7 @@ namespace OpenSim.Framework
|
||||||
configMember =
|
configMember =
|
||||||
new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig);
|
new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig);
|
||||||
configMember.performConfigurationRetrieve();
|
configMember.performConfigurationRetrieve();
|
||||||
|
m_serverURI = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
|
public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
|
||||||
|
@ -459,10 +475,12 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
m_internalEndPoint = internalEndPoint;
|
m_internalEndPoint = internalEndPoint;
|
||||||
m_externalHostName = externalUri;
|
m_externalHostName = externalUri;
|
||||||
|
m_serverURI = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegionInfo()
|
public RegionInfo()
|
||||||
{
|
{
|
||||||
|
m_serverURI = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EstateSettings EstateSettings
|
public EstateSettings EstateSettings
|
||||||
|
@ -552,10 +570,23 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
|
/// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
public string ServerURI
|
public string ServerURI
|
||||||
{
|
{
|
||||||
get { return m_serverURI; }
|
get {
|
||||||
set { m_serverURI = value; }
|
if ( m_serverURI != string.Empty ) {
|
||||||
|
return m_serverURI;
|
||||||
|
} else {
|
||||||
|
return "http://" + m_externalHostName + ":" + m_httpPort + "/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if ( value.EndsWith("/") ) {
|
||||||
|
m_serverURI = value;
|
||||||
|
} else {
|
||||||
|
m_serverURI = value + '/';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string RegionName
|
public string RegionName
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Serialization.External
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Utilities for manipulating external representations of data structures in OpenSim
|
||||||
|
/// </summary>
|
||||||
|
public class ExternalRepresentationUtils
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Takes a XML representation of a SceneObjectPart and returns another XML representation
|
||||||
|
/// with creator data added to it.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="xml">The SceneObjectPart represented in XML2</param>
|
||||||
|
/// <param name="profileURL">The URL of the profile service for the creator</param>
|
||||||
|
/// <param name="userService">The service for retrieving user account information</param>
|
||||||
|
/// <param name="scopeID">The scope of the user account information (Grid ID)</param>
|
||||||
|
/// <returns>The SceneObjectPart represented in XML2</returns>
|
||||||
|
public static string RewriteSOP(string xml, string profileURL, IUserAccountService userService, UUID scopeID)
|
||||||
|
{
|
||||||
|
if (xml == string.Empty || profileURL == string.Empty || userService == null)
|
||||||
|
return xml;
|
||||||
|
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
doc.LoadXml(xml);
|
||||||
|
XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart");
|
||||||
|
|
||||||
|
foreach (XmlNode sop in sops)
|
||||||
|
{
|
||||||
|
UserAccount creator = null;
|
||||||
|
bool hasCreatorData = false;
|
||||||
|
XmlNodeList nodes = sop.ChildNodes;
|
||||||
|
foreach (XmlNode node in nodes)
|
||||||
|
{
|
||||||
|
if (node.Name == "CreatorID")
|
||||||
|
{
|
||||||
|
UUID uuid = UUID.Zero;
|
||||||
|
UUID.TryParse(node.InnerText, out uuid);
|
||||||
|
creator = userService.GetUserAccount(scopeID, uuid);
|
||||||
|
}
|
||||||
|
if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty)
|
||||||
|
hasCreatorData = true;
|
||||||
|
|
||||||
|
//if (node.Name == "OwnerID")
|
||||||
|
//{
|
||||||
|
// UserAccount owner = GetUser(node.InnerText);
|
||||||
|
// if (owner != null)
|
||||||
|
// node.InnerText = m_ProfileServiceURL + "/" + node.InnerText + "/" + owner.FirstName + " " + owner.LastName;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
if (!hasCreatorData && creator != null)
|
||||||
|
{
|
||||||
|
XmlElement creatorData = doc.CreateElement("CreatorData");
|
||||||
|
creatorData.InnerText = profileURL + "/" + creator.PrincipalID + ";" + creator.FirstName + " " + creator.LastName;
|
||||||
|
sop.AppendChild(creatorData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
using (StringWriter wr = new StringWriter())
|
||||||
|
{
|
||||||
|
doc.Save(wr);
|
||||||
|
return wr.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -32,7 +32,7 @@ using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications.Osp
|
namespace OpenSim.Framework.Serialization
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resolves OpenSim Profile Anchors (OSPA). An OSPA is a string used to provide information for
|
/// Resolves OpenSim Profile Anchors (OSPA). An OSPA is a string used to provide information for
|
||||||
|
@ -57,6 +57,12 @@ namespace OpenSim.Framework.Communications.Osp
|
||||||
/// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns>
|
/// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns>
|
||||||
public static string MakeOspa(UUID userId, IUserAccountService userService)
|
public static string MakeOspa(UUID userId, IUserAccountService userService)
|
||||||
{
|
{
|
||||||
|
if (userService == null)
|
||||||
|
{
|
||||||
|
m_log.Warn("[OSP RESOLVER]: UserService is null");
|
||||||
|
return userId.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
UserAccount account = userService.GetUserAccount(UUID.Zero, userId);
|
UserAccount account = userService.GetUserAccount(UUID.Zero, userId);
|
||||||
if (account != null)
|
if (account != null)
|
||||||
return MakeOspa(account.FirstName, account.LastName);
|
return MakeOspa(account.FirstName, account.LastName);
|
|
@ -26,11 +26,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Serialization.External
|
namespace OpenSim.Framework.Serialization.External
|
||||||
{
|
{
|
||||||
|
@ -40,6 +45,141 @@ namespace OpenSim.Framework.Serialization.External
|
||||||
/// XXX: Please do not use yet.
|
/// XXX: Please do not use yet.
|
||||||
public class UserInventoryItemSerializer
|
public class UserInventoryItemSerializer
|
||||||
{
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private delegate void InventoryItemXmlProcessor(InventoryItemBase item, XmlTextReader reader);
|
||||||
|
private static Dictionary<string, InventoryItemXmlProcessor> m_InventoryItemXmlProcessors = new Dictionary<string, InventoryItemXmlProcessor>();
|
||||||
|
|
||||||
|
#region InventoryItemBase Processor initialization
|
||||||
|
static UserInventoryItemSerializer()
|
||||||
|
{
|
||||||
|
m_InventoryItemXmlProcessors.Add("Name", ProcessName);
|
||||||
|
m_InventoryItemXmlProcessors.Add("ID", ProcessID);
|
||||||
|
m_InventoryItemXmlProcessors.Add("InvType", ProcessInvType);
|
||||||
|
m_InventoryItemXmlProcessors.Add("CreatorUUID", ProcessCreatorUUID);
|
||||||
|
m_InventoryItemXmlProcessors.Add("CreatorID", ProcessCreatorID);
|
||||||
|
m_InventoryItemXmlProcessors.Add("CreatorData", ProcessCreatorData);
|
||||||
|
m_InventoryItemXmlProcessors.Add("CreationDate", ProcessCreationDate);
|
||||||
|
m_InventoryItemXmlProcessors.Add("Owner", ProcessOwner);
|
||||||
|
m_InventoryItemXmlProcessors.Add("Description", ProcessDescription);
|
||||||
|
m_InventoryItemXmlProcessors.Add("AssetType", ProcessAssetType);
|
||||||
|
m_InventoryItemXmlProcessors.Add("AssetID", ProcessAssetID);
|
||||||
|
m_InventoryItemXmlProcessors.Add("SaleType", ProcessSaleType);
|
||||||
|
m_InventoryItemXmlProcessors.Add("SalePrice", ProcessSalePrice);
|
||||||
|
m_InventoryItemXmlProcessors.Add("BasePermissions", ProcessBasePermissions);
|
||||||
|
m_InventoryItemXmlProcessors.Add("CurrentPermissions", ProcessCurrentPermissions);
|
||||||
|
m_InventoryItemXmlProcessors.Add("EveryOnePermissions", ProcessEveryOnePermissions);
|
||||||
|
m_InventoryItemXmlProcessors.Add("NextPermissions", ProcessNextPermissions);
|
||||||
|
m_InventoryItemXmlProcessors.Add("Flags", ProcessFlags);
|
||||||
|
m_InventoryItemXmlProcessors.Add("GroupID", ProcessGroupID);
|
||||||
|
m_InventoryItemXmlProcessors.Add("GroupOwned", ProcessGroupOwned);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region InventoryItemBase Processors
|
||||||
|
private static void ProcessName(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.Name = reader.ReadElementContentAsString("Name", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessID(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.ID = Util.ReadUUID(reader, "ID");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessInvType(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.InvType = reader.ReadElementContentAsInt("InvType", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessCreatorUUID(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.CreatorId = reader.ReadElementContentAsString("CreatorUUID", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessCreatorID(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
// when it exists, this overrides the previous
|
||||||
|
item.CreatorId = reader.ReadElementContentAsString("CreatorID", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessCreationDate(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.CreationDate = reader.ReadElementContentAsInt("CreationDate", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessOwner(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.Owner = Util.ReadUUID(reader, "Owner");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessDescription(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.Description = reader.ReadElementContentAsString("Description", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessAssetType(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.AssetType = reader.ReadElementContentAsInt("AssetType", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessAssetID(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.AssetID = Util.ReadUUID(reader, "AssetID");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessSaleType(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.SaleType = (byte)reader.ReadElementContentAsInt("SaleType", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessSalePrice(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.SalePrice = reader.ReadElementContentAsInt("SalePrice", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessBasePermissions(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.BasePermissions = (uint)reader.ReadElementContentAsInt("BasePermissions", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessCurrentPermissions(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.CurrentPermissions = (uint)reader.ReadElementContentAsInt("CurrentPermissions", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessEveryOnePermissions(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.EveryOnePermissions = (uint)reader.ReadElementContentAsInt("EveryOnePermissions", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessNextPermissions(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.NextPermissions = (uint)reader.ReadElementContentAsInt("NextPermissions", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessFlags(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.Flags = (uint)reader.ReadElementContentAsInt("Flags", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessGroupID(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.GroupID = Util.ReadUUID(reader, "GroupID");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessGroupOwned(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.GroupOwned = Util.ReadBoolean(reader);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessCreatorData(InventoryItemBase item, XmlTextReader reader)
|
||||||
|
{
|
||||||
|
item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deserialize item
|
/// Deserialize item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -61,39 +201,46 @@ namespace OpenSim.Framework.Serialization.External
|
||||||
{
|
{
|
||||||
InventoryItemBase item = new InventoryItemBase();
|
InventoryItemBase item = new InventoryItemBase();
|
||||||
|
|
||||||
StringReader sr = new StringReader(serialization);
|
using (XmlTextReader reader = new XmlTextReader(new StringReader(serialization)))
|
||||||
XmlTextReader xtr = new XmlTextReader(sr);
|
{
|
||||||
|
reader.ReadStartElement("InventoryItem");
|
||||||
|
|
||||||
xtr.ReadStartElement("InventoryItem");
|
string nodeName = string.Empty;
|
||||||
|
while (reader.NodeType != XmlNodeType.EndElement)
|
||||||
|
{
|
||||||
|
nodeName = reader.Name;
|
||||||
|
InventoryItemXmlProcessor p = null;
|
||||||
|
if (m_InventoryItemXmlProcessors.TryGetValue(reader.Name, out p))
|
||||||
|
{
|
||||||
|
//m_log.DebugFormat("[XXX] Processing: {0}", reader.Name);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
p(item, reader);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[InventoryItemSerializer]: exception while parsing {0}: {1}", nodeName, e);
|
||||||
|
if (reader.NodeType == XmlNodeType.EndElement)
|
||||||
|
reader.Read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[InventoryItemSerializer]: caught unknown element {0}", nodeName);
|
||||||
|
reader.ReadOuterXml(); // ignore
|
||||||
|
}
|
||||||
|
|
||||||
item.Name = xtr.ReadElementString("Name");
|
}
|
||||||
item.ID = UUID.Parse( xtr.ReadElementString("ID"));
|
|
||||||
item.InvType = Convert.ToInt32( xtr.ReadElementString("InvType"));
|
|
||||||
item.CreatorId = xtr.ReadElementString("CreatorUUID");
|
|
||||||
item.CreationDate = Convert.ToInt32( xtr.ReadElementString("CreationDate"));
|
|
||||||
item.Owner = UUID.Parse( xtr.ReadElementString("Owner"));
|
|
||||||
item.Description = xtr.ReadElementString("Description");
|
|
||||||
item.AssetType = Convert.ToInt32( xtr.ReadElementString("AssetType"));
|
|
||||||
item.AssetID = UUID.Parse( xtr.ReadElementString("AssetID"));
|
|
||||||
item.SaleType = Convert.ToByte( xtr.ReadElementString("SaleType"));
|
|
||||||
item.SalePrice = Convert.ToInt32( xtr.ReadElementString("SalePrice"));
|
|
||||||
item.BasePermissions = Convert.ToUInt32( xtr.ReadElementString("BasePermissions"));
|
|
||||||
item.CurrentPermissions = Convert.ToUInt32( xtr.ReadElementString("CurrentPermissions"));
|
|
||||||
item.EveryOnePermissions = Convert.ToUInt32( xtr.ReadElementString("EveryOnePermissions"));
|
|
||||||
item.NextPermissions = Convert.ToUInt32( xtr.ReadElementString("NextPermissions"));
|
|
||||||
item.Flags = Convert.ToUInt32( xtr.ReadElementString("Flags"));
|
|
||||||
item.GroupID = UUID.Parse( xtr.ReadElementString("GroupID"));
|
|
||||||
item.GroupOwned = Convert.ToBoolean(xtr.ReadElementString("GroupOwned"));
|
|
||||||
|
|
||||||
xtr.ReadEndElement();
|
reader.ReadEndElement(); // InventoryItem
|
||||||
|
}
|
||||||
xtr.Close();
|
|
||||||
sr.Close();
|
|
||||||
|
|
||||||
|
//m_log.DebugFormat("[XXX]: parsed InventoryItemBase {0} - {1}", obj.Name, obj.UUID);
|
||||||
return item;
|
return item;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Serialize(InventoryItemBase inventoryItem)
|
public static string Serialize(InventoryItemBase inventoryItem, Dictionary<string, object> options, IUserAccountService userAccountService)
|
||||||
{
|
{
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
XmlTextWriter writer = new XmlTextWriter(sw);
|
XmlTextWriter writer = new XmlTextWriter(sw);
|
||||||
|
@ -112,7 +259,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||||
writer.WriteString(inventoryItem.InvType.ToString());
|
writer.WriteString(inventoryItem.InvType.ToString());
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
writer.WriteStartElement("CreatorUUID");
|
writer.WriteStartElement("CreatorUUID");
|
||||||
writer.WriteString(inventoryItem.CreatorId);
|
writer.WriteString(OspResolver.MakeOspa(inventoryItem.CreatorIdAsUuid, userAccountService));
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
writer.WriteStartElement("CreationDate");
|
writer.WriteStartElement("CreationDate");
|
||||||
writer.WriteString(inventoryItem.CreationDate.ToString());
|
writer.WriteString(inventoryItem.CreationDate.ToString());
|
||||||
|
@ -156,6 +303,20 @@ namespace OpenSim.Framework.Serialization.External
|
||||||
writer.WriteStartElement("GroupOwned");
|
writer.WriteStartElement("GroupOwned");
|
||||||
writer.WriteString(inventoryItem.GroupOwned.ToString());
|
writer.WriteString(inventoryItem.GroupOwned.ToString());
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
|
if (inventoryItem.CreatorData != null && inventoryItem.CreatorData != string.Empty)
|
||||||
|
writer.WriteElementString("CreatorData", inventoryItem.CreatorData);
|
||||||
|
else if (options.ContainsKey("profile"))
|
||||||
|
{
|
||||||
|
if (userAccountService != null)
|
||||||
|
{
|
||||||
|
UserAccount account = userAccountService.GetUserAccount(UUID.Zero, inventoryItem.CreatorIdAsUuid);
|
||||||
|
if (account != null)
|
||||||
|
{
|
||||||
|
writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + inventoryItem.CreatorIdAsUuid + ";" + account.FirstName + " " + account.LastName);
|
||||||
|
}
|
||||||
|
writer.WriteElementString("CreatorID", inventoryItem.CreatorId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
|
|
||||||
|
|
|
@ -348,7 +348,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
|
//m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
|
||||||
|
|
||||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
|
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
string path = request.RawUrl;
|
string path = request.RawUrl;
|
||||||
string handlerKey = GetHandlerKey(request.HttpMethod, path);
|
string handlerKey = GetHandlerKey(request.HttpMethod, path);
|
||||||
|
|
||||||
// m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
|
//m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
|
||||||
|
|
||||||
if (TryGetStreamHandler(handlerKey, out requestHandler))
|
if (TryGetStreamHandler(handlerKey, out requestHandler))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1558,5 +1558,86 @@ namespace OpenSim.Framework
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Xml Serialization Utilities
|
||||||
|
public static bool ReadBoolean(XmlTextReader reader)
|
||||||
|
{
|
||||||
|
reader.ReadStartElement();
|
||||||
|
bool result = Boolean.Parse(reader.ReadContentAsString().ToLower());
|
||||||
|
reader.ReadEndElement();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UUID ReadUUID(XmlTextReader reader, string name)
|
||||||
|
{
|
||||||
|
UUID id;
|
||||||
|
string idStr;
|
||||||
|
|
||||||
|
reader.ReadStartElement(name);
|
||||||
|
|
||||||
|
if (reader.Name == "Guid")
|
||||||
|
idStr = reader.ReadElementString("Guid");
|
||||||
|
else if (reader.Name == "UUID")
|
||||||
|
idStr = reader.ReadElementString("UUID");
|
||||||
|
else // no leading tag
|
||||||
|
idStr = reader.ReadContentAsString();
|
||||||
|
UUID.TryParse(idStr, out id);
|
||||||
|
reader.ReadEndElement();
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector3 ReadVector(XmlTextReader reader, string name)
|
||||||
|
{
|
||||||
|
Vector3 vec;
|
||||||
|
|
||||||
|
reader.ReadStartElement(name);
|
||||||
|
vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x
|
||||||
|
vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or y
|
||||||
|
vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z
|
||||||
|
reader.ReadEndElement();
|
||||||
|
|
||||||
|
return vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Quaternion ReadQuaternion(XmlTextReader reader, string name)
|
||||||
|
{
|
||||||
|
Quaternion quat = new Quaternion();
|
||||||
|
|
||||||
|
reader.ReadStartElement(name);
|
||||||
|
while (reader.NodeType != XmlNodeType.EndElement)
|
||||||
|
{
|
||||||
|
switch (reader.Name.ToLower())
|
||||||
|
{
|
||||||
|
case "x":
|
||||||
|
quat.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
|
||||||
|
break;
|
||||||
|
case "y":
|
||||||
|
quat.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
|
||||||
|
break;
|
||||||
|
case "z":
|
||||||
|
quat.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
|
||||||
|
break;
|
||||||
|
case "w":
|
||||||
|
quat.W = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reader.ReadEndElement();
|
||||||
|
|
||||||
|
return quat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T ReadEnum<T>(XmlTextReader reader, string name)
|
||||||
|
{
|
||||||
|
string value = reader.ReadElementContentAsString(name, String.Empty);
|
||||||
|
// !!!!! to deal with flags without commas
|
||||||
|
if (value.Contains(" ") && !value.Contains(","))
|
||||||
|
value = value.Replace(" ", ", ");
|
||||||
|
|
||||||
|
return (T)Enum.Parse(typeof(T), value); ;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -363,5 +364,85 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Stream
|
#endregion Stream
|
||||||
|
|
||||||
|
public class QBasedComparer : IComparer
|
||||||
|
{
|
||||||
|
public int Compare(Object x, Object y)
|
||||||
|
{
|
||||||
|
float qx = GetQ(x);
|
||||||
|
float qy = GetQ(y);
|
||||||
|
if (qx < qy)
|
||||||
|
return -1;
|
||||||
|
if (qx == qy)
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float GetQ(Object o)
|
||||||
|
{
|
||||||
|
// Example: image/png;q=0.9
|
||||||
|
|
||||||
|
if (o is String)
|
||||||
|
{
|
||||||
|
string mime = (string)o;
|
||||||
|
string[] parts = mime.Split(new char[] { ';' });
|
||||||
|
if (parts.Length > 1)
|
||||||
|
{
|
||||||
|
string[] kvp = parts[1].Split(new char[] { '=' });
|
||||||
|
if (kvp.Length == 2 && kvp[0] == "q")
|
||||||
|
{
|
||||||
|
float qvalue = 1F;
|
||||||
|
float.TryParse(kvp[1], out qvalue);
|
||||||
|
return qvalue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Takes the value of an Accept header and returns the preferred types
|
||||||
|
/// ordered by q value (if it exists).
|
||||||
|
/// Example input: image/jpg;q=0.7, image/png;q=0.8, image/jp2
|
||||||
|
/// Exmaple output: ["jp2", "png", "jpg"]
|
||||||
|
/// NOTE: This doesn't handle the semantics of *'s...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="accept"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string[] GetPreferredImageTypes(string accept)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (accept == null || accept == string.Empty)
|
||||||
|
return new string[0];
|
||||||
|
|
||||||
|
string[] types = accept.Split(new char[] { ',' });
|
||||||
|
if (types.Length > 0)
|
||||||
|
{
|
||||||
|
List<string> list = new List<string>(types);
|
||||||
|
list.RemoveAll(delegate(string s) { return !s.ToLower().StartsWith("image"); });
|
||||||
|
ArrayList tlist = new ArrayList(list);
|
||||||
|
tlist.Sort(new QBasedComparer());
|
||||||
|
|
||||||
|
string[] result = new string[tlist.Count];
|
||||||
|
for (int i = 0; i < tlist.Count; i++)
|
||||||
|
{
|
||||||
|
string mime = (string)tlist[i];
|
||||||
|
string[] parts = mime.Split(new char[] { ';' });
|
||||||
|
string[] pair = parts[0].Split(new char[] { '/' });
|
||||||
|
if (pair.Length == 2)
|
||||||
|
result[i] = pair[1].ToLower();
|
||||||
|
else // oops, we don't know what this is...
|
||||||
|
result[i] = pair[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new string[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,10 +265,10 @@ namespace OpenSim
|
||||||
LoadOar);
|
LoadOar);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("region", false, "save oar",
|
m_console.Commands.AddCommand("region", false, "save oar",
|
||||||
"save oar [-v|--version=N] [-p|--profile=url] [<OAR path>]",
|
"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]",
|
||||||
"Save a region's data to an OAR archive.",
|
"Save a region's data to an OAR archive.",
|
||||||
"-v|--version=N generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
|
"-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
|
||||||
+ "-p|--profile=url adds the url of the profile service to the saved user information" + Environment.NewLine
|
+ "-p|--profile=<url> adds the url of the profile service to the saved user information" + Environment.NewLine
|
||||||
+ "The OAR path must be a filesystem path."
|
+ "The OAR path must be a filesystem path."
|
||||||
+ " If this is not given then the oar is saved to region.oar in the current directory.",
|
+ " If this is not given then the oar is saved to region.oar in the current directory.",
|
||||||
SaveOar);
|
SaveOar);
|
||||||
|
|
|
@ -327,8 +327,8 @@ namespace OpenSim
|
||||||
//regionInfo.originRegionID = regionInfo.RegionID;
|
//regionInfo.originRegionID = regionInfo.RegionID;
|
||||||
|
|
||||||
// set initial ServerURI
|
// set initial ServerURI
|
||||||
regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port;
|
|
||||||
regionInfo.HttpPort = m_httpServerPort;
|
regionInfo.HttpPort = m_httpServerPort;
|
||||||
|
regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/";
|
||||||
|
|
||||||
regionInfo.osSecret = m_osSecret;
|
regionInfo.osSecret = m_osSecret;
|
||||||
|
|
||||||
|
@ -352,13 +352,13 @@ namespace OpenSim
|
||||||
m_moduleLoader.InitialiseSharedModules(scene);
|
m_moduleLoader.InitialiseSharedModules(scene);
|
||||||
|
|
||||||
// Use this in the future, the line above will be deprecated soon
|
// Use this in the future, the line above will be deprecated soon
|
||||||
m_log.Info("[MODULES]: Loading Region's modules (new style)");
|
m_log.Info("[REGIONMODULES]: Loading Region's modules (new style)");
|
||||||
IRegionModulesController controller;
|
IRegionModulesController controller;
|
||||||
if (ApplicationRegistry.TryGet(out controller))
|
if (ApplicationRegistry.TryGet(out controller))
|
||||||
{
|
{
|
||||||
controller.AddRegionToModules(scene);
|
controller.AddRegionToModules(scene);
|
||||||
}
|
}
|
||||||
else m_log.Error("[MODULES]: The new RegionModulesController is missing...");
|
else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing...");
|
||||||
|
|
||||||
scene.SetModuleInterfaces();
|
scene.SetModuleInterfaces();
|
||||||
|
|
||||||
|
|
|
@ -3571,24 +3571,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
EntityUpdate update;
|
EntityUpdate update;
|
||||||
while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update))
|
while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update))
|
||||||
{
|
{
|
||||||
// Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
|
|
||||||
// will never receive an update after a prim kill. Even then, keeping the kill record may be a good
|
|
||||||
// safety measure.
|
|
||||||
//
|
|
||||||
// Receiving updates after kills results in undeleteable prims that persist until relog and
|
|
||||||
// currently occurs because prims can be deleted before all queued updates are sent.
|
|
||||||
if (m_killRecord.Contains(update.Entity.LocalId))
|
|
||||||
{
|
|
||||||
// m_log.WarnFormat(
|
|
||||||
// "[CLIENT]: Preventing full update for prim with local id {0} after client for user {1} told it was deleted",
|
|
||||||
// update.Entity.LocalId, Name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (update.Entity is SceneObjectPart)
|
if (update.Entity is SceneObjectPart)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = (SceneObjectPart)update.Entity;
|
SceneObjectPart part = (SceneObjectPart)update.Entity;
|
||||||
|
|
||||||
|
// Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
|
||||||
|
// will never receive an update after a prim kill. Even then, keeping the kill record may be a good
|
||||||
|
// safety measure.
|
||||||
|
//
|
||||||
|
// If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update
|
||||||
|
// after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs
|
||||||
|
// updates and kills on different threads with different scheduling strategies, hence this protection.
|
||||||
|
//
|
||||||
|
// This doesn't appear to apply to child prims - a client will happily ignore these updates
|
||||||
|
// after the root prim has been deleted.
|
||||||
|
if (m_killRecord.Contains(part.LocalId))
|
||||||
|
{
|
||||||
|
// m_log.WarnFormat(
|
||||||
|
// "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted",
|
||||||
|
// part.LocalId, Name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (part.ParentGroup.IsAttachment && m_disableFacelights)
|
if (part.ParentGroup.IsAttachment && m_disableFacelights)
|
||||||
{
|
{
|
||||||
if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
|
if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
|
||||||
|
|
|
@ -399,7 +399,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool EnqueueOutgoing(OutgoingPacket packet)
|
/// <summary>
|
||||||
|
/// Queue an outgoing packet if appropriate.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="packet"></param>
|
||||||
|
/// <param name="forceQueue">Always queue the packet if at all possible.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// true if the packet has been queued,
|
||||||
|
/// false if the packet has not been queued and should be sent immediately.
|
||||||
|
/// </returns>
|
||||||
|
public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue)
|
||||||
{
|
{
|
||||||
int category = (int)packet.Category;
|
int category = (int)packet.Category;
|
||||||
|
|
||||||
|
@ -408,14 +417,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
|
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
|
||||||
TokenBucket bucket = m_throttleCategories[category];
|
TokenBucket bucket = m_throttleCategories[category];
|
||||||
|
|
||||||
if (bucket.RemoveTokens(packet.Buffer.DataLength))
|
if (!forceQueue && bucket.RemoveTokens(packet.Buffer.DataLength))
|
||||||
{
|
{
|
||||||
// Enough tokens were removed from the bucket, the packet will not be queued
|
// Enough tokens were removed from the bucket, the packet will not be queued
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Not enough tokens in the bucket, queue this packet
|
// Force queue specified or not enough tokens in the bucket, queue this packet
|
||||||
queue.Enqueue(packet);
|
queue.Enqueue(packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,6 +312,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Start the process of sending a packet to the client.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="udpClient"></param>
|
||||||
|
/// <param name="packet"></param>
|
||||||
|
/// <param name="category"></param>
|
||||||
|
/// <param name="allowSplitting"></param>
|
||||||
public void SendPacket(LLUDPClient udpClient, Packet packet, ThrottleOutPacketType category, bool allowSplitting)
|
public void SendPacket(LLUDPClient udpClient, Packet packet, ThrottleOutPacketType category, bool allowSplitting)
|
||||||
{
|
{
|
||||||
// CoarseLocationUpdate packets cannot be split in an automated way
|
// CoarseLocationUpdate packets cannot be split in an automated way
|
||||||
|
@ -339,6 +346,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Start the process of sending a packet to the client.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="udpClient"></param>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="category"></param>
|
||||||
public void SendPacketData(LLUDPClient udpClient, byte[] data, PacketType type, ThrottleOutPacketType category)
|
public void SendPacketData(LLUDPClient udpClient, byte[] data, PacketType type, ThrottleOutPacketType category)
|
||||||
{
|
{
|
||||||
int dataLength = data.Length;
|
int dataLength = data.Length;
|
||||||
|
@ -396,7 +410,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category);
|
OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category);
|
||||||
|
|
||||||
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket))
|
// If a Linden Lab 1.23.5 client receives an update packet after a kill packet for an object, it will
|
||||||
|
// continue to display the deleted object until relog. Therefore, we need to always queue a kill object
|
||||||
|
// packet so that it isn't sent before a queued update packet.
|
||||||
|
bool requestQueue = type == PacketType.KillObject;
|
||||||
|
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue))
|
||||||
SendPacketFinal(outgoingPacket);
|
SendPacketFinal(outgoingPacket);
|
||||||
|
|
||||||
#endregion Queue or Send
|
#endregion Queue or Send
|
||||||
|
@ -489,7 +507,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
//Interlocked.Increment(ref Stats.ResentPackets);
|
//Interlocked.Increment(ref Stats.ResentPackets);
|
||||||
|
|
||||||
// Requeue or resend the packet
|
// Requeue or resend the packet
|
||||||
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket))
|
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false))
|
||||||
SendPacketFinal(outgoingPacket);
|
SendPacketFinal(outgoingPacket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -630,7 +648,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
IClientAPI client;
|
IClientAPI client;
|
||||||
if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView))
|
if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView))
|
||||||
{
|
{
|
||||||
//m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
|
m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,19 +41,22 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AgentAssetTransactions
|
public class AgentAssetTransactions
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(
|
||||||
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
// Fields
|
// Fields
|
||||||
private bool m_dumpAssetsToFile;
|
private bool m_dumpAssetsToFile;
|
||||||
public AssetTransactionModule Manager;
|
private Scene m_Scene;
|
||||||
public UUID UserID;
|
public UUID UserID;
|
||||||
public Dictionary<UUID, AssetXferUploader> XferUploaders = new Dictionary<UUID, AssetXferUploader>();
|
public Dictionary<UUID, AssetXferUploader> XferUploaders =
|
||||||
|
new Dictionary<UUID, AssetXferUploader>();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
public AgentAssetTransactions(UUID agentID, AssetTransactionModule manager, bool dumpAssetsToFile)
|
public AgentAssetTransactions(UUID agentID, Scene scene,
|
||||||
|
bool dumpAssetsToFile)
|
||||||
{
|
{
|
||||||
|
m_Scene = scene;
|
||||||
UserID = agentID;
|
UserID = agentID;
|
||||||
Manager = manager;
|
|
||||||
m_dumpAssetsToFile = dumpAssetsToFile;
|
m_dumpAssetsToFile = dumpAssetsToFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +64,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
{
|
{
|
||||||
if (!XferUploaders.ContainsKey(transactionID))
|
if (!XferUploaders.ContainsKey(transactionID))
|
||||||
{
|
{
|
||||||
AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile);
|
AssetXferUploader uploader = new AssetXferUploader(m_Scene,
|
||||||
|
m_dumpAssetsToFile);
|
||||||
|
|
||||||
lock (XferUploaders)
|
lock (XferUploaders)
|
||||||
{
|
{
|
||||||
|
@ -88,22 +92,25 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RequestCreateInventoryItem(IClientAPI remoteClient, UUID transactionID, UUID folderID,
|
public void RequestCreateInventoryItem(IClientAPI remoteClient,
|
||||||
uint callbackID, string description, string name, sbyte invType,
|
UUID transactionID, UUID folderID, uint callbackID,
|
||||||
sbyte type, byte wearableType, uint nextOwnerMask)
|
string description, string name, sbyte invType,
|
||||||
|
sbyte type, byte wearableType, uint nextOwnerMask)
|
||||||
{
|
{
|
||||||
if (XferUploaders.ContainsKey(transactionID))
|
if (XferUploaders.ContainsKey(transactionID))
|
||||||
{
|
{
|
||||||
XferUploaders[transactionID].RequestCreateInventoryItem(remoteClient, transactionID, folderID,
|
XferUploaders[transactionID].RequestCreateInventoryItem(
|
||||||
callbackID, description, name, invType, type,
|
remoteClient, transactionID, folderID,
|
||||||
wearableType, nextOwnerMask);
|
callbackID, description, name, invType, type,
|
||||||
|
wearableType, nextOwnerMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed.
|
/// Get an uploaded asset. If the data is successfully retrieved,
|
||||||
|
/// the transaction will be removed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="transactionID"></param>
|
/// <param name="transactionID"></param>
|
||||||
/// <returns>The asset if the upload has completed, null if it has not.</returns>
|
/// <returns>The asset if the upload has completed, null if it has not.</returns>
|
||||||
|
@ -125,105 +132,56 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//private void CreateItemFromUpload(AssetBase asset, IClientAPI ourClient, UUID inventoryFolderID, uint nextPerms, uint wearableType)
|
public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient,
|
||||||
//{
|
SceneObjectPart part, UUID transactionID,
|
||||||
// Manager.MyScene.CommsManager.AssetCache.AddAsset(asset);
|
TaskInventoryItem item)
|
||||||
// CachedUserInfo userInfo = Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(
|
|
||||||
// ourClient.AgentId);
|
|
||||||
|
|
||||||
// if (userInfo != null)
|
|
||||||
// {
|
|
||||||
// InventoryItemBase item = new InventoryItemBase();
|
|
||||||
// item.Owner = ourClient.AgentId;
|
|
||||||
// item.Creator = ourClient.AgentId;
|
|
||||||
// item.ID = UUID.Random();
|
|
||||||
// item.AssetID = asset.FullID;
|
|
||||||
// item.Description = asset.Description;
|
|
||||||
// item.Name = asset.Name;
|
|
||||||
// item.AssetType = asset.Type;
|
|
||||||
// item.InvType = asset.Type;
|
|
||||||
// item.Folder = inventoryFolderID;
|
|
||||||
// item.BasePermissions = 0x7fffffff;
|
|
||||||
// item.CurrentPermissions = 0x7fffffff;
|
|
||||||
// item.EveryOnePermissions = 0;
|
|
||||||
// item.NextPermissions = nextPerms;
|
|
||||||
// item.Flags = wearableType;
|
|
||||||
// item.CreationDate = Util.UnixTimeSinceEpoch();
|
|
||||||
|
|
||||||
// userInfo.AddItem(item);
|
|
||||||
// ourClient.SendInventoryItemCreateUpdate(item);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// m_log.ErrorFormat(
|
|
||||||
// "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation",
|
|
||||||
// ourClient.AgentId);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
public void RequestUpdateTaskInventoryItem(
|
|
||||||
IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
|
|
||||||
{
|
{
|
||||||
if (XferUploaders.ContainsKey(transactionID))
|
if (XferUploaders.ContainsKey(transactionID))
|
||||||
{
|
{
|
||||||
AssetBase asset = XferUploaders[transactionID].GetAssetData();
|
AssetBase asset = GetTransactionAsset(transactionID);
|
||||||
|
|
||||||
|
// Only legacy viewers use this, and they prefer CAPS, which
|
||||||
|
// we have, so this really never runs.
|
||||||
|
// Allow it, but only for "safe" types.
|
||||||
|
if ((InventoryType)item.InvType != InventoryType.Notecard &&
|
||||||
|
(InventoryType)item.InvType != InventoryType.LSL)
|
||||||
|
return;
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
asset.FullID = UUID.Random();
|
||||||
"[ASSET TRANSACTIONS]: Updating task item {0} in {1} with asset in transaction {2}",
|
|
||||||
item.Name, part.Name, transactionID);
|
|
||||||
|
|
||||||
asset.Name = item.Name;
|
asset.Name = item.Name;
|
||||||
asset.Description = item.Description;
|
asset.Description = item.Description;
|
||||||
asset.Type = (sbyte)item.Type;
|
asset.Type = (sbyte)item.Type;
|
||||||
item.AssetID = asset.FullID;
|
item.AssetID = asset.FullID;
|
||||||
|
|
||||||
Manager.MyScene.AssetService.Store(asset);
|
m_Scene.AssetService.Store(asset);
|
||||||
|
|
||||||
if (part.Inventory.UpdateInventoryItem(item))
|
part.Inventory.UpdateInventoryItem(item);
|
||||||
{
|
|
||||||
if ((InventoryType)item.InvType == InventoryType.Notecard)
|
|
||||||
remoteClient.SendAgentAlertMessage("Notecard saved", false);
|
|
||||||
else if ((InventoryType)item.InvType == InventoryType.LSL)
|
|
||||||
remoteClient.SendAgentAlertMessage("Script saved", false);
|
|
||||||
else
|
|
||||||
remoteClient.SendAgentAlertMessage("Item saved", false);
|
|
||||||
|
|
||||||
part.GetProperties(remoteClient);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RequestUpdateInventoryItem(IClientAPI remoteClient,
|
||||||
public void RequestUpdateInventoryItem(IClientAPI remoteClient, UUID transactionID,
|
UUID transactionID, InventoryItemBase item)
|
||||||
InventoryItemBase item)
|
|
||||||
{
|
{
|
||||||
if (XferUploaders.ContainsKey(transactionID))
|
if (XferUploaders.ContainsKey(transactionID))
|
||||||
{
|
{
|
||||||
UUID assetID = UUID.Combine(transactionID, remoteClient.SecureSessionId);
|
AssetBase asset = GetTransactionAsset(transactionID);
|
||||||
|
|
||||||
AssetBase asset = Manager.MyScene.AssetService.Get(assetID.ToString());
|
if (asset != null)
|
||||||
|
|
||||||
if (asset == null)
|
|
||||||
{
|
{
|
||||||
asset = GetTransactionAsset(transactionID);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (asset != null && asset.FullID == assetID)
|
|
||||||
{
|
|
||||||
// Assets never get updated, new ones get created
|
|
||||||
asset.FullID = UUID.Random();
|
asset.FullID = UUID.Random();
|
||||||
asset.Name = item.Name;
|
asset.Name = item.Name;
|
||||||
asset.Description = item.Description;
|
asset.Description = item.Description;
|
||||||
asset.Type = (sbyte)item.AssetType;
|
asset.Type = (sbyte)item.AssetType;
|
||||||
item.AssetID = asset.FullID;
|
item.AssetID = asset.FullID;
|
||||||
|
|
||||||
Manager.MyScene.AssetService.Store(asset);
|
m_Scene.AssetService.Store(asset);
|
||||||
}
|
|
||||||
|
|
||||||
IInventoryService invService = Manager.MyScene.InventoryService;
|
IInventoryService invService = m_Scene.InventoryService;
|
||||||
invService.UpdateItem(item);
|
invService.UpdateItem(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,22 +34,19 @@ using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
{
|
{
|
||||||
public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AssetTransactionModule")]
|
||||||
|
public class AssetTransactionModule : INonSharedRegionModule,
|
||||||
|
IAgentAssetTransactions
|
||||||
{
|
{
|
||||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
// private static readonly ILog m_log = LogManager.GetLogger(
|
||||||
|
// MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private readonly Dictionary<UUID, Scene> RegisteredScenes = new Dictionary<UUID, Scene>();
|
protected Scene m_Scene;
|
||||||
private bool m_dumpAssetsToFile = false;
|
private bool m_dumpAssetsToFile = false;
|
||||||
private Scene m_scene = null;
|
|
||||||
|
|
||||||
[Obsolete]
|
|
||||||
public Scene MyScene
|
|
||||||
{
|
|
||||||
get{ return m_scene;}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Each agent has its own singleton collection of transactions
|
/// Each agent has its own singleton collection of transactions
|
||||||
|
@ -57,33 +54,24 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
private Dictionary<UUID, AgentAssetTransactions> AgentTransactions =
|
private Dictionary<UUID, AgentAssetTransactions> AgentTransactions =
|
||||||
new Dictionary<UUID, AgentAssetTransactions>();
|
new Dictionary<UUID, AgentAssetTransactions>();
|
||||||
|
|
||||||
|
|
||||||
public AssetTransactionModule()
|
|
||||||
{
|
|
||||||
//m_log.Debug("creating AgentAssetTransactionModule");
|
|
||||||
}
|
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region IRegionModule Members
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
|
|
||||||
{
|
|
||||||
// m_log.Debug("initialising AgentAssetTransactionModule");
|
|
||||||
RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
|
|
||||||
scene.RegisterModuleInterface<IAgentAssetTransactions>(this);
|
|
||||||
|
|
||||||
scene.EventManager.OnNewClient += NewClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
// EVIL HACK!
|
|
||||||
// This needs killing!
|
|
||||||
//
|
|
||||||
if (m_scene == null)
|
|
||||||
m_scene = scene;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
m_Scene = scene;
|
||||||
|
scene.RegisterModuleInterface<IAgentAssetTransactions>(this);
|
||||||
|
scene.EventManager.OnNewClient += NewClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,9 +84,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
get { return "AgentTransactionModule"; }
|
get { return "AgentTransactionModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return typeof(IAgentAssetTransactions); }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -111,8 +99,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
|
|
||||||
#region AgentAssetTransactions
|
#region AgentAssetTransactions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the collection of asset transactions for the given user. If one does not already exist, it
|
/// Get the collection of asset transactions for the given user.
|
||||||
/// is created.
|
/// If one does not already exist, it is created.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userID"></param>
|
/// <param name="userID"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
@ -122,7 +110,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
{
|
{
|
||||||
if (!AgentTransactions.ContainsKey(userID))
|
if (!AgentTransactions.ContainsKey(userID))
|
||||||
{
|
{
|
||||||
AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
|
AgentAssetTransactions transactions =
|
||||||
|
new AgentAssetTransactions(userID, m_Scene,
|
||||||
|
m_dumpAssetsToFile);
|
||||||
|
|
||||||
AgentTransactions.Add(userID, transactions);
|
AgentTransactions.Add(userID, transactions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,8 +122,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove the given agent asset transactions. This should be called when a client is departing
|
/// Remove the given agent asset transactions. This should be called
|
||||||
/// from a scene (and hence won't be making any more transactions here).
|
/// when a client is departing from a scene (and hence won't be making
|
||||||
|
/// any more transactions here).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userID"></param>
|
/// <param name="userID"></param>
|
||||||
public void RemoveAgentAssetTransactions(UUID userID)
|
public void RemoveAgentAssetTransactions(UUID userID)
|
||||||
|
@ -146,10 +138,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create an inventory item from data that has been received through a transaction.
|
/// Create an inventory item from data that has been received through
|
||||||
///
|
/// a transaction.
|
||||||
/// This is called when new clothing or body parts are created. It may also be called in other
|
/// This is called when new clothing or body parts are created.
|
||||||
/// situations.
|
/// It may also be called in other situations.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
/// <param name="transactionID"></param>
|
/// <param name="transactionID"></param>
|
||||||
|
@ -161,61 +153,72 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <param name="wearableType"></param>
|
/// <param name="wearableType"></param>
|
||||||
/// <param name="nextOwnerMask"></param>
|
/// <param name="nextOwnerMask"></param>
|
||||||
public void HandleItemCreationFromTransaction(IClientAPI remoteClient, UUID transactionID, UUID folderID,
|
public void HandleItemCreationFromTransaction(IClientAPI remoteClient,
|
||||||
uint callbackID, string description, string name, sbyte invType,
|
UUID transactionID, UUID folderID, uint callbackID,
|
||||||
sbyte type, byte wearableType, uint nextOwnerMask)
|
string description, string name, sbyte invType,
|
||||||
|
sbyte type, byte wearableType, uint nextOwnerMask)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name);
|
// "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name);
|
||||||
|
|
||||||
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
AgentAssetTransactions transactions =
|
||||||
|
GetUserTransactions(remoteClient.AgentId);
|
||||||
|
|
||||||
transactions.RequestCreateInventoryItem(
|
transactions.RequestCreateInventoryItem(remoteClient, transactionID,
|
||||||
remoteClient, transactionID, folderID, callbackID, description,
|
folderID, callbackID, description, name, invType, type,
|
||||||
name, invType, type, wearableType, nextOwnerMask);
|
wearableType, nextOwnerMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update an inventory item with data that has been received through a transaction.
|
/// Update an inventory item with data that has been received through a
|
||||||
|
/// transaction.
|
||||||
///
|
///
|
||||||
/// This is called when clothing or body parts are updated (for instance, with new textures or
|
/// This is called when clothing or body parts are updated (for
|
||||||
/// colours). It may also be called in other situations.
|
/// instance, with new textures or colours). It may also be called in
|
||||||
|
/// other situations.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
/// <param name="transactionID"></param>
|
/// <param name="transactionID"></param>
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, UUID transactionID,
|
public void HandleItemUpdateFromTransaction(IClientAPI remoteClient,
|
||||||
InventoryItemBase item)
|
UUID transactionID, InventoryItemBase item)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}",
|
// "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}",
|
||||||
// item.Name);
|
// item.Name);
|
||||||
|
|
||||||
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
AgentAssetTransactions transactions =
|
||||||
|
GetUserTransactions(remoteClient.AgentId);
|
||||||
|
|
||||||
transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item);
|
transactions.RequestUpdateInventoryItem(remoteClient,
|
||||||
|
transactionID, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update a task inventory item with data that has been received through a transaction.
|
/// Update a task inventory item with data that has been received
|
||||||
|
/// through a transaction.
|
||||||
///
|
///
|
||||||
/// This is currently called when, for instance, a notecard in a prim is saved. The data is sent
|
/// This is currently called when, for instance, a notecard in a prim
|
||||||
/// up through a single AssetUploadRequest. A subsequent UpdateTaskInventory then references the transaction
|
/// is saved. The data is sent up through a single AssetUploadRequest.
|
||||||
|
/// A subsequent UpdateTaskInventory then references the transaction
|
||||||
/// and comes through this method.
|
/// and comes through this method.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
/// <param name="transactionID"></param>
|
/// <param name="transactionID"></param>
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
public void HandleTaskItemUpdateFromTransaction(
|
public void HandleTaskItemUpdateFromTransaction(IClientAPI remoteClient,
|
||||||
IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
|
SceneObjectPart part, UUID transactionID,
|
||||||
|
TaskInventoryItem item)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0}",
|
// "[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0}",
|
||||||
// item.Name);
|
// item.Name);
|
||||||
|
|
||||||
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
AgentAssetTransactions transactions =
|
||||||
|
GetUserTransactions(remoteClient.AgentId);
|
||||||
|
|
||||||
transactions.RequestUpdateTaskInventoryItem(remoteClient, part, transactionID, item);
|
transactions.RequestUpdateTaskInventoryItem(remoteClient, part,
|
||||||
|
transactionID, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -227,8 +230,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <param name="data"></param></param>
|
/// <param name="data"></param></param>
|
||||||
/// <param name="tempFile"></param>
|
/// <param name="tempFile"></param>
|
||||||
public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type,
|
public void HandleUDPUploadRequest(IClientAPI remoteClient,
|
||||||
byte[] data, bool storeLocal, bool tempFile)
|
UUID assetID, UUID transaction, sbyte type, byte[] data,
|
||||||
|
bool storeLocal, bool tempFile)
|
||||||
{
|
{
|
||||||
// m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile);
|
// m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile);
|
||||||
|
|
||||||
|
@ -251,27 +255,33 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
AgentAssetTransactions transactions =
|
||||||
|
GetUserTransactions(remoteClient.AgentId);
|
||||||
|
|
||||||
|
AssetXferUploader uploader =
|
||||||
|
transactions.RequestXferUploader(transaction);
|
||||||
|
|
||||||
AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
|
|
||||||
if (uploader != null)
|
if (uploader != null)
|
||||||
{
|
{
|
||||||
uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile);
|
uploader.Initialise(remoteClient, assetID, transaction, type,
|
||||||
|
data, storeLocal, tempFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle asset transfer data packets received in response to the asset upload request in
|
/// Handle asset transfer data packets received in response to the
|
||||||
/// HandleUDPUploadRequest()
|
/// asset upload request in HandleUDPUploadRequest()
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
/// <param name="xferID"></param>
|
/// <param name="xferID"></param>
|
||||||
/// <param name="packetID"></param>
|
/// <param name="packetID"></param>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
|
public void HandleXfer(IClientAPI remoteClient, ulong xferID,
|
||||||
|
uint packetID, byte[] data)
|
||||||
{
|
{
|
||||||
//m_log.Debug("xferID: " + xferID + " packetID: " + packetID + " data!");
|
//m_log.Debug("xferID: " + xferID + " packetID: " + packetID + " data!");
|
||||||
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
AgentAssetTransactions transactions =
|
||||||
|
GetUserTransactions(remoteClient.AgentId);
|
||||||
|
|
||||||
transactions.HandleXfer(xferID, packetID, data);
|
transactions.HandleXfer(xferID, packetID, data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
|
@ -50,17 +50,17 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
private bool m_finished = false;
|
private bool m_finished = false;
|
||||||
private string m_name = String.Empty;
|
private string m_name = String.Empty;
|
||||||
private bool m_storeLocal;
|
private bool m_storeLocal;
|
||||||
private AgentAssetTransactions m_userTransactions;
|
|
||||||
private uint nextPerm = 0;
|
private uint nextPerm = 0;
|
||||||
private IClientAPI ourClient;
|
private IClientAPI ourClient;
|
||||||
private UUID TransactionID = UUID.Zero;
|
private UUID TransactionID = UUID.Zero;
|
||||||
private sbyte type = 0;
|
private sbyte type = 0;
|
||||||
private byte wearableType = 0;
|
private byte wearableType = 0;
|
||||||
public ulong XferID;
|
public ulong XferID;
|
||||||
|
private Scene m_Scene;
|
||||||
|
|
||||||
public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile)
|
public AssetXferUploader(Scene scene, bool dumpAssetToFile)
|
||||||
{
|
{
|
||||||
m_userTransactions = transactions;
|
m_Scene = scene;
|
||||||
m_dumpAssetToFile = dumpAssetToFile;
|
m_dumpAssetToFile = dumpAssetToFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,11 +108,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
/// <param name="packetID"></param>
|
/// <param name="packetID"></param>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
/// <returns>True if the transfer is complete, false otherwise</returns>
|
/// <returns>True if the transfer is complete, false otherwise</returns>
|
||||||
public bool Initialise(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, byte[] data,
|
public bool Initialise(IClientAPI remoteClient, UUID assetID,
|
||||||
bool storeLocal, bool tempFile)
|
UUID transaction, sbyte type, byte[] data, bool storeLocal,
|
||||||
|
bool tempFile)
|
||||||
{
|
{
|
||||||
ourClient = remoteClient;
|
ourClient = remoteClient;
|
||||||
m_asset = new AssetBase(assetID, "blank", type, remoteClient.AgentId.ToString());
|
m_asset = new AssetBase(assetID, "blank", type,
|
||||||
|
remoteClient.AgentId.ToString());
|
||||||
m_asset.Data = data;
|
m_asset.Data = data;
|
||||||
m_asset.Description = "empty";
|
m_asset.Description = "empty";
|
||||||
m_asset.Local = storeLocal;
|
m_asset.Local = storeLocal;
|
||||||
|
@ -137,12 +139,14 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
protected void RequestStartXfer()
|
protected void RequestStartXfer()
|
||||||
{
|
{
|
||||||
XferID = Util.GetNextXferID();
|
XferID = Util.GetNextXferID();
|
||||||
ourClient.SendXferRequest(XferID, m_asset.Type, m_asset.FullID, 0, new byte[0]);
|
ourClient.SendXferRequest(XferID, m_asset.Type, m_asset.FullID,
|
||||||
|
0, new byte[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SendCompleteMessage()
|
protected void SendCompleteMessage()
|
||||||
{
|
{
|
||||||
ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true, m_asset.FullID);
|
ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true,
|
||||||
|
m_asset.FullID);
|
||||||
|
|
||||||
m_finished = true;
|
m_finished = true;
|
||||||
if (m_createItem)
|
if (m_createItem)
|
||||||
|
@ -151,18 +155,20 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
}
|
}
|
||||||
else if (m_storeLocal)
|
else if (m_storeLocal)
|
||||||
{
|
{
|
||||||
m_userTransactions.Manager.MyScene.AssetService.Store(m_asset);
|
m_Scene.AssetService.Store(m_asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[ASSET TRANSACTIONS]: Uploaded asset {0} for transaction {1}", m_asset.FullID, TransactionID);
|
"[ASSET TRANSACTIONS]: Uploaded asset {0} for transaction {1}",
|
||||||
|
m_asset.FullID, TransactionID);
|
||||||
|
|
||||||
if (m_dumpAssetToFile)
|
if (m_dumpAssetToFile)
|
||||||
{
|
{
|
||||||
DateTime now = DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
string filename =
|
string filename =
|
||||||
String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat", now.Year, now.Month, now.Day,
|
String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat",
|
||||||
now.Hour, now.Minute, now.Second, m_asset.Name, m_asset.Type);
|
now.Year, now.Month, now.Day, now.Hour, now.Minute,
|
||||||
|
now.Second, m_asset.Name, m_asset.Type);
|
||||||
SaveAssetToFile(filename, m_asset.Data);
|
SaveAssetToFile(filename, m_asset.Data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,9 +187,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
fs.Close();
|
fs.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RequestCreateInventoryItem(IClientAPI remoteClient, UUID transactionID, UUID folderID,
|
public void RequestCreateInventoryItem(IClientAPI remoteClient,
|
||||||
uint callbackID, string description, string name, sbyte invType,
|
UUID transactionID, UUID folderID, uint callbackID,
|
||||||
sbyte type, byte wearableType, uint nextOwnerMask)
|
string description, string name, sbyte invType,
|
||||||
|
sbyte type, byte wearableType, uint nextOwnerMask)
|
||||||
{
|
{
|
||||||
if (TransactionID == transactionID)
|
if (TransactionID == transactionID)
|
||||||
{
|
{
|
||||||
|
@ -212,7 +219,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
|
|
||||||
private void DoCreateItem(uint callbackID)
|
private void DoCreateItem(uint callbackID)
|
||||||
{
|
{
|
||||||
m_userTransactions.Manager.MyScene.AssetService.Store(m_asset);
|
m_Scene.AssetService.Store(m_asset);
|
||||||
|
|
||||||
InventoryItemBase item = new InventoryItemBase();
|
InventoryItemBase item = new InventoryItemBase();
|
||||||
item.Owner = ourClient.AgentId;
|
item.Owner = ourClient.AgentId;
|
||||||
|
@ -232,7 +239,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||||
item.Flags = (uint) wearableType;
|
item.Flags = (uint) wearableType;
|
||||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||||
|
|
||||||
if (m_userTransactions.Manager.MyScene.AddInventoryItem(item))
|
if (m_Scene.AddInventoryItem(item))
|
||||||
ourClient.SendInventoryItemCreateUpdate(item, callbackID);
|
ourClient.SendInventoryItemCreateUpdate(item, callbackID);
|
||||||
else
|
else
|
||||||
ourClient.SendAlertMessage("Unable to create inventory item");
|
ourClient.SendAlertMessage("Unable to create inventory item");
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
@ -35,6 +37,7 @@ using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.StructuredData;
|
using OpenMetaverse.StructuredData;
|
||||||
|
using OpenMetaverse.Imaging;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
|
@ -74,6 +77,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
private IAssetService m_assetService;
|
private IAssetService m_assetService;
|
||||||
|
|
||||||
|
public const string DefaultFormat = "x-j2c";
|
||||||
|
|
||||||
|
// TODO: Change this to a config option
|
||||||
|
const string REDIRECT_URL = null;
|
||||||
|
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region IRegionModule Members
|
||||||
|
|
||||||
public void Initialise(Scene pScene, IConfigSource pSource)
|
public void Initialise(Scene pScene, IConfigSource pSource)
|
||||||
|
@ -96,7 +105,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
||||||
{
|
{
|
||||||
UUID capID = UUID.Random();
|
UUID capID = UUID.Random();
|
||||||
|
|
||||||
m_log.Info("[GETTEXTURE]: /CAPS/" + capID);
|
m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||||
caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,12 +113,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
||||||
|
|
||||||
private byte[] ProcessGetTexture(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
private byte[] ProcessGetTexture(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||||
{
|
{
|
||||||
// TODO: Change this to a config option
|
//m_log.DebugFormat("[GETTEXTURE]: called in {0}", m_scene.RegionInfo.RegionName);
|
||||||
const string REDIRECT_URL = null;
|
|
||||||
|
|
||||||
// Try to parse the texture ID from the request URL
|
// Try to parse the texture ID from the request URL
|
||||||
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
||||||
string textureStr = query.GetOne("texture_id");
|
string textureStr = query.GetOne("texture_id");
|
||||||
|
string format = query.GetOne("format");
|
||||||
|
|
||||||
if (m_assetService == null)
|
if (m_assetService == null)
|
||||||
{
|
{
|
||||||
|
@ -121,52 +130,27 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
||||||
UUID textureID;
|
UUID textureID;
|
||||||
if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
|
if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[GETTEXTURE]: {0}", textureID);
|
string[] formats;
|
||||||
AssetBase texture;
|
if (format != null && format != string.Empty)
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(REDIRECT_URL))
|
|
||||||
{
|
{
|
||||||
// Only try to fetch locally cached textures. Misses are redirected
|
formats = new string[1] { format.ToLower() };
|
||||||
texture = m_assetService.GetCached(textureID.ToString());
|
|
||||||
|
|
||||||
if (texture != null)
|
|
||||||
{
|
|
||||||
if (texture.Type != (sbyte)AssetType.Texture)
|
|
||||||
{
|
|
||||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
|
||||||
httpResponse.Send();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
SendTexture(httpRequest, httpResponse, texture);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string textureUrl = REDIRECT_URL + textureID.ToString();
|
|
||||||
m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
|
|
||||||
httpResponse.RedirectLocation = textureUrl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Fetch locally or remotely. Misses return a 404
|
formats = WebUtil.GetPreferredImageTypes(httpRequest.Headers.Get("Accept"));
|
||||||
texture = m_assetService.Get(textureID.ToString());
|
if (formats.Length == 0)
|
||||||
|
formats = new string[1] { DefaultFormat }; // default
|
||||||
|
|
||||||
if (texture != null)
|
|
||||||
{
|
|
||||||
if (texture.Type != (sbyte)AssetType.Texture)
|
|
||||||
{
|
|
||||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
|
||||||
httpResponse.Send();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
SendTexture(httpRequest, httpResponse, texture);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
|
|
||||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// OK, we have an array with preferred formats, possibly with only one entry
|
||||||
|
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
|
foreach (string f in formats)
|
||||||
|
{
|
||||||
|
if (FetchTexture(httpRequest, httpResponse, textureID, f))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -177,11 +161,105 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendTexture(OSHttpRequest request, OSHttpResponse response, AssetBase texture)
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="httpRequest"></param>
|
||||||
|
/// <param name="httpResponse"></param>
|
||||||
|
/// <param name="textureID"></param>
|
||||||
|
/// <param name="format"></param>
|
||||||
|
/// <returns>False for "caller try another codec"; true otherwise</returns>
|
||||||
|
private bool FetchTexture(OSHttpRequest httpRequest, OSHttpResponse httpResponse, UUID textureID, string format)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
|
||||||
|
AssetBase texture;
|
||||||
|
|
||||||
|
string fullID = textureID.ToString();
|
||||||
|
if (format != DefaultFormat)
|
||||||
|
fullID = fullID + "-" + format;
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(REDIRECT_URL))
|
||||||
|
{
|
||||||
|
// Only try to fetch locally cached textures. Misses are redirected
|
||||||
|
texture = m_assetService.GetCached(fullID);
|
||||||
|
|
||||||
|
if (texture != null)
|
||||||
|
{
|
||||||
|
if (texture.Type != (sbyte)AssetType.Texture)
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
WriteTextureData(httpRequest, httpResponse, texture, format);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string textureUrl = REDIRECT_URL + textureID.ToString();
|
||||||
|
m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
|
||||||
|
httpResponse.RedirectLocation = textureUrl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // no redirect
|
||||||
|
{
|
||||||
|
// try the cache
|
||||||
|
texture = m_assetService.GetCached(fullID);
|
||||||
|
|
||||||
|
if (texture == null)
|
||||||
|
{
|
||||||
|
//m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache");
|
||||||
|
|
||||||
|
// Fetch locally or remotely. Misses return a 404
|
||||||
|
texture = m_assetService.Get(textureID.ToString());
|
||||||
|
|
||||||
|
if (texture != null)
|
||||||
|
{
|
||||||
|
if (texture.Type != (sbyte)AssetType.Texture)
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (format == DefaultFormat)
|
||||||
|
{
|
||||||
|
WriteTextureData(httpRequest, httpResponse, texture, format);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID);
|
||||||
|
newTexture.Data = ConvertTextureData(texture, format);
|
||||||
|
if (newTexture.Data.Length == 0)
|
||||||
|
return false; // !!! Caller try another codec, please!
|
||||||
|
|
||||||
|
newTexture.Flags = AssetFlags.Collectable;
|
||||||
|
newTexture.Temporary = true;
|
||||||
|
m_assetService.Store(newTexture);
|
||||||
|
WriteTextureData(httpRequest, httpResponse, newTexture, format);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // it was on the cache
|
||||||
|
{
|
||||||
|
//m_log.DebugFormat("[GETTEXTURE]: texture was in the cache");
|
||||||
|
WriteTextureData(httpRequest, httpResponse, texture, format);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// not found
|
||||||
|
m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
|
||||||
|
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteTextureData(OSHttpRequest request, OSHttpResponse response, AssetBase texture, string format)
|
||||||
{
|
{
|
||||||
string range = request.Headers.GetOne("Range");
|
string range = request.Headers.GetOne("Range");
|
||||||
//m_log.DebugFormat("[GETTEXTURE]: Range {0}", range);
|
//m_log.DebugFormat("[GETTEXTURE]: Range {0}", range);
|
||||||
if (!String.IsNullOrEmpty(range))
|
if (!String.IsNullOrEmpty(range)) // JP2's only
|
||||||
{
|
{
|
||||||
// Range request
|
// Range request
|
||||||
int start, end;
|
int start, end;
|
||||||
|
@ -212,15 +290,19 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Warn("Malformed Range header: " + range);
|
m_log.Warn("[GETTEXTURE]: Malformed Range header: " + range);
|
||||||
response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
|
response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // JP2's or other formats
|
||||||
{
|
{
|
||||||
// Full content request
|
// Full content request
|
||||||
|
response.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||||
response.ContentLength = texture.Data.Length;
|
response.ContentLength = texture.Data.Length;
|
||||||
response.ContentType = texture.Metadata.ContentType;
|
if (format == DefaultFormat)
|
||||||
|
response.ContentType = texture.Metadata.ContentType;
|
||||||
|
else
|
||||||
|
response.ContentType = "image/" + format;
|
||||||
response.Body.Write(texture.Data, 0, texture.Data.Length);
|
response.Body.Write(texture.Data, 0, texture.Data.Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,5 +322,83 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
||||||
start = end = 0;
|
start = end = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private byte[] ConvertTextureData(AssetBase texture, string format)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format);
|
||||||
|
byte[] data = new byte[0];
|
||||||
|
|
||||||
|
MemoryStream imgstream = new MemoryStream();
|
||||||
|
Bitmap mTexture = new Bitmap(1, 1);
|
||||||
|
ManagedImage managedImage;
|
||||||
|
Image image = (Image)mTexture;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
|
||||||
|
|
||||||
|
imgstream = new MemoryStream();
|
||||||
|
|
||||||
|
// Decode image to System.Drawing.Image
|
||||||
|
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image))
|
||||||
|
{
|
||||||
|
// Save to bitmap
|
||||||
|
mTexture = new Bitmap(image);
|
||||||
|
|
||||||
|
EncoderParameters myEncoderParameters = new EncoderParameters();
|
||||||
|
myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, 95L);
|
||||||
|
|
||||||
|
// Save bitmap to stream
|
||||||
|
ImageCodecInfo codec = GetEncoderInfo("image/" + format);
|
||||||
|
if (codec != null)
|
||||||
|
{
|
||||||
|
mTexture.Save(imgstream, codec, myEncoderParameters);
|
||||||
|
// Write the stream to a byte array for output
|
||||||
|
data = imgstream.ToArray();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_log.WarnFormat("[GETTEXTURE]: No such codec {0}", format);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[GETTEXTURE]: Unable to convert texture {0} to {1}: {2}", texture.ID, format, e.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
// Reclaim memory, these are unmanaged resources
|
||||||
|
// If we encountered an exception, one or more of these will be null
|
||||||
|
if (mTexture != null)
|
||||||
|
mTexture.Dispose();
|
||||||
|
|
||||||
|
if (image != null)
|
||||||
|
image.Dispose();
|
||||||
|
|
||||||
|
if (imgstream != null)
|
||||||
|
{
|
||||||
|
imgstream.Close();
|
||||||
|
imgstream.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// From msdn
|
||||||
|
private static ImageCodecInfo GetEncoderInfo(String mimeType)
|
||||||
|
{
|
||||||
|
ImageCodecInfo[] encoders;
|
||||||
|
encoders = ImageCodecInfo.GetImageEncoders();
|
||||||
|
for (int j = 0; j < encoders.Length; ++j)
|
||||||
|
{
|
||||||
|
if (encoders[j].MimeType == mimeType)
|
||||||
|
return encoders[j];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check for the existence of the baked texture assets. Request a rebake
|
||||||
|
/// unless checkonly is true.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="checkonly"></param>
|
||||||
public bool ValidateBakedTextureCache(IClientAPI client)
|
public bool ValidateBakedTextureCache(IClientAPI client)
|
||||||
|
{
|
||||||
|
return ValidateBakedTextureCache(client, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ValidateBakedTextureCache(IClientAPI client, bool checkonly)
|
||||||
{
|
{
|
||||||
ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
|
ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
|
||||||
if (sp == null)
|
if (sp == null)
|
||||||
|
@ -131,15 +142,33 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
{
|
{
|
||||||
int idx = AvatarAppearance.BAKE_INDICES[i];
|
int idx = AvatarAppearance.BAKE_INDICES[i];
|
||||||
Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx];
|
Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx];
|
||||||
if (face == null || face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
|
|
||||||
|
// if there is no texture entry, skip it
|
||||||
|
if (face == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// if the texture is one of the "defaults" then skip it
|
||||||
|
// this should probably be more intelligent (skirt texture doesnt matter
|
||||||
|
// if the avatar isnt wearing a skirt) but if any of the main baked
|
||||||
|
// textures is default then the rest should be as well
|
||||||
|
if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
defonly = false; // found a non-default texture reference
|
defonly = false; // found a non-default texture reference
|
||||||
|
|
||||||
if (! CheckBakedTextureAsset(client,face.TextureID,idx))
|
if (! CheckBakedTextureAsset(client,face.TextureID,idx))
|
||||||
return false;
|
{
|
||||||
|
// the asset didn't exist if we are only checking, then we found a bad
|
||||||
|
// one and we're done otherwise, ask for a rebake
|
||||||
|
if (checkonly) return false;
|
||||||
|
|
||||||
|
m_log.InfoFormat("[AVFACTORY] missing baked texture {0}, request rebake",face.TextureID);
|
||||||
|
client.SendRebakeAvatarTextures(face.TextureID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_log.InfoFormat("[AVFACTORY]: complete texture check for {0}",client.AgentId);
|
||||||
|
|
||||||
// If we only found default textures, then the appearance is not cached
|
// If we only found default textures, then the appearance is not cached
|
||||||
return (defonly ? false : true);
|
return (defonly ? false : true);
|
||||||
}
|
}
|
||||||
|
@ -158,61 +187,43 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_log.WarnFormat("[AVFACTORY]: Start SetAppearance for {0}",client.AgentId);
|
m_log.InfoFormat("[AVFACTORY]: start SetAppearance for {0}",client.AgentId);
|
||||||
|
|
||||||
|
// TODO: This is probably not necessary any longer, just assume the
|
||||||
|
// textureEntry set implies that the appearance transaction is complete
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
// Process the texture entry transactionally, this doesn't guarantee that Appearance is
|
// Process the texture entry transactionally, this doesn't guarantee that Appearance is
|
||||||
// going to be handled correctly but it does serialize the updates to the appearance
|
// going to be handled correctly but it does serialize the updates to the appearance
|
||||||
lock (m_setAppearanceLock)
|
lock (m_setAppearanceLock)
|
||||||
{
|
{
|
||||||
if (textureEntry != null)
|
|
||||||
{
|
|
||||||
changed = sp.Appearance.SetTextureEntries(textureEntry);
|
|
||||||
|
|
||||||
// m_log.WarnFormat("[AVFACTORY]: Prepare to check textures for {0}",client.AgentId);
|
|
||||||
|
|
||||||
for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
|
|
||||||
{
|
|
||||||
int idx = AvatarAppearance.BAKE_INDICES[i];
|
|
||||||
Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx];
|
|
||||||
if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
|
|
||||||
Util.FireAndForget(delegate(object o) {
|
|
||||||
if (! CheckBakedTextureAsset(client,face.TextureID,idx))
|
|
||||||
client.SendRebakeAvatarTextures(face.TextureID);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// m_log.WarnFormat("[AVFACTORY]: Complete texture check for {0}",client.AgentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process the visual params, this may change height as well
|
// Process the visual params, this may change height as well
|
||||||
if (visualParams != null)
|
if (visualParams != null)
|
||||||
{
|
{
|
||||||
if (sp.Appearance.SetVisualParams(visualParams))
|
changed = sp.Appearance.SetVisualParams(visualParams);
|
||||||
{
|
if (sp.Appearance.AvatarHeight > 0)
|
||||||
changed = true;
|
sp.SetHeight(sp.Appearance.AvatarHeight);
|
||||||
if (sp.Appearance.AvatarHeight > 0)
|
|
||||||
sp.SetHeight(sp.Appearance.AvatarHeight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the appearance back to the avatar, not clear that this is needed
|
// Process the baked texture array
|
||||||
sp.ControllingClient.SendAvatarDataImmediate(sp);
|
if (textureEntry != null)
|
||||||
// AvatarAppearance avp = sp.Appearance;
|
{
|
||||||
// sp.ControllingClient.SendAppearance(avp.Owner,avp.VisualParams,avp.Texture.GetBytes());
|
changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
|
||||||
|
|
||||||
|
m_log.InfoFormat("[AVFACTORY]: received texture update for {0}",client.AgentId);
|
||||||
|
Util.FireAndForget(delegate(object o) { ValidateBakedTextureCache(client,false); });
|
||||||
|
|
||||||
|
// This appears to be set only in the final stage of the appearance
|
||||||
|
// update transaction. In theory, we should be able to do an immediate
|
||||||
|
// appearance send and save here.
|
||||||
|
|
||||||
|
QueueAppearanceSave(client.AgentId);
|
||||||
|
QueueAppearanceSend(client.AgentId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString());
|
||||||
// If something changed in the appearance then queue an appearance save
|
|
||||||
if (changed)
|
|
||||||
QueueAppearanceSave(client.AgentId);
|
|
||||||
|
|
||||||
// And always queue up an appearance update to send out
|
|
||||||
QueueAppearanceSend(client.AgentId);
|
|
||||||
|
|
||||||
// m_log.WarnFormat("[AVFACTORY]: Complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -235,6 +246,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
|
|
||||||
#region UpdateAppearanceTimer
|
#region UpdateAppearanceTimer
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Queue up a request to send appearance, makes it possible to
|
||||||
|
/// accumulate changes without sending out each one separately.
|
||||||
|
/// </summary>
|
||||||
public void QueueAppearanceSend(UUID agentid)
|
public void QueueAppearanceSend(UUID agentid)
|
||||||
{
|
{
|
||||||
// m_log.WarnFormat("[AVFACTORY]: Queue appearance send for {0}", agentid);
|
// m_log.WarnFormat("[AVFACTORY]: Queue appearance send for {0}", agentid);
|
||||||
|
@ -300,21 +315,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
|
|
||||||
// Send the appearance to everyone in the scene
|
// Send the appearance to everyone in the scene
|
||||||
sp.SendAppearanceToAllOtherAgents();
|
sp.SendAppearanceToAllOtherAgents();
|
||||||
// sp.ControllingClient.SendAvatarDataImmediate(sp);
|
|
||||||
|
|
||||||
// Send the appearance back to the avatar
|
// Send animations back to the avatar as well
|
||||||
// AvatarAppearance avp = sp.Appearance;
|
sp.Animator.SendAnimPack();
|
||||||
// sp.ControllingClient.SendAppearance(avp.Owner, avp.VisualParams, avp.Texture.GetBytes());
|
|
||||||
|
|
||||||
/*
|
|
||||||
// this needs to be fixed, the flag should be on scene presence not the region module
|
|
||||||
// Start the animations if necessary
|
|
||||||
if (!m_startAnimationSet)
|
|
||||||
{
|
|
||||||
sp.Animator.UpdateMovementAnimations();
|
|
||||||
m_startAnimationSet = true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleAppearanceSave(UUID agentid)
|
private void HandleAppearanceSave(UUID agentid)
|
||||||
|
@ -405,6 +408,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
|
|
||||||
// m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}", client.AgentId);
|
// m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}", client.AgentId);
|
||||||
|
|
||||||
|
// we need to clean out the existing textures
|
||||||
|
sp.Appearance.ResetAppearance();
|
||||||
|
|
||||||
|
// operate on a copy of the appearance so we don't have to lock anything
|
||||||
AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false);
|
AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false);
|
||||||
|
|
||||||
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
|
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
|
||||||
|
@ -419,9 +426,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
SetAppearanceAssets(sp.UUID, ref avatAppearance);
|
SetAppearanceAssets(sp.UUID, ref avatAppearance);
|
||||||
|
|
||||||
// could get fancier with the locks here, but in the spirit of "last write wins"
|
// could get fancier with the locks here, but in the spirit of "last write wins"
|
||||||
// this should work correctly
|
// this should work correctly, also, we don't need to send the appearance here
|
||||||
|
// since the "iswearing" will trigger a new set of visual param and baked texture changes
|
||||||
|
// when those complete, the new appearance will be sent
|
||||||
sp.Appearance = avatAppearance;
|
sp.Appearance = avatAppearance;
|
||||||
m_scene.AvatarService.SetAppearance(client.AgentId, sp.Appearance);
|
QueueAppearanceSave(client.AgentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance)
|
private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance)
|
||||||
|
|
|
@ -599,7 +599,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
XmlRpcResponse GridResp = GridReq.Send("http://" + reginfo.ExternalHostName + ":" + reginfo.HttpPort, 3000);
|
XmlRpcResponse GridResp = GridReq.Send(reginfo.ServerURI, 3000);
|
||||||
|
|
||||||
Hashtable responseData = (Hashtable)GridResp.Value;
|
Hashtable responseData = (Hashtable)GridResp.Value;
|
||||||
|
|
||||||
|
@ -621,8 +621,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
}
|
}
|
||||||
catch (WebException e)
|
catch (WebException e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to http://{0}:{1} the host didn't respond ({2})",
|
m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0}} the host didn't respond ({2})",
|
||||||
reginfo.ExternalHostName, reginfo.HttpPort, e.Message);
|
reginfo.ServerURI, e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -37,12 +37,11 @@ using System.Xml.Linq;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
|
||||||
using OpenSim.Framework.Communications.Osp;
|
|
||||||
using OpenSim.Framework.Serialization;
|
using OpenSim.Framework.Serialization;
|
||||||
using OpenSim.Framework.Serialization.External;
|
using OpenSim.Framework.Serialization.External;
|
||||||
using OpenSim.Region.CoreModules.World.Archiver;
|
using OpenSim.Region.CoreModules.World.Archiver;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
|
@ -399,15 +398,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
item.ID = UUID.Random();
|
item.ID = UUID.Random();
|
||||||
|
|
||||||
UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService);
|
UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService);
|
||||||
if (UUID.Zero != ospResolvedId)
|
if (UUID.Zero != ospResolvedId) // The user exists in this grid
|
||||||
{
|
{
|
||||||
item.CreatorIdAsUuid = ospResolvedId;
|
item.CreatorIdAsUuid = ospResolvedId;
|
||||||
|
|
||||||
// XXX: For now, don't preserve the OSPA in the creator id (which actually gets persisted to the
|
// XXX: For now, don't preserve the OSPA in the creator id (which actually gets persisted to the
|
||||||
// database). Instead, replace with the UUID that we found.
|
// database). Instead, replace with the UUID that we found.
|
||||||
item.CreatorId = ospResolvedId.ToString();
|
item.CreatorId = ospResolvedId.ToString();
|
||||||
|
|
||||||
|
item.CreatorData = string.Empty;
|
||||||
}
|
}
|
||||||
else
|
else if (item.CreatorData == null || item.CreatorData == String.Empty)
|
||||||
{
|
{
|
||||||
item.CreatorIdAsUuid = m_userInfo.PrincipalID;
|
item.CreatorIdAsUuid = m_userInfo.PrincipalID;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,6 @@ using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Serialization;
|
using OpenSim.Framework.Serialization;
|
||||||
using OpenSim.Framework.Serialization.External;
|
using OpenSim.Framework.Serialization.External;
|
||||||
using OpenSim.Framework.Communications;
|
|
||||||
using OpenSim.Framework.Communications.Osp;
|
|
||||||
using OpenSim.Region.CoreModules.World.Archiver;
|
using OpenSim.Region.CoreModules.World.Archiver;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
@ -139,20 +137,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
|
m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SaveInvItem(InventoryItemBase inventoryItem, string path)
|
protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService)
|
||||||
{
|
{
|
||||||
string filename = path + CreateArchiveItemName(inventoryItem);
|
string filename = path + CreateArchiveItemName(inventoryItem);
|
||||||
|
|
||||||
// Record the creator of this item for user record purposes (which might go away soon)
|
// Record the creator of this item for user record purposes (which might go away soon)
|
||||||
m_userUuids[inventoryItem.CreatorIdAsUuid] = 1;
|
m_userUuids[inventoryItem.CreatorIdAsUuid] = 1;
|
||||||
|
|
||||||
InventoryItemBase saveItem = (InventoryItemBase)inventoryItem.Clone();
|
string serialization = UserInventoryItemSerializer.Serialize(inventoryItem, options, userAccountService);
|
||||||
saveItem.CreatorId = OspResolver.MakeOspa(saveItem.CreatorIdAsUuid, m_scene.UserAccountService);
|
|
||||||
|
|
||||||
string serialization = UserInventoryItemSerializer.Serialize(saveItem);
|
|
||||||
m_archiveWriter.WriteFile(filename, serialization);
|
m_archiveWriter.WriteFile(filename, serialization);
|
||||||
|
|
||||||
m_assetGatherer.GatherAssetUuids(saveItem.AssetID, (AssetType)saveItem.AssetType, m_assetUuids);
|
m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (AssetType)inventoryItem.AssetType, m_assetUuids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -161,7 +156,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// <param name="inventoryFolder">The inventory folder to save</param>
|
/// <param name="inventoryFolder">The inventory folder to save</param>
|
||||||
/// <param name="path">The path to which the folder should be saved</param>
|
/// <param name="path">The path to which the folder should be saved</param>
|
||||||
/// <param name="saveThisFolderItself">If true, save this folder itself. If false, only saves contents</param>
|
/// <param name="saveThisFolderItself">If true, save this folder itself. If false, only saves contents</param>
|
||||||
protected void SaveInvFolder(InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself)
|
protected void SaveInvFolder(InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, Dictionary<string, object> options, IUserAccountService userAccountService)
|
||||||
{
|
{
|
||||||
if (saveThisFolderItself)
|
if (saveThisFolderItself)
|
||||||
{
|
{
|
||||||
|
@ -176,19 +171,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
|
|
||||||
foreach (InventoryFolderBase childFolder in contents.Folders)
|
foreach (InventoryFolderBase childFolder in contents.Folders)
|
||||||
{
|
{
|
||||||
SaveInvFolder(childFolder, path, true);
|
SaveInvFolder(childFolder, path, true, options, userAccountService);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (InventoryItemBase item in contents.Items)
|
foreach (InventoryItemBase item in contents.Items)
|
||||||
{
|
{
|
||||||
SaveInvItem(item, path);
|
SaveInvItem(item, path, options, userAccountService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Execute the inventory write request
|
/// Execute the inventory write request
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Execute()
|
public void Execute(Dictionary<string, object> options, IUserAccountService userAccountService)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -266,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath);
|
m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath);
|
||||||
|
|
||||||
//recurse through all dirs getting dirs and files
|
//recurse through all dirs getting dirs and files
|
||||||
SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly);
|
SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly, options, userAccountService);
|
||||||
}
|
}
|
||||||
else if (inventoryItem != null)
|
else if (inventoryItem != null)
|
||||||
{
|
{
|
||||||
|
@ -274,14 +269,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
"[INVENTORY ARCHIVER]: Found item {0} {1} at {2}",
|
"[INVENTORY ARCHIVER]: Found item {0} {1} at {2}",
|
||||||
inventoryItem.Name, inventoryItem.ID, m_invPath);
|
inventoryItem.Name, inventoryItem.ID, m_invPath);
|
||||||
|
|
||||||
SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH);
|
SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH, options, userAccountService);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't put all this profile information into the archive right now.
|
// Don't put all this profile information into the archive right now.
|
||||||
//SaveUsers();
|
//SaveUsers();
|
||||||
|
|
||||||
new AssetsRequest(
|
new AssetsRequest(
|
||||||
new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute();
|
new AssetsArchiver(m_archiveWriter),
|
||||||
|
m_assetUuids, m_scene.AssetService,
|
||||||
|
m_scene.UserAccountService, m_scene.RegionInfo.ScopeID,
|
||||||
|
options, ReceivedAllAssets).Execute();
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,6 +75,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
||||||
private Scene m_aScene;
|
private Scene m_aScene;
|
||||||
|
|
||||||
|
private IUserAccountService m_UserAccountService;
|
||||||
|
protected IUserAccountService UserAccountService
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (m_UserAccountService == null)
|
||||||
|
// What a strange thing to do...
|
||||||
|
foreach (Scene s in m_scenes.Values)
|
||||||
|
{
|
||||||
|
m_UserAccountService = s.RequestModuleInterface<IUserAccountService>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_UserAccountService;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public InventoryArchiverModule() {}
|
public InventoryArchiverModule() {}
|
||||||
|
|
||||||
public InventoryArchiverModule(bool disablePresenceChecks)
|
public InventoryArchiverModule(bool disablePresenceChecks)
|
||||||
|
@ -106,11 +124,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
|
|
||||||
scene.AddCommand(
|
scene.AddCommand(
|
||||||
this, "save iar",
|
this, "save iar",
|
||||||
"save iar <first> <last> <inventory path> <password> [<IAR path>]",
|
"save iar <first> <last> <inventory path> <password> [--p|-profile=<url>] [<IAR path>]",
|
||||||
"Save user inventory archive (IAR).",
|
"Save user inventory archive (IAR).",
|
||||||
"<first> is the user's first name." + Environment.NewLine
|
"<first> is the user's first name." + Environment.NewLine
|
||||||
+ "<last> is the user's last name." + Environment.NewLine
|
+ "<last> is the user's last name." + Environment.NewLine
|
||||||
+ "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine
|
+ "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine
|
||||||
|
+ "-p|--profile=<url> adds the url of the profile service to the saved user information." + Environment.NewLine
|
||||||
+ "<IAR path> is the filesystem path at which to save the IAR."
|
+ "<IAR path> is the filesystem path at which to save the IAR."
|
||||||
+ string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME),
|
+ string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME),
|
||||||
HandleSaveInvConsoleCommand);
|
HandleSaveInvConsoleCommand);
|
||||||
|
@ -157,7 +176,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute();
|
new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService);
|
||||||
}
|
}
|
||||||
catch (EntryPointNotFoundException e)
|
catch (EntryPointNotFoundException e)
|
||||||
{
|
{
|
||||||
|
@ -197,7 +216,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute();
|
new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService);
|
||||||
}
|
}
|
||||||
catch (EntryPointNotFoundException e)
|
catch (EntryPointNotFoundException e)
|
||||||
{
|
{
|
||||||
|
@ -240,6 +259,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
{
|
{
|
||||||
if (CheckPresence(userInfo.PrincipalID))
|
if (CheckPresence(userInfo.PrincipalID))
|
||||||
{
|
{
|
||||||
|
|
||||||
InventoryArchiveReadRequest request;
|
InventoryArchiveReadRequest request;
|
||||||
bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
|
bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
|
||||||
|
|
||||||
|
@ -268,6 +288,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID);
|
userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
m_log.ErrorFormat("[INVENTORY ARCHIVER]: User {0} {1} not found",
|
||||||
|
firstName, lastName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -369,9 +392,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
{
|
{
|
||||||
Guid id = Guid.NewGuid();
|
Guid id = Guid.NewGuid();
|
||||||
|
|
||||||
|
Dictionary<string, object> options = new Dictionary<string, object>();
|
||||||
|
|
||||||
|
OptionSet ops = new OptionSet();
|
||||||
|
//ops.Add("v|version=", delegate(string v) { options["version"] = v; });
|
||||||
|
ops.Add("p|profile=", delegate(string v) { options["profile"] = v; });
|
||||||
|
|
||||||
|
List<string> mainParams = ops.Parse(cmdparams);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (cmdparams.Length < 6)
|
if (mainParams.Count < 6)
|
||||||
{
|
{
|
||||||
m_log.Error(
|
m_log.Error(
|
||||||
"[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]");
|
"[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]");
|
||||||
|
@ -379,18 +410,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
||||||
|
if (options.ContainsKey("profile"))
|
||||||
|
m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -profile option if you want to produce a compatible IAR");
|
||||||
|
|
||||||
string firstName = cmdparams[2];
|
string firstName = mainParams[2];
|
||||||
string lastName = cmdparams[3];
|
string lastName = mainParams[3];
|
||||||
string invPath = cmdparams[4];
|
string invPath = mainParams[4];
|
||||||
string pass = cmdparams[5];
|
string pass = mainParams[5];
|
||||||
string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
|
string savePath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME);
|
||||||
|
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
|
"[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
|
||||||
savePath, invPath, firstName, lastName);
|
savePath, invPath, firstName, lastName);
|
||||||
|
|
||||||
ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
|
ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, options);
|
||||||
}
|
}
|
||||||
catch (InventoryArchiverException e)
|
catch (InventoryArchiverException e)
|
||||||
{
|
{
|
||||||
|
@ -518,5 +551,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Serialization;
|
using OpenSim.Framework.Serialization;
|
||||||
using OpenSim.Framework.Serialization.External;
|
using OpenSim.Framework.Serialization.External;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Communications.Osp;
|
|
||||||
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
|
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
|
||||||
using OpenSim.Region.CoreModules.World.Serialiser;
|
using OpenSim.Region.CoreModules.World.Serialiser;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
@ -96,14 +95,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
item1.Name = m_item1Name;
|
item1.Name = m_item1Name;
|
||||||
item1.AssetID = UUID.Random();
|
item1.AssetID = UUID.Random();
|
||||||
item1.GroupID = UUID.Random();
|
item1.GroupID = UUID.Random();
|
||||||
item1.CreatorId = OspResolver.MakeOspa(m_ua2.FirstName, m_ua2.LastName);
|
//item1.CreatorId = OspResolver.MakeOspa(m_ua2.FirstName, m_ua2.LastName);
|
||||||
//item1.CreatorId = userUuid.ToString();
|
//item1.CreatorId = userUuid.ToString();
|
||||||
//item1.CreatorId = "00000000-0000-0000-0000-000000000444";
|
item1.CreatorId = m_ua2.PrincipalID.ToString();
|
||||||
item1.Owner = UUID.Zero;
|
item1.Owner = UUID.Zero;
|
||||||
|
|
||||||
|
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
|
||||||
|
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
|
||||||
|
|
||||||
string item1FileName
|
string item1FileName
|
||||||
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
|
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
|
||||||
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
|
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string, object>(), scene.UserAccountService));
|
||||||
tar.Close();
|
tar.Close();
|
||||||
m_iarStream = new MemoryStream(archiveWriteStream.ToArray());
|
m_iarStream = new MemoryStream(archiveWriteStream.ToArray());
|
||||||
}
|
}
|
||||||
|
@ -551,7 +553,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
|
|
||||||
string item1FileName
|
string item1FileName
|
||||||
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
|
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
|
||||||
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
|
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string,object>(), null));
|
||||||
tar.Close();
|
tar.Close();
|
||||||
|
|
||||||
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
||||||
|
|
|
@ -197,9 +197,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
sp.ControllingClient.SendTeleportFailed("Problem at destination");
|
sp.ControllingClient.SendTeleportFailed("Problem at destination");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}",
|
||||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}",
|
finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI);
|
||||||
finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID);
|
|
||||||
|
|
||||||
// Check that these are not the same coordinates
|
// Check that these are not the same coordinates
|
||||||
if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
|
if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
|
||||||
|
@ -255,8 +254,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}:{2}/{3}",
|
"[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}",
|
||||||
reg.ExternalHostName, reg.HttpPort, finalDestination.RegionName, position);
|
reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
|
||||||
|
|
||||||
uint newRegionX = (uint)(reg.RegionHandle >> 40);
|
uint newRegionX = (uint)(reg.RegionHandle >> 40);
|
||||||
uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
|
uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
|
||||||
|
@ -328,43 +327,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
// OK, it got this agent. Let's close some child agents
|
// OK, it got this agent. Let's close some child agents
|
||||||
sp.CloseChildAgents(newRegionX, newRegionY);
|
sp.CloseChildAgents(newRegionX, newRegionY);
|
||||||
|
IClientIPEndpoint ipepClient;
|
||||||
if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY))
|
if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY))
|
||||||
{
|
{
|
||||||
//sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent...");
|
//sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent...");
|
||||||
|
|
||||||
#region IP Translation for NAT
|
#region IP Translation for NAT
|
||||||
IClientIPEndpoint ipepClient;
|
// Uses ipepClient above
|
||||||
if (sp.ClientView.TryGet(out ipepClient))
|
if (sp.ClientView.TryGet(out ipepClient))
|
||||||
{
|
{
|
||||||
capsPath
|
endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
|
||||||
= "http://"
|
|
||||||
+ NetworkUtil.GetHostFor(ipepClient.EndPoint, finalDestination.ExternalHostName)
|
|
||||||
+ ":"
|
|
||||||
+ finalDestination.HttpPort
|
|
||||||
+ CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
capsPath
|
|
||||||
= "http://"
|
|
||||||
+ finalDestination.ExternalHostName
|
|
||||||
+ ":"
|
|
||||||
+ finalDestination.HttpPort
|
|
||||||
+ CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
|
||||||
|
|
||||||
if (eq != null)
|
if (eq != null)
|
||||||
{
|
{
|
||||||
#region IP Translation for NAT
|
|
||||||
// Uses ipepClient above
|
|
||||||
if (sp.ClientView.TryGet(out ipepClient))
|
|
||||||
{
|
|
||||||
endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
eq.EnableSimulator(destinationHandle, endPoint, sp.UUID);
|
eq.EnableSimulator(destinationHandle, endPoint, sp.UUID);
|
||||||
|
|
||||||
// ES makes the client send a UseCircuitCode message to the destination,
|
// ES makes the client send a UseCircuitCode message to the destination,
|
||||||
|
@ -383,8 +360,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle);
|
agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle);
|
||||||
capsPath = "http://" + finalDestination.ExternalHostName + ":" + finalDestination.HttpPort
|
capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
|
||||||
+ "/CAPS/" + agentCircuit.CapsPath + "0000/";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expect avatar crossing is a heavy-duty function at the destination.
|
// Expect avatar crossing is a heavy-duty function at the destination.
|
||||||
|
@ -518,8 +494,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
protected virtual void SetCallbackURL(AgentData agent, RegionInfo region)
|
protected virtual void SetCallbackURL(AgentData agent, RegionInfo region)
|
||||||
{
|
{
|
||||||
agent.CallbackURI = "http://" + region.ExternalHostName + ":" + region.HttpPort +
|
agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/";
|
||||||
"/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/";
|
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Set callback URL to {0}", agent.CallbackURI);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -845,8 +821,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
cAgent.Position = pos;
|
cAgent.Position = pos;
|
||||||
if (isFlying)
|
if (isFlying)
|
||||||
cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
|
cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
|
||||||
cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort +
|
cAgent.CallbackURI = m_scene.RegionInfo.ServerURI +
|
||||||
"/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
|
"agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
|
||||||
|
|
||||||
if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
|
if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
|
||||||
{
|
{
|
||||||
|
@ -871,10 +847,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
neighbourRegion.RegionHandle);
|
neighbourRegion.RegionHandle);
|
||||||
return agent;
|
return agent;
|
||||||
}
|
}
|
||||||
// TODO Should construct this behind a method
|
string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
|
||||||
string capsPath =
|
|
||||||
"http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort
|
|
||||||
+ "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/";
|
|
||||||
|
|
||||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
|
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
|
||||||
|
|
||||||
|
@ -903,8 +876,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
}
|
}
|
||||||
|
|
||||||
agent.MakeChildAgent();
|
agent.MakeChildAgent();
|
||||||
|
|
||||||
// now we have a child agent in this region. Request all interesting data about other (root) agents
|
// now we have a child agent in this region. Request all interesting data about other (root) agents
|
||||||
agent.SendInitialFullUpdateToAllClients();
|
agent.SendOtherAgentsAvatarDataToMe();
|
||||||
|
agent.SendOtherAgentsAppearanceToMe();
|
||||||
|
|
||||||
CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
|
CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
|
||||||
|
|
||||||
|
@ -1193,8 +1168,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
y = y / Constants.RegionSize;
|
y = y / Constants.RegionSize;
|
||||||
m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")");
|
m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")");
|
||||||
|
|
||||||
string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort
|
string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath);
|
||||||
+ "/CAPS/" + a.CapsPath + "0000/";
|
|
||||||
|
|
||||||
string reason = String.Empty;
|
string reason = String.Empty;
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID);
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID);
|
||||||
return m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID);
|
GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID);
|
||||||
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: GetFinalDestination serveruri -> {0}", real_destination.ServerURI);
|
||||||
|
return real_destination;
|
||||||
}
|
}
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
@ -149,6 +151,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
|
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI);
|
||||||
reason = string.Empty;
|
reason = string.Empty;
|
||||||
logout = false;
|
logout = false;
|
||||||
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
|
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
|
||||||
|
@ -236,6 +239,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
IUserAgentService security = new UserAgentServiceConnector(url);
|
IUserAgentService security = new UserAgentServiceConnector(url);
|
||||||
return security.VerifyClient(aCircuit.SessionID, token);
|
return security.VerifyClient(aCircuit.SessionID, token);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent {0} {1} does not have a HomeURI OH NO!", aCircuit.firstname, aCircuit.lastname);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,11 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
@ -52,14 +55,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
// private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>();
|
// private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>();
|
||||||
|
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
|
private string m_ProfileServerURI;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructor
|
#region Constructor
|
||||||
|
|
||||||
public HGAssetMapper(Scene scene)
|
public HGAssetMapper(Scene scene, string profileURL)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
|
m_ProfileServerURI = profileURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -95,16 +100,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
asset1.ID = url + "/" + asset.ID;
|
asset1.ID = url + "/" + asset.ID;
|
||||||
// UUID temp = UUID.Zero;
|
|
||||||
// TODO: if the creator is local, stick this grid's URL in front
|
|
||||||
//if (UUID.TryParse(asset.Metadata.CreatorID, out temp))
|
|
||||||
// asset1.Metadata.CreatorID = ??? + "/" + asset.Metadata.CreatorID;
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
m_log.Warn("[HG ASSET MAPPER]: Oops.");
|
m_log.Warn("[HG ASSET MAPPER]: Oops.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AdjustIdentifiers(asset1.Metadata);
|
||||||
|
if (asset1.Metadata.Type == (sbyte)AssetType.Object)
|
||||||
|
asset1.Data = AdjustIdentifiers(asset.Data);
|
||||||
|
else
|
||||||
|
asset1.Data = asset.Data;
|
||||||
|
|
||||||
m_scene.AssetService.Store(asset1);
|
m_scene.AssetService.Store(asset1);
|
||||||
m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url);
|
m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +125,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
private void Copy(AssetBase from, AssetBase to)
|
private void Copy(AssetBase from, AssetBase to)
|
||||||
{
|
{
|
||||||
to.Data = from.Data;
|
//to.Data = from.Data; // don't copy this, it's copied elsewhere
|
||||||
to.Description = from.Description;
|
to.Description = from.Description;
|
||||||
to.FullID = from.FullID;
|
to.FullID = from.FullID;
|
||||||
to.ID = from.ID;
|
to.ID = from.ID;
|
||||||
|
@ -129,6 +136,70 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AdjustIdentifiers(AssetMetadata meta)
|
||||||
|
{
|
||||||
|
if (meta.CreatorID != null && meta.CreatorID != string.Empty)
|
||||||
|
{
|
||||||
|
UUID uuid = UUID.Zero;
|
||||||
|
UUID.TryParse(meta.CreatorID, out uuid);
|
||||||
|
UserAccount creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
|
||||||
|
if (creator != null)
|
||||||
|
meta.CreatorID = m_ProfileServerURI + "/" + meta.CreatorID + ";" + creator.FirstName + " " + creator.LastName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected byte[] AdjustIdentifiers(byte[] data)
|
||||||
|
{
|
||||||
|
string xml = Utils.BytesToString(data);
|
||||||
|
return Utils.StringToBytes(RewriteSOP(xml));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected string RewriteSOP(string xml)
|
||||||
|
{
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
doc.LoadXml(xml);
|
||||||
|
XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart");
|
||||||
|
|
||||||
|
foreach (XmlNode sop in sops)
|
||||||
|
{
|
||||||
|
UserAccount creator = null;
|
||||||
|
bool hasCreatorData = false;
|
||||||
|
XmlNodeList nodes = sop.ChildNodes;
|
||||||
|
foreach (XmlNode node in nodes)
|
||||||
|
{
|
||||||
|
if (node.Name == "CreatorID")
|
||||||
|
{
|
||||||
|
UUID uuid = UUID.Zero;
|
||||||
|
UUID.TryParse(node.InnerText, out uuid);
|
||||||
|
creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
|
||||||
|
}
|
||||||
|
if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty)
|
||||||
|
hasCreatorData = true;
|
||||||
|
|
||||||
|
//if (node.Name == "OwnerID")
|
||||||
|
//{
|
||||||
|
// UserAccount owner = GetUser(node.InnerText);
|
||||||
|
// if (owner != null)
|
||||||
|
// node.InnerText = m_ProfileServiceURL + "/" + node.InnerText + "/" + owner.FirstName + " " + owner.LastName;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasCreatorData && creator != null)
|
||||||
|
{
|
||||||
|
XmlElement creatorData = doc.CreateElement("CreatorData");
|
||||||
|
creatorData.InnerText = m_ProfileServerURI + "/" + creator.PrincipalID + ";" + creator.FirstName + " " + creator.LastName;
|
||||||
|
sop.AppendChild(creatorData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
using (StringWriter wr = new StringWriter())
|
||||||
|
{
|
||||||
|
doc.Save(wr);
|
||||||
|
return wr.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: unused
|
// TODO: unused
|
||||||
// private void Dump(Dictionary<UUID, bool> lst)
|
// private void Dump(Dictionary<UUID, bool> lst)
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -54,6 +54,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
get { return m_assMapper; }
|
get { return m_assMapper; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string m_ProfileServerURI;
|
||||||
|
|
||||||
// private bool m_Initialized = false;
|
// private bool m_Initialized = false;
|
||||||
|
|
||||||
#region INonSharedRegionModule
|
#region INonSharedRegionModule
|
||||||
|
@ -73,6 +75,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
{
|
{
|
||||||
m_Enabled = true;
|
m_Enabled = true;
|
||||||
m_log.InfoFormat("[HG INVENTORY ACCESS MODULE]: {0} enabled.", Name);
|
m_log.InfoFormat("[HG INVENTORY ACCESS MODULE]: {0} enabled.", Name);
|
||||||
|
|
||||||
|
IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"];
|
||||||
|
if (thisModuleConfig != null)
|
||||||
|
m_ProfileServerURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty);
|
||||||
|
else
|
||||||
|
m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +91,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
return;
|
return;
|
||||||
|
|
||||||
base.AddRegion(scene);
|
base.AddRegion(scene);
|
||||||
m_assMapper = new HGAssetMapper(scene);
|
m_assMapper = new HGAssetMapper(scene, m_ProfileServerURI);
|
||||||
scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem;
|
scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -97,7 +105,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
string userAssetServer = string.Empty;
|
string userAssetServer = string.Empty;
|
||||||
if (IsForeignUser(avatarID, out userAssetServer))
|
if (IsForeignUser(avatarID, out userAssetServer))
|
||||||
{
|
{
|
||||||
m_assMapper.Post(assetID, avatarID, userAssetServer);
|
Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
protected bool m_Enabled = false;
|
protected bool m_Enabled = false;
|
||||||
protected Scene m_Scene;
|
protected Scene m_Scene;
|
||||||
|
protected IUserManagement m_UserManagement;
|
||||||
|
protected IUserManagement UserManagementModule
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (m_UserManagement == null)
|
||||||
|
m_UserManagement = m_Scene.RequestModuleInterface<IUserManagement>();
|
||||||
|
return m_UserManagement;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#region INonSharedRegionModule
|
#region INonSharedRegionModule
|
||||||
|
|
||||||
|
@ -542,6 +553,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
SceneObjectGroup group
|
SceneObjectGroup group
|
||||||
= SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData);
|
= SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData);
|
||||||
|
|
||||||
|
Util.FireAndForget(delegate { AddUserData(group); });
|
||||||
|
|
||||||
group.RootPart.FromFolderID = item.Folder;
|
group.RootPart.FromFolderID = item.Folder;
|
||||||
|
|
||||||
// If it's rezzed in world, select it. Much easier to
|
// If it's rezzed in world, select it. Much easier to
|
||||||
|
@ -699,6 +712,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void AddUserData(SceneObjectGroup sog)
|
||||||
|
{
|
||||||
|
UserManagementModule.AddUser(sog.RootPart.CreatorID, sog.RootPart.CreatorData);
|
||||||
|
foreach (SceneObjectPart sop in sog.Parts)
|
||||||
|
UserManagementModule.AddUser(sop.CreatorID, sop.CreatorData);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver)
|
public virtual void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -779,9 +799,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID)
|
protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID)
|
||||||
{
|
{
|
||||||
IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>();
|
IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>();
|
||||||
InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, agentID);
|
InventoryItemBase item = new InventoryItemBase(itemID, agentID);
|
||||||
assetRequestItem = invService.GetItem(assetRequestItem);
|
item = invService.GetItem(item);
|
||||||
return assetRequestItem;
|
|
||||||
|
if (item.CreatorData != null && item.CreatorData != string.Empty)
|
||||||
|
UserManagementModule.AddUser(item.CreatorIdAsUuid, item.CreatorData);
|
||||||
|
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -275,6 +275,11 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||||
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL);
|
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddUser(UUID uuid, string first, string last, string profileURL)
|
||||||
|
{
|
||||||
|
AddUser(uuid, profileURL + ";" + first + " " + last);
|
||||||
|
}
|
||||||
|
|
||||||
//public void AddUser(UUID uuid, string userData)
|
//public void AddUser(UUID uuid, string userData)
|
||||||
//{
|
//{
|
||||||
// if (m_UserCache.ContainsKey(uuid))
|
// if (m_UserCache.ContainsKey(uuid))
|
||||||
|
|
|
@ -595,12 +595,12 @@ namespace OpenSim.Region.CoreModules.InterGrid
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
responseMap["seed_capability"]
|
responseMap["seed_capability"]
|
||||||
= OSD.FromString(
|
= OSD.FromString(
|
||||||
regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath));
|
regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath));
|
||||||
|
|
||||||
// REPLACEMENT
|
// REPLACEMENT
|
||||||
responseMap["region_seed_capability"]
|
responseMap["region_seed_capability"]
|
||||||
= OSD.FromString(
|
= OSD.FromString(
|
||||||
regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath));
|
regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath));
|
||||||
|
|
||||||
responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath);
|
responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath);
|
||||||
responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath);
|
responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath);
|
||||||
|
|
|
@ -91,9 +91,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset
|
||||||
{
|
{
|
||||||
m_Registered = true;
|
m_Registered = true;
|
||||||
|
|
||||||
m_log.Info("[RegionAssetService]: Starting...");
|
m_log.Info("[HGAssetService]: Starting...");
|
||||||
|
|
||||||
Object[] args = new Object[] { m_Config, MainServer.Instance, string.Empty };
|
|
||||||
|
Object[] args = new Object[] { m_Config, MainServer.Instance, "HGAssetService" };
|
||||||
|
|
||||||
ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:AssetServiceConnector", args);
|
ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:AssetServiceConnector", args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,6 +257,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool QueryAccess(GridRegion destination, UUID id)
|
||||||
|
{
|
||||||
|
if (destination == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
foreach (Scene s in m_sceneList)
|
||||||
|
{
|
||||||
|
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
|
||||||
|
{
|
||||||
|
//m_log.Debug("[LOCAL COMMS]: Found region to send QueryAccess");
|
||||||
|
return s.QueryAccess(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public bool ReleaseAgent(UUID origin, UUID id, string uri)
|
public bool ReleaseAgent(UUID origin, UUID id, string uri)
|
||||||
{
|
{
|
||||||
foreach (Scene s in m_sceneList)
|
foreach (Scene s in m_sceneList)
|
||||||
|
|
|
@ -239,6 +239,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool QueryAccess(GridRegion destination, UUID id)
|
||||||
|
{
|
||||||
|
if (destination == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Try local first
|
||||||
|
if (m_localBackend.QueryAccess(destination, id))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// else do the remote thing
|
||||||
|
if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
|
||||||
|
return m_remoteConnector.QueryAccess(destination, id);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public bool ReleaseAgent(UUID origin, UUID id, string uri)
|
public bool ReleaseAgent(UUID origin, UUID id, string uri)
|
||||||
{
|
{
|
||||||
// Try local first
|
// Try local first
|
||||||
|
|
|
@ -190,7 +190,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
|
|
||||||
new AssetsRequest(
|
new AssetsRequest(
|
||||||
new AssetsArchiver(archiveWriter), assetUuids,
|
new AssetsArchiver(archiveWriter), assetUuids,
|
||||||
m_scene.AssetService, awre.ReceivedAllAssets).Execute();
|
m_scene.AssetService, m_scene.UserAccountService,
|
||||||
|
m_scene.RegionInfo.ScopeID, options, awre.ReceivedAllAssets).Execute();
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
@ -238,10 +239,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion);
|
m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion);
|
||||||
if (majorVersion == 1)
|
//if (majorVersion == 1)
|
||||||
{
|
//{
|
||||||
m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR");
|
// m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR");
|
||||||
}
|
//}
|
||||||
|
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
XmlTextWriter xtw = new XmlTextWriter(sw);
|
XmlTextWriter xtw = new XmlTextWriter(sw);
|
||||||
|
|
|
@ -34,6 +34,7 @@ using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Serialization;
|
using OpenSim.Framework.Serialization;
|
||||||
|
using OpenSim.Framework.Serialization.External;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.World.Archiver
|
namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
|
@ -100,17 +101,26 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
/// Asset service used to request the assets
|
/// Asset service used to request the assets
|
||||||
/// </value>
|
/// </value>
|
||||||
protected IAssetService m_assetService;
|
protected IAssetService m_assetService;
|
||||||
|
protected IUserAccountService m_userAccountService;
|
||||||
|
protected UUID m_scopeID; // the grid ID
|
||||||
|
|
||||||
protected AssetsArchiver m_assetsArchiver;
|
protected AssetsArchiver m_assetsArchiver;
|
||||||
|
|
||||||
|
protected Dictionary<string, object> m_options;
|
||||||
|
|
||||||
protected internal AssetsRequest(
|
protected internal AssetsRequest(
|
||||||
AssetsArchiver assetsArchiver, IDictionary<UUID, AssetType> uuids,
|
AssetsArchiver assetsArchiver, IDictionary<UUID, AssetType> uuids,
|
||||||
IAssetService assetService, AssetsRequestCallback assetsRequestCallback)
|
IAssetService assetService, IUserAccountService userService,
|
||||||
|
UUID scope, Dictionary<string, object> options,
|
||||||
|
AssetsRequestCallback assetsRequestCallback)
|
||||||
{
|
{
|
||||||
m_assetsArchiver = assetsArchiver;
|
m_assetsArchiver = assetsArchiver;
|
||||||
m_uuids = uuids;
|
m_uuids = uuids;
|
||||||
m_assetsRequestCallback = assetsRequestCallback;
|
m_assetsRequestCallback = assetsRequestCallback;
|
||||||
m_assetService = assetService;
|
m_assetService = assetService;
|
||||||
|
m_userAccountService = userService;
|
||||||
|
m_scopeID = scope;
|
||||||
|
m_options = options;
|
||||||
m_repliesRequired = uuids.Count;
|
m_repliesRequired = uuids.Count;
|
||||||
|
|
||||||
m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT);
|
m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT);
|
||||||
|
@ -241,7 +251,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id);
|
// m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id);
|
||||||
m_foundAssetUuids.Add(asset.FullID);
|
m_foundAssetUuids.Add(asset.FullID);
|
||||||
m_assetsArchiver.WriteAsset(asset);
|
|
||||||
|
m_assetsArchiver.WriteAsset(PostProcess(asset));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -288,5 +299,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
"[ARCHIVER]: Terminating archive creation since asset requster callback failed with {0}", e);
|
"[ARCHIVER]: Terminating archive creation since asset requster callback failed with {0}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected AssetBase PostProcess(AssetBase asset)
|
||||||
|
{
|
||||||
|
if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("profile"))
|
||||||
|
{
|
||||||
|
//m_log.DebugFormat("[ARCHIVER]: Rewriting object data for {0}", asset.ID);
|
||||||
|
string xml = ExternalRepresentationUtils.RewriteSOP(Utils.BytesToString(asset.Data), m_options["profile"].ToString(), m_userAccountService, m_scopeID);
|
||||||
|
asset.Data = Utils.StringToBytes(xml);
|
||||||
|
}
|
||||||
|
return asset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,23 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
|
|
||||||
private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds)
|
private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds)
|
||||||
{
|
{
|
||||||
m_scene.Restart(timeInSeconds);
|
IRestartModule restartModule = m_scene.RequestModuleInterface<IRestartModule>();
|
||||||
|
if (restartModule != null)
|
||||||
|
{
|
||||||
|
List<int> times = new List<int>();
|
||||||
|
while (timeInSeconds > 0)
|
||||||
|
{
|
||||||
|
times.Add(timeInSeconds);
|
||||||
|
if (timeInSeconds > 300)
|
||||||
|
timeInSeconds -= 120;
|
||||||
|
else if (timeInSeconds > 30)
|
||||||
|
timeInSeconds -= 30;
|
||||||
|
else
|
||||||
|
timeInSeconds -= 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID)
|
private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID)
|
||||||
|
|
|
@ -0,0 +1,263 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Timers;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using log4net;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using Timer=System.Timers.Timer;
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.CoreModules.World.Region
|
||||||
|
{
|
||||||
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RestartModule")]
|
||||||
|
public class RestartModule : INonSharedRegionModule, IRestartModule
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log =
|
||||||
|
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
protected Scene m_Scene;
|
||||||
|
protected Timer m_CountdownTimer = null;
|
||||||
|
protected DateTime m_RestartBegin;
|
||||||
|
protected List<int> m_Alerts;
|
||||||
|
protected string m_Message;
|
||||||
|
protected UUID m_Initiator;
|
||||||
|
protected bool m_Notice = false;
|
||||||
|
protected IDialogModule m_DialogModule = null;
|
||||||
|
|
||||||
|
public void Initialise(IConfigSource config)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
m_Scene = scene;
|
||||||
|
scene.RegisterModuleInterface<IRestartModule>(this);
|
||||||
|
MainConsole.Instance.Commands.AddCommand("RestartModule",
|
||||||
|
false, "region restart bluebox",
|
||||||
|
"region restart bluebox <message> <time> ...",
|
||||||
|
"Restart the region", HandleRegionRestart);
|
||||||
|
MainConsole.Instance.Commands.AddCommand("RestartModule",
|
||||||
|
false, "region restart notice",
|
||||||
|
"region restart notice <message> <time> ...",
|
||||||
|
"Restart the region", HandleRegionRestart);
|
||||||
|
MainConsole.Instance.Commands.AddCommand("RestartModule",
|
||||||
|
false, "region restart abort",
|
||||||
|
"region restart abort [<message>]",
|
||||||
|
"Restart the region", HandleRegionRestart);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
m_DialogModule = m_Scene.RequestModuleInterface<IDialogModule>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "RestartModule"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type ReplaceableInterface
|
||||||
|
{
|
||||||
|
get { return typeof(IRestartModule); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeSpan TimeUntilRestart
|
||||||
|
{
|
||||||
|
get { return DateTime.Now - m_RestartBegin; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice)
|
||||||
|
{
|
||||||
|
if (m_CountdownTimer != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (alerts == null)
|
||||||
|
{
|
||||||
|
m_Scene.RestartNow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Message = message;
|
||||||
|
m_Initiator = initiator;
|
||||||
|
m_Notice = notice;
|
||||||
|
m_Alerts = new List<int>(alerts);
|
||||||
|
m_Alerts.Sort();
|
||||||
|
m_Alerts.Reverse();
|
||||||
|
|
||||||
|
if (m_Alerts[0] == 0)
|
||||||
|
{
|
||||||
|
m_Scene.RestartNow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int nextInterval = DoOneNotice();
|
||||||
|
|
||||||
|
SetTimer(nextInterval);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int DoOneNotice()
|
||||||
|
{
|
||||||
|
if (m_Alerts.Count == 0 || m_Alerts[0] == 0)
|
||||||
|
{
|
||||||
|
m_Scene.RestartNow();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int nextAlert = 0;
|
||||||
|
while (m_Alerts.Count > 1)
|
||||||
|
{
|
||||||
|
if (m_Alerts[1] == m_Alerts[0])
|
||||||
|
{
|
||||||
|
m_Alerts.RemoveAt(0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
nextAlert = m_Alerts[1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int currentAlert = m_Alerts[0];
|
||||||
|
|
||||||
|
m_Alerts.RemoveAt(0);
|
||||||
|
|
||||||
|
int minutes = currentAlert / 60;
|
||||||
|
string currentAlertString = String.Empty;
|
||||||
|
if (minutes > 0)
|
||||||
|
{
|
||||||
|
if (minutes == 1)
|
||||||
|
currentAlertString += "1 minute";
|
||||||
|
else
|
||||||
|
currentAlertString += String.Format("{0} minutes", minutes);
|
||||||
|
if ((currentAlert % 60) != 0)
|
||||||
|
currentAlertString += " and ";
|
||||||
|
}
|
||||||
|
if ((currentAlert % 60) != 0)
|
||||||
|
{
|
||||||
|
int seconds = currentAlert % 60;
|
||||||
|
if (seconds == 1)
|
||||||
|
currentAlertString += "1 second";
|
||||||
|
else
|
||||||
|
currentAlertString += String.Format("{0} seconds", seconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
string msg = String.Format(m_Message, currentAlertString);
|
||||||
|
|
||||||
|
if (m_DialogModule != null && msg != String.Empty)
|
||||||
|
{
|
||||||
|
if (m_Notice)
|
||||||
|
m_DialogModule.SendGeneralAlert(msg);
|
||||||
|
else
|
||||||
|
m_DialogModule.SendNotificationToUsersInRegion(m_Initiator, "System", msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return currentAlert - nextAlert;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTimer(int intervalSeconds)
|
||||||
|
{
|
||||||
|
m_CountdownTimer = new Timer();
|
||||||
|
m_CountdownTimer.AutoReset = false;
|
||||||
|
m_CountdownTimer.Interval = intervalSeconds * 1000;
|
||||||
|
m_CountdownTimer.Elapsed += OnTimer;
|
||||||
|
m_CountdownTimer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTimer(object source, ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
int nextInterval = DoOneNotice();
|
||||||
|
|
||||||
|
SetTimer(nextInterval);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AbortRestart(string message)
|
||||||
|
{
|
||||||
|
if (m_CountdownTimer != null)
|
||||||
|
{
|
||||||
|
m_CountdownTimer.Stop();
|
||||||
|
m_CountdownTimer = null;
|
||||||
|
if (m_DialogModule != null && message != String.Empty)
|
||||||
|
m_DialogModule.SendGeneralAlert(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleRegionRestart(string module, string[] args)
|
||||||
|
{
|
||||||
|
if (!(MainConsole.Instance.ConsoleScene is Scene))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (MainConsole.Instance.ConsoleScene != m_Scene)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (args.Length < 5)
|
||||||
|
{
|
||||||
|
if (args.Length > 2)
|
||||||
|
{
|
||||||
|
if (args[2] == "abort")
|
||||||
|
{
|
||||||
|
string msg = String.Empty;
|
||||||
|
if (args.Length > 3)
|
||||||
|
msg = args[3];
|
||||||
|
|
||||||
|
AbortRestart(msg);
|
||||||
|
|
||||||
|
MainConsole.Instance.Output("Region restart aborted");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MainConsole.Instance.Output("Error: restart region <mode> <name> <time> ...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool notice = false;
|
||||||
|
if (args[2] == "notice")
|
||||||
|
notice = true;
|
||||||
|
|
||||||
|
List<int> times = new List<int>();
|
||||||
|
for (int i = 4 ; i < args.Length ; i++)
|
||||||
|
times.Add(Convert.ToInt32(args[i]));
|
||||||
|
|
||||||
|
ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
|
|
||||||
string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString();
|
string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString();
|
||||||
regionimage = regionimage.Replace("-", "");
|
regionimage = regionimage.Replace("-", "");
|
||||||
m_log.Info("[WORLD MAP]: JPEG Map location: http://" + m_scene.RegionInfo.ExternalEndPoint.Address.ToString() + ":" + m_scene.RegionInfo.HttpPort.ToString() + "/index.php?method=" + regionimage);
|
m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "/index.php?method=" + regionimage);
|
||||||
|
|
||||||
MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage);
|
MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage);
|
||||||
MainServer.Instance.AddLLSDHandler(
|
MainServer.Instance.AddLLSDHandler(
|
||||||
|
@ -579,7 +579,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
|
|
||||||
if (mreg != null)
|
if (mreg != null)
|
||||||
{
|
{
|
||||||
httpserver = "http://" + mreg.ExternalEndPoint.Address.ToString() + ":" + mreg.HttpPort + "/MAP/MapItems/" + regionhandle.ToString();
|
httpserver = mreg.ServerURI + "MAP/MapItems/" + regionhandle.ToString();
|
||||||
lock (m_cachedRegionMapItemsAddress)
|
lock (m_cachedRegionMapItemsAddress)
|
||||||
{
|
{
|
||||||
if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle))
|
if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle))
|
||||||
|
|
|
@ -34,6 +34,17 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.Examples.SimpleModule
|
namespace OpenSim.Region.Examples.SimpleModule
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Example region module.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is an old and unmaintained region module which uses the old style module interface. It is not loaded into
|
||||||
|
/// OpenSim by default. If you want to try enabling it, look in the bin folder of this project.
|
||||||
|
/// Please see the README.txt in this project on the filesystem for some more information.
|
||||||
|
/// Nonetheless, it may contain some useful example code so has been left here for now.
|
||||||
|
///
|
||||||
|
/// You can see bare bones examples of the more modern region module system in OpenSim/Region/OptionalModules/Example
|
||||||
|
/// </remarks>
|
||||||
public class RegionModule : IRegionModule
|
public class RegionModule : IRegionModule
|
||||||
{
|
{
|
||||||
#region IRegionModule Members
|
#region IRegionModule Members
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.Framework.Interfaces
|
||||||
|
{
|
||||||
|
public interface IRestartModule
|
||||||
|
{
|
||||||
|
TimeSpan TimeUntilRestart { get; }
|
||||||
|
void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice);
|
||||||
|
void AbortRestart(string message);
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,5 +9,6 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
{
|
{
|
||||||
string GetUserName(UUID uuid);
|
string GetUserName(UUID uuid);
|
||||||
void AddUser(UUID uuid, string userData);
|
void AddUser(UUID uuid, string userData);
|
||||||
|
void AddUser(UUID uuid, string firstName, string lastName, string profileURL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -493,6 +493,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if ((item != null) && (item.Owner == senderId))
|
if ((item != null) && (item.Owner == senderId))
|
||||||
{
|
{
|
||||||
|
IUserManagement uman = RequestModuleInterface<IUserManagement>();
|
||||||
|
if (uman != null)
|
||||||
|
uman.AddUser(item.CreatorIdAsUuid, item.CreatorData);
|
||||||
|
|
||||||
if (!Permissions.BypassPermissions())
|
if (!Permissions.BypassPermissions())
|
||||||
{
|
{
|
||||||
if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
|
if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
|
||||||
|
|
|
@ -1065,60 +1065,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return new GridRegion(RegionInfo);
|
return new GridRegion(RegionInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Given float seconds, this will restart the region.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="seconds">float indicating duration before restart.</param>
|
|
||||||
public virtual void Restart(float seconds)
|
|
||||||
{
|
|
||||||
// notifications are done in 15 second increments
|
|
||||||
// so .. if the number of seconds is less then 15 seconds, it's not really a restart request
|
|
||||||
// It's a 'Cancel restart' request.
|
|
||||||
|
|
||||||
// RestartNow() does immediate restarting.
|
|
||||||
if (seconds < 15)
|
|
||||||
{
|
|
||||||
m_restartTimer.Stop();
|
|
||||||
m_dialogModule.SendGeneralAlert("Restart Aborted");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Now we figure out what to set the timer to that does the notifications and calls, RestartNow()
|
|
||||||
m_restartTimer.Interval = 15000;
|
|
||||||
m_incrementsof15seconds = (int)seconds / 15;
|
|
||||||
m_RestartTimerCounter = 0;
|
|
||||||
m_restartTimer.AutoReset = true;
|
|
||||||
m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
|
|
||||||
m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
|
|
||||||
m_restartTimer.Start();
|
|
||||||
m_dialogModule.SendNotificationToUsersInRegion(
|
|
||||||
UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The Restart timer has occured.
|
|
||||||
// We have to figure out if this is a notification or if the number of seconds specified in Restart
|
|
||||||
// have elapsed.
|
|
||||||
// If they have elapsed, call RestartNow()
|
|
||||||
public void RestartTimer_Elapsed(object sender, ElapsedEventArgs e)
|
|
||||||
{
|
|
||||||
m_RestartTimerCounter++;
|
|
||||||
if (m_RestartTimerCounter <= m_incrementsof15seconds)
|
|
||||||
{
|
|
||||||
if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7)
|
|
||||||
m_dialogModule.SendNotificationToUsersInRegion(
|
|
||||||
UUID.Random(),
|
|
||||||
String.Empty,
|
|
||||||
RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter) * 15) + " seconds");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_restartTimer.Stop();
|
|
||||||
m_restartTimer.AutoReset = false;
|
|
||||||
RestartNow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This causes the region to restart immediatley.
|
// This causes the region to restart immediatley.
|
||||||
public void RestartNow()
|
public void RestartNow()
|
||||||
{
|
{
|
||||||
|
@ -1141,7 +1087,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Close();
|
Close();
|
||||||
|
|
||||||
m_log.Error("[REGION]: Firing Region Restart Message");
|
m_log.Error("[REGION]: Firing Region Restart Message");
|
||||||
base.Restart(0);
|
|
||||||
|
base.Restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a helper function that notifies root agents in this region that a new sim near them has come up
|
// This is a helper function that notifies root agents in this region that a new sim near them has come up
|
||||||
|
@ -2384,7 +2331,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Force a database update so that the scene object group ID is accurate. It's possible that the
|
// Force a database update so that the scene object group ID is accurate. It's possible that the
|
||||||
// group has recently been delinked from another group but that this change has not been persisted
|
// group has recently been delinked from another group but that this change has not been persisted
|
||||||
// to the DB.
|
// to the DB.
|
||||||
ForceSceneObjectBackup(so);
|
// This is an expensive thing to do so only do it if absolutely necessary.
|
||||||
|
if (so.HasGroupChangedDueToDelink)
|
||||||
|
ForceSceneObjectBackup(so);
|
||||||
|
|
||||||
so.DetachFromBackup();
|
so.DetachFromBackup();
|
||||||
SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID);
|
SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID);
|
||||||
}
|
}
|
||||||
|
@ -2652,15 +2602,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 2);
|
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
|
||||||
|
|
||||||
newObject.ResumeScripts();
|
newObject.ResumeScripts();
|
||||||
|
|
||||||
// Do this as late as possible so that listeners have full access to the incoming object
|
// Do this as late as possible so that listeners have full access to the incoming object
|
||||||
EventManager.TriggerOnIncomingSceneObject(newObject);
|
EventManager.TriggerOnIncomingSceneObject(newObject);
|
||||||
|
|
||||||
TriggerChangedTeleport(newObject);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2768,7 +2716,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TriggerChangedTeleport(SceneObjectGroup sog)
|
private int GetStateSource(SceneObjectGroup sog)
|
||||||
{
|
{
|
||||||
ScenePresence sp = GetScenePresence(sog.OwnerID);
|
ScenePresence sp = GetScenePresence(sog.OwnerID);
|
||||||
|
|
||||||
|
@ -2779,13 +2727,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
|
if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
|
||||||
{
|
{
|
||||||
// This will get your attention
|
// This will get your attention
|
||||||
//m_log.Error("[XXX] Triggering ");
|
//m_log.Error("[XXX] Triggering CHANGED_TELEPORT");
|
||||||
|
|
||||||
// Trigger CHANGED_TELEPORT
|
return 5; // StateSource.Teleporting
|
||||||
sp.Scene.EventManager.TriggerOnScriptChangedEvent(sog.LocalId, (uint)Changed.TELEPORT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return 2; // StateSource.PrimCrossing
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -2900,6 +2847,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
|
m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4053,6 +4001,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
|
ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
|
||||||
|
|
||||||
if (childAgentUpdate != null)
|
if (childAgentUpdate != null)
|
||||||
{
|
{
|
||||||
childAgentUpdate.ChildAgentDataUpdate(cAgentData);
|
childAgentUpdate.ChildAgentDataUpdate(cAgentData);
|
||||||
|
@ -4610,7 +4559,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Perform the given action for each object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="action"></param>
|
/// <param name="action"></param>
|
||||||
// public void ForEachObject(Action<SceneObjectGroup> action)
|
// public void ForEachObject(Action<SceneObjectGroup> action)
|
||||||
|
@ -5320,5 +5269,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
DeleteSceneObject(grp, true);
|
DeleteSceneObject(grp, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This method is called across the simulation connector to
|
||||||
|
// determine if a given agent is allowed in this region
|
||||||
|
// AS A ROOT AGENT. Returning false here will prevent them
|
||||||
|
// from logging into the region, teleporting into the region
|
||||||
|
// or corssing the broder walking, but will NOT prevent
|
||||||
|
// child agent creation, thereby emulating the SL behavior.
|
||||||
|
public bool QueryAccess(UUID agentID)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,18 +218,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
#region admin stuff
|
#region admin stuff
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Region Restart - Seconds till restart.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="seconds"></param>
|
|
||||||
public virtual void Restart(int seconds)
|
|
||||||
{
|
|
||||||
m_log.Error("[REGION]: passing Restart Message up the namespace");
|
|
||||||
restart handlerPhysicsCrash = OnRestart;
|
|
||||||
if (handlerPhysicsCrash != null)
|
|
||||||
handlerPhysicsCrash(RegionInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool PresenceChildStatus(UUID avatarID)
|
public virtual bool PresenceChildStatus(UUID avatarID)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -562,6 +550,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Restart()
|
||||||
|
{
|
||||||
|
// This has to be here to fire the event
|
||||||
|
restart handlerPhysicsCrash = OnRestart;
|
||||||
|
if (handlerPhysicsCrash != null)
|
||||||
|
handlerPhysicsCrash(RegionInfo);
|
||||||
|
}
|
||||||
|
|
||||||
public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep);
|
public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,11 +119,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
timeFirstChanged = DateTime.Now.Ticks;
|
timeFirstChanged = DateTime.Now.Ticks;
|
||||||
}
|
}
|
||||||
m_hasGroupChanged = value;
|
m_hasGroupChanged = value;
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[SCENE OBJECT GROUP]: HasGroupChanged set to {0} for {1} {2}", m_hasGroupChanged, Name, LocalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
get { return m_hasGroupChanged; }
|
get { return m_hasGroupChanged; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Has the group changed due to an unlink operation? We record this in order to optimize deletion, since
|
||||||
|
/// an unlinked group currently has to be persisted to the database before we can perform an unlink operation.
|
||||||
|
/// </summary>
|
||||||
|
public bool HasGroupChangedDueToDelink { get; private set; }
|
||||||
|
|
||||||
private bool isTimeToPersist()
|
private bool isTimeToPersist()
|
||||||
{
|
{
|
||||||
if (IsSelected || IsDeleted || IsAttachment)
|
if (IsSelected || IsDeleted || IsAttachment)
|
||||||
|
@ -1340,6 +1349,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
|
backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
|
||||||
backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem;
|
backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem;
|
||||||
HasGroupChanged = false;
|
HasGroupChanged = false;
|
||||||
|
HasGroupChangedDueToDelink = false;
|
||||||
|
|
||||||
m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this);
|
m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this);
|
||||||
datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID);
|
datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID);
|
||||||
|
@ -2218,8 +2228,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
linkPart.Rezzed = RootPart.Rezzed;
|
linkPart.Rezzed = RootPart.Rezzed;
|
||||||
|
|
||||||
//HasGroupChanged = true;
|
// When we delete a group, we currently have to force persist to the database if the object id has changed
|
||||||
//ScheduleGroupForFullUpdate();
|
// (since delete works by deleting all rows which have a given object id)
|
||||||
|
objectGroup.HasGroupChangedDueToDelink = true;
|
||||||
|
|
||||||
return objectGroup;
|
return objectGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -447,7 +447,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CreatorData // = <profile url>;<name>
|
/// <summary>
|
||||||
|
/// Data about the creator in the form profile_url;name
|
||||||
|
/// </summary>
|
||||||
|
public string CreatorData
|
||||||
{
|
{
|
||||||
get { return m_creatorData; }
|
get { return m_creatorData; }
|
||||||
set { m_creatorData = value; }
|
set { m_creatorData = value; }
|
||||||
|
|
|
@ -461,8 +461,36 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
PhysicsActor actor = m_physicsActor;
|
PhysicsActor actor = m_physicsActor;
|
||||||
if (actor != null)
|
if (actor != null)
|
||||||
m_pos = actor.Position;
|
m_pos = actor.Position;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Obtain the correct position of a seated avatar.
|
||||||
|
// In addition to providing the correct position while
|
||||||
|
// the avatar is seated, this value will also
|
||||||
|
// be used as the location to unsit to.
|
||||||
|
//
|
||||||
|
// If m_parentID is not 0, assume we are a seated avatar
|
||||||
|
// and we should return the position based on the sittarget
|
||||||
|
// offset and rotation of the prim we are seated on.
|
||||||
|
//
|
||||||
|
// Generally, m_pos will contain the position of the avatar
|
||||||
|
// in the sim unless the avatar is on a sit target. While
|
||||||
|
// on a sit target, m_pos will contain the desired offset
|
||||||
|
// without the parent rotation applied.
|
||||||
|
if (m_parentID != 0)
|
||||||
|
{
|
||||||
|
SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID);
|
||||||
|
if (part != null)
|
||||||
|
{
|
||||||
|
return m_parentPosition + (m_pos * part.GetWorldRotation());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return m_parentPosition + m_pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return m_parentPosition + m_pos;
|
return m_pos;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
@ -733,7 +761,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Note: This won't send data *to* other clients in that region (children don't send)
|
// Note: This won't send data *to* other clients in that region (children don't send)
|
||||||
|
|
||||||
// MIC: This gets called again in CompleteMovement
|
// MIC: This gets called again in CompleteMovement
|
||||||
SendInitialFullUpdateToAllClients();
|
// SendInitialFullUpdateToAllClients();
|
||||||
|
SendOtherAgentsAvatarDataToMe();
|
||||||
|
SendOtherAgentsAppearanceToMe();
|
||||||
|
|
||||||
RegisterToEvents();
|
RegisterToEvents();
|
||||||
SetDirectionVectors();
|
SetDirectionVectors();
|
||||||
|
@ -1689,7 +1719,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
AbsolutePosition = part.AbsolutePosition;
|
AbsolutePosition = part.AbsolutePosition;
|
||||||
Velocity = Vector3.Zero;
|
Velocity = Vector3.Zero;
|
||||||
SendFullUpdateToAllClients();
|
SendAvatarDataToAllAgents();
|
||||||
|
|
||||||
//HandleAgentSit(ControllingClient, m_requestedSitTargetUUID);
|
//HandleAgentSit(ControllingClient, m_requestedSitTargetUUID);
|
||||||
}
|
}
|
||||||
|
@ -1764,7 +1794,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_parentPosition = Vector3.Zero;
|
m_parentPosition = Vector3.Zero;
|
||||||
|
|
||||||
m_parentID = 0;
|
m_parentID = 0;
|
||||||
SendFullUpdateToAllClients();
|
SendAvatarDataToAllAgents();
|
||||||
m_requestedSitTargetID = 0;
|
m_requestedSitTargetID = 0;
|
||||||
if (m_physicsActor != null && m_appearance != null)
|
if (m_physicsActor != null && m_appearance != null)
|
||||||
{
|
{
|
||||||
|
@ -2230,7 +2260,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
RemoveFromPhysicalScene();
|
RemoveFromPhysicalScene();
|
||||||
|
|
||||||
Animator.TrySetMovementAnimation(sitAnimation);
|
Animator.TrySetMovementAnimation(sitAnimation);
|
||||||
SendFullUpdateToAllClients();
|
SendAvatarDataToAllAgents();
|
||||||
// This may seem stupid, but Our Full updates don't send avatar rotation :P
|
// This may seem stupid, but Our Full updates don't send avatar rotation :P
|
||||||
// So we're also sending a terse update (which has avatar rotation)
|
// So we're also sending a terse update (which has avatar rotation)
|
||||||
// [Update] We do now.
|
// [Update] We do now.
|
||||||
|
@ -2463,83 +2493,129 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tell other client about this avatar (The client previously didn't know or had outdated details about this avatar)
|
/// Do everything required once a client completes its movement into a region and becomes
|
||||||
|
/// a root agent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="remoteAvatar"></param>
|
private void SendInitialData()
|
||||||
public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
|
|
||||||
{
|
{
|
||||||
// 2 stage check is needed.
|
// Moved this into CompleteMovement to ensure that m_appearance is initialized before
|
||||||
if (remoteAvatar == null)
|
// the inventory arrives
|
||||||
return;
|
// m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
|
||||||
|
|
||||||
IClientAPI cl = remoteAvatar.ControllingClient;
|
bool cachedappearance = false;
|
||||||
if (cl == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (m_appearance.Texture == null)
|
// We have an appearance but we may not have the baked textures. Check the asset cache
|
||||||
return;
|
// to see if all the baked textures are already here.
|
||||||
|
if (m_scene.AvatarFactory != null)
|
||||||
// MT: This is needed for sit. It's legal to send it to oneself, and the name
|
|
||||||
// of the method is a misnomer
|
|
||||||
//
|
|
||||||
// if (LocalId == remoteAvatar.LocalId)
|
|
||||||
// {
|
|
||||||
// m_log.WarnFormat("[SCENEPRESENCE]: An agent is attempting to send avatar data to itself; {0}", UUID);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (IsChildAgent)
|
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[SCENEPRESENCE]: A child agent is attempting to send out avatar data; {0}", UUID);
|
cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient);
|
||||||
return;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this);
|
// If we aren't using a cached appearance, then clear out the baked textures
|
||||||
m_scene.StatsReporter.AddAgentUpdates(1);
|
if (! cachedappearance)
|
||||||
|
{
|
||||||
|
m_appearance.ResetAppearance();
|
||||||
|
if (m_scene.AvatarFactory != null)
|
||||||
|
m_scene.AvatarFactory.QueueAppearanceSave(UUID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This agent just became root. We are going to tell everyone about it. The process of
|
||||||
|
// getting other avatars information was initiated in the constructor... don't do it
|
||||||
|
// again here... this comes after the cached appearance check because the avatars
|
||||||
|
// appearance goes into the avatar update packet
|
||||||
|
SendAvatarDataToAllAgents();
|
||||||
|
SendAppearanceToAgent(this);
|
||||||
|
|
||||||
|
// If we are using the the cached appearance then send it out to everyone
|
||||||
|
if (cachedappearance)
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name);
|
||||||
|
|
||||||
|
// If the avatars baked textures are all in the cache, then we have a
|
||||||
|
// complete appearance... send it out, if not, then we'll send it when
|
||||||
|
// the avatar finishes updating its appearance
|
||||||
|
SendAppearanceToAllOtherAgents();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tell *ALL* agents about this agent
|
/// Send this agent's avatar data to all other root and child agents in the scene
|
||||||
|
/// This agent must be root. This avatar will receive its own update.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendInitialFullUpdateToAllClients()
|
public void SendAvatarDataToAllAgents()
|
||||||
|
{
|
||||||
|
// only send update from root agents to other clients; children are only "listening posts"
|
||||||
|
if (IsChildAgent)
|
||||||
|
{
|
||||||
|
m_log.Warn("[SCENEPRESENCE] attempt to send avatar data from a child agent");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_perfMonMS = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
||||||
|
{
|
||||||
|
SendAvatarDataToAgent(scenePresence);
|
||||||
|
count++;
|
||||||
|
});
|
||||||
|
|
||||||
|
m_scene.StatsReporter.AddAgentUpdates(count);
|
||||||
|
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Send avatar data for all other root agents to this agent, this agent
|
||||||
|
/// can be either a child or root
|
||||||
|
/// </summary>
|
||||||
|
public void SendOtherAgentsAvatarDataToMe()
|
||||||
{
|
{
|
||||||
// REGION SYNC
|
// REGION SYNC
|
||||||
// The server should not be doing anything via the ForEachScenePresence method
|
// The server should not be doing anything via the ForEachScenePresence method
|
||||||
if (m_scene.IsSyncedServer())
|
if (m_scene.IsSyncedServer())
|
||||||
return;
|
return;
|
||||||
m_perfMonMS = Util.EnvironmentTickCount();
|
m_perfMonMS = Util.EnvironmentTickCount();
|
||||||
int avUpdates = 0;
|
|
||||||
m_scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
|
||||||
{
|
|
||||||
++avUpdates;
|
|
||||||
|
|
||||||
// Don't update ourselves
|
int count = 0;
|
||||||
if (avatar.LocalId == LocalId)
|
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
||||||
return;
|
{
|
||||||
|
// only send information about root agents
|
||||||
|
if (scenePresence.IsChildAgent)
|
||||||
|
return;
|
||||||
|
|
||||||
// If this is a root agent, then get info about the avatar
|
// only send information about other root agents
|
||||||
if (!IsChildAgent)
|
if (scenePresence.UUID == UUID)
|
||||||
{
|
return;
|
||||||
m_log.DebugFormat("[SCENE PRESENCE]: SendInitialFullUpdateToAllClients.SendFullUpdateToOtherClient");
|
|
||||||
SendFullUpdateToOtherClient(avatar);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the other avatar is a root
|
scenePresence.SendAvatarDataToAgent(this);
|
||||||
if (!avatar.IsChildAgent)
|
count++;
|
||||||
{
|
});
|
||||||
avatar.SendFullUpdateToOtherClient(this);
|
|
||||||
avatar.SendAppearanceToOtherAgent(this);
|
|
||||||
avatar.Animator.SendAnimPackToClient(ControllingClient);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
m_scene.StatsReporter.AddAgentUpdates(avUpdates);
|
m_scene.StatsReporter.AddAgentUpdates(count);
|
||||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||||
|
|
||||||
//Animator.SendAnimPack();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendFullUpdateToAllClients()
|
/// <summary>
|
||||||
|
/// Send avatar data to an agent.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="avatar"></param>
|
||||||
|
public void SendAvatarDataToAgent(ScenePresence avatar)
|
||||||
|
{
|
||||||
|
// m_log.WarnFormat("[SP] Send avatar data from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
|
||||||
|
|
||||||
|
avatar.ControllingClient.SendAvatarDataImmediate(this);
|
||||||
|
Animator.SendAnimPackToClient(avatar.ControllingClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Send this agent's appearance to all other root and child agents in the scene
|
||||||
|
/// This agent must be root.
|
||||||
|
/// </summary>
|
||||||
|
public void SendAppearanceToAllOtherAgents()
|
||||||
{
|
{
|
||||||
// REGION SYNC
|
// REGION SYNC
|
||||||
// The server should not be doing anything via the ForEachScenePresence method
|
// The server should not be doing anything via the ForEachScenePresence method
|
||||||
|
@ -2548,99 +2624,62 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_scene.RegionSyncServerModule.QueuePresenceForTerseUpdate(this);
|
m_scene.RegionSyncServerModule.QueuePresenceForTerseUpdate(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_perfMonMS = Util.EnvironmentTickCount();
|
|
||||||
|
|
||||||
// only send update from root agents to other clients; children are only "listening posts"
|
// only send update from root agents to other clients; children are only "listening posts"
|
||||||
if (IsChildAgent)
|
if (IsChildAgent)
|
||||||
{
|
{
|
||||||
m_log.Warn("[SCENEPRESENCE] attempt to send update from a childagent");
|
m_log.Warn("[SCENEPRESENCE] attempt to send avatar data from a child agent");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
|
|
||||||
{
|
|
||||||
if (sp.IsChildAgent)
|
|
||||||
return;
|
|
||||||
SendFullUpdateToOtherClient(sp);
|
|
||||||
++count;
|
|
||||||
});
|
|
||||||
m_scene.StatsReporter.AddAgentUpdates(count);
|
|
||||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
|
||||||
|
|
||||||
Animator.SendAnimPack();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Do everything required once a client completes its movement into a region
|
|
||||||
/// </summary>
|
|
||||||
public void SendInitialData()
|
|
||||||
{
|
|
||||||
// Moved this into CompleteMovement to ensure that m_appearance is initialized before
|
|
||||||
// the inventory arrives
|
|
||||||
// m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
|
|
||||||
|
|
||||||
m_controllingClient.SendAvatarDataImmediate(this);
|
|
||||||
if (m_scene.AvatarFactory != null)
|
|
||||||
{
|
|
||||||
if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient))
|
|
||||||
{
|
|
||||||
// m_log.WarnFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name);
|
|
||||||
m_controllingClient.SendAppearance(
|
|
||||||
m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public void SendAppearanceToAllOtherAgents()
|
|
||||||
{
|
|
||||||
// DEBUG ON
|
|
||||||
// m_log.WarnFormat("[SCENEPRESENCE]: Send appearance from {0} to all other agents", m_uuid);
|
|
||||||
// DEBUG OFF
|
|
||||||
// REGION SYNC
|
|
||||||
// The server sends appearance to all client managers since there are no local clients
|
|
||||||
if (m_scene.IsSyncedServer())
|
|
||||||
{
|
|
||||||
m_scene.RegionSyncServerModule.SendAppearance(UUID);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Appearance.Texture == null)
|
|
||||||
return;
|
|
||||||
m_perfMonMS = Util.EnvironmentTickCount();
|
m_perfMonMS = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
||||||
{
|
{
|
||||||
if (scenePresence.UUID != UUID)
|
if (scenePresence.UUID == UUID)
|
||||||
{
|
return;
|
||||||
SendAppearanceToOtherAgent(scenePresence);
|
|
||||||
}
|
SendAppearanceToAgent(scenePresence);
|
||||||
|
count++;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
m_scene.StatsReporter.AddAgentUpdates(count);
|
||||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Send appearance data to an agent that isn't this one.
|
/// Send appearance from all other root agents to this agent. this agent
|
||||||
|
/// can be either root or child
|
||||||
|
/// </summary>
|
||||||
|
public void SendOtherAgentsAppearanceToMe()
|
||||||
|
{
|
||||||
|
m_perfMonMS = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
||||||
|
{
|
||||||
|
// only send information about root agents
|
||||||
|
if (scenePresence.IsChildAgent)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// only send information about other root agents
|
||||||
|
if (scenePresence.UUID == UUID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
scenePresence.SendAppearanceToAgent(this);
|
||||||
|
count++;
|
||||||
|
});
|
||||||
|
m_scene.StatsReporter.AddAgentUpdates(count);
|
||||||
|
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Send appearance data to an agent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="avatar"></param>
|
/// <param name="avatar"></param>
|
||||||
public void SendAppearanceToOtherAgent(ScenePresence avatar)
|
public void SendAppearanceToAgent(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
if (LocalId == avatar.LocalId)
|
|
||||||
{
|
|
||||||
m_log.WarnFormat("[SCENE PRESENCE]: An agent is attempting to send appearance data to itself; {0}", UUID);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// DEBUG ON
|
|
||||||
// m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
|
// m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
|
||||||
// DEBUG OFF
|
|
||||||
|
|
||||||
avatar.ControllingClient.SendAppearance(
|
avatar.ControllingClient.SendAppearance(
|
||||||
m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
|
m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
|
||||||
|
@ -3153,9 +3192,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void CopyFrom(AgentData cAgent)
|
public void CopyFrom(AgentData cAgent)
|
||||||
{
|
{
|
||||||
// DEBUG ON
|
|
||||||
m_log.ErrorFormat("[SCENEPRESENCE] CALLING COPYFROM");
|
|
||||||
// DEBUG OFF
|
|
||||||
m_originRegionID = cAgent.RegionID;
|
m_originRegionID = cAgent.RegionID;
|
||||||
|
|
||||||
m_callbackURI = cAgent.CallbackURI;
|
m_callbackURI = cAgent.CallbackURI;
|
||||||
|
|
|
@ -409,12 +409,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
#region SOPXmlProcessors
|
#region SOPXmlProcessors
|
||||||
private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.AllowedDrop = reader.ReadElementContentAsBoolean("AllowedDrop", String.Empty);
|
obj.AllowedDrop = Util.ReadBoolean(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.CreatorID = ReadUUID(reader, "CreatorID");
|
obj.CreatorID = Util.ReadUUID(reader, "CreatorID");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader)
|
||||||
|
@ -424,7 +424,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.FolderID = ReadUUID(reader, "FolderID");
|
obj.FolderID = Util.ReadUUID(reader, "FolderID");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessInventorySerial(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessInventorySerial(SceneObjectPart obj, XmlTextReader reader)
|
||||||
|
@ -439,7 +439,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessUUID(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessUUID(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.UUID = ReadUUID(reader, "UUID");
|
obj.UUID = Util.ReadUUID(reader, "UUID");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessLocalId(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessLocalId(SceneObjectPart obj, XmlTextReader reader)
|
||||||
|
@ -459,7 +459,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessPassTouches(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessPassTouches(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.PassTouches = reader.ReadElementContentAsBoolean("PassTouches", String.Empty);
|
obj.PassTouches = Util.ReadBoolean(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessRegionHandle(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessRegionHandle(SceneObjectPart obj, XmlTextReader reader)
|
||||||
|
@ -474,32 +474,32 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessGroupPosition(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessGroupPosition(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.GroupPosition = ReadVector(reader, "GroupPosition");
|
obj.GroupPosition = Util.ReadVector(reader, "GroupPosition");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessOffsetPosition(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessOffsetPosition(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.OffsetPosition = ReadVector(reader, "OffsetPosition"); ;
|
obj.OffsetPosition = Util.ReadVector(reader, "OffsetPosition"); ;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessRotationOffset(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessRotationOffset(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.RotationOffset = ReadQuaternion(reader, "RotationOffset");
|
obj.RotationOffset = Util.ReadQuaternion(reader, "RotationOffset");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessVelocity(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessVelocity(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.Velocity = ReadVector(reader, "Velocity");
|
obj.Velocity = Util.ReadVector(reader, "Velocity");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessAngularVelocity(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessAngularVelocity(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.AngularVelocity = ReadVector(reader, "AngularVelocity");
|
obj.AngularVelocity = Util.ReadVector(reader, "AngularVelocity");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessAcceleration(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessAcceleration(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.Acceleration = ReadVector(reader, "Acceleration");
|
obj.Acceleration = Util.ReadVector(reader, "Acceleration");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessDescription(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessDescription(SceneObjectPart obj, XmlTextReader reader)
|
||||||
|
@ -553,7 +553,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.Scale = ReadVector(reader, "Scale");
|
obj.Scale = Util.ReadVector(reader, "Scale");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessUpdateFlag(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessUpdateFlag(SceneObjectPart obj, XmlTextReader reader)
|
||||||
|
@ -563,22 +563,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.SitTargetOrientation = ReadQuaternion(reader, "SitTargetOrientation");
|
obj.SitTargetOrientation = Util.ReadQuaternion(reader, "SitTargetOrientation");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessSitTargetPosition(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessSitTargetPosition(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.SitTargetPosition = ReadVector(reader, "SitTargetPosition");
|
obj.SitTargetPosition = Util.ReadVector(reader, "SitTargetPosition");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessSitTargetPositionLL(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessSitTargetPositionLL(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.SitTargetPositionLL = ReadVector(reader, "SitTargetPositionLL");
|
obj.SitTargetPositionLL = Util.ReadVector(reader, "SitTargetPositionLL");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessSitTargetOrientationLL(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessSitTargetOrientationLL(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.SitTargetOrientationLL = ReadQuaternion(reader, "SitTargetOrientationLL");
|
obj.SitTargetOrientationLL = Util.ReadQuaternion(reader, "SitTargetOrientationLL");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessParentID(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessParentID(SceneObjectPart obj, XmlTextReader reader)
|
||||||
|
@ -614,17 +614,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessGroupID(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessGroupID(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.GroupID = ReadUUID(reader, "GroupID");
|
obj.GroupID = Util.ReadUUID(reader, "GroupID");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessOwnerID(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessOwnerID(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.OwnerID = ReadUUID(reader, "OwnerID");
|
obj.OwnerID = Util.ReadUUID(reader, "OwnerID");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessLastOwnerID(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessLastOwnerID(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.LastOwnerID = ReadUUID(reader, "LastOwnerID");
|
obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessBaseMask(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessBaseMask(SceneObjectPart obj, XmlTextReader reader)
|
||||||
|
@ -654,16 +654,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessFlags(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessFlags(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
string value = reader.ReadElementContentAsString("Flags", String.Empty);
|
obj.Flags = Util.ReadEnum<PrimFlags>(reader, "Flags");
|
||||||
// !!!!! to deal with flags without commas
|
|
||||||
if (value.Contains(" ") && !value.Contains(","))
|
|
||||||
value = value.Replace(" ", ", ");
|
|
||||||
obj.Flags = (PrimFlags)Enum.Parse(typeof(PrimFlags), value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
obj.CollisionSound = ReadUUID(reader, "CollisionSound");
|
obj.CollisionSound = Util.ReadUUID(reader, "CollisionSound");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlTextReader reader)
|
private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlTextReader reader)
|
||||||
|
@ -690,7 +686,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
#region TaskInventoryXmlProcessors
|
#region TaskInventoryXmlProcessors
|
||||||
private static void ProcessTIAssetID(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTIAssetID(TaskInventoryItem item, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
item.AssetID = ReadUUID(reader, "AssetID");
|
item.AssetID = Util.ReadUUID(reader, "AssetID");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlTextReader reader)
|
||||||
|
@ -705,7 +701,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessTICreatorID(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTICreatorID(TaskInventoryItem item, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
item.CreatorID = ReadUUID(reader, "CreatorID");
|
item.CreatorID = Util.ReadUUID(reader, "CreatorID");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader)
|
||||||
|
@ -730,7 +726,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessTIGroupID(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTIGroupID(TaskInventoryItem item, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
item.GroupID = ReadUUID(reader, "GroupID");
|
item.GroupID = Util.ReadUUID(reader, "GroupID");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlTextReader reader)
|
||||||
|
@ -745,20 +741,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessTIItemID(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTIItemID(TaskInventoryItem item, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
item.ItemID = ReadUUID(reader, "ItemID");
|
item.ItemID = Util.ReadUUID(reader, "ItemID");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
ReadUUID(reader, "OldItemID");
|
Util.ReadUUID(reader, "OldItemID");
|
||||||
// On deserialization, the old item id MUST BE UUID.Zero!!!!!
|
// On deserialization, the old item id MUST BE UUID.Zero!!!!!
|
||||||
// Setting this to the saved value will BREAK script persistence!
|
// Setting this to the saved value will BREAK script persistence!
|
||||||
// item.OldItemID = ReadUUID(reader, "OldItemID");
|
// item.OldItemID = Util.ReadUUID(reader, "OldItemID");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
item.LastOwnerID = ReadUUID(reader, "LastOwnerID");
|
item.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessTIName(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTIName(TaskInventoryItem item, XmlTextReader reader)
|
||||||
|
@ -773,7 +769,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessTIOwnerID(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTIOwnerID(TaskInventoryItem item, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
item.OwnerID = ReadUUID(reader, "OwnerID");
|
item.OwnerID = Util.ReadUUID(reader, "OwnerID");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlTextReader reader)
|
||||||
|
@ -783,17 +779,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessTIParentID(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTIParentID(TaskInventoryItem item, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
item.ParentID = ReadUUID(reader, "ParentID");
|
item.ParentID = Util.ReadUUID(reader, "ParentID");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessTIParentPartID(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTIParentPartID(TaskInventoryItem item, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
item.ParentPartID = ReadUUID(reader, "ParentPartID");
|
item.ParentPartID = Util.ReadUUID(reader, "ParentPartID");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
item.PermsGranter = ReadUUID(reader, "PermsGranter");
|
item.PermsGranter = Util.ReadUUID(reader, "PermsGranter");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessTIPermsMask(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTIPermsMask(TaskInventoryItem item, XmlTextReader reader)
|
||||||
|
@ -808,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader)
|
private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
item.OwnerChanged = reader.ReadElementContentAsBoolean("OwnerChanged", String.Empty);
|
item.OwnerChanged = Util.ReadBoolean(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -922,7 +918,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessShpScale(PrimitiveBaseShape shp, XmlTextReader reader)
|
private static void ProcessShpScale(PrimitiveBaseShape shp, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
shp.Scale = ReadVector(reader, "Scale");
|
shp.Scale = Util.ReadVector(reader, "Scale");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessShpState(PrimitiveBaseShape shp, XmlTextReader reader)
|
private static void ProcessShpState(PrimitiveBaseShape shp, XmlTextReader reader)
|
||||||
|
@ -932,25 +928,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader)
|
private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
string value = reader.ReadElementContentAsString("ProfileShape", String.Empty);
|
shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape");
|
||||||
// !!!!! to deal with flags without commas
|
|
||||||
if (value.Contains(" ") && !value.Contains(","))
|
|
||||||
value = value.Replace(" ", ", ");
|
|
||||||
shp.ProfileShape = (ProfileShape)Enum.Parse(typeof(ProfileShape), value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader)
|
private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
string value = reader.ReadElementContentAsString("HollowShape", String.Empty);
|
shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape");
|
||||||
// !!!!! to deal with flags without commas
|
|
||||||
if (value.Contains(" ") && !value.Contains(","))
|
|
||||||
value = value.Replace(" ", ", ");
|
|
||||||
shp.HollowShape = (HollowShape)Enum.Parse(typeof(HollowShape), value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader)
|
private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
shp.SculptTexture = ReadUUID(reader, "SculptTexture");
|
shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlTextReader reader)
|
private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlTextReader reader)
|
||||||
|
@ -1045,17 +1033,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlTextReader reader)
|
private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
shp.FlexiEntry = reader.ReadElementContentAsBoolean("FlexiEntry", String.Empty);
|
shp.FlexiEntry = Util.ReadBoolean(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlTextReader reader)
|
private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
shp.LightEntry = reader.ReadElementContentAsBoolean("LightEntry", String.Empty);
|
shp.LightEntry = Util.ReadBoolean(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlTextReader reader)
|
private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlTextReader reader)
|
||||||
{
|
{
|
||||||
shp.SculptEntry = reader.ReadElementContentAsBoolean("SculptEntry", String.Empty);
|
shp.SculptEntry = Util.ReadBoolean(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader)
|
private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader)
|
||||||
|
@ -1225,16 +1213,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> options)
|
static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> options)
|
||||||
{
|
{
|
||||||
// Older versions of serialization can't cope with commas
|
// Older versions of serialization can't cope with commas, so we eliminate the commas
|
||||||
if (options.ContainsKey("version"))
|
writer.WriteElementString(name, flagsStr.Replace(",", ""));
|
||||||
{
|
|
||||||
float version = 0.5F;
|
|
||||||
float.TryParse(options["version"].ToString(), out version);
|
|
||||||
if (version < 0.5)
|
|
||||||
flagsStr = flagsStr.Replace(",", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
writer.WriteElementString(name, flagsStr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options, Scene scene)
|
static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options, Scene scene)
|
||||||
|
@ -1464,66 +1444,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
static UUID ReadUUID(XmlTextReader reader, string name)
|
|
||||||
{
|
|
||||||
UUID id;
|
|
||||||
string idStr;
|
|
||||||
|
|
||||||
reader.ReadStartElement(name);
|
|
||||||
|
|
||||||
if (reader.Name == "Guid")
|
|
||||||
idStr = reader.ReadElementString("Guid");
|
|
||||||
else // UUID
|
|
||||||
idStr = reader.ReadElementString("UUID");
|
|
||||||
|
|
||||||
UUID.TryParse(idStr, out id);
|
|
||||||
reader.ReadEndElement();
|
|
||||||
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Vector3 ReadVector(XmlTextReader reader, string name)
|
|
||||||
{
|
|
||||||
Vector3 vec;
|
|
||||||
|
|
||||||
reader.ReadStartElement(name);
|
|
||||||
vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x
|
|
||||||
vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or y
|
|
||||||
vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z
|
|
||||||
reader.ReadEndElement();
|
|
||||||
|
|
||||||
return vec;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Quaternion ReadQuaternion(XmlTextReader reader, string name)
|
|
||||||
{
|
|
||||||
Quaternion quat = new Quaternion();
|
|
||||||
|
|
||||||
reader.ReadStartElement(name);
|
|
||||||
while (reader.NodeType != XmlNodeType.EndElement)
|
|
||||||
{
|
|
||||||
switch (reader.Name.ToLower())
|
|
||||||
{
|
|
||||||
case "x":
|
|
||||||
quat.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
|
|
||||||
break;
|
|
||||||
case "y":
|
|
||||||
quat.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
|
|
||||||
break;
|
|
||||||
case "z":
|
|
||||||
quat.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
|
|
||||||
break;
|
|
||||||
case "w":
|
|
||||||
quat.W = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
reader.ReadEndElement();
|
|
||||||
|
|
||||||
return quat;
|
|
||||||
}
|
|
||||||
|
|
||||||
static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name)
|
static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name)
|
||||||
{
|
{
|
||||||
TaskInventoryDictionary tinv = new TaskInventoryDictionary();
|
TaskInventoryDictionary tinv = new TaskInventoryDictionary();
|
||||||
|
|
|
@ -121,13 +121,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
"Not exactly sure what this is asserting...");
|
"Not exactly sure what this is asserting...");
|
||||||
|
|
||||||
// Delink part 2
|
// Delink part 2
|
||||||
grp1.DelinkFromGroup(part2.LocalId);
|
SceneObjectGroup grp3 = grp1.DelinkFromGroup(part2.LocalId);
|
||||||
|
|
||||||
if (debugtest)
|
if (debugtest)
|
||||||
m_log.Debug("Group2: Prim2: OffsetPosition:" + part2.AbsolutePosition + ", OffsetRotation:" + part2.RotationOffset);
|
m_log.Debug("Group2: Prim2: OffsetPosition:" + part2.AbsolutePosition + ", OffsetRotation:" + part2.RotationOffset);
|
||||||
|
|
||||||
Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink.");
|
Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink.");
|
||||||
Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero");
|
Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero");
|
||||||
|
Assert.That(grp3.HasGroupChangedDueToDelink, Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -333,7 +334,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
|
|
||||||
// These changes should occur immediately without waiting for a backup pass
|
// These changes should occur immediately without waiting for a backup pass
|
||||||
SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
|
SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
|
||||||
|
|
||||||
|
Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.True);
|
||||||
scene.DeleteSceneObject(groupToDelete, false);
|
scene.DeleteSceneObject(groupToDelete, false);
|
||||||
|
Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.False);
|
||||||
|
|
||||||
List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
|
List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
|
||||||
|
|
||||||
|
|
|
@ -86,23 +86,33 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="assetUuids">The assets gathered</param>
|
/// <param name="assetUuids">The assets gathered</param>
|
||||||
public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, AssetType> assetUuids)
|
public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, AssetType> assetUuids)
|
||||||
{
|
{
|
||||||
assetUuids[assetUuid] = assetType;
|
try
|
||||||
|
{
|
||||||
|
assetUuids[assetUuid] = assetType;
|
||||||
|
|
||||||
if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType)
|
if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType)
|
||||||
{
|
{
|
||||||
GetWearableAssetUuids(assetUuid, assetUuids);
|
GetWearableAssetUuids(assetUuid, assetUuids);
|
||||||
|
}
|
||||||
|
else if (AssetType.Gesture == assetType)
|
||||||
|
{
|
||||||
|
GetGestureAssetUuids(assetUuid, assetUuids);
|
||||||
|
}
|
||||||
|
else if (AssetType.LSLText == assetType)
|
||||||
|
{
|
||||||
|
GetScriptAssetUuids(assetUuid, assetUuids);
|
||||||
|
}
|
||||||
|
else if (AssetType.Object == assetType)
|
||||||
|
{
|
||||||
|
GetSceneObjectAssetUuids(assetUuid, assetUuids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (AssetType.Gesture == assetType)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
GetGestureAssetUuids(assetUuid, assetUuids);
|
m_log.ErrorFormat(
|
||||||
}
|
"[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}",
|
||||||
else if (AssetType.LSLText == assetType)
|
assetUuid, assetType);
|
||||||
{
|
throw;
|
||||||
GetScriptAssetUuids(assetUuid, assetUuids);
|
|
||||||
}
|
|
||||||
else if (AssetType.Object == assetType)
|
|
||||||
{
|
|
||||||
GetSceneObjectAssetUuids(assetUuid, assetUuids);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
m_FreeswitchService = ServerUtils.LoadPlugin<IFreeswitchService>(serviceDll, args);
|
m_FreeswitchService = ServerUtils.LoadPlugin<IFreeswitchService>(serviceDll, args);
|
||||||
|
|
||||||
string jsonConfig = m_FreeswitchService.GetJsonConfig();
|
string jsonConfig = m_FreeswitchService.GetJsonConfig();
|
||||||
m_log.Debug("[FreeSwitchVoice]: Configuration string: " + jsonConfig);
|
//m_log.Debug("[FreeSwitchVoice]: Configuration string: " + jsonConfig);
|
||||||
OSDMap map = (OSDMap)OSDParser.DeserializeJson(jsonConfig);
|
OSDMap map = (OSDMap)OSDParser.DeserializeJson(jsonConfig);
|
||||||
|
|
||||||
m_freeSwitchAPIPrefix = map["APIPrefix"].AsString();
|
m_freeSwitchAPIPrefix = map["APIPrefix"].AsString();
|
||||||
|
@ -363,8 +363,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
|
//m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
|
||||||
request, path, param);
|
// request, path, param);
|
||||||
|
|
||||||
//XmlElement resp;
|
//XmlElement resp;
|
||||||
string agentname = "x" + Convert.ToBase64String(agentID.GetBytes());
|
string agentname = "x" + Convert.ToBase64String(agentID.GetBytes());
|
||||||
|
@ -445,8 +445,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
// voice channel
|
// voice channel
|
||||||
LandData land = scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
|
LandData land = scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
|
||||||
|
|
||||||
m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": request: {4}, path: {5}, param: {6}",
|
//m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": request: {4}, path: {5}, param: {6}",
|
||||||
scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, request, path, param);
|
// scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, request, path, param);
|
||||||
|
|
||||||
// TODO: EstateSettings don't seem to get propagated...
|
// TODO: EstateSettings don't seem to get propagated...
|
||||||
// if (!scene.RegionInfo.EstateSettings.AllowVoice)
|
// if (!scene.RegionInfo.EstateSettings.AllowVoice)
|
||||||
|
@ -592,7 +592,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
|
|
||||||
response["int_response_code"] = 200;
|
response["int_response_code"] = 200;
|
||||||
|
|
||||||
m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler return {0}",response["str_response_string"]);
|
//m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler return {0}",response["str_response_string"]);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,7 +664,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
response["str_response_string"] = resp.ToString();
|
response["str_response_string"] = resp.ToString();
|
||||||
Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
|
Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
|
||||||
|
|
||||||
m_log.DebugFormat("[FREESWITCH]: {0}", normalizeEndLines.Replace((string)response["str_response_string"],""));
|
//m_log.DebugFormat("[FREESWITCH]: {0}", normalizeEndLines.Replace((string)response["str_response_string"],""));
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,8 +696,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat("[FreeSwitchVoice]: AUTH, URI: {0}, Content-Type:{1}, Body{2}", uri, contenttype,
|
//m_log.DebugFormat("[FreeSwitchVoice]: AUTH, URI: {0}, Content-Type:{1}, Body{2}", uri, contenttype,
|
||||||
requestbody);
|
// requestbody);
|
||||||
Hashtable response = new Hashtable();
|
Hashtable response = new Hashtable();
|
||||||
response["str_response_string"] = string.Format(@"<response xsi:schemaLocation=""/xsd/signin.xsd"">
|
response["str_response_string"] = string.Format(@"<response xsi:schemaLocation=""/xsd/signin.xsd"">
|
||||||
<level0>
|
<level0>
|
||||||
|
|
|
@ -1173,10 +1173,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
presence = scene.GetScenePresence(AgentID);
|
presence = scene.GetScenePresence(AgentID);
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
{
|
{
|
||||||
presence.Grouptitle = Title;
|
if (presence.Grouptitle != Title)
|
||||||
|
{
|
||||||
|
presence.Grouptitle = Title;
|
||||||
|
|
||||||
// FixMe: Ter suggests a "Schedule" method that I can't find.
|
if (! presence.IsChildAgent)
|
||||||
presence.SendFullUpdateToAllClients();
|
presence.SendAvatarDataToAllAgents();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using log4net;
|
||||||
|
using Mono.Addins;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.OptionalModules.Example.BareBonesNonShared
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Simplest possible example of a non-shared region module.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This module is the simplest possible example of a non-shared region module (a module where each scene/region
|
||||||
|
/// in the simulator has its own copy). If anybody wants to create a more complex example in the future then
|
||||||
|
/// please create a separate class.
|
||||||
|
///
|
||||||
|
/// This module is not active by default. If you want to see it in action,
|
||||||
|
/// then just uncomment the line below starting with [Extension(Path...
|
||||||
|
///
|
||||||
|
/// When the module is enabled it will print messages when it receives certain events to the screen and the log
|
||||||
|
/// file.
|
||||||
|
/// </remarks>
|
||||||
|
//[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BareBonesNonSharedModule")]
|
||||||
|
public class BareBonesNonSharedModule : INonSharedRegionModule
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
public string Name { get { return "Bare Bones Non Shared Module"; } }
|
||||||
|
|
||||||
|
public Type ReplaceableInterface { get { return null; } }
|
||||||
|
|
||||||
|
public void Initialise(IConfigSource source)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[BARE BONES NON SHARED]: INITIALIZED MODULE");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[BARE BONES NON SHARED]: CLOSED MODULE");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[BARE BONES NON SHARED]: REGION {0} ADDED", scene.RegionInfo.RegionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[BARE BONES NON SHARED]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[BARE BONES NON SHARED]: REGION {0} LOADED", scene.RegionInfo.RegionName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using log4net;
|
||||||
|
using Mono.Addins;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.OptionalModules.Example.BareBonesShared
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Simplest possible example of a shared region module.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This module is the simplest possible example of a shared region module (a module which is shared by every
|
||||||
|
/// scene/region running on the simulator). If anybody wants to create a more complex example in the future then
|
||||||
|
/// please create a separate class.
|
||||||
|
///
|
||||||
|
/// This module is not active by default. If you want to see it in action,
|
||||||
|
/// then just uncomment the line below starting with [Extension(Path...
|
||||||
|
///
|
||||||
|
/// When the module is enabled it will print messages when it receives certain events to the screen and the log
|
||||||
|
/// file.
|
||||||
|
/// </remarks>
|
||||||
|
//[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BareBonesSharedModule")]
|
||||||
|
public class BareBonesSharedModule : ISharedRegionModule
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
public string Name { get { return "Bare Bones Shared Module"; } }
|
||||||
|
|
||||||
|
public Type ReplaceableInterface { get { return null; } }
|
||||||
|
|
||||||
|
public void Initialise(IConfigSource source)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[BARE BONES SHARED]: INITIALIZED MODULE");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PostInitialise()
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[BARE BONES SHARED]: POST INITIALIZED MODULE");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[BARE BONES SHARED]: CLOSED MODULE");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[BARE BONES SHARED]: REGION {0} ADDED", scene.RegionInfo.RegionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[BARE BONES SHARED]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[BARE BONES SHARED]: REGION {0} LOADED", scene.RegionInfo.RegionName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -42,7 +42,8 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
||||||
NewRez = 1,
|
NewRez = 1,
|
||||||
PrimCrossing = 2,
|
PrimCrossing = 2,
|
||||||
ScriptedRez = 3,
|
ScriptedRez = 3,
|
||||||
AttachedRez = 4
|
AttachedRez = 4,
|
||||||
|
Teleporting = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IScriptWorkItem
|
public interface IScriptWorkItem
|
||||||
|
|
|
@ -7846,24 +7846,59 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
|
case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
|
||||||
// TODO--------------
|
|
||||||
if (remain < 1)
|
if (remain < 1)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
face=(int)rules.GetLSLIntegerItem(idx++);
|
face=(int)rules.GetLSLIntegerItem(idx++);
|
||||||
|
|
||||||
res.Add(new LSL_Integer(0));
|
tex = part.Shape.Textures;
|
||||||
res.Add(new LSL_Integer(0));
|
if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
|
{
|
||||||
|
for (face = 0; face < GetNumberOfSides(part); face++)
|
||||||
|
{
|
||||||
|
Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
|
||||||
|
// Convert Shininess to PRIM_SHINY_*
|
||||||
|
res.Add(new LSL_Integer((uint)texface.Shiny >> 6));
|
||||||
|
// PRIM_BUMP_*
|
||||||
|
res.Add(new LSL_Integer((int)texface.Bump));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
|
{
|
||||||
|
Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
|
||||||
|
// Convert Shininess to PRIM_SHINY_*
|
||||||
|
res.Add(new LSL_Integer((uint)texface.Shiny >> 6));
|
||||||
|
// PRIM_BUMP_*
|
||||||
|
res.Add(new LSL_Integer((int)texface.Bump));
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
|
case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
|
||||||
// TODO--------------
|
|
||||||
if (remain < 1)
|
if (remain < 1)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
face=(int)rules.GetLSLIntegerItem(idx++);
|
face=(int)rules.GetLSLIntegerItem(idx++);
|
||||||
|
|
||||||
res.Add(new LSL_Integer(0));
|
tex = part.Shape.Textures;
|
||||||
|
if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
|
{
|
||||||
|
for (face = 0; face < GetNumberOfSides(part); face++)
|
||||||
|
{
|
||||||
|
Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
|
||||||
|
res.Add(new LSL_Integer(texface.Fullbright ? 1 : 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
|
{
|
||||||
|
Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
|
||||||
|
res.Add(new LSL_Integer(texface.Fullbright ? 1 : 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int)ScriptBaseClass.PRIM_FLEXIBLE:
|
case (int)ScriptBaseClass.PRIM_FLEXIBLE:
|
||||||
|
@ -7884,14 +7919,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int)ScriptBaseClass.PRIM_TEXGEN:
|
case (int)ScriptBaseClass.PRIM_TEXGEN:
|
||||||
// TODO--------------
|
|
||||||
// (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR)
|
|
||||||
if (remain < 1)
|
if (remain < 1)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
face=(int)rules.GetLSLIntegerItem(idx++);
|
face=(int)rules.GetLSLIntegerItem(idx++);
|
||||||
|
|
||||||
res.Add(new LSL_Integer(0));
|
tex = part.Shape.Textures;
|
||||||
|
if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
|
{
|
||||||
|
for (face = 0; face < GetNumberOfSides(part); face++)
|
||||||
|
{
|
||||||
|
MappingType texgen = tex.GetFace((uint)face).TexMapType;
|
||||||
|
// Convert MappingType to PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR etc.
|
||||||
|
res.Add(new LSL_Integer((uint)texgen >> 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
|
{
|
||||||
|
MappingType texgen = tex.GetFace((uint)face).TexMapType;
|
||||||
|
res.Add(new LSL_Integer((uint)texgen >> 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
|
case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
|
||||||
|
@ -7910,14 +7960,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int)ScriptBaseClass.PRIM_GLOW:
|
case (int)ScriptBaseClass.PRIM_GLOW:
|
||||||
// TODO--------------
|
|
||||||
if (remain < 1)
|
if (remain < 1)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
face=(int)rules.GetLSLIntegerItem(idx++);
|
face=(int)rules.GetLSLIntegerItem(idx++);
|
||||||
|
|
||||||
res.Add(new LSL_Float(0));
|
tex = part.Shape.Textures;
|
||||||
|
if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
|
{
|
||||||
|
for (face = 0; face < GetNumberOfSides(part); face++)
|
||||||
|
{
|
||||||
|
Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
|
||||||
|
res.Add(new LSL_Float(texface.Glow));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
|
{
|
||||||
|
Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
|
||||||
|
res.Add(new LSL_Float(texface.Glow));
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int)ScriptBaseClass.PRIM_TEXT:
|
case (int)ScriptBaseClass.PRIM_TEXT:
|
||||||
Color4 textColor = part.GetTextColor();
|
Color4 textColor = part.GetTextColor();
|
||||||
res.Add(part.Text);
|
res.Add(part.Text);
|
||||||
|
|
|
@ -395,10 +395,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
//
|
//
|
||||||
CheckThreatLevel(ThreatLevel.High, "osRegionRestart");
|
CheckThreatLevel(ThreatLevel.High, "osRegionRestart");
|
||||||
|
|
||||||
|
IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>();
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false))
|
if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false) && (restartModule != null))
|
||||||
{
|
{
|
||||||
World.Restart((float)seconds);
|
if (seconds < 15)
|
||||||
|
{
|
||||||
|
restartModule.AbortRestart("Restart aborted");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<int> times = new List<int>();
|
||||||
|
while (seconds > 0)
|
||||||
|
{
|
||||||
|
times.Add((int)seconds);
|
||||||
|
if (seconds > 300)
|
||||||
|
seconds -= 120;
|
||||||
|
else if (seconds > 30)
|
||||||
|
seconds -= 30;
|
||||||
|
else
|
||||||
|
seconds -= 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -390,17 +390,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
}
|
}
|
||||||
else if (m_stateSource == StateSource.RegionStart)
|
else if (m_stateSource == StateSource.RegionStart)
|
||||||
{
|
{
|
||||||
// m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script");
|
//m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script");
|
||||||
PostEvent(new EventParams("changed",
|
PostEvent(new EventParams("changed",
|
||||||
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) },
|
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) }, new DetectParams[0]));
|
||||||
new DetectParams[0]));
|
|
||||||
}
|
}
|
||||||
else if (m_stateSource == StateSource.PrimCrossing)
|
else if (m_stateSource == StateSource.PrimCrossing || m_stateSource == StateSource.Teleporting)
|
||||||
{
|
{
|
||||||
// CHANGED_REGION
|
// CHANGED_REGION
|
||||||
PostEvent(new EventParams("changed",
|
PostEvent(new EventParams("changed",
|
||||||
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) },
|
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) }, new DetectParams[0]));
|
||||||
new DetectParams[0]));
|
|
||||||
|
// CHANGED_TELEPORT
|
||||||
|
if (m_stateSource == StateSource.Teleporting)
|
||||||
|
PostEvent(new EventParams("changed",
|
||||||
|
new Object[] { new LSL_Types.LSLInteger((int)Changed.TELEPORT) }, new DetectParams[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -47,6 +47,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
{
|
{
|
||||||
|
|
||||||
private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6;
|
private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6;
|
||||||
|
private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d;
|
||||||
private LSL_Api m_lslApi;
|
private LSL_Api m_lslApi;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
|
@ -164,5 +165,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail");
|
Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail");
|
||||||
Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail");
|
Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
// llVecNorm test.
|
||||||
|
public void TestllVecNorm()
|
||||||
|
{
|
||||||
|
// Check special case for normalizing zero vector.
|
||||||
|
CheckllVecNorm(new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), new LSL_Types.Vector3(0.0d, 0.0d, 0.0d));
|
||||||
|
// Check various vectors.
|
||||||
|
CheckllVecNorm(new LSL_Types.Vector3(10.0d, 25.0d, 0.0d), new LSL_Types.Vector3(0.371391d, 0.928477d, 0.0d));
|
||||||
|
CheckllVecNorm(new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), new LSL_Types.Vector3(1.0d, 0.0d, 0.0d));
|
||||||
|
CheckllVecNorm(new LSL_Types.Vector3(-90.0d, 55.0d, 2.0d), new LSL_Types.Vector3(-0.853128d, 0.521356d, 0.018958d));
|
||||||
|
CheckllVecNorm(new LSL_Types.Vector3(255.0d, 255.0d, 255.0d), new LSL_Types.Vector3(0.577350d, 0.577350d, 0.577350d));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CheckllVecNorm(LSL_Types.Vector3 vec, LSL_Types.Vector3 vecNormCheck)
|
||||||
|
{
|
||||||
|
// Call LSL function to normalize the vector.
|
||||||
|
LSL_Types.Vector3 vecNorm = m_lslApi.llVecNorm(vec);
|
||||||
|
// Check each vector component against expected result.
|
||||||
|
Assert.AreEqual(vecNorm.x, vecNormCheck.x, VECTOR_COMPONENT_ACCURACY, "TestllVecNorm vector check fail on x component");
|
||||||
|
Assert.AreEqual(vecNorm.y, vecNormCheck.y, VECTOR_COMPONENT_ACCURACY, "TestllVecNorm vector check fail on y component");
|
||||||
|
Assert.AreEqual(vecNorm.z, vecNormCheck.z, VECTOR_COMPONENT_ACCURACY, "TestllVecNorm vector check fail on z component");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,12 +53,15 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
String.Empty);
|
String.Empty);
|
||||||
|
|
||||||
if (assetService == String.Empty)
|
if (assetService == String.Empty)
|
||||||
throw new Exception("No AssetService in config file");
|
throw new Exception("No LocalServiceModule in config file");
|
||||||
|
|
||||||
Object[] args = new Object[] { config };
|
Object[] args = new Object[] { config };
|
||||||
m_AssetService =
|
m_AssetService =
|
||||||
ServerUtils.LoadPlugin<IAssetService>(assetService, args);
|
ServerUtils.LoadPlugin<IAssetService>(assetService, args);
|
||||||
|
|
||||||
|
if (m_AssetService == null)
|
||||||
|
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
|
||||||
|
|
||||||
bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false);
|
bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false);
|
||||||
|
|
||||||
server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));
|
server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));
|
||||||
|
|
|
@ -124,6 +124,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||||
UUID uuid = UUID.Zero;
|
UUID uuid = UUID.Zero;
|
||||||
string regionname = string.Empty;
|
string regionname = string.Empty;
|
||||||
string gatekeeper_host = string.Empty;
|
string gatekeeper_host = string.Empty;
|
||||||
|
string gatekeeper_serveruri = string.Empty;
|
||||||
|
string destination_serveruri = string.Empty;
|
||||||
int gatekeeper_port = 0;
|
int gatekeeper_port = 0;
|
||||||
IPEndPoint client_ipaddress = null;
|
IPEndPoint client_ipaddress = null;
|
||||||
|
|
||||||
|
@ -131,8 +133,13 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||||
gatekeeper_host = args["gatekeeper_host"].AsString();
|
gatekeeper_host = args["gatekeeper_host"].AsString();
|
||||||
if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null)
|
if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null)
|
||||||
Int32.TryParse(args["gatekeeper_port"].AsString(), out gatekeeper_port);
|
Int32.TryParse(args["gatekeeper_port"].AsString(), out gatekeeper_port);
|
||||||
|
if (args.ContainsKey("gatekeeper_serveruri") && args["gatekeeper_serveruri"] !=null)
|
||||||
|
gatekeeper_serveruri = args["gatekeeper_serveruri"];
|
||||||
|
if (args.ContainsKey("destination_serveruri") && args["destination_serveruri"] !=null)
|
||||||
|
destination_serveruri = args["destination_serveruri"];
|
||||||
|
|
||||||
GridRegion gatekeeper = new GridRegion();
|
GridRegion gatekeeper = new GridRegion();
|
||||||
|
gatekeeper.ServerURI = gatekeeper_serveruri;
|
||||||
gatekeeper.ExternalHostName = gatekeeper_host;
|
gatekeeper.ExternalHostName = gatekeeper_host;
|
||||||
gatekeeper.HttpPort = (uint)gatekeeper_port;
|
gatekeeper.HttpPort = (uint)gatekeeper_port;
|
||||||
gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
|
gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
|
||||||
|
@ -173,6 +180,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||||
destination.RegionLocX = x;
|
destination.RegionLocX = x;
|
||||||
destination.RegionLocY = y;
|
destination.RegionLocY = y;
|
||||||
destination.RegionName = regionname;
|
destination.RegionName = regionname;
|
||||||
|
destination.ServerURI = destination_serveruri;
|
||||||
|
|
||||||
AgentCircuitData aCircuit = new AgentCircuitData();
|
AgentCircuitData aCircuit = new AgentCircuitData();
|
||||||
try
|
try
|
||||||
|
|
|
@ -153,7 +153,7 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Debug("[XINVENTORY HANDLER]: Exception {0}", e);
|
m_log.DebugFormat("[XINVENTORY HANDLER]: Exception {0}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
@ -604,6 +604,10 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
ret["CreatorId"] = item.CreatorId.ToString();
|
ret["CreatorId"] = item.CreatorId.ToString();
|
||||||
else
|
else
|
||||||
ret["CreatorId"] = String.Empty;
|
ret["CreatorId"] = String.Empty;
|
||||||
|
if (item.CreatorData != null)
|
||||||
|
ret["CreatorData"] = item.CreatorData;
|
||||||
|
else
|
||||||
|
ret["CreatorData"] = String.Empty;
|
||||||
ret["CurrentPermissions"] = item.CurrentPermissions.ToString();
|
ret["CurrentPermissions"] = item.CurrentPermissions.ToString();
|
||||||
ret["Description"] = item.Description.ToString();
|
ret["Description"] = item.Description.ToString();
|
||||||
ret["EveryOnePermissions"] = item.EveryOnePermissions.ToString();
|
ret["EveryOnePermissions"] = item.EveryOnePermissions.ToString();
|
||||||
|
|
|
@ -110,6 +110,11 @@ namespace OpenSim.Server.Handlers.Simulation
|
||||||
DoAgentDelete(request, responsedata, agentID, action, regionID);
|
DoAgentDelete(request, responsedata, agentID, action, regionID);
|
||||||
return responsedata;
|
return responsedata;
|
||||||
}
|
}
|
||||||
|
else if (method.Equals("QUERYACCESSS"))
|
||||||
|
{
|
||||||
|
DoQueryAccess(request, responsedata, agentID, regionID);
|
||||||
|
return responsedata;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method);
|
m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method);
|
||||||
|
@ -300,6 +305,27 @@ namespace OpenSim.Server.Handlers.Simulation
|
||||||
return m_SimulationService.UpdateAgent(destination, agent);
|
return m_SimulationService.UpdateAgent(destination, agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
|
||||||
|
{
|
||||||
|
if (m_SimulationService == null)
|
||||||
|
{
|
||||||
|
m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless.");
|
||||||
|
responsedata["content_type"] = "application/json";
|
||||||
|
responsedata["int_response_code"] = HttpStatusCode.NotImplemented;
|
||||||
|
responsedata["str_response_string"] = string.Empty;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GridRegion destination = new GridRegion();
|
||||||
|
destination.RegionID = regionID;
|
||||||
|
|
||||||
|
bool result = m_SimulationService.QueryAccess(destination, id);
|
||||||
|
|
||||||
|
responsedata["int_response_code"] = HttpStatusCode.OK;
|
||||||
|
responsedata["str_response_string"] = result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
|
protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
|
||||||
{
|
{
|
||||||
if (m_SimulationService == null)
|
if (m_SimulationService == null)
|
||||||
|
|
|
@ -84,32 +84,43 @@ namespace OpenSim.Server.Handlers.Simulation
|
||||||
return responsedata;
|
return responsedata;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next, let's parse the verb
|
try
|
||||||
string method = (string)request["http-method"];
|
|
||||||
if (method.Equals("POST"))
|
|
||||||
{
|
{
|
||||||
DoObjectPost(request, responsedata, regionID);
|
// Next, let's parse the verb
|
||||||
return responsedata;
|
string method = (string)request["http-method"];
|
||||||
|
if (method.Equals("POST"))
|
||||||
|
{
|
||||||
|
DoObjectPost(request, responsedata, regionID);
|
||||||
|
return responsedata;
|
||||||
|
}
|
||||||
|
else if (method.Equals("PUT"))
|
||||||
|
{
|
||||||
|
DoObjectPut(request, responsedata, regionID);
|
||||||
|
return responsedata;
|
||||||
|
}
|
||||||
|
//else if (method.Equals("DELETE"))
|
||||||
|
//{
|
||||||
|
// DoObjectDelete(request, responsedata, agentID, action, regionHandle);
|
||||||
|
// return responsedata;
|
||||||
|
//}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[OBJECT HANDLER]: method {0} not supported in object message", method);
|
||||||
|
responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed;
|
||||||
|
responsedata["str_response_string"] = "Method not allowed";
|
||||||
|
|
||||||
|
return responsedata;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (method.Equals("PUT"))
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
DoObjectPut(request, responsedata, regionID);
|
m_log.WarnFormat("[OBJECT HANDLER]: Caught exception {0}", e.StackTrace);
|
||||||
return responsedata;
|
responsedata["int_response_code"] = HttpStatusCode.InternalServerError;
|
||||||
}
|
responsedata["str_response_string"] = "Internal server error";
|
||||||
//else if (method.Equals("DELETE"))
|
|
||||||
//{
|
|
||||||
// DoObjectDelete(request, responsedata, agentID, action, regionHandle);
|
|
||||||
// return responsedata;
|
|
||||||
//}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.InfoFormat("[OBJECT HANDLER]: method {0} not supported in object message", method);
|
|
||||||
responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed;
|
|
||||||
responsedata["str_response_string"] = "Mthod not allowed";
|
|
||||||
|
|
||||||
return responsedata;
|
return responsedata;
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void DoObjectPost(Hashtable request, Hashtable responsedata, UUID regionID)
|
protected void DoObjectPost(Hashtable request, Hashtable responsedata, UUID regionID)
|
||||||
|
|
|
@ -43,44 +43,51 @@ namespace OpenSim.Services.AssetService
|
||||||
LogManager.GetLogger(
|
LogManager.GetLogger(
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
protected static AssetService m_RootInstance;
|
||||||
|
|
||||||
public AssetService(IConfigSource config) : base(config)
|
public AssetService(IConfigSource config) : base(config)
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Commands.AddCommand("kfs", false,
|
if (m_RootInstance == null)
|
||||||
"show digest",
|
|
||||||
"show digest <ID>",
|
|
||||||
"Show asset digest", HandleShowDigest);
|
|
||||||
|
|
||||||
MainConsole.Instance.Commands.AddCommand("kfs", false,
|
|
||||||
"delete asset",
|
|
||||||
"delete asset <ID>",
|
|
||||||
"Delete asset from database", HandleDeleteAsset);
|
|
||||||
|
|
||||||
if (m_AssetLoader != null)
|
|
||||||
{
|
{
|
||||||
IConfig assetConfig = config.Configs["AssetService"];
|
m_RootInstance = this;
|
||||||
if (assetConfig == null)
|
|
||||||
throw new Exception("No AssetService configuration");
|
|
||||||
|
|
||||||
string loaderArgs = assetConfig.GetString("AssetLoaderArgs",
|
MainConsole.Instance.Commands.AddCommand("kfs", false,
|
||||||
String.Empty);
|
"show digest",
|
||||||
|
"show digest <ID>",
|
||||||
|
"Show asset digest", HandleShowDigest);
|
||||||
|
|
||||||
bool assetLoaderEnabled = assetConfig.GetBoolean("AssetLoaderEnabled", true);
|
MainConsole.Instance.Commands.AddCommand("kfs", false,
|
||||||
|
"delete asset",
|
||||||
|
"delete asset <ID>",
|
||||||
|
"Delete asset from database", HandleDeleteAsset);
|
||||||
|
|
||||||
if (assetLoaderEnabled)
|
if (m_AssetLoader != null)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[ASSET]: Loading default asset set from {0}", loaderArgs);
|
IConfig assetConfig = config.Configs["AssetService"];
|
||||||
m_AssetLoader.ForEachDefaultXmlAsset(loaderArgs,
|
if (assetConfig == null)
|
||||||
delegate(AssetBase a)
|
throw new Exception("No AssetService configuration");
|
||||||
{
|
|
||||||
Store(a);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.Info("[ASSET SERVICE]: Local asset service enabled");
|
string loaderArgs = assetConfig.GetString("AssetLoaderArgs",
|
||||||
|
String.Empty);
|
||||||
|
|
||||||
|
bool assetLoaderEnabled = assetConfig.GetBoolean("AssetLoaderEnabled", true);
|
||||||
|
|
||||||
|
if (assetLoaderEnabled)
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[ASSET]: Loading default asset set from {0}", loaderArgs);
|
||||||
|
m_AssetLoader.ForEachDefaultXmlAsset(loaderArgs,
|
||||||
|
delegate(AssetBase a)
|
||||||
|
{
|
||||||
|
Store(a);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.Info("[ASSET SERVICE]: Local asset service enabled");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AssetBase Get(string id)
|
public virtual AssetBase Get(string id)
|
||||||
{
|
{
|
||||||
UUID assetID;
|
UUID assetID;
|
||||||
|
|
||||||
|
@ -93,12 +100,12 @@ namespace OpenSim.Services.AssetService
|
||||||
return m_Database.GetAsset(assetID);
|
return m_Database.GetAsset(assetID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AssetBase GetCached(string id)
|
public virtual AssetBase GetCached(string id)
|
||||||
{
|
{
|
||||||
return Get(id);
|
return Get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AssetMetadata GetMetadata(string id)
|
public virtual AssetMetadata GetMetadata(string id)
|
||||||
{
|
{
|
||||||
UUID assetID;
|
UUID assetID;
|
||||||
|
|
||||||
|
@ -112,7 +119,7 @@ namespace OpenSim.Services.AssetService
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] GetData(string id)
|
public virtual byte[] GetData(string id)
|
||||||
{
|
{
|
||||||
UUID assetID;
|
UUID assetID;
|
||||||
|
|
||||||
|
@ -123,7 +130,7 @@ namespace OpenSim.Services.AssetService
|
||||||
return asset.Data;
|
return asset.Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Get(string id, Object sender, AssetRetrieved handler)
|
public virtual bool Get(string id, Object sender, AssetRetrieved handler)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[AssetService]: Get asset async {0}", id);
|
//m_log.DebugFormat("[AssetService]: Get asset async {0}", id);
|
||||||
|
|
||||||
|
@ -141,7 +148,7 @@ namespace OpenSim.Services.AssetService
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Store(AssetBase asset)
|
public virtual string Store(AssetBase asset)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID);
|
//m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID);
|
||||||
m_Database.StoreAsset(asset);
|
m_Database.StoreAsset(asset);
|
||||||
|
@ -154,7 +161,7 @@ namespace OpenSim.Services.AssetService
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Delete(string id)
|
public virtual bool Delete(string id)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[ASSET SERVICE]: Deleting asset {0}", id);
|
m_log.DebugFormat("[ASSET SERVICE]: Deleting asset {0}", id);
|
||||||
UUID assetID;
|
UUID assetID;
|
||||||
|
|
|
@ -63,12 +63,12 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
|
|
||||||
protected override string AgentPath()
|
protected override string AgentPath()
|
||||||
{
|
{
|
||||||
return "/foreignagent/";
|
return "foreignagent/";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string ObjectPath()
|
protected override string ObjectPath()
|
||||||
{
|
{
|
||||||
return "/foreignobject/";
|
return "foreignobject/";
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason)
|
public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason)
|
||||||
|
@ -86,12 +86,11 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
paramList.Add(hash);
|
paramList.Add(hash);
|
||||||
|
|
||||||
XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
|
XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
|
||||||
string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/");
|
m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + info.ServerURI);
|
||||||
m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
|
|
||||||
XmlRpcResponse response = null;
|
XmlRpcResponse response = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
response = request.Send(uri, 10000);
|
response = request.Send(info.ServerURI, 10000);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -117,16 +116,20 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
UUID.TryParse((string)hash["uuid"], out regionID);
|
UUID.TryParse((string)hash["uuid"], out regionID);
|
||||||
//m_log.Debug(">> HERE, uuid: " + uuid);
|
//m_log.Debug(">> HERE, uuid: " + regionID);
|
||||||
if ((string)hash["handle"] != null)
|
if ((string)hash["handle"] != null)
|
||||||
{
|
{
|
||||||
realHandle = Convert.ToUInt64((string)hash["handle"]);
|
realHandle = Convert.ToUInt64((string)hash["handle"]);
|
||||||
//m_log.Debug(">> HERE, realHandle: " + realHandle);
|
//m_log.Debug(">> HERE, realHandle: " + realHandle);
|
||||||
}
|
}
|
||||||
if (hash["region_image"] != null)
|
if (hash["region_image"] != null) {
|
||||||
imageURL = (string)hash["region_image"];
|
imageURL = (string)hash["region_image"];
|
||||||
if (hash["external_name"] != null)
|
//m_log.Debug(">> HERE, imageURL: " + imageURL);
|
||||||
|
}
|
||||||
|
if (hash["external_name"] != null) {
|
||||||
externalName = (string)hash["external_name"];
|
externalName = (string)hash["external_name"];
|
||||||
|
//m_log.Debug(">> HERE, externalName: " + externalName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -188,12 +191,11 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
paramList.Add(hash);
|
paramList.Add(hash);
|
||||||
|
|
||||||
XmlRpcRequest request = new XmlRpcRequest("get_region", paramList);
|
XmlRpcRequest request = new XmlRpcRequest("get_region", paramList);
|
||||||
string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/");
|
m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI);
|
||||||
m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri);
|
|
||||||
XmlRpcResponse response = null;
|
XmlRpcResponse response = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
response = request.Send(uri, 10000);
|
response = request.Send(gatekeeper.ServerURI, 10000);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -236,21 +238,31 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
if (hash["region_name"] != null)
|
if (hash["region_name"] != null)
|
||||||
{
|
{
|
||||||
region.RegionName = (string)hash["region_name"];
|
region.RegionName = (string)hash["region_name"];
|
||||||
//m_log.Debug(">> HERE, name: " + region.RegionName);
|
//m_log.Debug(">> HERE, region_name: " + region.RegionName);
|
||||||
}
|
}
|
||||||
if (hash["hostname"] != null)
|
if (hash["hostname"] != null) {
|
||||||
region.ExternalHostName = (string)hash["hostname"];
|
region.ExternalHostName = (string)hash["hostname"];
|
||||||
|
//m_log.Debug(">> HERE, hostname: " + region.ExternalHostName);
|
||||||
|
}
|
||||||
if (hash["http_port"] != null)
|
if (hash["http_port"] != null)
|
||||||
{
|
{
|
||||||
uint p = 0;
|
uint p = 0;
|
||||||
UInt32.TryParse((string)hash["http_port"], out p);
|
UInt32.TryParse((string)hash["http_port"], out p);
|
||||||
region.HttpPort = p;
|
region.HttpPort = p;
|
||||||
|
//m_log.Debug(">> HERE, http_port: " + region.HttpPort);
|
||||||
}
|
}
|
||||||
if (hash["internal_port"] != null)
|
if (hash["internal_port"] != null)
|
||||||
{
|
{
|
||||||
int p = 0;
|
int p = 0;
|
||||||
Int32.TryParse((string)hash["internal_port"], out p);
|
Int32.TryParse((string)hash["internal_port"], out p);
|
||||||
region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p);
|
region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p);
|
||||||
|
//m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hash["server_uri"] != null)
|
||||||
|
{
|
||||||
|
region.ServerURI = (string) hash["server_uri"];
|
||||||
|
//m_log.Debug(">> HERE, server_uri: " + region.ServerURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Successful return
|
// Successful return
|
||||||
|
|
|
@ -232,12 +232,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message);
|
m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message);
|
||||||
}
|
}
|
||||||
// Add the input arguments
|
// Add the input arguments
|
||||||
|
args["gatekeeper_serveruri"] = OSD.FromString(gatekeeper.ServerURI);
|
||||||
args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName);
|
args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName);
|
||||||
args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString());
|
args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString());
|
||||||
args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
|
args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
|
||||||
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
|
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
|
||||||
args["destination_name"] = OSD.FromString(destination.RegionName);
|
args["destination_name"] = OSD.FromString(destination.RegionName);
|
||||||
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
|
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
|
||||||
|
args["destination_serveruri"] = OSD.FromString(destination.ServerURI);
|
||||||
|
|
||||||
// 10/3/2010
|
// 10/3/2010
|
||||||
// I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here.
|
// I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here.
|
||||||
|
|
|
@ -84,8 +84,7 @@ namespace OpenSim.Services.Connectors
|
||||||
if (info != null) // just to be sure
|
if (info != null) // just to be sure
|
||||||
{
|
{
|
||||||
XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
|
XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
|
||||||
string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
|
XmlRpcResponse response = request.Send(info.ServerURI, 10000);
|
||||||
XmlRpcResponse response = request.Send(uri, 10000);
|
|
||||||
if (response.IsFault)
|
if (response.IsFault)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString);
|
m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString);
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace OpenSim.Services.Connectors
|
||||||
|
|
||||||
public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion)
|
public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion)
|
||||||
{
|
{
|
||||||
string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/";
|
string uri = region.ServerURI + "/region/" + thisRegion.RegionID + "/";
|
||||||
//m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri);
|
//m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri);
|
||||||
|
|
||||||
WebRequest HelloNeighbourRequest = WebRequest.Create(uri);
|
WebRequest HelloNeighbourRequest = WebRequest.Create(uri);
|
||||||
|
|
|
@ -145,8 +145,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
|
Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
|
||||||
Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0);
|
Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0);
|
||||||
|
|
||||||
string httpAddress = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/";
|
|
||||||
|
|
||||||
OSDMap extraData = new OSDMap
|
OSDMap extraData = new OSDMap
|
||||||
{
|
{
|
||||||
{ "ServerURI", OSD.FromString(regionInfo.ServerURI) },
|
{ "ServerURI", OSD.FromString(regionInfo.ServerURI) },
|
||||||
|
@ -168,7 +166,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "Name", regionInfo.RegionName },
|
{ "Name", regionInfo.RegionName },
|
||||||
{ "MinPosition", minPosition.ToString() },
|
{ "MinPosition", minPosition.ToString() },
|
||||||
{ "MaxPosition", maxPosition.ToString() },
|
{ "MaxPosition", maxPosition.ToString() },
|
||||||
{ "Address", httpAddress },
|
{ "Address", regionInfo.ServerURI },
|
||||||
{ "Enabled", "1" },
|
{ "Enabled", "1" },
|
||||||
{ "ExtraData", OSDParser.SerializeJsonString(extraData) }
|
{ "ExtraData", OSDParser.SerializeJsonString(extraData) }
|
||||||
};
|
};
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
||||||
|
|
||||||
protected virtual string AgentPath()
|
protected virtual string AgentPath()
|
||||||
{
|
{
|
||||||
return "/agent/";
|
return "agent/";
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
|
public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
|
||||||
|
@ -104,26 +104,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
string uri = string.Empty;
|
string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
|
||||||
|
|
||||||
// HACK -- Simian grid make it work!!!
|
|
||||||
if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:"))
|
|
||||||
uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
|
|
||||||
else
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/";
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.Error("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message);
|
|
||||||
reason = e.Message;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri);
|
|
||||||
|
|
||||||
AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri);
|
AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri);
|
||||||
AgentCreateRequest.Method = "POST";
|
AgentCreateRequest.Method = "POST";
|
||||||
|
@ -277,17 +258,8 @@ namespace OpenSim.Services.Connectors.Simulation
|
||||||
private bool UpdateAgent(GridRegion destination, IAgentData cAgentData)
|
private bool UpdateAgent(GridRegion destination, IAgentData cAgentData)
|
||||||
{
|
{
|
||||||
// Eventually, we want to use a caps url instead of the agentID
|
// Eventually, we want to use a caps url instead of the agentID
|
||||||
string uri = string.Empty;
|
|
||||||
try
|
string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/";
|
||||||
{
|
|
||||||
uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/";
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.Warn("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri);
|
|
||||||
|
|
||||||
HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri);
|
HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri);
|
||||||
ChildUpdateRequest.Method = "PUT";
|
ChildUpdateRequest.Method = "PUT";
|
||||||
|
@ -385,8 +357,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
||||||
{
|
{
|
||||||
agent = null;
|
agent = null;
|
||||||
// Eventually, we want to use a caps url instead of the agentID
|
// Eventually, we want to use a caps url instead of the agentID
|
||||||
string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
|
string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
|
||||||
//Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri);
|
|
||||||
|
|
||||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
|
||||||
request.Method = "GET";
|
request.Method = "GET";
|
||||||
|
@ -407,7 +378,6 @@ namespace OpenSim.Services.Connectors.Simulation
|
||||||
sr = new StreamReader(webResponse.GetResponseStream());
|
sr = new StreamReader(webResponse.GetResponseStream());
|
||||||
reply = sr.ReadToEnd().Trim();
|
reply = sr.ReadToEnd().Trim();
|
||||||
|
|
||||||
//Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (WebException ex)
|
catch (WebException ex)
|
||||||
|
@ -428,7 +398,6 @@ namespace OpenSim.Services.Connectors.Simulation
|
||||||
OSDMap args = Util.GetOSDMap(reply);
|
OSDMap args = Util.GetOSDMap(reply);
|
||||||
if (args == null)
|
if (args == null)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,7 +406,65 @@ namespace OpenSim.Services.Connectors.Simulation
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode);
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool QueryAccess(GridRegion destination, UUID id)
|
||||||
|
{
|
||||||
|
IPEndPoint ext = destination.ExternalEndPoint;
|
||||||
|
if (ext == null) return false;
|
||||||
|
// Eventually, we want to use a caps url instead of the agentID
|
||||||
|
string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
|
||||||
|
|
||||||
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
|
||||||
|
request.Method = "QUERYACCESS";
|
||||||
|
request.Timeout = 10000;
|
||||||
|
//request.Headers.Add("authorization", ""); // coming soon
|
||||||
|
|
||||||
|
HttpWebResponse webResponse = null;
|
||||||
|
string reply = string.Empty;
|
||||||
|
StreamReader sr = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
webResponse = (HttpWebResponse)request.GetResponse();
|
||||||
|
if (webResponse == null)
|
||||||
|
{
|
||||||
|
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on agent query ");
|
||||||
|
}
|
||||||
|
|
||||||
|
sr = new StreamReader(webResponse.GetResponseStream());
|
||||||
|
reply = sr.ReadToEnd().Trim();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (WebException ex)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent query {0}", ex.Message);
|
||||||
|
// ignore, really
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (sr != null)
|
||||||
|
sr.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (webResponse.StatusCode == HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool result;
|
||||||
|
|
||||||
|
result = bool.Parse(reply);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,18 +506,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
||||||
|
|
||||||
public bool CloseAgent(GridRegion destination, UUID id)
|
public bool CloseAgent(GridRegion destination, UUID id)
|
||||||
{
|
{
|
||||||
string uri = string.Empty;
|
string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
|
||||||
try
|
|
||||||
{
|
|
||||||
uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.Warn("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri);
|
|
||||||
|
|
||||||
WebRequest request = WebRequest.Create(uri);
|
WebRequest request = WebRequest.Create(uri);
|
||||||
request.Method = "DELETE";
|
request.Method = "DELETE";
|
||||||
|
@ -532,13 +548,13 @@ namespace OpenSim.Services.Connectors.Simulation
|
||||||
|
|
||||||
protected virtual string ObjectPath()
|
protected virtual string ObjectPath()
|
||||||
{
|
{
|
||||||
return "/object/";
|
return "object/";
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
|
public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
|
||||||
{
|
{
|
||||||
string uri
|
string uri
|
||||||
= "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/";
|
= destination.ServerURI + ObjectPath() + sog.UUID + "/";
|
||||||
//m_log.Debug(" >>> DoCreateObjectCall <<< " + uri);
|
//m_log.Debug(" >>> DoCreateObjectCall <<< " + uri);
|
||||||
|
|
||||||
WebRequest ObjectCreateRequest = WebRequest.Create(uri);
|
WebRequest ObjectCreateRequest = WebRequest.Create(uri);
|
||||||
|
|
|
@ -479,7 +479,7 @@ namespace OpenSim.Services.GridService
|
||||||
OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
|
OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
|
||||||
MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n",
|
MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n",
|
||||||
r.RegionName, r.RegionID,
|
r.RegionName, r.RegionID,
|
||||||
String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(),
|
String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"],
|
||||||
r.Data["owner_uuid"].ToString(), flags.ToString()));
|
r.Data["owner_uuid"].ToString(), flags.ToString()));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -128,14 +128,17 @@ namespace OpenSim.Services.GridService
|
||||||
if (MainConsole.Instance != null)
|
if (MainConsole.Instance != null)
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
|
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
|
||||||
"link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
|
"link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]",
|
||||||
"Link a hypergrid region", RunCommand);
|
"Link a HyperGrid Region", RunCommand);
|
||||||
|
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
|
||||||
|
"link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]",
|
||||||
|
"Link a hypergrid region (deprecated)", RunCommand);
|
||||||
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
|
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
|
||||||
"unlink-region <local name> or <HostName>:<HttpPort> <cr>",
|
"unlink-region <local name>",
|
||||||
"Unlink a hypergrid region", RunCommand);
|
"Unlink a hypergrid region", RunCommand);
|
||||||
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
|
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>]",
|
||||||
"Set local coordinate to map HG regions to", RunCommand);
|
"Set local coordinate to map HG regions to", RunCommand);
|
||||||
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks <cr>",
|
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks",
|
||||||
"List the HG regions", HandleShow);
|
"List the HG regions", HandleShow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,29 +208,38 @@ namespace OpenSim.Services.GridService
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, UUID ownerID, out GridRegion regInfo, out string reason)
|
||||||
// From the command line and the 2 above
|
|
||||||
public bool TryCreateLink(UUID scopeID, int xloc, int yloc,
|
|
||||||
string externalRegionName, uint externalPort, string externalHostName, UUID ownerID,
|
|
||||||
out GridRegion regInfo, out string reason)
|
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc);
|
return TryCreateLink(scopeID, xloc, yloc, remoteRegionName, externalPort, externalHostName, null, ownerID, out regInfo, out reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}",
|
||||||
|
((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
|
||||||
|
remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
|
||||||
|
|
||||||
reason = string.Empty;
|
reason = string.Empty;
|
||||||
regInfo = new GridRegion();
|
regInfo = new GridRegion();
|
||||||
regInfo.RegionName = externalRegionName;
|
if ( externalPort > 0)
|
||||||
regInfo.HttpPort = externalPort;
|
regInfo.HttpPort = externalPort;
|
||||||
regInfo.ExternalHostName = externalHostName;
|
else
|
||||||
|
regInfo.HttpPort = 0;
|
||||||
|
if ( externalHostName != null)
|
||||||
|
regInfo.ExternalHostName = externalHostName;
|
||||||
|
else
|
||||||
|
regInfo.ExternalHostName = "0.0.0.0";
|
||||||
|
if ( serverURI != null)
|
||||||
|
regInfo.ServerURI = serverURI;
|
||||||
|
|
||||||
|
if ( remoteRegionName != string.Empty )
|
||||||
|
regInfo.RegionName = remoteRegionName;
|
||||||
|
|
||||||
regInfo.RegionLocX = xloc;
|
regInfo.RegionLocX = xloc;
|
||||||
regInfo.RegionLocY = yloc;
|
regInfo.RegionLocY = yloc;
|
||||||
regInfo.ScopeID = scopeID;
|
regInfo.ScopeID = scopeID;
|
||||||
regInfo.EstateOwner = ownerID;
|
regInfo.EstateOwner = ownerID;
|
||||||
|
|
||||||
// Big HACK for Simian Grid !!!
|
|
||||||
// We need to clean up all URLs used in OpenSim !!!
|
|
||||||
if (externalHostName.Contains("/"))
|
|
||||||
regInfo.ServerURI = externalHostName;
|
|
||||||
|
|
||||||
// Check for free coordinates
|
// Check for free coordinates
|
||||||
GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY);
|
GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY);
|
||||||
if (region != null)
|
if (region != null)
|
||||||
|
@ -267,8 +279,13 @@ namespace OpenSim.Services.GridService
|
||||||
}
|
}
|
||||||
|
|
||||||
regInfo.RegionID = regionID;
|
regInfo.RegionID = regionID;
|
||||||
if (regInfo.RegionName == string.Empty)
|
|
||||||
regInfo.RegionName = regInfo.ExternalHostName;
|
if ( externalName == string.Empty )
|
||||||
|
regInfo.RegionName = regInfo.ServerURI;
|
||||||
|
else
|
||||||
|
regInfo.RegionName = externalName;
|
||||||
|
|
||||||
|
m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName);
|
||||||
|
|
||||||
// Try get the map image
|
// Try get the map image
|
||||||
//regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL);
|
//regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL);
|
||||||
|
@ -316,13 +333,6 @@ namespace OpenSim.Services.GridService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//foreach (GridRegion r in m_HyperlinkRegions.Values)
|
|
||||||
//{
|
|
||||||
// m_log.DebugFormat("XXX Comparing {0}:{1} with {2}:{3}", host, port, r.ExternalHostName, r.HttpPort);
|
|
||||||
// if (host.Equals(r.ExternalHostName) && (port == r.HttpPort))
|
|
||||||
// regInfo = r;
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (regInfo != null)
|
if (regInfo != null)
|
||||||
{
|
{
|
||||||
RemoveHyperlinkRegion(regInfo.RegionID);
|
RemoveHyperlinkRegion(regInfo.RegionID);
|
||||||
|
@ -443,6 +453,21 @@ namespace OpenSim.Services.GridService
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RunLinkRegionCommand(string[] cmdparams)
|
||||||
|
{
|
||||||
|
int xloc, yloc;
|
||||||
|
string serverURI;
|
||||||
|
string remoteName = null;
|
||||||
|
xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize;
|
||||||
|
yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize;
|
||||||
|
serverURI = cmdparams[2];
|
||||||
|
if (cmdparams.Length == 4)
|
||||||
|
remoteName = cmdparams[3];
|
||||||
|
string reason = string.Empty;
|
||||||
|
GridRegion regInfo;
|
||||||
|
TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, UUID.Zero, out regInfo, out reason);
|
||||||
|
}
|
||||||
|
|
||||||
private void RunHGCommand(string command, string[] cmdparams)
|
private void RunHGCommand(string command, string[] cmdparams)
|
||||||
{
|
{
|
||||||
if (command.Equals("link-mapping"))
|
if (command.Equals("link-mapping"))
|
||||||
|
@ -464,6 +489,18 @@ namespace OpenSim.Services.GridService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (command.Equals("link-region"))
|
else if (command.Equals("link-region"))
|
||||||
|
{
|
||||||
|
if (cmdparams.Length > 0 && cmdparams.Length < 5)
|
||||||
|
{
|
||||||
|
RunLinkRegionCommand(cmdparams);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LinkRegionCmdUsage();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (command.Equals("link-region"))
|
||||||
{
|
{
|
||||||
if (cmdparams.Length < 3)
|
if (cmdparams.Length < 3)
|
||||||
{
|
{
|
||||||
|
@ -478,7 +515,11 @@ namespace OpenSim.Services.GridService
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmdparams[2].Contains(":"))
|
//this should be the prefererred way of setting up hg links now
|
||||||
|
if ( cmdparams[2].StartsWith("http") && ( cmdparams.Length >= 3 && cmdparams.Length <= 5 )) {
|
||||||
|
RunLinkRegionCommand(cmdparams);
|
||||||
|
}
|
||||||
|
else if (cmdparams[2].Contains(":"))
|
||||||
{
|
{
|
||||||
// New format
|
// New format
|
||||||
int xloc, yloc;
|
int xloc, yloc;
|
||||||
|
@ -517,12 +558,16 @@ namespace OpenSim.Services.GridService
|
||||||
int xloc, yloc;
|
int xloc, yloc;
|
||||||
uint externalPort;
|
uint externalPort;
|
||||||
string externalHostName;
|
string externalHostName;
|
||||||
|
string serverURI;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
xloc = Convert.ToInt32(cmdparams[0]);
|
xloc = Convert.ToInt32(cmdparams[0]);
|
||||||
yloc = Convert.ToInt32(cmdparams[1]);
|
yloc = Convert.ToInt32(cmdparams[1]);
|
||||||
externalPort = Convert.ToUInt32(cmdparams[3]);
|
externalPort = Convert.ToUInt32(cmdparams[3]);
|
||||||
externalHostName = cmdparams[2];
|
externalHostName = cmdparams[2];
|
||||||
|
if ( cmdparams.Length == 4 ) {
|
||||||
|
|
||||||
|
}
|
||||||
//internalPort = Convert.ToUInt32(cmdparams[4]);
|
//internalPort = Convert.ToUInt32(cmdparams[4]);
|
||||||
//remotingPort = Convert.ToUInt32(cmdparams[5]);
|
//remotingPort = Convert.ToUInt32(cmdparams[5]);
|
||||||
}
|
}
|
||||||
|
@ -537,7 +582,7 @@ namespace OpenSim.Services.GridService
|
||||||
xloc = xloc * (int)Constants.RegionSize;
|
xloc = xloc * (int)Constants.RegionSize;
|
||||||
yloc = yloc * (int)Constants.RegionSize;
|
yloc = yloc * (int)Constants.RegionSize;
|
||||||
string reason = string.Empty;
|
string reason = string.Empty;
|
||||||
if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
|
if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
|
||||||
{
|
{
|
||||||
if (cmdparams.Length >= 5)
|
if (cmdparams.Length >= 5)
|
||||||
{
|
{
|
||||||
|
@ -551,7 +596,7 @@ namespace OpenSim.Services.GridService
|
||||||
}
|
}
|
||||||
else if (command.Equals("unlink-region"))
|
else if (command.Equals("unlink-region"))
|
||||||
{
|
{
|
||||||
if (cmdparams.Length < 1)
|
if (cmdparams.Length < 1 || cmdparams.Length > 1)
|
||||||
{
|
{
|
||||||
UnlinkRegionCmdUsage();
|
UnlinkRegionCmdUsage();
|
||||||
return;
|
return;
|
||||||
|
@ -639,7 +684,7 @@ namespace OpenSim.Services.GridService
|
||||||
xloc = xloc * (int)Constants.RegionSize;
|
xloc = xloc * (int)Constants.RegionSize;
|
||||||
yloc = yloc * (int)Constants.RegionSize;
|
yloc = yloc * (int)Constants.RegionSize;
|
||||||
string reason = string.Empty;
|
string reason = string.Empty;
|
||||||
if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
|
if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
|
||||||
{
|
{
|
||||||
regInfo.RegionName = config.GetString("localName", "");
|
regInfo.RegionName = config.GetString("localName", "");
|
||||||
}
|
}
|
||||||
|
@ -651,14 +696,14 @@ namespace OpenSim.Services.GridService
|
||||||
|
|
||||||
private void LinkRegionCmdUsage()
|
private void LinkRegionCmdUsage()
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("Usage: link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]");
|
MainConsole.Instance.Output("Usage: link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]");
|
||||||
MainConsole.Instance.Output("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]");
|
MainConsole.Instance.Output("Usage (deprecated): link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]");
|
||||||
|
MainConsole.Instance.Output("Usage (deprecated): link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]");
|
||||||
MainConsole.Instance.Output("Usage: link-region <URI_of_xml> [<exclude>]");
|
MainConsole.Instance.Output("Usage: link-region <URI_of_xml> [<exclude>]");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UnlinkRegionCmdUsage()
|
private void UnlinkRegionCmdUsage()
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("Usage: unlink-region <HostName>:<HttpPort>");
|
|
||||||
MainConsole.Instance.Output("Usage: unlink-region <LocalName>");
|
MainConsole.Instance.Output("Usage: unlink-region <LocalName>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,8 @@ namespace OpenSim.Services.HypergridService
|
||||||
//m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
|
//m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
|
||||||
m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
|
m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
|
||||||
m_ExternalName = serverConfig.GetString("ExternalName", string.Empty);
|
m_ExternalName = serverConfig.GetString("ExternalName", string.Empty);
|
||||||
|
if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/"))
|
||||||
|
m_ExternalName = m_ExternalName + "/";
|
||||||
|
|
||||||
Object[] args = new Object[] { config };
|
Object[] args = new Object[] { config };
|
||||||
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
||||||
|
@ -118,7 +120,7 @@ namespace OpenSim.Services.HypergridService
|
||||||
{
|
{
|
||||||
regionID = UUID.Zero;
|
regionID = UUID.Zero;
|
||||||
regionHandle = 0;
|
regionHandle = 0;
|
||||||
externalName = m_ExternalName;
|
externalName = m_ExternalName + ((regionName != string.Empty) ? " " + regionName : "");
|
||||||
imageURL = string.Empty;
|
imageURL = string.Empty;
|
||||||
reason = string.Empty;
|
reason = string.Empty;
|
||||||
|
|
||||||
|
@ -157,7 +159,7 @@ namespace OpenSim.Services.HypergridService
|
||||||
string regionimage = "regionImage" + region.RegionID.ToString();
|
string regionimage = "regionImage" + region.RegionID.ToString();
|
||||||
regionimage = regionimage.Replace("-", "");
|
regionimage = regionimage.Replace("-", "");
|
||||||
|
|
||||||
imageURL = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/index.php?method=" + regionimage;
|
imageURL = region.ServerURI + "index.php?method=" + regionimage;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -333,7 +335,8 @@ namespace OpenSim.Services.HypergridService
|
||||||
|
|
||||||
string addressee = parts[0];
|
string addressee = parts[0];
|
||||||
m_log.DebugFormat("[GATEKEEPER SERVICE]: Verifying {0} against {1}", addressee, m_ExternalName);
|
m_log.DebugFormat("[GATEKEEPER SERVICE]: Verifying {0} against {1}", addressee, m_ExternalName);
|
||||||
return (addressee == m_ExternalName);
|
|
||||||
|
return string.Equals(addressee, m_ExternalName, StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -0,0 +1,145 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
using Nini.Config;
|
||||||
|
using log4net;
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Serialization.External;
|
||||||
|
using OpenSim.Server.Base;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenSim.Services.AssetService;
|
||||||
|
|
||||||
|
namespace OpenSim.Services.HypergridService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Hypergrid asset service. It serves the IAssetService interface,
|
||||||
|
/// but implements it in ways that are appropriate for inter-grid
|
||||||
|
/// asset exchanges.
|
||||||
|
/// </summary>
|
||||||
|
public class HGAssetService : OpenSim.Services.AssetService.AssetService, IAssetService
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log =
|
||||||
|
LogManager.GetLogger(
|
||||||
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private string m_ProfileServiceURL;
|
||||||
|
private IUserAccountService m_UserAccountService;
|
||||||
|
|
||||||
|
private UserAccountCache m_Cache;
|
||||||
|
|
||||||
|
public HGAssetService(IConfigSource config) : base(config)
|
||||||
|
{
|
||||||
|
m_log.Debug("[HGAsset Service]: Starting");
|
||||||
|
IConfig assetConfig = config.Configs["HGAssetService"];
|
||||||
|
if (assetConfig == null)
|
||||||
|
throw new Exception("No HGAssetService configuration");
|
||||||
|
|
||||||
|
string userAccountsDll = assetConfig.GetString("UserAccountsService", string.Empty);
|
||||||
|
if (userAccountsDll == string.Empty)
|
||||||
|
throw new Exception("Please specify UserAccountsService in HGAssetService configuration");
|
||||||
|
|
||||||
|
Object[] args = new Object[] { config };
|
||||||
|
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountsDll, args);
|
||||||
|
if (m_UserAccountService == null)
|
||||||
|
throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll));
|
||||||
|
|
||||||
|
m_ProfileServiceURL = assetConfig.GetString("ProfileServerURI", string.Empty);
|
||||||
|
|
||||||
|
m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IAssetService overrides
|
||||||
|
public override AssetBase Get(string id)
|
||||||
|
{
|
||||||
|
AssetBase asset = base.Get(id);
|
||||||
|
|
||||||
|
if (asset == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (asset.Metadata.Type == (sbyte)AssetType.Object)
|
||||||
|
asset.Data = AdjustIdentifiers(asset.Data); ;
|
||||||
|
|
||||||
|
AdjustIdentifiers(asset.Metadata);
|
||||||
|
|
||||||
|
return asset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override AssetMetadata GetMetadata(string id)
|
||||||
|
{
|
||||||
|
AssetMetadata meta = base.GetMetadata(id);
|
||||||
|
|
||||||
|
if (meta == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
AdjustIdentifiers(meta);
|
||||||
|
|
||||||
|
return meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override byte[] GetData(string id)
|
||||||
|
{
|
||||||
|
byte[] data = base.GetData(id);
|
||||||
|
|
||||||
|
if (data == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return AdjustIdentifiers(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
//public virtual bool Get(string id, Object sender, AssetRetrieved handler)
|
||||||
|
|
||||||
|
public override bool Delete(string id)
|
||||||
|
{
|
||||||
|
// NOGO
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
protected void AdjustIdentifiers(AssetMetadata meta)
|
||||||
|
{
|
||||||
|
UserAccount creator = m_Cache.GetUser(meta.CreatorID);
|
||||||
|
if (creator != null)
|
||||||
|
meta.CreatorID = m_ProfileServiceURL + "/" + meta.CreatorID + ";" + creator.FirstName + " " + creator.LastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected byte[] AdjustIdentifiers(byte[] data)
|
||||||
|
{
|
||||||
|
string xml = Utils.BytesToString(data);
|
||||||
|
return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, m_ProfileServiceURL, m_Cache, UUID.Zero));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -33,11 +33,20 @@ using Nini.Config;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using OpenSim.Services.Base;
|
using OpenSim.Services.Base;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenSim.Services.InventoryService;
|
||||||
using OpenSim.Data;
|
using OpenSim.Data;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Server.Base;
|
||||||
|
|
||||||
namespace OpenSim.Services.InventoryService
|
namespace OpenSim.Services.HypergridService
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Hypergrid inventory service. It serves the IInventoryService interface,
|
||||||
|
/// but implements it in ways that are appropriate for inter-grid
|
||||||
|
/// inventory exchanges. Specifically, it does not performs deletions
|
||||||
|
/// and it responds to GetRootFolder requests with the ID of the
|
||||||
|
/// Suitcase folder, not the actual "My Inventory" folder.
|
||||||
|
/// </summary>
|
||||||
public class HGInventoryService : XInventoryService, IInventoryService
|
public class HGInventoryService : XInventoryService, IInventoryService
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
|
@ -46,9 +55,16 @@ namespace OpenSim.Services.InventoryService
|
||||||
|
|
||||||
protected new IXInventoryData m_Database;
|
protected new IXInventoryData m_Database;
|
||||||
|
|
||||||
|
private string m_ProfileServiceURL;
|
||||||
|
private IUserAccountService m_UserAccountService;
|
||||||
|
|
||||||
|
private UserAccountCache m_Cache;
|
||||||
|
|
||||||
public HGInventoryService(IConfigSource config)
|
public HGInventoryService(IConfigSource config)
|
||||||
: base(config)
|
: base(config)
|
||||||
{
|
{
|
||||||
|
m_log.Debug("[HGInventory Service]: Starting");
|
||||||
|
|
||||||
string dllName = String.Empty;
|
string dllName = String.Empty;
|
||||||
string connString = String.Empty;
|
string connString = String.Empty;
|
||||||
//string realm = "Inventory"; // OSG version doesn't use this
|
//string realm = "Inventory"; // OSG version doesn't use this
|
||||||
|
@ -68,12 +84,25 @@ namespace OpenSim.Services.InventoryService
|
||||||
//
|
//
|
||||||
// Try reading the [InventoryService] section, if it exists
|
// Try reading the [InventoryService] section, if it exists
|
||||||
//
|
//
|
||||||
IConfig authConfig = config.Configs["InventoryService"];
|
IConfig invConfig = config.Configs["HGInventoryService"];
|
||||||
if (authConfig != null)
|
if (invConfig != null)
|
||||||
{
|
{
|
||||||
dllName = authConfig.GetString("StorageProvider", dllName);
|
dllName = invConfig.GetString("StorageProvider", dllName);
|
||||||
connString = authConfig.GetString("ConnectionString", connString);
|
connString = invConfig.GetString("ConnectionString", connString);
|
||||||
|
|
||||||
// realm = authConfig.GetString("Realm", realm);
|
// realm = authConfig.GetString("Realm", realm);
|
||||||
|
string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty);
|
||||||
|
if (userAccountsDll == string.Empty)
|
||||||
|
throw new Exception("Please specify UserAccountsService in HGInventoryService configuration");
|
||||||
|
|
||||||
|
Object[] args = new Object[] { config };
|
||||||
|
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountsDll, args);
|
||||||
|
if (m_UserAccountService == null)
|
||||||
|
throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll));
|
||||||
|
|
||||||
|
m_ProfileServiceURL = invConfig.GetString("ProfileServerURI", string.Empty);
|
||||||
|
|
||||||
|
m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -282,9 +311,18 @@ namespace OpenSim.Services.InventoryService
|
||||||
//{
|
//{
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//public InventoryItemBase GetItem(InventoryItemBase item)
|
public override InventoryItemBase GetItem(InventoryItemBase item)
|
||||||
//{
|
{
|
||||||
//}
|
InventoryItemBase it = base.GetItem(item);
|
||||||
|
|
||||||
|
UserAccount user = m_Cache.GetUser(it.CreatorId);
|
||||||
|
|
||||||
|
// Adjust the creator data
|
||||||
|
if (user != null && it != null && (it.CreatorData == null || it.CreatorData == string.Empty))
|
||||||
|
it.CreatorData = m_ProfileServiceURL + "/" + it.CreatorId + ";" + user.FirstName + " " + user.LastName;
|
||||||
|
|
||||||
|
return it;
|
||||||
|
}
|
||||||
|
|
||||||
//public InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
//public InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
||||||
//{
|
//{
|
|
@ -0,0 +1,105 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
|
namespace OpenSim.Services.HypergridService
|
||||||
|
{
|
||||||
|
public class UserAccountCache : IUserAccountService
|
||||||
|
{
|
||||||
|
private const double CACHE_EXPIRATION_SECONDS = 120000.0; // 33 hours!
|
||||||
|
|
||||||
|
private static readonly ILog m_log =
|
||||||
|
LogManager.GetLogger(
|
||||||
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
private ExpiringCache<UUID, UserAccount> m_UUIDCache;
|
||||||
|
|
||||||
|
private IUserAccountService m_UserAccountService;
|
||||||
|
|
||||||
|
private static UserAccountCache m_Singleton;
|
||||||
|
|
||||||
|
public static UserAccountCache CreateUserAccountCache(IUserAccountService u)
|
||||||
|
{
|
||||||
|
if (m_Singleton == null)
|
||||||
|
m_Singleton = new UserAccountCache(u);
|
||||||
|
|
||||||
|
return m_Singleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
private UserAccountCache(IUserAccountService u)
|
||||||
|
{
|
||||||
|
m_UUIDCache = new ExpiringCache<UUID, UserAccount>();
|
||||||
|
m_UserAccountService = u;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Cache(UUID userID, UserAccount account)
|
||||||
|
{
|
||||||
|
// Cache even null accounts
|
||||||
|
m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS);
|
||||||
|
|
||||||
|
//m_log.DebugFormat("[USER CACHE]: cached user {0}", userID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserAccount Get(UUID userID, out bool inCache)
|
||||||
|
{
|
||||||
|
UserAccount account = null;
|
||||||
|
inCache = false;
|
||||||
|
if (m_UUIDCache.TryGetValue(userID, out account))
|
||||||
|
{
|
||||||
|
//m_log.DebugFormat("[USER CACHE]: Account {0} {1} found in cache", account.FirstName, account.LastName);
|
||||||
|
inCache = true;
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserAccount GetUser(string id)
|
||||||
|
{
|
||||||
|
UUID uuid = UUID.Zero;
|
||||||
|
UUID.TryParse(id, out uuid);
|
||||||
|
bool inCache = false;
|
||||||
|
UserAccount account = Get(uuid, out inCache);
|
||||||
|
if (!inCache)
|
||||||
|
{
|
||||||
|
account = m_UserAccountService.GetUserAccount(UUID.Zero, uuid);
|
||||||
|
Cache(uuid, account);
|
||||||
|
}
|
||||||
|
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IUserAccountService
|
||||||
|
public UserAccount GetUserAccount(UUID scopeID, UUID userID)
|
||||||
|
{
|
||||||
|
return GetUser(userID.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserAccount GetUserAccount(UUID scopeID, string Email)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool StoreUserAccount(UserAccount data)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -101,6 +101,8 @@ namespace OpenSim.Services.HypergridService
|
||||||
serverConfig = config.Configs["GatekeeperService"];
|
serverConfig = config.Configs["GatekeeperService"];
|
||||||
m_GridName = serverConfig.GetString("ExternalName", string.Empty);
|
m_GridName = serverConfig.GetString("ExternalName", string.Empty);
|
||||||
}
|
}
|
||||||
|
if (!m_GridName.EndsWith("/"))
|
||||||
|
m_GridName = m_GridName + "/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,23 +136,27 @@ namespace OpenSim.Services.HypergridService
|
||||||
public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason)
|
public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
|
m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
|
||||||
agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()),
|
agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI);
|
||||||
gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort);
|
|
||||||
|
|
||||||
// Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
|
// Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
|
||||||
GridRegion region = new GridRegion(gatekeeper);
|
GridRegion region = new GridRegion(gatekeeper);
|
||||||
|
region.ServerURI = gatekeeper.ServerURI;
|
||||||
|
region.ExternalHostName = finalDestination.ExternalHostName;
|
||||||
|
region.InternalEndPoint = finalDestination.InternalEndPoint;
|
||||||
region.RegionName = finalDestination.RegionName;
|
region.RegionName = finalDestination.RegionName;
|
||||||
region.RegionID = finalDestination.RegionID;
|
region.RegionID = finalDestination.RegionID;
|
||||||
region.RegionLocX = finalDestination.RegionLocX;
|
region.RegionLocX = finalDestination.RegionLocX;
|
||||||
region.RegionLocY = finalDestination.RegionLocY;
|
region.RegionLocY = finalDestination.RegionLocY;
|
||||||
|
|
||||||
// Generate a new service session
|
// Generate a new service session
|
||||||
agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random();
|
agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random();
|
||||||
TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region);
|
TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region);
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
string myExternalIP = string.Empty;
|
string myExternalIP = string.Empty;
|
||||||
string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort;
|
string gridName = gatekeeper.ServerURI;
|
||||||
|
|
||||||
|
m_log.DebugFormat("[USER AGENT SERVICE]: m_grid - {0}, gn - {1}", m_GridName, gridName);
|
||||||
|
|
||||||
if (m_GridName == gridName)
|
if (m_GridName == gridName)
|
||||||
success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason);
|
success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason);
|
||||||
else
|
else
|
||||||
|
@ -159,7 +165,7 @@ namespace OpenSim.Services.HypergridService
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}",
|
m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}",
|
||||||
agentCircuit.firstname, agentCircuit.lastname, region.ExternalHostName + ":" + region.HttpPort, reason);
|
agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason);
|
||||||
|
|
||||||
// restore the old travel info
|
// restore the old travel info
|
||||||
lock (m_TravelingAgents)
|
lock (m_TravelingAgents)
|
||||||
|
@ -210,7 +216,7 @@ namespace OpenSim.Services.HypergridService
|
||||||
m_TravelingAgents[agentCircuit.SessionID] = travel;
|
m_TravelingAgents[agentCircuit.SessionID] = travel;
|
||||||
}
|
}
|
||||||
travel.UserID = agentCircuit.AgentID;
|
travel.UserID = agentCircuit.AgentID;
|
||||||
travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort;
|
travel.GridExternalName = region.ServerURI;
|
||||||
travel.ServiceToken = agentCircuit.ServiceSessionID;
|
travel.ServiceToken = agentCircuit.ServiceSessionID;
|
||||||
if (old != null)
|
if (old != null)
|
||||||
travel.ClientIPAddress = old.ClientIPAddress;
|
travel.ClientIPAddress = old.ClientIPAddress;
|
||||||
|
|
|
@ -115,8 +115,20 @@ namespace OpenSim.Services.Interfaces
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ServerURI
|
public string ServerURI
|
||||||
{
|
{
|
||||||
get { return m_serverURI; }
|
get {
|
||||||
set { m_serverURI = value; }
|
if ( m_serverURI != string.Empty ) {
|
||||||
|
return m_serverURI;
|
||||||
|
} else {
|
||||||
|
return "http://" + m_externalHostName + ":" + m_httpPort + "/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if ( value.EndsWith("/") ) {
|
||||||
|
m_serverURI = value;
|
||||||
|
} else {
|
||||||
|
m_serverURI = value + '/';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
protected string m_serverURI;
|
protected string m_serverURI;
|
||||||
|
|
||||||
|
@ -164,6 +176,7 @@ namespace OpenSim.Services.Interfaces
|
||||||
|
|
||||||
public GridRegion()
|
public GridRegion()
|
||||||
{
|
{
|
||||||
|
m_serverURI = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri)
|
public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri)
|
||||||
|
|
|
@ -60,6 +60,8 @@ namespace OpenSim.Services.Interfaces
|
||||||
|
|
||||||
bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent);
|
bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent);
|
||||||
|
|
||||||
|
bool QueryAccess(GridRegion destination, UUID id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Message from receiving region to departing region, telling it got contacted by the client.
|
/// Message from receiving region to departing region, telling it got contacted by the client.
|
||||||
/// When sent over REST, it invokes the opaque uri.
|
/// When sent over REST, it invokes the opaque uri.
|
||||||
|
|
|
@ -333,34 +333,7 @@ namespace OpenSim.Services.LLLoginService
|
||||||
|
|
||||||
private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient)
|
private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient)
|
||||||
{
|
{
|
||||||
string capsSeedPath = String.Empty;
|
SeedCapability = destination.ServerURI + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath);
|
||||||
|
|
||||||
// Don't use the following! It Fails for logging into any region not on the same port as the http server!
|
|
||||||
// Kept here so it doesn't happen again!
|
|
||||||
// response.SeedCapability = regionInfo.ServerURI + capsSeedPath;
|
|
||||||
|
|
||||||
#region IP Translation for NAT
|
|
||||||
if (ipepClient != null)
|
|
||||||
{
|
|
||||||
capsSeedPath
|
|
||||||
= "http://"
|
|
||||||
+ NetworkUtil.GetHostFor(ipepClient.Address, destination.ExternalHostName)
|
|
||||||
+ ":"
|
|
||||||
+ destination.HttpPort
|
|
||||||
+ CapsUtil.GetCapsSeedPath(aCircuit.CapsPath);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
capsSeedPath
|
|
||||||
= "http://"
|
|
||||||
+ destination.ExternalHostName
|
|
||||||
+ ":"
|
|
||||||
+ destination.HttpPort
|
|
||||||
+ CapsUtil.GetCapsSeedPath(aCircuit.CapsPath);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
SeedCapability = capsSeedPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetDefaultValues()
|
private void SetDefaultValues()
|
||||||
|
|
|
@ -586,6 +586,7 @@ namespace OpenSim.Services.LLLoginService
|
||||||
|
|
||||||
private GridRegion FindForeignRegion(string domainName, uint port, string regionName, out GridRegion gatekeeper)
|
private GridRegion FindForeignRegion(string domainName, uint port, string regionName, out GridRegion gatekeeper)
|
||||||
{
|
{
|
||||||
|
m_log.Debug("[LLLOGIN SERVICE]: attempting to findforeignregion " + domainName + ":" + port.ToString() + ":" + regionName);
|
||||||
gatekeeper = new GridRegion();
|
gatekeeper = new GridRegion();
|
||||||
gatekeeper.ExternalHostName = domainName;
|
gatekeeper.ExternalHostName = domainName;
|
||||||
gatekeeper.HttpPort = port;
|
gatekeeper.HttpPort = port;
|
||||||
|
@ -651,11 +652,9 @@ namespace OpenSim.Services.LLLoginService
|
||||||
gatekeeper = new GridRegion(destination);
|
gatekeeper = new GridRegion(destination);
|
||||||
gatekeeper.ExternalHostName = hostName;
|
gatekeeper.ExternalHostName = hostName;
|
||||||
gatekeeper.HttpPort = (uint)port;
|
gatekeeper.HttpPort = (uint)port;
|
||||||
|
gatekeeper.ServerURI = m_GatekeeperURL;
|
||||||
}
|
|
||||||
else // login to foreign grid
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
m_log.Debug("[LLLOGIN SERVICE]: no gatekeeper detected..... using " + m_GatekeeperURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
@ -762,6 +761,7 @@ namespace OpenSim.Services.LLLoginService
|
||||||
if (account.ServiceURLs == null)
|
if (account.ServiceURLs == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Old style: get the service keys from the DB
|
||||||
foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
|
foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
|
||||||
{
|
{
|
||||||
if (kvp.Value == null || (kvp.Value != null && kvp.Value.ToString() == string.Empty))
|
if (kvp.Value == null || (kvp.Value != null && kvp.Value.ToString() == string.Empty))
|
||||||
|
@ -773,6 +773,21 @@ namespace OpenSim.Services.LLLoginService
|
||||||
aCircuit.ServiceURLs[kvp.Key] = kvp.Value;
|
aCircuit.ServiceURLs[kvp.Key] = kvp.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// New style: service keys start with SRV_; override the previous
|
||||||
|
string[] keys = m_LoginServerConfig.GetKeys();
|
||||||
|
|
||||||
|
if (keys.Length > 0)
|
||||||
|
{
|
||||||
|
IEnumerable<string> serviceKeys = keys.Where(value => value.StartsWith("SRV_"));
|
||||||
|
foreach (string serviceKey in serviceKeys)
|
||||||
|
{
|
||||||
|
string keyName = serviceKey.Replace("SRV_", "");
|
||||||
|
aCircuit.ServiceURLs[keyName] = m_LoginServerConfig.GetString(serviceKey, string.Empty);
|
||||||
|
m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, out string reason)
|
private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, out string reason)
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
<Addin id="OpenSim.Grid.GridServer" isroot="true" version="0.5">
|
|
||||||
<Runtime>
|
|
||||||
<Import assembly="OpenSim.Grid.GridServer.exe"/>
|
|
||||||
<Import assembly="OpenSim.Framework.dll"/>
|
|
||||||
</Runtime>
|
|
||||||
<ExtensionPoint path = "/OpenSim/GridServer">
|
|
||||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Grid.GridServer.IGridPlugin"/>
|
|
||||||
</ExtensionPoint>
|
|
||||||
</Addin>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<configSections>
|
|
||||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
|
||||||
</configSections>
|
|
||||||
<appSettings>
|
|
||||||
</appSettings>
|
|
||||||
<log4net>
|
|
||||||
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
|
|
||||||
<layout type="log4net.Layout.PatternLayout">
|
|
||||||
<conversionPattern value="%date{HH:mm:ss} - %message%newline" />
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
|
|
||||||
<file value="OpenSim.Grid.GridServer.log" />
|
|
||||||
<appendToFile value="true" />
|
|
||||||
<layout type="log4net.Layout.PatternLayout">
|
|
||||||
<conversionPattern value="%date %-5level - %logger %message%newline" />
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<root>
|
|
||||||
<level value="DEBUG" />
|
|
||||||
<appender-ref ref="Console" />
|
|
||||||
<appender-ref ref="LogFileAppender" />
|
|
||||||
</root>
|
|
||||||
</log4net>
|
|
||||||
</configuration>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<configSections>
|
|
||||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
|
||||||
</configSections>
|
|
||||||
<appSettings>
|
|
||||||
</appSettings>
|
|
||||||
<log4net>
|
|
||||||
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
|
|
||||||
<layout type="log4net.Layout.PatternLayout">
|
|
||||||
<conversionPattern value="%date{HH:mm:ss} - %message%newline" />
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
|
|
||||||
<file value="OpenSim.Grid.MessagingServer.log" />
|
|
||||||
<appendToFile value="true" />
|
|
||||||
<layout type="log4net.Layout.PatternLayout">
|
|
||||||
<conversionPattern value="%date %-5level - %logger %message%newline" />
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<root>
|
|
||||||
<level value="DEBUG" />
|
|
||||||
<appender-ref ref="Console" />
|
|
||||||
<appender-ref ref="LogFileAppender" />
|
|
||||||
</root>
|
|
||||||
</log4net>
|
|
||||||
</configuration>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<configSections>
|
|
||||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
|
||||||
</configSections>
|
|
||||||
<appSettings>
|
|
||||||
</appSettings>
|
|
||||||
<log4net>
|
|
||||||
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
|
|
||||||
<layout type="log4net.Layout.PatternLayout">
|
|
||||||
<conversionPattern value="%date{HH:mm:ss} - %message%newline" />
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
|
|
||||||
<file value="OpenSim.Grid.UserServer.log" />
|
|
||||||
<appendToFile value="true" />
|
|
||||||
<layout type="log4net.Layout.PatternLayout">
|
|
||||||
<conversionPattern value="%date %-5level - %logger %message%newline" />
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<root>
|
|
||||||
<level value="DEBUG" />
|
|
||||||
<appender-ref ref="Console" />
|
|
||||||
<appender-ref ref="LogFileAppender" />
|
|
||||||
</root>
|
|
||||||
</log4net>
|
|
||||||
</configuration>
|
|
|
@ -3,16 +3,23 @@
|
||||||
<configSections>
|
<configSections>
|
||||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
||||||
</configSections>
|
</configSections>
|
||||||
|
<runtime>
|
||||||
|
<gcConcurrent enabled="true" />
|
||||||
|
<gcServer enabled="true" />
|
||||||
|
</runtime>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
</appSettings>
|
</appSettings>
|
||||||
<log4net>
|
<log4net>
|
||||||
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
|
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
|
||||||
<layout type="log4net.Layout.PatternLayout">
|
<layout type="log4net.Layout.PatternLayout">
|
||||||
<conversionPattern value="%date{HH:mm:ss} - %message%newline" />
|
<conversionPattern value="%date{HH:mm:ss} - %message" />
|
||||||
|
<!-- console log with milliseconds. Useful for debugging -->
|
||||||
|
<!-- <conversionPattern value="%date{HH:mm:ss.fff} - %message" /> -->
|
||||||
</layout>
|
</layout>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
|
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
|
||||||
<file value="OpenSim.Grid.ScriptServer.log" />
|
<file value="OpenSim.log" />
|
||||||
<appendToFile value="true" />
|
<appendToFile value="true" />
|
||||||
<layout type="log4net.Layout.PatternLayout">
|
<layout type="log4net.Layout.PatternLayout">
|
||||||
<conversionPattern value="%date %-5level - %logger %message%newline" />
|
<conversionPattern value="%date %-5level - %logger %message%newline" />
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue