From 4d23749241eb002c3815aa18789e8c3ffd44bfc1 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 ++--
bin/OpenSim.ini.example | 5 +++++
3 files changed, 26 insertions(+), 4 deletions(-)
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()
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 5dcc601..54c013a 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -1245,6 +1245,11 @@
; enabled=false
+[MediaOnAPrim]
+ ; Enable media on a prim facilities
+ Enabled = true;
+
+
;;
;; These are defaults that are overwritten below in [Architecture].
;; These defaults allow OpenSim to work out of the box with
--
cgit v1.1