From 68b494b2cc54cfdd8fa8a0736332046de3887d6f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 19 Feb 2010 22:44:33 +0000
Subject: Apply http://opensimulator.org/mantis/view.php?id=4495 Adds
IsChildAgent property to IAvatar in MRM. Thanks ziah
---
.../OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs | 3 +++
OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs | 5 +++++
2 files changed, 8 insertions(+)
(limited to 'OpenSim/Region/OptionalModules')
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs
index 03c1e95..3d49732 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs
@@ -34,6 +34,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public interface IAvatar : IEntity
{
+
+ bool IsChildAgent { get; }
+
////
/// Array of worn attachments, empty but not null, if no attachments are worn
///
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs
index 4427426..0786bd9 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs
@@ -70,6 +70,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
set { GetSP().TeleportWithMomentum(value); }
}
+ public bool IsChildAgent
+ {
+ get { return GetSP().IsChildAgent; }
+ }
+
#region IAvatar implementation
public IAvatarAttachment[] Attachments
{
--
cgit v1.1
From d1f2fae3481ea502630eaf2c4d1cdb776b165c05 Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Sat, 20 Feb 2010 11:01:50 +0900
Subject: Formatting cleanup.
---
.../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 123 +++++++++------------
.../SvnSerialiser/SvnBackupModule.cs | 10 +-
2 files changed, 59 insertions(+), 74 deletions(-)
(limited to 'OpenSim/Region/OptionalModules')
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index b04b076..35819a6 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -50,7 +50,6 @@ using OpenSim.Region.Framework.Scenes;
using Caps = OpenSim.Framework.Capabilities.Caps;
using System.Text.RegularExpressions;
-
namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule
@@ -76,7 +75,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// SLVoice client will do a GET on this prefix
private static string m_freeSwitchAPIPrefix;
- // We need to return some information to SLVoice
+ // We need to return some information to SLVoice
// figured those out via curl
// http://vd1.vivox.com/api2/viv_get_prelogin.php
//
@@ -102,9 +101,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
private readonly Dictionary m_UUIDName = new Dictionary();
private Dictionary m_ParcelAddress = new Dictionary();
-
+
private Scene m_scene;
-
+
private IConfig m_config;
@@ -136,9 +135,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
m_freeSwitchServerUser = m_config.GetString("freeswitch_server_user", String.Empty);
m_freeSwitchServerPass = m_config.GetString("freeswitch_server_pass", String.Empty);
m_freeSwitchAPIPrefix = m_config.GetString("freeswitch_api_prefix", String.Empty);
-
+
// XXX: get IP address of HTTP server. (This can be this OpenSim server or another, or could be a dedicated grid service or may live on the freeswitch server)
-
+
string serviceIP = m_config.GetString("freeswitch_service_server", String.Empty);
int servicePort = m_config.GetInt("freeswitch_service_port", 80);
IPAddress serviceIPAddress = IPAddress.Parse(serviceIP);
@@ -156,7 +155,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// m_freeSwitchSubscribeRetry = m_config.GetInt("freeswitch_subscribe_retry", 120);
m_freeSwitchUrlResetPassword = m_config.GetString("freeswitch_password_reset_url", String.Empty);
m_freeSwitchContext = m_config.GetString("freeswitch_context", "default");
-
+
if (String.IsNullOrEmpty(m_freeSwitchServerUser) ||
String.IsNullOrEmpty(m_freeSwitchServerPass) ||
String.IsNullOrEmpty(m_freeSwitchRealm) ||
@@ -182,9 +181,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix),
FreeSwitchSLVoiceGetPreloginHTTPHandler);
-
+
// RestStreamHandler h = new
- // RestStreamHandler("GET",
+ // RestStreamHandler("GET",
// String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
// MainServer.Instance.AddStreamHandler(h);
@@ -202,13 +201,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix),
FreeSwitchSLVoiceBuddyHTTPHandler);
}
-
-
-
-
m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch server {0}", m_freeSwitchRealm);
-
+
m_FreeSwitchDirectory = new FreeSwitchDirectory();
m_FreeSwitchDialplan = new FreeSwitchDialplan();
@@ -225,7 +220,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
}
}
- if (m_pluginEnabled)
+ if (m_pluginEnabled)
{
// we need to capture scene in an anonymous method
// here as we need it later in the callbacks
@@ -233,8 +228,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
OnRegisterCaps(scene, agentID, caps);
};
-
-
try
{
@@ -254,16 +247,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions.");
}
}
-
}
}
-
+
public void PostInitialise()
{
if (m_pluginEnabled)
{
m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene");
-
+
// register the voice interface for this module, so the script engine can call us
m_scene.RegisterModuleInterface(this);
}
@@ -282,15 +274,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
get { return true; }
}
-
+
//
// implementation of IVoiceModule, called by osSetParcelSIPAddress script function
//
public void setLandSIPAddress(string SIPAddress,UUID GlobalID)
{
- m_log.DebugFormat("[FreeSwitchVoice]: setLandSIPAddress parcel id {0}: setting sip address {1}",
+ m_log.DebugFormat("[FreeSwitchVoice]: setLandSIPAddress parcel id {0}: setting sip address {1}",
GlobalID, SIPAddress);
-
+
lock (m_ParcelAddress)
{
if (m_ParcelAddress.ContainsKey(GlobalID.ToString()))
@@ -303,18 +295,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
}
}
}
-
+
//
// OnRegisterCaps is invoked via the scene.EventManager
// everytime OpenSim hands out capabilities to a client
// (login, region crossing). We contribute two capabilities to
// the set of capabilities handed back to the client:
// ProvisionVoiceAccountRequest and ParcelVoiceInfoRequest.
- //
+ //
// ProvisionVoiceAccountRequest allows the client to obtain
// the voice account credentials for the avatar it is
// controlling (e.g., user name, password, etc).
- //
+ //
// ParcelVoiceInfoRequest is invoked whenever the client
// changes from one region or parcel to another.
//
@@ -371,7 +363,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{
System.Threading.Thread.Sleep(2000);
avatar = scene.GetScenePresence(agentID);
-
+
if (avatar == null)
return "undef";
}
@@ -407,8 +399,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm, "http://etsvc02.hursley.ibm.com/api");
LLSDVoiceAccountResponse voiceAccountResponse =
new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm,
- String.Format("http://{0}:{1}{2}/", m_openSimWellKnownHTTPAddress,
- m_freeSwitchServicePort, m_freeSwitchAPIPrefix));
+ String.Format("http://{0}:{1}{2}/", m_openSimWellKnownHTTPAddress,
+ m_freeSwitchServicePort, m_freeSwitchAPIPrefix));
string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
@@ -442,7 +434,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
string avatarName = avatar.Name;
// - check whether we have a region channel in our cache
- // - if not:
+ // - if not:
// create it and cache it
// - send it to the client
// - send channel_uri: as "sip:regionID@m_sipDomain"
@@ -451,12 +443,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
LLSDParcelVoiceInfoResponse parcelVoiceInfo;
string channelUri;
- if (null == scene.LandChannel)
+ if (null == scene.LandChannel)
throw new Exception(String.Format("region \"{0}\": avatar \"{1}\": land data not yet available",
scene.RegionInfo.RegionName, avatarName));
-
-
// get channel_uri: check first whether estate
// settings allow voice, then whether parcel allows
// voice, if all do retrieve or obtain the parcel
@@ -493,22 +483,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
parcelVoiceInfo = new LLSDParcelVoiceInfoResponse(scene.RegionInfo.RegionName, land.LocalID, creds);
string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
- m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": {4}",
+ m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": {4}",
scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, r);
return r;
}
catch (Exception e)
{
- m_log.ErrorFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2}, retry later",
+ m_log.ErrorFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2}, retry later",
scene.RegionInfo.RegionName, avatarName, e.Message);
- m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2} failed",
+ m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2} failed",
scene.RegionInfo.RegionName, avatarName, e.ToString());
return "undef";
}
}
-
///
/// Callback for a client request for ChatSessionRequest
///
@@ -550,7 +539,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
string fwdresponsestr = "";
int fwdresponsecode = 200;
string fwdresponsecontenttype = "text/xml";
-
HttpWebRequest forwardreq = (HttpWebRequest)WebRequest.Create(forwardaddress);
forwardreq.Method = method;
@@ -577,7 +565,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
response["content_type"] = fwdresponsecontenttype;
response["str_response_string"] = fwdresponsestr;
response["int_response_code"] = fwdresponsecode;
-
+
return response;
}
@@ -585,11 +573,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request)
{
m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler called");
-
+
Hashtable response = new Hashtable();
response["content_type"] = "text/xml";
response["keepalive"] = false;
-
+
response["str_response_string"] = String.Format(
"\r\n" +
"\r\n"+
@@ -607,9 +595,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
"",
m_freeSwitchRealm, m_freeSwitchSIPProxy, m_freeSwitchAttemptUseSTUN,
m_freeSwitchEchoServer, m_freeSwitchEchoPort,
- m_freeSwitchDefaultWellKnownIP, m_freeSwitchDefaultTimeout,
+ m_freeSwitchDefaultWellKnownIP, m_freeSwitchDefaultTimeout,
m_freeSwitchUrlResetPassword, "");
-
+
response["int_response_code"] = 200;
m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler return {0}",response["str_response_string"]);
@@ -624,7 +612,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
response["content-type"] = "text/xml";
Hashtable requestBody = parseRequestBody((string)request["body"]);
-
+
if (!requestBody.ContainsKey("auth_token"))
return response;
@@ -632,7 +620,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
//string[] auth_tokenvals = auth_token.Split(':');
//string username = auth_tokenvals[0];
int strcount = 0;
-
+
string[] ids = new string[strcount];
int iter = -1;
@@ -648,7 +636,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
}
StringBuilder resp = new StringBuilder();
resp.Append("");
-
+
resp.Append(string.Format(@"
OK
lib_session
@@ -678,7 +666,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
", ids[i],i,m_freeSwitchRealm,dt));
}
-
+
resp.Append("