Update svn properties, formatting cleanup.

0.6.0-stable
Jeff Ames 2008-08-28 14:41:54 +00:00
parent 086284da55
commit 3bf8858727
37 changed files with 505 additions and 709 deletions

View File

@ -23,7 +23,6 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/ */
using System; using System;
@ -41,11 +40,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public delegate void RestMethodHandler(RequestData rdata); public delegate void RestMethodHandler(RequestData rdata);
public delegate RequestData RestMethodAllocator(OSHttpRequest request, OSHttpResponse response, string path); public delegate RequestData RestMethodAllocator(OSHttpRequest request, OSHttpResponse response, string path);
/// <summary> /// <summary>
/// This interface represents the boundary between the general purpose /// This interface represents the boundary between the general purpose
/// REST plugin handling, and the functionally specific handlers. The /// REST plugin handling, and the functionally specific handlers. The
/// handler knows only to initialize and terminate all such handlers /// handler knows only to initialize and terminate all such handlers
/// that it finds. Implementing this interface identifies the class as /// that it finds. Implementing this interface identifies the class as
/// a REST handler implementation. /// a REST handler implementation.
/// </summary> /// </summary>
@ -55,7 +54,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
string MsgId { get; } string MsgId { get; }
string RequestId { get; } string RequestId { get; }
void AddPathHandler(RestMethodHandler mh, string path, RestMethodAllocator ma); void AddPathHandler(RestMethodHandler mh, string path, RestMethodAllocator ma);
void AddStreamHandler(string httpMethod, string path, RestMethod method); void AddStreamHandler(string httpMethod, string path, RestMethod method);

View File

