aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs248
1 files changed, 124 insertions, 124 deletions
diff --git a/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs b/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs
index 1c8c0c8..a1497b4 100644
--- a/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs
+++ b/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs
@@ -1,124 +1,124 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Nwc.XmlRpc; 33using Nwc.XmlRpc;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38 38
39namespace OpenSim.Grid.UserServer.Modules 39namespace OpenSim.Grid.UserServer.Modules
40{ 40{
41 public class UserServerAvatarAppearanceModule 41 public class UserServerAvatarAppearanceModule
42 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 private UserDataBaseService m_userDataBaseService; 45 private UserDataBaseService m_userDataBaseService;
46 private BaseHttpServer m_httpServer; 46 private BaseHttpServer m_httpServer;
47 47
48 public UserServerAvatarAppearanceModule(UserDataBaseService userDataBaseService) 48 public UserServerAvatarAppearanceModule(UserDataBaseService userDataBaseService)
49 { 49 {
50 m_userDataBaseService = userDataBaseService; 50 m_userDataBaseService = userDataBaseService;
51 } 51 }
52 52
53 public void Initialise() 53 public void Initialise()
54 { 54 {
55 55
56 } 56 }
57 57
58 public void PostInitialise() 58 public void PostInitialise()
59 { 59 {
60 60
61 } 61 }
62 62
63 public void RegisterHandlers(BaseHttpServer httpServer) 63 public void RegisterHandlers(BaseHttpServer httpServer)
64 { 64 {
65 m_httpServer = httpServer; 65 m_httpServer = httpServer;
66 66
67 m_httpServer.AddXmlRPCHandler("get_avatar_appearance", XmlRPCGetAvatarAppearance); 67 m_httpServer.AddXmlRPCHandler("get_avatar_appearance", XmlRPCGetAvatarAppearance);
68 m_httpServer.AddXmlRPCHandler("update_avatar_appearance", XmlRPCUpdateAvatarAppearance); 68 m_httpServer.AddXmlRPCHandler("update_avatar_appearance", XmlRPCUpdateAvatarAppearance);
69 } 69 }
70 70
71 public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request) 71 public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request)
72 { 72 {
73 XmlRpcResponse response = new XmlRpcResponse(); 73 XmlRpcResponse response = new XmlRpcResponse();
74 Hashtable requestData = (Hashtable)request.Params[0]; 74 Hashtable requestData = (Hashtable)request.Params[0];
75 AvatarAppearance appearance; 75 AvatarAppearance appearance;
76 Hashtable responseData; 76 Hashtable responseData;
77 if (requestData.Contains("owner")) 77 if (requestData.Contains("owner"))
78 { 78 {
79 appearance = m_userDataBaseService.GetUserAppearance(new UUID((string)requestData["owner"])); 79 appearance = m_userDataBaseService.GetUserAppearance(new UUID((string)requestData["owner"]));
80 if (appearance == null) 80 if (appearance == null)
81 { 81 {
82 responseData = new Hashtable(); 82 responseData = new Hashtable();
83 responseData["error_type"] = "no appearance"; 83 responseData["error_type"] = "no appearance";
84 responseData["error_desc"] = "There was no appearance found for this avatar"; 84 responseData["error_desc"] = "There was no appearance found for this avatar";
85 } 85 }
86 else 86 else
87 { 87 {
88 responseData = appearance.ToHashTable(); 88 responseData = appearance.ToHashTable();
89 } 89 }
90 } 90 }
91 else 91 else
92 { 92 {
93 responseData = new Hashtable(); 93 responseData = new Hashtable();
94 responseData["error_type"] = "unknown_avatar"; 94 responseData["error_type"] = "unknown_avatar";
95 responseData["error_desc"] = "The avatar appearance requested is not in the database"; 95 responseData["error_desc"] = "The avatar appearance requested is not in the database";
96 } 96 }
97 97
98 response.Value = responseData; 98 response.Value = responseData;
99 return response; 99 return response;
100 } 100 }
101 101
102 public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request) 102 public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request)
103 { 103 {
104 XmlRpcResponse response = new XmlRpcResponse(); 104 XmlRpcResponse response = new XmlRpcResponse();
105 Hashtable requestData = (Hashtable)request.Params[0]; 105 Hashtable requestData = (Hashtable)request.Params[0];
106 Hashtable responseData; 106 Hashtable responseData;
107 if (requestData.Contains("owner")) 107 if (requestData.Contains("owner"))
108 { 108 {
109 AvatarAppearance appearance = new AvatarAppearance(requestData); 109 AvatarAppearance appearance = new AvatarAppearance(requestData);
110 m_userDataBaseService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance); 110 m_userDataBaseService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance);
111 responseData = new Hashtable(); 111 responseData = new Hashtable();
112 responseData["returnString"] = "TRUE"; 112 responseData["returnString"] = "TRUE";
113 } 113 }
114 else 114 else
115 { 115 {
116 responseData = new Hashtable(); 116 responseData = new Hashtable();
117 responseData["error_type"] = "unknown_avatar"; 117 responseData["error_type"] = "unknown_avatar";
118 responseData["error_desc"] = "The avatar appearance requested is not in the database"; 118 responseData["error_desc"] = "The avatar appearance requested is not in the database";
119 } 119 }
120 response.Value = responseData; 120 response.Value = responseData;
121 return response; 121 return response;
122 } 122 }
123 } 123 }
124} 124}