diff options
4 files changed, 73 insertions, 11 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 0cd708b..af42a3d 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -712,10 +712,25 @@ namespace OpenSim | |||
712 | } | 712 | } |
713 | else | 713 | else |
714 | { | 714 | { |
715 | ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(helpArgs[0]); | 715 | // Messily we want to join all the help params back here |
716 | if (moduleCommander != null) | 716 | //string helpSubject = string.Join(" ", helpArgs); |
717 | |||
718 | // FIXME: Very cheap hack to get transition help working. Will disappear very shortly. | ||
719 | if (helpArgs.Length == 1) | ||
717 | { | 720 | { |
718 | m_console.Notice(moduleCommander.Help); | 721 | ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(helpArgs[0]); |
722 | if (moduleCommander != null) | ||
723 | { | ||
724 | m_console.Notice(moduleCommander.Help); | ||
725 | } | ||
726 | } | ||
727 | else | ||
728 | { | ||
729 | ICommand command = SceneManager.CurrentOrFirstScene.GetCommand(helpArgs[1]); | ||
730 | if (command != null) | ||
731 | { | ||
732 | m_console.Notice(command.Help); | ||
733 | } | ||
719 | } | 734 | } |
720 | } | 735 | } |
721 | } | 736 | } |
diff --git a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs index 31a67f7..cd66295 100644 --- a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs +++ b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander | |||
59 | { | 59 | { |
60 | StringBuilder sb = new StringBuilder(); | 60 | StringBuilder sb = new StringBuilder(); |
61 | 61 | ||
62 | sb.AppendLine("===" + m_name + "==="); | 62 | sb.AppendLine("=== " + m_name + " ==="); |
63 | 63 | ||
64 | foreach (ICommand com in m_commands.Values) | 64 | foreach (ICommand com in m_commands.Values) |
65 | { | 65 | { |
@@ -83,9 +83,6 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander | |||
83 | m_generatedApiClassName += m_name.Substring(1); | 83 | m_generatedApiClassName += m_name.Substring(1); |
84 | } | 84 | } |
85 | 85 | ||
86 | /// <value> | ||
87 | /// Commands that this commander knows about | ||
88 | /// </value> | ||
89 | public Dictionary<string, ICommand> Commands | 86 | public Dictionary<string, ICommand> Commands |
90 | { | 87 | { |
91 | get { return m_commands; } | 88 | get { return m_commands; } |
diff --git a/OpenSim/Region/Framework/Interfaces/ICommander.cs b/OpenSim/Region/Framework/Interfaces/ICommander.cs index 17a2e4a..f94e8e8 100644 --- a/OpenSim/Region/Framework/Interfaces/ICommander.cs +++ b/OpenSim/Region/Framework/Interfaces/ICommander.cs | |||
@@ -25,6 +25,8 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Collections.Generic; | ||
29 | |||
28 | namespace OpenSim.Region.Framework.Interfaces | 30 | namespace OpenSim.Region.Framework.Interfaces |
29 | { | 31 | { |
30 | public interface ICommander | 32 | public interface ICommander |
@@ -39,6 +41,11 @@ namespace OpenSim.Region.Framework.Interfaces | |||
39 | /// </value> | 41 | /// </value> |
40 | string Help { get; } | 42 | string Help { get; } |
41 | 43 | ||
44 | /// <summary> | ||
45 | /// The commands available for this commander | ||
46 | /// </summary> | ||
47 | Dictionary<string, ICommand> Commands { get; } | ||
48 | |||
42 | void ProcessConsoleCommand(string function, string[] args); | 49 | void ProcessConsoleCommand(string function, string[] args); |
43 | void RegisterCommand(string commandName, ICommand command); | 50 | void RegisterCommand(string commandName, ICommand command); |
44 | void Run(string function, object[] args); | 51 | void Run(string function, object[] args); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 6d61e9f..e58d3ce 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -61,17 +61,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
61 | /// <value> | 61 | /// <value> |
62 | /// The module interfaces available from this scene. | 62 | /// The module interfaces available from this scene. |
63 | /// </value> | 63 | /// </value> |
64 | protected Dictionary<Type, List<object> > ModuleInterfaces = new Dictionary<Type, List<object> >(); | 64 | protected Dictionary<Type, List<object>> ModuleInterfaces = new Dictionary<Type, List<object>>(); |
65 | 65 | ||
66 | protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); | 66 | protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); |
67 | |||
68 | /// <value> | ||
69 | /// The module commanders available from this scene | ||
70 | /// </value> | ||
67 | protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>(); | 71 | protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>(); |
68 | 72 | ||
69 | /// <value> | 73 | /// <value> |
74 | /// The module commands available for this scene | ||
75 | /// </value> | ||
76 | protected Dictionary<string, ICommand> m_moduleCommands = new Dictionary<string, ICommand>(); | ||
77 | |||
78 | /// <value> | ||
70 | /// Registered classes that are capable of creating entities. | 79 | /// Registered classes that are capable of creating entities. |
71 | /// </value> | 80 | /// </value> |
72 | protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>(); | 81 | protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>(); |
73 | |||
74 | //API module interfaces | ||
75 | 82 | ||
76 | /// <summary> | 83 | /// <summary> |
77 | /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is | 84 | /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is |
@@ -278,11 +285,47 @@ namespace OpenSim.Region.Framework.Scenes | |||
278 | } | 285 | } |
279 | } | 286 | } |
280 | 287 | ||
288 | /// <summary> | ||
289 | /// Register a module commander. | ||
290 | /// </summary> | ||
291 | /// <param name="commander"></param> | ||
281 | public void RegisterModuleCommander(ICommander commander) | 292 | public void RegisterModuleCommander(ICommander commander) |
282 | { | 293 | { |
283 | lock (m_moduleCommanders) | 294 | lock (m_moduleCommanders) |
284 | { | 295 | { |
285 | m_moduleCommanders.Add(commander.Name, commander); | 296 | m_moduleCommanders.Add(commander.Name, commander); |
297 | |||
298 | lock (m_moduleCommands) | ||
299 | { | ||
300 | foreach (ICommand command in commander.Commands.Values) | ||
301 | { | ||
302 | if (m_moduleCommands.ContainsKey(command.Name)) | ||
303 | { | ||
304 | m_log.ErrorFormat( | ||
305 | "[MODULES]: Module commander {0} tried to register the command {1} which has already been registered", | ||
306 | commander.Name, command.Name); | ||
307 | continue; | ||
308 | } | ||
309 | |||
310 | m_moduleCommands[command.Name] = command; | ||
311 | } | ||
312 | } | ||
313 | } | ||
314 | } | ||
315 | |||
316 | /// <summary> | ||
317 | /// Get an available module command | ||
318 | /// </summary> | ||
319 | /// <param name="commandName"></param> | ||
320 | /// <returns>The command if it was found, null if no command is available with that name</returns> | ||
321 | public ICommand GetCommand(string commandName) | ||
322 | { | ||
323 | lock (m_moduleCommands) | ||
324 | { | ||
325 | if (m_moduleCommands.ContainsKey(commandName)) | ||
326 | return m_moduleCommands[commandName]; | ||
327 | else | ||
328 | return null; | ||
286 | } | 329 | } |
287 | } | 330 | } |
288 | 331 | ||