aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorMelanie Thielker2009-02-10 23:15:48 +0000
committerMelanie Thielker2009-02-10 23:15:48 +0000
commit9bfbfa381abc92f3c5fc8e97405943128c85c5d4 (patch)
tree06248d4262cfd0e053010d6b8b6a19b8f6db2d40 /OpenSim/Framework
parentFixes the problem of attachment offset after crossings/TPs. Hopefully it fixe... (diff)
downloadopensim-SC-9bfbfa381abc92f3c5fc8e97405943128c85c5d4.zip
opensim-SC-9bfbfa381abc92f3c5fc8e97405943128c85c5d4.tar.gz
opensim-SC-9bfbfa381abc92f3c5fc8e97405943128c85c5d4.tar.bz2
opensim-SC-9bfbfa381abc92f3c5fc8e97405943128c85c5d4.tar.xz
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.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Console/ConsoleBase.cs45
-rw-r--r--OpenSim/Framework/IScene.cs2
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs16
3 files changed, 40 insertions, 23 deletions
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs
index 8e61587..721e91a 100644
--- a/OpenSim/Framework/Console/ConsoleBase.cs
+++ b/OpenSim/Framework/Console/ConsoleBase.cs
@@ -49,6 +49,11 @@ namespace OpenSim.Framework.Console
49 public string module; 49 public string module;
50 50
51 /// <value> 51 /// <value>
52 /// Whether the module is shared
53 /// </value>
54 public bool shared;
55
56 /// <value>
52 /// Very short BNF description 57 /// Very short BNF description
53 /// </value> 58 /// </value>
54 public string help_text; 59 public string help_text;
@@ -66,7 +71,7 @@ namespace OpenSim.Framework.Console
66 /// <value> 71 /// <value>
67 /// The method to invoke for this command 72 /// The method to invoke for this command
68 /// </value> 73 /// </value>
69 public CommandDelegate fn; 74 public List<CommandDelegate> fn;
70 } 75 }
71 76
72 /// <value> 77 /// <value>
@@ -172,10 +177,11 @@ namespace OpenSim.Framework.Console
172 /// <param name="help"></param> 177 /// <param name="help"></param>
173 /// <param name="longhelp"></param> 178 /// <param name="longhelp"></param>
174 /// <param name="fn"></param> 179 /// <param name="fn"></param>
175 public void AddCommand( 180 public void AddCommand(string module, bool shared, string command,
176 string module, string command, string help, string longhelp, CommandDelegate fn) 181 string help, string longhelp, CommandDelegate fn)
177 { 182 {
178 AddCommand(module, command, help, longhelp, String.Empty, fn); 183 AddCommand(module, shared, command, help, longhelp,
184 String.Empty, fn);
179 } 185 }
180 186
181 /// <summary> 187 /// <summary>
@@ -187,8 +193,9 @@ namespace OpenSim.Framework.Console
187 /// <param name="longhelp"></param> 193 /// <param name="longhelp"></param>
188 /// <param name="descriptivehelp"></param> 194 /// <param name="descriptivehelp"></param>
189 /// <param name="fn"></param> 195 /// <param name="fn"></param>
190 public void AddCommand( 196 public void AddCommand(string module, bool shared, string command,
191 string module, string command, string help, string longhelp, string descriptivehelp, CommandDelegate fn) 197 string help, string longhelp, string descriptivehelp,
198 CommandDelegate fn)
192 { 199 {
193 string[] parts = Parser.Parse(command); 200 string[] parts = Parser.Parse(command);
194 201
@@ -212,15 +219,25 @@ namespace OpenSim.Framework.Console
212 } 219 }
213 } 220 }
214 221
222 CommandInfo info;
223
215 if (current.ContainsKey(String.Empty)) 224 if (current.ContainsKey(String.Empty))
225 {
226 info = (CommandInfo)current[String.Empty];
227 if (!info.shared && !info.fn.Contains(fn))
228 info.fn.Add(fn);
229
216 return; 230 return;
231 }
217 232
218 CommandInfo info = new CommandInfo(); 233 info = new CommandInfo();
219 info.module = module; 234 info.module = module;
235 info.shared = shared;
220 info.help_text = help; 236 info.help_text = help;
221 info.long_help = longhelp; 237 info.long_help = longhelp;
222 info.descriptive_help = descriptivehelp; 238 info.descriptive_help = descriptivehelp;
223 info.fn = fn; 239 info.fn = new List<CommandDelegate>();
240 info.fn.Add(fn);
224 current[String.Empty] = info; 241 current[String.Empty] = info;
225 } 242 }
226 243
@@ -275,7 +292,7 @@ namespace OpenSim.Framework.Console
275 if (s == String.Empty) 292 if (s == String.Empty)
276 { 293 {
277 CommandInfo ci = (CommandInfo)current[String.Empty]; 294 CommandInfo ci = (CommandInfo)current[String.Empty];
278 if (ci.fn != null) 295 if (ci.fn.Count != null)
279 addcr = true; 296 addcr = true;
280 } 297 }
281 else 298 else
@@ -337,9 +354,10 @@ namespace OpenSim.Framework.Console
337 if (current.ContainsKey(String.Empty)) 354 if (current.ContainsKey(String.Empty))
338 { 355 {
339 CommandInfo ci = (CommandInfo)current[String.Empty]; 356 CommandInfo ci = (CommandInfo)current[String.Empty];
340 if (ci.fn == null) 357 if (ci.fn.Count == null)
341 return new string[0]; 358 return new string[0];
342 ci.fn(ci.module, result); 359 foreach (CommandDelegate fn in ci.fn)
360 fn(ci.module, result);
343 return result; 361 return result;
344 } 362 }
345 return new string[0]; 363 return new string[0];
@@ -409,9 +427,8 @@ namespace OpenSim.Framework.Console
409 { 427 {
410 DefaultPrompt = defaultPrompt; 428 DefaultPrompt = defaultPrompt;
411 429
412 Commands.AddCommand( 430 Commands.AddCommand("console", false, "help", "help [<command>]",
413 "console", "help", "help [<command>]", 431 "Get general command list or more detailed help on a specific command", Help);
414 "Get general command list or more detailed help on a specific command", Help);
415 } 432 }
416 433
417 public void SetGuiMode(bool mode) 434 public void SetGuiMode(bool mode)
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index 493c626..1c0a3b5 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -90,6 +90,6 @@ namespace OpenSim.Framework
90 T RequestModuleInterface<T>(); 90 T RequestModuleInterface<T>();
91 T[] RequestModuleInterfaces<T>(); 91 T[] RequestModuleInterfaces<T>();
92 92
93 void AddCommand(string module, string command, string shorthelp, string longhelp, CommandDelegate callback); 93 void AddCommand(object module, string command, string shorthelp, string longhelp, CommandDelegate callback);
94 } 94 }
95} 95}
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index ac5e183..ff53e1a 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -104,35 +104,35 @@ namespace OpenSim.Framework.Servers
104 { 104 {
105 SetConsoleLogLevel(new string[] { "ALL" }); 105 SetConsoleLogLevel(new string[] { "ALL" });
106 106
107 m_console.Commands.AddCommand("base", "quit", 107 m_console.Commands.AddCommand("base", false, "quit",
108 "quit", 108 "quit",
109 "Quit the application", HandleQuit); 109 "Quit the application", HandleQuit);
110 110
111 m_console.Commands.AddCommand("base", "shutdown", 111 m_console.Commands.AddCommand("base", false, "shutdown",
112 "shutdown", 112 "shutdown",
113 "Quit the application", HandleQuit); 113 "Quit the application", HandleQuit);
114 114
115 m_console.Commands.AddCommand("base", "set log level", 115 m_console.Commands.AddCommand("base", false, "set log level",
116 "set log level <level>", 116 "set log level <level>",
117 "Set the console logging level", HandleLogLevel); 117 "Set the console logging level", HandleLogLevel);
118 118
119 m_console.Commands.AddCommand("base", "show info", 119 m_console.Commands.AddCommand("base", false, "show info",
120 "show info", 120 "show info",
121 "Show general information", HandleShow); 121 "Show general information", HandleShow);
122 122
123 m_console.Commands.AddCommand("base", "show stats", 123 m_console.Commands.AddCommand("base", false, "show stats",
124 "show stats", 124 "show stats",
125 "Show statistics", HandleShow); 125 "Show statistics", HandleShow);
126 126
127 m_console.Commands.AddCommand("base", "show threads", 127 m_console.Commands.AddCommand("base", false, "show threads",
128 "show threads", 128 "show threads",
129 "Show thread status", HandleShow); 129 "Show thread status", HandleShow);
130 130
131 m_console.Commands.AddCommand("base", "show uptime", 131 m_console.Commands.AddCommand("base", false, "show uptime",
132 "show uptime", 132 "show uptime",
133 "Show server uptime", HandleShow); 133 "Show server uptime", HandleShow);
134 134
135 m_console.Commands.AddCommand("base", "show version", 135 m_console.Commands.AddCommand("base", false, "show version",
136 "show version", 136 "show version",
137 "Show server version", HandleShow); 137 "Show server version", HandleShow);
138 } 138 }