Merge branch 'master-core' into mantis5110

viewer-2-initial-appearance
Jonathan Freedman 2010-12-05 11:49:15 -08:00
commit 45cd2e3ef9
79 changed files with 2421 additions and 1169 deletions

View File

@ -106,8 +106,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule...");
m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
// m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
// m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
m_log.Info("[LOADREGIONSPLUGIN]: Done.");
if (!CheckRegionsForSanity(regionsToLoad))

View File

@ -62,7 +62,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
new List<ISharedRegionModule>();
#region IApplicationPlugin implementation
public void Initialise (OpenSimBase openSim)
{
m_openSim = openSim;
@ -91,66 +91,24 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
{
if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null)
{
// Get the config string
string moduleString =
modulesConfig.GetString("Setup_" + node.Id, String.Empty);
// We have a selector
if (moduleString != String.Empty)
if (CheckModuleEnabled(node, modulesConfig))
{
// Allow disabling modules even if they don't have
// support for it
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);
}
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)
{
// Get the config string
string moduleString =
modulesConfig.GetString("Setup_" + node.Id, String.Empty);
// We have a selector
if (moduleString != String.Empty)
if (CheckModuleEnabled(node, modulesConfig))
{
// Allow disabling modules even if they don't have
// support for it
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);
}
m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type);
m_nonSharedModules.Add(node);
}
else
{
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
@ -197,8 +155,6 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
m_sharedInstances.Add(module);
module.Initialise(m_openSim.ConfigSource.Source);
}
}
public void PostInitialise ()
@ -210,7 +166,6 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
{
module.PostInitialise();
}
}
#endregion
@ -244,7 +199,6 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
#endregion
public string Version
{
get
@ -262,6 +216,42 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
}
#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.
// This is where we handle adding the modules to scenes when they

View File

@ -208,18 +208,25 @@ namespace OpenSim.ApplicationPlugins.RemoteController
UUID regionID = new UUID((string) requestData["regionID"]);
responseData["accepted"] = true;
responseData["success"] = true;
response.Value = responseData;
Scene rebootedScene;
responseData["success"] = false;
responseData["accepted"] = true;
if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene))
throw new Exception("region not found");
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;
rebootedScene.Restart(30);
}
catch (Exception e)
{

View File

@ -323,7 +323,7 @@ namespace OpenSim.Data.Tests
.IgnoreProperty(x => x.InvType)
.IgnoreProperty(x => x.CreatorIdAsUuid)
.IgnoreProperty(x => x.Description)
.IgnoreProperty(x => x.CreatorId)
.IgnoreProperty(x => x.CreatorIdentification)
.IgnoreProperty(x => x.CreatorData));
inventoryScrambler.Scramble(expected);
@ -334,7 +334,7 @@ namespace OpenSim.Data.Tests
.IgnoreProperty(x => x.InvType)
.IgnoreProperty(x => x.CreatorIdAsUuid)
.IgnoreProperty(x => x.Description)
.IgnoreProperty(x => x.CreatorId)
.IgnoreProperty(x => x.CreatorIdentification)
.IgnoreProperty(x => x.CreatorData));
}

View File

@ -302,31 +302,26 @@ namespace OpenSim.Framework
if (args["start_pos"] != null)
Vector3.TryParse(args["start_pos"].AsString(), out startpos);
// DEBUG ON
m_log.WarnFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString());
// DEBUG OFF
m_log.InfoFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString());
try {
// Unpack various appearance elements
Appearance = new AvatarAppearance(AgentID);
// Unpack various appearance elements
Appearance = new AvatarAppearance(AgentID);
// Eventually this code should be deprecated, use full appearance
// packing in packed_appearance
if (args["appearance_serial"] != null)
Appearance.Serial = args["appearance_serial"].AsInteger();
// Eventually this code should be deprecated, use full appearance
// packing in packed_appearance
if (args["appearance_serial"] != null)
Appearance.Serial = args["appearance_serial"].AsInteger();
if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map))
{
Appearance.Unpack((OSDMap)args["packed_appearance"]);
// DEBUG ON
m_log.WarnFormat("[AGENTCIRCUITDATA] unpacked appearance");
// DEBUG OFF
if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map))
{
Appearance.Unpack((OSDMap)args["packed_appearance"]);
m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance");
}
else
m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance");
}
// DEBUG ON
else
m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance");
// DEBUG OFF
} catch (Exception e)
catch (Exception e)
{
m_log.ErrorFormat("[AGENTCIRCUITDATA] failed to unpack appearance; {0}",e.Message);
}

View File

@ -51,8 +51,16 @@ namespace OpenSim.Framework
string[] parts = temp.Split('\n');
int.TryParse(parts[0].Substring(17, 1), out Version);
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")
Vector3.TryParse(parts[2].Substring(10, parts[2].Length - 10).Replace(" ", ","), out Position);
// The position is a vector with spaces as separators ("10.3 32.5 43").
// 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);
}
}

View File

@ -48,7 +48,7 @@ namespace OpenSim.Framework
public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
protected UUID m_owner;
protected int m_serial = 1;
protected int m_serial = 0;
protected byte[] m_visualparams;
protected Primitive.TextureEntry m_texture;
protected AvatarWearable[] m_wearables;
@ -103,7 +103,7 @@ namespace OpenSim.Framework
{
// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance for {0}",owner);
m_serial = 1;
m_serial = 0;
m_owner = owner;
SetDefaultWearables();
@ -127,7 +127,7 @@ namespace OpenSim.Framework
{
// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID);
m_serial = 1;
m_serial = 0;
m_owner = avatarID;
if (wearables != null)
@ -160,7 +160,7 @@ namespace OpenSim.Framework
if (appearance == null)
{
m_serial = 1;
m_serial = 0;
m_owner = UUID.Zero;
SetDefaultWearables();
@ -229,6 +229,24 @@ namespace OpenSim.Framework
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()
{
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()
{
m_texture = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97"));
for (uint i = 0; i < TEXTURE_COUNT; i++)
m_texture.CreateFace(i).TextureID = new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE);
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);
}
/// <summary>
@ -274,9 +293,6 @@ namespace OpenSim.Framework
}
changed = true;
// if (newface != null)
// m_log.WarnFormat("[AVATAR APPEARANCE]: index {0}, new texture id {1}",i,newface.TextureID);
}
m_texture = textureEntry;

View File

@ -990,6 +990,7 @@ namespace OpenSim.Framework.Capabilities
public void BakedTextureUploaded(UUID assetID, byte[] data)
{
// m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
AssetBase asset;
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString());
asset.Data = data;
@ -1331,6 +1332,7 @@ namespace OpenSim.Framework.Capabilities
newAssetID = UUID.Random();
uploaderPath = path;
httpListener = httpServer;
m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
}
/// <summary>
@ -1358,6 +1360,8 @@ namespace OpenSim.Framework.Capabilities
handlerUpLoad(newAssetID, data);
}
m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID);
return res;
}
}

View File

@ -331,9 +331,7 @@ namespace OpenSim.Framework
public virtual OSDMap Pack()
{
// DEBUG ON
m_log.WarnFormat("[CHILDAGENTDATAUPDATE] Pack data");
// DEBUG OFF
m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
OSDMap args = new OSDMap();
args["message_type"] = OSD.FromString("AgentData");
@ -454,9 +452,7 @@ namespace OpenSim.Framework
/// <param name="hash"></param>
public virtual void Unpack(OSDMap args)
{
// DEBUG ON
m_log.WarnFormat("[CHILDAGENTDATAUPDATE] Unpack data");
// DEBUG OFF
m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data");
if (args.ContainsKey("region_id"))
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)
Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]);
// DEBUG ON
else
m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
// DEBUG OFF
if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
{

View File

@ -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); }
}
}

View File

@ -73,7 +73,7 @@ namespace OpenSim.Framework
void AddNewClient(IClientAPI client);
void RemoveClient(UUID agentID);
void Restart(int seconds);
void Restart();
//RegionInfo OtherRegionUp(RegionInfo thisRegion);
string GetSimulatorVersion();

View File

@ -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();
}
}
}
}

View File

