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

@@ -12,8 +12,7 @@ namespace OpenMetaverse.TestClient
/// </summary>
public class ActivateGroupCommand : Command
{
ManualResetEvent GroupsEvent = new ManualResetEvent(false);
Dictionary<UUID, Group> groups = new Dictionary<UUID, Group>();
private ManualResetEvent GroupsEvent = new ManualResetEvent(false);
string activeGroup;
public ActivateGroupCommand(TestClient testClient)
@@ -27,7 +26,6 @@ namespace OpenMetaverse.TestClient
if (args.Length < 1)
return Description;
groups.Clear();
activeGroup = string.Empty;
string groupName = String.Empty;
@@ -35,49 +33,28 @@ namespace OpenMetaverse.TestClient
groupName += args[i] + " ";
groupName = groupName.Trim();
GroupManager.CurrentGroupsCallback callback = new GroupManager.CurrentGroupsCallback(Groups_OnCurrentGroups);
Client.Groups.OnCurrentGroups += callback;
Client.Groups.RequestCurrentGroups();
UUID groupUUID = Client.GroupName2UUID(groupName);
if (UUID.Zero != groupUUID) {
NetworkManager.PacketCallback pcallback = new NetworkManager.PacketCallback(AgentDataUpdateHandler);
Client.Network.RegisterCallback(PacketType.AgentDataUpdate, pcallback);
GroupsEvent.WaitOne(30000, false);
Console.WriteLine("setting " + groupName + " as active group");
Client.Groups.ActivateGroup(groupUUID);
GroupsEvent.WaitOne(30000, false);
Client.Groups.OnCurrentGroups -= callback;
GroupsEvent.Reset();
Client.Network.UnregisterCallback(PacketType.AgentDataUpdate, pcallback);
GroupsEvent.Reset();
if (groups.Count > 0)
{
foreach (Group currentGroup in groups.Values)
if (currentGroup.Name.ToLower() == groupName.ToLower())
{
NetworkManager.PacketCallback pcallback = new NetworkManager.PacketCallback(AgentDataUpdateHandler);
Client.Network.RegisterCallback(PacketType.AgentDataUpdate, pcallback);
/* A.Biondi
* TODO: Handle titles choosing.
*/
Console.WriteLine("setting " + currentGroup.Name + " as active group");
Client.Groups.ActivateGroup(currentGroup.ID);
GroupsEvent.WaitOne(30000, false);
if (String.IsNullOrEmpty(activeGroup))
return Client.ToString() + " failed to activate the group " + groupName;
Client.Network.UnregisterCallback(PacketType.AgentDataUpdate, pcallback);
GroupsEvent.Reset();
/* A.Biondi
* TODO: Handle titles choosing.
*/
if (String.IsNullOrEmpty(activeGroup))
return Client.ToString() + " failed to activate the group " + groupName;
return "Active group is now " + activeGroup;
}
return Client.ToString() + " doesn't seem to be member of the group " + groupName;
return "Active group is now " + activeGroup;
}
return Client.ToString() + " doesn't seem member of any group";
}
void Groups_OnCurrentGroups(Dictionary<UUID, Group> cGroups)
{
groups = cGroups;
GroupsEvent.Set();
return Client.ToString() + " doesn't seem to be member of the group " + groupName;
}
private void AgentDataUpdateHandler(Packet packet, Simulator sim)