diff options
4 files changed, 64 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c682fda..7792ab5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1949,6 +1949,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1949 | Nick, | 1949 | Nick, |
1950 | Name, | 1950 | Name, |
1951 | Login, | 1951 | Login, |
1952 | Home, | ||
1952 | Custom | 1953 | Custom |
1953 | }; | 1954 | }; |
1954 | 1955 | ||
@@ -1990,6 +1991,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1990 | retval = json["login"]; | 1991 | retval = json["login"]; |
1991 | break; | 1992 | break; |
1992 | 1993 | ||
1994 | case InfoType.Home: | ||
1995 | retval = json["home"]; | ||
1996 | break; | ||
1997 | |||
1993 | case InfoType.Custom: | 1998 | case InfoType.Custom: |
1994 | retval = json[key]; | 1999 | retval = json[key]; |
1995 | break; | 2000 | break; |
@@ -2062,6 +2067,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2062 | return loginURI; | 2067 | return loginURI; |
2063 | } | 2068 | } |
2064 | 2069 | ||
2070 | public string osGetGridHomeURI() | ||
2071 | { | ||
2072 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI"); | ||
2073 | m_host.AddScriptLPS(1); | ||
2074 | |||
2075 | string HomeURI = String.Empty; | ||
2076 | IConfigSource config = m_ScriptEngine.ConfigSource; | ||
2077 | |||
2078 | if (config.Configs["LoginService"] != null) | ||
2079 | HomeURI = config.Configs["LoginService"].GetString("SRV_HomeURI", HomeURI); | ||
2080 | |||
2081 | if (String.IsNullOrEmpty(HomeURI)) | ||
2082 | HomeURI = GridUserInfo(InfoType.Home); | ||
2083 | |||
2084 | return HomeURI; | ||
2085 | } | ||
2086 | |||
2065 | public string osGetGridCustom(string key) | 2087 | public string osGetGridCustom(string key) |
2066 | { | 2088 | { |
2067 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom"); | 2089 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index c1c4511..0f8cbdc 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 | |||
160 | string osGetGridNick(); | 160 | string osGetGridNick(); |
161 | string osGetGridName(); | 161 | string osGetGridName(); |
162 | string osGetGridLoginURI(); | 162 | string osGetGridLoginURI(); |
163 | string osGetGridHomeURI(); | ||
163 | string osGetGridCustom(string key); | 164 | string osGetGridCustom(string key); |
164 | 165 | ||
165 | LSL_String osFormatString(string str, LSL_List strings); | 166 | LSL_String osFormatString(string str, LSL_List strings); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index fc83786..02efecf 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 | |||
452 | return m_OSSL_Functions.osGetGridLoginURI(); | 452 | return m_OSSL_Functions.osGetGridLoginURI(); |
453 | } | 453 | } |
454 | 454 | ||
455 | public string osGetGridHomeURI() | ||
456 | { | ||
457 | return m_OSSL_Functions.osGetGridHomeURI(); | ||
458 | } | ||
459 | |||
455 | public string osGetGridCustom(string key) | 460 | public string osGetGridCustom(string key) |
456 | { | 461 | { |
457 | return m_OSSL_Functions.osGetGridCustom(key); | 462 | return m_OSSL_Functions.osGetGridCustom(key); |
diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs index bfcddca..965a54e 100644 --- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs +++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Server.Handlers.Grid | |||
44 | public class GridInfoHandlers | 44 | public class GridInfoHandlers |
45 | { | 45 | { |
46 | private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | private IConfigSource m_Config; | |
48 | private Hashtable _info = new Hashtable(); | 48 | private Hashtable _info = new Hashtable(); |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
@@ -60,6 +60,7 @@ namespace OpenSim.Server.Handlers.Grid | |||
60 | /// </remarks> | 60 | /// </remarks> |
61 | public GridInfoHandlers(IConfigSource configSource) | 61 | public GridInfoHandlers(IConfigSource configSource) |
62 | { | 62 | { |
63 | m_Config = configSource; | ||
63 | loadGridInfo(configSource); | 64 | loadGridInfo(configSource); |
64 | } | 65 | } |
65 | 66 | ||
@@ -144,9 +145,38 @@ namespace OpenSim.Server.Handlers.Grid | |||
144 | return sb.ToString(); | 145 | return sb.ToString(); |
145 | } | 146 | } |
146 | 147 | ||
148 | /// <summary> | ||
149 | /// Get GridInfo in json format: Used bu the OSSL osGetGrid* | ||
150 | /// Adding the SRV_HomeIRI to the kvp returned for use in scripts | ||
151 | /// </summary> | ||
152 | /// <returns> | ||
153 | /// json string | ||
154 | /// </returns> | ||
155 | /// <param name='request'> | ||
156 | /// Request. | ||
157 | /// </param> | ||
158 | /// <param name='path'> | ||
159 | /// /json_grid_info | ||
160 | /// </param> | ||
161 | /// <param name='param'> | ||
162 | /// Parameter. | ||
163 | /// </param> | ||
164 | /// <param name='httpRequest'> | ||
165 | /// Http request. | ||
166 | /// </param> | ||
167 | /// <param name='httpResponse'> | ||
168 | /// Http response. | ||
169 | /// </param> | ||
147 | public string JsonGetGridInfoMethod(string request, string path, string param, | 170 | public string JsonGetGridInfoMethod(string request, string path, string param, |
148 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 171 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
149 | { | 172 | { |
173 | string HomeURI = String.Empty; | ||
174 | IConfig cfg = m_Config.Configs["LoginService"]; | ||
175 | |||
176 | if (null != cfg) | ||
177 | { | ||
178 | HomeURI = cfg.GetString("SRV_HomeURI", HomeURI); | ||
179 | } | ||
150 | 180 | ||
151 | OSDMap map = new OSDMap(); | 181 | OSDMap map = new OSDMap(); |
152 | 182 | ||
@@ -155,6 +185,11 @@ namespace OpenSim.Server.Handlers.Grid | |||
155 | map[k] = OSD.FromString(_info[k].ToString()); | 185 | map[k] = OSD.FromString(_info[k].ToString()); |
156 | } | 186 | } |
157 | 187 | ||
188 | if (!String.IsNullOrEmpty(HomeURI)) | ||
189 | { | ||
190 | map["home"] = OSD.FromString(HomeURI); | ||
191 | } | ||
192 | |||
158 | return OSDParser.SerializeJsonString(map).ToString(); | 193 | return OSDParser.SerializeJsonString(map).ToString(); |
159 | } | 194 | } |
160 | } | 195 | } |