@ -32,7 +32,7 @@ using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Services.Interfaces;
namespace OpenSim.Framework.Communications.Osp
namespace OpenSim.Framework.Serialization
{
/// <summary>
/// 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>
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);
if (account != null)
return MakeOspa(account.FirstName, account.LastName);

View File

@ -26,11 +26,16 @@
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using System.Xml;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Services.Interfaces;
namespace OpenSim.Framework.Serialization.External
{
@ -40,6 +45,141 @@ namespace OpenSim.Framework.Serialization.External
/// XXX: Please do not use yet.
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>
/// Deserialize item
/// </summary>
@ -60,40 +200,47 @@ namespace OpenSim.Framework.Serialization.External
public static InventoryItemBase Deserialize(string serialization)
{
InventoryItemBase item = new InventoryItemBase();
StringReader sr = new StringReader(serialization);
XmlTextReader xtr = new XmlTextReader(sr);
xtr.ReadStartElement("InventoryItem");
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();
xtr.Close();
sr.Close();
using (XmlTextReader reader = new XmlTextReader(new StringReader(serialization)))
{
reader.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
}
}
reader.ReadEndElement(); // InventoryItem
}
//m_log.DebugFormat("[XXX]: parsed InventoryItemBase {0} - {1}", obj.Name, obj.UUID);
return item;
}
public static string Serialize(InventoryItemBase inventoryItem)
public static string Serialize(InventoryItemBase inventoryItem, Dictionary<string, object> options, IUserAccountService userAccountService)
{
StringWriter sw = new StringWriter();
XmlTextWriter writer = new XmlTextWriter(sw);
@ -112,7 +259,7 @@ namespace OpenSim.Framework.Serialization.External
writer.WriteString(inventoryItem.InvType.ToString());
writer.WriteEndElement();
writer.WriteStartElement("CreatorUUID");
writer.WriteString(inventoryItem.CreatorId);
writer.WriteString(OspResolver.MakeOspa(inventoryItem.CreatorIdAsUuid, userAccountService));
writer.WriteEndElement();
writer.WriteStartElement("CreationDate");
writer.WriteString(inventoryItem.CreationDate.ToString());
@ -156,6 +303,20 @@ namespace OpenSim.Framework.Serialization.External
writer.WriteStartElement("GroupOwned");
writer.WriteString(inventoryItem.GroupOwned.ToString());
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();

View File

@ -1558,5 +1558,86 @@ namespace OpenSim.Framework
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
}
}

View File

@ -265,10 +265,10 @@ namespace OpenSim
LoadOar);
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.",
"-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
"-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
+ "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.",
SaveOar);

View File

@ -352,13 +352,13 @@ namespace OpenSim
m_moduleLoader.InitialiseSharedModules(scene);
// 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;
if (ApplicationRegistry.TryGet(out controller))
{
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();

View File

@ -3562,24 +3562,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
EntityUpdate 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)
{
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.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&

View File

@ -399,7 +399,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
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;
@ -408,14 +417,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[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
return false;
}
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);
return true;
}

View File

@ -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)
{
// 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)
{
int dataLength = data.Length;
@ -396,7 +410,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
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);
#endregion Queue or Send
@ -489,7 +507,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//Interlocked.Increment(ref Stats.ResentPackets);
// Requeue or resend the packet
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket))
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false))
SendPacketFinal(outgoingPacket);
}
}

View File

@ -41,19 +41,22 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
/// </summary>
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
private bool m_dumpAssetsToFile;
public AssetTransactionModule Manager;
private Scene m_Scene;
public UUID UserID;
public Dictionary<UUID, AssetXferUploader> XferUploaders = new Dictionary<UUID, AssetXferUploader>();
public Dictionary<UUID, AssetXferUploader> XferUploaders =
new Dictionary<UUID, AssetXferUploader>();
// Methods
public AgentAssetTransactions(UUID agentID, AssetTransactionModule manager, bool dumpAssetsToFile)
public AgentAssetTransactions(UUID agentID, Scene scene,
bool dumpAssetsToFile)
{
m_Scene = scene;
UserID = agentID;
Manager = manager;
m_dumpAssetsToFile = dumpAssetsToFile;
}
@ -61,7 +64,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
{
if (!XferUploaders.ContainsKey(transactionID))
{
AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile);
AssetXferUploader uploader = new AssetXferUploader(m_Scene,
m_dumpAssetsToFile);
lock (XferUploaders)
{
@ -88,22 +92,25 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
}
}
public void RequestCreateInventoryItem(IClientAPI remoteClient, UUID transactionID, UUID folderID,
uint callbackID, string description, string name, sbyte invType,
sbyte type, byte wearableType, uint nextOwnerMask)
public void RequestCreateInventoryItem(IClientAPI remoteClient,
UUID transactionID, UUID folderID, uint callbackID,
string description, string name, sbyte invType,
sbyte type, byte wearableType, uint nextOwnerMask)
{
if (XferUploaders.ContainsKey(transactionID))
{
XferUploaders[transactionID].RequestCreateInventoryItem(remoteClient, transactionID, folderID,
callbackID, description, name, invType, type,
wearableType, nextOwnerMask);
XferUploaders[transactionID].RequestCreateInventoryItem(
remoteClient, transactionID, folderID,
callbackID, description, name, invType, type,
wearableType, nextOwnerMask);
}
}
/// <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>
/// <param name="transactionID"></param>
/// <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;
}
//private void CreateItemFromUpload(AssetBase asset, IClientAPI ourClient, UUID inventoryFolderID, uint nextPerms, uint wearableType)
//{
// Manager.MyScene.CommsManager.AssetCache.AddAsset(asset);
// 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)
public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient,
SceneObjectPart part, UUID transactionID,
TaskInventoryItem item)
{
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)
{
m_log.DebugFormat(
"[ASSET TRANSACTIONS]: Updating task item {0} in {1} with asset in transaction {2}",
item.Name, part.Name, transactionID);
asset.FullID = UUID.Random();
asset.Name = item.Name;
asset.Description = item.Description;
asset.Type = (sbyte)item.Type;
item.AssetID = asset.FullID;
Manager.MyScene.AssetService.Store(asset);
m_Scene.AssetService.Store(asset);
if (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);
}
part.Inventory.UpdateInventoryItem(item);
}
}
}
public void RequestUpdateInventoryItem(IClientAPI remoteClient, UUID transactionID,
InventoryItemBase item)
public void RequestUpdateInventoryItem(IClientAPI remoteClient,
UUID transactionID, 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.Name = item.Name;
asset.Description = item.Description;
asset.Type = (sbyte)item.AssetType;
item.AssetID = asset.FullID;
Manager.MyScene.AssetService.Store(asset);
}
m_Scene.AssetService.Store(asset);
IInventoryService invService = Manager.MyScene.InventoryService;
invService.UpdateItem(item);
IInventoryService invService = m_Scene.InventoryService;
invService.UpdateItem(item);
}
}
}
}

View File

