Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
commit
835103af82
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
@ -263,6 +217,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
|
||||
// load. This means that here we deal with replaceable interfaces,
|
||||
|
|
|
@ -2636,8 +2636,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
string text;
|
||||
int health = scene.GetHealth(out flags, out text);
|
||||
responseData["health"] = health;
|
||||
responseData["flags"] = health;
|
||||
responseData["message"] = health;
|
||||
responseData["flags"] = flags;
|
||||
responseData["message"] = text;
|
||||
|
||||
response.Value = responseData;
|
||||
}
|
||||
|
|
|
@ -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 };
|
||||
|
@ -255,7 +273,7 @@ namespace OpenSim.Framework
|
|||
|
||||
protected virtual void SetDefaultTexture()
|
||||
{
|
||||
m_texture = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97"));
|
||||
m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE));
|
||||
|
||||
// for (uint i = 0; i < TEXTURE_COUNT; i++)
|
||||
// m_texture.CreateFace(i).TextureID = new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE);
|
||||
|
|
|
@ -1332,7 +1332,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
newAssetID = UUID.Random();
|
||||
uploaderPath = path;
|
||||
httpListener = httpServer;
|
||||
// m_log.WarnFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
|
||||
m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1362,6 +1362,8 @@ namespace OpenSim.Framework.Capabilities
|
|||
handlerUpLoad(newAssetID, data);
|
||||
}
|
||||
|
||||
m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -361,13 +361,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...");
|
||||
|
||||
if (m_securePermissionsLoading)
|
||||
{
|
||||
|
|
|
@ -3604,22 +3604,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId))
|
||||
continue;
|
||||
|
||||
// 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.IsDeleted)
|
||||
continue;
|
||||
|
||||
if (part.ParentGroup.IsAttachment)
|
||||
{ // Someone else's HUD, why are we getting these?
|
||||
if (part.ParentGroup.OwnerID != AgentId &&
|
||||
part.ParentGroup.RootPart.Shape.State >= 30)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (part.ParentGroup.IsAttachment && m_disableFacelights)
|
||||
|
|
|
@ -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,66 @@ 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 = Manager.MyScene.AssetService.Get(assetID.ToString());
|
||||
|
||||
if (asset == null)
|
||||
// Here we need to get the old asset to extract the
|
||||
// texture UUIDs if it's a wearable.
|
||||
if (item.AssetType == (int)AssetType.Bodypart ||
|
||||
item.AssetType == (int)AssetType.Clothing)
|
||||
{
|
||||
asset = GetTransactionAsset(transactionID);
|
||||
AssetBase oldAsset = m_Scene.AssetService.Get(item.AssetID.ToString());
|
||||
if (oldAsset != null)
|
||||
XferUploaders[transactionID].SetOldData(oldAsset.Data);
|
||||
}
|
||||
|
||||
if (asset != null && asset.FullID == assetID)
|
||||
AssetBase asset = GetTransactionAsset(transactionID);
|
||||
|
||||
if (asset != null)
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -28,16 +28,19 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
{
|
||||
public class AssetXferUploader
|
||||
{
|
||||
// Viewer's notion of the default texture
|
||||
private UUID defaultID = new UUID("5748decc-f629-461c-9a36-a35a221fe21f");
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private AssetBase m_asset;
|
||||
|
@ -50,17 +53,18 @@ 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;
|
||||
private byte[] m_oldData = null;
|
||||
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 +112,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 +143,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 +159,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 +191,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 +223,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
|
||||
private void DoCreateItem(uint callbackID)
|
||||
{
|
||||
m_userTransactions.Manager.MyScene.AssetService.Store(m_asset);
|
||||
ValidateAssets();
|
||||
m_Scene.AssetService.Store(m_asset);
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.Owner = ourClient.AgentId;
|
||||
|
@ -232,12 +244,77 @@ 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");
|
||||
}
|
||||
|
||||
private void ValidateAssets()
|
||||
{
|
||||
if (m_asset.Type == (sbyte)AssetType.Clothing ||
|
||||
m_asset.Type == (sbyte)AssetType.Bodypart)
|
||||
{
|
||||
string content = System.Text.Encoding.ASCII.GetString(m_asset.Data);
|
||||
string[] lines = content.Split(new char[] {'\n'});
|
||||
|
||||
List<string> validated = new List<string>();
|
||||
|
||||
Dictionary<int, UUID> allowed = ExtractTexturesFromOldData();
|
||||
|
||||
int textures = 0;
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (line.StartsWith("textures "))
|
||||
{
|
||||
textures = Convert.ToInt32(line.Substring(9));
|
||||
validated.Add(line);
|
||||
}
|
||||
else if (textures > 0)
|
||||
{
|
||||
string[] parts = line.Split(new char[] {' '});
|
||||
|
||||
UUID tx = new UUID(parts[1]);
|
||||
int id = Convert.ToInt32(parts[0]);
|
||||
|
||||
if (tx == defaultID || tx == UUID.Zero ||
|
||||
(allowed.ContainsKey(id) && allowed[id] == tx))
|
||||
{
|
||||
validated.Add(parts[0] + " " + tx.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
int perms = m_Scene.InventoryService.GetAssetPermissions(ourClient.AgentId, tx);
|
||||
int full = (int)(PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Copy);
|
||||
|
||||
if ((perms & full) != full)
|
||||
{
|
||||
m_log.ErrorFormat("[ASSET UPLOADER]: REJECTED update with texture {0} from {1} because they do not own the texture", tx, ourClient.AgentId);
|
||||
validated.Add(parts[0] + " " + defaultID.ToString());
|
||||
}
|
||||
}
|
||||
textures--;
|
||||
}
|
||||
else
|
||||
{
|
||||
validated.Add(line);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// If it's malformed, skip it
|
||||
}
|
||||
}
|
||||
|
||||
string final = String.Join("\n", validated.ToArray());
|
||||
|
||||
m_asset.Data = System.Text.Encoding.ASCII.GetBytes(final);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the asset data uploaded in this transfer.
|
||||
/// </summary>
|
||||
|
@ -246,10 +323,55 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
{
|
||||
if (m_finished)
|
||||
{
|
||||
ValidateAssets();
|
||||
return m_asset;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void SetOldData(byte[] d)
|
||||
{
|
||||
m_oldData = d;
|
||||
}
|
||||
|
||||
private Dictionary<int,UUID> ExtractTexturesFromOldData()
|
||||
{
|
||||
Dictionary<int,UUID> result = new Dictionary<int,UUID>();
|
||||
if (m_oldData == null)
|
||||
return result;
|
||||
|
||||
string content = System.Text.Encoding.ASCII.GetString(m_oldData);
|
||||
string[] lines = content.Split(new char[] {'\n'});
|
||||
|
||||
int textures = 0;
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (line.StartsWith("textures "))
|
||||
{
|
||||
textures = Convert.ToInt32(line.Substring(9));
|
||||
}
|
||||
else if (textures > 0)
|
||||
{
|
||||
string[] parts = line.Split(new char[] {' '});
|
||||
|
||||
UUID tx = new UUID(parts[1]);
|
||||
int id = Convert.ToInt32(parts[0]);
|
||||
result[id] = tx;
|
||||
textures--;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// If it's malformed, skip it
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,12 @@ 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);
|
||||
|
@ -157,12 +162,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
// one and we're done otherwise, ask for a rebake
|
||||
if (checkonly) return false;
|
||||
|
||||
m_log.WarnFormat("[AVFACTORY] missing baked texture {0}, request rebake",face.TextureID);
|
||||
m_log.InfoFormat("[AVFACTORY] missing baked texture {0}, request rebake",face.TextureID);
|
||||
client.SendRebakeAvatarTextures(face.TextureID);
|
||||
}
|
||||
}
|
||||
|
||||
m_log.WarnFormat("[AVFACTORY]: complete texture check for {0}",client.AgentId);
|
||||
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);
|
||||
|
@ -182,8 +187,10 @@ 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
|
||||
|
@ -203,7 +210,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
{
|
||||
changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
|
||||
|
||||
m_log.WarnFormat("[AVFACTORY]: received texture update for {0}",client.AgentId);
|
||||
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
|
||||
|
@ -216,13 +223,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
|
||||
}
|
||||
|
||||
// // 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());
|
||||
}
|
||||
|
||||
|
@ -377,9 +377,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
|
||||
// m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}", client.AgentId);
|
||||
|
||||
// we need to clean out the existing textures
|
||||
sp.Appearance.ResetAppearance();
|
||||
|
||||
// operate on a copy of the appearance so we don't have to lock anything
|
||||
AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false);
|
||||
sp.Appearance.ResetBakedTextures(); // this makes sure we don't reuse old textures if the baking takes time
|
||||
|
||||
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -2392,15 +2392,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -2527,7 +2525,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return true;
|
||||
}
|
||||
|
||||
private void TriggerChangedTeleport(SceneObjectGroup sog)
|
||||
private int GetStateSource(SceneObjectGroup sog)
|
||||
{
|
||||
ScenePresence sp = GetScenePresence(sog.OwnerID);
|
||||
|
||||
|
@ -2538,13 +2536,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
|
||||
|
|
|
@ -1639,6 +1639,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
parentGroup.areUpdatesSuspended = false;
|
||||
parentGroup.HasGroupChanged = true;
|
||||
parentGroup.ProcessBackup(m_parentScene.SimulationDataService, true);
|
||||
parentGroup.ScheduleGroupForFullUpdate();
|
||||
Monitor.Exit(m_updateLock);
|
||||
}
|
||||
|
|
|
@ -2789,7 +2789,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// If we aren't using a cached appearance, then clear out the baked textures
|
||||
if (! cachedappearance)
|
||||
{
|
||||
m_appearance.ResetBakedTextures();
|
||||
m_appearance.ResetAppearance();
|
||||
if (m_scene.AvatarFactory != null)
|
||||
m_scene.AvatarFactory.QueueAppearanceSave(UUID);
|
||||
}
|
||||
|
@ -2799,12 +2799,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// again here... this comes after the cached appearance check because the avatars
|
||||
// appearance goes into the avatar update packet
|
||||
SendAvatarDataToAllAgents();
|
||||
SendAppearanceToAgent(this);
|
||||
|
||||
// If we are using the the cached appearance then send it out to everyone
|
||||
if (cachedappearance)
|
||||
{
|
||||
m_log.WarnFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name);
|
||||
SendAppearanceToAgent(this);
|
||||
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
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Example.BareBonesNonShared
|
||||
{
|
||||
/// <summary>
|
||||
/// Simplest possible example of a non-shared region module.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This module is the simplest possible example of a non-shared region module (a module where each scene/region
|
||||
/// in the simulator has its own copy). If anybody wants to create a more complex example in the future then
|
||||
/// please create a separate class.
|
||||
///
|
||||
/// This module is not active by default. If you want to see it in action,
|
||||
/// then just uncomment the line below starting with [Extension(Path...
|
||||
///
|
||||
/// When the module is enabled it will print messages when it receives certain events to the screen and the log
|
||||
/// file.
|
||||
/// </remarks>
|
||||
//[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BareBonesNonSharedModule")]
|
||||
public class BareBonesNonSharedModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public string Name { get { return "Bare Bones Non Shared Module"; } }
|
||||
|
||||
public Type ReplaceableInterface { get { return null; } }
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
m_log.DebugFormat("[BARE BONES NON SHARED]: INITIALIZED MODULE");
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
m_log.DebugFormat("[BARE BONES NON SHARED]: CLOSED MODULE");
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
m_log.DebugFormat("[BARE BONES NON SHARED]: REGION {0} ADDED", scene.RegionInfo.RegionName);
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
m_log.DebugFormat("[BARE BONES NON SHARED]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
m_log.DebugFormat("[BARE BONES NON SHARED]: REGION {0} LOADED", scene.RegionInfo.RegionName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Example.BareBonesShared
|
||||
{
|
||||
/// <summary>
|
||||
/// Simplest possible example of a shared region module.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This module is the simplest possible example of a shared region module (a module which is shared by every
|
||||
/// scene/region running on the simulator). If anybody wants to create a more complex example in the future then
|
||||
/// please create a separate class.
|
||||
///
|
||||
/// This module is not active by default. If you want to see it in action,
|
||||
/// then just uncomment the line below starting with [Extension(Path...
|
||||
///
|
||||
/// When the module is enabled it will print messages when it receives certain events to the screen and the log
|
||||
/// file.
|
||||
/// </remarks>
|
||||
//[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BareBonesSharedModule")]
|
||||
public class BareBonesSharedModule : ISharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public string Name { get { return "Bare Bones Shared Module"; } }
|
||||
|
||||
public Type ReplaceableInterface { get { return null; } }
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
m_log.DebugFormat("[BARE BONES SHARED]: INITIALIZED MODULE");
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
m_log.DebugFormat("[BARE BONES SHARED]: POST INITIALIZED MODULE");
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
m_log.DebugFormat("[BARE BONES SHARED]: CLOSED MODULE");
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
m_log.DebugFormat("[BARE BONES SHARED]: REGION {0} ADDED", scene.RegionInfo.RegionName);
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
m_log.DebugFormat("[BARE BONES SHARED]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
m_log.DebugFormat("[BARE BONES SHARED]: REGION {0} LOADED", scene.RegionInfo.RegionName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -42,7 +42,8 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
|||
NewRez = 1,
|
||||
PrimCrossing = 2,
|
||||
ScriptedRez = 3,
|
||||
AttachedRez = 4
|
||||
AttachedRez = 4,
|
||||
Teleporting = 5
|
||||
}
|
||||
|
||||
public interface IScriptWorkItem
|
||||
|
|
|
@ -391,17 +391,20 @@ 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
|
||||
|
|
Loading…
Reference in New Issue