2007-11-10 18:36:50 +00:00
|
|
|
using System.Text;
|
|
|
|
|
|
2008-07-21 21:12:59 +00:00
|
|
|
namespace OpenMetaverse.TestClient
|
2007-11-10 18:36:50 +00:00
|
|
|
{
|
|
|
|
|
public class GroupsCommand : Command
|
|
|
|
|
{
|
|
|
|
|
public GroupsCommand(TestClient testClient)
|
|
|
|
|
{
|
|
|
|
|
Name = "groups";
|
|
|
|
|
Description = "List avatar groups. Usage: groups";
|
2008-07-25 08:55:36 +00:00
|
|
|
Category = CommandCategory.Groups;
|
2007-11-10 18:36:50 +00:00
|
|
|
}
|
2009-07-15 23:23:11 +00:00
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
2007-11-10 18:36:50 +00:00
|
|
|
{
|
2009-07-15 23:23:11 +00:00
|
|
|
Client.ReloadGroupsCache();
|
|
|
|
|
return getGroupsString();
|
2007-11-10 18:36:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string getGroupsString()
|
|
|
|
|
{
|
2009-07-15 23:23:11 +00:00
|
|
|
if (null == Client.GroupsCache)
|
|
|
|
|
return "Groups cache failed.";
|
|
|
|
|
if (0 == Client.GroupsCache.Count)
|
|
|
|
|
return "No groups";
|
2007-11-10 18:36:50 +00:00
|
|
|
StringBuilder sb = new StringBuilder();
|
2009-07-15 23:23:11 +00:00
|
|
|
sb.AppendLine("got "+Client.GroupsCache.Count +" groups:");
|
|
|
|
|
foreach (Group group in Client.GroupsCache.Values)
|
2007-11-10 18:36:50 +00:00
|
|
|
{
|
2009-07-15 23:23:11 +00:00
|
|
|
sb.AppendLine(group.ID + ", " + group.Name);
|
2008-01-05 23:30:50 +00:00
|
|
|
|
2007-11-10 18:36:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|