@ -34,22 +34,19 @@ using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using Mono.Addins;
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 Scene m_scene = null;
[Obsolete]
public Scene MyScene
{
get{ return m_scene;}
}
/// <summary>
/// Each agent has its own singleton collection of transactions
@ -57,33 +54,24 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
private Dictionary<UUID, AgentAssetTransactions> AgentTransactions =
new Dictionary<UUID, AgentAssetTransactions>();
public AssetTransactionModule()
{
//m_log.Debug("creating AgentAssetTransactionModule");
}
#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"; }
}
public bool IsSharedModule
public Type ReplaceableInterface
{
get { return true; }
get { return typeof(IAgentAssetTransactions); }
}
#endregion
@ -111,8 +99,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
#region AgentAssetTransactions
/// <summary>
/// Get the collection of asset transactions for the given user. If one does not already exist, it
/// is created.
/// Get the collection of asset transactions for the given user.
/// If one does not already exist, it is created.
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
@ -122,7 +110,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
{
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);
}
@ -131,8 +122,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
}
/// <summary>
/// Remove the given agent asset transactions. This should be called when a client is departing
/// from a scene (and hence won't be making any more transactions here).
/// Remove the given agent asset transactions. This should be called
/// when a client is departing from a scene (and hence won't be making
/// any more transactions here).
/// </summary>
/// <param name="userID"></param>
public void RemoveAgentAssetTransactions(UUID userID)
@ -146,10 +138,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
}
/// <summary>
/// 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
/// situations.
/// 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 situations.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="transactionID"></param>
@ -161,61 +153,72 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
/// <param name="type"></param>
/// <param name="wearableType"></param>
/// <param name="nextOwnerMask"></param>
public void HandleItemCreationFromTransaction(IClientAPI remoteClient, UUID transactionID, UUID folderID,
uint callbackID, string description, string name, sbyte invType,
sbyte type, byte wearableType, uint nextOwnerMask)
public void HandleItemCreationFromTransaction(IClientAPI remoteClient,
UUID transactionID, UUID folderID, uint callbackID,
string description, string name, sbyte invType,
sbyte type, byte wearableType, uint nextOwnerMask)
{
// m_log.DebugFormat(
// "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name);
// m_log.DebugFormat(
// "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name);
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
AgentAssetTransactions transactions =
GetUserTransactions(remoteClient.AgentId);
transactions.RequestCreateInventoryItem(
remoteClient, transactionID, folderID, callbackID, description,
name, invType, type, wearableType, nextOwnerMask);
transactions.RequestCreateInventoryItem(remoteClient, transactionID,
folderID, callbackID, description, name, invType, type,
wearableType, nextOwnerMask);
}
/// <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
/// colours). It may also be called in other situations.
/// This is called when clothing or body parts are updated (for
/// instance, with new textures or colours). It may also be called in
/// other situations.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="transactionID"></param>
/// <param name="item"></param>
public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, UUID transactionID,
InventoryItemBase item)
public void HandleItemUpdateFromTransaction(IClientAPI remoteClient,
UUID transactionID, InventoryItemBase item)
{
// m_log.DebugFormat(
// "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}",
// item.Name);
// m_log.DebugFormat(
// "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}",
// item.Name);
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
AgentAssetTransactions transactions =
GetUserTransactions(remoteClient.AgentId);
transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item);
transactions.RequestUpdateInventoryItem(remoteClient,
transactionID, item);
}
/// <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
/// up through a single AssetUploadRequest. A subsequent UpdateTaskInventory then references the transaction
/// This is currently called when, for instance, a notecard in a prim
/// is saved. The data is sent up through a single AssetUploadRequest.
/// A subsequent UpdateTaskInventory then references the transaction
/// and comes through this method.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="transactionID"></param>
/// <param name="item"></param>
public void HandleTaskItemUpdateFromTransaction(
IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
public void HandleTaskItemUpdateFromTransaction(IClientAPI remoteClient,
SceneObjectPart part, UUID transactionID,
TaskInventoryItem item)
{
// m_log.DebugFormat(
// "[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0}",
// item.Name);
// m_log.DebugFormat(
// "[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0}",
// 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>
@ -227,8 +230,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
/// <param name="type"></param>
/// <param name="data"></param></param>
/// <param name="tempFile"></param>
public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type,
byte[] data, bool storeLocal, bool tempFile)
public void HandleUDPUploadRequest(IClientAPI remoteClient,
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);
@ -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)
{
uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile);
uploader.Initialise(remoteClient, assetID, transaction, type,
data, storeLocal, tempFile);
}
}
/// <summary>
/// Handle asset transfer data packets received in response to the asset upload request in
/// HandleUDPUploadRequest()
/// Handle asset transfer data packets received in response to the
/// asset upload request in HandleUDPUploadRequest()
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="xferID"></param>
/// <param name="packetID"></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!");
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
AgentAssetTransactions transactions =
GetUserTransactions(remoteClient.AgentId);
transactions.HandleXfer(xferID, packetID, data);
}

View File

@ -31,7 +31,7 @@ using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
@ -50,17 +50,17 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
private bool m_finished = false;
private string m_name = String.Empty;
private bool m_storeLocal;
private AgentAssetTransactions m_userTransactions;
private uint nextPerm = 0;
private IClientAPI ourClient;
private UUID TransactionID = UUID.Zero;
private sbyte type = 0;
private byte wearableType = 0;
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;
}
@ -108,11 +108,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
/// <param name="packetID"></param>
/// <param name="data"></param>
/// <returns>True if the transfer is complete, false otherwise</returns>
public bool Initialise(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, byte[] data,
bool storeLocal, bool tempFile)
public bool Initialise(IClientAPI remoteClient, UUID assetID,
UUID transaction, sbyte type, byte[] data, bool storeLocal,
bool tempFile)
{
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.Description = "empty";
m_asset.Local = storeLocal;
@ -137,12 +139,14 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
protected void RequestStartXfer()
{
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()
{
ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true, m_asset.FullID);
ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true,
m_asset.FullID);
m_finished = true;
if (m_createItem)
@ -151,18 +155,20 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
}
else if (m_storeLocal)
{
m_userTransactions.Manager.MyScene.AssetService.Store(m_asset);
m_Scene.AssetService.Store(m_asset);
}
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)
{
DateTime now = DateTime.Now;
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,
now.Hour, now.Minute, now.Second, m_asset.Name, m_asset.Type);
String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat",
now.Year, now.Month, now.Day, now.Hour, now.Minute,
now.Second, m_asset.Name, m_asset.Type);
SaveAssetToFile(filename, m_asset.Data);
}
}
@ -181,9 +187,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
fs.Close();
}
public void RequestCreateInventoryItem(IClientAPI remoteClient, UUID transactionID, UUID folderID,
uint callbackID, string description, string name, sbyte invType,
sbyte type, byte wearableType, uint nextOwnerMask)
public void RequestCreateInventoryItem(IClientAPI remoteClient,
UUID transactionID, UUID folderID, uint callbackID,
string description, string name, sbyte invType,
sbyte type, byte wearableType, uint nextOwnerMask)
{
if (TransactionID == transactionID)
{
@ -212,7 +219,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
private void DoCreateItem(uint callbackID)
{
m_userTransactions.Manager.MyScene.AssetService.Store(m_asset);
m_Scene.AssetService.Store(m_asset);
InventoryItemBase item = new InventoryItemBase();
item.Owner = ourClient.AgentId;
@ -232,7 +239,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
item.Flags = (uint) wearableType;
item.CreationDate = Util.UnixTimeSinceEpoch();
if (m_userTransactions.Manager.MyScene.AddInventoryItem(item))
if (m_Scene.AddInventoryItem(item))
ourClient.SendInventoryItemCreateUpdate(item, callbackID);
else
ourClient.SendAlertMessage("Unable to create inventory item");

View File

@ -115,7 +115,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
#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)
{
return ValidateBakedTextureCache(client, true);
}
private bool ValidateBakedTextureCache(IClientAPI client, bool checkonly)
{
ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
if (sp == null)
@ -131,15 +142,33 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
{
int idx = AvatarAppearance.BAKE_INDICES[i];
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;
defonly = false; // found a non-default texture reference
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
return (defonly ? false : true);
}
@ -158,61 +187,43 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
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;
// 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
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
if (visualParams != null)
{
if (sp.Appearance.SetVisualParams(visualParams))
{
changed = true;
if (sp.Appearance.AvatarHeight > 0)
sp.SetHeight(sp.Appearance.AvatarHeight);
}
changed = sp.Appearance.SetVisualParams(visualParams);
if (sp.Appearance.AvatarHeight > 0)
sp.SetHeight(sp.Appearance.AvatarHeight);
}
// Send the appearance back to the avatar, not clear that this is needed
sp.ControllingClient.SendAvatarDataImmediate(sp);
// AvatarAppearance avp = sp.Appearance;
// sp.ControllingClient.SendAppearance(avp.Owner,avp.VisualParams,avp.Texture.GetBytes());
// Process the baked texture array
if (textureEntry != null)
{
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);
}
}
// 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());
// m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString());
}
/// <summary>
@ -235,6 +246,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
#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)
{
// m_log.WarnFormat("[AVFACTORY]: Queue appearance send for {0}", agentid);
@ -274,21 +289,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// Send the appearance to everyone in the scene
sp.SendAppearanceToAllOtherAgents();
// sp.ControllingClient.SendAvatarDataImmediate(sp);
// Send the appearance back to the avatar
// AvatarAppearance avp = sp.Appearance;
// 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;
}
*/
// Send animations back to the avatar as well
sp.Animator.SendAnimPack();
}
private void HandleAppearanceSave(UUID agentid)
@ -374,8 +377,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}", client.AgentId);
AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false);
// 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);
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
{
if (wear.Type < AvatarWearable.MAX_WEARABLES)
@ -388,9 +395,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
SetAppearanceAssets(sp.UUID, ref avatAppearance);
// 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;
m_scene.AvatarService.SetAppearance(client.AgentId, sp.Appearance);
QueueAppearanceSave(client.AgentId);
}
private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance)

