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.
0.6.3-post-fixes
Melanie Thielker 2009-02-10 23:15:48 +00:00
parent b4be9baa4a
commit 9bfbfa381a
13 changed files with 126 additions and 93 deletions

View File

@ -48,6 +48,11 @@ namespace OpenSim.Framework.Console
/// </value> /// </value>
public string module; public string module;
/// <value>
/// Whether the module is shared
/// </value>
public bool shared;
/// <value> /// <value>
/// Very short BNF description /// Very short BNF description
/// </value> /// </value>
@ -66,7 +71,7 @@ namespace OpenSim.Framework.Console
/// <value> /// <value>
/// The method to invoke for this command /// The method to invoke for this command
/// </value> /// </value>
public CommandDelegate fn; public List<CommandDelegate> fn;
} }
/// <value> /// <value>
@ -172,10 +177,11 @@ namespace OpenSim.Framework.Console
/// <param name="help"></param> /// <param name="help"></param>
/// <param name="longhelp"></param> /// <param name="longhelp"></param>
/// <param name="fn"></param> /// <param name="fn"></param>
public void AddCommand( public void AddCommand(string module, bool shared, string command,
string module, string command, string help, string longhelp, CommandDelegate fn) string help, string longhelp, CommandDelegate fn)
{ {
AddCommand(module, command, help, longhelp, String.Empty, fn); AddCommand(module, shared, command, help, longhelp,
String.Empty, fn);
} }
/// <summary> /// <summary>
@ -187,8 +193,9 @@ namespace OpenSim.Framework.Console
/// <param name="longhelp"></param> /// <param name="longhelp"></param>
/// <param name="descriptivehelp"></param> /// <param name="descriptivehelp"></param>
/// <param name="fn"></param> /// <param name="fn"></param>
public void AddCommand( public void AddCommand(string module, bool shared, string command,
string module, string command, string help, string longhelp, string descriptivehelp, CommandDelegate fn) string help, string longhelp, string descriptivehelp,
CommandDelegate fn)
{ {
string[] parts = Parser.Parse(command); string[] parts = Parser.Parse(command);
@ -212,15 +219,25 @@ namespace OpenSim.Framework.Console
} }
} }
CommandInfo info;
if (current.ContainsKey(String.Empty)) if (current.ContainsKey(String.Empty))
{
info = (CommandInfo)current[String.Empty];
if (!info.shared && !info.fn.Contains(fn))
info.fn.Add(fn);
return; return;
}
CommandInfo info = new CommandInfo(); info = new CommandInfo();
info.module = module; info.module = module;
info.shared = shared;
info.help_text = help; info.help_text = help;
info.long_help = longhelp; info.long_help = longhelp;
info.descriptive_help = descriptivehelp; info.descriptive_help = descriptivehelp;
info.fn = fn; info.fn = new List<CommandDelegate>();
info.fn.Add(fn);
current[String.Empty] = info; current[String.Empty] = info;
} }
@ -275,7 +292,7 @@ namespace OpenSim.Framework.Console
if (s == String.Empty) if (s == String.Empty)
{ {
CommandInfo ci = (CommandInfo)current[String.Empty]; CommandInfo ci = (CommandInfo)current[String.Empty];
if (ci.fn != null) if (ci.fn.Count != null)
addcr = true; addcr = true;
} }
else else
@ -337,9 +354,10 @@ namespace OpenSim.Framework.Console
if (current.ContainsKey(String.Empty)) if (current.ContainsKey(String.Empty))
{ {
CommandInfo ci = (CommandInfo)current[String.Empty]; CommandInfo ci = (CommandInfo)current[String.Empty];
if (ci.fn == null) if (ci.fn.Count == null)
return new string[0]; return new string[0];
ci.fn(ci.module, result); foreach (CommandDelegate fn in ci.fn)
fn(ci.module, result);
return result; return result;
} }
return new string[0]; return new string[0];
@ -409,9 +427,8 @@ namespace OpenSim.Framework.Console
{ {
DefaultPrompt = defaultPrompt; DefaultPrompt = defaultPrompt;
Commands.AddCommand( Commands.AddCommand("console", false, "help", "help [<command>]",
"console", "help", "help [<command>]", "Get general command list or more detailed help on a specific command", Help);
"Get general command list or more detailed help on a specific command", Help);
} }
public void SetGuiMode(bool mode) public void SetGuiMode(bool mode)

View File