@ -23,7 +23,6 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/ */
using System; using System;
@ -44,14 +43,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// <summary> /// <summary>
/// This class represents the current REST request. It /// This class represents the current REST request. It
/// encapsulates the request/response state and takes care /// encapsulates the request/response state and takes care
/// of response generation without exposing the REST handler /// of response generation without exposing the REST handler
/// to the actual mechanisms involved. /// to the actual mechanisms involved.
/// ///
/// This structure is created on entry to the Handler /// This structure is created on entry to the Handler
/// method and is disposed of upon return. It is part of /// method and is disposed of upon return. It is part of
/// the plug-in infrastructure, rather than the functionally /// the plug-in infrastructure, rather than the functionally
/// specific REST handler, and fundamental changes to /// specific REST handler, and fundamental changes to
/// this should be reflected in the Rest HandlerVersion. The /// this should be reflected in the Rest HandlerVersion. The
/// object is instantiated, and may be extended by, any /// object is instantiated, and may be extended by, any
/// given handler. See the inventory handler for an example /// given handler. See the inventory handler for an example
@ -84,7 +83,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// Storing information in body will suppress the return of // Storing information in body will suppress the return of
// statusBody which is only intended to report status on // statusBody which is only intended to report status on
// requests which do not themselves ordinarily generate // requests which do not themselves ordinarily generate
// an informational response. All of this is handled in // an informational response. All of this is handled in
// Respond(). // Respond().
internal byte[] buffer = null; internal byte[] buffer = null;
@ -92,8 +91,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal string bodyType = "text/html"; internal string bodyType = "text/html";
// The encoding in effect is set to a server default. It may // The encoding in effect is set to a server default. It may
// subsequently be overridden by a Content header. This // subsequently be overridden by a Content header. This
// value is established during construction and is used // value is established during construction and is used
// wherever encoding services are needed. // wherever encoding services are needed.
internal Encoding encoding = Rest.Encoding; internal Encoding encoding = Rest.Encoding;
@ -110,7 +109,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// The path part of the URI is decomposed. pathNodes // The path part of the URI is decomposed. pathNodes
// is an array of every element in the URI. Parameters // is an array of every element in the URI. Parameters
// is an array that contains only those nodes that // is an array that contains only those nodes that
// are not a part of the authority prefix // are not a part of the authority prefix
private string[] pathNodes = null; private string[] pathNodes = null;
@ -118,7 +117,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private static readonly string[] EmptyPath = { String.Empty }; private static readonly string[] EmptyPath = { String.Empty };
// The status code gets set during the course of processing // The status code gets set during the course of processing
// and is the HTTP completion code. The status body is // and is the HTTP completion code. The status body is
// initialized during construction, is appended to during the // initialized during construction, is appended to during the
// course of execution, and is finalized during Respond // course of execution, and is finalized during Respond
// processing. // processing.
@ -166,7 +165,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// force selection of a particular authentication model // force selection of a particular authentication model
// (choosing from amongst those supported of course) // (choosing from amongst those supported of course)
// //
internal bool authenticated = false; internal bool authenticated = false;
internal string scheme = null; internal string scheme = null;
internal string realm = Rest.Realm; internal string realm = Rest.Realm;
@ -183,7 +182,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal string userPass = String.Empty; internal string userPass = String.Empty;
// Session related tables. These are only needed if QOP is set to "auth-sess" // Session related tables. These are only needed if QOP is set to "auth-sess"
// and for now at least, it is not. Session related authentication is of // and for now at least, it is not. Session related authentication is of
// questionable merit in the context of REST anyway, but it is, arguably, more // questionable merit in the context of REST anyway, but it is, arguably, more
// secure. // secure.
@ -199,23 +198,23 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private static Regex schema = new Regex("^\\s*(?<scheme>\\w+)\\s*.*", private static Regex schema = new Regex("^\\s*(?<scheme>\\w+)\\s*.*",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static Regex basicParms = new Regex("^\\s*(?:\\w+)\\s+(?<pval>\\S+)\\s*", private static Regex basicParms = new Regex("^\\s*(?:\\w+)\\s+(?<pval>\\S+)\\s*",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static Regex digestParm1 = new Regex("\\s*(?<parm>\\w+)\\s*=\\s*\"(?<pval>[^\"]+)\"", private static Regex digestParm1 = new Regex("\\s*(?<parm>\\w+)\\s*=\\s*\"(?<pval>[^\"]+)\"",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static Regex digestParm2 = new Regex("\\s*(?<parm>\\w+)\\s*=\\s*(?<pval>[^\\p{P}\\s]+)", private static Regex digestParm2 = new Regex("\\s*(?<parm>\\w+)\\s*=\\s*(?<pval>[^\\p{P}\\s]+)",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static Regex reuserPass = new Regex("(?<user>[^:]+):(?<pass>[\\S\\s]*)", private static Regex reuserPass = new Regex("(?<user>[^:]+):(?<pass>[\\S\\s]*)",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
// For efficiency, we create static instances of these objects // For efficiency, we create static instances of these objects
private static MD5 md5hash = MD5.Create(); private static MD5 md5hash = MD5.Create();
private static StringComparer sc = StringComparer.OrdinalIgnoreCase; private static StringComparer sc = StringComparer.OrdinalIgnoreCase;
#region properties #region properties
@ -228,15 +227,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
/// <summary> /// <summary>
/// Return a boolean indication of whether or no an authenticated user is /// Return a boolean indication of whether or no an authenticated user is
/// associated with this request. This could be wholly integrated, but /// associated with this request. This could be wholly integrated, but
/// that would make authentication mandatory. /// that would make authentication mandatory.
/// </summary> /// </summary>
internal bool IsAuthenticated internal bool IsAuthenticated
{ {
get get
{ {
if (Rest.Authenticate) if (Rest.Authenticate)
{ {
if (!authenticated) if (!authenticated)
@ -258,31 +257,31 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal string[] PathNodes internal string[] PathNodes
{ {
get get
{ {
return pathNodes; return pathNodes;
} }
} }
/// <summary> /// <summary>
/// Access to all non-prefix 'nodes' in the supplied URI as an /// Access to all non-prefix 'nodes' in the supplied URI as an
/// array of strings. These identify a specific resource that /// array of strings. These identify a specific resource that
/// is managed by the authority (the prefix). /// is managed by the authority (the prefix).
/// </summary> /// </summary>
internal string[] Parameters internal string[] Parameters
{ {
get get
{ {
return parameters; return parameters;
} }
} }
#endregion properties #endregion properties
#region constructors #region constructors
// Constructor // Constructor
internal RequestData(OSHttpRequest p_request, OSHttpResponse p_response, string p_qprefix) internal RequestData(OSHttpRequest p_request, OSHttpResponse p_response, string p_qprefix)
{ {
@ -315,7 +314,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// Realm, domain, etc. /// Realm, domain, etc.
/// ///
/// This method checks to see if the current request is already /// This method checks to see if the current request is already
/// authenticated for this domain. If it is, then it returns /// authenticated for this domain. If it is, then it returns
/// true. If it is not, then it issues a challenge to the client /// true. If it is not, then it issues a challenge to the client
/// and responds negatively to the request. /// and responds negatively to the request.
/// ///
@ -339,7 +338,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} Challenge reason: No authorization data", MsgId); Rest.Log.DebugFormat("{0} Challenge reason: No authorization data", MsgId);
DoChallenge(); DoChallenge();
} }
// So, we have authentication data, now we have to check to // So, we have authentication data, now we have to check to
// see what we got and whether or not it is valid for the // see what we got and whether or not it is valid for the
// current domain. To do this we need to interpret the data // current domain. To do this we need to interpret the data
@ -438,7 +437,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// The service provider can force a particular scheme by // The service provider can force a particular scheme by
// assigning a value to scheme. // assigning a value to scheme.
// Basic authentication is pretty simple. // Basic authentication is pretty simple.
// Just specify the realm in question. // Just specify the realm in question.
@ -468,8 +467,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
sbuilder.Append(" "); sbuilder.Append(" ");
// Specify the effective realm. This should // Specify the effective realm. This should
// never be null if we are uthenticating, as it is required for all // never be null if we are uthenticating, as it is required for all
// authentication schemes. It defines, in conjunction with the // authentication schemes. It defines, in conjunction with the
// absolute URI information, the domain to which the authentication // absolute URI information, the domain to which the authentication
// applies. It is an arbitrary string. I *believe* this allows an // applies. It is an arbitrary string. I *believe* this allows an
// authentication to apply to disjoint resources within the same // authentication to apply to disjoint resources within the same
@ -485,7 +484,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
// Share our nonce. This is *uniquely* generated each time a 401 is // Share our nonce. This is *uniquely* generated each time a 401 is
// returned. We do not generate a very sophisticated nonce at the // returned. We do not generate a very sophisticated nonce at the
// moment (it's simply a base64 encoded UUID). // moment (it's simply a base64 encoded UUID).
if (nonce != null) if (nonce != null)
@ -532,7 +531,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
sbuilder.Append(Rest.CS_COMMA); sbuilder.Append(Rest.CS_COMMA);
} }
// Theoretically QOP is optional, but it is required by a compliant // Theoretically QOP is optional, but it is required by a compliant
// with current versions of the scheme. In fact IE requires that QOP // with current versions of the scheme. In fact IE requires that QOP
// be specified and will refuse to authenticate otherwise. // be specified and will refuse to authenticate otherwise.
@ -555,7 +554,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
// We don't know the userid that will be used // We don't know the userid that will be used
// so we cannot make any authentication domain // so we cannot make any authentication domain
// assumptions. So the prefix will determine // assumptions. So the prefix will determine
// this. // this.
@ -582,7 +581,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// understand this and also expect it to be the first one /// understand this and also expect it to be the first one
/// offered. So we do. /// offered. So we do.
/// OpenSim also needs this, as it is the only scheme that allows /// OpenSim also needs this, as it is the only scheme that allows
/// authentication using the hashed passwords stored in the /// authentication using the hashed passwords stored in the
/// user database. /// user database.
/// </summary> /// </summary>
@ -599,7 +598,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
foreach (Match m in matches) foreach (Match m in matches)
{ {
authparms.Add("response",m.Groups["pval"].Value); authparms.Add("response",m.Groups["pval"].Value);
Rest.Log.DebugFormat("{0} Parameter matched : {1} = {2}", Rest.Log.DebugFormat("{0} Parameter matched : {1} = {2}",
MsgId, "response", m.Groups["pval"].Value); MsgId, "response", m.Groups["pval"].Value);
} }
@ -623,7 +622,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
/// <summary> /// <summary>
/// This method provides validation in support of the BASIC /// This method provides validation in support of the BASIC
/// authentication method. This is not normaly expected to be /// authentication method. This is not normaly expected to be
/// used, but is included for completeness (and because I tried /// used, but is included for completeness (and because I tried
/// it first). /// it first).
@ -664,12 +663,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
string last; string last;
// Distinguish the parts, if necessary // Distinguish the parts, if necessary
if ((x=user.IndexOf(Rest.C_SPACE)) != -1) if ((x=user.IndexOf(Rest.C_SPACE)) != -1)
{ {
first = user.Substring(0,x); first = user.Substring(0,x);
last = user.Substring(x+1); last = user.Substring(x+1);
} }
else else
{ {
first = user; first = user;
@ -685,9 +684,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
HA1 = HashToString(pass); HA1 = HashToString(pass);
HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt)); HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt));
return (0 == sc.Compare(HA1, udata.PasswordHash)); return (0 == sc.Compare(HA1, udata.PasswordHash));
} }
#endregion authentication_basic #endregion authentication_basic
@ -712,7 +711,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
foreach (Match m in matches) foreach (Match m in matches)
{ {
authparms.Add(m.Groups["parm"].Value,m.Groups["pval"].Value); authparms.Add(m.Groups["parm"].Value,m.Groups["pval"].Value);
Rest.Log.DebugFormat("{0} String Parameter matched : {1} = {2}", Rest.Log.DebugFormat("{0} String Parameter matched : {1} = {2}",
MsgId, m.Groups["parm"].Value,m.Groups["pval"].Value); MsgId, m.Groups["parm"].Value,m.Groups["pval"].Value);
} }
@ -723,7 +722,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
foreach (Match m in matches) foreach (Match m in matches)
{ {
authparms.Add(m.Groups["parm"].Value,m.Groups["pval"].Value); authparms.Add(m.Groups["parm"].Value,m.Groups["pval"].Value);
Rest.Log.DebugFormat("{0} Tokenized Parameter matched : {1} = {2}", Rest.Log.DebugFormat("{0} Tokenized Parameter matched : {1} = {2}",
MsgId, m.Groups["parm"].Value,m.Groups["pval"].Value); MsgId, m.Groups["parm"].Value,m.Groups["pval"].Value);
} }
@ -760,7 +759,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (!authparms.TryGetValue("nonce", out nonce) || nonce == null) if (!authparms.TryGetValue("nonce", out nonce) || nonce == null)
{ {
Rest.Log.WarnFormat("{0} Authentication failed: nonce missing", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: nonce missing", MsgId);
break; break;
} }
@ -771,7 +770,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
if (temp != opaque) if (temp != opaque)
{ {
Rest.Log.WarnFormat("{0} Authentication failed: bad opaque value", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: bad opaque value", MsgId);
break; break;
} }
} }
@ -783,7 +782,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
if (temp != algorithm) if (temp != algorithm)
{ {
Rest.Log.WarnFormat("{0} Authentication failed: bad algorithm value", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: bad algorithm value", MsgId);
break; break;
} }
} }
@ -800,7 +799,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (!authparms.ContainsKey("cnonce")) if (!authparms.ContainsKey("cnonce"))
{ {
Rest.Log.WarnFormat("{0} Authentication failed: cnonce missing", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: cnonce missing", MsgId);
break; break;
} }
@ -808,7 +807,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (!authparms.TryGetValue("nc", out nck) || nck == null) if (!authparms.TryGetValue("nc", out nck) || nck == null)
{ {
Rest.Log.WarnFormat("{0} Authentication failed: cnonce counter missing", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: cnonce counter missing", MsgId);
break; break;
} }
@ -820,7 +819,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (Rest.Hex2Int(ncl) >= Rest.Hex2Int(nck)) if (Rest.Hex2Int(ncl) >= Rest.Hex2Int(nck))
{ {
Rest.Log.WarnFormat("{0} Authentication failed: bad cnonce counter", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: bad cnonce counter", MsgId);
break; break;
} }
cntable[nonce] = nck; cntable[nonce] = nck;
@ -840,12 +839,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// these MUST NOT be present. // these MUST NOT be present.
if (authparms.ContainsKey("cnonce")) if (authparms.ContainsKey("cnonce"))
{ {
Rest.Log.WarnFormat("{0} Authentication failed: invalid cnonce", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: invalid cnonce", MsgId);
break; break;
} }
if (authparms.ContainsKey("nc")) if (authparms.ContainsKey("nc"))
{ {
Rest.Log.WarnFormat("{0} Authentication failed: invalid cnonce counter[2]", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: invalid cnonce counter[2]", MsgId);
break; break;
} }
} }
@ -854,7 +853,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
authenticated = ValidateDigest(userName, nonce, cnonce, nck, authPrefix, response); authenticated = ValidateDigest(userName, nonce, cnonce, nck, authPrefix, response);
} }
while (false); while (false);
} }
@ -864,10 +863,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// <summary> /// <summary>
/// This mechanism is used by the digest authentication mechanism /// This mechanism is used by the digest authentication mechanism
/// to return the user's password. In fact, because the OpenSim /// to return the user's password. In fact, because the OpenSim
/// user's passwords are already hashed, and the HTTP mechanism /// user's passwords are already hashed, and the HTTP mechanism
/// does not supply an open password, the hashed passwords cannot /// does not supply an open password, the hashed passwords cannot
/// be used unless the client has used the same salting mechanism /// be used unless the client has used the same salting mechanism
/// to has the password before using it in the authentication /// to has the password before using it in the authentication
/// algorithn. This is not inconceivable... /// algorithn. This is not inconceivable...
/// </summary> /// </summary>
@ -879,12 +878,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
string last; string last;
// Distinguish the parts, if necessary // Distinguish the parts, if necessary
if ((x=user.IndexOf(Rest.C_SPACE)) != -1) if ((x=user.IndexOf(Rest.C_SPACE)) != -1)
{ {
first = user.Substring(0,x); first = user.Substring(0,x);
last = user.Substring(x+1); last = user.Substring(x+1);
} }
else else
{ {
first = user; first = user;
@ -955,7 +954,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
HA2 = HashToString(patt); HA2 = HashToString(patt);
// Generate Digest // Generate Digest
if (qop != String.Empty) if (qop != String.Empty)
{ {
patt = String.Format("{0}:{1}:{2}:{3}:{4}:{5}", HA1, nonce, nck, cnonce, qop, HA2); patt = String.Format("{0}:{1}:{2}:{3}:{4}:{5}", HA1, nonce, nck, cnonce, qop, HA2);
@ -1011,7 +1010,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
/// <summary> /// <summary>
/// Indicate a functionally-dependent conclusion to the /// Indicate a functionally-dependent conclusion to the
/// request. See Rest.cs for a list of possible values. /// request. See Rest.cs for a list of possible values.
/// </summary> /// </summary>
@ -1023,7 +1022,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// <summary> /// <summary>
/// Indicate that a request should be redirected, using /// Indicate that a request should be redirected, using
/// the HTTP completion codes. Permanent and temporary /// the HTTP completion codes. Permanent and temporary
/// redirections may be indicated. The supplied URL is /// redirections may be indicated. The supplied URL is
/// the new location of the resource. /// the new location of the resource.
/// </summary> /// </summary>
@ -1057,7 +1056,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
/// <summary> /// <summary>
/// For the more adventurous. This failure also includes a /// For the more adventurous. This failure also includes a
/// specified entity to be appended to the code-related /// specified entity to be appended to the code-related
/// status string. /// status string.
/// </summary> /// </summary>
@ -1101,12 +1100,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
fail = true; fail = true;
// Respond to the client's request, tag the response (for the // Respond to the client's request, tag the response (for the
// benefit of trace) to indicate the reason. // benefit of trace) to indicate the reason.
Respond(String.Format("Failure response: ({0}) : {1}", Respond(String.Format("Failure response: ({0}) : {1}",
code, Rest.HttpStatusDesc[code])); code, Rest.HttpStatusDesc[code]));
// Finally initialize and the throw a RestException. All of the // Finally initialize and the throw a RestException. All of the
// handler's infrastructure knows that this is a "normal" // handler's infrastructure knows that this is a "normal"
// completion from a code point-of-view. // completion from a code point-of-view.
@ -1129,7 +1128,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Fail(Rest.HttpStatusCodeNotImplemented, "request rejected (not implemented)"); Fail(Rest.HttpStatusCodeNotImplemented, "request rejected (not implemented)");
} }
// This MUST be called by an agent handler before it returns // This MUST be called by an agent handler before it returns
// control to Handle, otherwise the request will be ignored. // control to Handle, otherwise the request will be ignored.
// This is called implciitly for the REST stream handlers and // This is called implciitly for the REST stream handlers and
// is harmless if it is called twice. // is harmless if it is called twice.
@ -1222,7 +1221,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
// Set the status code & description. If nothing has been stored, // Set the status code & description. If nothing has been stored,
// we consider that a success. // we consider that a success.
if (statusCode == 0) if (statusCode == 0)
@ -1236,7 +1235,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// For a redirect we need to set the relocation header accordingly // For a redirect we need to set the relocation header accordingly
if (response.StatusCode == (int) Rest.HttpStatusCodeTemporaryRedirect || if (response.StatusCode == (int) Rest.HttpStatusCodeTemporaryRedirect ||
response.StatusCode == (int) Rest.HttpStatusCodePermanentRedirect) response.StatusCode == (int) Rest.HttpStatusCodePermanentRedirect)
{ {
Rest.Log.DebugFormat("{0} Re-direct location is {1}", MsgId, redirectLocation); Rest.Log.DebugFormat("{0} Re-direct location is {1}", MsgId, redirectLocation);
@ -1252,7 +1251,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// We've left the setting of handled' until the // We've left the setting of handled' until the
// last minute because the header settings included // last minute because the header settings included
// above are pretty harmless. But everything from // above are pretty harmless. But everything from
// here on down probably leaves the response // here on down probably leaves the response
// element unusable by anyone else. // element unusable by anyone else.
handled = true; handled = true;
@ -1267,7 +1266,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (buffer != null && buffer.Length != 0) if (buffer != null && buffer.Length != 0)
{ {
Rest.Log.DebugFormat("{0} Entity buffer, length = {1} : <{2}>", Rest.Log.DebugFormat("{0} Entity buffer, length = {1} : <{2}>",
MsgId, buffer.Length, encoding.GetString(buffer)); MsgId, buffer.Length, encoding.GetString(buffer));
response.OutputStream.Write(buffer, 0, buffer.Length); response.OutputStream.Write(buffer, 0, buffer.Length);
} }
@ -1295,11 +1294,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
if (Rest.DEBUG) if (Rest.DEBUG)
{ {
Rest.Log.DebugFormat("{0} Adding header: <{1}: {2}>", Rest.Log.DebugFormat("{0} Adding header: <{1}: {2}>",
MsgId, hdr, data); MsgId, hdr, data);
if (response.Headers.Get(hdr) != null) if (response.Headers.Get(hdr) != null)
{ {
Rest.Log.DebugFormat("{0} Multipe {1} headers will be generated>", Rest.Log.DebugFormat("{0} Multipe {1} headers will be generated>",
MsgId, hdr); MsgId, hdr);
} }
} }
@ -1313,7 +1312,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} Removing header: <{1}>", MsgId, hdr); Rest.Log.DebugFormat("{0} Removing header: <{1}>", MsgId, hdr);
if (response.Headers.Get(hdr) == null) if (response.Headers.Get(hdr) == null)
{ {
Rest.Log.DebugFormat("{0} No such header existed", Rest.Log.DebugFormat("{0} No such header existed",
MsgId, hdr); MsgId, hdr);
} }
} }
@ -1326,7 +1325,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
for (int i=0;i<response.Headers.Count;i++) for (int i=0;i<response.Headers.Count;i++)
{ {
Rest.Log.DebugFormat("{0} Header[{1}] : {2}", MsgId, i, Rest.Log.DebugFormat("{0} Header[{1}] : {2}", MsgId, i,
response.Headers.Get(i)); response.Headers.Get(i));
} }
} }
@ -1404,7 +1403,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// If we succeeded in getting a path, perform any // If we succeeded in getting a path, perform any
// additional pre-processing required. // additional pre-processing required.
if (path != null) if (path != null)
{ {
if (Rest.ExtendedEscape) if (Rest.ExtendedEscape)
{ {
@ -1442,14 +1441,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
parameters = new string[0]; parameters = new string[0];
} }
// Generate a debug list of the decoded parameters // Generate a debug list of the decoded parameters
if (Rest.DEBUG && prfxlen < path.Length-1) if (Rest.DEBUG && prfxlen < path.Length-1)
{ {
Rest.Log.DebugFormat("{0} URI: Parameters: {1}", MsgId, path.Substring(prfxlen)); Rest.Log.DebugFormat("{0} URI: Parameters: {1}", MsgId, path.Substring(prfxlen));
for (int i = 0; i < parameters.Length; i++) for (int i = 0; i < parameters.Length; i++)
{ {
Rest.Log.DebugFormat("{0} Parameter[{1}]: {2}", MsgId, i, parameters[i]); Rest.Log.DebugFormat("{0} Parameter[{1}]: {2}", MsgId, i, parameters[i]);
} }
} }

View File

@ -23,7 +23,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
@ -38,11 +38,9 @@ using Nini.Config;
namespace OpenSim.ApplicationPlugins.Rest.Inventory namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
public class Rest public class Rest
{ {
internal static readonly log4net.ILog Log =
internal static readonly log4net.ILog Log =
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
internal static bool DEBUG = Log.IsDebugEnabled; internal static bool DEBUG = Log.IsDebugEnabled;
@ -77,7 +75,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// HTTP requires that status information be generated for PUT /// HTTP requires that status information be generated for PUT
/// and POST opertaions. This is in support of that. The /// and POST opertaions. This is in support of that. The
/// operation verb gets substituted into the first string, /// operation verb gets substituted into the first string,
/// and the completion code is inserted into the tail. The /// and the completion code is inserted into the tail. The
/// strings are put here to encourage consistency. /// strings are put here to encourage consistency.
/// </summary> /// </summary>
@ -88,7 +86,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
static Rest() static Rest()
{ {
HttpStatusDesc = new Dictionary<int,string>(); HttpStatusDesc = new Dictionary<int,string>();
if (HttpStatusCodeArray.Length != HttpStatusDescArray.Length) if (HttpStatusCodeArray.Length != HttpStatusDescArray.Length)
{ {
Log.ErrorFormat("{0} HTTP Status Code and Description arrays do not match"); Log.ErrorFormat("{0} HTTP Status Code and Description arrays do not match");
@ -143,7 +141,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// supported by all servers. See Respond /// supported by all servers. See Respond
/// to see how these are handled. /// to see how these are handled.
/// </summary> /// </summary>
// REST AGENT 1.0 interpretations // REST AGENT 1.0 interpretations
public const string GET = "get"; // information retrieval - server state unchanged public const string GET = "get"; // information retrieval - server state unchanged
public const string HEAD = "head"; // same as get except only the headers are returned. public const string HEAD = "head"; // same as get except only the headers are returned.
@ -175,7 +173,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public static readonly char C_PERIOD = '.'; public static readonly char C_PERIOD = '.';
public static readonly char C_COMMA = ','; public static readonly char C_COMMA = ',';
public static readonly char C_DQUOTE = '"'; public static readonly char C_DQUOTE = '"';
public static readonly string CS_SPACE = " "; public static readonly string CS_SPACE = " ";
public static readonly string CS_SLASH = "/"; public static readonly string CS_SLASH = "/";
public static readonly string CS_PATHSEP = "/"; public static readonly string CS_PATHSEP = "/";
@ -184,7 +182,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public static readonly string CS_PERIOD = "."; public static readonly string CS_PERIOD = ".";
public static readonly string CS_COMMA = ","; public static readonly string CS_COMMA = ",";
public static readonly string CS_DQUOTE = "\""; public static readonly string CS_DQUOTE = "\"";
public static readonly char[] CA_SPACE = { C_SPACE }; public static readonly char[] CA_SPACE = { C_SPACE };
public static readonly char[] CA_SLASH = { C_SLASH }; public static readonly char[] CA_SLASH = { C_SLASH };
public static readonly char[] CA_PATHSEP = { C_PATHSEP }; public static readonly char[] CA_PATHSEP = { C_PATHSEP };
@ -392,7 +390,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public const string AS_DIGEST = "Digest"; public const string AS_DIGEST = "Digest";
/// Supported Digest algorithms /// Supported Digest algorithms
public const string Digest_MD5 = "MD5"; // assumedd efault if omitted public const string Digest_MD5 = "MD5"; // assumedd efault if omitted
public const string Digest_MD5Sess = "MD5-sess"; public const string Digest_MD5Sess = "MD5-sess";
@ -440,7 +438,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
int val = 0; int val = 0;
int sum = 0; int sum = 0;
string tmp = null; string tmp = null;
if (hex != null) if (hex != null)
{ {
tmp = hex.ToLower(); tmp = hex.ToLower();
@ -455,7 +453,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
return sum; return sum;
} }
// Nonce management // Nonce management
@ -465,17 +462,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
return StringToBase64(CreationDate + Guid.NewGuid().ToString()); return StringToBase64(CreationDate + Guid.NewGuid().ToString());
} }
// Dump he specified data stream; // Dump the specified data stream
public static void Dump(byte[] data) public static void Dump(byte[] data)
{ {
char[] buffer = new char[Rest.DumpLineSize]; char[] buffer = new char[Rest.DumpLineSize];
int cc = 0; int cc = 0;
for (int i = 0; i < data.Length; i++) for (int i = 0; i < data.Length; i++)
{ {
if (i % Rest.DumpLineSize == 0) Console.Write("\n{0}: ",i.ToString("d8")); if (i % Rest.DumpLineSize == 0) Console.Write("\n{0}: ",i.ToString("d8"));
if (i % 4 == 0) Console.Write(" "); if (i % 4 == 0) Console.Write(" ");
@ -494,7 +489,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Console.Write(" |"+(new String(buffer))+"|"); Console.Write(" |"+(new String(buffer))+"|");
cc = 0; cc = 0;
} }
} }
// Finish off any incomplete line // Finish off any incomplete line
@ -504,33 +498,29 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
for (int i = cc ; i < Rest.DumpLineSize; i++) for (int i = cc ; i < Rest.DumpLineSize; i++)
{ {
if (i % 4 == 0) Console.Write(" "); if (i % 4 == 0) Console.Write(" ");
Console.Write(" "); Console.Write(" ");
buffer[i % Rest.DumpLineSize] = ' '; buffer[i % Rest.DumpLineSize] = ' ';
} }
Console.WriteLine(" |"+(new String(buffer))+"|"); Console.WriteLine(" |"+(new String(buffer))+"|");
} }
else else
{ {
Console.Write("\n"); Console.Write("\n");
} }
} }
} }
// Local exception type // Local exception type
public class RestException : Exception public class RestException : Exception
{ {
internal int statusCode; internal int statusCode;
internal string statusDesc; internal string statusDesc;
internal string httpmethod; internal string httpmethod;
internal string httppath; internal string httppath;
public RestException(string msg) : base(msg) public RestException(string msg) : base(msg)
{ {
} }
} }
} }

View File

@ -23,7 +23,6 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/ */
using libsecondlife; using libsecondlife;
@ -40,10 +39,8 @@ using OpenSim.Framework.Communications.Cache;
namespace OpenSim.ApplicationPlugins.Rest.Inventory namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
public class RestAssetServices : IRest public class RestAssetServices : IRest
{ {
private bool enabled = false; private bool enabled = false;
private string qPrefix = "assets"; private string qPrefix = "assets";
@ -52,7 +49,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public RestAssetServices() public RestAssetServices()
{ {
Rest.Log.InfoFormat("{0} Asset services initializing", MsgId); Rest.Log.InfoFormat("{0} Asset services initializing", MsgId);
Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version); Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version);
@ -73,7 +69,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
enabled = true; enabled = true;
Rest.Log.InfoFormat("{0} Asset services initialization complete", MsgId); Rest.Log.InfoFormat("{0} Asset services initialization complete", MsgId);
} }
// Post-construction, pre-enabled initialization opportunity // Post-construction, pre-enabled initialization opportunity
@ -84,7 +79,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
// Called by the plug-in to halt REST processing. Local processing is // Called by the plug-in to halt REST processing. Local processing is
// disabled, and control blocks until all current processing has // disabled, and control blocks until all current processing has
// completed. No new processing will be started // completed. No new processing will be started
public void Close() public void Close()
@ -111,14 +106,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private void DoAsset(RequestData rparm) private void DoAsset(RequestData rparm)
{ {
if (!enabled) return; if (!enabled) return;
AssetRequestData rdata = (AssetRequestData) rparm; AssetRequestData rdata = (AssetRequestData) rparm;
Rest.Log.DebugFormat("{0} REST Asset handler ENTRY", MsgId); Rest.Log.DebugFormat("{0} REST Asset handler ENTRY", MsgId);
// Now that we know this is a serious attempt to // Now that we know this is a serious attempt to
// access inventory data, we should find out who // access inventory data, we should find out who
// is asking, and make sure they are authorized // is asking, and make sure they are authorized
// to do so. We need to validate the caller's // to do so. We need to validate the caller's
@ -129,9 +123,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// With the present HTTP server we can't use the // With the present HTTP server we can't use the
// builtin authentication mechanisms because they // builtin authentication mechanisms because they
// would be enforced for all in-bound requests. // would be enforced for all in-bound requests.
// Instead we look at the headers ourselves and // Instead we look at the headers ourselves and
// handle authentication directly. // handle authentication directly.
try try
{ {
if (!rdata.IsAuthenticated) if (!rdata.IsAuthenticated)
@ -144,13 +138,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (e.statusCode == Rest.HttpStatusCodeNotAuthorized) if (e.statusCode == Rest.HttpStatusCodeNotAuthorized)
{ {
Rest.Log.WarnFormat("{0} User not authenticated", MsgId); Rest.Log.WarnFormat("{0} User not authenticated", MsgId);
Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId,
rdata.request.Headers.Get("Authorization")); rdata.request.Headers.Get("Authorization"));
} }
else else
{ {
Rest.Log.ErrorFormat("{0} User authentication failed", MsgId); Rest.Log.ErrorFormat("{0} User authentication failed", MsgId);
Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId,
rdata.request.Headers.Get("Authorization")); rdata.request.Headers.Get("Authorization"));
} }
throw (e); throw (e);
@ -173,7 +167,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
case "post" : case "post" :
case "delete" : case "delete" :
default : default :
Rest.Log.WarnFormat("{0} Asset: Method not supported: {1}", Rest.Log.WarnFormat("{0} Asset: Method not supported: {1}",
MsgId, rdata.method); MsgId, rdata.method);
rdata.Fail(Rest.HttpStatusCodeBadRequest,String.Format("method <{0}> not supported", rdata.method)); rdata.Fail(Rest.HttpStatusCodeBadRequest,String.Format("method <{0}> not supported", rdata.method));
break; break;
@ -186,14 +180,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
Rest.Log.DebugFormat("{0} REST Asset handler EXIT", MsgId); Rest.Log.DebugFormat("{0} REST Asset handler EXIT", MsgId);
} }
#endregion Interface #endregion Interface
private void DoGet(AssetRequestData rdata) private void DoGet(AssetRequestData rdata)
{ {
bool istexture = false; bool istexture = false;
Rest.Log.DebugFormat("{0} REST Asset handler, Method = <{1}> ENTRY", MsgId, rdata.method); Rest.Log.DebugFormat("{0} REST Asset handler, Method = <{1}> ENTRY", MsgId, rdata.method);
@ -203,13 +195,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (rdata.Parameters.Length == 1) if (rdata.Parameters.Length == 1)
{ {
LLUUID uuid = new LLUUID(rdata.Parameters[0]); LLUUID uuid = new LLUUID(rdata.Parameters[0]);
AssetBase asset = Rest.AssetServices.GetAsset(uuid, istexture); AssetBase asset = Rest.AssetServices.GetAsset(uuid, istexture);
if (asset != null) if (asset != null)
{ {
Rest.Log.DebugFormat("{0} Asset located <{1}>", MsgId, rdata.Parameters[0]); Rest.Log.DebugFormat("{0} Asset located <{1}>", MsgId, rdata.Parameters[0]);
rdata.initXmlWriter(); rdata.initXmlWriter();
@ -237,7 +227,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
rdata.Complete(); rdata.Complete();
rdata.Respond("Asset " + rdata.method + ": Normal completion"); rdata.Respond("Asset " + rdata.method + ": Normal completion");
} }
private void DoPut(AssetRequestData rdata) private void DoPut(AssetRequestData rdata)
@ -255,7 +244,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (!xml.ReadToFollowing("Asset")) if (!xml.ReadToFollowing("Asset"))
{ {
Rest.Log.DebugFormat("{0} Invalid request data: <{1}>", MsgId, rdata.path); Rest.Log.DebugFormat("{0} Invalid request data: <{1}>", MsgId, rdata.path);
rdata.Fail(Rest.HttpStatusCodeBadRequest,"invalid request data"); rdata.Fail(Rest.HttpStatusCodeBadRequest,"invalid request data");
} }
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
@ -272,12 +261,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
else else
{ {
Rest.Log.DebugFormat("{0} Invalid parameters: <{1}>", MsgId, rdata.path); Rest.Log.DebugFormat("{0} Invalid parameters: <{1}>", MsgId, rdata.path);
rdata.Fail(Rest.HttpStatusCodeNotFound, "invalid parameters"); rdata.Fail(Rest.HttpStatusCodeNotFound, "invalid parameters");
} }
rdata.Complete(); rdata.Complete();
rdata.Respond("Asset " + rdata.method + ": Normal completion"); rdata.Respond("Asset " + rdata.method + ": Normal completion");
} }
internal class AssetRequestData : RequestData internal class AssetRequestData : RequestData
@ -287,6 +275,5 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
} }
} }
} }
} }