View File

@ -37,12 +37,11 @@ using System.Xml.Linq;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Osp;
using OpenSim.Framework.Serialization;
using OpenSim.Framework.Serialization.External;
using OpenSim.Region.CoreModules.World.Archiver;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
@ -398,20 +397,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// Don't use the item ID that's in the file
item.ID = UUID.Random();
UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService);
if (UUID.Zero != ospResolvedId)
UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService);
if (UUID.Zero != ospResolvedId) // The user exists in this grid
{
item.CreatorIdAsUuid = ospResolvedId;
// 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.
item.CreatorId = ospResolvedId.ToString();
item.CreatorData = string.Empty;
}
else
else if (item.CreatorData == null || item.CreatorData == String.Empty)
{
item.CreatorIdAsUuid = m_userInfo.PrincipalID;
}
item.Owner = m_userInfo.PrincipalID;
// Reset folder ID to the one in which we want to load it

View File

@ -36,8 +36,6 @@ using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Serialization;
using OpenSim.Framework.Serialization.External;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Osp;
using OpenSim.Region.CoreModules.World.Archiver;
using OpenSim.Region.Framework.Scenes;
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);
}
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);
// Record the creator of this item for user record purposes (which might go away soon)
m_userUuids[inventoryItem.CreatorIdAsUuid] = 1;
InventoryItemBase saveItem = (InventoryItemBase)inventoryItem.Clone();
saveItem.CreatorId = OspResolver.MakeOspa(saveItem.CreatorIdAsUuid, m_scene.UserAccountService);
string serialization = UserInventoryItemSerializer.Serialize(saveItem);
string serialization = UserInventoryItemSerializer.Serialize(inventoryItem, options, userAccountService);
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>
@ -161,7 +156,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// <param name="inventoryFolder">The inventory folder to save</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>
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)
{
@ -176,19 +171,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
foreach (InventoryFolderBase childFolder in contents.Folders)
{
SaveInvFolder(childFolder, path, true);
SaveInvFolder(childFolder, path, true, options, userAccountService);
}
foreach (InventoryItemBase item in contents.Items)
{
SaveInvItem(item, path);
SaveInvItem(item, path, options, userAccountService);
}
}
/// <summary>
/// Execute the inventory write request
/// </summary>
public void Execute()
public void Execute(Dictionary<string, object> options, IUserAccountService userAccountService)
{
try
{
@ -266,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath);
//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)
{
@ -274,14 +269,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
"[INVENTORY ARCHIVER]: Found item {0} {1} at {2}",
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.
//SaveUsers();
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)
{

View File

@ -75,6 +75,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
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(bool disablePresenceChecks)
@ -106,11 +124,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
scene.AddCommand(
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).",
"<first> is the user's first 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
+ "-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."
+ string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME),
HandleSaveInvConsoleCommand);
@ -157,7 +176,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
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)
{
@ -197,7 +216,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
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)
{
@ -235,14 +254,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (m_scenes.Count > 0)
{
UserAccount userInfo = GetUserInfo(firstName, lastName, pass);
if (userInfo != null)
{
if (CheckPresence(userInfo.PrincipalID))
{
InventoryArchiveReadRequest request;
bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
try
{
request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream, merge);
@ -256,7 +276,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
return false;
}
UpdateClientWithLoadedNodes(userInfo, request.Execute());
return true;
@ -268,6 +288,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID);
}
}
else
m_log.ErrorFormat("[INVENTORY ARCHIVER]: User {0} {1} not found",
firstName, lastName);
}
return false;
@ -368,10 +391,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams)
{
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
{
if (cmdparams.Length < 6)
if (mainParams.Count < 6)
{
m_log.Error(
"[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.");
string firstName = cmdparams[2];
string lastName = cmdparams[3];
string invPath = cmdparams[4];
string pass = cmdparams[5];
string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
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 = mainParams[2];
string lastName = mainParams[3];
string invPath = mainParams[4];
string pass = mainParams[5];
string savePath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME);
m_log.InfoFormat(
"[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
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)
{
@ -518,5 +551,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
return false;
}
}
}

View File

@ -38,7 +38,6 @@ using OpenSim.Framework;
using OpenSim.Framework.Serialization;
using OpenSim.Framework.Serialization.External;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Osp;
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
using OpenSim.Region.CoreModules.World.Serialiser;
using OpenSim.Region.Framework.Scenes;
@ -96,14 +95,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
item1.Name = m_item1Name;
item1.AssetID = 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 = "00000000-0000-0000-0000-000000000444";
item1.CreatorId = m_ua2.PrincipalID.ToString();
item1.Owner = UUID.Zero;
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
string item1FileName
= 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();
m_iarStream = new MemoryStream(archiveWriteStream.ToArray());
}
@ -386,7 +388,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
@ -551,7 +553,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string item1FileName
= 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();
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());

View File

@ -876,8 +876,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
agent.MakeChildAgent();
// 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);

View File

@ -27,8 +27,11 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Threading;
using System.Xml;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
@ -52,14 +55,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>();
private Scene m_scene;
private string m_ProfileServerURI;
#endregion
#region Constructor
public HGAssetMapper(Scene scene)
public HGAssetMapper(Scene scene, string profileURL)
{
m_scene = scene;
m_ProfileServerURI = profileURL;
}
#endregion
@ -95,16 +100,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
try
{
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
{
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_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)
{
to.Data = from.Data;
//to.Data = from.Data; // don't copy this, it's copied elsewhere
to.Description = from.Description;
to.FullID = from.FullID;
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
// private void Dump(Dictionary<UUID, bool> lst)
// {

View File

@ -54,6 +54,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
get { return m_assMapper; }
}
private string m_ProfileServerURI;
// private bool m_Initialized = false;
#region INonSharedRegionModule
@ -73,6 +75,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
m_Enabled = true;
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;
base.AddRegion(scene);
m_assMapper = new HGAssetMapper(scene);
m_assMapper = new HGAssetMapper(scene, m_ProfileServerURI);
scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem;
}
@ -97,7 +105,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
string userAssetServer = string.Empty;
if (IsForeignUser(avatarID, out userAssetServer))
{
m_assMapper.Post(assetID, avatarID, userAssetServer);
Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); });
}
}

View File

@ -53,6 +53,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
protected bool m_Enabled = false;
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
@ -542,6 +553,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
SceneObjectGroup group
= SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData);
Util.FireAndForget(delegate { AddUserData(group); });
group.RootPart.FromFolderID = item.Folder;
// If it's rezzed in world, select it. Much easier to
@ -699,6 +712,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
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)
{
}
@ -779,9 +799,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID)
{
IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>();
InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, agentID);
assetRequestItem = invService.GetItem(assetRequestItem);
return assetRequestItem;
InventoryItemBase item = new InventoryItemBase(itemID, agentID);
item = invService.GetItem(item);
if (item.CreatorData != null && item.CreatorData != string.Empty)
UserManagementModule.AddUser(item.CreatorIdAsUuid, item.CreatorData);
return item;
}
#endregion

View File

@ -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);
}
public void AddUser(UUID uuid, string first, string last, string profileURL)
{
AddUser(uuid, profileURL + ";" + first + " " + last);
}
//public void AddUser(UUID uuid, string userData)
//{
// if (m_UserCache.ContainsKey(uuid))

View File

@ -91,9 +91,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset
{
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);
}

View File

