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
This commit is contained in:
Latif Khalifa
2009-07-15 23:23:11 +00:00
parent 31d313cdd4
commit 64417a208a
10 changed files with 295 additions and 115 deletions

View File

@@ -9,45 +9,30 @@ namespace OpenMetaverse.TestClient
{
public class GroupsCommand : Command
{
ManualResetEvent GetCurrentGroupsEvent = new ManualResetEvent(false);
Dictionary<UUID, Group> groups = new Dictionary<UUID, Group>();
public GroupsCommand(TestClient testClient)
{
testClient.Groups.OnCurrentGroups += new GroupManager.CurrentGroupsCallback(Groups_OnCurrentGroups);
Name = "groups";
Description = "List avatar groups. Usage: groups";
Category = CommandCategory.Groups;
}
public override string Execute(string[] args, UUID fromAgentID)
{
if (groups.Count == 0)
{
Client.Groups.RequestCurrentGroups();
GetCurrentGroupsEvent.WaitOne(10000, false);
}
if (groups.Count > 0)
{
return getGroupsString();
}
else
{
return "No groups";
}
Client.ReloadGroupsCache();
return getGroupsString();
}
void Groups_OnCurrentGroups(Dictionary<UUID, Group> pGroups)
{
groups = pGroups;
GetCurrentGroupsEvent.Set();
}
string getGroupsString()
{
if (null == Client.GroupsCache)
return "Groups cache failed.";
if (0 == Client.GroupsCache.Count)
return "No groups";
StringBuilder sb = new StringBuilder();
foreach (Group group in groups.Values)
sb.AppendLine("got "+Client.GroupsCache.Count +" groups:");
foreach (Group group in Client.GroupsCache.Values)
{
sb.AppendLine(group.Name + " " + group.ID);
sb.AppendLine(group.ID + ", " + group.Name);
}