View File

@ -23,7 +23,6 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/ */
using System; using System;
@ -35,7 +34,6 @@ using OpenSim.ApplicationPlugins.Rest;
namespace OpenSim.ApplicationPlugins.Rest.Inventory namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
/// <remarks> /// <remarks>
/// The class signature reveals the roles that RestHandler plays. /// The class signature reveals the roles that RestHandler plays.
/// ///
@ -74,10 +72,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// <summary> /// <summary>
/// This static initializer scans the ASSEMBLY for classes that /// This static initializer scans the ASSEMBLY for classes that
/// export the IRest interface and builds a list of them. These /// export the IRest interface and builds a list of them. These
/// are later activated by the handler. To add a new handler it /// are later activated by the handler. To add a new handler it
/// is only necessary to create a new services class that implements /// is only necessary to create a new services class that implements
/// the IRest interface, and recompile the handler. This gives /// the IRest interface, and recompile the handler. This gives
/// all of the build-time flexibility of a modular approach /// all of the build-time flexibility of a modular approach
/// while not introducing yet-another module loader. Note that /// while not introducing yet-another module loader. Note that
/// multiple assembles can still be built, each with its own set /// multiple assembles can still be built, each with its own set
/// of handlers. Examples of services classes are RestInventoryServices /// of handlers. Examples of services classes are RestInventoryServices
@ -86,13 +84,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
static RestHandler() static RestHandler()
{ {
Module[] mods = Assembly.GetExecutingAssembly().GetModules(); Module[] mods = Assembly.GetExecutingAssembly().GetModules();
foreach (Module m in mods) foreach (Module m in mods)
{ {
Type[] types = m.GetTypes(); Type[] types = m.GetTypes();
foreach (Type t in types) foreach (Type t in types)
{ {
try try
{ {
@ -108,7 +105,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
} }
} }
} }
#endregion local static state #endregion local static state
@ -117,13 +113,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// <summary> /// <summary>
/// This routine loads all of the handlers discovered during /// This routine loads all of the handlers discovered during
/// instance initialization. /// instance initialization.
/// A table of all loaded and successfully constructed handlers /// A table of all loaded and successfully constructed handlers
/// is built, and this table is then used by the constructor to /// is built, and this table is then used by the constructor to
/// initialize each of the handlers in turn. /// initialize each of the handlers in turn.
/// NOTE: The loading process does not automatically imply that /// NOTE: The loading process does not automatically imply that
/// the handler has registered any kind of an interface, that /// the handler has registered any kind of an interface, that
/// may be (optionally) done by the handler either during /// may be (optionally) done by the handler either during
/// construction, or during initialization. /// construction, or during initialization.
/// ///
/// I was not able to make this code work within a constructor /// I was not able to make this code work within a constructor
@ -136,7 +132,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
if (!handlersLoaded) if (!handlersLoaded)
{ {
ConstructorInfo ci; ConstructorInfo ci;
Object ht; Object ht;
@ -167,8 +162,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// Name is used to differentiate the message header. // Name is used to differentiate the message header.
public override string Name public override string Name
{ {
get { return "HANDLER"; } get { return "HANDLER"; }
} }
@ -181,7 +176,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// We have to rename these because we want // We have to rename these because we want
// to be able to share the values with other // to be able to share the values with other
// classes in our assembly and the base // classes in our assembly and the base
// names are protected. // names are protected.
public string MsgId public string MsgId
@ -211,7 +206,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
try try
{ {
// This plugin will only be enabled if the broader // This plugin will only be enabled if the broader
// REST plugin mechanism is enabled. // REST plugin mechanism is enabled.
@ -222,7 +216,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// IsEnabled is implemented by the base class and // IsEnabled is implemented by the base class and
// reflects an overall RestPlugin status // reflects an overall RestPlugin status
if (!IsEnabled) if (!IsEnabled)
{ {
Rest.Log.WarnFormat("{0} Plugins are disabled", MsgId); Rest.Log.WarnFormat("{0} Plugins are disabled", MsgId);
return; return;
@ -278,15 +272,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.DumpLineSize); Rest.DumpLineSize);
} }
// Load all of the handlers present in the // Load all of the handlers present in the
// assembly // assembly
// In principle, as we're an application plug-in, // In principle, as we're an application plug-in,
// most of what needs to be done could be done using // most of what needs to be done could be done using
// static resources, however the Open Sim plug-in // static resources, however the Open Sim plug-in
// model makes this an instance, so that's what we // model makes this an instance, so that's what we
// need to be. // need to be.
// There is only one Communications manager per // There is only one Communications manager per
// server, and by inference, only one each of the // server, and by inference, only one each of the
// user, asset, and inventory servers. So we can cache // user, asset, and inventory servers. So we can cache
// those using a static initializer. // those using a static initializer.
@ -329,13 +323,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
Rest.Log.ErrorFormat("{0} Plugin initialization has failed: {1}", MsgId, e.Message); Rest.Log.ErrorFormat("{0} Plugin initialization has failed: {1}", MsgId, e.Message);
} }
} }
/// <summary> /// <summary>
/// In the interests of efficiency, and because we cannot determine whether /// In the interests of efficiency, and because we cannot determine whether
/// or not this instance will actually be harvested, we clobber the only /// or not this instance will actually be harvested, we clobber the only
/// anchoring reference to the working state for this plug-in. What the /// anchoring reference to the working state for this plug-in. What the
/// call to close does is irrelevant to this class beyond knowing that it /// call to close does is irrelevant to this class beyond knowing that it
/// can nullify the reference when it returns. /// can nullify the reference when it returns.
/// To make sure everything is copacetic we make sure the primary interface /// To make sure everything is copacetic we make sure the primary interface
@ -344,7 +337,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public override void Close() public override void Close()
{ {
Rest.Log.InfoFormat("{0} Plugin is terminating", MsgId); Rest.Log.InfoFormat("{0} Plugin is terminating", MsgId);
try try
@ -352,12 +344,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
RemoveAgentHandler(Rest.Name, this); RemoveAgentHandler(Rest.Name, this);
} }
catch (KeyNotFoundException){} catch (KeyNotFoundException){}
foreach (IRest handler in handlers) foreach (IRest handler in handlers)
{ {
handler.Close(); handler.Close();
} }
} }
#endregion overriding methods #endregion overriding methods
@ -383,7 +374,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
foreach (string key in pathHandlers.Keys) foreach (string key in pathHandlers.Keys)
{ {
Rest.Log.DebugFormat("{0} Match testing {1} against agent prefix <{2}>", MsgId, path, key); Rest.Log.DebugFormat("{0} Match testing {1} against agent prefix <{2}>", MsgId, path, key);
// Note that Match will not necessarily find the handler that will // Note that Match will not necessarily find the handler that will
// actually be used - it does no test for the "closest" fit. It // actually be used - it does no test for the "closest" fit. It
// simply reflects that at least one possible handler exists. // simply reflects that at least one possible handler exists.
@ -393,7 +384,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} Matched prefix <{1}>", MsgId, key); Rest.Log.DebugFormat("{0} Matched prefix <{1}>", MsgId, key);
// This apparently odd evaluation is needed to prevent a match // This apparently odd evaluation is needed to prevent a match
// on anything other than a URI token boundary. Otherwise we // on anything other than a URI token boundary. Otherwise we
// may match on URL's that were not intended for this handler. // may match on URL's that were not intended for this handler.
return ( path.Length == key.Length || return ( path.Length == key.Length ||
@ -406,9 +397,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
foreach (string key in streamHandlers.Keys) foreach (string key in streamHandlers.Keys)
{ {
Rest.Log.DebugFormat("{0} Match testing {1} against stream prefix <{2}>", MsgId, path, key); Rest.Log.DebugFormat("{0} Match testing {1} against stream prefix <{2}>", MsgId, path, key);
// Note that Match will not necessarily find the handler that will // Note that Match will not necessarily find the handler that will
// actually be used - it does no test for the "closest" fit. It // actually be used - it does no test for the "closest" fit. It
// simply reflects that at least one possible handler exists. // simply reflects that at least one possible handler exists.
@ -418,7 +408,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} Matched prefix <{1}>", MsgId, key); Rest.Log.DebugFormat("{0} Matched prefix <{1}>", MsgId, key);
// This apparently odd evaluation is needed to prevent a match // This apparently odd evaluation is needed to prevent a match
// on anything other than a URI token boundary. Otherwise we // on anything other than a URI token boundary. Otherwise we
// may match on URL's that were not intended for this handler. // may match on URL's that were not intended for this handler.
return ( path.Length == key.Length || return ( path.Length == key.Length ||
@ -426,7 +416,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
} }
} }
catch (Exception e) catch (Exception e)
{ {
@ -460,7 +449,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
for (int i = 0; i < request.Headers.Count; i++) for (int i = 0; i < request.Headers.Count; i++)
{ {
Rest.Log.DebugFormat("{0} Header [{1}] : <{2}> = <{3}>", Rest.Log.DebugFormat("{0} Header [{1}] : <{2}> = <{3}>",
MsgId, i, request.Headers.GetKey(i), request.Headers.Get(i)); MsgId, i, request.Headers.GetKey(i), request.Headers.Get(i));
} }
Rest.Log.DebugFormat("{0} URI: {1}", MsgId, request.RawUrl); Rest.Log.DebugFormat("{0} URI: {1}", MsgId, request.RawUrl);
@ -486,7 +475,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} EXIT", MsgId); Rest.Log.DebugFormat("{0} EXIT", MsgId);
return handled; return handled;
} }
#endregion interface methods #endregion interface methods
@ -534,7 +522,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
return rdata.handled; return rdata.handled;
} }
/// <summary> /// <summary>
@ -547,13 +534,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public void AddStreamHandler(string httpMethod, string path, RestMethod method) public void AddStreamHandler(string httpMethod, string path, RestMethod method)
{ {
if (!IsEnabled) if (!IsEnabled)
{ {
return; return;
} }
if (!path.StartsWith(Rest.Prefix)) if (!path.StartsWith(Rest.Prefix))
{ {
path = String.Format("{0}{1}", Rest.Prefix, path); path = String.Format("{0}{1}", Rest.Prefix, path);
} }
@ -571,7 +557,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
Rest.Log.WarnFormat("{0} Ignoring duplicate handler for {1}", MsgId, path); Rest.Log.WarnFormat("{0} Ignoring duplicate handler for {1}", MsgId, path);
} }
} }
/// <summary> /// <summary>
@ -586,10 +571,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal bool FindPathHandler(OSHttpRequest request, OSHttpResponse response) internal bool FindPathHandler(OSHttpRequest request, OSHttpResponse response)
{ {
RequestData rdata = null; RequestData rdata = null;
string bestMatch = null; string bestMatch = null;
if (!IsEnabled) if (!IsEnabled)
{ {
return false; return false;
@ -612,7 +596,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (!String.IsNullOrEmpty(bestMatch)) if (!String.IsNullOrEmpty(bestMatch))
{ {
rdata = pathAllocators[bestMatch](request, response, bestMatch); rdata = pathAllocators[bestMatch](request, response, bestMatch);
Rest.Log.DebugFormat("{0} Path based REST handler matched with <{1}>", MsgId, bestMatch); Rest.Log.DebugFormat("{0} Path based REST handler matched with <{1}>", MsgId, bestMatch);
@ -621,7 +604,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
pathHandlers[bestMatch](rdata); pathHandlers[bestMatch](rdata);
} }
// A plugin generated error indicates a request-related error // A plugin generated error indicates a request-related error
// that has been handled by the plugin. // that has been handled by the plugin.
@ -629,11 +612,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
Rest.Log.WarnFormat("{0} Request failed: {1}", MsgId, r.Message); Rest.Log.WarnFormat("{0} Request failed: {1}", MsgId, r.Message);
} }
} }
return (rdata == null) ? false : rdata.handled; return (rdata == null) ? false : rdata.handled;
} }
/// <summary> /// <summary>
@ -643,7 +624,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public void AddPathHandler(RestMethodHandler mh, string path, RestMethodAllocator ra) public void AddPathHandler(RestMethodHandler mh, string path, RestMethodAllocator ra)
{ {
if (!IsEnabled) if (!IsEnabled)
{ {
return; return;
@ -665,8 +645,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
pathHandlers.Add(path, mh); pathHandlers.Add(path, mh);
pathAllocators.Add(path, ra); pathAllocators.Add(path, ra);
} }
} }
} }

View File

@ -23,7 +23,6 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/ */
using libsecondlife; using libsecondlife;
@ -41,10 +40,8 @@ using OpenSim.Framework.Communications.Cache;
namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
{ {
public class Remote : ITest public class Remote : ITest
{ {
private static readonly int PARM_TESTID = 0; private static readonly int PARM_TESTID = 0;
private static readonly int PARM_COMMAND = 1; private static readonly int PARM_COMMAND = 1;
@ -72,7 +69,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
} }
// Called by the plug-in to halt REST processing. Local processing is // Called by the plug-in to halt REST processing. Local processing is
// disabled, and control blocks until all current processing has // disabled, and control blocks until all current processing has
// completed. No new processing will be started // completed. No new processing will be started
public void Close() public void Close()
@ -91,11 +88,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
// Remote Handler // Remote Handler
// Key information of interest here is the Parameters array, each // Key information of interest here is the Parameters array, each
// entry represents an element of the URI, with element zero being // entry represents an element of the URI, with element zero being
// the // the
public void Execute(RequestData rdata) public void Execute(RequestData rdata)
{ {
if (!enabled) return; if (!enabled) return;
// If we can't relate to what's there, leave it for others. // If we can't relate to what's there, leave it for others.
@ -125,7 +121,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
{ {
DoHelp(rdata); DoHelp(rdata);
} }
} }
private void DoHelp(RequestData rdata) private void DoHelp(RequestData rdata)
{ {
@ -138,7 +134,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
{ {
if (rdata.Parameters.Length >= 6) if (rdata.Parameters.Length >= 6)
{ {
string[] names = rdata.Parameters[PARM_MOVE_AVATAR].Split(Rest.CA_SPACE); string[] names = rdata.Parameters[PARM_MOVE_AVATAR].Split(Rest.CA_SPACE);
ScenePresence avatar = null; ScenePresence avatar = null;
Scene scene = null; Scene scene = null;
@ -149,7 +144,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
String.Format("invalid avatar name: <{0}>",rdata.Parameters[PARM_MOVE_AVATAR])); String.Format("invalid avatar name: <{0}>",rdata.Parameters[PARM_MOVE_AVATAR]));
} }
Rest.Log.WarnFormat("{0} '{1}' command received for {2} {3}", Rest.Log.WarnFormat("{0} '{1}' command received for {2} {3}",
MsgId, rdata.Parameters[0], names[0], names[1]); MsgId, rdata.Parameters[0], names[0], names[1]);
// The first parameter should be an avatar name, look for the // The first parameter should be an avatar name, look for the
@ -171,8 +166,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
if (avatar != null) if (avatar != null)
{ {
Rest.Log.DebugFormat("{0} Move : Avatar {1} located in region {2}",
Rest.Log.DebugFormat("{0} Move : Avatar {1} located in region {2}",
MsgId, rdata.Parameters[PARM_MOVE_AVATAR], scene.RegionInfo.RegionName); MsgId, rdata.Parameters[PARM_MOVE_AVATAR], scene.RegionInfo.RegionName);
try try
@ -185,16 +179,16 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
} }
catch (Exception e) catch (Exception e)
{ {
rdata.Fail(Rest.HttpStatusCodeBadRequest, rdata.Fail(Rest.HttpStatusCodeBadRequest,
String.Format("invalid parameters: {0}", e.Message)); String.Format("invalid parameters: {0}", e.Message));
} }
} }
else else
{ {
rdata.Fail(Rest.HttpStatusCodeBadRequest, rdata.Fail(Rest.HttpStatusCodeBadRequest,
String.Format("avatar {0} not present", rdata.Parameters[PARM_MOVE_AVATAR])); String.Format("avatar {0} not present", rdata.Parameters[PARM_MOVE_AVATAR]));
} }
rdata.Complete(); rdata.Complete();
rdata.Respond("OK"); rdata.Respond("OK");
@ -205,7 +199,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
Rest.Log.WarnFormat("{0} Move: No movement information provided", MsgId); Rest.Log.WarnFormat("{0} Move: No movement information provided", MsgId);
rdata.Fail(Rest.HttpStatusCodeBadRequest, "no movement information provided"); rdata.Fail(Rest.HttpStatusCodeBadRequest, "no movement information provided");
} }
} }
private static readonly string Help = private static readonly string Help =
@ -220,6 +213,5 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
+ "</body>" + "</body>"
+ "</html>" + "</html>"
; ;
} }
} }

View File

@ -112,7 +112,7 @@ namespace OpenSim.Framework
} }
} }
/// <summary> /// <summary>
/// Sometimes the circuitcode may not be known before setting up the connection /// Sometimes the circuitcode may not be known before setting up the connection
/// </summary> /// </summary>
@ -126,7 +126,7 @@ namespace OpenSim.Framework
if (AgentCircuits.ContainsKey((uint)circuitcode) && !AgentCircuits.ContainsKey((uint)newcircuitcode)) if (AgentCircuits.ContainsKey((uint)circuitcode) && !AgentCircuits.ContainsKey((uint)newcircuitcode))
{ {
AgentCircuitData agentData = AgentCircuits[(uint)circuitcode]; AgentCircuitData agentData = AgentCircuits[(uint)circuitcode];
agentData.circuitcode = newcircuitcode; agentData.circuitcode = newcircuitcode;
AgentCircuits.Remove((uint)circuitcode); AgentCircuits.Remove((uint)circuitcode);
@ -155,4 +155,4 @@ namespace OpenSim.Framework
return false; return false;
} }
} }
} }

