aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs67
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs5
4 files changed, 84 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d2e9f6c..733e868 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1480,6 +1480,73 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1480 m_host.SetFaceColorAlpha(face, color, null); 1480 m_host.SetFaceColorAlpha(face, color, null);
1481 } 1481 }
1482 1482
1483 public void llSetContentType(LSL_Key id, LSL_Integer type)
1484 {
1485 m_host.AddScriptLPS(1);
1486
1487 if (m_UrlModule == null)
1488 return;
1489
1490 // Make sure the content type is text/plain to start with
1491 m_UrlModule.HttpContentType(new UUID(id), "text/plain");
1492
1493 // Is the object owner online and in the region
1494 ScenePresence agent = World.GetScenePresence(m_host.ParentGroup.OwnerID);
1495 if (agent == null || agent.IsChildAgent)
1496 return; // Fail if the owner is not in the same region
1497
1498 // Is it the embeded browser?
1499 string userAgent = m_UrlModule.GetHttpHeader(new UUID(id), "user-agent");
1500 if (userAgent.IndexOf("SecondLife") < 0)
1501 return; // Not the embedded browser. Is this check good enough?
1502
1503 // Use the IP address of the client and check against the request
1504 // seperate logins from the same IP will allow all of them to get non-text/plain as long
1505 // as the owner is in the region. Same as SL!
1506 string logonFromIPAddress = agent.ControllingClient.RemoteEndPoint.Address.ToString();
1507 string requestFromIPAddress = m_UrlModule.GetHttpHeader(new UUID(id), "remote_addr");
1508 //m_log.Debug("IP from header='" + requestFromIPAddress + "' IP from endpoint='" + logonFromIPAddress + "'");
1509 if (requestFromIPAddress == null || requestFromIPAddress.Trim() == "")
1510 return;
1511 if (logonFromIPAddress == null || logonFromIPAddress.Trim() == "")
1512 return;
1513
1514 // If the request isnt from the same IP address then the request cannot be from the owner
1515 if (!requestFromIPAddress.Trim().Equals(logonFromIPAddress.Trim()))
1516 return;
1517
1518 switch (type)
1519 {
1520 case ScriptBaseClass.CONTENT_TYPE_HTML:
1521 m_UrlModule.HttpContentType(new UUID(id), "text/html");
1522 break;
1523 case ScriptBaseClass.CONTENT_TYPE_XML:
1524 m_UrlModule.HttpContentType(new UUID(id), "application/xml");
1525 break;
1526 case ScriptBaseClass.CONTENT_TYPE_XHTML:
1527 m_UrlModule.HttpContentType(new UUID(id), "application/xhtml+xml");
1528 break;
1529 case ScriptBaseClass.CONTENT_TYPE_ATOM:
1530 m_UrlModule.HttpContentType(new UUID(id), "application/atom+xml");
1531 break;
1532 case ScriptBaseClass.CONTENT_TYPE_JSON:
1533 m_UrlModule.HttpContentType(new UUID(id), "application/json");
1534 break;
1535 case ScriptBaseClass.CONTENT_TYPE_LLSD:
1536 m_UrlModule.HttpContentType(new UUID(id), "application/llsd+xml");
1537 break;
1538 case ScriptBaseClass.CONTENT_TYPE_FORM:
1539 m_UrlModule.HttpContentType(new UUID(id), "application/x-www-form-urlencoded");
1540 break;
1541 case ScriptBaseClass.CONTENT_TYPE_RSS:
1542 m_UrlModule.HttpContentType(new UUID(id), "application/rss+xml");
1543 break;
1544 default:
1545 m_UrlModule.HttpContentType(new UUID(id), "text/plain");
1546 break;
1547 }
1548 }
1549
1483 public void SetTexGen(SceneObjectPart part, int face,int style) 1550 public void SetTexGen(SceneObjectPart part, int face,int style)
1484 { 1551 {
1485 Primitive.TextureEntry tex = part.Shape.Textures; 1552 Primitive.TextureEntry tex = part.Shape.Textures;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index a6ea88c..ff13ee6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -338,6 +338,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
338 void llSetCameraParams(LSL_List rules); 338 void llSetCameraParams(LSL_List rules);
339 void llSetClickAction(int action); 339 void llSetClickAction(int action);
340 void llSetColor(LSL_Vector color, int face); 340 void llSetColor(LSL_Vector color, int face);
341 void llSetContentType(LSL_Key id, LSL_Integer type);
341 void llSetDamage(double damage); 342 void llSetDamage(double damage);
342 void llSetForce(LSL_Vector force, int local); 343 void llSetForce(LSL_Vector force, int local);
343 void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local); 344 void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 559068d..1137ad8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -359,6 +359,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
359 public const int HTTP_CUSTOM_HEADER = 5; 359 public const int HTTP_CUSTOM_HEADER = 5;
360 public const int HTTP_PRAGMA_NO_CACHE = 6; 360 public const int HTTP_PRAGMA_NO_CACHE = 6;
361 361
362 // llSetContentType
363 public const int CONTENT_TYPE_TEXT = 0; //text/plain
364 public const int CONTENT_TYPE_HTML = 1; //text/html
365 public const int CONTENT_TYPE_XML = 2; //application/xml
366 public const int CONTENT_TYPE_XHTML = 3; //application/xhtml+xml
367 public const int CONTENT_TYPE_ATOM = 4; //application/atom+xml
368 public const int CONTENT_TYPE_JSON = 5; //application/json
369 public const int CONTENT_TYPE_LLSD = 6; //application/llsd+xml
370 public const int CONTENT_TYPE_FORM = 7; //application/x-www-form-urlencoded
371 public const int CONTENT_TYPE_RSS = 8; //application/rss+xml
372
362 public const int PRIM_MATERIAL = 2; 373 public const int PRIM_MATERIAL = 2;
363 public const int PRIM_PHYSICS = 3; 374 public const int PRIM_PHYSICS = 3;
364 public const int PRIM_TEMP_ON_REZ = 4; 375 public const int PRIM_TEMP_ON_REZ = 4;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 398c125..87cc342 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -1528,6 +1528,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1528 m_LSL_Functions.llSetColor(color, face); 1528 m_LSL_Functions.llSetColor(color, face);
1529 } 1529 }
1530 1530
1531 public void llSetContentType(LSL_Key id, LSL_Integer type)
1532 {
1533 m_LSL_Functions.llSetContentType(id, type);
1534 }
1535
1531 public void llSetDamage(double damage) 1536 public void llSetDamage(double damage)
1532 { 1537 {
1533 m_LSL_Functions.llSetDamage(damage); 1538 m_LSL_Functions.llSetDamage(damage);