@ -190,7 +190,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
new AssetsRequest(
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)
{
@ -238,10 +239,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion);
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");
}
//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");
//}
StringWriter sw = new StringWriter();
XmlTextWriter xtw = new XmlTextWriter(sw);

View File

@ -34,6 +34,7 @@ using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Serialization;
using OpenSim.Framework.Serialization.External;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.World.Archiver
@ -100,17 +101,26 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// Asset service used to request the assets
/// </value>
protected IAssetService m_assetService;
protected IUserAccountService m_userAccountService;
protected UUID m_scopeID; // the grid ID
protected AssetsArchiver m_assetsArchiver;
protected Dictionary<string, object> m_options;
protected internal AssetsRequest(
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_uuids = uuids;
m_assetsRequestCallback = assetsRequestCallback;
m_assetService = assetService;
m_userAccountService = userService;
m_scopeID = scope;
m_options = options;
m_repliesRequired = uuids.Count;
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_foundAssetUuids.Add(asset.FullID);
m_assetsArchiver.WriteAsset(asset);
m_assetsArchiver.WriteAsset(PostProcess(asset));
}
else
{
@ -288,5 +299,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
"[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;
}
}
}

View File

@ -231,7 +231,23 @@ namespace OpenSim.Region.CoreModules.World.Estate
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)

View File

@ -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);
}
}
}

View File

@ -34,6 +34,17 @@ using OpenSim.Region.Framework.Scenes;
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
{
#region IRegionModule Members

View File

@ -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);
}
}

View File

@ -9,5 +9,6 @@ namespace OpenSim.Region.Framework.Interfaces
{
string GetUserName(UUID uuid);
void AddUser(UUID uuid, string userData);
void AddUser(UUID uuid, string firstName, string lastName, string profileURL);
}
}

View File

@ -416,6 +416,10 @@ namespace OpenSim.Region.Framework.Scenes
if ((item != null) && (item.Owner == senderId))
{
IUserManagement uman = RequestModuleInterface<IUserManagement>();
if (uman != null)
uman.AddUser(item.CreatorIdAsUuid, item.CreatorData);
if (!Permissions.BypassPermissions())
{
if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)

View File

@ -893,60 +893,6 @@ namespace OpenSim.Region.Framework.Scenes
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.
public void RestartNow()
{
@ -969,7 +915,8 @@ namespace OpenSim.Region.Framework.Scenes
Close();
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
@ -2050,7 +1997,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="group">Object Id</param>
/// <param name="silent">Suppress broadcasting changes to other clients.</param>
public void DeleteSceneObject(SceneObjectGroup group, bool silent)
{
{
// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);
//SceneObjectPart rootPart = group.GetChildPart(group.UUID);
@ -2091,7 +2038,7 @@ namespace OpenSim.Region.Framework.Scenes
group.DeleteGroupFromScene(silent);
// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
}
/// <summary>
@ -2110,9 +2057,12 @@ namespace OpenSim.Region.Framework.Scenes
// 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
// 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();
SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID);
SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID);
}
// We need to keep track of this state in case this group is still queued for further backup.
@ -2377,16 +2327,14 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
return false;
}
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 2);
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
newObject.ResumeScripts();
// Do this as late as possible so that listeners have full access to the incoming object
EventManager.TriggerOnIncomingSceneObject(newObject);
TriggerChangedTeleport(newObject);
return true;
}
@ -2494,7 +2442,7 @@ namespace OpenSim.Region.Framework.Scenes
return true;
}
private void TriggerChangedTeleport(SceneObjectGroup sog)
private int GetStateSource(SceneObjectGroup sog)
{
ScenePresence sp = GetScenePresence(sog.OwnerID);
@ -2505,13 +2453,12 @@ namespace OpenSim.Region.Framework.Scenes
if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
{
// This will get your attention
//m_log.Error("[XXX] Triggering ");
//m_log.Error("[XXX] Triggering CHANGED_TELEPORT");
// Trigger CHANGED_TELEPORT
sp.Scene.EventManager.TriggerOnScriptChangedEvent(sog.LocalId, (uint)Changed.TELEPORT);
return 5; // StateSource.Teleporting
}
}
return 2; // StateSource.PrimCrossing
}
#endregion
@ -2616,6 +2563,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
}
}

View File

@ -218,18 +218,6 @@ namespace OpenSim.Region.Framework.Scenes
#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)
{
return false;
@ -562,6 +550,14 @@ namespace OpenSim.Region.Framework.Scenes
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);
}
}

View File

@ -119,10 +119,19 @@ namespace OpenSim.Region.Framework.Scenes
timeFirstChanged = DateTime.Now.Ticks;
}
m_hasGroupChanged = value;
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: HasGroupChanged set to {0} for {1} {2}", m_hasGroupChanged, Name, LocalId);
}
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()
{
@ -1330,6 +1339,7 @@ namespace OpenSim.Region.Framework.Scenes
backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem;
HasGroupChanged = false;
HasGroupChangedDueToDelink = false;
m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this);
datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID);
@ -2208,8 +2218,9 @@ namespace OpenSim.Region.Framework.Scenes
linkPart.Rezzed = RootPart.Rezzed;
//HasGroupChanged = true;
//ScheduleGroupForFullUpdate();
// When we delete a group, we currently have to force persist to the database if the object id has changed
// (since delete works by deleting all rows which have a given object id)
objectGroup.HasGroupChangedDueToDelink = true;
return objectGroup;
}

View File

@ -449,7 +449,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; }
set { m_creatorData = value; }

View File

