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 WhisperCommand : Command
10 {
11 public WhisperCommand(TestClient testClient)
12 {
13 Name = "whisper";
14 Description = "Whisper something.";
15 Category = CommandCategory.Communication;
16 }
17  
18 public override string Execute(string[] args, UUID fromAgentID)
19 {
20 int channel = 0;
21 int startIndex = 0;
22 string message = String.Empty;
23 if (args.Length < 1)
24 {
25 return "usage: whisper (optional channel) whatever";
26 }
27 else if (args.Length > 1)
28 {
29 try
30 {
31 channel = Convert.ToInt32(args[0]);
32 startIndex = 1;
33 }
34 catch (FormatException)
35 {
36 channel = 0;
37 }
38 }
39  
40 for (int i = startIndex; i < args.Length; i++)
41 {
42 // Append a space before the next arg
43 if( i > 0 )
44 message += " ";
45 message += args[i];
46 }
47  
48 Client.Self.Chat(message, channel, ChatType.Whisper);
49  
50 return "Whispered " + message;
51 }
52 }
53 }