Files
libremetaverse/libsecondlife/examples/TestClient/Commands/Friends/FriendsCommand.cs
phaik fb45f1c66f Added FriendsCommand, type friends to see a list
Now removes Friend from _Friends when TerminateFriendship packet is received.

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1491 52acb1d6-8a22-11de-b505-999d5b087335
2007-11-20 01:27:38 +00:00

38 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Threading;
using libsecondlife;
using libsecondlife.Packets;
using System.Text;
namespace libsecondlife.TestClient
{
public class FriendsCommand : Command
{
ManualResetEvent GetCurrentGroupsEvent = new ManualResetEvent(false);
public FriendsCommand(TestClient testClient)
{
Name = "friends";
Description = "List avatar friends. Usage: friends";
}
public override string Execute(string[] args, LLUUID fromAgentID)
{
List<FriendsManager.FriendInfo> friends = Client.Friends.FriendsList();
if (friends.Count > 0)
{
StringBuilder sb = new StringBuilder();
foreach (FriendsManager.FriendInfo friend in friends)
{
sb.AppendLine(friend.Name);
}
return sb.ToString();
}
else
{
return "No friends";
}
}
}
}