diff --git a/libsecondlife/examples/TestClient/Commands/Voice/ParcelVoiceInfo.cs b/libsecondlife/examples/TestClient/Commands/Voice/ParcelVoiceInfo.cs new file mode 100644 index 00000000..0e973bcf --- /dev/null +++ b/libsecondlife/examples/TestClient/Commands/Voice/ParcelVoiceInfo.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using libsecondlife; +using libsecondlife.Packets; + +namespace libsecondlife.TestClient +{ + public class ParcelVoiceInfoCommand : Command + { + private AutoResetEvent ParcelVoiceInfoEvent = new AutoResetEvent(false); + private string VoiceRegionName = null; + private int VoiceLocalID = -1; + private string VoiceChannelURI = null; + + public ParcelVoiceInfoCommand(TestClient testClient) + { + Name = "voiceparcel"; + Description = "obtain parcel voice info. Usage: voiceparcel"; + + Client = testClient; + } + + private bool registered = false; + + private bool IsVoiceManagerRunning() + { + if (null == Client.VoiceManager) return false; + + if (!registered) + { + Client.VoiceManager.OnParcelVoiceInfo += Voice_OnParcelVoiceInfo; + registered = true; + } + return true; + } + + + public override string Execute(string[] args, LLUUID fromAgentID) + { + if (!IsVoiceManagerRunning()) + return String.Format("VoiceManager not running for {0}", fromAgentID); + + if (!Client.VoiceManager.RequestParcelVoiceInfo()) + { + return "RequestParcelVoiceInfo failed. Not available for the current grid?"; + } + ParcelVoiceInfoEvent.WaitOne(30 * 1000, false); + + if (String.IsNullOrEmpty(VoiceRegionName) && -1 == VoiceLocalID) + { + return String.Format("Parcel Voice Info request for {0} failed.", Client.Self.Name); + } + + return String.Format("Parcel Voice Info request for {0}: region name \"{1}\", parcel local id {2}, channel URI {3}", + Client.Self.Name, VoiceRegionName, VoiceLocalID, VoiceChannelURI); + } + + void Voice_OnParcelVoiceInfo(string regionName, int localID, string channelURI) + { + VoiceRegionName = regionName; + VoiceLocalID = localID; + VoiceChannelURI = channelURI; + + ParcelVoiceInfoEvent.Set(); + } + } +} diff --git a/libsecondlife/examples/TestClient/Commands/Voice/VoiceAcountCommand.cs b/libsecondlife/examples/TestClient/Commands/Voice/VoiceAcountCommand.cs new file mode 100644 index 00000000..f7b007aa --- /dev/null +++ b/libsecondlife/examples/TestClient/Commands/Voice/VoiceAcountCommand.cs @@ -0,0 +1,66 @@ + +using System; +using System.Collections.Generic; +using System.Threading; +using libsecondlife; +using libsecondlife.Packets; + +namespace libsecondlife.TestClient +{ + public class VoiceAccountCommand : Command + { + private AutoResetEvent ProvisionEvent = new AutoResetEvent(false); + private string VoiceAccount = null; + private string VoicePassword = null; + + public VoiceAccountCommand(TestClient testClient) + { + Name = "voiceaccount"; + Description = "obtain voice account info. Usage: voiceaccount"; + + Client = testClient; + } + + private bool registered = false; + + private bool IsVoiceManagerRunning() + { + if (null == Client.VoiceManager) return false; + + if (!registered) + { + Client.VoiceManager.OnProvisionAccount += Voice_OnProvisionAccount; + registered = true; + } + return true; + } + + public override string Execute(string[] args, LLUUID fromAgentID) + { + if (!IsVoiceManagerRunning()) + return String.Format("VoiceManager not running for {0}", Client.Self.Name); + + if (!Client.VoiceManager.RequestProvisionAccount()) + { + return "RequestProvisionAccount failed. Not available for the current grid?"; + } + ProvisionEvent.WaitOne(30 * 1000, false); + + if (String.IsNullOrEmpty(VoiceAccount) && String.IsNullOrEmpty(VoicePassword)) + { + return String.Format("Voice account information lookup for {0} failed.", Client.Self.Name); + } + + return String.Format("Voice Account for {0}: user \"{1}\", password \"{2}\"", + Client.Self.Name, VoiceAccount, VoicePassword); + } + + void Voice_OnProvisionAccount(string username, string password) + { + VoiceAccount = username; + VoicePassword = password; + + ProvisionEvent.Set(); + } + } +} \ No newline at end of file diff --git a/libsecondlife/examples/TestClient/TestClient.csproj b/libsecondlife/examples/TestClient/TestClient.csproj index df9c6053..9a6b7c8c 100644 --- a/libsecondlife/examples/TestClient/TestClient.csproj +++ b/libsecondlife/examples/TestClient/TestClient.csproj @@ -111,6 +111,8 @@ + +