diff options
author | Talun | 2013-06-12 00:06:08 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-06-15 00:06:03 +0100 |
commit | f074739e3381f85a73dfddcb522c0060edede148 (patch) | |
tree | 2019acce336e2b52db760f4e83ad268e1f1d0364 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | Mantis 6108: ossetprimitiveparams temporary/phantom problem (diff) | |
download | opensim-SC_OLD-f074739e3381f85a73dfddcb522c0060edede148.zip opensim-SC_OLD-f074739e3381f85a73dfddcb522c0060edede148.tar.gz opensim-SC_OLD-f074739e3381f85a73dfddcb522c0060edede148.tar.bz2 opensim-SC_OLD-f074739e3381f85a73dfddcb522c0060edede148.tar.xz |
Mantis 6280: llSetContentType(). An implementation.
An implimentation of llSetContentType including all of the new
constants added since the mantis was raised.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 67 |
1 files changed, 67 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; |