@ -90,6 +90,6 @@ namespace OpenSim.Framework
T RequestModuleInterface<T>(); T RequestModuleInterface<T>();
T[] RequestModuleInterfaces<T>(); T[] RequestModuleInterfaces<T>();
void AddCommand(string module, string command, string shorthelp, string longhelp, CommandDelegate callback); void AddCommand(object module, string command, string shorthelp, string longhelp, CommandDelegate callback);
} }
} }

View File

@ -104,35 +104,35 @@ namespace OpenSim.Framework.Servers
{ {
SetConsoleLogLevel(new string[] { "ALL" }); SetConsoleLogLevel(new string[] { "ALL" });
m_console.Commands.AddCommand("base", "quit", m_console.Commands.AddCommand("base", false, "quit",
"quit", "quit",
"Quit the application", HandleQuit); "Quit the application", HandleQuit);
m_console.Commands.AddCommand("base", "shutdown", m_console.Commands.AddCommand("base", false, "shutdown",
"shutdown", "shutdown",
"Quit the application", HandleQuit); "Quit the application", HandleQuit);
m_console.Commands.AddCommand("base", "set log level", m_console.Commands.AddCommand("base", false, "set log level",
"set log level <level>", "set log level <level>",
"Set the console logging level", HandleLogLevel); "Set the console logging level", HandleLogLevel);
m_console.Commands.AddCommand("base", "show info", m_console.Commands.AddCommand("base", false, "show info",
"show info", "show info",
"Show general information", HandleShow); "Show general information", HandleShow);
m_console.Commands.AddCommand("base", "show stats", m_console.Commands.AddCommand("base", false, "show stats",
"show stats", "show stats",
"Show statistics", HandleShow); "Show statistics", HandleShow);
m_console.Commands.AddCommand("base", "show threads", m_console.Commands.AddCommand("base", false, "show threads",
"show threads", "show threads",
"Show thread status", HandleShow); "Show thread status", HandleShow);
m_console.Commands.AddCommand("base", "show uptime", m_console.Commands.AddCommand("base", false, "show uptime",
"show uptime", "show uptime",
"Show server uptime", HandleShow); "Show server uptime", HandleShow);
m_console.Commands.AddCommand("base", "show version", m_console.Commands.AddCommand("base", false, "show version",
"show version", "show version",
"Show server version", HandleShow); "Show server version", HandleShow);
} }

View File

@ -114,15 +114,17 @@ namespace OpenSim.Grid.GridServer
base.StartupSpecific(); base.StartupSpecific();
m_console.Commands.AddCommand("gridserver", "enable registration", m_console.Commands.AddCommand("gridserver", false,
"enable registration",
"enable registration", "enable registration",
"Enable new regions to register", HandleRegistration); "Enable new regions to register", HandleRegistration);
m_console.Commands.AddCommand("gridserver", "disable registration", m_console.Commands.AddCommand("gridserver", false,
"disable registration",
"disable registration", "disable registration",
"Disable registering new regions", HandleRegistration); "Disable registering new regions", HandleRegistration);
m_console.Commands.AddCommand("gridserver", "show status", m_console.Commands.AddCommand("gridserver", false, "show status",
"show status", "show status",
"Show registration status", HandleShowStatus); "Show registration status", HandleShowStatus);
} }

View File

@ -80,7 +80,7 @@ namespace OpenSim.Grid.InventoryServer
base.StartupSpecific(); base.StartupSpecific();
m_console.Commands.AddCommand("inventoryserver", "add user", m_console.Commands.AddCommand("inventoryserver", false, "add user",
"add user", "add user",
"Add a random user inventory", HandleAddUser); "Add a random user inventory", HandleAddUser);
} }

View File

@ -127,11 +127,11 @@ namespace OpenSim.Grid.MessagingServer
base.StartupSpecific(); base.StartupSpecific();
m_console.Commands.AddCommand("messageserver", "clear cache", m_console.Commands.AddCommand("messageserver", false, "clear cache",
"clear cache", "clear cache",
"Clear presence cache", HandleClearCache); "Clear presence cache", HandleClearCache);
m_console.Commands.AddCommand("messageserver", "register", m_console.Commands.AddCommand("messageserver", false, "register",
"register", "register",
"Re-register with user server(s)", HandleRegister); "Re-register with user server(s)", HandleRegister);
} }

View File

