corrade-vassal – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 vero 1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using OpenMetaverse;
5 using OpenMetaverse.Packets;
6  
7 namespace OpenMetaverse.TestClient
8 {
9 public class EchoMasterCommand: Command
10 {
11 public EchoMasterCommand(TestClient testClient)
12 {
13 Name = "echoMaster";
14 Description = "Repeat everything that master says.";
15 Category = CommandCategory.Communication;
16 }
17  
18 public override string Execute(string[] args, UUID fromAgentID)
19 {
20 if (!Active)
21 {
22 Active = true;
23 Client.Self.ChatFromSimulator += Self_ChatFromSimulator;
24 return "Echoing is now on.";
25 }
26 else
27 {
28 Active = false;
29 Client.Self.ChatFromSimulator -= Self_ChatFromSimulator;
30 return "Echoing is now off.";
31 }
32 }
33  
34 void Self_ChatFromSimulator(object sender, ChatEventArgs e)
35 {
36 if (e.Message.Length > 0 && (Client.MasterKey == e.SourceID || (Client.MasterName == e.FromName && !Client.AllowObjectMaster)))
37 Client.Self.Chat(e.Message, 0, ChatType.Normal);
38 }
39 }
40 }