From 9bfbfa381abc92f3c5fc8e97405943128c85c5d4 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 10 Feb 2009 23:15:48 +0000 Subject: Add proper handling for shared vs. unshared modules to the command interface. Shared modules will now only get added once, so the command handler is called once per module, not once per scene. Removal of scenes has no adverse effects. Nonshared modules will be called for each scene. --- OpenSim/Region/Framework/Scenes/SceneBase.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index b0f328d..3f5c781 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -460,11 +460,24 @@ namespace OpenSim.Region.Framework.Scenes } } - public void AddCommand(string module, string command, string shorthelp, string longhelp, CommandDelegate callback) + public void AddCommand(object mod, string command, string shorthelp, string longhelp, CommandDelegate callback) { if (MainConsole.Instance == null) return; - MainConsole.Instance.Commands.AddCommand(module, command, shorthelp, longhelp, callback); + + string modulename = String.Empty; + bool shared = false; + + if (mod != null) + { + if (!(mod is IRegionModule)) + throw new Exception("AddCommand module parameter must be IRegionModule"); + IRegionModule module = (IRegionModule)mod; + modulename = module.Name; + shared = module.IsSharedModule; + } + + MainConsole.Instance.Commands.AddCommand(modulename, shared, command, shorthelp, longhelp, callback); } } } -- cgit v1.1