tabulate "show caps" output for easier readability

0.7.2-post-fixes
Justin Clark-Casey (justincc) 2011-11-29 16:29:11 +00:00
parent fcd60c6b74
commit 7987a6da95
1 changed files with 10 additions and 5 deletions

View File

@ -29,6 +29,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using log4net;
using Nini.Config;
using Mono.Addins;
@ -47,6 +48,8 @@ namespace OpenSim.Region.CoreModules.Framework
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_showCapsCommandFormat = " {0,-38} {1,-60}\n";
protected Scene m_scene;
/// <summary>
@ -68,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Framework
m_scene.RegisterModuleInterface<ICapabilitiesModule>(this);
MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps",
"show caps",
"Shows all registered capabilities", CapabilitiesCommand);
"Shows all registered capabilities", HandleShowCapsCommand);
}
public void RegionLoaded(Scene scene)
@ -227,21 +230,23 @@ namespace OpenSim.Region.CoreModules.Framework
}
}
private void CapabilitiesCommand(string module, string[] cmdparams)
private void HandleShowCapsCommand(string module, string[] cmdparams)
{
System.Text.StringBuilder caps = new System.Text.StringBuilder();
StringBuilder caps = new StringBuilder();
caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName);
foreach (KeyValuePair<UUID, Caps> kvp in m_capsObjects)
{
caps.AppendFormat("** User {0}:\n", kvp.Key);
for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); )
{
Uri uri = new Uri(kvp2.Value.ToString());
caps.AppendFormat(" {0} = {1}\n", kvp2.Key, uri.PathAndQuery);
caps.AppendFormat(m_showCapsCommandFormat, kvp2.Key, uri.PathAndQuery);
}
foreach (KeyValuePair<string, string> kvp3 in kvp.Value.ExternalCapsHandlers)
caps.AppendFormat(" {0} = {1}\n", kvp3.Key, kvp3.Value);
caps.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value);
}
MainConsole.Instance.Output(caps.ToString());