Add function osGetGridCustom

Add function osGetGridCustom to take an argument for the GridInfo kpv to retrieve from the GridInfoService
iar_mods
BlueWall 2012-01-17 22:38:36 -05:00
parent 9ed9720861
commit ba7d8cedec
3 changed files with 34 additions and 1 deletions

View File

@ -1948,10 +1948,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
Nick, Nick,
Name, Name,
Login Login,
Custom
}; };
private string GridUserInfo(InfoType type) private string GridUserInfo(InfoType type)
{
return GridUserInfo(type, "");
}
private string GridUserInfo(InfoType type, string key)
{ {
string retval = String.Empty; string retval = String.Empty;
IConfigSource config = m_ScriptEngine.ConfigSource; IConfigSource config = m_ScriptEngine.ConfigSource;
@ -1984,6 +1990,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
retval = json["login"]; retval = json["login"];
break; break;
case InfoType.Custom:
retval = json[key];
break;
default: default:
retval = "error"; retval = "error";
break; break;
@ -2052,6 +2062,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return loginURI; 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) public LSL_String osFormatString(string str, LSL_List strings)
{ {
CheckThreatLevel(ThreatLevel.Low, "osFormatString"); CheckThreatLevel(ThreatLevel.Low, "osFormatString");

View File

@ -160,6 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
string osGetGridNick(); string osGetGridNick();
string osGetGridName(); string osGetGridName();
string osGetGridLoginURI(); string osGetGridLoginURI();
string osGetGridCustom(string key);
LSL_String osFormatString(string str, LSL_List strings); LSL_String osFormatString(string str, LSL_List strings);
LSL_List osMatchString(string src, string pattern, int start); LSL_List osMatchString(string src, string pattern, int start);

View File

@ -452,6 +452,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osGetGridLoginURI(); 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) public LSL_String osFormatString(string str, LSL_List strings)
{ {
return m_OSSL_Functions.osFormatString(str, strings); return m_OSSL_Functions.osFormatString(str, strings);