View File

@ -306,7 +306,7 @@ namespace OpenSim.Framework.Communications.Cache
// "[INVENTORY CACHE]: Received item {0} {1} for user {2}", // "[INVENTORY CACHE]: Received item {0} {1} for user {2}",
// itemInfo.Name, itemInfo.ID, userID); // itemInfo.Name, itemInfo.ID, userID);
InventoryFolderImpl folder = null; InventoryFolderImpl folder = null;
if ( RootFolder != null ) if ( RootFolder != null )
folder = RootFolder.FindFolder(itemInfo.Folder); folder = RootFolder.FindFolder(itemInfo.Folder);

View File

@ -168,7 +168,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
if (userID == LLUUID.Zero) if (userID == LLUUID.Zero)
return; return;
lock (m_userProfiles) lock (m_userProfiles)
{ {
if (m_userProfiles.ContainsKey(userID)) if (m_userProfiles.ContainsKey(userID))

View File

@ -617,9 +617,9 @@ namespace OpenSim.Framework.Communications.Capabilities
IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>();
if(mm != null) if (mm != null)
{ {
if(!mm.UploadCovered(client)) if (!mm.UploadCovered(client))
{ {
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);

View File

@ -53,7 +53,7 @@ namespace OpenSim.Framework.Communications
/// GridInfoService uses the [GridInfo] section of the /// GridInfoService uses the [GridInfo] section of the
/// standard OpenSim.ini file --- which is not optimal, but /// standard OpenSim.ini file --- which is not optimal, but
/// anything else requires a general redesign of the config /// anything else requires a general redesign of the config
/// system. /// system.
/// </remarks> /// </remarks>
public GridInfoService(IConfigSource configSource) public GridInfoService(IConfigSource configSource)
{ {
@ -65,7 +65,7 @@ namespace OpenSim.Framework.Communications
/// </summary> /// </summary>
public GridInfoService() public GridInfoService()
{ {
try try
{ {
IConfigSource configSource = new IniConfigSource(Path.Combine(Util.configDir(), "OpenSim.ini")); IConfigSource configSource = new IniConfigSource(Path.Combine(Util.configDir(), "OpenSim.ini"));
loadGridInfo(configSource); loadGridInfo(configSource);
@ -84,15 +84,15 @@ namespace OpenSim.Framework.Communications
IConfig startupCfg = configSource.Configs["Startup"]; IConfig startupCfg = configSource.Configs["Startup"];
IConfig gridCfg = configSource.Configs["GridInfo"]; IConfig gridCfg = configSource.Configs["GridInfo"];
IConfig netCfg = configSource.Configs["Network"]; IConfig netCfg = configSource.Configs["Network"];
bool grid = startupCfg.GetBoolean("gridmode", false); bool grid = startupCfg.GetBoolean("gridmode", false);
if (grid) if (grid)
_info["mode"] = "grid"; _info["mode"] = "grid";
else else
_info["mode"] = "standalone"; _info["mode"] = "standalone";
if (null != gridCfg) if (null != gridCfg)
{ {
foreach (string k in gridCfg.GetKeys()) foreach (string k in gridCfg.GetKeys())

View File

@ -351,8 +351,8 @@ namespace OpenSim.Framework
bool SendLogoutPacketWhenClosing bool SendLogoutPacketWhenClosing
{ {
set; set;
} }
// [Obsolete("LLClientView Specific - Circuits are unique to LLClientView")] // [Obsolete("LLClientView Specific - Circuits are unique to LLClientView")]
uint CircuitCode { get; } uint CircuitCode { get; }
@ -526,7 +526,7 @@ namespace OpenSim.Framework
event TerrainUnacked OnUnackedTerrain; event TerrainUnacked OnUnackedTerrain;
event ActivateGesture OnActivateGesture; event ActivateGesture OnActivateGesture;
event DeactivateGesture OnDeactivateGesture; event DeactivateGesture OnDeactivateGesture;
// void ActivateGesture(LLUUID assetId, LLUUID gestureId); // void ActivateGesture(LLUUID assetId, LLUUID gestureId);
// [Obsolete("IClientAPI.OutPacket SHOULD NOT EXIST outside of LLClientView please refactor appropriately.")] // [Obsolete("IClientAPI.OutPacket SHOULD NOT EXIST outside of LLClientView please refactor appropriately.")]

View File

@ -278,7 +278,7 @@ namespace OpenSim.Framework.Servers
HandleLLSDRequests(request, response); HandleLLSDRequests(request, response);
return; return;
} }
HandleXmlRpcRequests(request, response); HandleXmlRpcRequests(request, response);
return; return;
} }
@ -498,7 +498,7 @@ namespace OpenSim.Framework.Servers
{ {
// we didn't find a registered llsd handler to service this request // we didn't find a registered llsd handler to service this request
// check if we have a default llsd handler // check if we have a default llsd handler
if (m_defaultLlsdHandler != null) if (m_defaultLlsdHandler != null)
{ {
// LibOMV path // LibOMV path
@ -541,7 +541,7 @@ namespace OpenSim.Framework.Servers
private bool DoWeHaveALLSDHandler(string path) private bool DoWeHaveALLSDHandler(string path)
{ {
string[] pathbase = path.Split('/'); string[] pathbase = path.Split('/');
string searchquery = "/"; string searchquery = "/";
@ -559,27 +559,27 @@ namespace OpenSim.Framework.Servers
foreach (string pattern in m_llsdHandlers.Keys) foreach (string pattern in m_llsdHandlers.Keys)
{ {
if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length) if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length)
{ {
bestMatch = pattern; bestMatch = pattern;
} }
} }
// extra kicker to remove the default XMLRPC login case.. just in case.. // extra kicker to remove the default XMLRPC login case.. just in case..
if (path == "/") if (path == "/")
return false; return false;
if (String.IsNullOrEmpty(bestMatch)) if (String.IsNullOrEmpty(bestMatch))
{ {
return false; return false;
} }
else else
{ {
return true; return true;
} }
} }
@ -588,7 +588,7 @@ namespace OpenSim.Framework.Servers
{ {
llsdHandler = null; llsdHandler = null;
// Pull out the first part of the path // Pull out the first part of the path
// splitting the path by '/' means we'll get the following return.. // splitting the path by '/' means we'll get the following return..
// {0}/{1}/{2} // {0}/{1}/{2}
// where {0} isn't something we really control 100% // where {0} isn't something we really control 100%
@ -599,7 +599,7 @@ namespace OpenSim.Framework.Servers
return false; return false;
for (int i=1; i<pathbase.Length; i++) for (int i=1; i<pathbase.Length; i++)
{ {
searchquery += pathbase[i]; searchquery += pathbase[i];
if (pathbase.Length-1 != i) if (pathbase.Length-1 != i)
searchquery += "/"; searchquery += "/";
@ -609,7 +609,7 @@ namespace OpenSim.Framework.Servers
// //
// [] = optional // [] = optional
// /resource/UUID/action[/action] // /resource/UUID/action[/action]
// //
// now try to get the closest match to the reigstered path // now try to get the closest match to the reigstered path
// at least for OGP, registered path would probably only consist of the /resource/ // at least for OGP, registered path would probably only consist of the /resource/

View File

@ -107,20 +107,20 @@ namespace OpenSim.Framework.Servers
{ {
sb.Append(m_stats.Report()); sb.Append(m_stats.Report());
} }
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
sb.Append(GetThreadsReport()); sb.Append(GetThreadsReport());
m_log.Debug(sb); m_log.Debug(sb);
} }
/// <summary> /// <summary>
/// Get a report about the registered threads in this server. /// Get a report about the registered threads in this server.
/// </summary> /// </summary>
protected string GetThreadsReport() protected string GetThreadsReport()
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
List<Thread> threads = ThreadTracker.GetThreads(); List<Thread> threads = ThreadTracker.GetThreads();
if (threads == null) if (threads == null)
{ {
@ -132,13 +132,13 @@ namespace OpenSim.Framework.Servers
foreach (Thread t in threads) foreach (Thread t in threads)
{ {
sb.Append( sb.Append(
"ID: " + t.ManagedThreadId + ", Name: " + t.Name + ", Alive: " + t.IsAlive "ID: " + t.ManagedThreadId + ", Name: " + t.Name + ", Alive: " + t.IsAlive
+ ", Pri: " + t.Priority + ", State: " + t.ThreadState + Environment.NewLine); + ", Pri: " + t.Priority + ", State: " + t.ThreadState + Environment.NewLine);
} }
} }
return sb.ToString(); return sb.ToString();
} }
/// <summary> /// <summary>
/// Return a report about the uptime of this server /// Return a report about the uptime of this server
@ -312,7 +312,7 @@ namespace OpenSim.Framework.Servers
return; return;
} }
} }
/// <summary> /// <summary>
/// Outputs to the console information about the region /// Outputs to the console information about the region

View File

@ -160,7 +160,7 @@ namespace OpenSim.Grid.UserServer
theUser.HomeRegion, m_config.GridServerURL, theUser.HomeRegion, m_config.GridServerURL,
m_config.GridSendKey, m_config.GridRecvKey); m_config.GridSendKey, m_config.GridRecvKey);
} }
if (startLocationRequest == "last") if (startLocationRequest == "last")
{ {
SimInfo = SimInfo =

View File

@ -34,7 +34,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
/// <summary> /// <summary>
/// When packetqueue dequeues this packet in the outgoing stream, it thread aborts /// When packetqueue dequeues this packet in the outgoing stream, it thread aborts
/// Ensures that the thread abort happens from within the client thread /// Ensures that the thread abort happens from within the client thread
/// regardless of where the close method is called /// regardless of where the close method is called
/// </summary> /// </summary>
class KillPacket : Packet class KillPacket : Packet
@ -42,20 +42,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private Header header; private Header header;
public override void FromBytes(Header header, byte[] bytes, ref int i, ref int packetEnd, byte[] zeroBuffer) public override void FromBytes(Header header, byte[] bytes, ref int i, ref int packetEnd, byte[] zeroBuffer)
{ {
} }
public override void FromBytes(byte[] bytes, ref int i, ref int packetEnd, byte[] zeroBuffer) public override void FromBytes(byte[] bytes, ref int i, ref int packetEnd, byte[] zeroBuffer)
{ {
} }
public override Header Header { get { return header; } set { header = value; }} public override Header Header { get { return header; } set { header = value; }}
public override byte[] ToBytes() public override byte[] ToBytes()
{ {
return new byte[0]; return new byte[0];
} }
public KillPacket() public KillPacket()
{ {
Header = new LowHeader(); Header = new LowHeader();

View File

@ -373,7 +373,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public bool SendLogoutPacketWhenClosing public bool SendLogoutPacketWhenClosing
{ {
set { m_SendLogoutPacketWhenClosing = value; } set { m_SendLogoutPacketWhenClosing = value; }
} }
/* METHODS */ /* METHODS */
@ -459,10 +459,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
GC.Collect(); GC.Collect();
// Sends a KillPacket object, with which, the // Sends a KillPacket object, with which, the
// blockingqueue dequeues and sees it's a killpacket // blockingqueue dequeues and sees it's a killpacket
// and terminates within the context of the client thread. // and terminates within the context of the client thread.
// This ensures that it's done from within the context // This ensures that it's done from within the context
// of the client thread regardless of where Close() is called. // of the client thread regardless of where Close() is called.
KillEndDone(); KillEndDone();
} }
@ -2099,8 +2099,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#endregion #endregion
// Gesture // Gesture
#region Appearance/ Wearables Methods #region Appearance/ Wearables Methods
@ -5964,11 +5962,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (handlerActivateGesture != null) if (handlerActivateGesture != null)
{ {
handlerActivateGesture(this, handlerActivateGesture(this,
activateGesturePacket.Data[0].AssetID, activateGesturePacket.Data[0].AssetID,
activateGesturePacket.Data[0].ItemID); activateGesturePacket.Data[0].ItemID);
} }
else m_log.Error("Null pointer for activateGesture"); else m_log.Error("Null pointer for activateGesture");
break; break;
case PacketType.DeactivateGestures: case PacketType.DeactivateGestures:

View File

@ -234,7 +234,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// to. Packet drop notifies will not be triggered in this // to. Packet drop notifies will not be triggered in this
// configuration! // configuration!
// //
if ((m_SynchronizeClient != null) && (!m_Client.IsActive)) if ((m_SynchronizeClient != null) && (!m_Client.IsActive))
{ {
if (m_SynchronizeClient(m_Client.Scene, packet, if (m_SynchronizeClient(m_Client.Scene, packet,
@ -749,7 +749,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// If we sent a killpacket // If we sent a killpacket
if (packet is KillPacket) if (packet is KillPacket)
Thread.CurrentThread.Abort(); Thread.CurrentThread.Abort();
// Actually make the byte array and send it // Actually make the byte array and send it
byte[] sendbuffer = packet.ToBytes(); byte[] sendbuffer = packet.ToBytes();

View File

@ -260,9 +260,9 @@ namespace OpenSim.Region.Communications.OGS1
catch (SocketException e) catch (SocketException e)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[OGS1 GRID SERVICES]: RequestNeighbours(): Lookup of neighbour {0} failed! Not including in neighbours list. {1}", "[OGS1 GRID SERVICES]: RequestNeighbours(): Lookup of neighbour {0} failed! Not including in neighbours list. {1}",
simIp, e); simIp, e);
continue; continue;
} }
@ -304,7 +304,7 @@ namespace OpenSim.Region.Communications.OGS1
SendParams.Add(requestData); SendParams.Add(requestData);
XmlRpcRequest gridReq = new XmlRpcRequest("simulator_data_request", SendParams); XmlRpcRequest gridReq = new XmlRpcRequest("simulator_data_request", SendParams);
XmlRpcResponse gridResp = null; XmlRpcResponse gridResp = null;
try try
{ {
gridResp = gridReq.Send(serversInfo.GridURL, 3000); gridResp = gridReq.Send(serversInfo.GridURL, 3000);
@ -312,9 +312,9 @@ namespace OpenSim.Region.Communications.OGS1
catch (WebException e) catch (WebException e)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[OGS1 GRID SERVICES]: Communication with the grid server at {0} failed, {1}", "[OGS1 GRID SERVICES]: Communication with the grid server at {0} failed, {1}",
serversInfo.GridURL, e); serversInfo.GridURL, e);
return null; return null;
} }
@ -1621,14 +1621,14 @@ namespace OpenSim.Region.Communications.OGS1
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[OGS1 GRID SERVICES]: CheckRegion Socket Setup exception: {0}:{1}", e.Message, e.StackTrace); "[OGS1 GRID SERVICES]: CheckRegion Socket Setup exception: {0}:{1}", e.Message, e.StackTrace);
return false; return false;
} }
if (timed_out) if (timed_out)
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[OGS1 GRID SERVICES]: socket [{0}] timed out ({1}) waiting to obtain a connection.", "[OGS1 GRID SERVICES]: socket [{0}] timed out ({1}) waiting to obtain a connection.",
m_EndPoint, timeOut * 1000); m_EndPoint, timeOut * 1000);
if (retry) if (retry)

View File

@ -1537,7 +1537,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
{ {
GetClientFunds(client); GetClientFunds(client);
lock(m_KnownClientFunds) lock (m_KnownClientFunds)
{ {
if (!m_KnownClientFunds.ContainsKey(client.AgentId)) if (!m_KnownClientFunds.ContainsKey(client.AgentId))
return 0; return 0;
@ -1570,7 +1570,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
int funds = m_KnownClientFunds[remoteClient.AgentId]; int funds = m_KnownClientFunds[remoteClient.AgentId];
if(salePrice != 0 && funds < salePrice) if (salePrice != 0 && funds < salePrice)
{ {
remoteClient.SendAgentAlertMessage("Unable to buy now. You don't have sufficient funds.", false); remoteClient.SendAgentAlertMessage("Unable to buy now. You don't have sufficient funds.", false);
return; return;
@ -1584,7 +1584,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
remoteClient.SendAgentAlertMessage("Unable to buy now. The object was not found.", false); remoteClient.SendAgentAlertMessage("Unable to buy now. The object was not found.", false);
return; return;
} }
doMoneyTransfer(remoteClient.AgentId, part.OwnerID, salePrice, 5000, "Object buy"); doMoneyTransfer(remoteClient.AgentId, part.OwnerID, salePrice, 5000, "Object buy");
s.PerformObjectBuy(remoteClient, categoryID, localID, saleType); s.PerformObjectBuy(remoteClient, categoryID, localID, saleType);

View File

@ -83,16 +83,13 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
public bool visible_to_parent; public bool visible_to_parent;
} }
public class OpenGridProtocolModule : IRegionModule public class OpenGridProtocolModule : IRegionModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private List<Scene> m_scene = new List<Scene>(); private List<Scene> m_scene = new List<Scene>();
private Dictionary<string, AgentCircuitData> CapsLoginID = new Dictionary<string, AgentCircuitData>(); private Dictionary<string, AgentCircuitData> CapsLoginID = new Dictionary<string, AgentCircuitData>();
private Dictionary<LLUUID, OGPState> m_OGPState = new Dictionary<LLUUID, OGPState>(); private Dictionary<LLUUID, OGPState> m_OGPState = new Dictionary<LLUUID, OGPState>();
#region IRegionModule Members #region IRegionModule Members
@ -134,7 +131,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
m_log.Error("[OGP]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions."); m_log.Error("[OGP]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions.");
} }
} }
} }
if (!m_scene.Contains(scene)) if (!m_scene.Contains(scene))
@ -217,15 +214,12 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
m_log.WarnFormat("[REQUESTREZAVATAR]: {0}", request.ToString()); m_log.WarnFormat("[REQUESTREZAVATAR]: {0}", request.ToString());
LLSDMap requestMap = (LLSDMap)request; LLSDMap requestMap = (LLSDMap)request;
Scene homeScene = GetRootScene(); Scene homeScene = GetRootScene();
if (homeScene == null) if (homeScene == null)
return GenerateNoHandlerMessage(); return GenerateNoHandlerMessage();
RegionInfo reg = homeScene.RegionInfo; RegionInfo reg = homeScene.RegionInfo;
ulong regionhandle = GetOSCompatibleRegionHandle(reg); ulong regionhandle = GetOSCompatibleRegionHandle(reg);
//string RegionURI = reg.ServerURI; //string RegionURI = reg.ServerURI;
@ -234,14 +228,13 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
LLUUID RemoteAgentID = requestMap["agent_id"].AsUUID(); LLUUID RemoteAgentID = requestMap["agent_id"].AsUUID();
// will be used in the future. The client always connects with the aditi agentid currently // will be used in the future. The client always connects with the aditi agentid currently
LLUUID LocalAgentID = RemoteAgentID; LLUUID LocalAgentID = RemoteAgentID;
string FirstName = requestMap["first_name"].AsString(); string FirstName = requestMap["first_name"].AsString();
string LastName = requestMap["last_name"].AsString(); string LastName = requestMap["last_name"].AsString();
OGPState userState = GetOGPState(LocalAgentID); OGPState userState = GetOGPState(LocalAgentID);
userState.first_name = requestMap["first_name"].AsString(); userState.first_name = requestMap["first_name"].AsString();
userState.last_name = requestMap["last_name"].AsString(); userState.last_name = requestMap["last_name"].AsString();
userState.age_verified = requestMap["age_verified"].AsBoolean(); userState.age_verified = requestMap["age_verified"].AsBoolean();
@ -268,7 +261,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
responseMap["region_Y"] = LLSD.FromInteger(reg.RegionLocY * (uint)Constants.RegionSize); // LLY responseMap["region_Y"] = LLSD.FromInteger(reg.RegionLocY * (uint)Constants.RegionSize); // LLY
responseMap["region_id"] = LLSD.FromUUID(reg.originRegionID); responseMap["region_id"] = LLSD.FromUUID(reg.originRegionID);
responseMap["sim_access"] = LLSD.FromString((reg.RegionSettings.Maturity == 1) ? "Mature" : "PG"); responseMap["sim_access"] = LLSD.FromString((reg.RegionSettings.Maturity == 1) ? "Mature" : "PG");
// Generate a dummy agent for the user so we can get back a CAPS path // Generate a dummy agent for the user so we can get back a CAPS path
AgentCircuitData agentData = new AgentCircuitData(); AgentCircuitData agentData = new AgentCircuitData();
agentData.AgentID = LocalAgentID; agentData.AgentID = LocalAgentID;
@ -299,7 +292,6 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
useragent.SecureSessionID=agentData.SecureSessionID; useragent.SecureSessionID=agentData.SecureSessionID;
useragent.SessionID = agentData.SessionID; useragent.SessionID = agentData.SessionID;
UserProfileData userProfile = new UserProfileData(); UserProfileData userProfile = new UserProfileData();
userProfile.AboutText = "OGP User"; userProfile.AboutText = "OGP User";
userProfile.CanDoMask = (uint)0; userProfile.CanDoMask = (uint)0;
@ -338,15 +330,13 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
// Do caps registration // Do caps registration
// get seed cap // get seed cap
// Stick our data in the cache so the region will know something about us // Stick our data in the cache so the region will know something about us
homeScene.CommsManager.UserProfileCacheService.PreloadUserCache(agentData.AgentID, userProfile); homeScene.CommsManager.UserProfileCacheService.PreloadUserCache(agentData.AgentID, userProfile);
// Call 'new user' event handler // Call 'new user' event handler
homeScene.NewUserConnection(reg.RegionHandle, agentData); homeScene.NewUserConnection(reg.RegionHandle, agentData);
//string raCap = string.Empty; //string raCap = string.Empty;
LLUUID AvatarRezCapUUID = LLUUID.Random(); LLUUID AvatarRezCapUUID = LLUUID.Random();
@ -379,16 +369,16 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
public LLSD RezAvatarMethod(string path, LLSD request) public LLSD RezAvatarMethod(string path, LLSD request)
{ {
m_log.WarnFormat("[REZAVATAR]: {0}", request.ToString()); m_log.WarnFormat("[REZAVATAR]: {0}", request.ToString());
LLSDMap responseMap = new LLSDMap(); LLSDMap responseMap = new LLSDMap();
AgentCircuitData userData = null; AgentCircuitData userData = null;
// Only people we've issued a cap can go further // Only people we've issued a cap can go further
if (TryGetAgentCircuitData(path,out userData)) if (TryGetAgentCircuitData(path,out userData))
{ {
LLSDMap requestMap = (LLSDMap)request; LLSDMap requestMap = (LLSDMap)request;
// take these values to start. There's a few more // take these values to start. There's a few more
LLUUID SecureSessionID=requestMap["secure_session_id"].AsUUID(); LLUUID SecureSessionID=requestMap["secure_session_id"].AsUUID();
LLUUID SessionID = requestMap["session_id"].AsUUID(); LLUUID SessionID = requestMap["session_id"].AsUUID();
@ -419,7 +409,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
if (item.ContainsKey("parent_estate_id")) if (item.ContainsKey("parent_estate_id"))
{ {
parentEstateID = item["parent_estate_id"].AsInteger(); parentEstateID = item["parent_estate_id"].AsInteger();
} }
if (item.ContainsKey("region_id")) if (item.ContainsKey("region_id"))
{ {
@ -437,11 +427,11 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
// Locate a home scene suitable for the user. // Locate a home scene suitable for the user.
Scene homeScene = GetRootScene(); Scene homeScene = GetRootScene();
if (homeScene != null) if (homeScene != null)
{ {
// Get a reference to their Cap object so we can pull out the capobjectroot // Get a reference to their Cap object so we can pull out the capobjectroot
OpenSim.Framework.Communications.Capabilities.Caps userCap = OpenSim.Framework.Communications.Capabilities.Caps userCap =
homeScene.GetCapsHandlerForUser(userData.AgentID); homeScene.GetCapsHandlerForUser(userData.AgentID);
//Update the circuit data in the region so this user is authorized //Update the circuit data in the region so this user is authorized
@ -470,7 +460,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
userState.region_id = regionID; userState.region_id = regionID;
userState.src_parent_estate_id = parentEstateID; userState.src_parent_estate_id = parentEstateID;
userState.visible_to_parent = visibleToParent; userState.visible_to_parent = visibleToParent;
// Save state changes // Save state changes
UpdateOGPState(userData.AgentID, userState); UpdateOGPState(userData.AgentID, userState);
@ -481,8 +471,8 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
LLSDArray PositionArray = new LLSDArray(); LLSDArray PositionArray = new LLSDArray();
PositionArray.Add(LLSD.FromInteger(128)); PositionArray.Add(LLSD.FromInteger(128));
PositionArray.Add(LLSD.FromInteger(128)); PositionArray.Add(LLSD.FromInteger(128));
PositionArray.Add(LLSD.FromInteger(40)); PositionArray.Add(LLSD.FromInteger(40));
LLSDArray LookAtArray = new LLSDArray(); LLSDArray LookAtArray = new LLSDArray();
LookAtArray.Add(LLSD.FromInteger(1)); LookAtArray.Add(LLSD.FromInteger(1));
LookAtArray.Add(LLSD.FromInteger(1)); LookAtArray.Add(LLSD.FromInteger(1));
@ -503,44 +493,36 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
responseMap["seed_capability"] = LLSD.FromString("http://" + reg.ExternalHostName + ":" + reg.HttpPort + "/CAPS/" + userCap.CapsObjectPath + "0000/"); responseMap["seed_capability"] = LLSD.FromString("http://" + reg.ExternalHostName + ":" + reg.HttpPort + "/CAPS/" + userCap.CapsObjectPath + "0000/");
responseMap["region"] = LLSD.FromUUID(reg.originRegionID); responseMap["region"] = LLSD.FromUUID(reg.originRegionID);
responseMap["look_at"] = LookAtArray; responseMap["look_at"] = LookAtArray;
responseMap["sim_port"] = LLSD.FromInteger(reg.InternalEndPoint.Port); responseMap["sim_port"] = LLSD.FromInteger(reg.InternalEndPoint.Port);
responseMap["sim_host"] = LLSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString());// + ":" + reg.InternalEndPoint.Port.ToString()); responseMap["sim_host"] = LLSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString());// + ":" + reg.InternalEndPoint.Port.ToString());
responseMap["sim_ip"] = LLSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString()); responseMap["sim_ip"] = LLSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString());
responseMap["session_id"] = LLSD.FromUUID(SessionID); responseMap["session_id"] = LLSD.FromUUID(SessionID);
responseMap["secure_session_id"] = LLSD.FromUUID(SecureSessionID); responseMap["secure_session_id"] = LLSD.FromUUID(SecureSessionID);
responseMap["circuit_code"] = LLSD.FromInteger(circuitcode); responseMap["circuit_code"] = LLSD.FromInteger(circuitcode);
responseMap["position"] = PositionArray; responseMap["position"] = PositionArray;
responseMap["region_id"] = LLSD.FromUUID(reg.originRegionID); responseMap["region_id"] = LLSD.FromUUID(reg.originRegionID);
responseMap["sim_access"] = LLSD.FromString("Mature"); responseMap["sim_access"] = LLSD.FromString("Mature");
responseMap["connect"] = LLSD.FromBoolean(true); responseMap["connect"] = LLSD.FromBoolean(true);
m_log.InfoFormat("[OGP]: host: {0}, IP {1}", responseMap["sim_host"].ToString(), responseMap["sim_ip"].ToString()); m_log.InfoFormat("[OGP]: host: {0}, IP {1}", responseMap["sim_host"].ToString(), responseMap["sim_ip"].ToString());
} }
} }
return responseMap; return responseMap;
} }
public LLSD DerezAvatarMethod(string path, LLSD request) public LLSD DerezAvatarMethod(string path, LLSD request)
{ {
m_log.ErrorFormat("DerezPath: {0}, Request: {1}", path, request.ToString()); m_log.ErrorFormat("DerezPath: {0}, Request: {1}", path, request.ToString());
//LLSD llsdResponse = null; //LLSD llsdResponse = null;
LLSDMap responseMap = new LLSDMap(); LLSDMap responseMap = new LLSDMap();
string[] PathArray = path.Split('/'); string[] PathArray = path.Split('/');
m_log.InfoFormat("[OGP]: prefix {0}, uuid {1}, suffix {2}", PathArray[1], PathArray[2], PathArray[3]); m_log.InfoFormat("[OGP]: prefix {0}, uuid {1}, suffix {2}", PathArray[1], PathArray[2], PathArray[3]);
@ -549,17 +531,15 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
LLUUID userUUID = LLUUID.Zero; LLUUID userUUID = LLUUID.Zero;
if (Helpers.TryParse(uuidString, out userUUID)) if (Helpers.TryParse(uuidString, out userUUID))
{ {
LLUUID RemoteID = uuidString; LLUUID RemoteID = uuidString;
LLUUID LocalID = RemoteID; LLUUID LocalID = RemoteID;
// FIXME: TODO: Routine to map RemoteUUIDs to LocalUUIds // FIXME: TODO: Routine to map RemoteUUIDs to LocalUUIds
// would be done already.. but the client connects with the Aditi UUID // would be done already.. but the client connects with the Aditi UUID
// regardless over the UDP stack // regardless over the UDP stack
OGPState userState = GetOGPState(LocalID); OGPState userState = GetOGPState(LocalID);
if (userState.agent_id != LLUUID.Zero) if (userState.agent_id != LLUUID.Zero)
{ {
//LLSDMap outboundRequestMap = new LLSDMap(); //LLSDMap outboundRequestMap = new LLSDMap();
LLSDMap inboundRequestMap = (LLSDMap)request; LLSDMap inboundRequestMap = (LLSDMap)request;
string rezAvatarString = inboundRequestMap["rez_avatar"].AsString(); string rezAvatarString = inboundRequestMap["rez_avatar"].AsString();
@ -569,12 +549,11 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
LookAtArray.Add(LLSD.FromInteger(1)); LookAtArray.Add(LLSD.FromInteger(1));
LookAtArray.Add(LLSD.FromInteger(1)); LookAtArray.Add(LLSD.FromInteger(1));
LLSDArray PositionArray = new LLSDArray(); LLSDArray PositionArray = new LLSDArray();
PositionArray.Add(LLSD.FromInteger(128)); PositionArray.Add(LLSD.FromInteger(128));
PositionArray.Add(LLSD.FromInteger(128)); PositionArray.Add(LLSD.FromInteger(128));
PositionArray.Add(LLSD.FromInteger(40)); PositionArray.Add(LLSD.FromInteger(40));
LLSDArray lookArray = new LLSDArray(); LLSDArray lookArray = new LLSDArray();
lookArray.Add(LLSD.FromInteger(128)); lookArray.Add(LLSD.FromInteger(128));
lookArray.Add(LLSD.FromInteger(128)); lookArray.Add(LLSD.FromInteger(128));
@ -582,11 +561,11 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
responseMap["connect"] = LLSD.FromBoolean(true);// it's okay to give this user up responseMap["connect"] = LLSD.FromBoolean(true);// it's okay to give this user up
responseMap["look_at"] = LookAtArray; responseMap["look_at"] = LookAtArray;
m_log.WarnFormat("[OGP]: Invoking rez_avatar on host:{0} for avatar: {1} {2}", rezAvatarString, userState.first_name, userState.last_name); m_log.WarnFormat("[OGP]: Invoking rez_avatar on host:{0} for avatar: {1} {2}", rezAvatarString, userState.first_name, userState.last_name);
LLSDMap rezResponseMap = invokeRezAvatarCap(responseMap, rezAvatarString,userState); LLSDMap rezResponseMap = invokeRezAvatarCap(responseMap, rezAvatarString,userState);
// If invoking it returned an error, parse and end // If invoking it returned an error, parse and end
if (rezResponseMap.ContainsKey("connect")) if (rezResponseMap.ContainsKey("connect"))
{ {
@ -599,17 +578,16 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
string rezRespSeedCap = rezResponseMap["seed_capability"].AsString(); string rezRespSeedCap = rezResponseMap["seed_capability"].AsString();
string rezRespSim_ip = rezResponseMap["sim_ip"].AsString(); string rezRespSim_ip = rezResponseMap["sim_ip"].AsString();
string rezRespSim_host = rezResponseMap["sim_host"].AsString(); string rezRespSim_host = rezResponseMap["sim_host"].AsString();
int rrPort = rezResponseMap["sim_port"].AsInteger(); int rrPort = rezResponseMap["sim_port"].AsInteger();
int rrX = rezResponseMap["region_x"].AsInteger(); int rrX = rezResponseMap["region_x"].AsInteger();
int rrY = rezResponseMap["region_y"].AsInteger(); int rrY = rezResponseMap["region_y"].AsInteger();
m_log.ErrorFormat("X:{0}, Y:{1}", rrX, rrY); m_log.ErrorFormat("X:{0}, Y:{1}", rrX, rrY);
LLUUID rrRID = rezResponseMap["region_id"].AsUUID(); LLUUID rrRID = rezResponseMap["region_id"].AsUUID();
string rrAccess = rezResponseMap["sim_access"].AsString(); string rrAccess = rezResponseMap["sim_access"].AsString();
LLSDArray RezResponsePositionArray = (LLSDArray)rezResponseMap["position"]; LLSDArray RezResponsePositionArray = (LLSDArray)rezResponseMap["position"];
responseMap["seed_capability"] = LLSD.FromString(rezRespSeedCap); responseMap["seed_capability"] = LLSD.FromString(rezRespSeedCap);
responseMap["sim_ip"] = LLSD.FromString(Util.GetHostFromDNS(rezRespSim_ip).ToString()); responseMap["sim_ip"] = LLSD.FromString(Util.GetHostFromDNS(rezRespSim_ip).ToString());
@ -619,23 +597,17 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
responseMap["region_y"] = LLSD.FromInteger(rrY ); responseMap["region_y"] = LLSD.FromInteger(rrY );
responseMap["region_id"] = LLSD.FromUUID(rrRID); responseMap["region_id"] = LLSD.FromUUID(rrRID);
responseMap["sim_access"] = LLSD.FromString(rrAccess); responseMap["sim_access"] = LLSD.FromString(rrAccess);
responseMap["position"] = RezResponsePositionArray; responseMap["position"] = RezResponsePositionArray;
responseMap["look_at"] = lookArray; responseMap["look_at"] = lookArray;
responseMap["connect"] = LLSD.FromBoolean(true); responseMap["connect"] = LLSD.FromBoolean(true);
ShutdownConnection(LocalID,this); ShutdownConnection(LocalID,this);
m_log.Warn("RESPONSEDEREZ: " + responseMap.ToString()); m_log.Warn("RESPONSEDEREZ: " + responseMap.ToString());
return responseMap; return responseMap;
} }
else else
{ {
return GenerateNoHandlerMessage(); return GenerateNoHandlerMessage();
} }
} }
@ -649,20 +621,18 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
private LLSDMap invokeRezAvatarCap(LLSDMap responseMap, string CapAddress, OGPState userState) private LLSDMap invokeRezAvatarCap(LLSDMap responseMap, string CapAddress, OGPState userState)
{ {
Scene reg = GetRootScene(); Scene reg = GetRootScene();
WebRequest DeRezRequest = WebRequest.Create(CapAddress); WebRequest DeRezRequest = WebRequest.Create(CapAddress);
DeRezRequest.Method = "POST"; DeRezRequest.Method = "POST";
DeRezRequest.ContentType = "application/xml+llsd"; DeRezRequest.ContentType = "application/xml+llsd";
LLSDMap RAMap = new LLSDMap(); LLSDMap RAMap = new LLSDMap();
LLSDMap AgentParms = new LLSDMap(); LLSDMap AgentParms = new LLSDMap();
LLSDMap RegionParms = new LLSDMap(); LLSDMap RegionParms = new LLSDMap();
LLSDArray Parameter = new LLSDArray(2); LLSDArray Parameter = new LLSDArray(2);
LLSDMap version = new LLSDMap(); LLSDMap version = new LLSDMap();
version["version"] = LLSD.FromInteger(userState.src_version); version["version"] = LLSD.FromInteger(userState.src_version);
Parameter.Add((LLSD)version); Parameter.Add((LLSD)version);
@ -673,7 +643,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
SrcData["region_id"] = LLSD.FromUUID(reg.RegionInfo.originRegionID); SrcData["region_id"] = LLSD.FromUUID(reg.RegionInfo.originRegionID);
SrcData["visible_to_parent"] = LLSD.FromBoolean(userState.visible_to_parent); SrcData["visible_to_parent"] = LLSD.FromBoolean(userState.visible_to_parent);
Parameter.Add((LLSD)SrcData); Parameter.Add((LLSD)SrcData);
AgentParms["first_name"] = LLSD.FromString(userState.first_name); AgentParms["first_name"] = LLSD.FromString(userState.first_name);
AgentParms["last_name"] = LLSD.FromString(userState.last_name); AgentParms["last_name"] = LLSD.FromString(userState.last_name);
AgentParms["agent_id"] = LLSD.FromUUID(userState.agent_id); AgentParms["agent_id"] = LLSD.FromUUID(userState.agent_id);
@ -689,13 +659,12 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
AgentParms["age_verified"] = LLSD.FromBoolean(userState.age_verified); AgentParms["age_verified"] = LLSD.FromBoolean(userState.age_verified);
AgentParms["limited_to_estate"] = LLSD.FromInteger(userState.limited_to_estate); AgentParms["limited_to_estate"] = LLSD.FromInteger(userState.limited_to_estate);
AgentParms["inventory_host"] = LLSD.FromString(userState.inventory_host); AgentParms["inventory_host"] = LLSD.FromString(userState.inventory_host);
// version 1 // version 1
RAMap = AgentParms; RAMap = AgentParms;
// Planned for version 2 // Planned for version 2
// RAMap["agent_params"] = AgentParms; // RAMap["agent_params"] = AgentParms;
RAMap["region_params"] = RegionParms; RAMap["region_params"] = RegionParms;
RAMap["parameter"] = Parameter; RAMap["parameter"] = Parameter;
@ -770,15 +739,13 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
return responseMap; return responseMap;
} }
public LLSD GenerateNoHandlerMessage() public LLSD GenerateNoHandlerMessage()
{ {
LLSDMap map = new LLSDMap(); LLSDMap map = new LLSDMap();
map["reason"] = LLSD.FromString("LLSDRequest"); map["reason"] = LLSD.FromString("LLSDRequest");
map["message"] = LLSD.FromString("No handler registered for LLSD Requests"); map["message"] = LLSD.FromString("No handler registered for LLSD Requests");
map["login"] = LLSD.FromString("false"); map["login"] = LLSD.FromString("false");
return map; return map;
} }
@ -802,7 +769,6 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
CapsLoginID.Remove(path); CapsLoginID.Remove(path);
} }
private Scene GetRootScene() private Scene GetRootScene()
{ {
Scene ReturnScene = null; Scene ReturnScene = null;
@ -815,9 +781,8 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
} }
return ReturnScene; return ReturnScene;
} }
private ulong GetOSCompatibleRegionHandle(RegionInfo reg) private ulong GetOSCompatibleRegionHandle(RegionInfo reg)
{ {
return Util.UIntsToLong(reg.RegionLocX, reg.RegionLocY); return Util.UIntsToLong(reg.RegionLocX, reg.RegionLocY);
@ -849,7 +814,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
returnState.src_version = 1; returnState.src_version = 1;
returnState.src_parent_estate_id = 1; returnState.src_parent_estate_id = 1;
returnState.visible_to_parent = true; returnState.visible_to_parent = true;
return returnState; return returnState;
} }
@ -871,9 +836,10 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
public void DeleteOGPState(LLUUID agentId) public void DeleteOGPState(LLUUID agentId)
{ {
lock (m_OGPState) lock (m_OGPState)
{
if (m_OGPState.ContainsKey(agentId)) if (m_OGPState.ContainsKey(agentId))
m_OGPState.Remove(agentId); m_OGPState.Remove(agentId);
}
} }
private void UpdateOGPState(LLUUID agentId, OGPState state) private void UpdateOGPState(LLUUID agentId, OGPState state)
@ -884,12 +850,13 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
{ {
m_OGPState[agentId] = state; m_OGPState[agentId] = state;
} }
else else
{ {
m_OGPState.Add(agentId,state); m_OGPState.Add(agentId,state);
} }
} }
} }
public void ShutdownConnection(LLUUID avatarId, OpenGridProtocolModule mod) public void ShutdownConnection(LLUUID avatarId, OpenGridProtocolModule mod)
{ {
Scene homeScene = GetRootScene(); Scene homeScene = GetRootScene();
@ -903,22 +870,17 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
ta.Start(); ta.Start();
} }
} }
// Temporary hack to allow teleporting to and from Vaak // Temporary hack to allow teleporting to and from Vaak
private static bool customXertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error) private static bool customXertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
{ {
//if (cert.Subject == "E=root@lindenlab.com, CN=*.vaak.lindenlab.com, O=\"Linden Lab, Inc.\", L=San Francisco, S=California, C=US") //if (cert.Subject == "E=root@lindenlab.com, CN=*.vaak.lindenlab.com, O=\"Linden Lab, Inc.\", L=San Francisco, S=California, C=US")
//{ //{
return true; return true;
//} //}
//return false; //return false;
} }
} }
public class KillAUser public class KillAUser
@ -944,7 +906,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
avToBeKilled.ControllingClient.SendLogoutPacketWhenClosing = false; avToBeKilled.ControllingClient.SendLogoutPacketWhenClosing = false;
Thread.Sleep(30000); Thread.Sleep(30000);
// test for child agent because they might have come back // test for child agent because they might have come back
if (avToBeKilled.IsChildAgent) if (avToBeKilled.IsChildAgent)
{ {
@ -953,12 +915,10 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
} }
} }
} }
} }
public class MonoCert : ICertificatePolicy public class MonoCert : ICertificatePolicy
{ {
#region ICertificatePolicy Members #region ICertificatePolicy Members
public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem)

View File

@ -59,7 +59,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
/// Path for terrains. Technically these may be assets, but I think it's quite nice to split them out. /// Path for terrains. Technically these may be assets, but I think it's quite nice to split them out.
/// </summary> /// </summary>
public static readonly string TERRAINS_PATH = "terrains/"; public static readonly string TERRAINS_PATH = "terrains/";
/// <summary> /// <summary>
/// The character the separates the uuid from extension information in an archived asset filename /// The character the separates the uuid from extension information in an archived asset filename
/// </summary> /// </summary>

View File

@ -212,16 +212,16 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
// Right now we're nastily obtaining the lluuid from the filename // Right now we're nastily obtaining the lluuid from the filename
string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length); string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length);
int i = filename.LastIndexOf(ArchiveConstants.ASSET_EXTENSION_SEPARATOR); int i = filename.LastIndexOf(ArchiveConstants.ASSET_EXTENSION_SEPARATOR);
if (i == -1) if (i == -1)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[ARCHIVER]: Could not find extension information in asset path {0} since it's missing the separator {1}. Skipping", "[ARCHIVER]: Could not find extension information in asset path {0} since it's missing the separator {1}. Skipping",
assetPath, ArchiveConstants.ASSET_EXTENSION_SEPARATOR); assetPath, ArchiveConstants.ASSET_EXTENSION_SEPARATOR);
return false; return false;
} }
string extension = filename.Substring(i); string extension = filename.Substring(i);
string uuid = filename.Remove(filename.Length - extension.Length); string uuid = filename.Remove(filename.Length - extension.Length);

