From ba7d8cedeca1440fe4d4166308fec56fbbcdac19 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 17 Jan 2012 22:38:36 -0500 Subject: [PATCH] Add function osGetGridCustom Add function osGetGridCustom to take an argument for the GridInfo kpv to retrieve from the GridInfoService --- .../Shared/Api/Implementation/OSSL_Api.cs | 29 ++++++++++++++++++- .../Shared/Api/Interface/IOSSL_Api.cs | 1 + .../Shared/Api/Runtime/OSSL_Stub.cs | 5 ++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c7a62b3fb3..c682fda97c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1948,10 +1948,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { Nick, Name, - Login + Login, + Custom }; private string GridUserInfo(InfoType type) + { + return GridUserInfo(type, ""); + } + + private string GridUserInfo(InfoType type, string key) { string retval = String.Empty; IConfigSource config = m_ScriptEngine.ConfigSource; @@ -1984,6 +1990,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api retval = json["login"]; break; + case InfoType.Custom: + retval = json[key]; + break; + default: retval = "error"; break; @@ -2052,6 +2062,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return loginURI; } + public string osGetGridCustom(string key) + { + CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom"); + m_host.AddScriptLPS(1); + + string retval = String.Empty; + IConfigSource config = m_ScriptEngine.ConfigSource; + + if (config.Configs["GridInfo"] != null) + retval = config.Configs["GridInfo"].GetString(key, retval); + + if (String.IsNullOrEmpty(retval)) + retval = GridUserInfo(InfoType.Custom, key); + + return retval; + } + public LSL_String osFormatString(string str, LSL_List strings) { CheckThreatLevel(ThreatLevel.Low, "osFormatString"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index af6be5f78b..c1c451144f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -160,6 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces string osGetGridNick(); string osGetGridName(); string osGetGridLoginURI(); + string osGetGridCustom(string key); LSL_String osFormatString(string str, LSL_List strings); LSL_List osMatchString(string src, string pattern, int start); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 0c05ea491c..fc83786c8c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -452,6 +452,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osGetGridLoginURI(); } + public string osGetGridCustom(string key) + { + return m_OSSL_Functions.osGetGridCustom(key); + } + public LSL_String osFormatString(string str, LSL_List strings) { return m_OSSL_Functions.osFormatString(str, strings);