@ -122,32 +122,32 @@ namespace OpenSim.Grid.UserServer
base.StartupSpecific(); base.StartupSpecific();
m_console.Commands.AddCommand("userserver", "create user", m_console.Commands.AddCommand("userserver", false, "create user",
"create user [<first> [<last> [<x> <y> [email]]]]", "create user [<first> [<last> [<x> <y> [email]]]]",
"Create a new user account", RunCommand); "Create a new user account", RunCommand);
m_console.Commands.AddCommand("userserver", "reset user password", m_console.Commands.AddCommand("userserver", false, "reset user password",
"reset user password [<first> [<last> [<new password>]]]", "reset user password [<first> [<last> [<new password>]]]",
"Reset a user's password", RunCommand); "Reset a user's password", RunCommand);
m_console.Commands.AddCommand("userserver", "login level", m_console.Commands.AddCommand("userserver", false, "login level",
"login level <level>", "login level <level>",
"Set the minimum user level to log in", HandleLoginCommand); "Set the minimum user level to log in", HandleLoginCommand);
m_console.Commands.AddCommand("userserver", "login reset", m_console.Commands.AddCommand("userserver", false, "login reset",
"login reset", "login reset",
"Reset the login level to allow all users", "Reset the login level to allow all users",
HandleLoginCommand); HandleLoginCommand);
m_console.Commands.AddCommand("userserver", "login text", m_console.Commands.AddCommand("userserver", false, "login text",
"login text <text>", "login text <text>",
"Set the text users will see on login", HandleLoginCommand); "Set the text users will see on login", HandleLoginCommand);
m_console.Commands.AddCommand("userserver", "test-inventory", m_console.Commands.AddCommand("userserver", false, "test-inventory",
"test-inventory", "test-inventory",
"Perform a test inventory transaction", RunCommand); "Perform a test inventory transaction", RunCommand);
m_console.Commands.AddCommand("userserver", "logoff-user", m_console.Commands.AddCommand("userserver", false, "logoff-user",
"logoff-user <first> <last> <message>", "logoff-user <first> <last> <message>",
"Log off a named user", RunCommand); "Log off a named user", RunCommand);
} }

View File

@ -78,8 +78,8 @@ namespace OpenSim
base.StartupSpecific(); base.StartupSpecific();
MainConsole.Instance.Commands.AddCommand("hypergrid", "link-mapping", "link-mapping [<x> <y>] <cr>", "Set local coordinate to map HG regions to", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", "Set local coordinate to map HG regions to", RunCommand);
MainConsole.Instance.Commands.AddCommand("hypergrid", "link-region", "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", "Link a hypergrid region", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", "Link a hypergrid region", RunCommand);
} }
protected override void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder) protected override void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder)

View File