@ -445,8 +445,36 @@ namespace OpenSim.Region.Framework.Scenes
PhysicsActor actor = m_physicsActor;
if (actor != null)
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
{
@ -703,7 +731,9 @@ namespace OpenSim.Region.Framework.Scenes
// Note: This won't send data *to* other clients in that region (children don't send)
// MIC: This gets called again in CompleteMovement
SendInitialFullUpdateToAllClients();
// SendInitialFullUpdateToAllClients();
SendOtherAgentsAvatarDataToMe();
SendOtherAgentsAppearanceToMe();
RegisterToEvents();
SetDirectionVectors();
@ -1613,7 +1643,7 @@ namespace OpenSim.Region.Framework.Scenes
{
AbsolutePosition = part.AbsolutePosition;
Velocity = Vector3.Zero;
SendFullUpdateToAllClients();
SendAvatarDataToAllAgents();
//HandleAgentSit(ControllingClient, m_requestedSitTargetUUID);
}
@ -1688,7 +1718,7 @@ namespace OpenSim.Region.Framework.Scenes
m_parentPosition = Vector3.Zero;
m_parentID = 0;
SendFullUpdateToAllClients();
SendAvatarDataToAllAgents();
m_requestedSitTargetID = 0;
if (m_physicsActor != null && m_appearance != null)
{
@ -2154,7 +2184,7 @@ namespace OpenSim.Region.Framework.Scenes
RemoveFromPhysicalScene();
Animator.TrySetMovementAnimation(sitAnimation);
SendFullUpdateToAllClients();
SendAvatarDataToAllAgents();
// 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)
// [Update] We do now.
@ -2379,165 +2409,183 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <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>
/// <param name="remoteAvatar"></param>
public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
{
// 2 stage check is needed.
if (remoteAvatar == null)
return;
IClientAPI cl = remoteAvatar.ControllingClient;
if (cl == null)
return;
if (m_appearance.Texture == null)
return;
// 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);
return;
}
remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this);
m_scene.StatsReporter.AddAgentUpdates(1);
}
/// <summary>
/// Tell *ALL* agents about this agent
/// </summary>
public void SendInitialFullUpdateToAllClients()
{
m_perfMonMS = Util.EnvironmentTickCount();
int avUpdates = 0;
m_scene.ForEachScenePresence(delegate(ScenePresence avatar)
{
++avUpdates;
// Don't update ourselves
if (avatar.LocalId == LocalId)
return;
// If this is a root agent, then get info about the avatar
if (!IsChildAgent)
{
SendFullUpdateToOtherClient(avatar);
}
// If the other avatar is a root
if (!avatar.IsChildAgent)
{
avatar.SendFullUpdateToOtherClient(this);
avatar.SendAppearanceToOtherAgent(this);
avatar.Animator.SendAnimPackToClient(ControllingClient);
}
});
m_scene.StatsReporter.AddAgentUpdates(avUpdates);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
//Animator.SendAnimPack();
}
public void SendFullUpdateToAllClients()
{
m_perfMonMS = Util.EnvironmentTickCount();
// only send update from root agents to other clients; children are only "listening posts"
if (IsChildAgent)
{
m_log.Warn("[SCENEPRESENCE] attempt to send update from a childagent");
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()
private 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);
bool cachedappearance = false;
// We have an appearance but we may not have the baked textures. Check the asset cache
// to see if all the baked textures are already here.
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());
}
cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient);
}
else
{
m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name);
}
// If we aren't using a cached appearance, then clear out the baked textures
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);
SendInitialFullUpdateToAllClients();
// 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>
///
/// 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>
public void SendAppearanceToAllOtherAgents()
public void SendAvatarDataToAllAgents()
{
// DEBUG ON
// m_log.WarnFormat("[SCENEPRESENCE]: Send appearance from {0} to all other agents", m_uuid);
// DEBUG OFF
// 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)
{
if (scenePresence.UUID != UUID)
{
SendAppearanceToOtherAgent(scenePresence);
}
SendAvatarDataToAgent(scenePresence);
count++;
});
m_scene.StatsReporter.AddAgentUpdates(count);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
}
/// <summary>
/// Send appearance data to an agent that isn't this one.
/// Send avatar data for all other root agents to this agent, this agent
/// can be either a child or root
/// </summary>
public void SendOtherAgentsAvatarDataToMe()
{
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.SendAvatarDataToAgent(this);
count++;
});
m_scene.StatsReporter.AddAgentUpdates(count);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
}
/// <summary>
/// Send avatar data to an agent.
/// </summary>
/// <param name="avatar"></param>
public void SendAppearanceToOtherAgent(ScenePresence avatar)
public void SendAvatarDataToAgent(ScenePresence avatar)
{
if (LocalId == avatar.LocalId)
// 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()
{
// only send update from root agents to other clients; children are only "listening posts"
if (IsChildAgent)
{
m_log.WarnFormat("[SCENE PRESENCE]: An agent is attempting to send appearance data to itself; {0}", UUID);
m_log.Warn("[SCENEPRESENCE] attempt to send avatar data from a child agent");
return;
}
m_perfMonMS = Util.EnvironmentTickCount();
// DEBUG ON
int count = 0;
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
{
if (scenePresence.UUID == UUID)
return;
SendAppearanceToAgent(scenePresence);
count++;
});
m_scene.StatsReporter.AddAgentUpdates(count);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
}
/// <summary>
/// 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>
/// <param name="avatar"></param>
public void SendAppearanceToAgent(ScenePresence avatar)
{
// m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
// DEBUG OFF
avatar.ControllingClient.SendAppearance(
m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
@ -3050,9 +3098,6 @@ namespace OpenSim.Region.Framework.Scenes
public void CopyFrom(AgentData cAgent)
{
// DEBUG ON
m_log.ErrorFormat("[SCENEPRESENCE] CALLING COPYFROM");
// DEBUG OFF
m_originRegionID = cAgent.RegionID;
m_callbackURI = cAgent.CallbackURI;

View File

@ -409,12 +409,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
#region SOPXmlProcessors
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)
{
obj.CreatorID = ReadUUID(reader, "CreatorID");
obj.CreatorID = Util.ReadUUID(reader, "CreatorID");
}
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)
{
obj.FolderID = ReadUUID(reader, "FolderID");
obj.FolderID = Util.ReadUUID(reader, "FolderID");
}
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)
{
obj.UUID = ReadUUID(reader, "UUID");
obj.UUID = Util.ReadUUID(reader, "UUID");
}
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)
{
obj.PassTouches = reader.ReadElementContentAsBoolean("PassTouches", String.Empty);
obj.PassTouches = Util.ReadBoolean(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)
{
obj.GroupPosition = ReadVector(reader, "GroupPosition");
obj.GroupPosition = Util.ReadVector(reader, "GroupPosition");
}
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)
{
obj.RotationOffset = ReadQuaternion(reader, "RotationOffset");
obj.RotationOffset = Util.ReadQuaternion(reader, "RotationOffset");
}
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)
{
obj.AngularVelocity = ReadVector(reader, "AngularVelocity");
obj.AngularVelocity = Util.ReadVector(reader, "AngularVelocity");
}
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)
@ -553,7 +553,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
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)
@ -563,22 +563,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
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)
{
obj.SitTargetPosition = ReadVector(reader, "SitTargetPosition");
obj.SitTargetPosition = Util.ReadVector(reader, "SitTargetPosition");
}
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)
{
obj.SitTargetOrientationLL = ReadQuaternion(reader, "SitTargetOrientationLL");
obj.SitTargetOrientationLL = Util.ReadQuaternion(reader, "SitTargetOrientationLL");
}
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)
{
obj.GroupID = ReadUUID(reader, "GroupID");
obj.GroupID = Util.ReadUUID(reader, "GroupID");
}
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)
{
obj.LastOwnerID = ReadUUID(reader, "LastOwnerID");
obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
}
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)
{
string value = reader.ReadElementContentAsString("Flags", String.Empty);
// !!!!! to deal with flags without commas
if (value.Contains(" ") && !value.Contains(","))
value = value.Replace(" ", ", ");
obj.Flags = (PrimFlags)Enum.Parse(typeof(PrimFlags), value);
obj.Flags = Util.ReadEnum<PrimFlags>(reader, "Flags");
}
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)
@ -690,7 +686,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
#region TaskInventoryXmlProcessors
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)
@ -705,7 +701,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
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)
@ -730,7 +726,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
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)
@ -745,20 +741,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
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)
{
ReadUUID(reader, "OldItemID");
Util.ReadUUID(reader, "OldItemID");
// On deserialization, the old item id MUST BE UUID.Zero!!!!!
// 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)
{
item.LastOwnerID = ReadUUID(reader, "LastOwnerID");
item.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
}
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)
{
item.OwnerID = ReadUUID(reader, "OwnerID");
item.OwnerID = Util.ReadUUID(reader, "OwnerID");
}
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)
{
item.ParentID = ReadUUID(reader, "ParentID");
item.ParentID = Util.ReadUUID(reader, "ParentID");
}
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)
{
item.PermsGranter = ReadUUID(reader, "PermsGranter");
item.PermsGranter = Util.ReadUUID(reader, "PermsGranter");
}
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)
{
item.OwnerChanged = reader.ReadElementContentAsBoolean("OwnerChanged", String.Empty);
item.OwnerChanged = Util.ReadBoolean(reader);
}
#endregion
@ -922,7 +918,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
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)
@ -932,25 +928,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader)
{
string value = reader.ReadElementContentAsString("ProfileShape", String.Empty);
// !!!!! to deal with flags without commas
if (value.Contains(" ") && !value.Contains(","))
value = value.Replace(" ", ", ");
shp.ProfileShape = (ProfileShape)Enum.Parse(typeof(ProfileShape), value);
shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape");
}
private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader)
{
string value = reader.ReadElementContentAsString("HollowShape", String.Empty);
// !!!!! to deal with flags without commas
if (value.Contains(" ") && !value.Contains(","))
value = value.Replace(" ", ", ");
shp.HollowShape = (HollowShape)Enum.Parse(typeof(HollowShape), value);
shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape");
}
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)
@ -1045,17 +1033,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
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)
{
shp.LightEntry = reader.ReadElementContentAsBoolean("LightEntry", String.Empty);
shp.LightEntry = Util.ReadBoolean(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)
@ -1220,16 +1208,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> options)
{
// Older versions of serialization can't cope with commas
if (options.ContainsKey("version"))
{
float version = 0.5F;
float.TryParse(options["version"].ToString(), out version);
if (version < 0.5)
flagsStr = flagsStr.Replace(",", "");
}
writer.WriteElementString(name, flagsStr);
// Older versions of serialization can't cope with commas, so we eliminate the commas
writer.WriteElementString(name, flagsStr.Replace(",", ""));
}
static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options, Scene scene)
@ -1459,66 +1439,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
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)
{
TaskInventoryDictionary tinv = new TaskInventoryDictionary();

View File

@ -121,13 +121,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
"Not exactly sure what this is asserting...");
// Delink part 2
grp1.DelinkFromGroup(part2.LocalId);
SceneObjectGroup grp3 = grp1.DelinkFromGroup(part2.LocalId);
if (debugtest)
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(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero");
Assert.That(grp3.HasGroupChangedDueToDelink, Is.True);
}
[Test]
@ -325,7 +326,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneObjectGroup sog = new SceneObjectGroup(rootPart);
sog.AddPart(linkPart);
scene.AddNewSceneObject(sog, true);
scene.AddNewSceneObject(sog, true);
// In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked
// scene backup thread.
@ -333,7 +334,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// These changes should occur immediately without waiting for a backup pass
SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.True);
scene.DeleteSceneObject(groupToDelete, false);
Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.False);
List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);

