diff options
Diffstat (limited to 'OpenSim/Framework/UserManager')
-rw-r--r-- | OpenSim/Framework/UserManager/LoginResponse.cs | 1286 | ||||
-rw-r--r-- | OpenSim/Framework/UserManager/UserManagerBase.cs | 1262 |
2 files changed, 1274 insertions, 1274 deletions
diff --git a/OpenSim/Framework/UserManager/LoginResponse.cs b/OpenSim/Framework/UserManager/LoginResponse.cs index abcbd48..d3dfd5b 100644 --- a/OpenSim/Framework/UserManager/LoginResponse.cs +++ b/OpenSim/Framework/UserManager/LoginResponse.cs | |||
@@ -1,643 +1,643 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | 2 | using System.Collections; |
3 | using libsecondlife; | 3 | using libsecondlife; |
4 | using Nwc.XmlRpc; | 4 | using Nwc.XmlRpc; |
5 | using OpenSim.Framework.Console; | 5 | using OpenSim.Framework.Console; |
6 | 6 | ||
7 | namespace OpenSim.Framework.UserManagement | 7 | namespace OpenSim.Framework.UserManagement |
8 | { | 8 | { |
9 | 9 | ||
10 | /// <summary> | 10 | /// <summary> |
11 | /// A temp class to handle login response. | 11 | /// A temp class to handle login response. |
12 | /// Should make use of UserProfileManager where possible. | 12 | /// Should make use of UserProfileManager where possible. |
13 | /// </summary> | 13 | /// </summary> |
14 | 14 | ||
15 | public class LoginResponse | 15 | public class LoginResponse |
16 | { | 16 | { |
17 | private Hashtable loginFlagsHash; | 17 | private Hashtable loginFlagsHash; |
18 | private Hashtable globalTexturesHash; | 18 | private Hashtable globalTexturesHash; |
19 | private Hashtable loginError; | 19 | private Hashtable loginError; |
20 | private Hashtable eventCategoriesHash; | 20 | private Hashtable eventCategoriesHash; |
21 | private Hashtable uiConfigHash; | 21 | private Hashtable uiConfigHash; |
22 | private Hashtable classifiedCategoriesHash; | 22 | private Hashtable classifiedCategoriesHash; |
23 | 23 | ||
24 | private ArrayList loginFlags; | 24 | private ArrayList loginFlags; |
25 | private ArrayList globalTextures; | 25 | private ArrayList globalTextures; |
26 | private ArrayList eventCategories; | 26 | private ArrayList eventCategories; |
27 | private ArrayList uiConfig; | 27 | private ArrayList uiConfig; |
28 | private ArrayList classifiedCategories; | 28 | private ArrayList classifiedCategories; |
29 | private ArrayList inventoryRoot; | 29 | private ArrayList inventoryRoot; |
30 | private ArrayList initialOutfit; | 30 | private ArrayList initialOutfit; |
31 | private ArrayList agentInventory; | 31 | private ArrayList agentInventory; |
32 | 32 | ||
33 | private UserInfo userProfile; | 33 | private UserInfo userProfile; |
34 | 34 | ||
35 | private LLUUID agentID; | 35 | private LLUUID agentID; |
36 | private LLUUID sessionID; | 36 | private LLUUID sessionID; |
37 | private LLUUID secureSessionID; | 37 | private LLUUID secureSessionID; |
38 | 38 | ||
39 | // Login Flags | 39 | // Login Flags |
40 | private string dst; | 40 | private string dst; |
41 | private string stipendSinceLogin; | 41 | private string stipendSinceLogin; |
42 | private string gendered; | 42 | private string gendered; |
43 | private string everLoggedIn; | 43 | private string everLoggedIn; |
44 | private string login; | 44 | private string login; |
45 | private int simPort; | 45 | private int simPort; |
46 | private string simAddress; | 46 | private string simAddress; |
47 | private string agentAccess; | 47 | private string agentAccess; |
48 | private Int32 circuitCode; | 48 | private Int32 circuitCode; |
49 | private uint regionX; | 49 | private uint regionX; |
50 | private uint regionY; | 50 | private uint regionY; |
51 | 51 | ||
52 | // Login | 52 | // Login |
53 | private string firstname; | 53 | private string firstname; |
54 | private string lastname; | 54 | private string lastname; |
55 | 55 | ||
56 | // Global Textures | 56 | // Global Textures |
57 | private string sunTexture; | 57 | private string sunTexture; |
58 | private string cloudTexture; | 58 | private string cloudTexture; |
59 | private string moonTexture; | 59 | private string moonTexture; |
60 | 60 | ||
61 | // Error Flags | 61 | // Error Flags |
62 | private string errorReason; | 62 | private string errorReason; |
63 | private string errorMessage; | 63 | private string errorMessage; |
64 | 64 | ||
65 | // Response | 65 | // Response |
66 | private XmlRpcResponse xmlRpcResponse; | 66 | private XmlRpcResponse xmlRpcResponse; |
67 | private XmlRpcResponse defaultXmlRpcResponse; | 67 | private XmlRpcResponse defaultXmlRpcResponse; |
68 | 68 | ||
69 | private string welcomeMessage; | 69 | private string welcomeMessage; |
70 | private string startLocation; | 70 | private string startLocation; |
71 | private string allowFirstLife; | 71 | private string allowFirstLife; |
72 | private string home; | 72 | private string home; |
73 | private string seedCapability; | 73 | private string seedCapability; |
74 | private string lookAt; | 74 | private string lookAt; |
75 | 75 | ||
76 | public LoginResponse() | 76 | public LoginResponse() |
77 | { | 77 | { |
78 | this.loginFlags = new ArrayList(); | 78 | this.loginFlags = new ArrayList(); |
79 | this.globalTextures = new ArrayList(); | 79 | this.globalTextures = new ArrayList(); |
80 | this.eventCategories = new ArrayList(); | 80 | this.eventCategories = new ArrayList(); |
81 | this.uiConfig = new ArrayList(); | 81 | this.uiConfig = new ArrayList(); |
82 | this.classifiedCategories = new ArrayList(); | 82 | this.classifiedCategories = new ArrayList(); |
83 | 83 | ||
84 | this.loginError = new Hashtable(); | 84 | this.loginError = new Hashtable(); |
85 | this.eventCategoriesHash = new Hashtable(); | 85 | this.eventCategoriesHash = new Hashtable(); |
86 | this.classifiedCategoriesHash = new Hashtable(); | 86 | this.classifiedCategoriesHash = new Hashtable(); |
87 | this.uiConfigHash = new Hashtable(); | 87 | this.uiConfigHash = new Hashtable(); |
88 | 88 | ||
89 | this.defaultXmlRpcResponse = new XmlRpcResponse(); | 89 | this.defaultXmlRpcResponse = new XmlRpcResponse(); |
90 | this.userProfile = new UserInfo(); | 90 | this.userProfile = new UserInfo(); |
91 | this.inventoryRoot = new ArrayList(); | 91 | this.inventoryRoot = new ArrayList(); |
92 | this.initialOutfit = new ArrayList(); | 92 | this.initialOutfit = new ArrayList(); |
93 | this.agentInventory = new ArrayList(); | 93 | this.agentInventory = new ArrayList(); |
94 | 94 | ||
95 | this.xmlRpcResponse = new XmlRpcResponse(); | 95 | this.xmlRpcResponse = new XmlRpcResponse(); |
96 | this.defaultXmlRpcResponse = new XmlRpcResponse(); | 96 | this.defaultXmlRpcResponse = new XmlRpcResponse(); |
97 | 97 | ||
98 | this.SetDefaultValues(); | 98 | this.SetDefaultValues(); |
99 | } // LoginServer | 99 | } // LoginServer |
100 | 100 | ||
101 | public void SetDefaultValues() | 101 | public void SetDefaultValues() |
102 | { | 102 | { |
103 | this.DST = "N"; | 103 | this.DST = "N"; |
104 | this.StipendSinceLogin = "N"; | 104 | this.StipendSinceLogin = "N"; |
105 | this.Gendered = "Y"; | 105 | this.Gendered = "Y"; |
106 | this.EverLoggedIn = "Y"; | 106 | this.EverLoggedIn = "Y"; |
107 | this.login = "false"; | 107 | this.login = "false"; |
108 | this.firstname = "Test"; | 108 | this.firstname = "Test"; |
109 | this.lastname = "User"; | 109 | this.lastname = "User"; |
110 | this.agentAccess = "M"; | 110 | this.agentAccess = "M"; |
111 | this.startLocation = "last"; | 111 | this.startLocation = "last"; |
112 | this.allowFirstLife = "Y"; | 112 | this.allowFirstLife = "Y"; |
113 | 113 | ||
114 | this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; | 114 | this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; |
115 | this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; | 115 | this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; |
116 | this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; | 116 | this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; |
117 | 117 | ||
118 | this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; | 118 | this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; |
119 | this.ErrorReason = "key"; | 119 | this.ErrorReason = "key"; |
120 | this.welcomeMessage = "Welcome to OpenSim!"; | 120 | this.welcomeMessage = "Welcome to OpenSim!"; |
121 | this.seedCapability = ""; | 121 | this.seedCapability = ""; |
122 | this.home = "{'region_handle':[r" + (1000 * 256).ToString() + ",r" + (1000 * 256).ToString() + "], 'position':[r" + this.userProfile.homepos.X.ToString() + ",r" + this.userProfile.homepos.Y.ToString() + ",r" + this.userProfile.homepos.Z.ToString() + "], 'look_at':[r" + this.userProfile.homelookat.X.ToString() + ",r" + this.userProfile.homelookat.Y.ToString() + ",r" + this.userProfile.homelookat.Z.ToString() + "]}"; | 122 | this.home = "{'region_handle':[r" + (1000 * 256).ToString() + ",r" + (1000 * 256).ToString() + "], 'position':[r" + this.userProfile.homepos.X.ToString() + ",r" + this.userProfile.homepos.Y.ToString() + ",r" + this.userProfile.homepos.Z.ToString() + "], 'look_at':[r" + this.userProfile.homelookat.X.ToString() + ",r" + this.userProfile.homelookat.Y.ToString() + ",r" + this.userProfile.homelookat.Z.ToString() + "]}"; |
123 | this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; | 123 | this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; |
124 | this.RegionX = (uint)255232; | 124 | this.RegionX = (uint)255232; |
125 | this.RegionY = (uint)254976; | 125 | this.RegionY = (uint)254976; |
126 | 126 | ||
127 | // Classifieds; | 127 | // Classifieds; |
128 | this.AddClassifiedCategory((Int32)1, "Shopping"); | 128 | this.AddClassifiedCategory((Int32)1, "Shopping"); |
129 | this.AddClassifiedCategory((Int32)2, "Land Rental"); | 129 | this.AddClassifiedCategory((Int32)2, "Land Rental"); |
130 | this.AddClassifiedCategory((Int32)3, "Property Rental"); | 130 | this.AddClassifiedCategory((Int32)3, "Property Rental"); |
131 | this.AddClassifiedCategory((Int32)4, "Special Attraction"); | 131 | this.AddClassifiedCategory((Int32)4, "Special Attraction"); |
132 | this.AddClassifiedCategory((Int32)5, "New Products"); | 132 | this.AddClassifiedCategory((Int32)5, "New Products"); |
133 | this.AddClassifiedCategory((Int32)6, "Employment"); | 133 | this.AddClassifiedCategory((Int32)6, "Employment"); |
134 | this.AddClassifiedCategory((Int32)7, "Wanted"); | 134 | this.AddClassifiedCategory((Int32)7, "Wanted"); |
135 | this.AddClassifiedCategory((Int32)8, "Service"); | 135 | this.AddClassifiedCategory((Int32)8, "Service"); |
136 | this.AddClassifiedCategory((Int32)9, "Personal"); | 136 | this.AddClassifiedCategory((Int32)9, "Personal"); |
137 | 137 | ||
138 | 138 | ||
139 | this.SessionID = LLUUID.Random(); | 139 | this.SessionID = LLUUID.Random(); |
140 | this.SecureSessionID = LLUUID.Random(); | 140 | this.SecureSessionID = LLUUID.Random(); |
141 | this.AgentID = LLUUID.Random(); | 141 | this.AgentID = LLUUID.Random(); |
142 | 142 | ||
143 | Hashtable InitialOutfitHash = new Hashtable(); | 143 | Hashtable InitialOutfitHash = new Hashtable(); |
144 | InitialOutfitHash["folder_name"] = "Nightclub Female"; | 144 | InitialOutfitHash["folder_name"] = "Nightclub Female"; |
145 | InitialOutfitHash["gender"] = "female"; | 145 | InitialOutfitHash["gender"] = "female"; |
146 | this.initialOutfit.Add(InitialOutfitHash); | 146 | this.initialOutfit.Add(InitialOutfitHash); |
147 | 147 | ||
148 | 148 | ||
149 | } // SetDefaultValues | 149 | } // SetDefaultValues |
150 | 150 | ||
151 | #region Login Failure Methods | 151 | #region Login Failure Methods |
152 | public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login) | 152 | public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login) |
153 | { | 153 | { |
154 | // Overwrite any default values; | 154 | // Overwrite any default values; |
155 | this.xmlRpcResponse = new XmlRpcResponse(); | 155 | this.xmlRpcResponse = new XmlRpcResponse(); |
156 | 156 | ||
157 | // Ensure Login Failed message/reason; | 157 | // Ensure Login Failed message/reason; |
158 | this.ErrorMessage = message; | 158 | this.ErrorMessage = message; |
159 | this.ErrorReason = reason; | 159 | this.ErrorReason = reason; |
160 | 160 | ||
161 | this.loginError["reason"] = this.ErrorReason; | 161 | this.loginError["reason"] = this.ErrorReason; |
162 | this.loginError["message"] = this.ErrorMessage; | 162 | this.loginError["message"] = this.ErrorMessage; |
163 | this.loginError["login"] = login; | 163 | this.loginError["login"] = login; |
164 | this.xmlRpcResponse.Value = this.loginError; | 164 | this.xmlRpcResponse.Value = this.loginError; |
165 | return (this.xmlRpcResponse); | 165 | return (this.xmlRpcResponse); |
166 | } // GenerateResponse | 166 | } // GenerateResponse |
167 | 167 | ||
168 | public XmlRpcResponse CreateFailedResponse() | 168 | public XmlRpcResponse CreateFailedResponse() |
169 | { | 169 | { |
170 | return (this.CreateLoginFailedResponse()); | 170 | return (this.CreateLoginFailedResponse()); |
171 | } // CreateErrorConnectingToGridResponse() | 171 | } // CreateErrorConnectingToGridResponse() |
172 | 172 | ||
173 | public XmlRpcResponse CreateLoginFailedResponse() | 173 | public XmlRpcResponse CreateLoginFailedResponse() |
174 | { | 174 | { |
175 | return (this.GenerateFailureResponse("key", "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", "false")); | 175 | return (this.GenerateFailureResponse("key", "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", "false")); |
176 | } // LoginFailedResponse | 176 | } // LoginFailedResponse |
177 | 177 | ||
178 | public XmlRpcResponse CreateAlreadyLoggedInResponse() | 178 | public XmlRpcResponse CreateAlreadyLoggedInResponse() |
179 | { | 179 | { |
180 | return (this.GenerateFailureResponse("presence", "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", "false")); | 180 | return (this.GenerateFailureResponse("presence", "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", "false")); |
181 | } // CreateAlreadyLoggedInResponse() | 181 | } // CreateAlreadyLoggedInResponse() |
182 | 182 | ||
183 | public XmlRpcResponse CreateDeadRegionResponse() | 183 | public XmlRpcResponse CreateDeadRegionResponse() |
184 | { | 184 | { |
185 | return (this.GenerateFailureResponse("key", "The region you are attempting to log into is not responding. Please select another region and try again.", "false")); | 185 | return (this.GenerateFailureResponse("key", "The region you are attempting to log into is not responding. Please select another region and try again.", "false")); |
186 | } | 186 | } |
187 | 187 | ||
188 | public XmlRpcResponse CreateGridErrorResponse() | 188 | public XmlRpcResponse CreateGridErrorResponse() |
189 | { | 189 | { |
190 | return (this.GenerateFailureResponse("key", "Error connecting to grid. Could not percieve credentials from login XML.", "false")); | 190 | return (this.GenerateFailureResponse("key", "Error connecting to grid. Could not percieve credentials from login XML.", "false")); |
191 | } | 191 | } |
192 | 192 | ||
193 | #endregion | 193 | #endregion |
194 | 194 | ||
195 | public XmlRpcResponse ToXmlRpcResponse() | 195 | public XmlRpcResponse ToXmlRpcResponse() |
196 | { | 196 | { |
197 | try | 197 | try |
198 | { | 198 | { |
199 | 199 | ||
200 | Hashtable responseData = new Hashtable(); | 200 | Hashtable responseData = new Hashtable(); |
201 | 201 | ||
202 | this.loginFlagsHash = new Hashtable(); | 202 | this.loginFlagsHash = new Hashtable(); |
203 | this.loginFlagsHash["daylight_savings"] = this.DST; | 203 | this.loginFlagsHash["daylight_savings"] = this.DST; |
204 | this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin; | 204 | this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin; |
205 | this.loginFlagsHash["gendered"] = this.Gendered; | 205 | this.loginFlagsHash["gendered"] = this.Gendered; |
206 | this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn; | 206 | this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn; |
207 | this.loginFlags.Add(this.loginFlagsHash); | 207 | this.loginFlags.Add(this.loginFlagsHash); |
208 | 208 | ||
209 | responseData["first_name"] = this.Firstname; | 209 | responseData["first_name"] = this.Firstname; |
210 | responseData["last_name"] = this.Lastname; | 210 | responseData["last_name"] = this.Lastname; |
211 | responseData["agent_access"] = this.agentAccess; | 211 | responseData["agent_access"] = this.agentAccess; |
212 | 212 | ||
213 | this.globalTexturesHash = new Hashtable(); | 213 | this.globalTexturesHash = new Hashtable(); |
214 | this.globalTexturesHash["sun_texture_id"] = this.SunTexture; | 214 | this.globalTexturesHash["sun_texture_id"] = this.SunTexture; |
215 | this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture; | 215 | this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture; |
216 | this.globalTexturesHash["moon_texture_id"] = this.MoonTexture; | 216 | this.globalTexturesHash["moon_texture_id"] = this.MoonTexture; |
217 | this.globalTextures.Add(this.globalTexturesHash); | 217 | this.globalTextures.Add(this.globalTexturesHash); |
218 | this.eventCategories.Add(this.eventCategoriesHash); | 218 | this.eventCategories.Add(this.eventCategoriesHash); |
219 | 219 | ||
220 | this.AddToUIConfig("allow_first_life", this.allowFirstLife); | 220 | this.AddToUIConfig("allow_first_life", this.allowFirstLife); |
221 | this.uiConfig.Add(this.uiConfigHash); | 221 | this.uiConfig.Add(this.uiConfigHash); |
222 | 222 | ||
223 | responseData["sim_port"] =(Int32) this.SimPort; | 223 | responseData["sim_port"] =(Int32) this.SimPort; |
224 | responseData["sim_ip"] = this.SimAddress; | 224 | responseData["sim_ip"] = this.SimAddress; |
225 | 225 | ||
226 | MainLog.Instance.Warn("SIM IP: " + responseData["sim_ip"] + "; SIM PORT: " + responseData["sim_port"]); | 226 | MainLog.Instance.Warn("SIM IP: " + responseData["sim_ip"] + "; SIM PORT: " + responseData["sim_port"]); |
227 | 227 | ||
228 | responseData["agent_id"] = this.AgentID.ToStringHyphenated(); | 228 | responseData["agent_id"] = this.AgentID.ToStringHyphenated(); |
229 | responseData["session_id"] = this.SessionID.ToStringHyphenated(); | 229 | responseData["session_id"] = this.SessionID.ToStringHyphenated(); |
230 | responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated(); | 230 | responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated(); |
231 | responseData["circuit_code"] = this.CircuitCode; | 231 | responseData["circuit_code"] = this.CircuitCode; |
232 | responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | 232 | responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; |
233 | responseData["login-flags"] = this.loginFlags; | 233 | responseData["login-flags"] = this.loginFlags; |
234 | responseData["global-textures"] = this.globalTextures; | 234 | responseData["global-textures"] = this.globalTextures; |
235 | responseData["seed_capability"] = this.seedCapability; | 235 | responseData["seed_capability"] = this.seedCapability; |
236 | 236 | ||
237 | responseData["event_categories"] = this.eventCategories; | 237 | responseData["event_categories"] = this.eventCategories; |
238 | responseData["event_notifications"] = new ArrayList(); // todo | 238 | responseData["event_notifications"] = new ArrayList(); // todo |
239 | responseData["classified_categories"] = this.classifiedCategories; | 239 | responseData["classified_categories"] = this.classifiedCategories; |
240 | responseData["ui-config"] = this.uiConfig; | 240 | responseData["ui-config"] = this.uiConfig; |
241 | 241 | ||
242 | responseData["inventory-skeleton"] = this.agentInventory; | 242 | responseData["inventory-skeleton"] = this.agentInventory; |
243 | responseData["inventory-skel-lib"] = new ArrayList(); // todo | 243 | responseData["inventory-skel-lib"] = new ArrayList(); // todo |
244 | responseData["inventory-root"] = this.inventoryRoot; | 244 | responseData["inventory-root"] = this.inventoryRoot; |
245 | responseData["gestures"] = new ArrayList(); // todo | 245 | responseData["gestures"] = new ArrayList(); // todo |
246 | responseData["inventory-lib-owner"] = new ArrayList(); // todo | 246 | responseData["inventory-lib-owner"] = new ArrayList(); // todo |
247 | responseData["initial-outfit"] = this.initialOutfit; | 247 | responseData["initial-outfit"] = this.initialOutfit; |
248 | responseData["start_location"] = this.startLocation; | 248 | responseData["start_location"] = this.startLocation; |
249 | responseData["seed_capability"] = this.seedCapability; | 249 | responseData["seed_capability"] = this.seedCapability; |
250 | responseData["home"] = this.home; | 250 | responseData["home"] = this.home; |
251 | responseData["look_at"] = this.lookAt; | 251 | responseData["look_at"] = this.lookAt; |
252 | responseData["message"] = this.welcomeMessage; | 252 | responseData["message"] = this.welcomeMessage; |
253 | responseData["region_x"] = (Int32)this.RegionX * 256; | 253 | responseData["region_x"] = (Int32)this.RegionX * 256; |
254 | responseData["region_y"] = (Int32)this.RegionY * 256; | 254 | responseData["region_y"] = (Int32)this.RegionY * 256; |
255 | 255 | ||
256 | //responseData["inventory-lib-root"] = new ArrayList(); // todo | 256 | //responseData["inventory-lib-root"] = new ArrayList(); // todo |
257 | //responseData["buddy-list"] = new ArrayList(); // todo | 257 | //responseData["buddy-list"] = new ArrayList(); // todo |
258 | 258 | ||
259 | responseData["login"] = "true"; | 259 | responseData["login"] = "true"; |
260 | this.xmlRpcResponse.Value = responseData; | 260 | this.xmlRpcResponse.Value = responseData; |
261 | 261 | ||
262 | return (this.xmlRpcResponse); | 262 | return (this.xmlRpcResponse); |
263 | } | 263 | } |
264 | catch (Exception e) | 264 | catch (Exception e) |
265 | { | 265 | { |
266 | MainLog.Instance.WriteLine( | 266 | MainLog.Instance.WriteLine( |
267 | LogPriority.LOW, | 267 | LogPriority.LOW, |
268 | "LoginResponse: Error creating XML-RPC Response: " + e.Message | 268 | "LoginResponse: Error creating XML-RPC Response: " + e.Message |
269 | ); | 269 | ); |
270 | return (this.GenerateFailureResponse("Internal Error", "Error generating Login Response", "false")); | 270 | return (this.GenerateFailureResponse("Internal Error", "Error generating Login Response", "false")); |
271 | 271 | ||
272 | } | 272 | } |
273 | 273 | ||
274 | } // ToXmlRpcResponse | 274 | } // ToXmlRpcResponse |
275 | 275 | ||
276 | public void SetEventCategories(string category, string value) | 276 | public void SetEventCategories(string category, string value) |
277 | { | 277 | { |
278 | this.eventCategoriesHash[category] = value; | 278 | this.eventCategoriesHash[category] = value; |
279 | } // SetEventCategories | 279 | } // SetEventCategories |
280 | 280 | ||
281 | public void AddToUIConfig(string itemName, string item) | 281 | public void AddToUIConfig(string itemName, string item) |
282 | { | 282 | { |
283 | this.uiConfigHash[itemName] = item; | 283 | this.uiConfigHash[itemName] = item; |
284 | } // SetUIConfig | 284 | } // SetUIConfig |
285 | 285 | ||
286 | public void AddClassifiedCategory(Int32 ID, string categoryName) | 286 | public void AddClassifiedCategory(Int32 ID, string categoryName) |
287 | { | 287 | { |
288 | this.classifiedCategoriesHash["category_name"] = categoryName; | 288 | this.classifiedCategoriesHash["category_name"] = categoryName; |
289 | this.classifiedCategoriesHash["category_id"] = ID; | 289 | this.classifiedCategoriesHash["category_id"] = ID; |
290 | this.classifiedCategories.Add(this.classifiedCategoriesHash); | 290 | this.classifiedCategories.Add(this.classifiedCategoriesHash); |
291 | // this.classifiedCategoriesHash.Clear(); | 291 | // this.classifiedCategoriesHash.Clear(); |
292 | } // SetClassifiedCategory | 292 | } // SetClassifiedCategory |
293 | 293 | ||
294 | #region Properties | 294 | #region Properties |
295 | public string Login | 295 | public string Login |
296 | { | 296 | { |
297 | get | 297 | get |
298 | { | 298 | { |
299 | return this.login; | 299 | return this.login; |
300 | } | 300 | } |
301 | set | 301 | set |
302 | { | 302 | { |
303 | this.login = value; | 303 | this.login = value; |
304 | } | 304 | } |
305 | } // Login | 305 | } // Login |
306 | 306 | ||
307 | public string DST | 307 | public string DST |
308 | { | 308 | { |
309 | get | 309 | get |
310 | { | 310 | { |
311 | return this.dst; | 311 | return this.dst; |
312 | } | 312 | } |
313 | set | 313 | set |
314 | { | 314 | { |
315 | this.dst = value; | 315 | this.dst = value; |
316 | } | 316 | } |
317 | } // DST | 317 | } // DST |
318 | 318 | ||
319 | public string StipendSinceLogin | 319 | public string StipendSinceLogin |
320 | { | 320 | { |
321 | get | 321 | get |
322 | { | 322 | { |
323 | return this.stipendSinceLogin; | 323 | return this.stipendSinceLogin; |
324 | } | 324 | } |
325 | set | 325 | set |
326 | { | 326 | { |
327 | this.stipendSinceLogin = value; | 327 | this.stipendSinceLogin = value; |
328 | } | 328 | } |
329 | } // StipendSinceLogin | 329 | } // StipendSinceLogin |
330 | 330 | ||
331 | public string Gendered | 331 | public string Gendered |
332 | { | 332 | { |
333 | get | 333 | get |
334 | { | 334 | { |
335 | return this.gendered; | 335 | return this.gendered; |
336 | } | 336 | } |
337 | set | 337 | set |
338 | { | 338 | { |
339 | this.gendered = value; | 339 | this.gendered = value; |
340 | } | 340 | } |
341 | } // Gendered | 341 | } // Gendered |
342 | 342 | ||
343 | public string EverLoggedIn | 343 | public string EverLoggedIn |
344 | { | 344 | { |
345 | get | 345 | get |
346 | { | 346 | { |
347 | return this.everLoggedIn; | 347 | return this.everLoggedIn; |
348 | } | 348 | } |
349 | set | 349 | set |
350 | { | 350 | { |
351 | this.everLoggedIn = value; | 351 | this.everLoggedIn = value; |
352 | } | 352 | } |
353 | } // EverLoggedIn | 353 | } // EverLoggedIn |
354 | 354 | ||
355 | public int SimPort | 355 | public int SimPort |
356 | { | 356 | { |
357 | get | 357 | get |
358 | { | 358 | { |
359 | return this.simPort; | 359 | return this.simPort; |
360 | } | 360 | } |
361 | set | 361 | set |
362 | { | 362 | { |
363 | this.simPort = value; | 363 | this.simPort = value; |
364 | } | 364 | } |
365 | } // SimPort | 365 | } // SimPort |
366 | 366 | ||
367 | public string SimAddress | 367 | public string SimAddress |
368 | { | 368 | { |
369 | get | 369 | get |
370 | { | 370 | { |
371 | return this.simAddress; | 371 | return this.simAddress; |
372 | } | 372 | } |
373 | set | 373 | set |
374 | { | 374 | { |
375 | this.simAddress = value; | 375 | this.simAddress = value; |
376 | } | 376 | } |
377 | } // SimAddress | 377 | } // SimAddress |
378 | 378 | ||
379 | public LLUUID AgentID | 379 | public LLUUID AgentID |
380 | { | 380 | { |
381 | get | 381 | get |
382 | { | 382 | { |
383 | return this.agentID; | 383 | return this.agentID; |
384 | } | 384 | } |
385 | set | 385 | set |
386 | { | 386 | { |
387 | this.agentID = value; | 387 | this.agentID = value; |
388 | } | 388 | } |
389 | } // AgentID | 389 | } // AgentID |
390 | 390 | ||
391 | public LLUUID SessionID | 391 | public LLUUID SessionID |
392 | { | 392 | { |
393 | get | 393 | get |
394 | { | 394 | { |
395 | return this.sessionID; | 395 | return this.sessionID; |
396 | } | 396 | } |
397 | set | 397 | set |
398 | { | 398 | { |
399 | this.sessionID = value; | 399 | this.sessionID = value; |
400 | } | 400 | } |
401 | } // SessionID | 401 | } // SessionID |
402 | 402 | ||
403 | public LLUUID SecureSessionID | 403 | public LLUUID SecureSessionID |
404 | { | 404 | { |
405 | get | 405 | get |
406 | { | 406 | { |
407 | return this.secureSessionID; | 407 | return this.secureSessionID; |
408 | } | 408 | } |
409 | set | 409 | set |
410 | { | 410 | { |
411 | this.secureSessionID = value; | 411 | this.secureSessionID = value; |
412 | } | 412 | } |
413 | } // SecureSessionID | 413 | } // SecureSessionID |
414 | 414 | ||
415 | public Int32 CircuitCode | 415 | public Int32 CircuitCode |
416 | { | 416 | { |
417 | get | 417 | get |
418 | { | 418 | { |
419 | return this.circuitCode; | 419 | return this.circuitCode; |
420 | } | 420 | } |
421 | set | 421 | set |
422 | { | 422 | { |
423 | this.circuitCode = value; | 423 | this.circuitCode = value; |
424 | } | 424 | } |
425 | } // CircuitCode | 425 | } // CircuitCode |
426 | 426 | ||
427 | public uint RegionX | 427 | public uint RegionX |
428 | { | 428 | { |
429 | get | 429 | get |
430 | { | 430 | { |
431 | return this.regionX; | 431 | return this.regionX; |
432 | } | 432 | } |
433 | set | 433 | set |
434 | { | 434 | { |
435 | this.regionX = value; | 435 | this.regionX = value; |
436 | } | 436 | } |
437 | } // RegionX | 437 | } // RegionX |
438 | 438 | ||
439 | public uint RegionY | 439 | public uint RegionY |
440 | { | 440 | { |
441 | get | 441 | get |
442 | { | 442 | { |
443 | return this.regionY; | 443 | return this.regionY; |
444 | } | 444 | } |
445 | set | 445 | set |
446 | { | 446 | { |
447 | this.regionY = value; | 447 | this.regionY = value; |
448 | } | 448 | } |
449 | } // RegionY | 449 | } // RegionY |
450 | 450 | ||
451 | public string SunTexture | 451 | public string SunTexture |
452 | { | 452 | { |
453 | get | 453 | get |
454 | { | 454 | { |
455 | return this.sunTexture; | 455 | return this.sunTexture; |
456 | } | 456 | } |
457 | set | 457 | set |
458 | { | 458 | { |
459 | this.sunTexture = value; | 459 | this.sunTexture = value; |
460 | } | 460 | } |
461 | } // SunTexture | 461 | } // SunTexture |
462 | 462 | ||
463 | public string CloudTexture | 463 | public string CloudTexture |
464 | { | 464 | { |
465 | get | 465 | get |
466 | { | 466 | { |
467 | return this.cloudTexture; | 467 | return this.cloudTexture; |
468 | } | 468 | } |
469 | set | 469 | set |
470 | { | 470 | { |
471 | this.cloudTexture = value; | 471 | this.cloudTexture = value; |
472 | } | 472 | } |
473 | } // CloudTexture | 473 | } // CloudTexture |
474 | 474 | ||
475 | public string MoonTexture | 475 | public string MoonTexture |
476 | { | 476 | { |
477 | get | 477 | get |
478 | { | 478 | { |
479 | return this.moonTexture; | 479 | return this.moonTexture; |
480 | } | 480 | } |
481 | set | 481 | set |
482 | { | 482 | { |
483 | this.moonTexture = value; | 483 | this.moonTexture = value; |
484 | } | 484 | } |
485 | } // MoonTexture | 485 | } // MoonTexture |
486 | 486 | ||
487 | public string Firstname | 487 | public string Firstname |
488 | { | 488 | { |
489 | get | 489 | get |
490 | { | 490 | { |
491 | return this.firstname; | 491 | return this.firstname; |
492 | } | 492 | } |
493 | set | 493 | set |
494 | { | 494 | { |
495 | this.firstname = value; | 495 | this.firstname = value; |
496 | } | 496 | } |
497 | } // Firstname | 497 | } // Firstname |
498 | 498 | ||
499 | public string Lastname | 499 | public string Lastname |
500 | { | 500 | { |
501 | get | 501 | get |
502 | { | 502 | { |
503 | return this.lastname; | 503 | return this.lastname; |
504 | } | 504 | } |
505 | set | 505 | set |
506 | { | 506 | { |
507 | this.lastname = value; | 507 | this.lastname = value; |
508 | } | 508 | } |
509 | } // Lastname | 509 | } // Lastname |
510 | 510 | ||
511 | public string AgentAccess | 511 | public string AgentAccess |
512 | { | 512 | { |
513 | get | 513 | get |
514 | { | 514 | { |
515 | return this.agentAccess; | 515 | return this.agentAccess; |
516 | } | 516 | } |
517 | set | 517 | set |
518 | { | 518 | { |
519 | this.agentAccess = value; | 519 | this.agentAccess = value; |
520 | } | 520 | } |
521 | } | 521 | } |
522 | 522 | ||
523 | public string StartLocation | 523 | public string StartLocation |
524 | { | 524 | { |
525 | get | 525 | get |
526 | { | 526 | { |
527 | return this.startLocation; | 527 | return this.startLocation; |
528 | } | 528 | } |
529 | set | 529 | set |
530 | { | 530 | { |
531 | this.startLocation = value; | 531 | this.startLocation = value; |
532 | } | 532 | } |
533 | } // StartLocation | 533 | } // StartLocation |
534 | 534 | ||
535 | public string LookAt | 535 | public string LookAt |
536 | { | 536 | { |
537 | get | 537 | get |
538 | { | 538 | { |
539 | return this.lookAt; | 539 | return this.lookAt; |
540 | } | 540 | } |
541 | set | 541 | set |
542 | { | 542 | { |
543 | this.lookAt = value; | 543 | this.lookAt = value; |
544 | } | 544 | } |
545 | } | 545 | } |
546 | 546 | ||
547 | public string SeedCapability | 547 | public string SeedCapability |
548 | { | 548 | { |
549 | get | 549 | get |
550 | { | 550 | { |
551 | return this.seedCapability; | 551 | return this.seedCapability; |
552 | } | 552 | } |
553 | set | 553 | set |
554 | { | 554 | { |
555 | this.seedCapability = value; | 555 | this.seedCapability = value; |
556 | } | 556 | } |
557 | } // SeedCapability | 557 | } // SeedCapability |
558 | 558 | ||
559 | public string ErrorReason | 559 | public string ErrorReason |
560 | { | 560 | { |
561 | get | 561 | get |
562 | { | 562 | { |
563 | return this.errorReason; | 563 | return this.errorReason; |
564 | } | 564 | } |
565 | set | 565 | set |
566 | { | 566 | { |
567 | this.errorReason = value; | 567 | this.errorReason = value; |
568 | } | 568 | } |
569 | } // ErrorReason | 569 | } // ErrorReason |
570 | 570 | ||
571 | public string ErrorMessage | 571 | public string ErrorMessage |
572 | { | 572 | { |
573 | get | 573 | get |
574 | { | 574 | { |
575 | return this.errorMessage; | 575 | return this.errorMessage; |
576 | } | 576 | } |
577 | set | 577 | set |
578 | { | 578 | { |
579 | this.errorMessage = value; | 579 | this.errorMessage = value; |
580 | } | 580 | } |
581 | } // ErrorMessage | 581 | } // ErrorMessage |
582 | 582 | ||
583 | public ArrayList InventoryRoot | 583 | public ArrayList InventoryRoot |
584 | { | 584 | { |
585 | get | 585 | get |
586 | { | 586 | { |
587 | return this.inventoryRoot; | 587 | return this.inventoryRoot; |
588 | } | 588 | } |
589 | set | 589 | set |
590 | { | 590 | { |
591 | this.inventoryRoot = value; | 591 | this.inventoryRoot = value; |
592 | } | 592 | } |
593 | } | 593 | } |
594 | 594 | ||
595 | public ArrayList InventorySkeleton | 595 | public ArrayList InventorySkeleton |
596 | { | 596 | { |
597 | get | 597 | get |
598 | { | 598 | { |
599 | return this.agentInventory; | 599 | return this.agentInventory; |
600 | } | 600 | } |
601 | set | 601 | set |
602 | { | 602 | { |
603 | this.agentInventory = value; | 603 | this.agentInventory = value; |
604 | } | 604 | } |
605 | } | 605 | } |
606 | 606 | ||
607 | public string Home | 607 | public string Home |
608 | { | 608 | { |
609 | get | 609 | get |
610 | { | 610 | { |
611 | return this.home; | 611 | return this.home; |
612 | } | 612 | } |
613 | set | 613 | set |
614 | { | 614 | { |
615 | this.home = value; | 615 | this.home = value; |
616 | } | 616 | } |
617 | } | 617 | } |
618 | 618 | ||
619 | public string Message | 619 | public string Message |
620 | { | 620 | { |
621 | get | 621 | get |
622 | { | 622 | { |
623 | return this.welcomeMessage; | 623 | return this.welcomeMessage; |
624 | } | 624 | } |
625 | set | 625 | set |
626 | { | 626 | { |
627 | this.welcomeMessage = value; | 627 | this.welcomeMessage = value; |
628 | } | 628 | } |
629 | } | 629 | } |
630 | #endregion | 630 | #endregion |
631 | 631 | ||
632 | 632 | ||
633 | public class UserInfo | 633 | public class UserInfo |
634 | { | 634 | { |
635 | public string firstname; | 635 | public string firstname; |
636 | public string lastname; | 636 | public string lastname; |
637 | public ulong homeregionhandle; | 637 | public ulong homeregionhandle; |
638 | public LLVector3 homepos; | 638 | public LLVector3 homepos; |
639 | public LLVector3 homelookat; | 639 | public LLVector3 homelookat; |
640 | } | 640 | } |
641 | } | 641 | } |
642 | } | 642 | } |
643 | 643 | ||
diff --git a/OpenSim/Framework/UserManager/UserManagerBase.cs b/OpenSim/Framework/UserManager/UserManagerBase.cs index 4e688f7..fe45d1b 100644 --- a/OpenSim/Framework/UserManager/UserManagerBase.cs +++ b/OpenSim/Framework/UserManager/UserManagerBase.cs | |||
@@ -1,631 +1,631 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Security.Cryptography; | 32 | using System.Security.Cryptography; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework.Data; | 36 | using OpenSim.Framework.Data; |
37 | using OpenSim.Framework.Interfaces; | 37 | using OpenSim.Framework.Interfaces; |
38 | using OpenSim.Framework.Inventory; | 38 | using OpenSim.Framework.Inventory; |
39 | using OpenSim.Framework.Utilities; | 39 | using OpenSim.Framework.Utilities; |
40 | 40 | ||
41 | namespace OpenSim.Framework.UserManagement | 41 | namespace OpenSim.Framework.UserManagement |
42 | { | 42 | { |
43 | public abstract class UserManagerBase | 43 | public abstract class UserManagerBase |
44 | { | 44 | { |
45 | public UserConfig _config; | 45 | public UserConfig _config; |
46 | Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); | 46 | Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); |
47 | 47 | ||
48 | /// <summary> | 48 | /// <summary> |
49 | /// Adds a new user server plugin - user servers will be requested in the order they were loaded. | 49 | /// Adds a new user server plugin - user servers will be requested in the order they were loaded. |
50 | /// </summary> | 50 | /// </summary> |
51 | /// <param name="FileName">The filename to the user server plugin DLL</param> | 51 | /// <param name="FileName">The filename to the user server plugin DLL</param> |
52 | public void AddPlugin(string FileName) | 52 | public void AddPlugin(string FileName) |
53 | { | 53 | { |
54 | MainLog.Instance.Verbose( "Userstorage: Attempting to load " + FileName); | 54 | MainLog.Instance.Verbose( "Userstorage: Attempting to load " + FileName); |
55 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 55 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); |
56 | 56 | ||
57 | MainLog.Instance.Verbose( "Userstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); | 57 | MainLog.Instance.Verbose( "Userstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); |
58 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 58 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
59 | { | 59 | { |
60 | if (!pluginType.IsAbstract) | 60 | if (!pluginType.IsAbstract) |
61 | { | 61 | { |
62 | Type typeInterface = pluginType.GetInterface("IUserData", true); | 62 | Type typeInterface = pluginType.GetInterface("IUserData", true); |
63 | 63 | ||
64 | if (typeInterface != null) | 64 | if (typeInterface != null) |
65 | { | 65 | { |
66 | IUserData plug = (IUserData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 66 | IUserData plug = (IUserData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
67 | plug.Initialise(); | 67 | plug.Initialise(); |
68 | this._plugins.Add(plug.getName(), plug); | 68 | this._plugins.Add(plug.getName(), plug); |
69 | MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface"); | 69 | MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface"); |
70 | } | 70 | } |
71 | 71 | ||
72 | typeInterface = null; | 72 | typeInterface = null; |
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
76 | pluginAssembly = null; | 76 | pluginAssembly = null; |
77 | } | 77 | } |
78 | 78 | ||
79 | #region Get UserProfile | 79 | #region Get UserProfile |
80 | /// <summary> | 80 | /// <summary> |
81 | /// Loads a user profile from a database by UUID | 81 | /// Loads a user profile from a database by UUID |
82 | /// </summary> | 82 | /// </summary> |
83 | /// <param name="uuid">The target UUID</param> | 83 | /// <param name="uuid">The target UUID</param> |
84 | /// <returns>A user profile</returns> | 84 | /// <returns>A user profile</returns> |
85 | public UserProfileData getUserProfile(LLUUID uuid) | 85 | public UserProfileData getUserProfile(LLUUID uuid) |
86 | { | 86 | { |
87 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 87 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
88 | { | 88 | { |
89 | try | 89 | try |
90 | { | 90 | { |
91 | UserProfileData profile = plugin.Value.getUserByUUID(uuid); | 91 | UserProfileData profile = plugin.Value.getUserByUUID(uuid); |
92 | profile.currentAgent = getUserAgent(profile.UUID); | 92 | profile.currentAgent = getUserAgent(profile.UUID); |
93 | return profile; | 93 | return profile; |
94 | } | 94 | } |
95 | catch (Exception e) | 95 | catch (Exception e) |
96 | { | 96 | { |
97 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 97 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | return null; | 101 | return null; |
102 | } | 102 | } |
103 | 103 | ||
104 | 104 | ||
105 | /// <summary> | 105 | /// <summary> |
106 | /// Loads a user profile by name | 106 | /// Loads a user profile by name |
107 | /// </summary> | 107 | /// </summary> |
108 | /// <param name="name">The target name</param> | 108 | /// <param name="name">The target name</param> |
109 | /// <returns>A user profile</returns> | 109 | /// <returns>A user profile</returns> |
110 | public UserProfileData getUserProfile(string name) | 110 | public UserProfileData getUserProfile(string name) |
111 | { | 111 | { |
112 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 112 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
113 | { | 113 | { |
114 | try | 114 | try |
115 | { | 115 | { |
116 | UserProfileData profile = plugin.Value.getUserByName(name); | 116 | UserProfileData profile = plugin.Value.getUserByName(name); |
117 | profile.currentAgent = getUserAgent(profile.UUID); | 117 | profile.currentAgent = getUserAgent(profile.UUID); |
118 | return profile; | 118 | return profile; |
119 | } | 119 | } |
120 | catch (Exception e) | 120 | catch (Exception e) |
121 | { | 121 | { |
122 | System.Console.WriteLine("EEK!"); | 122 | System.Console.WriteLine("EEK!"); |
123 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 123 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | return null; | 127 | return null; |
128 | } | 128 | } |
129 | 129 | ||
130 | /// <summary> | 130 | /// <summary> |
131 | /// Loads a user profile by name | 131 | /// Loads a user profile by name |
132 | /// </summary> | 132 | /// </summary> |
133 | /// <param name="fname">First name</param> | 133 | /// <param name="fname">First name</param> |
134 | /// <param name="lname">Last name</param> | 134 | /// <param name="lname">Last name</param> |
135 | /// <returns>A user profile</returns> | 135 | /// <returns>A user profile</returns> |
136 | public UserProfileData getUserProfile(string fname, string lname) | 136 | public UserProfileData getUserProfile(string fname, string lname) |
137 | { | 137 | { |
138 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 138 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
139 | { | 139 | { |
140 | try | 140 | try |
141 | { | 141 | { |
142 | UserProfileData profile = plugin.Value.getUserByName(fname,lname); | 142 | UserProfileData profile = plugin.Value.getUserByName(fname,lname); |
143 | 143 | ||
144 | profile.currentAgent = getUserAgent(profile.UUID); | 144 | profile.currentAgent = getUserAgent(profile.UUID); |
145 | 145 | ||
146 | return profile; | 146 | return profile; |
147 | } | 147 | } |
148 | catch (Exception e) | 148 | catch (Exception e) |
149 | { | 149 | { |
150 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 150 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | return null; | 154 | return null; |
155 | } | 155 | } |
156 | #endregion | 156 | #endregion |
157 | 157 | ||
158 | #region Get UserAgent | 158 | #region Get UserAgent |
159 | /// <summary> | 159 | /// <summary> |
160 | /// Loads a user agent by uuid (not called directly) | 160 | /// Loads a user agent by uuid (not called directly) |
161 | /// </summary> | 161 | /// </summary> |
162 | /// <param name="uuid">The agents UUID</param> | 162 | /// <param name="uuid">The agents UUID</param> |
163 | /// <returns>Agent profiles</returns> | 163 | /// <returns>Agent profiles</returns> |
164 | public UserAgentData getUserAgent(LLUUID uuid) | 164 | public UserAgentData getUserAgent(LLUUID uuid) |
165 | { | 165 | { |
166 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 166 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
167 | { | 167 | { |
168 | try | 168 | try |
169 | { | 169 | { |
170 | return plugin.Value.getAgentByUUID(uuid); | 170 | return plugin.Value.getAgentByUUID(uuid); |
171 | } | 171 | } |
172 | catch (Exception e) | 172 | catch (Exception e) |
173 | { | 173 | { |
174 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 174 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | return null; | 178 | return null; |
179 | } | 179 | } |
180 | 180 | ||
181 | /// <summary> | 181 | /// <summary> |
182 | /// Loads a user agent by name (not called directly) | 182 | /// Loads a user agent by name (not called directly) |
183 | /// </summary> | 183 | /// </summary> |
184 | /// <param name="name">The agents name</param> | 184 | /// <param name="name">The agents name</param> |
185 | /// <returns>A user agent</returns> | 185 | /// <returns>A user agent</returns> |
186 | public UserAgentData getUserAgent(string name) | 186 | public UserAgentData getUserAgent(string name) |
187 | { | 187 | { |
188 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 188 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
189 | { | 189 | { |
190 | try | 190 | try |
191 | { | 191 | { |
192 | return plugin.Value.getAgentByName(name); | 192 | return plugin.Value.getAgentByName(name); |
193 | } | 193 | } |
194 | catch (Exception e) | 194 | catch (Exception e) |
195 | { | 195 | { |
196 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 196 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | 199 | ||
200 | return null; | 200 | return null; |
201 | } | 201 | } |
202 | 202 | ||
203 | /// <summary> | 203 | /// <summary> |
204 | /// Loads a user agent by name (not called directly) | 204 | /// Loads a user agent by name (not called directly) |
205 | /// </summary> | 205 | /// </summary> |
206 | /// <param name="fname">The agents firstname</param> | 206 | /// <param name="fname">The agents firstname</param> |
207 | /// <param name="lname">The agents lastname</param> | 207 | /// <param name="lname">The agents lastname</param> |
208 | /// <returns>A user agent</returns> | 208 | /// <returns>A user agent</returns> |
209 | public UserAgentData getUserAgent(string fname, string lname) | 209 | public UserAgentData getUserAgent(string fname, string lname) |
210 | { | 210 | { |
211 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 211 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
212 | { | 212 | { |
213 | try | 213 | try |
214 | { | 214 | { |
215 | return plugin.Value.getAgentByName(fname,lname); | 215 | return plugin.Value.getAgentByName(fname,lname); |
216 | } | 216 | } |
217 | catch (Exception e) | 217 | catch (Exception e) |
218 | { | 218 | { |
219 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 219 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
220 | } | 220 | } |
221 | } | 221 | } |
222 | 222 | ||
223 | return null; | 223 | return null; |
224 | } | 224 | } |
225 | 225 | ||
226 | #endregion | 226 | #endregion |
227 | 227 | ||
228 | #region CreateAgent | 228 | #region CreateAgent |
229 | /// <summary> | 229 | /// <summary> |
230 | /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB | 230 | /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB |
231 | /// </summary> | 231 | /// </summary> |
232 | /// <param name="profile">The users profile</param> | 232 | /// <param name="profile">The users profile</param> |
233 | /// <param name="request">The users loginrequest</param> | 233 | /// <param name="request">The users loginrequest</param> |
234 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) | 234 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) |
235 | { | 235 | { |
236 | Hashtable requestData = (Hashtable)request.Params[0]; | 236 | Hashtable requestData = (Hashtable)request.Params[0]; |
237 | 237 | ||
238 | UserAgentData agent = new UserAgentData(); | 238 | UserAgentData agent = new UserAgentData(); |
239 | 239 | ||
240 | // User connection | 240 | // User connection |
241 | agent.agentOnline = true; | 241 | agent.agentOnline = true; |
242 | 242 | ||
243 | // Generate sessions | 243 | // Generate sessions |
244 | RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); | 244 | RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); |
245 | byte[] randDataS = new byte[16]; | 245 | byte[] randDataS = new byte[16]; |
246 | byte[] randDataSS = new byte[16]; | 246 | byte[] randDataSS = new byte[16]; |
247 | rand.GetBytes(randDataS); | 247 | rand.GetBytes(randDataS); |
248 | rand.GetBytes(randDataSS); | 248 | rand.GetBytes(randDataSS); |
249 | 249 | ||
250 | agent.secureSessionID = new LLUUID(randDataSS, 0); | 250 | agent.secureSessionID = new LLUUID(randDataSS, 0); |
251 | agent.sessionID = new LLUUID(randDataS, 0); | 251 | agent.sessionID = new LLUUID(randDataS, 0); |
252 | 252 | ||
253 | // Profile UUID | 253 | // Profile UUID |
254 | agent.UUID = profile.UUID; | 254 | agent.UUID = profile.UUID; |
255 | 255 | ||
256 | // Current position (from Home) | 256 | // Current position (from Home) |
257 | agent.currentHandle = profile.homeRegion; | 257 | agent.currentHandle = profile.homeRegion; |
258 | agent.currentPos = profile.homeLocation; | 258 | agent.currentPos = profile.homeLocation; |
259 | 259 | ||
260 | // If user specified additional start, use that | 260 | // If user specified additional start, use that |
261 | if (requestData.ContainsKey("start")) | 261 | if (requestData.ContainsKey("start")) |
262 | { | 262 | { |
263 | string startLoc = ((string)requestData["start"]).Trim(); | 263 | string startLoc = ((string)requestData["start"]).Trim(); |
264 | if (!(startLoc == "last" || startLoc == "home")) | 264 | if (!(startLoc == "last" || startLoc == "home")) |
265 | { | 265 | { |
266 | // Format: uri:Ahern&162&213&34 | 266 | // Format: uri:Ahern&162&213&34 |
267 | try | 267 | try |
268 | { | 268 | { |
269 | string[] parts = startLoc.Remove(0, 4).Split('&'); | 269 | string[] parts = startLoc.Remove(0, 4).Split('&'); |
270 | string region = parts[0]; | 270 | string region = parts[0]; |
271 | 271 | ||
272 | //////////////////////////////////////////////////// | 272 | //////////////////////////////////////////////////// |
273 | //SimProfile SimInfo = new SimProfile(); | 273 | //SimProfile SimInfo = new SimProfile(); |
274 | //SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); | 274 | //SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); |
275 | } | 275 | } |
276 | catch (Exception) | 276 | catch (Exception) |
277 | { | 277 | { |
278 | 278 | ||
279 | } | 279 | } |
280 | } | 280 | } |
281 | } | 281 | } |
282 | 282 | ||
283 | // What time did the user login? | 283 | // What time did the user login? |
284 | agent.loginTime = Util.UnixTimeSinceEpoch(); | 284 | agent.loginTime = Util.UnixTimeSinceEpoch(); |
285 | agent.logoutTime = 0; | 285 | agent.logoutTime = 0; |
286 | 286 | ||
287 | // Current location | 287 | // Current location |
288 | agent.regionID = new LLUUID(); // Fill in later | 288 | agent.regionID = new LLUUID(); // Fill in later |
289 | agent.currentRegion = new LLUUID(); // Fill in later | 289 | agent.currentRegion = new LLUUID(); // Fill in later |
290 | 290 | ||
291 | profile.currentAgent = agent; | 291 | profile.currentAgent = agent; |
292 | } | 292 | } |
293 | 293 | ||
294 | /// <summary> | 294 | /// <summary> |
295 | /// Saves a target agent to the database | 295 | /// Saves a target agent to the database |
296 | /// </summary> | 296 | /// </summary> |
297 | /// <param name="profile">The users profile</param> | 297 | /// <param name="profile">The users profile</param> |
298 | /// <returns>Successful?</returns> | 298 | /// <returns>Successful?</returns> |
299 | public bool CommitAgent(ref UserProfileData profile) | 299 | public bool CommitAgent(ref UserProfileData profile) |
300 | { | 300 | { |
301 | // Saves the agent to database | 301 | // Saves the agent to database |
302 | return true; | 302 | return true; |
303 | } | 303 | } |
304 | 304 | ||
305 | #endregion | 305 | #endregion |
306 | 306 | ||
307 | /// <summary> | 307 | /// <summary> |
308 | /// Checks a user against it's password hash | 308 | /// Checks a user against it's password hash |
309 | /// </summary> | 309 | /// </summary> |
310 | /// <param name="profile">The users profile</param> | 310 | /// <param name="profile">The users profile</param> |
311 | /// <param name="password">The supplied password</param> | 311 | /// <param name="password">The supplied password</param> |
312 | /// <returns>Authenticated?</returns> | 312 | /// <returns>Authenticated?</returns> |
313 | public virtual bool AuthenticateUser(UserProfileData profile, string password) | 313 | public virtual bool AuthenticateUser(UserProfileData profile, string password) |
314 | { | 314 | { |
315 | MainLog.Instance.Verbose( | 315 | MainLog.Instance.Verbose( |
316 | "Authenticating " + profile.username + " " + profile.surname); | 316 | "Authenticating " + profile.username + " " + profile.surname); |
317 | 317 | ||
318 | password = password.Remove(0, 3); //remove $1$ | 318 | password = password.Remove(0, 3); //remove $1$ |
319 | 319 | ||
320 | string s = Util.Md5Hash(password + ":" + profile.passwordSalt); | 320 | string s = Util.Md5Hash(password + ":" + profile.passwordSalt); |
321 | 321 | ||
322 | return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); | 322 | return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); |
323 | } | 323 | } |
324 | 324 | ||
325 | #region Xml Response | 325 | #region Xml Response |
326 | 326 | ||
327 | /// <summary> | 327 | /// <summary> |
328 | /// | 328 | /// |
329 | /// </summary> | 329 | /// </summary> |
330 | /// <param name="firstname"></param> | 330 | /// <param name="firstname"></param> |
331 | /// <param name="lastname"></param> | 331 | /// <param name="lastname"></param> |
332 | /// <returns></returns> | 332 | /// <returns></returns> |
333 | public virtual UserProfileData GetTheUser(string firstname, string lastname) | 333 | public virtual UserProfileData GetTheUser(string firstname, string lastname) |
334 | { | 334 | { |
335 | return getUserProfile(firstname, lastname); | 335 | return getUserProfile(firstname, lastname); |
336 | } | 336 | } |
337 | 337 | ||
338 | /// <summary> | 338 | /// <summary> |
339 | /// | 339 | /// |
340 | /// </summary> | 340 | /// </summary> |
341 | /// <returns></returns> | 341 | /// <returns></returns> |
342 | public virtual string GetMessage() | 342 | public virtual string GetMessage() |
343 | { | 343 | { |
344 | return _config.DefaultStartupMsg; | 344 | return _config.DefaultStartupMsg; |
345 | } | 345 | } |
346 | 346 | ||
347 | /// <summary> | 347 | /// <summary> |
348 | /// Customises the login response and fills in missing values. | 348 | /// Customises the login response and fills in missing values. |
349 | /// </summary> | 349 | /// </summary> |
350 | /// <param name="response">The existing response</param> | 350 | /// <param name="response">The existing response</param> |
351 | /// <param name="theUser">The user profile</param> | 351 | /// <param name="theUser">The user profile</param> |
352 | public abstract void CustomiseResponse( LoginResponse response, UserProfileData theUser); | 352 | public abstract void CustomiseResponse( LoginResponse response, UserProfileData theUser); |
353 | 353 | ||
354 | /// <summary> | 354 | /// <summary> |
355 | /// Main user login function | 355 | /// Main user login function |
356 | /// </summary> | 356 | /// </summary> |
357 | /// <param name="request">The XMLRPC request</param> | 357 | /// <param name="request">The XMLRPC request</param> |
358 | /// <returns>The response to send</returns> | 358 | /// <returns>The response to send</returns> |
359 | public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) | 359 | public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) |
360 | { | 360 | { |
361 | 361 | ||
362 | System.Console.WriteLine("Attempting login now..."); | 362 | System.Console.WriteLine("Attempting login now..."); |
363 | XmlRpcResponse response = new XmlRpcResponse(); | 363 | XmlRpcResponse response = new XmlRpcResponse(); |
364 | Hashtable requestData = (Hashtable)request.Params[0]; | 364 | Hashtable requestData = (Hashtable)request.Params[0]; |
365 | 365 | ||
366 | bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); | 366 | bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); |
367 | bool GoodLogin = false; | 367 | bool GoodLogin = false; |
368 | string firstname = ""; | 368 | string firstname = ""; |
369 | string lastname = ""; | 369 | string lastname = ""; |
370 | string passwd = ""; | 370 | string passwd = ""; |
371 | 371 | ||
372 | UserProfileData userProfile; | 372 | UserProfileData userProfile; |
373 | LoginResponse logResponse = new LoginResponse(); | 373 | LoginResponse logResponse = new LoginResponse(); |
374 | 374 | ||
375 | if (GoodXML) | 375 | if (GoodXML) |
376 | { | 376 | { |
377 | firstname = (string)requestData["first"]; | 377 | firstname = (string)requestData["first"]; |
378 | lastname = (string)requestData["last"]; | 378 | lastname = (string)requestData["last"]; |
379 | passwd = (string)requestData["passwd"]; | 379 | passwd = (string)requestData["passwd"]; |
380 | 380 | ||
381 | userProfile = GetTheUser(firstname, lastname); | 381 | userProfile = GetTheUser(firstname, lastname); |
382 | if (userProfile == null) | 382 | if (userProfile == null) |
383 | return logResponse.CreateLoginFailedResponse(); | 383 | return logResponse.CreateLoginFailedResponse(); |
384 | 384 | ||
385 | GoodLogin = AuthenticateUser(userProfile, passwd); | 385 | GoodLogin = AuthenticateUser(userProfile, passwd); |
386 | } | 386 | } |
387 | else | 387 | else |
388 | { | 388 | { |
389 | return logResponse.CreateGridErrorResponse(); | 389 | return logResponse.CreateGridErrorResponse(); |
390 | } | 390 | } |
391 | 391 | ||
392 | if (!GoodLogin) | 392 | if (!GoodLogin) |
393 | { | 393 | { |
394 | return logResponse.CreateLoginFailedResponse(); | 394 | return logResponse.CreateLoginFailedResponse(); |
395 | } | 395 | } |
396 | else | 396 | else |
397 | { | 397 | { |
398 | // If we already have a session... | 398 | // If we already have a session... |
399 | if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) | 399 | if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) |
400 | { | 400 | { |
401 | // Reject the login | 401 | // Reject the login |
402 | return logResponse.CreateAlreadyLoggedInResponse(); | 402 | return logResponse.CreateAlreadyLoggedInResponse(); |
403 | } | 403 | } |
404 | // Otherwise... | 404 | // Otherwise... |
405 | // Create a new agent session | 405 | // Create a new agent session |
406 | CreateAgent( userProfile, request); | 406 | CreateAgent( userProfile, request); |
407 | 407 | ||
408 | try | 408 | try |
409 | { | 409 | { |
410 | 410 | ||
411 | LLUUID AgentID = userProfile.UUID; | 411 | LLUUID AgentID = userProfile.UUID; |
412 | 412 | ||
413 | // Inventory Library Section | 413 | // Inventory Library Section |
414 | ArrayList AgentInventoryArray = new ArrayList(); | 414 | ArrayList AgentInventoryArray = new ArrayList(); |
415 | Hashtable TempHash; | 415 | Hashtable TempHash; |
416 | 416 | ||
417 | AgentInventory Library = new AgentInventory(); | 417 | AgentInventory Library = new AgentInventory(); |
418 | Library.CreateRootFolder(AgentID, true); | 418 | Library.CreateRootFolder(AgentID, true); |
419 | 419 | ||
420 | foreach (InventoryFolder InvFolder in Library.InventoryFolders.Values) | 420 | foreach (InventoryFolder InvFolder in Library.InventoryFolders.Values) |
421 | { | 421 | { |
422 | TempHash = new Hashtable(); | 422 | TempHash = new Hashtable(); |
423 | TempHash["name"] = InvFolder.FolderName; | 423 | TempHash["name"] = InvFolder.FolderName; |
424 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); | 424 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); |
425 | TempHash["version"] = (Int32)InvFolder.Version; | 425 | TempHash["version"] = (Int32)InvFolder.Version; |
426 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; | 426 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; |
427 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); | 427 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); |
428 | AgentInventoryArray.Add(TempHash); | 428 | AgentInventoryArray.Add(TempHash); |
429 | } | 429 | } |
430 | 430 | ||
431 | Hashtable InventoryRootHash = new Hashtable(); | 431 | Hashtable InventoryRootHash = new Hashtable(); |
432 | InventoryRootHash["folder_id"] = Library.InventoryRoot.FolderID.ToStringHyphenated(); | 432 | InventoryRootHash["folder_id"] = Library.InventoryRoot.FolderID.ToStringHyphenated(); |
433 | ArrayList InventoryRoot = new ArrayList(); | 433 | ArrayList InventoryRoot = new ArrayList(); |
434 | InventoryRoot.Add(InventoryRootHash); | 434 | InventoryRoot.Add(InventoryRootHash); |
435 | 435 | ||
436 | // Circuit Code | 436 | // Circuit Code |
437 | uint circode = (uint)(Util.RandomClass.Next()); | 437 | uint circode = (uint)(Util.RandomClass.Next()); |
438 | 438 | ||
439 | logResponse.Lastname = userProfile.surname; | 439 | logResponse.Lastname = userProfile.surname; |
440 | logResponse.Firstname = userProfile.username; | 440 | logResponse.Firstname = userProfile.username; |
441 | logResponse.AgentID = AgentID.ToStringHyphenated(); | 441 | logResponse.AgentID = AgentID.ToStringHyphenated(); |
442 | logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); | 442 | logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); |
443 | logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); | 443 | logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); |
444 | logResponse.InventoryRoot = InventoryRoot; | 444 | logResponse.InventoryRoot = InventoryRoot; |
445 | logResponse.InventorySkeleton = AgentInventoryArray; | 445 | logResponse.InventorySkeleton = AgentInventoryArray; |
446 | logResponse.CircuitCode = (Int32)circode; | 446 | logResponse.CircuitCode = (Int32)circode; |
447 | //logResponse.RegionX = 0; //overwritten | 447 | //logResponse.RegionX = 0; //overwritten |
448 | //logResponse.RegionY = 0; //overwritten | 448 | //logResponse.RegionY = 0; //overwritten |
449 | logResponse.Home = "!!null temporary value {home}!!"; // Overwritten | 449 | logResponse.Home = "!!null temporary value {home}!!"; // Overwritten |
450 | //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; | 450 | //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; |
451 | //logResponse.SimAddress = "127.0.0.1"; //overwritten | 451 | //logResponse.SimAddress = "127.0.0.1"; //overwritten |
452 | //logResponse.SimPort = 0; //overwritten | 452 | //logResponse.SimPort = 0; //overwritten |
453 | logResponse.Message = this.GetMessage(); | 453 | logResponse.Message = this.GetMessage(); |
454 | 454 | ||
455 | try | 455 | try |
456 | { | 456 | { |
457 | this.CustomiseResponse( logResponse, userProfile); | 457 | this.CustomiseResponse( logResponse, userProfile); |
458 | } | 458 | } |
459 | catch (Exception e) | 459 | catch (Exception e) |
460 | { | 460 | { |
461 | System.Console.WriteLine(e.ToString()); | 461 | System.Console.WriteLine(e.ToString()); |
462 | return logResponse.CreateDeadRegionResponse(); | 462 | return logResponse.CreateDeadRegionResponse(); |
463 | //return logResponse.ToXmlRpcResponse(); | 463 | //return logResponse.ToXmlRpcResponse(); |
464 | } | 464 | } |
465 | CommitAgent(ref userProfile); | 465 | CommitAgent(ref userProfile); |
466 | return logResponse.ToXmlRpcResponse(); | 466 | return logResponse.ToXmlRpcResponse(); |
467 | 467 | ||
468 | } | 468 | } |
469 | 469 | ||
470 | catch (Exception E) | 470 | catch (Exception E) |
471 | { | 471 | { |
472 | System.Console.WriteLine(E.ToString()); | 472 | System.Console.WriteLine(E.ToString()); |
473 | } | 473 | } |
474 | //} | 474 | //} |
475 | } | 475 | } |
476 | return response; | 476 | return response; |
477 | 477 | ||
478 | } | 478 | } |
479 | 479 | ||
480 | #endregion | 480 | #endregion |
481 | 481 | ||
482 | /// <summary> | 482 | /// <summary> |
483 | /// Deletes an active agent session | 483 | /// Deletes an active agent session |
484 | /// </summary> | 484 | /// </summary> |
485 | /// <param name="request">The request</param> | 485 | /// <param name="request">The request</param> |
486 | /// <param name="path">The path (eg /bork/narf/test)</param> | 486 | /// <param name="path">The path (eg /bork/narf/test)</param> |
487 | /// <param name="param">Parameters sent</param> | 487 | /// <param name="param">Parameters sent</param> |
488 | /// <returns>Success "OK" else error</returns> | 488 | /// <returns>Success "OK" else error</returns> |
489 | public string RestDeleteUserSessionMethod(string request, string path, string param) | 489 | public string RestDeleteUserSessionMethod(string request, string path, string param) |
490 | { | 490 | { |
491 | // TODO! Important! | 491 | // TODO! Important! |
492 | 492 | ||
493 | return "OK"; | 493 | return "OK"; |
494 | } | 494 | } |
495 | 495 | ||
496 | /// <summary> | 496 | /// <summary> |
497 | /// | 497 | /// |
498 | /// </summary> | 498 | /// </summary> |
499 | /// <param name="user"></param> | 499 | /// <param name="user"></param> |
500 | public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) | 500 | public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) |
501 | { | 501 | { |
502 | UserProfileData user = new UserProfileData(); | 502 | UserProfileData user = new UserProfileData(); |
503 | user.homeLocation = new LLVector3(128, 128, 100); | 503 | user.homeLocation = new LLVector3(128, 128, 100); |
504 | user.UUID = LLUUID.Random(); | 504 | user.UUID = LLUUID.Random(); |
505 | user.username = firstName; | 505 | user.username = firstName; |
506 | user.surname = lastName; | 506 | user.surname = lastName; |
507 | user.passwordHash = pass; | 507 | user.passwordHash = pass; |
508 | user.passwordSalt = ""; | 508 | user.passwordSalt = ""; |
509 | user.created = Util.UnixTimeSinceEpoch(); | 509 | user.created = Util.UnixTimeSinceEpoch(); |
510 | user.homeLookAt = new LLVector3(100, 100, 100); | 510 | user.homeLookAt = new LLVector3(100, 100, 100); |
511 | user.homeRegion = Util.UIntsToLong((regX * 256), (regY * 256)); | 511 | user.homeRegion = Util.UIntsToLong((regX * 256), (regY * 256)); |
512 | 512 | ||
513 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 513 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
514 | { | 514 | { |
515 | try | 515 | try |
516 | { | 516 | { |
517 | plugin.Value.addNewUserProfile(user); | 517 | plugin.Value.addNewUserProfile(user); |
518 | 518 | ||
519 | } | 519 | } |
520 | catch (Exception e) | 520 | catch (Exception e) |
521 | { | 521 | { |
522 | MainLog.Instance.Verbose("Unable to add user via " + plugin.Key + "(" + e.ToString() + ")"); | 522 | MainLog.Instance.Verbose("Unable to add user via " + plugin.Key + "(" + e.ToString() + ")"); |
523 | } | 523 | } |
524 | } | 524 | } |
525 | } | 525 | } |
526 | 526 | ||
527 | /// <summary> | 527 | /// <summary> |
528 | /// Returns an error message that the user could not be found in the database | 528 | /// Returns an error message that the user could not be found in the database |
529 | /// </summary> | 529 | /// </summary> |
530 | /// <returns>XML string consisting of a error element containing individual error(s)</returns> | 530 | /// <returns>XML string consisting of a error element containing individual error(s)</returns> |
531 | public XmlRpcResponse CreateUnknownUserErrorResponse() | 531 | public XmlRpcResponse CreateUnknownUserErrorResponse() |
532 | { | 532 | { |
533 | XmlRpcResponse response = new XmlRpcResponse(); | 533 | XmlRpcResponse response = new XmlRpcResponse(); |
534 | Hashtable responseData = new Hashtable(); | 534 | Hashtable responseData = new Hashtable(); |
535 | responseData["error_type"] = "unknown_user"; | 535 | responseData["error_type"] = "unknown_user"; |
536 | responseData["error_desc"] = "The user requested is not in the database"; | 536 | responseData["error_desc"] = "The user requested is not in the database"; |
537 | 537 | ||
538 | response.Value = responseData; | 538 | response.Value = responseData; |
539 | return response; | 539 | return response; |
540 | } | 540 | } |
541 | 541 | ||
542 | /// <summary> | 542 | /// <summary> |
543 | /// Converts a user profile to an XML element which can be returned | 543 | /// Converts a user profile to an XML element which can be returned |
544 | /// </summary> | 544 | /// </summary> |
545 | /// <param name="profile">The user profile</param> | 545 | /// <param name="profile">The user profile</param> |
546 | /// <returns>A string containing an XML Document of the user profile</returns> | 546 | /// <returns>A string containing an XML Document of the user profile</returns> |
547 | public XmlRpcResponse ProfileToXmlRPCResponse(UserProfileData profile) | 547 | public XmlRpcResponse ProfileToXmlRPCResponse(UserProfileData profile) |
548 | { | 548 | { |
549 | XmlRpcResponse response = new XmlRpcResponse(); | 549 | XmlRpcResponse response = new XmlRpcResponse(); |
550 | Hashtable responseData = new Hashtable(); | 550 | Hashtable responseData = new Hashtable(); |
551 | 551 | ||
552 | // Account information | 552 | // Account information |
553 | responseData["firstname"] = profile.username; | 553 | responseData["firstname"] = profile.username; |
554 | responseData["lastname"] = profile.surname; | 554 | responseData["lastname"] = profile.surname; |
555 | responseData["uuid"] = profile.UUID.ToStringHyphenated(); | 555 | responseData["uuid"] = profile.UUID.ToStringHyphenated(); |
556 | // Server Information | 556 | // Server Information |
557 | responseData["server_inventory"] = profile.userInventoryURI; | 557 | responseData["server_inventory"] = profile.userInventoryURI; |
558 | responseData["server_asset"] = profile.userAssetURI; | 558 | responseData["server_asset"] = profile.userAssetURI; |
559 | // Profile Information | 559 | // Profile Information |
560 | responseData["profile_about"] = profile.profileAboutText; | 560 | responseData["profile_about"] = profile.profileAboutText; |
561 | responseData["profile_firstlife_about"] = profile.profileFirstText; | 561 | responseData["profile_firstlife_about"] = profile.profileFirstText; |
562 | responseData["profile_firstlife_image"] = profile.profileFirstImage.ToStringHyphenated(); | 562 | responseData["profile_firstlife_image"] = profile.profileFirstImage.ToStringHyphenated(); |
563 | responseData["profile_can_do"] = profile.profileCanDoMask.ToString(); | 563 | responseData["profile_can_do"] = profile.profileCanDoMask.ToString(); |
564 | responseData["profile_want_do"] = profile.profileWantDoMask.ToString(); | 564 | responseData["profile_want_do"] = profile.profileWantDoMask.ToString(); |
565 | responseData["profile_image"] = profile.profileImage.ToStringHyphenated(); | 565 | responseData["profile_image"] = profile.profileImage.ToStringHyphenated(); |
566 | responseData["profile_created"] = profile.created.ToString(); | 566 | responseData["profile_created"] = profile.created.ToString(); |
567 | responseData["profile_lastlogin"] = profile.lastLogin.ToString(); | 567 | responseData["profile_lastlogin"] = profile.lastLogin.ToString(); |
568 | // Home region information | 568 | // Home region information |
569 | responseData["home_coordinates_x"] = profile.homeLocation.X.ToString(); | 569 | responseData["home_coordinates_x"] = profile.homeLocation.X.ToString(); |
570 | responseData["home_coordinates_y"] = profile.homeLocation.Y.ToString(); | 570 | responseData["home_coordinates_y"] = profile.homeLocation.Y.ToString(); |
571 | responseData["home_coordinates_z"] = profile.homeLocation.Z.ToString(); | 571 | responseData["home_coordinates_z"] = profile.homeLocation.Z.ToString(); |
572 | 572 | ||
573 | responseData["home_region"] = profile.homeRegion.ToString(); | 573 | responseData["home_region"] = profile.homeRegion.ToString(); |
574 | 574 | ||
575 | responseData["home_look_x"] = profile.homeLookAt.X.ToString(); | 575 | responseData["home_look_x"] = profile.homeLookAt.X.ToString(); |
576 | responseData["home_look_y"] = profile.homeLookAt.Y.ToString(); | 576 | responseData["home_look_y"] = profile.homeLookAt.Y.ToString(); |
577 | responseData["home_look_z"] = profile.homeLookAt.Z.ToString(); | 577 | responseData["home_look_z"] = profile.homeLookAt.Z.ToString(); |
578 | response.Value = responseData; | 578 | response.Value = responseData; |
579 | 579 | ||
580 | return response; | 580 | return response; |
581 | } | 581 | } |
582 | 582 | ||
583 | #region XMLRPC User Methods | 583 | #region XMLRPC User Methods |
584 | //should most likely move out of here and into the grid's userserver sub class | 584 | //should most likely move out of here and into the grid's userserver sub class |
585 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) | 585 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) |
586 | { | 586 | { |
587 | XmlRpcResponse response = new XmlRpcResponse(); | 587 | XmlRpcResponse response = new XmlRpcResponse(); |
588 | Hashtable requestData = (Hashtable)request.Params[0]; | 588 | Hashtable requestData = (Hashtable)request.Params[0]; |
589 | UserProfileData userProfile; | 589 | UserProfileData userProfile; |
590 | if (requestData.Contains("avatar_name")) | 590 | if (requestData.Contains("avatar_name")) |
591 | { | 591 | { |
592 | userProfile = getUserProfile((string)requestData["avatar_name"]); | 592 | userProfile = getUserProfile((string)requestData["avatar_name"]); |
593 | if (userProfile == null) | 593 | if (userProfile == null) |
594 | { | 594 | { |
595 | return CreateUnknownUserErrorResponse(); | 595 | return CreateUnknownUserErrorResponse(); |
596 | } | 596 | } |
597 | } | 597 | } |
598 | else | 598 | else |
599 | { | 599 | { |
600 | return CreateUnknownUserErrorResponse(); | 600 | return CreateUnknownUserErrorResponse(); |
601 | } | 601 | } |
602 | 602 | ||
603 | return ProfileToXmlRPCResponse(userProfile); | 603 | return ProfileToXmlRPCResponse(userProfile); |
604 | } | 604 | } |
605 | 605 | ||
606 | public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request) | 606 | public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request) |
607 | { | 607 | { |
608 | XmlRpcResponse response = new XmlRpcResponse(); | 608 | XmlRpcResponse response = new XmlRpcResponse(); |
609 | Hashtable requestData = (Hashtable)request.Params[0]; | 609 | Hashtable requestData = (Hashtable)request.Params[0]; |
610 | UserProfileData userProfile; | 610 | UserProfileData userProfile; |
611 | System.Console.WriteLine("METHOD BY UUID CALLED"); | 611 | System.Console.WriteLine("METHOD BY UUID CALLED"); |
612 | if (requestData.Contains("avatar_uuid")) | 612 | if (requestData.Contains("avatar_uuid")) |
613 | { | 613 | { |
614 | userProfile = getUserProfile((LLUUID)requestData["avatar_uuid"]); | 614 | userProfile = getUserProfile((LLUUID)requestData["avatar_uuid"]); |
615 | if (userProfile == null) | 615 | if (userProfile == null) |
616 | { | 616 | { |
617 | return CreateUnknownUserErrorResponse(); | 617 | return CreateUnknownUserErrorResponse(); |
618 | } | 618 | } |
619 | } | 619 | } |
620 | else | 620 | else |
621 | { | 621 | { |
622 | return CreateUnknownUserErrorResponse(); | 622 | return CreateUnknownUserErrorResponse(); |
623 | } | 623 | } |
624 | 624 | ||
625 | 625 | ||
626 | return ProfileToXmlRPCResponse(userProfile); | 626 | return ProfileToXmlRPCResponse(userProfile); |
627 | } | 627 | } |
628 | #endregion | 628 | #endregion |
629 | 629 | ||
630 | } | 630 | } |
631 | } | 631 | } |