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 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') 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"); -- cgit v1.1