aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/UserServer/UserManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/UserServer/UserManager.cs')
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs119
1 files changed, 118 insertions, 1 deletions
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index 4203ba6..c68b260 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -32,6 +32,7 @@ using Nwc.XmlRpc;
32using OpenSim.Framework.Data; 32using OpenSim.Framework.Data;
33using OpenSim.Framework.UserManagement; 33using OpenSim.Framework.UserManagement;
34using OpenSim.Framework.Utilities; 34using OpenSim.Framework.Utilities;
35using libsecondlife;
35 36
36namespace OpenSim.Grid.UserServer 37namespace OpenSim.Grid.UserServer
37{ 38{
@@ -41,6 +42,122 @@ namespace OpenSim.Grid.UserServer
41 { 42 {
42 } 43 }
43 44
44 45
46 /// <summary>
47 /// Deletes an active agent session
48 /// </summary>
49 /// <param name="request">The request</param>
50 /// <param name="path">The path (eg /bork/narf/test)</param>
51 /// <param name="param">Parameters sent</param>
52 /// <returns>Success "OK" else error</returns>
53 public string RestDeleteUserSessionMethod(string request, string path, string param)
54 {
55 // TODO! Important!
56
57 return "OK";
58 }
59
60 /// <summary>
61 /// Returns an error message that the user could not be found in the database
62 /// </summary>
63 /// <returns>XML string consisting of a error element containing individual error(s)</returns>
64 public XmlRpcResponse CreateUnknownUserErrorResponse()
65 {
66 XmlRpcResponse response = new XmlRpcResponse();
67 Hashtable responseData = new Hashtable();
68 responseData["error_type"] = "unknown_user";
69 responseData["error_desc"] = "The user requested is not in the database";
70
71 response.Value = responseData;
72 return response;
73 }
74
75 /// <summary>
76 /// Converts a user profile to an XML element which can be returned
77 /// </summary>
78 /// <param name="profile">The user profile</param>
79 /// <returns>A string containing an XML Document of the user profile</returns>
80 public XmlRpcResponse ProfileToXmlRPCResponse(UserProfileData profile)
81 {
82 XmlRpcResponse response = new XmlRpcResponse();
83 Hashtable responseData = new Hashtable();
84
85 // Account information
86 responseData["firstname"] = profile.username;
87 responseData["lastname"] = profile.surname;
88 responseData["uuid"] = profile.UUID.ToStringHyphenated();
89 // Server Information
90 responseData["server_inventory"] = profile.userInventoryURI;
91 responseData["server_asset"] = profile.userAssetURI;
92 // Profile Information
93 responseData["profile_about"] = profile.profileAboutText;
94 responseData["profile_firstlife_about"] = profile.profileFirstText;
95 responseData["profile_firstlife_image"] = profile.profileFirstImage.ToStringHyphenated();
96 responseData["profile_can_do"] = profile.profileCanDoMask.ToString();
97 responseData["profile_want_do"] = profile.profileWantDoMask.ToString();
98 responseData["profile_image"] = profile.profileImage.ToStringHyphenated();
99 responseData["profile_created"] = profile.created.ToString();
100 responseData["profile_lastlogin"] = profile.lastLogin.ToString();
101 // Home region information
102 responseData["home_coordinates_x"] = profile.homeLocation.X.ToString();
103 responseData["home_coordinates_y"] = profile.homeLocation.Y.ToString();
104 responseData["home_coordinates_z"] = profile.homeLocation.Z.ToString();
105
106 responseData["home_region"] = profile.homeRegion.ToString();
107
108 responseData["home_look_x"] = profile.homeLookAt.X.ToString();
109 responseData["home_look_y"] = profile.homeLookAt.Y.ToString();
110 responseData["home_look_z"] = profile.homeLookAt.Z.ToString();
111 response.Value = responseData;
112
113 return response;
114 }
115
116 #region XMLRPC User Methods
117 //should most likely move out of here and into the grid's userserver sub class
118 public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request)
119 {
120 XmlRpcResponse response = new XmlRpcResponse();
121 Hashtable requestData = (Hashtable)request.Params[0];
122 UserProfileData userProfile;
123 if (requestData.Contains("avatar_name"))
124 {
125 userProfile = getUserProfile((string)requestData["avatar_name"]);
126 if (userProfile == null)
127 {
128 return CreateUnknownUserErrorResponse();
129 }
130 }
131 else
132 {
133 return CreateUnknownUserErrorResponse();
134 }
135
136 return ProfileToXmlRPCResponse(userProfile);
137 }
138
139 public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request)
140 {
141 XmlRpcResponse response = new XmlRpcResponse();
142 Hashtable requestData = (Hashtable)request.Params[0];
143 UserProfileData userProfile;
144 System.Console.WriteLine("METHOD BY UUID CALLED");
145 if (requestData.Contains("avatar_uuid"))
146 {
147 userProfile = getUserProfile((LLUUID)(string)requestData["avatar_uuid"]);
148 if (userProfile == null)
149 {
150 return CreateUnknownUserErrorResponse();
151 }
152 }
153 else
154 {
155 return CreateUnknownUserErrorResponse();
156 }
157
158
159 return ProfileToXmlRPCResponse(userProfile);
160 }
161 #endregion
45 } 162 }
46} 163}