@ -99,185 +99,185 @@ namespace OpenSim
m_console.SetGuiMode(m_gui); m_console.SetGuiMode(m_gui);
MainConsole.Instance = m_console; MainConsole.Instance = m_console;
m_console.Commands.AddCommand("region", "clear assets", m_console.Commands.AddCommand("region", false, "clear assets",
"clear assets", "clear assets",
"Clear the asset cache", HandleClearAssets); "Clear the asset cache", HandleClearAssets);
m_console.Commands.AddCommand("region", "force update", m_console.Commands.AddCommand("region", false, "force update",
"force update", "force update",
"Force the update of all objects on clients", "Force the update of all objects on clients",
HandleForceUpdate); HandleForceUpdate);
m_console.Commands.AddCommand("region", "debug packet", m_console.Commands.AddCommand("region", false, "debug packet",
"debug packet <level>", "debug packet <level>",
"Turn on packet debugging", Debug); "Turn on packet debugging", Debug);
m_console.Commands.AddCommand("region", "debug scene", m_console.Commands.AddCommand("region", false, "debug scene",
"debug scene <cripting> <collisions> <physics>", "debug scene <cripting> <collisions> <physics>",
"Turn on scene debugging", Debug); "Turn on scene debugging", Debug);
m_console.Commands.AddCommand("region", "change region", m_console.Commands.AddCommand("region", false, "change region",
"change region <region name>", "change region <region name>",
"Change current console region", ChangeSelectedRegion); "Change current console region", ChangeSelectedRegion);
m_console.Commands.AddCommand("region", "save xml", m_console.Commands.AddCommand("region", false, "save xml",
"save xml", "save xml",
"Save a region's data in XML format", SaveXml); "Save a region's data in XML format", SaveXml);
m_console.Commands.AddCommand("region", "save xml2", m_console.Commands.AddCommand("region", false, "save xml2",
"save xml2", "save xml2",
"Save a region's data in XML2 format", SaveXml2); "Save a region's data in XML2 format", SaveXml2);
m_console.Commands.AddCommand("region", "load xml", m_console.Commands.AddCommand("region", false, "load xml",
"load xml [-newIDs [<x> <y> <z>]]", "load xml [-newIDs [<x> <y> <z>]]",
"Load a region's data from XML format", LoadXml); "Load a region's data from XML format", LoadXml);
m_console.Commands.AddCommand("region", "load xml2", m_console.Commands.AddCommand("region", false, "load xml2",
"load xml2", "load xml2",
"Load a region's data from XML2 format", LoadXml2); "Load a region's data from XML2 format", LoadXml2);
m_console.Commands.AddCommand("region", "save prims xml2", m_console.Commands.AddCommand("region", false, "save prims xml2",
"save prims xml2 [<prim name> <file name>]", "save prims xml2 [<prim name> <file name>]",
"Save named prim to XML2", SavePrimsXml2); "Save named prim to XML2", SavePrimsXml2);
m_console.Commands.AddCommand("region", "load oar", m_console.Commands.AddCommand("region", false, "load oar",
"load oar <oar name>", "load oar <oar name>",
"Load a region's data from OAR archive", LoadOar); "Load a region's data from OAR archive", LoadOar);
m_console.Commands.AddCommand("region", "save oar", m_console.Commands.AddCommand("region", false, "save oar",
"save oar <oar name>", "save oar <oar name>",
"Save a region's data to an OAR archive", "Save a region's data to an OAR archive",
"More information on forthcoming options here soon", SaveOar); "More information on forthcoming options here soon", SaveOar);
/* /*
m_console.Commands.AddCommand("region", "save inventory", m_console.Commands.AddCommand("region", false, "save inventory",
"save inventory <first> <last> <path> <file>", "save inventory <first> <last> <path> <file>",
"Save user inventory data", SaveInv); "Save user inventory data", SaveInv);
m_console.Commands.AddCommand("region", "load inventory", m_console.Commands.AddCommand("region", false, "load inventory",
"load inventory <first> <last> <path> <file>", "load inventory <first> <last> <path> <file>",
"Load user inventory data", LoadInv); "Load user inventory data", LoadInv);
*/ */
m_console.Commands.AddCommand("region", "edit scale", m_console.Commands.AddCommand("region", false, "edit scale",
"edit scale <name> <x> <y> <z>", "edit scale <name> <x> <y> <z>",
"Change the scale of a named prim", HandleEditScale); "Change the scale of a named prim", HandleEditScale);
m_console.Commands.AddCommand("region", "kick user", m_console.Commands.AddCommand("region", false, "kick user",
"kick user <first> <last>", "kick user <first> <last>",
"Kick a user off the simulator", KickUserCommand); "Kick a user off the simulator", KickUserCommand);
m_console.Commands.AddCommand("region", "show assets", m_console.Commands.AddCommand("region", false, "show assets",
"show assets", "show assets",
"Show asset data", HandleShow); "Show asset data", HandleShow);
m_console.Commands.AddCommand("region", "show users", m_console.Commands.AddCommand("region", false, "show users",
"show users [full]", "show users [full]",
"Show user data", HandleShow); "Show user data", HandleShow);
m_console.Commands.AddCommand("region", "show users full", m_console.Commands.AddCommand("region", false, "show users full",
"show users full", "show users full",
String.Empty, HandleShow); String.Empty, HandleShow);
m_console.Commands.AddCommand("region", "show modules", m_console.Commands.AddCommand("region", false, "show modules",
"show modules", "show modules",
"Show module data", HandleShow); "Show module data", HandleShow);
m_console.Commands.AddCommand("region", "show regions", m_console.Commands.AddCommand("region", false, "show regions",
"show regions", "show regions",
"Show region data", HandleShow); "Show region data", HandleShow);
m_console.Commands.AddCommand("region", "show queues", m_console.Commands.AddCommand("region", false, "show queues",
"show queues", "show queues",
"Show queue data", HandleShow); "Show queue data", HandleShow);
m_console.Commands.AddCommand("region", "alert", m_console.Commands.AddCommand("region", false, "alert",
"alert <first> <last> <message>", "alert <first> <last> <message>",
"Send an alert to a user", RunCommand); "Send an alert to a user", RunCommand);
m_console.Commands.AddCommand("region", "alert general", m_console.Commands.AddCommand("region", false, "alert general",
"alert general <message>", "alert general <message>",
"Send an alert everyone", RunCommand); "Send an alert everyone", RunCommand);
m_console.Commands.AddCommand("region", "backup", m_console.Commands.AddCommand("region", false, "backup",
"backup", "backup",
"Persist objects to the database now", RunCommand); "Persist objects to the database now", RunCommand);
m_console.Commands.AddCommand("region", "create region", m_console.Commands.AddCommand("region", false, "create region",
"create region", "create region",
"Create a new region", HandleCreateRegion); "Create a new region", HandleCreateRegion);
m_console.Commands.AddCommand("region", "login enable", m_console.Commands.AddCommand("region", false, "login enable",
"login enable", "login enable",
"Enable logins to the simulator", HandleLoginEnable); "Enable logins to the simulator", HandleLoginEnable);
m_console.Commands.AddCommand("region", "login disable", m_console.Commands.AddCommand("region", false, "login disable",
"login disable", "login disable",
"Disable logins to the simulator", HandleLoginDisable); "Disable logins to the simulator", HandleLoginDisable);
m_console.Commands.AddCommand("region", "login status", m_console.Commands.AddCommand("region", false, "login status",
"login status", "login status",
"Display status of logins", HandleLoginStatus); "Display status of logins", HandleLoginStatus);
m_console.Commands.AddCommand("region", "restart", m_console.Commands.AddCommand("region", false, "restart",
"restart", "restart",
"Restart all sims in this instance", RunCommand); "Restart all sims in this instance", RunCommand);
m_console.Commands.AddCommand("region", "config set", m_console.Commands.AddCommand("region", false, "config set",
"config set <section> <field> <value>", "config set <section> <field> <value>",
"Set a config option", HandleConfig); "Set a config option", HandleConfig);
m_console.Commands.AddCommand("region", "config get", m_console.Commands.AddCommand("region", false, "config get",
"config get <section> <field>", "config get <section> <field>",
"Read a config option", HandleConfig); "Read a config option", HandleConfig);
m_console.Commands.AddCommand("region", "config save", m_console.Commands.AddCommand("region", false, "config save",
"config save", "config save",
"Save current configuration", HandleConfig); "Save current configuration", HandleConfig);
m_console.Commands.AddCommand("region", "command-script", m_console.Commands.AddCommand("region", false, "command-script",
"command-script <script>", "command-script <script>",
"Run a command script from file", RunCommand); "Run a command script from file", RunCommand);
m_console.Commands.AddCommand("region", "export-map", m_console.Commands.AddCommand("region", false, "export-map",
"export-map <file>", "export-map <file>",
"Save an image of the world map", RunCommand); "Save an image of the world map", RunCommand);
m_console.Commands.AddCommand("region", "remove-region", m_console.Commands.AddCommand("region", false, "remove-region",
"remove-region <name>", "remove-region <name>",
"Remove a region from this simulator", RunCommand); "Remove a region from this simulator", RunCommand);
m_console.Commands.AddCommand("region", "delete-region", m_console.Commands.AddCommand("region", false, "delete-region",
"delete-region <name>", "delete-region <name>",
"Delete a region from disk", RunCommand); "Delete a region from disk", RunCommand);
m_console.Commands.AddCommand("region", "predecode-j2k", m_console.Commands.AddCommand("region", false, "predecode-j2k",
"predecode-j2k [<num threads>]>", "predecode-j2k [<num threads>]>",
"Precache assets,decode j2k layerdata", RunCommand); "Precache assets,decode j2k layerdata", RunCommand);
m_console.Commands.AddCommand("region", "modules list", m_console.Commands.AddCommand("region", false, "modules list",
"modules list", "modules list",
"List modules", HandleModules); "List modules", HandleModules);
m_console.Commands.AddCommand("region", "modules load", m_console.Commands.AddCommand("region", false, "modules load",
"modules load <name>", "modules load <name>",
"Load a module", HandleModules); "Load a module", HandleModules);
m_console.Commands.AddCommand("region", "modules unload", m_console.Commands.AddCommand("region", false, "modules unload",
"modules unload <name>", "modules unload <name>",
"Unload a module", HandleModules); "Unload a module", HandleModules);
m_console.Commands.AddCommand("region", "Add-InventoryHost", m_console.Commands.AddCommand("region", false, "Add-InventoryHost",
"Add-InventoryHost <host>", "Add-InventoryHost <host>",
String.Empty, RunCommand); String.Empty, RunCommand);
if (ConfigurationSettings.Standalone) if (ConfigurationSettings.Standalone)
{ {
m_console.Commands.AddCommand("region", "create user", m_console.Commands.AddCommand("region", false, "create user",
"create user [<first> [<last> [<pass> [<x> <y> [<email>]]]]]", "create user [<first> [<last> [<pass> [<x> <y> [<email>]]]]]",
"Create a new user", HandleCreateUser); "Create a new user", HandleCreateUser);
m_console.Commands.AddCommand("region", "reset user password", m_console.Commands.AddCommand("region", false, "reset user password",
"reset user password [<first> [<last> [<password>]]]", "reset user password [<first> [<last> [<password>]]]",
"Reset a user password", HandleResetUserPassword); "Reset a user password", HandleResetUserPassword);
} }

