Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

iar_mods
Justin Clark-Casey (justincc) 2012-01-19 19:47:18 +00:00
commit d75899f2d1
4 changed files with 64 additions and 1 deletions

View File

@ -1949,6 +1949,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Nick,
Name,
Login,
Home,
Custom
};
@ -1990,6 +1991,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
retval = json["login"];
break;
case InfoType.Home:
retval = json["home"];
break;
case InfoType.Custom:
retval = json[key];
break;
@ -2062,6 +2067,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return loginURI;
}
public string osGetGridHomeURI()
{
CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI");
m_host.AddScriptLPS(1);
string HomeURI = String.Empty;
IConfigSource config = m_ScriptEngine.ConfigSource;
if (config.Configs["LoginService"] != null)
HomeURI = config.Configs["LoginService"].GetString("SRV_HomeURI", HomeURI);
if (String.IsNullOrEmpty(HomeURI))
HomeURI = GridUserInfo(InfoType.Home);
return HomeURI;
}
public string osGetGridCustom(string key)
{
CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom");

View File

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

View File

@ -452,6 +452,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osGetGridLoginURI();
}
public string osGetGridHomeURI()
{
return m_OSSL_Functions.osGetGridHomeURI();
}
public string osGetGridCustom(string key)
{
return m_OSSL_Functions.osGetGridCustom(key);

View File

@ -44,7 +44,7 @@ namespace OpenSim.Server.Handlers.Grid
public class GridInfoHandlers
{
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IConfigSource m_Config;
private Hashtable _info = new Hashtable();
/// <summary>
@ -60,6 +60,7 @@ namespace OpenSim.Server.Handlers.Grid
/// </remarks>
public GridInfoHandlers(IConfigSource configSource)
{
m_Config = configSource;
loadGridInfo(configSource);
}
@ -144,9 +145,38 @@ namespace OpenSim.Server.Handlers.Grid
return sb.ToString();
}
/// <summary>
/// Get GridInfo in json format: Used bu the OSSL osGetGrid*
/// Adding the SRV_HomeIRI to the kvp returned for use in scripts
/// </summary>
/// <returns>
/// json string
/// </returns>
/// <param name='request'>
/// Request.
/// </param>
/// <param name='path'>
/// /json_grid_info
/// </param>
/// <param name='param'>
/// Parameter.
/// </param>
/// <param name='httpRequest'>
/// Http request.
/// </param>
/// <param name='httpResponse'>
/// Http response.
/// </param>
public string JsonGetGridInfoMethod(string request, string path, string param,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
string HomeURI = String.Empty;
IConfig cfg = m_Config.Configs["LoginService"];
if (null != cfg)
{
HomeURI = cfg.GetString("SRV_HomeURI", HomeURI);
}
OSDMap map = new OSDMap();
@ -155,6 +185,11 @@ namespace OpenSim.Server.Handlers.Grid
map[k] = OSD.FromString(_info[k].ToString());
}
if (!String.IsNullOrEmpty(HomeURI))
{
map["home"] = OSD.FromString(HomeURI);
}
return OSDParser.SerializeJsonString(map).ToString();
}
}