View File

@ -315,13 +315,13 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
public event RegionHandleRequest OnRegionHandleRequest; public event RegionHandleRequest OnRegionHandleRequest;
public event ParcelInfoRequest OnParcelInfoRequest; public event ParcelInfoRequest OnParcelInfoRequest;
public event ActivateGesture OnActivateGesture; public event ActivateGesture OnActivateGesture;
public event DeactivateGesture OnDeactivateGesture; public event DeactivateGesture OnDeactivateGesture;
#pragma warning restore 67 #pragma warning restore 67
#endregion #endregion
public void ActivateGesture(LLUUID assetId, LLUUID gestureId) public void ActivateGesture(LLUUID assetId, LLUUID gestureId)
{ {
} }

View File

@ -103,7 +103,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
Bitmap mapbmp = new Bitmap(256, 256); Bitmap mapbmp = new Bitmap(256, 256);
//long t = System.Environment.TickCount; //long t = System.Environment.TickCount;
//for(int i = 0; i < 10; ++i) { //for (int i = 0; i < 10; ++i) {
terrainRenderer.TerrainToBitmap(mapbmp); terrainRenderer.TerrainToBitmap(mapbmp);
//} //}
//t = System.Environment.TickCount - t; //t = System.Environment.TickCount - t;

View File

