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

@@ -49,6 +49,7 @@ namespace OpenMetaverse.TestClient
public bool Running = true;
public bool GetTextures = false;
public volatile int PendingLogins = 0;
public string onlyAvatar = String.Empty;
ClientManager()
{
@@ -247,6 +248,28 @@ namespace OpenMetaverse.TestClient
// Allow for comments when cmdline begins with ';' or '#'
if (firstToken[0] == ';' || firstToken[0] == '#')
return;
if ('@' == firstToken[0]) {
onlyAvatar = String.Empty;
if (tokens.Length == 3) {
bool found = false;
onlyAvatar = tokens[1]+" "+tokens[2];
foreach (TestClient client in Clients.Values) {
if (client.ToString() == onlyAvatar) {
found = true;
break;
}
}
if (found) {
Logger.Log("Commanding only "+onlyAvatar+" now", Helpers.LogLevel.Info);
} else {
Logger.Log("Commanding nobody now. Avatar "+onlyAvatar+" is offline", Helpers.LogLevel.Info);
}
} else {
Logger.Log("Commanding all avatars now", Helpers.LogLevel.Info);
}
return;
}
string[] args = new string[tokens.Length - 1];
if (args.Length > 0)
@@ -308,11 +331,13 @@ namespace OpenMetaverse.TestClient
delegate(object state)
{
TestClient testClient = (TestClient)state;
if (testClient.Commands.ContainsKey(firstToken))
Logger.Log(testClient.Commands[firstToken].Execute(args, fromAgentID),
Helpers.LogLevel.Info, testClient);
else
Logger.Log("Unknown command " + firstToken, Helpers.LogLevel.Warning);
if ((String.Empty == onlyAvatar) || (testClient.ToString() == onlyAvatar)) {
if (testClient.Commands.ContainsKey(firstToken))
Logger.Log(testClient.Commands[firstToken].Execute(args, fromAgentID),
Helpers.LogLevel.Info, testClient);
else
Logger.Log("Unknown command " + firstToken, Helpers.LogLevel.Warning);
}
++completed;
},