From ba7d8cedeca1440fe4d4166308fec56fbbcdac19 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 17 Jan 2012 22:38:36 -0500 Subject: 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 +++++++++++++++++++++- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 ++++ 3 files changed, 34 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c7a62b3..c682fda 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1948,11 +1948,17 @@ 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; string url = config.Configs["GridInfo"].GetString("GridInfoURI", String.Empty); @@ -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 af6be5f..c1c4511 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 0c05ea4..fc83786 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); -- cgit v1.1