Adds two TestClient commands: ParcelVoiceInfo VoiceAcountCommand to display parcel's voice settings and to display voice account information Courtesy of DrScofield Mantis#220

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1753 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
Jim Radford
2008-04-22 00:31:37 +00:00
parent 0e0e948505
commit cda27f0a6c
3 changed files with 136 additions and 0 deletions

View File

@@ -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();
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -111,6 +111,8 @@
<Compile Include="Commands\System\ShowEffectsCommand.cs" />
<Compile Include="Commands\TouchCommand.cs" />
<Compile Include="Commands\TreeCommand.cs" />
<Compile Include="Commands\Voice\ParcelVoiceInfo.cs" />
<Compile Include="Commands\Voice\VoiceAcountCommand.cs" />
<Compile Include="Commands\WhoCommand.cs" />
<Compile Include="Parsing.cs" />
<Compile Include="Program.cs" />