@ -97,8 +97,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// No, that doesn't scale it: // No, that doesn't scale it:
// heightvalue = low + mid * (heightvalue - low) / mid; => low + (heightvalue - low) * mid / mid = low + (heightvalue - low) * 1 = low + heightvalue - low = heightvalue // heightvalue = low + mid * (heightvalue - low) / mid; => low + (heightvalue - low) * mid / mid = low + (heightvalue - low) * 1 = low + heightvalue - low = heightvalue
if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue)) if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue))
heightvalue = 0; heightvalue = 0;
else if (heightvalue > 255f) else if (heightvalue > 255f)
@ -136,7 +134,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
int hfdiffi = 0; int hfdiffi = 0;
int hfdiffihighlight = 0; int hfdiffihighlight = 0;
float highlightfactor = 0.18f; float highlightfactor = 0.18f;
try try
{ {
// hfdiffi = Math.Abs((int)((hfdiff * 4) + (hfdiff * 0.5))) + 1; // hfdiffi = Math.Abs((int)((hfdiff * 4) + (hfdiff * 0.5))) + 1;
@ -146,7 +144,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// hfdiffi = hfdiffi + Math.Abs((int)(((hfdiff % 1) * 0.5f) * 10f) - 1); // hfdiffi = hfdiffi + Math.Abs((int)(((hfdiff % 1) * 0.5f) * 10f) - 1);
hfdiffi = hfdiffi + Math.Abs((int)((hfdiff % 1f) * 5f) - 1); hfdiffi = hfdiffi + Math.Abs((int)((hfdiff % 1f) * 5f) - 1);
} }
hfdiffihighlight = Math.Abs((int)((hfdiff * highlightfactor) * 4.5f)) + 1; hfdiffihighlight = Math.Abs((int)((hfdiff * highlightfactor) * 4.5f)) + 1;
if (hfdiff % 1f != 0) if (hfdiff % 1f != 0)
{ {
@ -195,10 +193,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
color = Color.FromArgb((r - hfdiffi > 0) ? r - hfdiffi : 0, color = Color.FromArgb((r - hfdiffi > 0) ? r - hfdiffi : 0,
(g - hfdiffi > 0) ? g - hfdiffi : 0, (g - hfdiffi > 0) ? g - hfdiffi : 0,
(b - hfdiffi > 0) ? b - hfdiffi : 0); (b - hfdiffi > 0) ? b - hfdiffi : 0);
mapbmp.SetPixel(x-1, yr+1, color); mapbmp.SetPixel(x-1, yr+1, color);
} }
} }
} }
} }
@ -213,7 +210,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
color = Color.Black; color = Color.Black;
mapbmp.SetPixel(x, yr, color); mapbmp.SetPixel(x, yr, color);
} }
} }
else else
{ {

View File

@ -82,10 +82,10 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// (for info about algorithm, see http://en.wikipedia.org/wiki/HSL_and_HSV) // (for info about algorithm, see http://en.wikipedia.org/wiki/HSL_and_HSV)
public Color toColor() public Color toColor()
{ {
if(s < 0f) Console.WriteLine("S < 0: " + s); if (s < 0f) Console.WriteLine("S < 0: " + s);
else if(s > 1f) Console.WriteLine("S > 1: " + s); else if (s > 1f) Console.WriteLine("S > 1: " + s);
if(v < 0f) Console.WriteLine("V < 0: " + v); if (v < 0f) Console.WriteLine("V < 0: " + v);
else if(v > 1f) Console.WriteLine("V > 1: " + v); else if (v > 1f) Console.WriteLine("V > 1: " + v);
float f = h / 60f; float f = h / 60f;
int sector = (int)f % 6; int sector = (int)f % 6;
@ -95,7 +95,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
int ti = (int)(v * (1f - (1f - f) * s) * 255f); int ti = (int)(v * (1f - (1f - f) * s) * 255f);
int vi = (int)(v * 255f); int vi = (int)(v * 255f);
switch(sector) switch (sector)
{ {
case 0: case 0:
return Color.FromArgb(vi, ti, pi); return Color.FromArgb(vi, ti, pi);
@ -168,7 +168,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
{ {
AssetBase asset = m_scene.AssetCache.GetAsset(id, true); AssetBase asset = m_scene.AssetCache.GetAsset(id, true);
m_log.DebugFormat("Fetched texture {0}, found: {1}", id, asset != null); m_log.DebugFormat("Fetched texture {0}, found: {1}", id, asset != null);
if(asset == null) return null; if (asset == null) return null;
return new Bitmap(OpenJPEG.DecodeToImage(asset.Data)); return new Bitmap(OpenJPEG.DecodeToImage(asset.Data));
} }
@ -179,9 +179,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// color-channel, so 2^24 is the maximum value we can get, adding everything. // color-channel, so 2^24 is the maximum value we can get, adding everything.
// int is be big enough for that. // int is be big enough for that.
int r = 0, g = 0, b = 0; int r = 0, g = 0, b = 0;
for(int y = 0; y < bmp.Height; ++y) for (int y = 0; y < bmp.Height; ++y)
{ {
for(int x = 0; x < bmp.Width; ++x) for (int x = 0; x < bmp.Width; ++x)
{ {
Color c = bmp.GetPixel(x, y); Color c = bmp.GetPixel(x, y);
r += (int)c.R & 0xff; r += (int)c.R & 0xff;
@ -218,14 +218,14 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// interpolate two colors in HSV space and return the resulting color // interpolate two colors in HSV space and return the resulting color
private HSV interpolateHSV(ref HSV c1, ref HSV c2, float ratio) { private HSV interpolateHSV(ref HSV c1, ref HSV c2, float ratio) {
if(ratio <= 0f) return c1; if (ratio <= 0f) return c1;
if(ratio >= 1f) return c2; if (ratio >= 1f) return c2;
// make sure we are on the same side on the hue-circle for interpolation // make sure we are on the same side on the hue-circle for interpolation
// We change the hue of the parameters here, but we don't change the color // We change the hue of the parameters here, but we don't change the color
// represented by that value // represented by that value
if(c1.h - c2.h > 180f) c1.h -= 360f; if (c1.h - c2.h > 180f) c1.h -= 360f;
else if(c2.h - c1.h > 180f) c1.h += 360f; else if (c2.h - c1.h > 180f) c1.h += 360f;
return new HSV(c1.h * (1f - ratio) + c2.h * ratio, return new HSV(c1.h * (1f - ratio) + c2.h * ratio,
c1.s * (1f - ratio) + c2.s * ratio, c1.s * (1f - ratio) + c2.s * ratio,
@ -321,16 +321,16 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
} }
HSV hsv; HSV hsv;
if(hmod <= low) hsv = hsv1; // too low if (hmod <= low) hsv = hsv1; // too low
else if(hmod >= high) hsv = hsv4; // too high else if (hmod >= high) hsv = hsv4; // too high
else else
{ {
// HSV-interpolate along the colors // HSV-interpolate along the colors
// first, rescale h to 0.0 - 1.0 // first, rescale h to 0.0 - 1.0
hmod = (hmod - low) / (high - low); hmod = (hmod - low) / (high - low);
// now we have to split: 0.00 => color1, 0.33 => color2, 0.67 => color3, 1.00 => color4 // now we have to split: 0.00 => color1, 0.33 => color2, 0.67 => color3, 1.00 => color4
if(hmod < 1f/3f) hsv = interpolateHSV(ref hsv1, ref hsv2, hmod * 3f); if (hmod < 1f/3f) hsv = interpolateHSV(ref hsv1, ref hsv2, hmod * 3f);
else if(hmod < 2f/3f) hsv = interpolateHSV(ref hsv2, ref hsv3, (hmod * 3f) - 1f); else if (hmod < 2f/3f) hsv = interpolateHSV(ref hsv2, ref hsv3, (hmod * 3f) - 1f);
else hsv = interpolateHSV(ref hsv3, ref hsv4, (hmod * 3f) - 2f); else hsv = interpolateHSV(ref hsv3, ref hsv4, (hmod * 3f) - 2f);
} }

View File

@ -276,8 +276,6 @@ namespace OpenSim.Region.Environment.Scenes
if (m_storageManager.EstateDataStore != null) if (m_storageManager.EstateDataStore != null)
m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID); m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID);
//Bind Storage Manager functions to some land manager functions for this scene //Bind Storage Manager functions to some land manager functions for this scene
EventManager.OnLandObjectAdded += EventManager.OnLandObjectAdded +=
new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject); new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject);
@ -322,7 +320,6 @@ namespace OpenSim.Region.Environment.Scenes
{ {
m_log.Warn("Failed to load StartupConfig"); m_log.Warn("Failed to load StartupConfig");
} }
} }
#endregion #endregion
@ -351,7 +348,6 @@ namespace OpenSim.Region.Environment.Scenes
// we add it to the notify list regardless of distance. // we add it to the notify list regardless of distance.
// We'll check the agent's draw distance before notifying them though. // We'll check the agent's draw distance before notifying them though.
if (RegionInfo.RegionHandle != otherRegion.RegionHandle) if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
{ {
for (int i = 0; i < m_neighbours.Count; i++) for (int i = 0; i < m_neighbours.Count; i++)
@ -386,8 +382,7 @@ namespace OpenSim.Region.Environment.Scenes
int resultX = Math.Abs((int)otherRegion.RegionLocX - (int)RegionInfo.RegionLocX); int resultX = Math.Abs((int)otherRegion.RegionLocX - (int)RegionInfo.RegionLocX);
int resultY = Math.Abs((int)otherRegion.RegionLocY - (int)RegionInfo.RegionLocY); int resultY = Math.Abs((int)otherRegion.RegionLocY - (int)RegionInfo.RegionLocY);
if ((resultX <= 1) && if (resultX <= 1 && resultY <= 1)
(resultY <= 1))
{ {
try try
{ {
@ -584,8 +579,6 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
} }
} }
m_scripts_enabled = !ScriptEngine; m_scripts_enabled = !ScriptEngine;
m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine");
@ -600,7 +593,9 @@ namespace OpenSim.Region.Environment.Scenes
public int GetInaccurateNeighborCount() public int GetInaccurateNeighborCount()
{ {
lock (m_neighbours) lock (m_neighbours)
{
return m_neighbours.Count; return m_neighbours.Count;
}
} }
// This is the method that shuts down the scene. // This is the method that shuts down the scene.
@ -1062,7 +1057,6 @@ namespace OpenSim.Region.Environment.Scenes
float hfdiff = hfvalue; float hfdiff = hfvalue;
int hfdiffi = 0; int hfdiffi = 0;
for (int x = 0; x < 256; x++) for (int x = 0; x < 256; x++)
{ {
//int tc = System.Environment.TickCount; //int tc = System.Environment.TickCount;
@ -1087,10 +1081,8 @@ namespace OpenSim.Region.Environment.Scenes
//float tmpval = (float)hm[x, y]; //float tmpval = (float)hm[x, y];
float heightvalue = (float)hm[x, y]; float heightvalue = (float)hm[x, y];
if (heightvalue > (float)m_regInfo.RegionSettings.WaterHeight) if (heightvalue > (float)m_regInfo.RegionSettings.WaterHeight)
{ {
// scale height value // scale height value
heightvalue = low + mid * (heightvalue - low) / mid; heightvalue = low + mid * (heightvalue - low) / mid;
@ -1102,6 +1094,7 @@ namespace OpenSim.Region.Environment.Scenes
if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue)) if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue))
heightvalue = 0; heightvalue = 0;
try try
{ {
Color green = Color.FromArgb((int)heightvalue, 100, (int)heightvalue); Color green = Color.FromArgb((int)heightvalue, 100, (int)heightvalue);
@ -1136,7 +1129,6 @@ namespace OpenSim.Region.Environment.Scenes
// we use floats, colors use bytes, so shrink are space down to // we use floats, colors use bytes, so shrink are space down to
// 0-255 // 0-255
try try
{ {
hfdiffi = Math.Abs((int)((hfdiff * 4) + (hfdiff * 0.5))) + 1; hfdiffi = Math.Abs((int)((hfdiff * 4) + (hfdiff * 0.5))) + 1;
@ -1166,15 +1158,8 @@ namespace OpenSim.Region.Environment.Scenes
mapbmp.SetPixel(x - 1, (256 - y) - 1, Shade); mapbmp.SetPixel(x - 1, (256 - y) - 1, Shade);
} }
} }
} }
} }
} }
catch (System.ArgumentException) catch (System.ArgumentException)
{ {
@ -1264,7 +1249,6 @@ namespace OpenSim.Region.Environment.Scenes
if (part == null) if (part == null)
continue; continue;
// Draw if the object is at least 1 meter wide in any direction // Draw if the object is at least 1 meter wide in any direction
if (part.Scale.X > 1f || part.Scale.Y > 1f || part.Scale.Z > 1f) if (part.Scale.X > 1f || part.Scale.Y > 1f || part.Scale.Z > 1f)
{ {
@ -1426,6 +1410,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
} }
public void LazySaveGeneratedMaptile(byte[] data, bool temporary) public void LazySaveGeneratedMaptile(byte[] data, bool temporary)
{ {
// Overwrites the local Asset cache with new maptile data // Overwrites the local Asset cache with new maptile data
@ -1482,6 +1467,7 @@ namespace OpenSim.Region.Environment.Scenes
asset.Temporary = temporary; asset.Temporary = temporary;
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
} }
#endregion #endregion
#region Load Land #region Load Land
@ -1556,6 +1542,7 @@ namespace OpenSim.Region.Environment.Scenes
pos = RayEnd; pos = RayEnd;
return pos; return pos;
} }
if (RayTargetID != LLUUID.Zero) if (RayTargetID != LLUUID.Zero)
{ {
SceneObjectPart target = GetSceneObjectPart(RayTargetID); SceneObjectPart target = GetSceneObjectPart(RayTargetID);
@ -1921,9 +1908,7 @@ namespace OpenSim.Region.Environment.Scenes
if (position.X > Constants.RegionSize + 0.1f) if (position.X > Constants.RegionSize + 0.1f)
{ {
pos.X = ((pos.X - Constants.RegionSize)); pos.X = ((pos.X - Constants.RegionSize));
newRegionHandle = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize)); newRegionHandle = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize));
// x + 1 // x + 1
} }
else if (position.X < -0.1f) else if (position.X < -0.1f)
@ -2165,9 +2150,7 @@ namespace OpenSim.Region.Environment.Scenes
client.OnScriptReset += ProcessScriptReset; client.OnScriptReset += ProcessScriptReset;
client.OnGetScriptRunning += GetScriptRunning; client.OnGetScriptRunning += GetScriptRunning;
client.OnSetScriptRunning += SetScriptRunning; client.OnSetScriptRunning += SetScriptRunning;
client.OnRegionHandleRequest += RegionHandleRequest; client.OnRegionHandleRequest += RegionHandleRequest;
client.OnUnackedTerrain += TerrainUnAcked; client.OnUnackedTerrain += TerrainUnAcked;
//Gesture //Gesture
@ -2185,7 +2168,6 @@ namespace OpenSim.Region.Environment.Scenes
if (userInfo != null) if (userInfo != null)
{ {
InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId); InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId);
if (item != null) if (item != null)
{ {
@ -2206,7 +2188,6 @@ namespace OpenSim.Region.Environment.Scenes
if (userInfo != null) if (userInfo != null)
{ {
InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId); InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId);
if (item != null) if (item != null)
{ {
@ -2607,7 +2588,6 @@ namespace OpenSim.Region.Environment.Scenes
"[CONNECTION DEBUGGING]: Skipping this region for welcoming avatar {0} [{1}] at {2}", "[CONNECTION DEBUGGING]: Skipping this region for welcoming avatar {0} [{1}] at {2}",
agent.AgentID, regionHandle, RegionInfo.RegionName); agent.AgentID, regionHandle, RegionInfo.RegionName);
} }
} }
public void UpdateCircuitData(AgentCircuitData data) public void UpdateCircuitData(AgentCircuitData data)
@ -2645,9 +2625,8 @@ namespace OpenSim.Region.Environment.Scenes
m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString()); m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString());
} }
} }
} }
/// <summary> /// <summary>
/// Add a caps handler for the given agent. If the CAPS handler already exists for this agent, /// Add a caps handler for the given agent. If the CAPS handler already exists for this agent,
/// then it is replaced by a new CAPS handler. /// then it is replaced by a new CAPS handler.
@ -2905,14 +2884,14 @@ namespace OpenSim.Region.Environment.Scenes
public void RequestTeleportLandmark(IClientAPI remoteClient, LLUUID regionID, LLVector3 position) public void RequestTeleportLandmark(IClientAPI remoteClient, LLUUID regionID, LLVector3 position)
{ {
RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(regionID); RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(regionID);
if (info == null) if (info == null)
{ {
// can't find the region: Tell viewer and abort // can't find the region: Tell viewer and abort
remoteClient.SendTeleportFailed("The teleport destination could not be found."); remoteClient.SendTeleportFailed("The teleport destination could not be found.");
return; return;
} }
lock (m_scenePresences) lock (m_scenePresences)
{ {
if (m_scenePresences.ContainsKey(remoteClient.AgentId)) if (m_scenePresences.ContainsKey(remoteClient.AgentId))
@ -3016,7 +2995,6 @@ namespace OpenSim.Region.Environment.Scenes
m_statsReporter.SetObjectCapacity(objects); m_statsReporter.SetObjectCapacity(objects);
} }
objectCapacity = objects; objectCapacity = objects;
} }
public List<FriendListItem> GetFriendList(LLUUID avatarID) public List<FriendListItem> GetFriendList(LLUUID avatarID)
@ -3089,7 +3067,6 @@ namespace OpenSim.Region.Environment.Scenes
return LLUUID.Zero; return LLUUID.Zero;
} }
/// <summary> /// <summary>
/// This method is a way for the Friends Module to create an instant /// This method is a way for the Friends Module to create an instant
/// message to the avatar and for Instant Messages that travel across /// message to the avatar and for Instant Messages that travel across
@ -3105,7 +3082,6 @@ namespace OpenSim.Region.Environment.Scenes
m_eventManager.TriggerGridInstantMessage(message, options); m_eventManager.TriggerGridInstantMessage(message, options);
} }
public virtual void StoreAddFriendship(LLUUID ownerID, LLUUID friendID, uint perms) public virtual void StoreAddFriendship(LLUUID ownerID, LLUUID friendID, uint perms)
{ {
// TODO: m_sceneGridService.DoStuff; // TODO: m_sceneGridService.DoStuff;
@ -3123,6 +3099,7 @@ namespace OpenSim.Region.Environment.Scenes
// TODO: m_sceneGridService.DoStuff; // TODO: m_sceneGridService.DoStuff;
m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID); m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID);
} }
public virtual List<FriendListItem> StoreGetFriendsForUser(LLUUID ownerID) public virtual List<FriendListItem> StoreGetFriendsForUser(LLUUID ownerID)
{ {
// TODO: m_sceneGridService.DoStuff; // TODO: m_sceneGridService.DoStuff;
@ -3135,11 +3112,13 @@ namespace OpenSim.Region.Environment.Scenes
m_statsReporter.AddOutPackets(outPackets); m_statsReporter.AddOutPackets(outPackets);
m_statsReporter.AddunAckedBytes(unAckedBytes); m_statsReporter.AddunAckedBytes(unAckedBytes);
} }
public void AddAgentTime(int ms) public void AddAgentTime(int ms)
{ {
m_statsReporter.addFrameMS(ms); m_statsReporter.addFrameMS(ms);
m_statsReporter.addAgentMS(ms); m_statsReporter.addAgentMS(ms);
} }
public void AddAgentUpdates(int count) public void AddAgentUpdates(int count)
{ {
m_statsReporter.AddAgentUpdates(count); m_statsReporter.AddAgentUpdates(count);
@ -3239,7 +3218,6 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="Message">The Message being sent to the user</param> /// <param name="Message">The Message being sent to the user</param>
public void SendRegionMessageFromEstateTools(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message) public void SendRegionMessageFromEstateTools(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message)
{ {
List<ScenePresence> presenceList = GetScenePresences(); List<ScenePresence> presenceList = GetScenePresences();
foreach (ScenePresence presence in presenceList) foreach (ScenePresence presence in presenceList)
@ -3359,7 +3337,7 @@ namespace OpenSim.Region.Environment.Scenes
foreach (ScenePresence presence in presenceList) foreach (ScenePresence presence in presenceList)
{ {
if ((presence.Firstname == firstName) && (presence.Lastname == lastName)) if (presence.Firstname == firstName && presence.Lastname == lastName)
{ {
presence.ControllingClient.SendAgentAlertMessage(message, modal); presence.ControllingClient.SendAgentAlertMessage(message, modal);
break; break;
@ -3876,7 +3854,6 @@ namespace OpenSim.Region.Environment.Scenes
return m_httpListener.AddLLSDHandler(path, handler); return m_httpListener.AddLLSDHandler(path, handler);
} }
public void RemoveStreamHandler(string httpMethod, string path) public void RemoveStreamHandler(string httpMethod, string path)
{ {
m_httpListener.RemoveStreamHandler(httpMethod, path); m_httpListener.RemoveStreamHandler(httpMethod, path);
@ -3945,7 +3922,6 @@ namespace OpenSim.Region.Environment.Scenes
client.SendRegionHandle(regionID, info.RegionHandle); client.SendRegionHandle(regionID, info.RegionHandle);
} }
public void TerrainUnAcked(IClientAPI client, int patchX, int patchY) public void TerrainUnAcked(IClientAPI client, int patchX, int patchY)
{ {
//Console.WriteLine("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); //Console.WriteLine("Terrain packet unacked, resending patch: " + patchX + " , " + patchY);
@ -3973,10 +3949,10 @@ namespace OpenSim.Region.Environment.Scenes
public void ObjectSaleInfo(IClientAPI client, LLUUID agentID, LLUUID sessionID, uint localID, byte saleType, int salePrice) public void ObjectSaleInfo(IClientAPI client, LLUUID agentID, LLUUID sessionID, uint localID, byte saleType, int salePrice)
{ {
SceneObjectPart part = GetSceneObjectPart(localID); SceneObjectPart part = GetSceneObjectPart(localID);
if(part == null || part.ParentGroup == null) if (part == null || part.ParentGroup == null)
return; return;
if(part.ParentGroup.RootPart == null) if (part.ParentGroup.RootPart == null)
return; return;
part = part.ParentGroup.RootPart; part = part.ParentGroup.RootPart;
@ -3994,10 +3970,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
SceneObjectPart part = GetSceneObjectPart(localID); SceneObjectPart part = GetSceneObjectPart(localID);
if(part == null) if (part == null)
return; return;
if(part.ParentGroup == null) if (part.ParentGroup == null)
return; return;
SceneObjectGroup group = part.ParentGroup; SceneObjectGroup group = part.ParentGroup;

View File

@ -636,7 +636,7 @@ namespace OpenSim.Region.Environment.Scenes
// both regions // both regions
if (avatar.ParentID != (uint)0) if (avatar.ParentID != (uint)0)
avatar.StandUp(); avatar.StandUp();
if(!avatar.ValidateAttachments()) if (!avatar.ValidateAttachments())
{ {
avatar.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); avatar.ControllingClient.SendTeleportFailed("Inconsistent attachment state");
return; return;

View File

@ -2350,10 +2350,10 @@ namespace OpenSim.Region.Environment.Scenes
// Validate // Validate
foreach (SceneObjectGroup gobj in m_attachments) foreach (SceneObjectGroup gobj in m_attachments)
{ {
if(gobj == null) if (gobj == null)
return false; return false;
if(gobj.RootPart == null) if (gobj.RootPart == null)
{ {
return false; return false;
} }
@ -2370,7 +2370,7 @@ namespace OpenSim.Region.Environment.Scenes
// Validate // Validate
foreach (SceneObjectGroup gobj in m_attachments) foreach (SceneObjectGroup gobj in m_attachments)
{ {
if(gobj == null || gobj.RootPart == null) if (gobj == null || gobj.RootPart == null)
return false; return false;
} }

View File

@ -231,7 +231,7 @@ namespace OpenSim.Region.Physics.Meshing
{ {
int[] result = getIndexListAsInt(); int[] result = getIndexListAsInt();
pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned); pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned);
return result; return result;
} }

View File

@ -1890,9 +1890,9 @@ namespace OpenSim.Region.Physics.Meshing
else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle)
{ // half circle, prim is a sphere { // half circle, prim is a sphere
sides = 24; sides = 24;
profileBegin = 0.5f * profileBegin + 0.5f; profileBegin = 0.5f * profileBegin + 0.5f;
profileEnd = 0.5f * profileEnd + 0.5f; profileEnd = 0.5f * profileEnd + 0.5f;
//profileHollow = 0.0f; // debugging only //profileHollow = 0.0f; // debugging only
} }
@ -1904,7 +1904,6 @@ namespace OpenSim.Region.Physics.Meshing
hollowSides = 4; hollowSides = 4;
else if (primShape.HollowShape == HollowShape.Triangle) else if (primShape.HollowShape == HollowShape.Triangle)
hollowSides = 3; hollowSides = 3;
PrimMesh primMesh = new PrimMesh(sides, profileBegin, profileEnd, profileHollow, hollowSides); PrimMesh primMesh = new PrimMesh(sides, profileBegin, profileEnd, profileHollow, hollowSides);
//PrimMesh primMesh = new PrimMesh(sides, profileBegin, profileEnd, 0.0f, 4); //PrimMesh primMesh = new PrimMesh(sides, profileBegin, profileEnd, 0.0f, 4);

View File

@ -99,8 +99,8 @@ namespace OpenSim.Region.Physics.Meshing
internal List<Angle> angles; internal List<Angle> angles;
// this class should have a table of most commonly computed values // this class should have a table of most commonly computed values
// instead of all the trig function calls // instead of all the trig function calls
// most common would be for sides = 3, 4, or 24 // most common would be for sides = 3, 4, or 24
internal void makeAngles( int sides, float startAngle, float stopAngle ) internal void makeAngles( int sides, float startAngle, float stopAngle )
{ {
angles = new List<Angle>(); angles = new List<Angle>();
@ -134,7 +134,7 @@ namespace OpenSim.Region.Physics.Meshing
newAngle.Y = (float) System.Math.Sin(angle); newAngle.Y = (float) System.Math.Sin(angle);
angles.Add(newAngle); angles.Add(newAngle);
step += 1; step += 1;
angle = stepSize * step; angle = stepSize * step;
} }
if (startAngle > angles[0].angle) if (startAngle > angles[0].angle)
@ -187,15 +187,15 @@ namespace OpenSim.Region.Physics.Meshing
AngleList hollowAngles = new AngleList(); AngleList hollowAngles = new AngleList();
float xScale = 0.5f; float xScale = 0.5f;
float yScale = 0.5f; float yScale = 0.5f;
if (sides == 4) // corners of a square are sqrt(2) from center if (sides == 4) // corners of a square are sqrt(2) from center
{ {
xScale = 0.707f; xScale = 0.707f;
yScale = 0.707f; yScale = 0.707f;
} }
float startAngle = profileStart * twoPi; float startAngle = profileStart * twoPi;
float stopAngle = profileEnd * twoPi; float stopAngle = profileEnd * twoPi;
float stepSize = twoPi / sides; float stepSize = twoPi / sides;
try { angles.makeAngles(sides, startAngle, stopAngle); } try { angles.makeAngles(sides, startAngle, stopAngle); }
@ -397,7 +397,7 @@ namespace OpenSim.Region.Physics.Meshing
{ {
vert = this.coords[i]; vert = this.coords[i];
Vertex v = new Vertex(vert.X, vert.Y, vert.Z) * q; Vertex v = new Vertex(vert.X, vert.Y, vert.Z) * q;
vert.X = v.X; vert.X = v.X;
vert.Y = v.Y; vert.Y = v.Y;
vert.Z = v.Z; vert.Z = v.Z;
@ -507,23 +507,23 @@ namespace OpenSim.Region.Physics.Meshing
s += "sides..................: " + this.sides.ToString(); s += "sides..................: " + this.sides.ToString();
s += "\nhollowSides..........: " + this.hollowSides.ToString(); s += "\nhollowSides..........: " + this.hollowSides.ToString();
s += "\nprofileStart.........: " + this.profileStart.ToString(); s += "\nprofileStart.........: " + this.profileStart.ToString();
s += "\nprofileEnd...........: " + this.profileEnd.ToString(); s += "\nprofileEnd...........: " + this.profileEnd.ToString();
s += "\nhollow...............: " + this.hollow.ToString(); s += "\nhollow...............: " + this.hollow.ToString();
s += "\ntwistBegin...........: " + this.twistBegin.ToString(); s += "\ntwistBegin...........: " + this.twistBegin.ToString();
s += "\ntwistEnd.............: " + this.twistEnd.ToString(); s += "\ntwistEnd.............: " + this.twistEnd.ToString();
s += "\ntopShearX............: " + this.topShearX.ToString(); s += "\ntopShearX............: " + this.topShearX.ToString();
s += "\ntopShearY............: " + this.topShearY.ToString(); s += "\ntopShearY............: " + this.topShearY.ToString();
s += "\npathCutBegin.........: " + this.pathCutBegin.ToString(); s += "\npathCutBegin.........: " + this.pathCutBegin.ToString();
s += "\npathCutEnd...........: " + this.pathCutEnd.ToString(); s += "\npathCutEnd...........: " + this.pathCutEnd.ToString();
s += "\ndimpleBegin..........: " + this.dimpleBegin.ToString(); s += "\ndimpleBegin..........: " + this.dimpleBegin.ToString();
s += "\ndimpleEnd............: " + this.dimpleEnd.ToString(); s += "\ndimpleEnd............: " + this.dimpleEnd.ToString();
s += "\nskew.................: " + this.skew.ToString(); s += "\nskew.................: " + this.skew.ToString();
s += "\nholeSizeX............: " + this.holeSizeX.ToString(); s += "\nholeSizeX............: " + this.holeSizeX.ToString();
s += "\nholeSizeY............: " + this.holeSizeY.ToString(); s += "\nholeSizeY............: " + this.holeSizeY.ToString();
s += "\ntaperX...............: " + this.taperX.ToString(); s += "\ntaperX...............: " + this.taperX.ToString();
s += "\ntaperY...............: " + this.taperY.ToString(); s += "\ntaperY...............: " + this.taperY.ToString();
s += "\nradius...............: " + this.radius.ToString(); s += "\nradius...............: " + this.radius.ToString();
s += "\nrevolutions..........: " + this.revolutions.ToString(); s += "\nrevolutions..........: " + this.revolutions.ToString();
s += "\nstepsPerRevolution...: " + this.stepsPerRevolution.ToString(); s += "\nstepsPerRevolution...: " + this.stepsPerRevolution.ToString();
return s; return s;
@ -542,20 +542,20 @@ namespace OpenSim.Region.Physics.Meshing
this.hollowSides = hollowSides; this.hollowSides = hollowSides;
if (sides < 3) if (sides < 3)
this.sides = 3; this.sides = 3;
if ( hollowSides < 3) if ( hollowSides < 3)
this.hollowSides = 3; this.hollowSides = 3;
if (profileStart < 0.0f) if (profileStart < 0.0f)
this.profileStart = 0.0f; this.profileStart = 0.0f;
if (profileEnd > 1.0f) if (profileEnd > 1.0f)
this.profileEnd = 1.0f; this.profileEnd = 1.0f;
if (profileEnd < 0.02f) if (profileEnd < 0.02f)
this.profileEnd = 0.02f; this.profileEnd = 0.02f;
if (profileStart >= profileEnd) if (profileStart >= profileEnd)
this.profileStart = profileEnd - 0.02f; this.profileStart = profileEnd - 0.02f;
if (hollow > 1.0f) if (hollow > 1.0f)
this.hollow = 1.0f; this.hollow = 1.0f;
if (hollow < 0.0f) if (hollow < 0.0f)
this.hollow = 0.0f; this.hollow = 0.0f;
} }
@ -578,7 +578,7 @@ namespace OpenSim.Region.Physics.Meshing
steps = (int)(steps * 4.5 * length); steps = (int)(steps * 4.5 * length);
} }
#endif #endif
float twistBegin = this.twistBegin / 360.0f * twoPi; float twistBegin = this.twistBegin / 360.0f * twoPi;
float twistEnd = this.twistEnd / 360.0f * twoPi; float twistEnd = this.twistEnd / 360.0f * twoPi;
float twistTotal = twistEnd - twistBegin; float twistTotal = twistEnd - twistBegin;
@ -661,7 +661,7 @@ namespace OpenSim.Region.Physics.Meshing
newLayer.AddValue2Faces(coordsLen); newLayer.AddValue2Faces(coordsLen);
this.coords.AddRange(newLayer.coords); this.coords.AddRange(newLayer.coords);
this.faces.AddRange(newLayer.faces); this.faces.AddRange(newLayer.faces);
// fill faces between layers // fill faces between layers
@ -707,7 +707,6 @@ namespace OpenSim.Region.Physics.Meshing
else done = true; else done = true;
} }
} }
public void ExtrudeCircular() public void ExtrudeCircular()
{ {
@ -721,9 +720,9 @@ namespace OpenSim.Region.Physics.Meshing
float twistEnd = this.twistEnd / 360.0f * twoPi; float twistEnd = this.twistEnd / 360.0f * twoPi;
float twistTotal = twistEnd - twistBegin; float twistTotal = twistEnd - twistBegin;
// if the profile has a lot of twist, add more layers otherwise the layers may overlap // if the profile has a lot of twist, add more layers otherwise the layers may overlap
// and the resulting mesh may be quite inaccurate. This method is arbitrary and doesn't // and the resulting mesh may be quite inaccurate. This method is arbitrary and doesn't
// accurately match the viewer // accurately match the viewer
float twistTotalAbs = Math.Abs(twistTotal); float twistTotalAbs = Math.Abs(twistTotal);
if (twistTotalAbs > 0.01f) if (twistTotalAbs > 0.01f)
{ {
@ -732,19 +731,19 @@ namespace OpenSim.Region.Physics.Meshing
if (twistTotalAbs > Math.PI * 3.0f) if (twistTotalAbs > Math.PI * 3.0f)
steps *= 2; steps *= 2;
} }
float yPathScale = this.holeSizeY * 0.5f; float yPathScale = this.holeSizeY * 0.5f;
float pathLength = this.pathCutEnd - this.pathCutBegin; float pathLength = this.pathCutEnd - this.pathCutBegin;
float totalSkew = this.skew * 2.0f * pathLength; float totalSkew = this.skew * 2.0f * pathLength;
float skewStart = this.pathCutBegin * 2.0f * this.skew - this.skew; float skewStart = this.pathCutBegin * 2.0f * this.skew - this.skew;
// It's not quite clear what pushY (Y top shear) does, but subtracting it from the start and end // It's not quite clear what pushY (Y top shear) does, but subtracting it from the start and end
// angles appears to approximate it's effects on path cut. Likewise, adding it to the angle used // angles appears to approximate it's effects on path cut. Likewise, adding it to the angle used
// to calculate the sine for generating the path radius appears to approximate it's effects there // to calculate the sine for generating the path radius appears to approximate it's effects there
// too, but there are some subtle differences in the radius which are noticeable as the prim size // too, but there are some subtle differences in the radius which are noticeable as the prim size
// increases and it may affect megaprims quite a bit. The effect of the Y top shear parameter on // increases and it may affect megaprims quite a bit. The effect of the Y top shear parameter on
// the meshes generated with this technique appear nearly identical in shape to the same prims when // the meshes generated with this technique appear nearly identical in shape to the same prims when
// displayed by the viewer. // displayed by the viewer.
float startAngle = (twoPi * this.pathCutBegin * this.revolutions) - this.topShearY * 0.9f; float startAngle = (twoPi * this.pathCutBegin * this.revolutions) - this.topShearY * 0.9f;
float endAngle = (twoPi * this.pathCutEnd * this.revolutions) - this.topShearY * 0.9f; float endAngle = (twoPi * this.pathCutEnd * this.revolutions) - this.topShearY * 0.9f;
@ -784,7 +783,7 @@ namespace OpenSim.Region.Physics.Meshing
hollow /= 0.7f; hollow /= 0.7f;
} }
} }
Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides); Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides);
if (initialProfileRot != 0.0f) if (initialProfileRot != 0.0f)
@ -834,7 +833,7 @@ namespace OpenSim.Region.Physics.Meshing
newLayer.AddRot(new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist)); newLayer.AddRot(new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist));
// now orient the rotation of the profile layer relative to it's position on the path // now orient the rotation of the profile layer relative to it's position on the path
// adding taperY to the angle used to generate the quat appears to approximate the viewer // adding taperY to the angle used to generate the quat appears to approximate the viewer
newLayer.AddRot(new Quaternion(new Vertex(1.0f, 0.0f, 0.0f), angle + this.topShearY * 0.9f)); newLayer.AddRot(new Quaternion(new Vertex(1.0f, 0.0f, 0.0f), angle + this.topShearY * 0.9f));
newLayer.AddPos(xOffset, yOffset, zOffset); newLayer.AddPos(xOffset, yOffset, zOffset);
@ -959,7 +958,7 @@ namespace OpenSim.Region.Physics.Meshing
sw.WriteLine(s); sw.WriteLine(s);
} }
sw.Close(); sw.Close();
} }
} }

