From 7d77e0e703cc383c2bf68bb283518bf9fd2e009c Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 16 Feb 2009 01:22:37 +0000 Subject: [PATCH] Thank you, patnad, for a patch that adds 3 new discovery functions to OSSL. Applied with changes. Fixes Mantis #3172 --- .../Shared/Api/Implementation/OSSL_Api.cs | 39 +++++++++++++++++++ .../Shared/Api/Interface/IOSSL_Api.cs | 5 +++ .../Shared/Api/Runtime/OSSL_Stub.cs | 15 +++++++ 3 files changed, 59 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index fa09b0a681..697fdb4266 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1066,5 +1066,44 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.Inventory.AddInventoryItem(taskItem, false); } + + /// Threat level is Moderate because intentional abuse, for instance + /// scripts that are written to be malicious only on one grid, + /// for instance in a HG scenario, are a distinct possibility. + /// + /// Use value from the config file and return it. + /// + public string osGetGridNick() + { + CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick"); + m_host.AddScriptLPS(1); + string nick = "hippogrid"; + IConfigSource config = new IniConfigSource(Application.iniFilePath); + if (config.Configs["GridInfo"] != null) + nick = config.Configs["GridInfo"].GetString("gridnick", nick); + return nick; + } + + public string osGetGridName() + { + CheckThreatLevel(ThreatLevel.Moderate, "osGetGridName"); + m_host.AddScriptLPS(1); + string name = "the lost continent of hippo"; + IConfigSource config = new IniConfigSource(Application.iniFilePath); + if (config.Configs["GridInfo"] != null) + name = config.Configs["GridInfo"].GetString("gridname", name); + return name; + } + + public string osGetGridLoginURI() + { + CheckThreatLevel(ThreatLevel.Moderate, "osGetGridLoginURI"); + m_host.AddScriptLPS(1); + string loginURI = "http://127.0.0.1:9000/"; + IConfigSource config = new IniConfigSource(Application.iniFilePath); + if (config.Configs["GridInfo"] != null) + loginURI = config.Configs["GridInfo"].GetString("login", loginURI); + return loginURI; + } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index f439f3457a..aab91dffcb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -99,5 +99,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osMessageObject(key objectUUID,string message); void osMakeNotecard(string notecardName, LSL_Types.list contents); + + // Grid Info Functions + string osGetGridNick(); + string osGetGridName(); + string osGetGridLoginURI(); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index ceb0f372cf..50acc1eb07 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -247,6 +247,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osMakeNotecard(notecardName, contents); } + public string osGetGridNick() + { + return m_OSSL_Functions.osGetGridNick(); + } + + public string osGetGridName() + { + return m_OSSL_Functions.osGetGridName(); + } + + public string osGetGridLoginURI() + { + return m_OSSL_Functions.osGetGridLoginURI(); + } + public OSSLPrim Prim; [Serializable]