Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs OpenSim/Region/OptionalModules/World/NPC/NPCModule.csavinationmerge
commit
d9b149b375
|
@ -99,12 +99,12 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
|
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
|
||||||
|
|
||||||
m_log.Info("[LOAD REGIONS PLUGIN]: Loading specific shared modules...");
|
m_log.Info("[LOAD REGIONS PLUGIN]: Loading specific shared modules...");
|
||||||
m_log.Info("[LOAD REGIONS PLUGIN]: DynamicTextureModule...");
|
//m_log.Info("[LOAD REGIONS PLUGIN]: DynamicTextureModule...");
|
||||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
|
//m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
|
||||||
m_log.Info("[LOAD REGIONS PLUGIN]: LoadImageURLModule...");
|
//m_log.Info("[LOAD REGIONS PLUGIN]: LoadImageURLModule...");
|
||||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
|
//m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
|
||||||
m_log.Info("[LOAD REGIONS PLUGIN]: XMLRPCModule...");
|
//m_log.Info("[LOAD REGIONS PLUGIN]: XMLRPCModule...");
|
||||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
|
//m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
|
||||||
// m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
|
// m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
|
||||||
// m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
|
// m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
|
||||||
m_log.Info("[LOAD REGIONS PLUGIN]: Done.");
|
m_log.Info("[LOAD REGIONS PLUGIN]: Done.");
|
||||||
|
|
|
@ -55,6 +55,16 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||||
private readonly Dictionary<UUID, List<DecodedCallback>> m_notifyList = new Dictionary<UUID, List<DecodedCallback>>();
|
private readonly Dictionary<UUID, List<DecodedCallback>> m_notifyList = new Dictionary<UUID, List<DecodedCallback>>();
|
||||||
/// <summary>Cache that will store decoded JPEG2000 layer boundary data</summary>
|
/// <summary>Cache that will store decoded JPEG2000 layer boundary data</summary>
|
||||||
private IImprovedAssetCache m_cache;
|
private IImprovedAssetCache m_cache;
|
||||||
|
private IImprovedAssetCache Cache
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (m_cache == null)
|
||||||
|
m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
|
||||||
|
|
||||||
|
return m_cache;
|
||||||
|
}
|
||||||
|
}
|
||||||
/// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary>
|
/// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary>
|
||||||
private UUID m_CreatorID = UUID.Zero;
|
private UUID m_CreatorID = UUID.Zero;
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
|
@ -98,7 +108,6 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
@ -297,7 +306,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||||
{
|
{
|
||||||
m_decodedCache.AddOrUpdate(AssetId, Layers, TimeSpan.FromMinutes(10));
|
m_decodedCache.AddOrUpdate(AssetId, Layers, TimeSpan.FromMinutes(10));
|
||||||
|
|
||||||
if (m_cache != null)
|
if (Cache != null)
|
||||||
{
|
{
|
||||||
string assetID = "j2kCache_" + AssetId.ToString();
|
string assetID = "j2kCache_" + AssetId.ToString();
|
||||||
|
|
||||||
|
@ -321,7 +330,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||||
|
|
||||||
#endregion Serialize Layer Data
|
#endregion Serialize Layer Data
|
||||||
|
|
||||||
m_cache.Cache(layerDecodeAsset);
|
Cache.Cache(layerDecodeAsset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,10 +340,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (m_cache != null)
|
else if (Cache != null)
|
||||||
{
|
{
|
||||||
string assetName = "j2kCache_" + AssetId.ToString();
|
string assetName = "j2kCache_" + AssetId.ToString();
|
||||||
AssetBase layerDecodeAsset = m_cache.Get(assetName);
|
AssetBase layerDecodeAsset = Cache.Get(assetName);
|
||||||
|
|
||||||
if (layerDecodeAsset != null)
|
if (layerDecodeAsset != null)
|
||||||
{
|
{
|
||||||
|
@ -346,7 +355,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||||
if (lines.Length == 0)
|
if (lines.Length == 0)
|
||||||
{
|
{
|
||||||
m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (empty) " + assetName);
|
m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (empty) " + assetName);
|
||||||
m_cache.Expire(assetName);
|
Cache.Expire(assetName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,7 +376,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||||
catch (FormatException)
|
catch (FormatException)
|
||||||
{
|
{
|
||||||
m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (format) " + assetName);
|
m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (format) " + assetName);
|
||||||
m_cache.Expire(assetName);
|
Cache.Expire(assetName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,7 +387,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (layout) " + assetName);
|
m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (layout) " + assetName);
|
||||||
m_cache.Expire(assetName);
|
Cache.Expire(assetName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,12 @@ using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using log4net;
|
using log4net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||||
{
|
{
|
||||||
public class DynamicTextureModule : IRegionModule, IDynamicTextureManager
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DynamicTextureModule")]
|
||||||
|
public class DynamicTextureModule : ISharedRegionModule, IDynamicTextureManager
|
||||||
{
|
{
|
||||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -81,6 +83,16 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private Cache m_reuseableDynamicTextures;
|
private Cache m_reuseableDynamicTextures;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This constructor is only here because of the Unit Tests...
|
||||||
|
/// Don't use it.
|
||||||
|
/// </summary>
|
||||||
|
public DynamicTextureModule()
|
||||||
|
{
|
||||||
|
m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative);
|
||||||
|
m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
#region IDynamicTextureManager Members
|
#region IDynamicTextureManager Members
|
||||||
|
|
||||||
public void RegisterRender(string handleType, IDynamicTextureRender render)
|
public void RegisterRender(string handleType, IDynamicTextureRender render)
|
||||||
|
@ -323,17 +335,30 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region ISharedRegionModule Members
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
IConfig texturesConfig = config.Configs["Textures"];
|
IConfig texturesConfig = config.Configs["Textures"];
|
||||||
if (texturesConfig != null)
|
if (texturesConfig != null)
|
||||||
{
|
{
|
||||||
ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false);
|
ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false);
|
||||||
ReuseLowDataTextures = texturesConfig.GetBoolean("ReuseDynamicLowDataTextures", false);
|
ReuseLowDataTextures = texturesConfig.GetBoolean("ReuseDynamicLowDataTextures", false);
|
||||||
}
|
|
||||||
|
|
||||||
|
if (ReuseTextures)
|
||||||
|
{
|
||||||
|
m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative);
|
||||||
|
m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PostInitialise()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
|
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
|
||||||
{
|
{
|
||||||
RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
|
RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
|
||||||
|
@ -341,13 +366,14 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void RegionLoaded(Scene scene)
|
||||||
{
|
{
|
||||||
if (ReuseTextures)
|
}
|
||||||
{
|
|
||||||
m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative);
|
public void RemoveRegion(Scene scene)
|
||||||
m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0);
|
{
|
||||||
}
|
if (RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
|
||||||
|
RegisteredScenes.Remove(scene.RegionInfo.RegionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
@ -359,9 +385,9 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||||
get { return "DynamicTextureModule"; }
|
get { return "DynamicTextureModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -37,10 +37,12 @@ using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||||
{
|
{
|
||||||
public class EmailModule : IRegionModule, IEmailModule
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EmailModule")]
|
||||||
|
public class EmailModule : ISharedRegionModule, IEmailModule
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Log
|
// Log
|
||||||
|
@ -72,31 +74,9 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||||
|
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
|
|
||||||
public void InsertEmail(UUID to, Email email)
|
#region ISharedRegionModule
|
||||||
{
|
|
||||||
// It's tempting to create the queue here. Don't; objects which have
|
|
||||||
// not yet called GetNextEmail should have no queue, and emails to them
|
|
||||||
// should be silently dropped.
|
|
||||||
|
|
||||||
lock (m_MailQueues)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
|
||||||
if (m_MailQueues.ContainsKey(to))
|
|
||||||
{
|
|
||||||
if (m_MailQueues[to].Count >= m_MaxQueueSize)
|
|
||||||
{
|
|
||||||
// fail silently
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
lock (m_MailQueues[to])
|
|
||||||
{
|
|
||||||
m_MailQueues[to].Add(email);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
|
||||||
{
|
{
|
||||||
m_Config = config;
|
m_Config = config;
|
||||||
IConfig SMTPConfig;
|
IConfig SMTPConfig;
|
||||||
|
@ -129,36 +109,44 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||||
SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT);
|
SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT);
|
||||||
SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN);
|
SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN);
|
||||||
SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD);
|
SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD);
|
||||||
m_MaxEmailSize = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize);
|
m_MaxEmailSize = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[EMAIL] DefaultEmailModule not configured: "+ e.Message);
|
m_log.Error("[EMAIL] DefaultEmailModule not configured: " + e.Message);
|
||||||
m_Enabled = false;
|
m_Enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// It's a go!
|
}
|
||||||
if (m_Enabled)
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// It's a go!
|
||||||
|
lock (m_Scenes)
|
||||||
{
|
{
|
||||||
lock (m_Scenes)
|
// Claim the interface slot
|
||||||
|
scene.RegisterModuleInterface<IEmailModule>(this);
|
||||||
|
|
||||||
|
// Add to scene list
|
||||||
|
if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle))
|
||||||
{
|
{
|
||||||
// Claim the interface slot
|
m_Scenes[scene.RegionInfo.RegionHandle] = scene;
|
||||||
scene.RegisterModuleInterface<IEmailModule>(this);
|
}
|
||||||
|
else
|
||||||
// Add to scene list
|
{
|
||||||
if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle))
|
m_Scenes.Add(scene.RegionInfo.RegionHandle, scene);
|
||||||
{
|
|
||||||
m_Scenes[scene.RegionInfo.RegionHandle] = scene;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_Scenes.Add(scene.RegionInfo.RegionHandle, scene);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Info("[EMAIL] Activated DefaultEmailModule");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_log.Info("[EMAIL] Activated DefaultEmailModule");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
|
@ -174,9 +162,39 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||||
get { return "DefaultEmailModule"; }
|
get { return "DefaultEmailModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public void InsertEmail(UUID to, Email email)
|
||||||
|
{
|
||||||
|
// It's tempting to create the queue here. Don't; objects which have
|
||||||
|
// not yet called GetNextEmail should have no queue, and emails to them
|
||||||
|
// should be silently dropped.
|
||||||
|
|
||||||
|
lock (m_MailQueues)
|
||||||
|
{
|
||||||
|
if (m_MailQueues.ContainsKey(to))
|
||||||
|
{
|
||||||
|
if (m_MailQueues[to].Count >= m_MaxQueueSize)
|
||||||
|
{
|
||||||
|
// fail silently
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lock (m_MailQueues[to])
|
||||||
|
{
|
||||||
|
m_MailQueues[to].Add(email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsLocal(UUID objectID)
|
private bool IsLocal(UUID objectID)
|
||||||
|
|
|
@ -41,6 +41,7 @@ using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
*
|
*
|
||||||
|
@ -87,7 +88,8 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||||
{
|
{
|
||||||
public class HttpRequestModule : IRegionModule, IHttpRequestModule
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HttpRequestModule")]
|
||||||
|
public class HttpRequestModule : ISharedRegionModule, IHttpRequestModule
|
||||||
{
|
{
|
||||||
private object HttpListLock = new object();
|
private object HttpListLock = new object();
|
||||||
private int httpTimeout = 30000;
|
private int httpTimeout = 30000;
|
||||||
|
@ -270,24 +272,38 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region ISharedRegionModule Members
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
|
||||||
|
|
||||||
m_scene.RegisterModuleInterface<IHttpRequestModule>(this);
|
|
||||||
|
|
||||||
m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
|
m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
|
||||||
m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
|
m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
|
||||||
|
|
||||||
m_pendingRequests = new Dictionary<UUID, HttpRequestClass>();
|
m_pendingRequests = new Dictionary<UUID, HttpRequestClass>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
m_scene = scene;
|
||||||
|
|
||||||
|
m_scene.RegisterModuleInterface<IHttpRequestModule>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
scene.UnregisterModuleInterface<IHttpRequestModule>(this);
|
||||||
|
if (scene == m_scene)
|
||||||
|
m_scene = null;
|
||||||
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -297,9 +313,9 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||||
get { return m_name; }
|
get { return m_name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -37,10 +37,12 @@ using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using log4net;
|
using log4net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
||||||
{
|
{
|
||||||
public class LoadImageURLModule : IRegionModule, IDynamicTextureRender
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LoadImageURLModule")]
|
||||||
|
public class LoadImageURLModule : ISharedRegionModule, IDynamicTextureRender
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -104,22 +106,32 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region ISharedRegionModule Members
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
if (m_scene == null)
|
|
||||||
{
|
|
||||||
m_scene = scene;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
|
m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
|
||||||
m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
|
m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
if (m_scene != null)
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (m_scene == null)
|
||||||
|
m_scene = scene;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
if (m_textureManager == null && m_scene == scene)
|
||||||
{
|
{
|
||||||
m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
|
m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
|
||||||
if (m_textureManager != null)
|
if (m_textureManager != null)
|
||||||
|
@ -138,9 +150,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
||||||
get { return m_name; }
|
get { return m_name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -172,6 +184,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
||||||
|
|
||||||
private void HttpRequestReturn(IAsyncResult result)
|
private void HttpRequestReturn(IAsyncResult result)
|
||||||
{
|
{
|
||||||
|
if (m_textureManager == null)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[LOADIMAGEURLMODULE]: No texture manager. Can't function.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
RequestState state = (RequestState) result.AsyncState;
|
RequestState state = (RequestState) result.AsyncState;
|
||||||
WebRequest request = (WebRequest) state.Request;
|
WebRequest request = (WebRequest) state.Request;
|
||||||
Stream stream = null;
|
Stream stream = null;
|
||||||
|
|
|
@ -40,12 +40,14 @@ using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using log4net;
|
using log4net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
//using Cairo;
|
//using Cairo;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||||
{
|
{
|
||||||
public class VectorRenderModule : IRegionModule, IDynamicTextureRender
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "VectorRenderModule")]
|
||||||
|
public class VectorRenderModule : ISharedRegionModule, IDynamicTextureRender
|
||||||
{
|
{
|
||||||
// These fields exist for testing purposes, please do not remove.
|
// These fields exist for testing purposes, please do not remove.
|
||||||
// private static bool s_flipper;
|
// private static bool s_flipper;
|
||||||
|
@ -56,6 +58,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||||
|
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
private IDynamicTextureManager m_textureManager;
|
private IDynamicTextureManager m_textureManager;
|
||||||
|
|
||||||
private Graphics m_graph;
|
private Graphics m_graph;
|
||||||
private string m_fontName = "Arial";
|
private string m_fontName = "Arial";
|
||||||
|
|
||||||
|
@ -103,6 +106,11 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||||
|
|
||||||
public bool AsyncConvertData(UUID id, string bodyData, string extraParams)
|
public bool AsyncConvertData(UUID id, string bodyData, string extraParams)
|
||||||
{
|
{
|
||||||
|
if (m_textureManager == null)
|
||||||
|
{
|
||||||
|
m_log.Warn("[VECTORRENDERMODULE]: No texture manager. Can't function");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// XXX: This isn't actually being done asynchronously!
|
// XXX: This isn't actually being done asynchronously!
|
||||||
m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams));
|
m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams));
|
||||||
|
|
||||||
|
@ -131,45 +139,49 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region ISharedRegionModule Members
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
if (m_scene == null)
|
|
||||||
{
|
|
||||||
m_scene = scene;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_graph == null)
|
|
||||||
{
|
|
||||||
// We won't dispose of these explicitly since this module is only removed when the entire simulator
|
|
||||||
// is shut down.
|
|
||||||
Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb);
|
|
||||||
m_graph = Graphics.FromImage(bitmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
IConfig cfg = config.Configs["VectorRender"];
|
IConfig cfg = config.Configs["VectorRender"];
|
||||||
if (null != cfg)
|
if (null != cfg)
|
||||||
{
|
{
|
||||||
m_fontName = cfg.GetString("font_name", m_fontName);
|
m_fontName = cfg.GetString("font_name", m_fontName);
|
||||||
}
|
}
|
||||||
m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName);
|
m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName);
|
||||||
|
|
||||||
|
// We won't dispose of these explicitly since this module is only removed when the entire simulator
|
||||||
|
// is shut down.
|
||||||
|
Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb);
|
||||||
|
m_graph = Graphics.FromImage(bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
|
}
|
||||||
if (m_textureManager != null)
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (m_scene == null)
|
||||||
{
|
{
|
||||||
m_textureManager.RegisterRender(GetContentType(), this);
|
m_scene = scene;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This code exists for testing purposes, please do not remove.
|
public void RegionLoaded(Scene scene)
|
||||||
// s_asset1Data = m_scene.AssetService.Get("00000000-0000-1111-9999-000000000001").Data;
|
{
|
||||||
// s_asset1Data = m_scene.AssetService.Get("9f4acf0d-1841-4e15-bdb8-3a12efc9dd8f").Data;
|
if (m_textureManager == null && m_scene == scene)
|
||||||
|
{
|
||||||
|
m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
|
||||||
|
if (m_textureManager != null)
|
||||||
|
{
|
||||||
|
m_textureManager.RegisterRender(GetContentType(), this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Terrain dirt - smallest bin/assets file (6004 bytes)
|
public void RemoveRegion(Scene scene)
|
||||||
// s_asset2Data = m_scene.AssetService.Get("b8d3965a-ad78-bf43-699b-bff8eca6c975").Data;
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
@ -181,9 +193,9 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||||
get { return "VectorRenderModule"; }
|
get { return "VectorRenderModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -40,6 +40,7 @@ using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
*
|
*
|
||||||
|
@ -76,7 +77,8 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
|
namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
|
||||||
{
|
{
|
||||||
public class XMLRPCModule : IRegionModule, IXMLRPC
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XMLRPCModule")]
|
||||||
|
public class XMLRPCModule : ISharedRegionModule, IXMLRPC
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -86,6 +88,10 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
|
||||||
private Dictionary<UUID, RPCChannelInfo> m_openChannels;
|
private Dictionary<UUID, RPCChannelInfo> m_openChannels;
|
||||||
private Dictionary<UUID, SendRemoteDataRequest> m_pendingSRDResponses;
|
private Dictionary<UUID, SendRemoteDataRequest> m_pendingSRDResponses;
|
||||||
private int m_remoteDataPort = 0;
|
private int m_remoteDataPort = 0;
|
||||||
|
public int Port
|
||||||
|
{
|
||||||
|
get { return m_remoteDataPort; }
|
||||||
|
}
|
||||||
|
|
||||||
private Dictionary<UUID, RPCRequestInfo> m_rpcPending;
|
private Dictionary<UUID, RPCRequestInfo> m_rpcPending;
|
||||||
private Dictionary<UUID, RPCRequestInfo> m_rpcPendingResponses;
|
private Dictionary<UUID, RPCRequestInfo> m_rpcPendingResponses;
|
||||||
|
@ -94,34 +100,24 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
|
||||||
private int RemoteReplyScriptWait = 300;
|
private int RemoteReplyScriptWait = 300;
|
||||||
private object XMLRPCListLock = new object();
|
private object XMLRPCListLock = new object();
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region ISharedRegionModule Members
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
// We need to create these early because the scripts might be calling
|
// We need to create these early because the scripts might be calling
|
||||||
// But since this gets called for every region, we need to make sure they
|
// But since this gets called for every region, we need to make sure they
|
||||||
// get called only one time (or we lose any open channels)
|
// get called only one time (or we lose any open channels)
|
||||||
if (null == m_openChannels)
|
m_openChannels = new Dictionary<UUID, RPCChannelInfo>();
|
||||||
{
|
m_rpcPending = new Dictionary<UUID, RPCRequestInfo>();
|
||||||
m_openChannels = new Dictionary<UUID, RPCChannelInfo>();
|
m_rpcPendingResponses = new Dictionary<UUID, RPCRequestInfo>();
|
||||||
m_rpcPending = new Dictionary<UUID, RPCRequestInfo>();
|
m_pendingSRDResponses = new Dictionary<UUID, SendRemoteDataRequest>();
|
||||||
m_rpcPendingResponses = new Dictionary<UUID, RPCRequestInfo>();
|
|
||||||
m_pendingSRDResponses = new Dictionary<UUID, SendRemoteDataRequest>();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort);
|
m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort);
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
if (!m_scenes.Contains(scene))
|
|
||||||
{
|
{
|
||||||
m_scenes.Add(scene);
|
|
||||||
|
|
||||||
scene.RegisterModuleInterface<IXMLRPC>(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,15 +127,44 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
|
||||||
{
|
{
|
||||||
// Start http server
|
// Start http server
|
||||||
// Attach xmlrpc handlers
|
// Attach xmlrpc handlers
|
||||||
// m_log.InfoFormat(
|
// m_log.InfoFormat(
|
||||||
// "[XML RPC MODULE]: Starting up XMLRPC Server on port {0} for llRemoteData commands.",
|
// "[XML RPC MODULE]: Starting up XMLRPC Server on port {0} for llRemoteData commands.",
|
||||||
// m_remoteDataPort);
|
// m_remoteDataPort);
|
||||||
|
|
||||||
IHttpServer httpServer = MainServer.GetHttpServer((uint)m_remoteDataPort);
|
IHttpServer httpServer = MainServer.GetHttpServer((uint)m_remoteDataPort);
|
||||||
httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
|
httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!IsEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_scenes.Contains(scene))
|
||||||
|
{
|
||||||
|
m_scenes.Add(scene);
|
||||||
|
|
||||||
|
scene.RegisterModuleInterface<IXMLRPC>(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!IsEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_scenes.Contains(scene))
|
||||||
|
{
|
||||||
|
scene.UnregisterModuleInterface<IXMLRPC>(this);
|
||||||
|
m_scenes.Remove(scene);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -149,14 +174,9 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
|
||||||
get { return m_name; }
|
get { return m_name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return null; }
|
||||||
}
|
|
||||||
|
|
||||||
public int Port
|
|
||||||
{
|
|
||||||
get { return m_remoteDataPort; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -37,13 +37,17 @@ using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.World.Permissions
|
namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
{
|
{
|
||||||
public class PermissionsModule : IRegionModule, IPermissionsModule
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PermissionsModule")]
|
||||||
|
public class PermissionsModule : INonSharedRegionModule, IPermissionsModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected Scene m_scene;
|
protected Scene m_scene;
|
||||||
|
protected bool m_Enabled;
|
||||||
|
|
||||||
private InventoryFolderImpl m_libraryRootFolder;
|
private InventoryFolderImpl m_libraryRootFolder;
|
||||||
protected InventoryFolderImpl LibraryRootFolder
|
protected InventoryFolderImpl LibraryRootFolder
|
||||||
|
@ -114,18 +118,44 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>();
|
private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>();
|
||||||
private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>();
|
private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>();
|
||||||
private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>();
|
private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>();
|
||||||
|
|
||||||
private IFriendsModule m_friendsModule;
|
private IFriendsModule m_friendsModule;
|
||||||
|
private IFriendsModule FriendsModule
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (m_friendsModule == null)
|
||||||
|
m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
|
||||||
|
return m_friendsModule;
|
||||||
|
}
|
||||||
|
}
|
||||||
private IGroupsModule m_groupsModule;
|
private IGroupsModule m_groupsModule;
|
||||||
private IMoapModule m_moapModule;
|
private IGroupsModule GroupsModule
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (m_groupsModule == null)
|
||||||
|
m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
|
||||||
|
return m_groupsModule;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IMoapModule m_moapModule;
|
||||||
|
private IMoapModule MoapModule
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (m_moapModule == null)
|
||||||
|
m_moapModule = m_scene.RequestModuleInterface<IMoapModule>();
|
||||||
|
return m_moapModule;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region INonSharedRegionModule Members
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
|
||||||
|
|
||||||
IConfig myConfig = config.Configs["Startup"];
|
IConfig myConfig = config.Configs["Startup"];
|
||||||
|
|
||||||
string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule");
|
string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule");
|
||||||
|
@ -135,6 +165,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
if (!modules.Contains("DefaultPermissionsModule"))
|
if (!modules.Contains("DefaultPermissionsModule"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
m_Enabled = true;
|
||||||
|
|
||||||
m_allowGridGods = myConfig.GetBoolean("allow_grid_gods", false);
|
m_allowGridGods = myConfig.GetBoolean("allow_grid_gods", false);
|
||||||
m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true);
|
m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true);
|
||||||
m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true);
|
m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true);
|
||||||
|
@ -144,7 +176,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
|
|
||||||
m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false);
|
m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false);
|
||||||
|
|
||||||
m_allowedScriptCreators
|
m_allowedScriptCreators
|
||||||
= ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators);
|
= ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators);
|
||||||
m_allowedScriptEditors
|
m_allowedScriptEditors
|
||||||
= ParseUserSetConfigSetting(myConfig, "allowed_script_editors", m_allowedScriptEditors);
|
= ParseUserSetConfigSetting(myConfig, "allowed_script_editors", m_allowedScriptEditors);
|
||||||
|
@ -154,97 +186,31 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
else
|
else
|
||||||
m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks");
|
m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks");
|
||||||
|
|
||||||
scene.RegisterModuleInterface<IPermissionsModule>(this);
|
string grant = myConfig.GetString("GrantLSL", "");
|
||||||
|
if (grant.Length > 0)
|
||||||
//Register functions with Scene External Checks!
|
{
|
||||||
m_scene.Permissions.OnBypassPermissions += BypassPermissions;
|
foreach (string uuidl in grant.Split(','))
|
||||||
m_scene.Permissions.OnSetBypassPermissions += SetBypassPermissions;
|
{
|
||||||
m_scene.Permissions.OnPropagatePermissions += PropagatePermissions;
|
|
||||||
m_scene.Permissions.OnGenerateClientFlags += GenerateClientFlags;
|
|
||||||
m_scene.Permissions.OnAbandonParcel += CanAbandonParcel;
|
|
||||||
m_scene.Permissions.OnReclaimParcel += CanReclaimParcel;
|
|
||||||
m_scene.Permissions.OnDeedParcel += CanDeedParcel;
|
|
||||||
m_scene.Permissions.OnDeedObject += CanDeedObject;
|
|
||||||
m_scene.Permissions.OnIsGod += IsGod;
|
|
||||||
m_scene.Permissions.OnIsGridGod += IsGridGod;
|
|
||||||
m_scene.Permissions.OnIsAdministrator += IsAdministrator;
|
|
||||||
m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
|
|
||||||
m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnInstantMessage += CanInstantMessage;
|
|
||||||
m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnMoveObject += CanMoveObject; //MAYBE FULLY IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnObjectEntry += CanObjectEntry;
|
|
||||||
m_scene.Permissions.OnReturnObjects += CanReturnObjects; //NOT YET IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand;
|
|
||||||
m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnCompileScript += CanCompileScript;
|
|
||||||
m_scene.Permissions.OnSellParcel += CanSellParcel;
|
|
||||||
m_scene.Permissions.OnTakeObject += CanTakeObject;
|
|
||||||
m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject;
|
|
||||||
m_scene.Permissions.OnTerraformLand += CanTerraformLand;
|
|
||||||
m_scene.Permissions.OnLinkObject += CanLinkObject; //NOT YET IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnDelinkObject += CanDelinkObject; //NOT YET IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED
|
|
||||||
|
|
||||||
m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED
|
|
||||||
|
|
||||||
m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory;
|
|
||||||
m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnResetScript += CanResetScript;
|
|
||||||
|
|
||||||
m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; //NOT YET IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; //NOT YET IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; //NOT YET IMPLEMENTED
|
|
||||||
m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED
|
|
||||||
|
|
||||||
m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED
|
|
||||||
|
|
||||||
m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia;
|
|
||||||
m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia;
|
|
||||||
|
|
||||||
m_scene.AddCommand("Users", this, "bypass permissions",
|
|
||||||
"bypass permissions <true / false>",
|
|
||||||
"Bypass permission checks",
|
|
||||||
HandleBypassPermissions);
|
|
||||||
|
|
||||||
m_scene.AddCommand("Users", this, "force permissions",
|
|
||||||
"force permissions <true / false>",
|
|
||||||
"Force permissions on or off",
|
|
||||||
HandleForcePermissions);
|
|
||||||
|
|
||||||
m_scene.AddCommand("Debug", this, "debug permissions",
|
|
||||||
"debug permissions <true / false>",
|
|
||||||
"Turn on permissions debugging",
|
|
||||||
HandleDebugPermissions);
|
|
||||||
|
|
||||||
string grant = myConfig.GetString("GrantLSL","");
|
|
||||||
if (grant.Length > 0) {
|
|
||||||
foreach (string uuidl in grant.Split(',')) {
|
|
||||||
string uuid = uuidl.Trim(" \t".ToCharArray());
|
string uuid = uuidl.Trim(" \t".ToCharArray());
|
||||||
GrantLSL.Add(uuid, true);
|
GrantLSL.Add(uuid, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
grant = myConfig.GetString("GrantCS","");
|
grant = myConfig.GetString("GrantCS", "");
|
||||||
if (grant.Length > 0) {
|
if (grant.Length > 0)
|
||||||
foreach (string uuidl in grant.Split(',')) {
|
{
|
||||||
|
foreach (string uuidl in grant.Split(','))
|
||||||
|
{
|
||||||
string uuid = uuidl.Trim(" \t".ToCharArray());
|
string uuid = uuidl.Trim(" \t".ToCharArray());
|
||||||
GrantCS.Add(uuid, true);
|
GrantCS.Add(uuid, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
grant = myConfig.GetString("GrantVB","");
|
grant = myConfig.GetString("GrantVB", "");
|
||||||
if (grant.Length > 0) {
|
if (grant.Length > 0)
|
||||||
foreach (string uuidl in grant.Split(',')) {
|
{
|
||||||
|
foreach (string uuidl in grant.Split(','))
|
||||||
|
{
|
||||||
string uuid = uuidl.Trim(" \t".ToCharArray());
|
string uuid = uuidl.Trim(" \t".ToCharArray());
|
||||||
GrantVB.Add(uuid, true);
|
GrantVB.Add(uuid, true);
|
||||||
}
|
}
|
||||||
|
@ -269,9 +235,119 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
GrantYP.Add(uuid, true);
|
GrantYP.Add(uuid, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_scene = scene;
|
||||||
|
|
||||||
|
scene.RegisterModuleInterface<IPermissionsModule>(this);
|
||||||
|
|
||||||
|
//Register functions with Scene External Checks!
|
||||||
|
m_scene.Permissions.OnBypassPermissions += BypassPermissions;
|
||||||
|
m_scene.Permissions.OnSetBypassPermissions += SetBypassPermissions;
|
||||||
|
m_scene.Permissions.OnPropagatePermissions += PropagatePermissions;
|
||||||
|
m_scene.Permissions.OnGenerateClientFlags += GenerateClientFlags;
|
||||||
|
m_scene.Permissions.OnAbandonParcel += CanAbandonParcel;
|
||||||
|
m_scene.Permissions.OnReclaimParcel += CanReclaimParcel;
|
||||||
|
m_scene.Permissions.OnDeedParcel += CanDeedParcel;
|
||||||
|
m_scene.Permissions.OnDeedObject += CanDeedObject;
|
||||||
|
m_scene.Permissions.OnIsGod += IsGod;
|
||||||
|
m_scene.Permissions.OnIsGridGod += IsGridGod;
|
||||||
|
m_scene.Permissions.OnIsAdministrator += IsAdministrator;
|
||||||
|
m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
|
||||||
|
m_scene.Permissions.OnDeleteObject += CanDeleteObject;
|
||||||
|
m_scene.Permissions.OnEditObject += CanEditObject;
|
||||||
|
m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties;
|
||||||
|
m_scene.Permissions.OnInstantMessage += CanInstantMessage;
|
||||||
|
m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer;
|
||||||
|
m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand;
|
||||||
|
m_scene.Permissions.OnMoveObject += CanMoveObject;
|
||||||
|
m_scene.Permissions.OnObjectEntry += CanObjectEntry;
|
||||||
|
m_scene.Permissions.OnReturnObjects += CanReturnObjects;
|
||||||
|
m_scene.Permissions.OnRezObject += CanRezObject;
|
||||||
|
m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand;
|
||||||
|
m_scene.Permissions.OnRunScript += CanRunScript;
|
||||||
|
m_scene.Permissions.OnCompileScript += CanCompileScript;
|
||||||
|
m_scene.Permissions.OnSellParcel += CanSellParcel;
|
||||||
|
m_scene.Permissions.OnTakeObject += CanTakeObject;
|
||||||
|
m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject;
|
||||||
|
m_scene.Permissions.OnTerraformLand += CanTerraformLand;
|
||||||
|
m_scene.Permissions.OnLinkObject += CanLinkObject;
|
||||||
|
m_scene.Permissions.OnDelinkObject += CanDelinkObject;
|
||||||
|
m_scene.Permissions.OnBuyLand += CanBuyLand;
|
||||||
|
|
||||||
|
m_scene.Permissions.OnViewNotecard += CanViewNotecard;
|
||||||
|
m_scene.Permissions.OnViewScript += CanViewScript;
|
||||||
|
m_scene.Permissions.OnEditNotecard += CanEditNotecard;
|
||||||
|
m_scene.Permissions.OnEditScript += CanEditScript;
|
||||||
|
|
||||||
|
m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory;
|
||||||
|
m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;
|
||||||
|
m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory;
|
||||||
|
m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory;
|
||||||
|
m_scene.Permissions.OnResetScript += CanResetScript;
|
||||||
|
|
||||||
|
m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory;
|
||||||
|
m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory;
|
||||||
|
m_scene.Permissions.OnEditUserInventory += CanEditUserInventory;
|
||||||
|
m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory;
|
||||||
|
|
||||||
|
m_scene.Permissions.OnTeleport += CanTeleport;
|
||||||
|
|
||||||
|
m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia;
|
||||||
|
m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia;
|
||||||
|
|
||||||
|
m_scene.AddCommand("Users", this, "bypass permissions",
|
||||||
|
"bypass permissions <true / false>",
|
||||||
|
"Bypass permission checks",
|
||||||
|
HandleBypassPermissions);
|
||||||
|
|
||||||
|
m_scene.AddCommand("Users", this, "force permissions",
|
||||||
|
"force permissions <true / false>",
|
||||||
|
"Force permissions on or off",
|
||||||
|
HandleForcePermissions);
|
||||||
|
|
||||||
|
m_scene.AddCommand("Debug", this, "debug permissions",
|
||||||
|
"debug permissions <true / false>",
|
||||||
|
"Turn on permissions debugging",
|
||||||
|
HandleDebugPermissions);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_scene.UnregisterModuleInterface<IPermissionsModule>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "PermissionsModule"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type ReplaceableInterface
|
||||||
|
{
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Console command handlers
|
||||||
|
|
||||||
public void HandleBypassPermissions(string module, string[] args)
|
public void HandleBypassPermissions(string module, string[] args)
|
||||||
{
|
{
|
||||||
if (m_scene.ConsoleScene() != null &&
|
if (m_scene.ConsoleScene() != null &&
|
||||||
|
@ -290,7 +366,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
m_bypassPermissions = val;
|
m_bypassPermissions = val;
|
||||||
|
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[PERMISSIONS]: Set permissions bypass to {0} for {1}",
|
"[PERMISSIONS]: Set permissions bypass to {0} for {1}",
|
||||||
m_bypassPermissions, m_scene.RegionInfo.RegionName);
|
m_bypassPermissions, m_scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,39 +419,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
|
||||||
{
|
|
||||||
m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
|
|
||||||
|
|
||||||
if (m_friendsModule == null)
|
|
||||||
m_log.Debug("[PERMISSIONS]: Friends module not found, friend permissions will not work");
|
|
||||||
|
|
||||||
m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
|
|
||||||
|
|
||||||
if (m_groupsModule == null)
|
|
||||||
m_log.Debug("[PERMISSIONS]: Groups module not found, group permissions will not work");
|
|
||||||
|
|
||||||
m_moapModule = m_scene.RequestModuleInterface<IMoapModule>();
|
|
||||||
|
|
||||||
// This log line will be commented out when no longer required for debugging
|
|
||||||
// if (m_moapModule == null)
|
|
||||||
// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Name
|
|
||||||
{
|
|
||||||
get { return "DefaultPermissionsModule"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Helper Functions
|
#region Helper Functions
|
||||||
|
@ -400,10 +443,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers)
|
protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers)
|
||||||
{
|
{
|
||||||
if (null == m_groupsModule)
|
if (null == GroupsModule)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, userID);
|
GroupMembershipData gmd = GroupsModule.GetMembershipData(groupID, userID);
|
||||||
|
|
||||||
if (gmd != null)
|
if (gmd != null)
|
||||||
{
|
{
|
||||||
|
@ -503,10 +546,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
if (user == UUID.Zero)
|
if (user == UUID.Zero)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (m_friendsModule == null)
|
if (FriendsModule == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int friendPerms = m_friendsModule.GetRightsGrantedByFriend(user, objectOwner);
|
int friendPerms = FriendsModule.GetRightsGrantedByFriend(user, objectOwner);
|
||||||
return (friendPerms & (int)FriendRights.CanModifyObjects) != 0;
|
return (friendPerms & (int)FriendRights.CanModifyObjects) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1915,14 +1958,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
// "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}",
|
// "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}",
|
||||||
// agentID, primID, face);
|
// agentID, primID, face);
|
||||||
|
|
||||||
if (null == m_moapModule)
|
if (null == MoapModule)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SceneObjectPart part = m_scene.GetSceneObjectPart(primID);
|
SceneObjectPart part = m_scene.GetSceneObjectPart(primID);
|
||||||
if (null == part)
|
if (null == part)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
MediaEntry me = m_moapModule.GetMediaEntry(part, face);
|
MediaEntry me = MoapModule.GetMediaEntry(part, face);
|
||||||
|
|
||||||
// If there is no existing media entry then it can be controlled (in this context, created).
|
// If there is no existing media entry then it can be controlled (in this context, created).
|
||||||
if (null == me)
|
if (null == me)
|
||||||
|
@ -1941,14 +1984,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
// "[PERMISSONS]: Performing CanInteractWithPrimMedia check with agentID {0}, primID {1}, face {2}",
|
// "[PERMISSONS]: Performing CanInteractWithPrimMedia check with agentID {0}, primID {1}, face {2}",
|
||||||
// agentID, primID, face);
|
// agentID, primID, face);
|
||||||
|
|
||||||
if (null == m_moapModule)
|
if (null == MoapModule)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SceneObjectPart part = m_scene.GetSceneObjectPart(primID);
|
SceneObjectPart part = m_scene.GetSceneObjectPart(primID);
|
||||||
if (null == part)
|
if (null == part)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
MediaEntry me = m_moapModule.GetMediaEntry(part, face);
|
MediaEntry me = MoapModule.GetMediaEntry(part, face);
|
||||||
|
|
||||||
// If there is no existing media entry then it can be controlled (in this context, created).
|
// If there is no existing media entry then it can be controlled (in this context, created).
|
||||||
if (null == me)
|
if (null == me)
|
||||||
|
|
|
@ -32,14 +32,16 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
namespace OpenSim.Region.Framework.Interfaces
|
namespace OpenSim.Region.Framework.Interfaces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Temporary interface. More methods to come at some point to make NPCs more object oriented rather than
|
/// Temporary interface. More methods to come at some point to make NPCs
|
||||||
/// controlling purely through module level interface calls (e.g. sit/stand).
|
/// more object oriented rather than controlling purely through module
|
||||||
|
/// level interface calls (e.g. sit/stand).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface INPC
|
public interface INPC
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Should this NPC be sensed by LSL sensors as an 'agent' (interpreted here to mean a normal user)
|
/// Should this NPC be sensed by LSL sensors as an 'agent'
|
||||||
/// rather than an OpenSim specific NPC extension?
|
/// (interpreted here to mean a normal user) rather than an OpenSim
|
||||||
|
/// specific NPC extension?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool SenseAsAgent { get; }
|
bool SenseAsAgent { get; }
|
||||||
}
|
}
|
||||||
|
@ -53,35 +55,42 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="lastname"></param>
|
/// <param name="lastname"></param>
|
||||||
/// <param name="position"></param>
|
/// <param name="position"></param>
|
||||||
/// <param name="senseAsAgent">
|
/// <param name="senseAsAgent">
|
||||||
/// Make the NPC show up as an agent on LSL sensors. The default is that they
|
/// Make the NPC show up as an agent on LSL sensors. The default is
|
||||||
/// show up as the NPC type instead, but this is currently an OpenSim-only extension.
|
/// that they show up as the NPC type instead, but this is currently
|
||||||
|
/// an OpenSim-only extension.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <param name="appearance">The avatar appearance to use for the new NPC.</param>
|
/// <param name="appearance">
|
||||||
/// <returns>The UUID of the ScenePresence created. UUID.Zero if there was a failure.</returns>
|
/// The avatar appearance to use for the new NPC.
|
||||||
UUID CreateNPC(
|
/// </param>
|
||||||
string firstname,
|
/// <returns>
|
||||||
string lastname,
|
/// The UUID of the ScenePresence created. UUID.Zero if there was a
|
||||||
Vector3 position,
|
/// failure.
|
||||||
UUID owner,
|
/// </returns>
|
||||||
bool senseAsAgent,
|
UUID CreateNPC(string firstname, string lastname, Vector3 position,
|
||||||
Scene scene,
|
UUID owner, bool senseAsAgent, Scene scene,
|
||||||
AvatarAppearance appearance);
|
AvatarAppearance appearance);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if the agent is an NPC.
|
/// Check if the agent is an NPC.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="agentID"></param>
|
/// <param name="agentID"></param>
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <returns>True if the agent is an NPC in the given scene. False otherwise.</returns>
|
/// <returns>
|
||||||
|
/// True if the agent is an NPC in the given scene. False otherwise.
|
||||||
|
/// </returns>
|
||||||
bool IsNPC(UUID agentID, Scene scene);
|
bool IsNPC(UUID agentID, Scene scene);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the NPC. This is not currently complete - manipulation of NPCs still occurs through the region interface
|
/// Get the NPC.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is not currently complete - manipulation of NPCs still occurs
|
||||||
|
/// through the region interface.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="agentID"></param>
|
/// <param name="agentID"></param>
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <returns>The NPC. null if it does not exist.</returns>
|
/// <returns>The NPC. null if it does not exist.</returns>
|
||||||
INPC GetNPC(UUID agentID, Scene scene);
|
INPC GetNPC(UUID agentID, Scene scene);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -89,7 +98,10 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="npcID"></param>
|
/// <param name="npcID"></param>
|
||||||
/// <param name="callerID"></param>
|
/// <param name="callerID"></param>
|
||||||
/// <returns>true if they do, false if they don't or if there's no NPC with the given ID.</returns>
|
/// <returns>
|
||||||
|
/// true if they do, false if they don't or if there's no NPC with the
|
||||||
|
/// given ID.
|
||||||
|
/// </returns>
|
||||||
bool CheckPermissions(UUID npcID, UUID callerID);
|
bool CheckPermissions(UUID npcID, UUID callerID);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -98,8 +110,12 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="agentID"></param>
|
/// <param name="agentID"></param>
|
||||||
/// <param name="appearance"></param>
|
/// <param name="appearance"></param>
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
/// <returns>
|
||||||
bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, Scene scene);
|
/// True if the operation succeeded, false if there was no such agent
|
||||||
|
/// or the agent was not an NPC.
|
||||||
|
/// </returns>
|
||||||
|
bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance,
|
||||||
|
Scene scene);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Move an NPC to a target over time.
|
/// Move an NPC to a target over time.
|
||||||
|
@ -108,23 +124,29 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <param name="pos"></param>
|
/// <param name="pos"></param>
|
||||||
/// <param name="noFly">
|
/// <param name="noFly">
|
||||||
/// If true, then the avatar will attempt to walk to the location even if it's up in the air.
|
/// If true, then the avatar will attempt to walk to the location even
|
||||||
/// This is to allow walking on prims.
|
/// if it's up in the air. This is to allow walking on prims.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="landAtTarget">
|
/// <param name="landAtTarget">
|
||||||
/// If true and the avatar is flying when it reaches the target, land.
|
/// If true and the avatar is flying when it reaches the target, land.
|
||||||
/// </param> name="running">
|
/// </param> name="running">
|
||||||
/// If true, NPC moves with running speed.
|
/// If true, NPC moves with running speed.
|
||||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
/// <returns>
|
||||||
///
|
/// True if the operation succeeded, false if there was no such agent
|
||||||
bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running);
|
/// or the agent was not an NPC.
|
||||||
|
/// </returns>
|
||||||
|
bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly,
|
||||||
|
bool landAtTarget, bool running);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop the NPC's current movement.
|
/// Stop the NPC's current movement.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="agentID">The UUID of the NPC</param>
|
/// <param name="agentID">The UUID of the NPC</param>
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
/// <returns>
|
||||||
|
/// True if the operation succeeded, false if there was no such agent
|
||||||
|
/// or the agent was not an NPC.
|
||||||
|
/// </returns>
|
||||||
bool StopMoveToTarget(UUID agentID, Scene scene);
|
bool StopMoveToTarget(UUID agentID, Scene scene);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -133,7 +155,10 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="agentID">The UUID of the NPC</param>
|
/// <param name="agentID">The UUID of the NPC</param>
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
/// <returns>
|
||||||
|
/// True if the operation succeeded, false if there was no such agent
|
||||||
|
/// or the agent was not an NPC.
|
||||||
|
/// </returns>
|
||||||
bool Say(UUID agentID, Scene scene, string text);
|
bool Say(UUID agentID, Scene scene, string text);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -143,7 +168,10 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <param name="channel"></param>
|
/// <param name="channel"></param>
|
||||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
/// <returns>
|
||||||
|
/// True if the operation succeeded, false if there was no such agent
|
||||||
|
/// or the agent was not an NPC.
|
||||||
|
/// </returns>
|
||||||
bool Say(UUID agentID, Scene scene, string text, int channel);
|
bool Say(UUID agentID, Scene scene, string text, int channel);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -153,7 +181,10 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <param name="channel"></param>
|
/// <param name="channel"></param>
|
||||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
/// <returns>
|
||||||
|
/// True if the operation succeeded, false if there was no such agent
|
||||||
|
/// or the agent was not an NPC.
|
||||||
|
/// </returns>
|
||||||
bool Shout(UUID agentID, Scene scene, string text, int channel);
|
bool Shout(UUID agentID, Scene scene, string text, int channel);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -163,7 +194,10 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <param name="channel"></param>
|
/// <param name="channel"></param>
|
||||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
/// <returns>
|
||||||
|
/// True if the operation succeeded, false if there was no such agent
|
||||||
|
/// or the agent was not an NPC.
|
||||||
|
/// </returns>
|
||||||
bool Whisper(UUID agentID, Scene scene, string text, int channel);
|
bool Whisper(UUID agentID, Scene scene, string text, int channel);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -188,7 +222,9 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="agentID"></param>
|
/// <param name="agentID"></param>
|
||||||
/// <param name="partID"></param>
|
/// <param name="partID"></param>
|
||||||
/// <returns>true if the touch is actually attempted, false if not</returns>
|
/// <returns>
|
||||||
|
/// true if the touch is actually attempted, false if not.
|
||||||
|
/// </returns>
|
||||||
bool Touch(UUID agentID, UUID partID);
|
bool Touch(UUID agentID, UUID partID);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -196,14 +232,20 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="agentID">The UUID of the NPC</param>
|
/// <param name="agentID">The UUID of the NPC</param>
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
/// <returns>
|
||||||
|
/// True if the operation succeeded, false if there was no such agent
|
||||||
|
/// or the agent was not an NPC.
|
||||||
|
/// </returns>
|
||||||
bool DeleteNPC(UUID agentID, Scene scene);
|
bool DeleteNPC(UUID agentID, Scene scene);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the owner of a NPC
|
/// Get the owner of a NPC
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="agentID">The UUID of the NPC</param>
|
/// <param name="agentID">The UUID of the NPC</param>
|
||||||
/// <returns>UUID of owner if the NPC exists, UUID.Zero if there was no such agent, the agent is unowned or the agent was not an NPC</returns>
|
/// <returns>
|
||||||
|
/// UUID of owner if the NPC exists, UUID.Zero if there was no such
|
||||||
|
/// agent, the agent is unowned or the agent was not an NPC.
|
||||||
|
/// </returns>
|
||||||
UUID GetOwner(UUID agentID);
|
UUID GetOwner(UUID agentID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
@ -33,29 +34,65 @@ using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server;
|
using OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server;
|
||||||
|
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
|
namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
|
||||||
{
|
{
|
||||||
public class IRCStackModule : IRegionModule
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "IRCStackModule")]
|
||||||
|
public class IRCStackModule : INonSharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private IRCServer m_server;
|
private IRCServer m_server;
|
||||||
|
private int m_Port;
|
||||||
// private Scene m_scene;
|
// private Scene m_scene;
|
||||||
|
private bool m_Enabled;
|
||||||
|
|
||||||
#region Implementation of IRegionModule
|
#region Implementation of INonSharedRegionModule
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
{
|
{
|
||||||
if (null != source.Configs["IRCd"] &&
|
if (null != source.Configs["IRCd"] &&
|
||||||
source.Configs["IRCd"].GetBoolean("Enabled",false))
|
source.Configs["IRCd"].GetBoolean("Enabled", false))
|
||||||
{
|
{
|
||||||
int portNo = source.Configs["IRCd"].GetInt("Port",6666);
|
m_Enabled = true;
|
||||||
// m_scene = scene;
|
m_Port = source.Configs["IRCd"].GetInt("Port", 6666);
|
||||||
m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), portNo, scene);
|
|
||||||
m_server.OnNewIRCClient += m_server_OnNewIRCClient;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), m_Port, scene);
|
||||||
|
m_server.OnNewIRCClient += m_server_OnNewIRCClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "IRCClientStackModule"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type ReplaceableInterface
|
||||||
|
{
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
void m_server_OnNewIRCClient(IRCClientView user)
|
void m_server_OnNewIRCClient(IRCClientView user)
|
||||||
{
|
{
|
||||||
user.OnIRCReady += user_OnIRCReady;
|
user.OnIRCReady += user_OnIRCReady;
|
||||||
|
@ -68,26 +105,5 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
|
||||||
m_log.Info("[IRCd] Added user to Scene");
|
m_log.Info("[IRCd] Added user to Scene");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Name
|
|
||||||
{
|
|
||||||
get { return "IRCClientStackModule"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,13 +43,17 @@ using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
{
|
{
|
||||||
public class MRMModule : IRegionModule, IMRMModule
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MRMModule")]
|
||||||
|
public class MRMModule : INonSharedRegionModule, IMRMModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
|
private bool m_Enabled;
|
||||||
|
private bool m_Hidden;
|
||||||
|
|
||||||
private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>();
|
private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>();
|
||||||
|
|
||||||
|
@ -67,7 +71,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
m_extensions[typeof (T)] = instance;
|
m_extensions[typeof (T)] = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource source)
|
#region INonSharedRegionModule
|
||||||
|
|
||||||
|
public void Initialise(IConfigSource source)
|
||||||
{
|
{
|
||||||
if (source.Configs["MRM"] != null)
|
if (source.Configs["MRM"] != null)
|
||||||
{
|
{
|
||||||
|
@ -76,23 +82,60 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
if (source.Configs["MRM"].GetBoolean("Enabled", false))
|
if (source.Configs["MRM"].GetBoolean("Enabled", false))
|
||||||
{
|
{
|
||||||
m_log.Info("[MRM]: Enabling MRM Module");
|
m_log.Info("[MRM]: Enabling MRM Module");
|
||||||
m_scene = scene;
|
m_Enabled = true;
|
||||||
|
m_Hidden = source.Configs["MRM"].GetBoolean("Hidden", false);
|
||||||
// when hidden, we don't listen for client initiated script events
|
|
||||||
// only making the MRM engine available for region modules
|
|
||||||
if (!source.Configs["MRM"].GetBoolean("Hidden", false))
|
|
||||||
{
|
|
||||||
scene.EventManager.OnRezScript += EventManager_OnRezScript;
|
|
||||||
scene.EventManager.OnStopScript += EventManager_OnStopScript;
|
|
||||||
}
|
|
||||||
|
|
||||||
scene.EventManager.OnFrame += EventManager_OnFrame;
|
|
||||||
|
|
||||||
scene.RegisterModuleInterface<IMRMModule>(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_scene = scene;
|
||||||
|
|
||||||
|
// when hidden, we don't listen for client initiated script events
|
||||||
|
// only making the MRM engine available for region modules
|
||||||
|
if (!m_Hidden)
|
||||||
|
{
|
||||||
|
scene.EventManager.OnRezScript += EventManager_OnRezScript;
|
||||||
|
scene.EventManager.OnStopScript += EventManager_OnStopScript;
|
||||||
|
}
|
||||||
|
|
||||||
|
scene.EventManager.OnFrame += EventManager_OnFrame;
|
||||||
|
|
||||||
|
scene.RegisterModuleInterface<IMRMModule>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts)
|
||||||
|
{
|
||||||
|
pair.Value.Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "MiniRegionModule"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type ReplaceableInterface
|
||||||
|
{
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
void EventManager_OnStopScript(uint localID, UUID itemID)
|
void EventManager_OnStopScript(uint localID, UUID itemID)
|
||||||
{
|
{
|
||||||
if (m_scripts.ContainsKey(itemID))
|
if (m_scripts.ContainsKey(itemID))
|
||||||
|
@ -293,28 +336,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
mmb.InitMiniModule(world, host, itemID);
|
mmb.InitMiniModule(world, host, itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close()
|
|
||||||
{
|
|
||||||
foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts)
|
|
||||||
{
|
|
||||||
pair.Value.Stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Name
|
|
||||||
{
|
|
||||||
get { return "MiniRegionModule"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stolen from ScriptEngine Common
|
/// Stolen from ScriptEngine Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -32,6 +32,7 @@ using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
|
@ -49,7 +50,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
||||||
public string uri;
|
public string uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class XmlRpcGridRouter : IRegionModule, IXmlRpcRouter
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XmlRpcGridRouter")]
|
||||||
|
public class XmlRpcGridRouter : INonSharedRegionModule, IXmlRpcRouter
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -59,9 +61,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
private string m_ServerURI = String.Empty;
|
private string m_ServerURI = String.Empty;
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
#region INonSharedRegionModule
|
||||||
|
|
||||||
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
IConfig startupConfig = config.Configs["Startup"];
|
IConfig startupConfig = config.Configs["XMLRPC"];
|
||||||
if (startupConfig == null)
|
if (startupConfig == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -74,14 +78,28 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
||||||
m_log.Error("[XMLRPC GRID ROUTER] Module configured but no URI given. Disabling");
|
m_log.Error("[XMLRPC GRID ROUTER] Module configured but no URI given. Disabling");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.RegisterModuleInterface<IXmlRpcRouter>(this);
|
|
||||||
m_Enabled = true;
|
m_Enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
scene.RegisterModuleInterface<IXmlRpcRouter>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
scene.UnregisterModuleInterface<IXmlRpcRouter>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
@ -93,11 +111,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
||||||
get { return "XmlRpcGridRouterModule"; }
|
get { return "XmlRpcGridRouterModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return false; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
|
public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
|
||||||
{
|
{
|
||||||
if (!m_Channels.ContainsKey(itemID))
|
if (!m_Channels.ContainsKey(itemID))
|
||||||
|
|
|
@ -31,6 +31,7 @@ using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
@ -39,30 +40,44 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
|
namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
|
||||||
{
|
{
|
||||||
public class XmlRpcRouter : IRegionModule, IXmlRpcRouter
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XmlRpcRouter")]
|
||||||
|
public class XmlRpcRouter : INonSharedRegionModule, IXmlRpcRouter
|
||||||
{
|
{
|
||||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private bool m_enabled = false;
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
private bool m_Enabled;
|
||||||
|
|
||||||
|
#region INonSharedRegionModule
|
||||||
|
|
||||||
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
IConfig startupConfig = config.Configs["XMLRPC"];
|
IConfig startupConfig = config.Configs["XMLRPC"];
|
||||||
if (startupConfig == null)
|
if (startupConfig == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (startupConfig.GetString("XmlRpcRouterModule",
|
if (startupConfig.GetString("XmlRpcRouterModule",
|
||||||
"") == "XmlRpcRouterModule")
|
"XmlRpcRouterModule") == "XmlRpcRouterModule")
|
||||||
{
|
m_Enabled = true;
|
||||||
scene.RegisterModuleInterface<IXmlRpcRouter>(this);
|
|
||||||
m_enabled = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_enabled = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
scene.RegisterModuleInterface<IXmlRpcRouter>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
scene.UnregisterModuleInterface<IXmlRpcRouter>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
@ -74,14 +89,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
|
||||||
get { return "XmlRpcRouterModule"; }
|
get { return "XmlRpcRouterModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return false; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
|
public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
|
||||||
{
|
{
|
||||||
if (m_enabled)
|
if (m_Enabled)
|
||||||
{
|
{
|
||||||
scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] { uri });
|
scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] { uri });
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,37 +29,57 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using Timer = System.Timers.Timer;
|
||||||
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
using Mono.Addins;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Timer=System.Timers.Timer;
|
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.OptionalModules.World.NPC
|
namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
{
|
{
|
||||||
public class NPCModule : IRegionModule, INPCModule
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||||
|
public class NPCModule : INPCModule, ISharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(
|
||||||
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private Dictionary<UUID, NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>();
|
private Dictionary<UUID, NPCAvatar> m_avatars =
|
||||||
|
new Dictionary<UUID, NPCAvatar>();
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource source)
|
public bool Enabled { get; private set; }
|
||||||
|
|
||||||
|
public void Initialise(IConfigSource source)
|
||||||
{
|
{
|
||||||
IConfig config = source.Configs["NPC"];
|
IConfig config = source.Configs["NPC"];
|
||||||
|
|
||||||
if (config != null && config.GetBoolean("Enabled", false))
|
Enabled = (config != null && config.GetBoolean("Enabled", false));
|
||||||
{
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (Enabled)
|
||||||
scene.RegisterModuleInterface<INPCModule>(this);
|
scene.RegisterModuleInterface<INPCModule>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
scene.UnregisterModuleInterface<INPCModule>(this);
|
||||||
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -69,15 +89,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
get { return "NPCModule"; }
|
get { return "NPCModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface { get { return null; } }
|
||||||
{
|
|
||||||
get { return true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsNPC(UUID agentId, Scene scene)
|
public bool IsNPC(UUID agentId, Scene scene)
|
||||||
{
|
{
|
||||||
// FIXME: This implementation could not just use the ScenePresence.PresenceType (and callers could inspect
|
// FIXME: This implementation could not just use the
|
||||||
// that directly).
|
// ScenePresence.PresenceType (and callers could inspect that
|
||||||
|
// directly).
|
||||||
ScenePresence sp = scene.GetScenePresence(agentId);
|
ScenePresence sp = scene.GetScenePresence(agentId);
|
||||||
if (sp == null || sp.IsChildAgent)
|
if (sp == null || sp.IsChildAgent)
|
||||||
return false;
|
return false;
|
||||||
|
@ -86,7 +104,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
return m_avatars.ContainsKey(agentId);
|
return m_avatars.ContainsKey(agentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene)
|
public bool SetNPCAppearance(UUID agentId,
|
||||||
|
AvatarAppearance appearance, Scene scene)
|
||||||
{
|
{
|
||||||
ScenePresence npc = scene.GetScenePresence(agentId);
|
ScenePresence npc = scene.GetScenePresence(agentId);
|
||||||
if (npc == null || npc.IsChildAgent)
|
if (npc == null || npc.IsChildAgent)
|
||||||
|
@ -99,30 +118,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
// Delete existing npc attachments
|
// Delete existing npc attachments
|
||||||
scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false);
|
scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false);
|
||||||
|
|
||||||
// XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments
|
// XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet
|
||||||
AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
|
// since it doesn't transfer attachments
|
||||||
|
AvatarAppearance npcAppearance = new AvatarAppearance(appearance,
|
||||||
|
true);
|
||||||
npc.Appearance = npcAppearance;
|
npc.Appearance = npcAppearance;
|
||||||
|
|
||||||
// Rez needed npc attachments
|
// Rez needed npc attachments
|
||||||
scene.AttachmentsModule.RezAttachments(npc);
|
scene.AttachmentsModule.RezAttachments(npc);
|
||||||
|
|
||||||
IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>();
|
IAvatarFactoryModule module =
|
||||||
|
scene.RequestModuleInterface<IAvatarFactoryModule>();
|
||||||
module.SendAppearance(npc.UUID);
|
module.SendAppearance(npc.UUID);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID CreateNPC(
|
public UUID CreateNPC(string firstname, string lastname,
|
||||||
string firstname,
|
Vector3 position, UUID owner, bool senseAsAgent, Scene scene,
|
||||||
string lastname,
|
AvatarAppearance appearance)
|
||||||
Vector3 position,
|
|
||||||
UUID owner,
|
|
||||||
bool senseAsAgent,
|
|
||||||
Scene scene,
|
|
||||||
AvatarAppearance appearance)
|
|
||||||
{
|
{
|
||||||
NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, owner, senseAsAgent, scene);
|
NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position,
|
||||||
npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue);
|
owner, senseAsAgent, scene);
|
||||||
|
npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0,
|
||||||
|
int.MaxValue);
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}",
|
// "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}",
|
||||||
|
@ -134,15 +153,20 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
acd.lastname = lastname;
|
acd.lastname = lastname;
|
||||||
acd.ServiceURLs = new Dictionary<string, object>();
|
acd.ServiceURLs = new Dictionary<string, object>();
|
||||||
|
|
||||||
AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
|
AvatarAppearance npcAppearance = new AvatarAppearance(appearance,
|
||||||
|
true);
|
||||||
acd.Appearance = npcAppearance;
|
acd.Appearance = npcAppearance;
|
||||||
|
|
||||||
// for (int i = 0; i < acd.Appearance.Texture.FaceTextures.Length; i++)
|
/*
|
||||||
// {
|
for (int i = 0;
|
||||||
// m_log.DebugFormat(
|
i < acd.Appearance.Texture.FaceTextures.Length; i++)
|
||||||
// "[NPC MODULE]: NPC avatar {0} has texture id {1} : {2}",
|
{
|
||||||
// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
|
m_log.DebugFormat(
|
||||||
// }
|
"[NPC MODULE]: NPC avatar {0} has texture id {1} : {2}",
|
||||||
|
acd.AgentID, i,
|
||||||
|
acd.Appearance.Texture.FaceTextures[i]);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
ManualResetEvent ev = new ManualResetEvent(false);
|
ManualResetEvent ev = new ManualResetEvent(false);
|
||||||
|
|
||||||
|
@ -170,7 +194,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
return npcAvatar.AgentId;
|
return npcAvatar.AgentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running)
|
public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos,
|
||||||
|
bool noFly, bool landAtTarget, bool running)
|
||||||
{
|
{
|
||||||
lock (m_avatars)
|
lock (m_avatars)
|
||||||
{
|
{
|
||||||
|
@ -185,7 +210,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
|
|
||||||
sp.MoveToTarget(pos, noFly, landAtTarget);
|
sp.MoveToTarget(pos, noFly, landAtTarget);
|
||||||
sp.SetAlwaysRun = running;
|
sp.SetAlwaysRun = running;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,9 +283,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
ScenePresence sp;
|
ScenePresence sp;
|
||||||
if (scene.TryGetScenePresence(agentID, out sp))
|
if (scene.TryGetScenePresence(agentID, out sp))
|
||||||
{
|
{
|
||||||
sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero);
|
sp.HandleAgentRequestSit(m_avatars[agentID], agentID,
|
||||||
// sp.HandleAgentSit(m_avatars[agentID], agentID);
|
partID, Vector3.Zero);
|
||||||
|
//sp.HandleAgentSit(m_avatars[agentID], agentID);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,7 +295,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Whisper(UUID agentID, Scene scene, string text, int channel)
|
public bool Whisper(UUID agentID, Scene scene, string text,
|
||||||
|
int channel)
|
||||||
{
|
{
|
||||||
lock (m_avatars)
|
lock (m_avatars)
|
||||||
{
|
{
|
||||||
|
@ -344,7 +371,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
NPCAvatar av;
|
NPCAvatar av;
|
||||||
if (m_avatars.TryGetValue(agentID, out av))
|
if (m_avatars.TryGetValue(agentID, out av))
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", agentID, av.Name);
|
/*
|
||||||
|
m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove",
|
||||||
|
agentID, av.Name);
|
||||||
|
*/
|
||||||
scene.RemoveClient(agentID, false);
|
scene.RemoveClient(agentID, false);
|
||||||
m_avatars.Remove(agentID);
|
m_avatars.Remove(agentID);
|
||||||
|
|
||||||
|
@ -352,8 +382,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
// m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", agentID);
|
m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove",
|
||||||
|
agentID);
|
||||||
|
*/
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,15 +43,20 @@ using OpenSim.Framework.Servers.HttpServer;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.SqliteClient;
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||||
|
|
||||||
using OSD = OpenMetaverse.StructuredData.OSD;
|
using OSD = OpenMetaverse.StructuredData.OSD;
|
||||||
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
|
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
|
||||||
|
|
||||||
|
[assembly: Addin("WebStats", "1.0")]
|
||||||
|
[assembly: AddinDependency("OpenSim", "0.5")]
|
||||||
|
|
||||||
namespace OpenSim.Region.UserStatistics
|
namespace OpenSim.Region.UserStatistics
|
||||||
{
|
{
|
||||||
public class WebStatsModule : IRegionModule
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebStatsModule")]
|
||||||
|
public class WebStatsModule : ISharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
@ -74,59 +79,69 @@ namespace OpenSim.Region.UserStatistics
|
||||||
private string m_loglines = String.Empty;
|
private string m_loglines = String.Empty;
|
||||||
private volatile int lastHit = 12000;
|
private volatile int lastHit = 12000;
|
||||||
|
|
||||||
public virtual void Initialise(Scene scene, IConfigSource config)
|
#region ISharedRegionModule
|
||||||
|
|
||||||
|
public virtual void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
IConfig cnfg = config.Configs["WebStats"];
|
IConfig cnfg = config.Configs["WebStats"];
|
||||||
|
|
||||||
if (cnfg != null)
|
if (cnfg != null)
|
||||||
enabled = cnfg.GetBoolean("enabled", false);
|
enabled = cnfg.GetBoolean("enabled", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void PostInitialise()
|
||||||
|
{
|
||||||
|
if (!enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
AddEventHandlers();
|
||||||
|
|
||||||
|
if (Util.IsWindows())
|
||||||
|
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
|
||||||
|
|
||||||
|
//IConfig startupConfig = config.Configs["Startup"];
|
||||||
|
|
||||||
|
dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3");
|
||||||
|
dbConn.Open();
|
||||||
|
CreateTables(dbConn);
|
||||||
|
|
||||||
|
Prototype_distributor protodep = new Prototype_distributor();
|
||||||
|
Updater_distributor updatedep = new Updater_distributor();
|
||||||
|
ActiveConnectionsAJAX ajConnections = new ActiveConnectionsAJAX();
|
||||||
|
SimStatsAJAX ajSimStats = new SimStatsAJAX();
|
||||||
|
LogLinesAJAX ajLogLines = new LogLinesAJAX();
|
||||||
|
Default_Report defaultReport = new Default_Report();
|
||||||
|
Clients_report clientReport = new Clients_report();
|
||||||
|
Sessions_Report sessionsReport = new Sessions_Report();
|
||||||
|
|
||||||
|
reports.Add("prototype.js", protodep);
|
||||||
|
reports.Add("updater.js", updatedep);
|
||||||
|
reports.Add("activeconnectionsajax.html", ajConnections);
|
||||||
|
reports.Add("simstatsajax.html", ajSimStats);
|
||||||
|
reports.Add("activelogajax.html", ajLogLines);
|
||||||
|
reports.Add("default.report", defaultReport);
|
||||||
|
reports.Add("clients.report", clientReport);
|
||||||
|
reports.Add("sessions.report", sessionsReport);
|
||||||
|
|
||||||
|
////
|
||||||
|
// Add Your own Reports here (Do Not Modify Lines here Devs!)
|
||||||
|
////
|
||||||
|
|
||||||
|
////
|
||||||
|
// End Own reports section
|
||||||
|
////
|
||||||
|
|
||||||
|
MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest);
|
||||||
|
MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lock (m_scenes)
|
lock (m_scenes)
|
||||||
{
|
{
|
||||||
if (m_scenes.Count == 0)
|
|
||||||
{
|
|
||||||
if (Util.IsWindows())
|
|
||||||
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
|
|
||||||
|
|
||||||
//IConfig startupConfig = config.Configs["Startup"];
|
|
||||||
|
|
||||||
dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3");
|
|
||||||
dbConn.Open();
|
|
||||||
CreateTables(dbConn);
|
|
||||||
|
|
||||||
Prototype_distributor protodep = new Prototype_distributor();
|
|
||||||
Updater_distributor updatedep = new Updater_distributor();
|
|
||||||
ActiveConnectionsAJAX ajConnections = new ActiveConnectionsAJAX();
|
|
||||||
SimStatsAJAX ajSimStats = new SimStatsAJAX();
|
|
||||||
LogLinesAJAX ajLogLines = new LogLinesAJAX();
|
|
||||||
Default_Report defaultReport = new Default_Report();
|
|
||||||
Clients_report clientReport = new Clients_report();
|
|
||||||
Sessions_Report sessionsReport = new Sessions_Report();
|
|
||||||
|
|
||||||
reports.Add("prototype.js", protodep);
|
|
||||||
reports.Add("updater.js", updatedep);
|
|
||||||
reports.Add("activeconnectionsajax.html", ajConnections);
|
|
||||||
reports.Add("simstatsajax.html", ajSimStats);
|
|
||||||
reports.Add("activelogajax.html", ajLogLines);
|
|
||||||
reports.Add("default.report", defaultReport);
|
|
||||||
reports.Add("clients.report", clientReport);
|
|
||||||
reports.Add("sessions.report", sessionsReport);
|
|
||||||
|
|
||||||
////
|
|
||||||
// Add Your own Reports here (Do Not Modify Lines here Devs!)
|
|
||||||
////
|
|
||||||
|
|
||||||
////
|
|
||||||
// End Own reports section
|
|
||||||
////
|
|
||||||
|
|
||||||
MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest);
|
|
||||||
MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_scenes.Add(scene);
|
m_scenes.Add(scene);
|
||||||
if (m_simstatsCounters.ContainsKey(scene.RegionInfo.RegionID))
|
if (m_simstatsCounters.ContainsKey(scene.RegionInfo.RegionID))
|
||||||
m_simstatsCounters.Remove(scene.RegionInfo.RegionID);
|
m_simstatsCounters.Remove(scene.RegionInfo.RegionID);
|
||||||
|
@ -136,6 +151,39 @@ namespace OpenSim.Region.UserStatistics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Close()
|
||||||
|
{
|
||||||
|
if (!enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
dbConn.Close();
|
||||||
|
dbConn.Dispose();
|
||||||
|
m_sessions.Clear();
|
||||||
|
m_scenes.Clear();
|
||||||
|
reports.Clear();
|
||||||
|
m_simstatsCounters.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual string Name
|
||||||
|
{
|
||||||
|
get { return "ViewerStatsModule"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type ReplaceableInterface
|
||||||
|
{
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
private void ReceiveClassicSimStatsPacket(SimStats stats)
|
private void ReceiveClassicSimStatsPacket(SimStats stats)
|
||||||
{
|
{
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
|
@ -251,37 +299,6 @@ namespace OpenSim.Region.UserStatistics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void PostInitialise()
|
|
||||||
{
|
|
||||||
if (!enabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
AddHandlers();
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void Close()
|
|
||||||
{
|
|
||||||
if (!enabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dbConn.Close();
|
|
||||||
dbConn.Dispose();
|
|
||||||
m_sessions.Clear();
|
|
||||||
m_scenes.Clear();
|
|
||||||
reports.Clear();
|
|
||||||
m_simstatsCounters.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual string Name
|
|
||||||
{
|
|
||||||
get { return "ViewerStatsModule"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
|
||||||
get { return true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnRegisterCaps(UUID agentID, Caps caps)
|
private void OnRegisterCaps(UUID agentID, Caps caps)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
|
// m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
|
||||||
|
@ -302,7 +319,7 @@ namespace OpenSim.Region.UserStatistics
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void AddHandlers()
|
protected virtual void AddEventHandlers()
|
||||||
{
|
{
|
||||||
lock (m_scenes)
|
lock (m_scenes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -383,6 +383,11 @@ namespace OpenSim.Tests.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (IRegionModuleBase module in newModules)
|
||||||
|
{
|
||||||
|
if (module is ISharedRegionModule) ((ISharedRegionModule)module).PostInitialise();
|
||||||
|
}
|
||||||
|
|
||||||
foreach (IRegionModuleBase module in newModules)
|
foreach (IRegionModuleBase module in newModules)
|
||||||
{
|
{
|
||||||
foreach (Scene scene in scenes)
|
foreach (Scene scene in scenes)
|
||||||
|
@ -392,11 +397,6 @@ namespace OpenSim.Tests.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (IRegionModuleBase module in newModules)
|
|
||||||
{
|
|
||||||
if (module is ISharedRegionModule) ((ISharedRegionModule)module).PostInitialise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegionLoaded is fired after all modules have been appropriately added to all scenes
|
// RegionLoaded is fired after all modules have been appropriately added to all scenes
|
||||||
foreach (IRegionModuleBase module in newModules)
|
foreach (IRegionModuleBase module in newModules)
|
||||||
foreach (Scene scene in scenes)
|
foreach (Scene scene in scenes)
|
||||||
|
|
Loading…
Reference in New Issue