diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs index a5894c6..613dbe9 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs | |||
@@ -34,6 +34,7 @@ using System.Text.RegularExpressions; | |||
34 | using log4net; | 34 | using log4net; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using Nwc.XmlRpc; | ||
37 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Communications.Services; | 40 | using OpenSim.Framework.Communications.Services; |
@@ -115,6 +116,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
115 | 116 | ||
116 | httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod); | 117 | httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod); |
117 | httpServer.AddXmlRPCHandler("check_auth_session", m_loginService.XmlRPCCheckAuthSession, false); | 118 | httpServer.AddXmlRPCHandler("check_auth_session", m_loginService.XmlRPCCheckAuthSession, false); |
119 | httpServer.AddXmlRPCHandler("get_avatar_appearance", XmlRPCGetAvatarAppearance); | ||
120 | httpServer.AddXmlRPCHandler("update_avatar_appearance", XmlRPCUpdateAvatarAppearance); | ||
118 | 121 | ||
119 | } | 122 | } |
120 | } | 123 | } |
@@ -256,5 +259,64 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
256 | scene = null; | 259 | scene = null; |
257 | return false; | 260 | return false; |
258 | } | 261 | } |
262 | |||
263 | public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request, IPEndPoint remoteClient) | ||
264 | { | ||
265 | XmlRpcResponse response = new XmlRpcResponse(); | ||
266 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
267 | AvatarAppearance appearance; | ||
268 | Hashtable responseData; | ||
269 | if (requestData.Contains("owner")) | ||
270 | { | ||
271 | appearance = m_firstScene.CommsManager.AvatarService.GetUserAppearance(new UUID((string)requestData["owner"])); | ||
272 | if (appearance == null) | ||
273 | { | ||
274 | responseData = new Hashtable(); | ||
275 | responseData["error_type"] = "no appearance"; | ||
276 | responseData["error_desc"] = "There was no appearance found for this avatar"; | ||
277 | } | ||
278 | else | ||
279 | { | ||
280 | responseData = appearance.ToHashTable(); | ||
281 | } | ||
282 | } | ||
283 | else | ||
284 | { | ||
285 | responseData = new Hashtable(); | ||
286 | responseData["error_type"] = "unknown_avatar"; | ||
287 | responseData["error_desc"] = "The avatar appearance requested is not in the database"; | ||
288 | } | ||
289 | |||
290 | response.Value = responseData; | ||
291 | return response; | ||
292 | } | ||
293 | |||
294 | public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request, IPEndPoint remoteClient) | ||
295 | { | ||
296 | XmlRpcResponse response = new XmlRpcResponse(); | ||
297 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
298 | Hashtable responseData; | ||
299 | if (requestData.Contains("owner")) | ||
300 | { | ||
301 | AvatarAppearance appearance = new AvatarAppearance(requestData); | ||
302 | |||
303 | // TODO: Sometime in the future we may have a database layer that is capable of updating appearance when | ||
304 | // the TextureEntry is null. When that happens, this check can be removed | ||
305 | if (appearance.Texture != null) | ||
306 | m_firstScene.CommsManager.AvatarService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance); | ||
307 | |||
308 | responseData = new Hashtable(); | ||
309 | responseData["returnString"] = "TRUE"; | ||
310 | } | ||
311 | else | ||
312 | { | ||
313 | responseData = new Hashtable(); | ||
314 | responseData["error_type"] = "unknown_avatar"; | ||
315 | responseData["error_desc"] = "The avatar appearance requested is not in the database"; | ||
316 | } | ||
317 | response.Value = responseData; | ||
318 | return response; | ||
319 | } | ||
259 | } | 320 | } |
321 | |||
260 | } | 322 | } |