2008-07-21 21:12:59 +00:00
|
|
|
namespace OpenMetaverse.TestClient
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
|
|
|
|
public class EchoMasterCommand: Command
|
|
|
|
|
{
|
|
|
|
|
public EchoMasterCommand(TestClient testClient)
|
|
|
|
|
{
|
|
|
|
|
Name = "echoMaster";
|
|
|
|
|
Description = "Repeat everything that master says.";
|
2008-07-25 08:55:36 +00:00
|
|
|
Category = CommandCategory.Communication;
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
|
|
|
|
if (!Active)
|
|
|
|
|
{
|
|
|
|
|
Active = true;
|
2009-10-16 02:53:53 +00:00
|
|
|
Client.Self.ChatFromSimulator += Self_ChatFromSimulator;
|
2007-04-28 20:54:02 +00:00
|
|
|
return "Echoing is now on.";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Active = false;
|
2009-10-16 02:53:53 +00:00
|
|
|
Client.Self.ChatFromSimulator -= Self_ChatFromSimulator;
|
2007-04-28 20:54:02 +00:00
|
|
|
return "Echoing is now off.";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-16 02:53:53 +00:00
|
|
|
void Self_ChatFromSimulator(object sender, ChatEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (e.Message.Length > 0 && (Client.MasterKey == e.SourceID || (Client.MasterName == e.FromName && !Client.AllowObjectMaster)))
|
|
|
|
|
Client.Self.Chat(e.Message, 0, ChatType.Normal);
|
|
|
|
|
}
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
}
|