View File

@ -2296,7 +2296,7 @@ namespace OpenSim.Region.ScriptEngine.Common
bool found = false; bool found = false;
float dist = (float)llVecDist(llGetPos(), pos); float dist = (float)llVecDist(llGetPos(), pos);
if(dist > m_distanceFactor * 10.0f) if (dist > m_distanceFactor * 10.0f)
return; return;
// Instead of using return;, I'm using continue; because in our TaskInventory implementation // Instead of using return;, I'm using continue; because in our TaskInventory implementation
@ -6247,7 +6247,7 @@ namespace OpenSim.Region.ScriptEngine.Common
switch (primType) switch (primType)
{ {
case BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX: case BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX:
case BuiltIn_Commands_BaseClass.PRIM_TYPE_CYLINDER: case BuiltIn_Commands_BaseClass.PRIM_TYPE_CYLINDER:
case BuiltIn_Commands_BaseClass.PRIM_TYPE_PRISM: case BuiltIn_Commands_BaseClass.PRIM_TYPE_PRISM:
res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve)); res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve));
res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
@ -6298,10 +6298,10 @@ namespace OpenSim.Region.ScriptEngine.Common
// vector tapera // vector tapera
res.Add(new LSL_Types.Vector3(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); res.Add(new LSL_Types.Vector3(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0));
// float revolutions, // float revolutions,
res.Add(new LSL_Types.LSLFloat(Shape.PathRevolutions / 50.0)); // needs fixing :( res.Add(new LSL_Types.LSLFloat(Shape.PathRevolutions / 50.0)); // needs fixing :(
// float radiusoffset, // float radiusoffset,
res.Add(new LSL_Types.LSLFloat(Shape.PathRadiusOffset / 100.0)); res.Add(new LSL_Types.LSLFloat(Shape.PathRadiusOffset / 100.0));
// float skew // float skew
@ -7014,10 +7014,10 @@ namespace OpenSim.Region.ScriptEngine.Common
{ {
case 5: // DATA_SIM_POS case 5: // DATA_SIM_POS
if (info == null) if (info == null)
{ {
// ScriptSleep(1000); // ScriptSleep(1000);
return LLUUID.Zero.ToString(); return LLUUID.Zero.ToString();
} }
reply = new LSL_Types.Vector3( reply = new LSL_Types.Vector3(
info.RegionLocX * Constants.RegionSize, info.RegionLocX * Constants.RegionSize,
info.RegionLocY * Constants.RegionSize, info.RegionLocY * Constants.RegionSize,
@ -7031,10 +7031,10 @@ namespace OpenSim.Region.ScriptEngine.Common
break; break;
case 7: // DATA_SIM_RATING case 7: // DATA_SIM_RATING
if (info == null) if (info == null)
{ {
// ScriptSleep(1000); // ScriptSleep(1000);
return LLUUID.Zero.ToString(); return LLUUID.Zero.ToString();
} }
int access = info.RegionSettings.Maturity; int access = info.RegionSettings.Maturity;
if (access == 0) if (access == 0)
reply = "PG"; reply = "PG";
@ -7047,18 +7047,18 @@ namespace OpenSim.Region.ScriptEngine.Common
reply = m_ScriptEngine.World.GetSimulatorVersion(); reply = m_ScriptEngine.World.GetSimulatorVersion();
break; break;
default: default:
// ScriptSleep(1000); // ScriptSleep(1000);
return LLUUID.Zero.ToString(); // Raise no event return LLUUID.Zero.ToString(); // Raise no event
} }
LLUUID rq = LLUUID.Random(); LLUUID rq = LLUUID.Random();
LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager.
m_Dataserver.RegisterRequest(m_localID, m_itemID, rq.ToString()); m_Dataserver.RegisterRequest(m_localID, m_itemID, rq.ToString());
m_ScriptEngine.m_ASYNCLSLCommandManager. m_ScriptEngine.m_ASYNCLSLCommandManager.
m_Dataserver.DataserverReply(rq.ToString(), reply); m_Dataserver.DataserverReply(rq.ToString(), reply);
// ScriptSleep(1000); // ScriptSleep(1000);
return tid.ToString(); return tid.ToString();
} }
catch(Exception e) catch(Exception e)
@ -8041,12 +8041,12 @@ namespace OpenSim.Region.ScriptEngine.Common
(line >= 0) && (line >= 0) &&
(line < notecardLines.Length)) (line < notecardLines.Length))
{ {
// ScriptSleep(100); // ScriptSleep(100);
return notecardLines[line]; return notecardLines[line];
} }
else else
{ {
// ScriptSleep(100); // ScriptSleep(100);
return String.Empty; return String.Empty;
} }
} }

