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, Nick,
Name, Name,
Login, Login,
Home,
Custom Custom
}; };
@ -1990,6 +1991,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
retval = json["login"]; retval = json["login"];
break; break;
case InfoType.Home:
retval = json["home"];
break;
case InfoType.Custom: case InfoType.Custom:
retval = json[key]; retval = json[key];
break; break;
@ -2062,6 +2067,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return loginURI; 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) public string osGetGridCustom(string key)
{ {
CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom"); CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom");

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 osGetGridHomeURI();
string osGetGridCustom(string key); string osGetGridCustom(string key);
LSL_String osFormatString(string str, LSL_List strings); 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(); return m_OSSL_Functions.osGetGridLoginURI();
} }
public string osGetGridHomeURI()
{
return m_OSSL_Functions.osGetGridHomeURI();
}
public string osGetGridCustom(string key) public string osGetGridCustom(string key)
{ {
return m_OSSL_Functions.osGetGridCustom(key); return m_OSSL_Functions.osGetGridCustom(key);

View File

@ -44,7 +44,7 @@ namespace OpenSim.Server.Handlers.Grid
public class GridInfoHandlers public class GridInfoHandlers
{ {
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IConfigSource m_Config;
private Hashtable _info = new Hashtable(); private Hashtable _info = new Hashtable();
/// <summary> /// <summary>
@ -60,6 +60,7 @@ namespace OpenSim.Server.Handlers.Grid
/// </remarks> /// </remarks>
public GridInfoHandlers(IConfigSource configSource) public GridInfoHandlers(IConfigSource configSource)
{ {
m_Config = configSource;
loadGridInfo(configSource); loadGridInfo(configSource);
} }
@ -144,9 +145,38 @@ namespace OpenSim.Server.Handlers.Grid
return sb.ToString(); 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, public string JsonGetGridInfoMethod(string request, string path, string param,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 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(); OSDMap map = new OSDMap();
@ -155,6 +185,11 @@ namespace OpenSim.Server.Handlers.Grid
map[k] = OSD.FromString(_info[k].ToString()); map[k] = OSD.FromString(_info[k].ToString());
} }
if (!String.IsNullOrEmpty(HomeURI))
{
map["home"] = OSD.FromString(HomeURI);
}
return OSDParser.SerializeJsonString(map).ToString(); return OSDParser.SerializeJsonString(map).ToString();
} }
} }