From f34795c6b3cd022bd9f6ed4cea02631f5b17bf72 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 26 Jul 2010 21:41:39 +0100
Subject: provide config option for media on a prim
---
.../CoreModules/World/Media/Moap/MoapModule.cs | 21 +++++++++++++++++++--
.../World/Permissions/PermissionsModule.cs | 4 ++--
2 files changed, 21 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index 0e03318..7afeeec 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -61,6 +61,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap
public Type ReplaceableInterface { get { return null; } }
///
+ /// Is this module enabled?
+ ///
+ protected bool m_isEnabled = true;
+
+ ///
/// The scene to which this module is attached
///
protected Scene m_scene;
@@ -85,13 +90,19 @@ namespace OpenSim.Region.CoreModules.Media.Moap
///
protected Dictionary m_omuCapUrls = new Dictionary();
- public void Initialise(IConfigSource config)
+ public void Initialise(IConfigSource configSource)
{
- // TODO: Add config switches to enable/disable this module
+ IConfig config = configSource.Configs["MediaOnAPrim"];
+
+ if (config != null && !config.GetBoolean("Enabled", false))
+ m_isEnabled = false;
}
public void AddRegion(Scene scene)
{
+ if (!m_isEnabled)
+ return;
+
m_scene = scene;
m_scene.RegisterModuleInterface(this);
}
@@ -100,6 +111,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
public void RegionLoaded(Scene scene)
{
+ if (!m_isEnabled)
+ return;
+
m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
m_scene.EventManager.OnDeregisterCaps += OnDeregisterCaps;
m_scene.EventManager.OnSceneObjectLoaded += OnSceneObjectLoaded;
@@ -108,6 +122,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
public void Close()
{
+ if (!m_isEnabled)
+ return;
+
m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps;
m_scene.EventManager.OnSceneObjectLoaded -= OnSceneObjectLoaded;
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 7f6f851..982ac52 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -401,8 +401,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_moapModule = m_scene.RequestModuleInterface();
// 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");
+// 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()
--
cgit v1.1