2007-04-28 20:54:02 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
2008-07-21 21:12:59 +00:00
|
|
|
using OpenMetaverse;
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2008-07-21 21:12:59 +00:00
|
|
|
namespace OpenMetaverse.TestClient
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
|
|
|
|
public class SayCommand: Command
|
|
|
|
|
{
|
|
|
|
|
public SayCommand(TestClient testClient)
|
|
|
|
|
{
|
|
|
|
|
Name = "say";
|
|
|
|
|
Description = "Say something. (usage: say (optional channel) whatever)";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string Execute(string[] args, LLUUID fromAgentID)
|
|
|
|
|
{
|
|
|
|
|
int channel = 0;
|
|
|
|
|
int startIndex = 0;
|
|
|
|
|
|
|
|
|
|
if (args.Length < 1)
|
|
|
|
|
{
|
|
|
|
|
return "usage: say (optional channel) whatever";
|
|
|
|
|
}
|
|
|
|
|
else if (args.Length > 1)
|
|
|
|
|
{
|
|
|
|
|
if (Int32.TryParse(args[0], out channel))
|
|
|
|
|
startIndex = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StringBuilder message = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
for (int i = startIndex; i < args.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
message.Append(args[i]);
|
|
|
|
|
if (i != args.Length - 1) message.Append(" ");
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-22 18:16:38 +00:00
|
|
|
Client.Self.Chat(message.ToString(), channel, ChatType.Normal);
|
2007-04-28 20:54:02 +00:00
|
|
|
|
|
|
|
|
return "Said " + message.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|