Files
libremetaverse/Programs/examples/TestClient/Commands/Groups/GroupsCommand.cs
Latif Khalifa 64417a208a LIBOMV-630: TestClient improvements (patch by Kephra Nurmi)
Improved TestClient:
added '@' as a command prefix to target one avatar only and to check, if a named avatar is logged in.

Improved TestClient to add new commands:

groupmembers GroupnameOrUUID - shows groupmembers UUIDs
grouproles GroupnameOrUUID - shows grouproles UUID and Names
invitegroup AvatarUUID GroupUUID RoleUUID* - invites an avatar into a group (without querying groupmembers first !-)

added public Dictionary<UUID, Group> GroupsCache = null; to TestClient.cs to refactor copy and paste code of group commands.
added friend.UUID to output of FriendsCommand.cs
swapped output of UUID and name in GroupsCommand.cs



git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2989 52acb1d6-8a22-11de-b505-999d5b087335
2009-07-15 23:23:11 +00:00

43 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Threading;
using OpenMetaverse;
using OpenMetaverse.Packets;
using System.Text;
namespace OpenMetaverse.TestClient
{
public class GroupsCommand : Command
{
public GroupsCommand(TestClient testClient)
{
Name = "groups";
Description = "List avatar groups. Usage: groups";
Category = CommandCategory.Groups;
}
public override string Execute(string[] args, UUID fromAgentID)
{
Client.ReloadGroupsCache();
return getGroupsString();
}
string getGroupsString()
{
if (null == Client.GroupsCache)
return "Groups cache failed.";
if (0 == Client.GroupsCache.Count)
return "No groups";
StringBuilder sb = new StringBuilder();
sb.AppendLine("got "+Client.GroupsCache.Count +" groups:");
foreach (Group group in Client.GroupsCache.Values)
{
sb.AppendLine(group.ID + ", " + group.Name);
}
return sb.ToString();
}
}
}