Make it possible for the "deregister region id" command to accept more than one id

varregion
Justin Clark-Casey (justincc) 2013-08-23 01:03:27 +01:00
parent 61c20bd06a
commit 2be786709b
1 changed files with 27 additions and 24 deletions

View File

@ -86,7 +86,7 @@ namespace OpenSim.Services.GridService
{ {
MainConsole.Instance.Commands.AddCommand("Regions", true, MainConsole.Instance.Commands.AddCommand("Regions", true,
"deregister region id", "deregister region id",
"deregister region id <Region UUID>", "deregister region id <region-id>+",
"Deregister a region manually.", "Deregister a region manually.",
String.Empty, String.Empty,
HandleDeregisterRegion); HandleDeregisterRegion);
@ -526,37 +526,40 @@ namespace OpenSim.Services.GridService
private void HandleDeregisterRegion(string module, string[] cmd) private void HandleDeregisterRegion(string module, string[] cmd)
{ {
if (cmd.Length != 4) if (cmd.Length < 4)
{ {
MainConsole.Instance.Output("Syntax: degregister region id <Region UUID>"); MainConsole.Instance.Output("Usage: degregister region id <region-id>+");
return; return;
} }
string rawRegionUuid = cmd[3]; for (int i = 3; i < cmd.Length; i++)
UUID regionUuid;
if (!UUID.TryParse(rawRegionUuid, out regionUuid))
{ {
MainConsole.Instance.OutputFormat("{0} is not a valid region uuid", rawRegionUuid); string rawRegionUuid = cmd[i];
return; UUID regionUuid;
}
GridRegion region = GetRegionByUUID(UUID.Zero, regionUuid); if (!UUID.TryParse(rawRegionUuid, out regionUuid))
{
MainConsole.Instance.OutputFormat("{0} is not a valid region uuid", rawRegionUuid);
return;
}
if (region == null) GridRegion region = GetRegionByUUID(UUID.Zero, regionUuid);
{
MainConsole.Instance.OutputFormat("No region with UUID {0}", regionUuid);
return;
}
if (DeregisterRegion(regionUuid)) if (region == null)
{ {
MainConsole.Instance.OutputFormat("Deregistered {0} {1}", region.RegionName, regionUuid); MainConsole.Instance.OutputFormat("No region with UUID {0}", regionUuid);
} return;
else }
{
// I don't think this can ever occur if we know that the region exists. if (DeregisterRegion(regionUuid))
MainConsole.Instance.OutputFormat("Error deregistering {0} {1}", region.RegionName, regionUuid); {
MainConsole.Instance.OutputFormat("Deregistered {0} {1}", region.RegionName, regionUuid);
}
else
{
// I don't think this can ever occur if we know that the region exists.
MainConsole.Instance.OutputFormat("Error deregistering {0} {1}", region.RegionName, regionUuid);
}
} }
return; return;