diff options
Diffstat (limited to 'OpenSim/Services/GridService')
-rw-r--r-- | OpenSim/Services/GridService/GridService.cs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 7d2dadb..e4c3246 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -91,6 +91,18 @@ namespace OpenSim.Services.GridService | |||
91 | String.Empty, | 91 | String.Empty, |
92 | HandleDeregisterRegion); | 92 | HandleDeregisterRegion); |
93 | 93 | ||
94 | // A messy way of stopping this command being added if we are in standalone (since the simulator | ||
95 | // has an identically named command | ||
96 | // | ||
97 | // XXX: We're relying on the OpenSimulator version being registered first, which is not well defined. | ||
98 | if (MainConsole.Instance.Commands.Resolve(new string[] { "show", "regions" }).Length == 0) | ||
99 | MainConsole.Instance.Commands.AddCommand("Regions", true, | ||
100 | "show regions", | ||
101 | "show all regions", | ||
102 | "Show details on all regions", | ||
103 | String.Empty, | ||
104 | HandleShowRegions); | ||
105 | |||
94 | MainConsole.Instance.Commands.AddCommand("Regions", true, | 106 | MainConsole.Instance.Commands.AddCommand("Regions", true, |
95 | "show region name", | 107 | "show region name", |
96 | "show region name <Region name>", | 108 | "show region name <Region name>", |
@@ -547,6 +559,20 @@ namespace OpenSim.Services.GridService | |||
547 | return; | 559 | return; |
548 | } | 560 | } |
549 | 561 | ||
562 | private void HandleShowRegions(string module, string[] cmd) | ||
563 | { | ||
564 | if (cmd.Length != 2) | ||
565 | { | ||
566 | MainConsole.Instance.Output("Syntax: show regions"); | ||
567 | return; | ||
568 | } | ||
569 | |||
570 | List<RegionData> regions = m_Database.Get(int.MinValue, int.MinValue, int.MaxValue, int.MaxValue, UUID.Zero); | ||
571 | |||
572 | OutputRegionsToConsoleSummary(regions); | ||
573 | } | ||
574 | |||
575 | |||
550 | private void HandleShowRegion(string module, string[] cmd) | 576 | private void HandleShowRegion(string module, string[] cmd) |
551 | { | 577 | { |
552 | if (cmd.Length != 4) | 578 | if (cmd.Length != 4) |
@@ -619,6 +645,24 @@ namespace OpenSim.Services.GridService | |||
619 | OutputRegionToConsole(r); | 645 | OutputRegionToConsole(r); |
620 | } | 646 | } |
621 | 647 | ||
648 | private void OutputRegionsToConsoleSummary(List<RegionData> regions) | ||
649 | { | ||
650 | ConsoleDisplayTable dispTable = new ConsoleDisplayTable(); | ||
651 | dispTable.Columns.Add(new ConsoleDisplayTableColumn("Name", 16)); | ||
652 | dispTable.Columns.Add(new ConsoleDisplayTableColumn("ID", 36)); | ||
653 | dispTable.Columns.Add(new ConsoleDisplayTableColumn("Owner ID", 36)); | ||
654 | dispTable.Columns.Add(new ConsoleDisplayTableColumn("Flags", 60)); | ||
655 | |||
656 | foreach (RegionData r in regions) | ||
657 | { | ||
658 | OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); | ||
659 | dispTable.Rows.Add( | ||
660 | new ConsoleDisplayTableRow(new List<string> { r.RegionName, r.RegionID.ToString(), r.Data["owner_uuid"].ToString(), flags.ToString() })); | ||
661 | } | ||
662 | |||
663 | MainConsole.Instance.Output(dispTable.ToString()); | ||
664 | } | ||
665 | |||
622 | private int ParseFlags(int prev, string flags) | 666 | private int ParseFlags(int prev, string flags) |
623 | { | 667 | { |
624 | OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)prev; | 668 | OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)prev; |