diff --git a/libsecondlife-cs/examples/TestClient/Commands/SayCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/SayCommand.cs index 7f40e617..d5d1f3bb 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/SayCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/SayCommand.cs @@ -16,14 +16,31 @@ namespace libsecondlife.TestClient public override string Execute(SecondLife Client, string[] args, LLUUID fromAgentID) { - if (args.Length < 1) - return "usage: say whatever"; + int channel = 0; + int startIndex = 0; + string message = String.Empty; + if (args.Length < 1) + { + return "usage: say (optional channel) whatever"; + } + else if (args.Length > 1) + { + try + { + channel = Convert.ToInt32(args[0]); + startIndex = 1; + } + catch (FormatException) + { + channel = 0; + } + } + + for (int i = startIndex; i < args.Length; i++) { + message += args[i] + " "; + } - string message = String.Empty; - foreach (string s in args) - message += s + " "; - - Client.Self.Chat(message, 0, MainAvatar.ChatType.Normal); + Client.Self.Chat(message, channel, MainAvatar.ChatType.Normal); return "Said " + message; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/ShoutCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/ShoutCommand.cs index 6b3082c5..0e18d8da 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/ShoutCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/ShoutCommand.cs @@ -16,14 +16,32 @@ namespace libsecondlife.TestClient public override string Execute(SecondLife Client, string[] args, LLUUID fromAgentID) { - if (args.Length < 1) - return "usage: whisper whatever"; - + int channel = 0; + int startIndex = 0; string message = String.Empty; - foreach (string s in args) - message += s + " "; + if (args.Length < 1) + { + return "usage: shout (optional channel) whatever"; + } + else if (args.Length > 1) + { + try + { + channel = Convert.ToInt32(args[0]); + startIndex = 1; + } + catch (FormatException) + { + channel = 0; + } + } - Client.Self.Chat(message, 0, MainAvatar.ChatType.Shout); + for (int i = startIndex; i < args.Length; i++) + { + message += args[i] + " "; + } + + Client.Self.Chat(message, channel, MainAvatar.ChatType.Shout); return "Shouted " + message; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/WhisperCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/WhisperCommand.cs index a33774b8..d94029c3 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/WhisperCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/WhisperCommand.cs @@ -16,14 +16,32 @@ namespace libsecondlife.TestClient public override string Execute(SecondLife Client, string[] args, LLUUID fromAgentID) { - if (args.Length < 1) - return "usage: whisper whatever"; - + int channel = 0; + int startIndex = 0; string message = String.Empty; - foreach (string s in args) - message += s + " "; + if (args.Length < 1) + { + return "usage: whisper (optional channel) whatever"; + } + else if (args.Length > 1) + { + try + { + channel = Convert.ToInt32(args[0]); + startIndex = 1; + } + catch (FormatException) + { + channel = 0; + } + } - Client.Self.Chat(message, 0, MainAvatar.ChatType.Whisper); + for (int i = startIndex; i < args.Length; i++) + { + message += args[i] + " "; + } + + Client.Self.Chat(message, channel, MainAvatar.ChatType.Whisper); return "Whispered " + message; }