From 5292b8b8be85696604f4f8086376da568b8342b5 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 26 Jun 2012 00:34:37 +0100 Subject: [PATCH] Add "show regions" console command to ROBUST to show all regions currently registered. Command is not added in standalone, which has its own version of "show regions" that can also show estate name --- OpenSim/Services/GridService/GridService.cs | 44 +++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 7d2dadb7c4..e4c32467a2 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -91,6 +91,18 @@ namespace OpenSim.Services.GridService String.Empty, HandleDeregisterRegion); + // A messy way of stopping this command being added if we are in standalone (since the simulator + // has an identically named command + // + // XXX: We're relying on the OpenSimulator version being registered first, which is not well defined. + if (MainConsole.Instance.Commands.Resolve(new string[] { "show", "regions" }).Length == 0) + MainConsole.Instance.Commands.AddCommand("Regions", true, + "show regions", + "show all regions", + "Show details on all regions", + String.Empty, + HandleShowRegions); + MainConsole.Instance.Commands.AddCommand("Regions", true, "show region name", "show region name ", @@ -547,6 +559,20 @@ namespace OpenSim.Services.GridService return; } + private void HandleShowRegions(string module, string[] cmd) + { + if (cmd.Length != 2) + { + MainConsole.Instance.Output("Syntax: show regions"); + return; + } + + List regions = m_Database.Get(int.MinValue, int.MinValue, int.MaxValue, int.MaxValue, UUID.Zero); + + OutputRegionsToConsoleSummary(regions); + } + + private void HandleShowRegion(string module, string[] cmd) { if (cmd.Length != 4) @@ -619,6 +645,24 @@ namespace OpenSim.Services.GridService OutputRegionToConsole(r); } + private void OutputRegionsToConsoleSummary(List regions) + { + ConsoleDisplayTable dispTable = new ConsoleDisplayTable(); + dispTable.Columns.Add(new ConsoleDisplayTableColumn("Name", 16)); + dispTable.Columns.Add(new ConsoleDisplayTableColumn("ID", 36)); + dispTable.Columns.Add(new ConsoleDisplayTableColumn("Owner ID", 36)); + dispTable.Columns.Add(new ConsoleDisplayTableColumn("Flags", 60)); + + foreach (RegionData r in regions) + { + OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); + dispTable.Rows.Add( + new ConsoleDisplayTableRow(new List { r.RegionName, r.RegionID.ToString(), r.Data["owner_uuid"].ToString(), flags.ToString() })); + } + + MainConsole.Instance.Output(dispTable.ToString()); + } + private int ParseFlags(int prev, string flags) { OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)prev;