View File

@ -86,23 +86,33 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="assetUuids">The assets gathered</param>
public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, AssetType> assetUuids)
{
assetUuids[assetUuid] = assetType;
if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType)
{
GetWearableAssetUuids(assetUuid, assetUuids);
try
{
assetUuids[assetUuid] = assetType;
if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType)
{
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);
}
else if (AssetType.LSLText == assetType)
{
GetScriptAssetUuids(assetUuid, assetUuids);
}
else if (AssetType.Object == assetType)
{
GetSceneObjectAssetUuids(assetUuid, assetUuids);
m_log.ErrorFormat(
"[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}",
assetUuid, assetType);
throw;
}
}

View File

@ -132,7 +132,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
m_FreeswitchService = ServerUtils.LoadPlugin<IFreeswitchService>(serviceDll, args);
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);
m_freeSwitchAPIPrefix = map["APIPrefix"].AsString();
@ -363,8 +363,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
try
{
m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
request, path, param);
//m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
// request, path, param);
//XmlElement resp;
string agentname = "x" + Convert.ToBase64String(agentID.GetBytes());
@ -445,8 +445,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// voice channel
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}",
scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, request, path, param);
//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);
// TODO: EstateSettings don't seem to get propagated...
// if (!scene.RegionInfo.EstateSettings.AllowVoice)
@ -592,7 +592,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
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;
}
@ -664,7 +664,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
response["str_response_string"] = resp.ToString();
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;
}
@ -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,
requestbody);
//m_log.DebugFormat("[FreeSwitchVoice]: AUTH, URI: {0}, Content-Type:{1}, Body{2}", uri, contenttype,
// requestbody);
Hashtable response = new Hashtable();
response["str_response_string"] = string.Format(@"<response xsi:schemaLocation=""/xsd/signin.xsd"">
<level0>

View File

@ -1173,10 +1173,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
presence = scene.GetScenePresence(AgentID);
if (presence != null)
{
presence.Grouptitle = Title;
if (presence.Grouptitle != Title)
{
presence.Grouptitle = Title;
// FixMe: Ter suggests a "Schedule" method that I can't find.
presence.SendFullUpdateToAllClients();
if (! presence.IsChildAgent)
presence.SendAvatarDataToAllAgents();
}
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -276,7 +276,7 @@ namespace OpenSim.Region.Physics.Meshing
m_log.Debug("[MESH]: experimental mesh proxy generation");
OSD meshOsd;
OSD meshOsd = null;
if (primShape.SculptData.Length <= 0)
{
@ -287,7 +287,14 @@ namespace OpenSim.Region.Physics.Meshing
long start = 0;
using (MemoryStream data = new MemoryStream(primShape.SculptData))
{
meshOsd = (OSDMap)OSDParser.DeserializeLLSDBinary(data);
try
{
meshOsd = (OSDMap)OSDParser.DeserializeLLSDBinary(data);
}
catch (Exception e)
{
m_log.Error("[MESH]: Exception deserializing mesh asset header:" + e.ToString());
}
start = data.Position;
}

View File

@ -42,7 +42,8 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
NewRez = 1,
PrimCrossing = 2,
ScriptedRez = 3,
AttachedRez = 4
AttachedRez = 4,
Teleporting = 5
}
public interface IScriptWorkItem

View File

@ -7759,24 +7759,59 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
// TODO--------------
if (remain < 1)
return res;
face=(int)rules.GetLSLIntegerItem(idx++);
res.Add(new LSL_Integer(0));
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);
// 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;
case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
// TODO--------------
if (remain < 1)
return res;
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;
case (int)ScriptBaseClass.PRIM_FLEXIBLE:
@ -7797,14 +7832,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case (int)ScriptBaseClass.PRIM_TEXGEN:
// TODO--------------
// (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR)
if (remain < 1)
return res;
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;
case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
@ -7823,14 +7873,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case (int)ScriptBaseClass.PRIM_GLOW:
// TODO--------------
if (remain < 1)
return res;
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;
case (int)ScriptBaseClass.PRIM_TEXT:
Color4 textColor = part.GetTextColor();
res.Add(part.Text);

View File

@ -395,10 +395,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//
CheckThreatLevel(ThreatLevel.High, "osRegionRestart");
IRestartModule restartModule = World.RequestModuleInterface<IRestartModule>();
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;
}
else
@ -2315,4 +2334,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
}
}
}
}

View File

@ -390,19 +390,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
}
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",
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) },
new DetectParams[0]));
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) }, new DetectParams[0]));
}
else if (m_stateSource == StateSource.PrimCrossing)
else if (m_stateSource == StateSource.PrimCrossing || m_stateSource == StateSource.Teleporting)
{
// CHANGED_REGION
PostEvent(new EventParams("changed",
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) },
new DetectParams[0]));
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) }, 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
{
Start();

View File

@ -47,6 +47,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
{
private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6;
private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d;
private LSL_Api m_lslApi;
[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.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");
}
}
}

View File

@ -53,12 +53,15 @@ namespace OpenSim.Server.Handlers.Asset
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 };
m_AssetService =
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);
server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));

View File

@ -153,7 +153,7 @@ namespace OpenSim.Server.Handlers.Asset
}
catch (Exception e)
{
m_log.Debug("[XINVENTORY HANDLER]: Exception {0}", e);
m_log.DebugFormat("[XINVENTORY HANDLER]: Exception {0}", e);
}
return FailureResult();
@ -604,6 +604,10 @@ namespace OpenSim.Server.Handlers.Asset
ret["CreatorId"] = item.CreatorId.ToString();
else
ret["CreatorId"] = String.Empty;
if (item.CreatorData != null)
ret["CreatorData"] = item.CreatorData;
else
ret["CreatorData"] = String.Empty;
ret["CurrentPermissions"] = item.CurrentPermissions.ToString();
ret["Description"] = item.Description.ToString();
ret["EveryOnePermissions"] = item.EveryOnePermissions.ToString();

View File

@ -43,44 +43,51 @@ namespace OpenSim.Services.AssetService
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
protected static AssetService m_RootInstance;
public AssetService(IConfigSource config) : base(config)
{
MainConsole.Instance.Commands.AddCommand("kfs", false,
"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)
if (m_RootInstance == null)
{
IConfig assetConfig = config.Configs["AssetService"];
if (assetConfig == null)
throw new Exception("No AssetService configuration");
m_RootInstance = this;
string loaderArgs = assetConfig.GetString("AssetLoaderArgs",
String.Empty);
MainConsole.Instance.Commands.AddCommand("kfs", false,
"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);
m_AssetLoader.ForEachDefaultXmlAsset(loaderArgs,
delegate(AssetBase a)
{
Store(a);
});
IConfig assetConfig = config.Configs["AssetService"];
if (assetConfig == null)
throw new Exception("No AssetService configuration");
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");
}
m_log.Info("[ASSET SERVICE]: Local asset service enabled");
}
}
public AssetBase Get(string id)
public virtual AssetBase Get(string id)
{
UUID assetID;
@ -93,12 +100,12 @@ namespace OpenSim.Services.AssetService
return m_Database.GetAsset(assetID);
}
public AssetBase GetCached(string id)
public virtual AssetBase GetCached(string id)
{
return Get(id);
}
public AssetMetadata GetMetadata(string id)
public virtual AssetMetadata GetMetadata(string id)
{
UUID assetID;
@ -112,7 +119,7 @@ namespace OpenSim.Services.AssetService
return null;
}
public byte[] GetData(string id)
public virtual byte[] GetData(string id)
{
UUID assetID;
@ -123,7 +130,7 @@ namespace OpenSim.Services.AssetService
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);
@ -141,7 +148,7 @@ namespace OpenSim.Services.AssetService
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_Database.StoreAsset(asset);
@ -154,7 +161,7 @@ namespace OpenSim.Services.AssetService
return false;
}
public bool Delete(string id)
public virtual bool Delete(string id)
{
m_log.DebugFormat("[ASSET SERVICE]: Deleting asset {0}", id);
UUID assetID;

View File

@ -333,7 +333,8 @@ namespace OpenSim.Services.HypergridService
string addressee = parts[0];
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

View File

@ -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));
}
}
}