View File

@ -203,12 +203,12 @@ namespace OpenSim
foreach (string topic in topics) foreach (string topic in topics)
{ {
m_console.Commands.AddCommand("plugin", "help " + topic, m_console.Commands.AddCommand("plugin", false, "help " + topic,
"help " + topic, "help " + topic,
"Get help on plugin command '" + topic + "'", "Get help on plugin command '" + topic + "'",
HandleCommanderHelp); HandleCommanderHelp);
m_console.Commands.AddCommand("plugin", topic, m_console.Commands.AddCommand("plugin", false, topic,
topic, topic,
"Execute subcommand for plugin '" + topic + "'", "Execute subcommand for plugin '" + topic + "'",
null); null);
@ -221,7 +221,8 @@ namespace OpenSim
foreach (string command in commander.Commands.Keys) foreach (string command in commander.Commands.Keys)
{ {
m_console.Commands.AddCommand(topic, topic + " " + command, m_console.Commands.AddCommand(topic, false,
topic + " " + command,
topic + " " + commander.Commands[command].ShortHelp(), topic + " " + commander.Commands[command].ShortHelp(),
String.Empty, HandleCommanderCommand); String.Empty, HandleCommanderCommand);
} }

View File

@ -171,17 +171,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_scene.Permissions.AddCanTeleportHandler(CanTeleport); //NOT YET IMPLEMENTED m_scene.Permissions.AddCanTeleportHandler(CanTeleport); //NOT YET IMPLEMENTED
m_scene.AddCommand("permissions", "bypass permissions", m_scene.AddCommand(this, "bypass permissions",
"bypass permissions <true / false>", "bypass permissions <true / false>",
"Bypass permission checks", "Bypass permission checks",
HandleBypassPermissions); HandleBypassPermissions);
m_scene.AddCommand("permissions", "force permissions", m_scene.AddCommand(this, "force permissions",
"force permissions <true / false>", "force permissions <true / false>",
"Force permissions on or off", "Force permissions on or off",
HandleForcePermissions); HandleForcePermissions);
m_scene.AddCommand("permissions", "debug permissions", m_scene.AddCommand(this, "debug permissions",
"debug permissions <true / false>", "debug permissions <true / false>",
"Enable permissions debugging", "Enable permissions debugging",
HandleDebugPermissions); HandleDebugPermissions);

View File

@ -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) if (MainConsole.Instance == null)
return; 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);
} }
} }
} }

View File

@ -79,16 +79,16 @@ namespace pCampBot
} }
} }
m_console.Commands.AddCommand("bot", "shutdown", m_console.Commands.AddCommand("bot", false, "shutdown",
"shutdown", "shutdown",
"Gracefully shut down bots", HandleShutdown); "Gracefully shut down bots", HandleShutdown);
m_console.Commands.AddCommand("bot", "quit", m_console.Commands.AddCommand("bot", false, "quit",
"quit", "quit",
"Force quit (DANGEROUS, try shutdown first)", "Force quit (DANGEROUS, try shutdown first)",
HandleShutdown); HandleShutdown);
m_console.Commands.AddCommand("bot", "add bots", m_console.Commands.AddCommand("bot", false, "add bots",
"add bots <number>", "add bots <number>",
"Add more bots", HandleAddBots); "Add more bots", HandleAddBots);