mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -50,6 +50,9 @@ using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
|
||||
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
using AssetLandmark = OpenSim.Framework.AssetLandmark;
|
||||
|
||||
@@ -4996,6 +4999,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (end > src.Length)
|
||||
end = src.Length;
|
||||
|
||||
if (stride == 0)
|
||||
stride = 1;
|
||||
|
||||
// There may be one or two ranges to be considered
|
||||
|
||||
if (start != end)
|
||||
@@ -5022,9 +5028,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
// A negative stride reverses the direction of the
|
||||
// scan producing an inverted list as a result.
|
||||
|
||||
if (stride == 0)
|
||||
stride = 1;
|
||||
|
||||
if (stride > 0)
|
||||
{
|
||||
for (int i = 0; i < src.Length; i += stride)
|
||||
@@ -5048,7 +5051,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add(src.Data[start]);
|
||||
if (start%stride == 0)
|
||||
{
|
||||
result.Add(src.Data[start]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -5226,12 +5232,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
}
|
||||
|
||||
List<SimpleRegionInfo> neighbors = World.CommsManager.GridService.RequestNeighbours(World.RegionInfo.RegionLocX, World.RegionInfo.RegionLocY);
|
||||
List<GridRegion> neighbors = World.GridService.GetNeighbours(World.RegionInfo.ScopeID, World.RegionInfo.RegionID);
|
||||
|
||||
uint neighborX = World.RegionInfo.RegionLocX + (uint)dir.x;
|
||||
uint neighborY = World.RegionInfo.RegionLocY + (uint)dir.y;
|
||||
|
||||
foreach (SimpleRegionInfo sri in neighbors)
|
||||
foreach (GridRegion sri in neighbors)
|
||||
{
|
||||
if (sri.RegionLocX == neighborX && sri.RegionLocY == neighborY)
|
||||
return 0;
|
||||
@@ -6321,9 +6327,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero);
|
||||
IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
|
||||
if (xmlRpcRouter != null)
|
||||
{
|
||||
string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName;
|
||||
|
||||
xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID,
|
||||
m_itemID, String.Format("http://{0}:{1}/", System.Environment.MachineName,
|
||||
m_itemID, String.Format("http://{0}:{1}/", ExternalHostName,
|
||||
xmlrpcMod.Port.ToString()));
|
||||
}
|
||||
object[] resobj = new object[]
|
||||
{
|
||||
new LSL_Integer(1),
|
||||
@@ -7834,8 +7844,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public LSL_String llGetHTTPHeader(LSL_Key request_id, string header)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
NotImplemented("llGetHTTPHeader");
|
||||
return String.Empty;
|
||||
|
||||
if (m_UrlModule != null)
|
||||
return m_UrlModule.GetHttpHeader(new UUID(request_id), header);
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
|
||||
@@ -8175,7 +8187,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
string reply = String.Empty;
|
||||
|
||||
RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator);
|
||||
GridRegion info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator);
|
||||
|
||||
switch (data)
|
||||
{
|
||||
@@ -8202,7 +8214,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
ConditionalScriptSleep(1000);
|
||||
return UUID.Zero.ToString();
|
||||
}
|
||||
int access = info.RegionSettings.Maturity;
|
||||
int access = info.Maturity;
|
||||
if (access == 0)
|
||||
reply = "PG";
|
||||
else if (access == 1)
|
||||
@@ -9113,13 +9125,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
|
||||
|
||||
public void llHTTPResponse(string url, int status, string body)
|
||||
public void llHTTPResponse(LSL_Key id, int status, string body)
|
||||
{
|
||||
// Partial implementation: support for parameter flags needed
|
||||
// see http://wiki.secondlife.com/wiki/llHTTPResponse
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
NotImplemented("llHTTPResponse");
|
||||
|
||||
if (m_UrlModule != null)
|
||||
m_UrlModule.HttpResponse(new UUID(id), status,body);
|
||||
}
|
||||
|
||||
public void llResetLandBanList()
|
||||
|
||||
@@ -48,6 +48,8 @@ using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
|
||||
using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
|
||||
@@ -599,17 +601,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (regionName.Contains(".") && regionName.Contains(":"))
|
||||
{
|
||||
// Try to link the region
|
||||
RegionInfo regInfo = HGHyperlink.TryLinkRegion(World,
|
||||
presence.ControllingClient,
|
||||
regionName);
|
||||
// Get the region name
|
||||
if (regInfo != null)
|
||||
IHyperlinkService hyperService = World.RequestModuleInterface<IHyperlinkService>();
|
||||
if (hyperService != null)
|
||||
{
|
||||
regionName = regInfo.RegionName;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Might need to ping the client here in case of failure??
|
||||
GridRegion regInfo = hyperService.TryLinkRegion(presence.ControllingClient,
|
||||
regionName);
|
||||
// Get the region name
|
||||
if (regInfo != null)
|
||||
{
|
||||
regionName = regInfo.RegionName;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Might need to ping the client here in case of failure??
|
||||
}
|
||||
}
|
||||
}
|
||||
presence.ControllingClient.SendTeleportLocationStart();
|
||||
@@ -1164,6 +1169,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
land.SetMediaUrl(url);
|
||||
}
|
||||
|
||||
public void osSetParcelSIPAddress(string SIPAddress)
|
||||
{
|
||||
// What actually is the difference to the LL function?
|
||||
//
|
||||
CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL");
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
|
||||
ILandObject land
|
||||
= World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
|
||||
|
||||
if (land.landData.OwnerID != m_host.ObjectOwner)
|
||||
{
|
||||
OSSLError("osSetParcelSIPAddress: Sorry, you need to own the land to use this function");
|
||||
return;
|
||||
}
|
||||
|
||||
// get the voice module
|
||||
IVoiceModule voiceModule = World.RequestModuleInterface<IVoiceModule>();
|
||||
|
||||
if (voiceModule != null)
|
||||
voiceModule.setLandSIPAddress(SIPAddress,land.landData.GlobalID);
|
||||
else
|
||||
OSSLError("osSetParcelSIPAddress: No voice module enabled for this land");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public string osGetScriptEngineName()
|
||||
{
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
void llGroundRepel(double height, int water, double tau);
|
||||
LSL_Vector llGroundSlope(LSL_Vector offset);
|
||||
LSL_String llHTTPRequest(string url, LSL_List parameters, string body);
|
||||
void llHTTPResponse(string url, int status, string body);
|
||||
void llHTTPResponse(LSL_Key id, int status, string body);
|
||||
LSL_String llInsertString(string dst, int position, string src);
|
||||
void llInstantMessage(string user, string message);
|
||||
LSL_String llIntegerToBase64(int number);
|
||||
|
||||
@@ -75,6 +75,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
bool osConsoleCommand(string Command);
|
||||
void osSetParcelMediaURL(string url);
|
||||
void osSetPrimFloatOnWater(int floatYN);
|
||||
void osSetParcelSIPAddress(string SIPAddress);
|
||||
|
||||
// Avatar Info Commands
|
||||
string osGetAgentIP(string agent);
|
||||
|
||||
@@ -864,9 +864,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_LSL_Functions.llHTTPRequest(url, parameters, body);
|
||||
}
|
||||
|
||||
public void llHTTPResponse(string url, int status, string body)
|
||||
public void llHTTPResponse(LSL_Key id, int status, string body)
|
||||
{
|
||||
m_LSL_Functions.llHTTPResponse(url, status, body);
|
||||
m_LSL_Functions.llHTTPResponse(id, status, body);
|
||||
}
|
||||
|
||||
public LSL_String llInsertString(string dst, int position, string src)
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_OSSL_Functions.osWindActiveModelPluginName();
|
||||
}
|
||||
|
||||
// Not yet plugged in as available OSSL functions, so commented out
|
||||
// Not yet plugged in as available OSSL functions, so commented out
|
||||
// void osWindParamSet(string plugin, string param, float value)
|
||||
// {
|
||||
// m_OSSL_Functions.osWindParamSet(plugin, param, value);
|
||||
@@ -183,6 +183,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
{
|
||||
m_OSSL_Functions.osSetParcelMediaURL(url);
|
||||
}
|
||||
|
||||
public void osSetParcelSIPAddress(string SIPAddress)
|
||||
{
|
||||
m_OSSL_Functions.osSetParcelSIPAddress(SIPAddress);
|
||||
}
|
||||
|
||||
public void osSetPrimFloatOnWater(int floatYN)
|
||||
{
|
||||
@@ -324,7 +329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
|
||||
public string osGetSimulatorVersion()
|
||||
{
|
||||
return m_OSSL_Functions.osGetSimulatorVersion();
|
||||
return m_OSSL_Functions.osGetSimulatorVersion();
|
||||
}
|
||||
|
||||
public Hashtable osParseJSON(string JSON)
|
||||
|
||||
@@ -542,23 +542,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||
break;
|
||||
case enumCompileType.cs:
|
||||
case enumCompileType.lsl:
|
||||
lock (CScodeProvider)
|
||||
bool complete = false;
|
||||
bool retried = false;
|
||||
do
|
||||
{
|
||||
results = CScodeProvider.CompileAssemblyFromSource(
|
||||
lock (CScodeProvider)
|
||||
{
|
||||
results = CScodeProvider.CompileAssemblyFromSource(
|
||||
parameters, Script);
|
||||
}
|
||||
}
|
||||
// Deal with an occasional segv in the compiler.
|
||||
// Rarely, if ever, occurs twice in succession.
|
||||
// Line # == 0 and no file name are indications that
|
||||
// this is a native stack trace rather than a normal
|
||||
// error log.
|
||||
if (results.Errors.Count > 0)
|
||||
{
|
||||
if (!retried && (results.Errors[0].FileName == null || results.Errors[0].FileName == String.Empty) &&
|
||||
results.Errors[0].Line == 0)
|
||||
{
|
||||
// System.Console.WriteLine("retrying failed compilation");
|
||||
retried = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
complete = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
complete = true;
|
||||
}
|
||||
} while (!complete);
|
||||
break;
|
||||
case enumCompileType.js:
|
||||
results = JScodeProvider.CompileAssemblyFromSource(
|
||||
parameters, Script);
|
||||
parameters, Script);
|
||||
break;
|
||||
case enumCompileType.yp:
|
||||
results = YPcodeProvider.CompileAssemblyFromSource(
|
||||
parameters, Script);
|
||||
parameters, Script);
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Compiler is not able to recongnize "+
|
||||
"language type \"" + lang.ToString() + "\"");
|
||||
"language type \"" + lang.ToString() + "\"");
|
||||
}
|
||||
|
||||
// Check result
|
||||
@@ -567,56 +594,62 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||
//
|
||||
// WARNINGS AND ERRORS
|
||||
//
|
||||
int display = 5;
|
||||
bool hadErrors = false;
|
||||
string errtext = String.Empty;
|
||||
|
||||
if (results.Errors.Count > 0)
|
||||
{
|
||||
string errtext = String.Empty;
|
||||
foreach (CompilerError CompErr in results.Errors)
|
||||
{
|
||||
// Show 5 errors max
|
||||
//
|
||||
if (display <= 0)
|
||||
break;
|
||||
display--;
|
||||
|
||||
string severity = "Error";
|
||||
if (CompErr.IsWarning)
|
||||
{
|
||||
severity = "Warning";
|
||||
}
|
||||
string severity = CompErr.IsWarning ? "Warning" : "Error";
|
||||
|
||||
KeyValuePair<int, int> lslPos;
|
||||
|
||||
lslPos = FindErrorPosition(CompErr.Line, CompErr.Column);
|
||||
// Show 5 errors max, but check entire list for errors
|
||||
|
||||
string text = CompErr.ErrorText;
|
||||
if (severity == "Error")
|
||||
{
|
||||
lslPos = FindErrorPosition(CompErr.Line, CompErr.Column);
|
||||
string text = CompErr.ErrorText;
|
||||
|
||||
// Use LSL type names
|
||||
if (lang == enumCompileType.lsl)
|
||||
text = ReplaceTypes(CompErr.ErrorText);
|
||||
// Use LSL type names
|
||||
if (lang == enumCompileType.lsl)
|
||||
text = ReplaceTypes(CompErr.ErrorText);
|
||||
|
||||
// The Second Life viewer's script editor begins
|
||||
// countingn lines and columns at 0, so we subtract 1.
|
||||
errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n",
|
||||
lslPos.Key - 1, lslPos.Value - 1,
|
||||
CompErr.ErrorNumber, text, severity);
|
||||
// The Second Life viewer's script editor begins
|
||||
// countingn lines and columns at 0, so we subtract 1.
|
||||
errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n",
|
||||
lslPos.Key - 1, lslPos.Value - 1,
|
||||
CompErr.ErrorNumber, text, severity);
|
||||
hadErrors = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (hadErrors)
|
||||
{
|
||||
throw new Exception(errtext);
|
||||
}
|
||||
|
||||
// On today's highly asynchronous systems, the result of
|
||||
// the compile may not be immediately apparent. Wait a
|
||||
// reasonable amount of time before giving up on it.
|
||||
|
||||
if (!File.Exists(OutFile))
|
||||
{
|
||||
for (int i=0; i<20 && !File.Exists(OutFile); i++)
|
||||
{
|
||||
System.Threading.Thread.Sleep(250);
|
||||
}
|
||||
// One final chance...
|
||||
if (!File.Exists(OutFile))
|
||||
{
|
||||
errtext = String.Empty;
|
||||
errtext += "No compile error. But not able to locate compiled file.";
|
||||
throw new Exception(errtext);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// NO ERRORS, BUT NO COMPILED FILE
|
||||
//
|
||||
if (!File.Exists(OutFile))
|
||||
{
|
||||
string errtext = String.Empty;
|
||||
errtext += "No compile error. But not able to locate compiled file.";
|
||||
throw new Exception(errtext);
|
||||
}
|
||||
// m_log.DebugFormat("[Compiler] Compiled new assembly "+
|
||||
// "for {0}", asset);
|
||||
|
||||
@@ -629,7 +662,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||
|
||||
if (fi == null)
|
||||
{
|
||||
string errtext = String.Empty;
|
||||
errtext = String.Empty;
|
||||
errtext += "No compile error. But not able to stat file.";
|
||||
throw new Exception(errtext);
|
||||
}
|
||||
@@ -644,7 +677,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
string errtext = String.Empty;
|
||||
errtext = String.Empty;
|
||||
errtext += "No compile error. But not able to open file.";
|
||||
throw new Exception(errtext);
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
"SecondLife.Script");
|
||||
|
||||
//ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
|
||||
RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
|
||||
RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
|
||||
// lease.Register(this);
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -430,7 +430,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
|
||||
permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
|
||||
permsMask = part.TaskInventory[m_ItemID].PermsMask;
|
||||
}
|
||||
}
|
||||
|
||||
if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
||||
{
|
||||
@@ -630,7 +630,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
/// <summary>
|
||||
/// Process the next event queued for this script
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>
|
||||
public object EventProcessor()
|
||||
{
|
||||
lock (m_Script)
|
||||
@@ -925,7 +925,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("{0} {1} on {2}", m_ScriptName, m_ItemID, m_PrimName);
|
||||
return String.Format("{0} {1} on {2}", m_ScriptName, m_ItemID, m_PrimName);
|
||||
}
|
||||
|
||||
string FormatException(Exception e)
|
||||
|
||||
Reference in New Issue
Block a user