View File

@ -33,11 +33,20 @@ using Nini.Config;
using System.Reflection;
using OpenSim.Services.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Services.InventoryService;
using OpenSim.Data;
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
{
private static readonly ILog m_log =
@ -46,9 +55,16 @@ namespace OpenSim.Services.InventoryService
protected new IXInventoryData m_Database;
private string m_ProfileServiceURL;
private IUserAccountService m_UserAccountService;
private UserAccountCache m_Cache;
public HGInventoryService(IConfigSource config)
: base(config)
{
m_log.Debug("[HGInventory Service]: Starting");
string dllName = String.Empty;
string connString = String.Empty;
//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
//
IConfig authConfig = config.Configs["InventoryService"];
if (authConfig != null)
IConfig invConfig = config.Configs["HGInventoryService"];
if (invConfig != null)
{
dllName = authConfig.GetString("StorageProvider", dllName);
connString = authConfig.GetString("ConnectionString", connString);
dllName = invConfig.GetString("StorageProvider", dllName);
connString = invConfig.GetString("ConnectionString", connString);
// 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)
//{

View File

@ -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
}
}

View File

@ -761,6 +761,7 @@ namespace OpenSim.Services.LLLoginService
if (account.ServiceURLs == null)
return;
// Old style: get the service keys from the DB
foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
{
if (kvp.Value == null || (kvp.Value != null && kvp.Value.ToString() == string.Empty))
@ -772,6 +773,21 @@ namespace OpenSim.Services.LLLoginService
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)

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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.ScriptServer.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>

View File

@ -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>

View File

@ -13,6 +13,8 @@
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{HH:mm:ss} - %message" />
<!-- console log with milliseconds. Useful for debugging -->
<!-- <conversionPattern value="%date{HH:mm:ss.fff} - %message" /> -->
</layout>
</appender>

View File

@ -21,7 +21,7 @@
; * [[<ConfigName>@]<port>/]<dll name>[:<class name>]
; *
[Startup]
ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:AssetServiceConnector,8002/OpenSim.Server.Handlers.dll:HeloServiceInConnector"
ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,HGAssetService@8002/OpenSim.Server.Handlers.dll:AssetServiceConnector,8002/OpenSim.Server.Handlers.dll:HeloServiceInConnector"
; * This is common for all services, it's the network setup for the entire
; * server instance, if none if specified above
@ -154,10 +154,12 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; Defaults for the users, if none is specified in the useraccounts table entry (ServiceURLs)
; CHANGE THIS
HomeURI = "http://127.0.0.1:8002"
GatekeeperURI = "http://127.0.0.1:8002"
InventoryServerURI = "http://127.0.0.1:8002"
AssetServerURI = "http://127.0.0.1:8002"
GatekeeperURI = "http://127.0.0.1:8002"
SRV_HomeURI = "http://127.0.0.1:8002"
SRV_InventoryServerURI = "http://127.0.0.1:8002"
SRV_AssetServerURI = "http://127.0.0.1:8002"
SRV_ProfileServerURI = "http://127.0.0.1:8002"
[GridInfoService]
; These settings are used to return information on a get_grid_info call.
@ -169,7 +171,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; See http://opensimulator.org/wiki/GridInfo
; login uri: for grid this is the login server URI
login = http://127.0.0.1:9000/
login = http://127.0.0.1:8002/
; long grid name: the long name of your grid
gridname = "the lost continent of hippo"
@ -183,7 +185,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; helper uri: optional: if it exists if will be used to tell the client to use
; this for all economy related things
;economy = http://127.0.0.1:9000/
;economy = http://127.0.0.1:8002/
; web page of grid: optional: page providing further information about your grid
;about = http://127.0.0.1/about/
@ -241,4 +243,15 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; *
[HGInventoryService]
; For the InventoryServiceInConnector
LocalServiceModule = "OpenSim.Services.InventoryService.dll:HGInventoryService"
LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGInventoryService"
UserAccountsService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
ProfileServerURI = "http://127.0.0.1:8002/user"
; * The interface that local users get when they are in other grids.
; * This restricts the access that the rest of the world has to
; * the assets of this world.
; *
[HGAssetService]
LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGAssetService"
UserAccountsService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
ProfileServerURI = "http://127.0.0.1:8002/user"

View File

@ -78,6 +78,14 @@
;
FriendsServerURI = "http://mygridserver.com:8003"
[HGInventoryAccessModule]
;
; === HG ONLY ===
; Change this to your profile server
; accessible from other grids
;
ProfileServerURI = "http://mygridserver.com:8002/profiles"
[Modules]
;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists.
;; Copy the config .example file into your own .ini file and change configs there

View File

@ -25,6 +25,15 @@
DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll"
AssetLoaderArgs = "assets/AssetSets.xml"
[HGInventoryService]
ProfileServerURI = "http://127.0.0.1:9000/profiles"
[HGAssetService]
ProfileServerURI = "http://127.0.0.1:9000/profiles"
[HGInventoryAccessModule]
ProfileServerURI = "http://127.0.0.1:9000/profiles"
[Modules]
;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists.
;; Copy the config .example file into your own .ini file and change configs there
@ -68,11 +77,12 @@
[LoginService]
WelcomeMessage = "Welcome, Avatar!"
HomeURI = "http://127.0.0.1:9000"
GatekeeperURI = "http://127.0.0.1:9000"
InventoryServerURI = "http://127.0.0.1:9000"
AssetServerURI = "http://127.0.0.1:9000"
SRV_HomeURI = "http://127.0.0.1:9000"
SRV_InventoryServerURI = "http://127.0.0.1:9000"
SRV_AssetServerURI = "http://127.0.0.1:9000"
SRV_ProfileServerURI = "http://127.0.0.1:9000"
[GatekeeperService]
ExternalName = "http://127.0.0.1:9000"

View File

@ -128,8 +128,14 @@
;; This greatly restricts the inventory operations while in other grids
[HGInventoryService]
; For the InventoryServiceInConnector
LocalServiceModule = "OpenSim.Services.InventoryService.dll:HGInventoryService"
LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGInventoryService"
UserAccountsService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
;; The interface that local users get when they are in other grids
;; This restricts/filters the asset operations from the outside
[HGAssetService]
LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGAssetService"
UserAccountsService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
;; This should always be the very last thing on this file
[Includes]

View File

@ -175,6 +175,34 @@
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Services.Interfaces" path="OpenSim/Services/Interfaces" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="Nini" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Framework.Serialization" path="OpenSim/Framework/Serialization" type="Library">
<Configuration name="Debug">
<Options>
@ -194,6 +222,7 @@
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Services.Interfaces"/>
<Files>
<Match pattern="*.cs" recurse="true">
@ -631,35 +660,6 @@
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Services.Interfaces" path="OpenSim/Services/Interfaces" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="Nini" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Framework.Capabilities" path="OpenSim/Framework/Capabilities" type="Library">
<Configuration name="Debug">
<Options>
@ -1253,10 +1253,13 @@
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Serialization"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenSim.Services.Base"/>
<Reference name="OpenSim.Services.AssetService"/>
<Reference name="OpenSim.Services.InventoryService"/>
<Reference name="OpenSim.Services.Connectors"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Server.Base"/>