View File

@ -2130,7 +2130,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
float dist = (float)llVecMag(llGetPos() - pos); float dist = (float)llVecMag(llGetPos() - pos);
if(dist > m_ScriptDistanceFactor * 10.0f) if (dist > m_ScriptDistanceFactor * 10.0f)
return; return;
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -5735,8 +5735,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.PRIM_POINT_LIGHT: case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
if (remain < 5) if (remain < 5)
return; return;
LSL_Types.LSLInteger light = new LSL_Types.LSLInteger(rules.Data[idx++].ToString()); LSL_Types.LSLInteger light = new LSL_Types.LSLInteger(rules.Data[idx++].ToString());
LSL_Types.Vector3 lightcolor =new LSL_Types.Vector3(rules.Data[idx++].ToString()); LSL_Types.Vector3 lightcolor = new LSL_Types.Vector3(rules.Data[idx++].ToString());
float intensity = (float)Convert.ToDouble(rules.Data[idx++]); float intensity = (float)Convert.ToDouble(rules.Data[idx++]);
float radius = (float)Convert.ToDouble(rules.Data[idx++]); float radius = (float)Convert.ToDouble(rules.Data[idx++]);
float falloff = (float)Convert.ToDouble(rules.Data[idx++]); float falloff = (float)Convert.ToDouble(rules.Data[idx++]);
@ -6895,10 +6895,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
case 5: // DATA_SIM_POS case 5: // DATA_SIM_POS
if (info == null) if (info == null)
{ {
// ScriptSleep(1000); // ScriptSleep(1000);
return LLUUID.Zero.ToString(); return LLUUID.Zero.ToString();
} }
reply = new LSL_Types.Vector3( reply = new LSL_Types.Vector3(
info.RegionLocX * Constants.RegionSize, info.RegionLocX * Constants.RegionSize,
info.RegionLocY * Constants.RegionSize, info.RegionLocY * Constants.RegionSize,
@ -6912,10 +6912,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break; break;
case 7: // DATA_SIM_RATING case 7: // DATA_SIM_RATING
if (info == null) if (info == null)
{ {
// ScriptSleep(1000); // ScriptSleep(1000);
return LLUUID.Zero.ToString(); return LLUUID.Zero.ToString();
} }
int access = info.RegionSettings.Maturity; int access = info.RegionSettings.Maturity;
if (access == 0) if (access == 0)
reply = "PG"; reply = "PG";
@ -6928,7 +6928,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
reply = m_ScriptEngine.World.GetSimulatorVersion(); reply = m_ScriptEngine.World.GetSimulatorVersion();
break; break;
default: default:
// ScriptSleep(1000); // ScriptSleep(1000);
return LLUUID.Zero.ToString(); // Raise no event return LLUUID.Zero.ToString(); // Raise no event
} }
LLUUID rq = LLUUID.Random(); LLUUID rq = LLUUID.Random();
@ -6939,7 +6939,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
AsyncCommands. AsyncCommands.
DataserverPlugin.DataserverReply(rq.ToString(), reply); DataserverPlugin.DataserverReply(rq.ToString(), reply);
// ScriptSleep(1000); // ScriptSleep(1000);
return tid.ToString(); return tid.ToString();
} }
catch(Exception e) catch(Exception e)
@ -7910,7 +7910,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
AsyncCommands. AsyncCommands.
DataserverPlugin.DataserverReply(item.AssetID.ToString(), DataserverPlugin.DataserverReply(item.AssetID.ToString(),
NotecardCache.GetLines(item.AssetID).ToString()); NotecardCache.GetLines(item.AssetID).ToString());
// ScriptSleep(100); // ScriptSleep(100);
return tid.ToString(); return tid.ToString();
} }
WithNotecard(item.AssetID, delegate (LLUUID id, AssetBase a) WithNotecard(item.AssetID, delegate (LLUUID id, AssetBase a)
@ -7924,7 +7924,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
DataserverPlugin.DataserverReply(id.ToString(), DataserverPlugin.DataserverReply(id.ToString(),
NotecardCache.GetLines(id).ToString()); NotecardCache.GetLines(id).ToString());
}); });
// ScriptSleep(100); // ScriptSleep(100);
return tid.ToString(); return tid.ToString();
} }
} }
@ -7948,7 +7948,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
AsyncCommands. AsyncCommands.
DataserverPlugin.DataserverReply(item.AssetID.ToString(), DataserverPlugin.DataserverReply(item.AssetID.ToString(),
NotecardCache.GetLine(item.AssetID, line)); NotecardCache.GetLine(item.AssetID, line));
// ScriptSleep(100); // ScriptSleep(100);
return tid.ToString(); return tid.ToString();
} }
WithNotecard(item.AssetID, delegate (LLUUID id, AssetBase a) WithNotecard(item.AssetID, delegate (LLUUID id, AssetBase a)
@ -7963,7 +7963,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
NotecardCache.GetLine(id, line)); NotecardCache.GetLine(id, line));
}); });
// ScriptSleep(100); // ScriptSleep(100);
return tid.ToString(); return tid.ToString();
} }
} }

View File

@ -89,7 +89,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
det[0].Key = remoteClient.AgentId; det[0].Key = remoteClient.AgentId;
det[0].Populate(myScriptEngine.World); det[0].Populate(myScriptEngine.World);
if (originalID == 0) if (originalID == 0)
{ {
SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(localID); SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(localID);
@ -103,7 +102,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID); SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID);
det[0].LinkNum = originalPart.LinkNum; det[0].LinkNum = originalPart.LinkNum;
} }
myScriptEngine.PostObjectEvent(localID, new EventParams( myScriptEngine.PostObjectEvent(localID, new EventParams(
"touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, "touch_start", new Object[] { new LSL_Types.LSLInteger(1) },
det)); det));