diff options
author | Diva Canto | 2010-01-10 20:29:09 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-10 20:29:09 -0800 |
commit | dc4bbf6065ad4cb914c9d44f2e6496a2e3d99814 (patch) | |
tree | f4cf3aa9f25ca879b87e14941ca4c19197e7c942 /OpenSim/Framework/Communications/Services/LoginResponse.cs | |
parent | All grid servers deleted, including user server. They served us well. (diff) | |
download | opensim-SC_OLD-dc4bbf6065ad4cb914c9d44f2e6496a2e3d99814.zip opensim-SC_OLD-dc4bbf6065ad4cb914c9d44f2e6496a2e3d99814.tar.gz opensim-SC_OLD-dc4bbf6065ad4cb914c9d44f2e6496a2e3d99814.tar.bz2 opensim-SC_OLD-dc4bbf6065ad4cb914c9d44f2e6496a2e3d99814.tar.xz |
All Framework.Communications.Clients and Framework.Communications.Services deleted, including old LoginService.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Communications/Services/LoginResponse.cs | 823 |
1 files changed, 0 insertions, 823 deletions
diff --git a/OpenSim/Framework/Communications/Services/LoginResponse.cs b/OpenSim/Framework/Communications/Services/LoginResponse.cs deleted file mode 100644 index ec5f428..0000000 --- a/OpenSim/Framework/Communications/Services/LoginResponse.cs +++ /dev/null | |||
@@ -1,823 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | using Nwc.XmlRpc; | ||
34 | using OpenMetaverse; | ||
35 | using OpenMetaverse.StructuredData; | ||
36 | |||
37 | namespace OpenSim.Framework.Communications.Services | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// A temp class to handle login response. | ||
41 | /// Should make use of UserProfileManager where possible. | ||
42 | /// </summary> | ||
43 | public class LoginResponse | ||
44 | { | ||
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
47 | private Hashtable loginFlagsHash; | ||
48 | private Hashtable globalTexturesHash; | ||
49 | private Hashtable loginError; | ||
50 | private Hashtable uiConfigHash; | ||
51 | |||
52 | private ArrayList loginFlags; | ||
53 | private ArrayList globalTextures; | ||
54 | private ArrayList eventCategories; | ||
55 | private ArrayList uiConfig; | ||
56 | private ArrayList classifiedCategories; | ||
57 | private ArrayList inventoryRoot; | ||
58 | private ArrayList initialOutfit; | ||
59 | private ArrayList agentInventory; | ||
60 | private ArrayList inventoryLibraryOwner; | ||
61 | private ArrayList inventoryLibRoot; | ||
62 | private ArrayList inventoryLibrary; | ||
63 | private ArrayList activeGestures; | ||
64 | |||
65 | private UserInfo userProfile; | ||
66 | |||
67 | private UUID agentID; | ||
68 | private UUID sessionID; | ||
69 | private UUID secureSessionID; | ||
70 | |||
71 | // Login Flags | ||
72 | private string dst; | ||
73 | private string stipendSinceLogin; | ||
74 | private string gendered; | ||
75 | private string everLoggedIn; | ||
76 | private string login; | ||
77 | private uint simPort; | ||
78 | private uint simHttpPort; | ||
79 | private string simAddress; | ||
80 | private string agentAccess; | ||
81 | private string agentAccessMax; | ||
82 | private Int32 circuitCode; | ||
83 | private uint regionX; | ||
84 | private uint regionY; | ||
85 | |||
86 | // Login | ||
87 | private string firstname; | ||
88 | private string lastname; | ||
89 | |||
90 | // Global Textures | ||
91 | private string sunTexture; | ||
92 | private string cloudTexture; | ||
93 | private string moonTexture; | ||
94 | |||
95 | // Error Flags | ||
96 | private string errorReason; | ||
97 | private string errorMessage; | ||
98 | |||
99 | // Response | ||
100 | private XmlRpcResponse xmlRpcResponse; | ||
101 | // private XmlRpcResponse defaultXmlRpcResponse; | ||
102 | |||
103 | private string welcomeMessage; | ||
104 | private string startLocation; | ||
105 | private string allowFirstLife; | ||
106 | private string home; | ||
107 | private string seedCapability; | ||
108 | private string lookAt; | ||
109 | |||
110 | private BuddyList m_buddyList = null; | ||
111 | |||
112 | public LoginResponse() | ||
113 | { | ||
114 | loginFlags = new ArrayList(); | ||
115 | globalTextures = new ArrayList(); | ||
116 | eventCategories = new ArrayList(); | ||
117 | uiConfig = new ArrayList(); | ||
118 | classifiedCategories = new ArrayList(); | ||
119 | |||
120 | loginError = new Hashtable(); | ||
121 | uiConfigHash = new Hashtable(); | ||
122 | |||
123 | // defaultXmlRpcResponse = new XmlRpcResponse(); | ||
124 | userProfile = new UserInfo(); | ||
125 | inventoryRoot = new ArrayList(); | ||
126 | initialOutfit = new ArrayList(); | ||
127 | agentInventory = new ArrayList(); | ||
128 | inventoryLibrary = new ArrayList(); | ||
129 | inventoryLibraryOwner = new ArrayList(); | ||
130 | activeGestures = new ArrayList(); | ||
131 | |||
132 | xmlRpcResponse = new XmlRpcResponse(); | ||
133 | // defaultXmlRpcResponse = new XmlRpcResponse(); | ||
134 | |||
135 | SetDefaultValues(); | ||
136 | } | ||
137 | |||
138 | private void SetDefaultValues() | ||
139 | { | ||
140 | DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; | ||
141 | StipendSinceLogin = "N"; | ||
142 | Gendered = "Y"; | ||
143 | EverLoggedIn = "Y"; | ||
144 | login = "false"; | ||
145 | firstname = "Test"; | ||
146 | lastname = "User"; | ||
147 | agentAccess = "M"; | ||
148 | agentAccessMax = "A"; | ||
149 | startLocation = "last"; | ||
150 | allowFirstLife = "Y"; | ||
151 | |||
152 | SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; | ||
153 | CloudTexture = "dc4b9f0b-d008-45c6-96a4-01dd947ac621"; | ||
154 | MoonTexture = "ec4b9f0b-d008-45c6-96a4-01dd947ac621"; | ||
155 | |||
156 | ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; | ||
157 | ErrorReason = "key"; | ||
158 | welcomeMessage = "Welcome to OpenSim!"; | ||
159 | seedCapability = String.Empty; | ||
160 | home = "{'region_handle':[r" + (1000*Constants.RegionSize).ToString() + ",r" + (1000*Constants.RegionSize).ToString() + "], 'position':[r" + | ||
161 | userProfile.homepos.X.ToString() + ",r" + userProfile.homepos.Y.ToString() + ",r" + | ||
162 | userProfile.homepos.Z.ToString() + "], 'look_at':[r" + userProfile.homelookat.X.ToString() + ",r" + | ||
163 | userProfile.homelookat.Y.ToString() + ",r" + userProfile.homelookat.Z.ToString() + "]}"; | ||
164 | lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; | ||
165 | RegionX = (uint) 255232; | ||
166 | RegionY = (uint) 254976; | ||
167 | |||
168 | // Classifieds; | ||
169 | AddClassifiedCategory((Int32) 1, "Shopping"); | ||
170 | AddClassifiedCategory((Int32) 2, "Land Rental"); | ||
171 | AddClassifiedCategory((Int32) 3, "Property Rental"); | ||
172 | AddClassifiedCategory((Int32) 4, "Special Attraction"); | ||
173 | AddClassifiedCategory((Int32) 5, "New Products"); | ||
174 | AddClassifiedCategory((Int32) 6, "Employment"); | ||
175 | AddClassifiedCategory((Int32) 7, "Wanted"); | ||
176 | AddClassifiedCategory((Int32) 8, "Service"); | ||
177 | AddClassifiedCategory((Int32) 9, "Personal"); | ||
178 | |||
179 | SessionID = UUID.Random(); | ||
180 | SecureSessionID = UUID.Random(); | ||
181 | AgentID = UUID.Random(); | ||
182 | |||
183 | Hashtable InitialOutfitHash = new Hashtable(); | ||
184 | InitialOutfitHash["folder_name"] = "Nightclub Female"; | ||
185 | InitialOutfitHash["gender"] = "female"; | ||
186 | initialOutfit.Add(InitialOutfitHash); | ||
187 | } | ||
188 | |||
189 | #region Login Failure Methods | ||
190 | |||
191 | public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login) | ||
192 | { | ||
193 | // Overwrite any default values; | ||
194 | xmlRpcResponse = new XmlRpcResponse(); | ||
195 | |||
196 | // Ensure Login Failed message/reason; | ||
197 | ErrorMessage = message; | ||
198 | ErrorReason = reason; | ||
199 | |||
200 | loginError["reason"] = ErrorReason; | ||
201 | loginError["message"] = ErrorMessage; | ||
202 | loginError["login"] = login; | ||
203 | xmlRpcResponse.Value = loginError; | ||
204 | return (xmlRpcResponse); | ||
205 | } | ||
206 | |||
207 | public OSD GenerateFailureResponseLLSD(string reason, string message, string login) | ||
208 | { | ||
209 | OSDMap map = new OSDMap(); | ||
210 | |||
211 | // Ensure Login Failed message/reason; | ||
212 | ErrorMessage = message; | ||
213 | ErrorReason = reason; | ||
214 | |||
215 | map["reason"] = OSD.FromString(ErrorReason); | ||
216 | map["message"] = OSD.FromString(ErrorMessage); | ||
217 | map["login"] = OSD.FromString(login); | ||
218 | |||
219 | return map; | ||
220 | } | ||
221 | |||
222 | public XmlRpcResponse CreateFailedResponse() | ||
223 | { | ||
224 | return (CreateLoginFailedResponse()); | ||
225 | } | ||
226 | |||
227 | public OSD CreateFailedResponseLLSD() | ||
228 | { | ||
229 | return CreateLoginFailedResponseLLSD(); | ||
230 | } | ||
231 | |||
232 | public XmlRpcResponse CreateLoginFailedResponse() | ||
233 | { | ||
234 | return | ||
235 | (GenerateFailureResponse("key", | ||
236 | "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", | ||
237 | "false")); | ||
238 | } | ||
239 | |||
240 | public OSD CreateLoginFailedResponseLLSD() | ||
241 | { | ||
242 | return GenerateFailureResponseLLSD( | ||
243 | "key", | ||
244 | "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", | ||
245 | "false"); | ||
246 | } | ||
247 | |||
248 | /// <summary> | ||
249 | /// Response to indicate that login failed because the agent's inventory was not available. | ||
250 | /// </summary> | ||
251 | /// <returns></returns> | ||
252 | public XmlRpcResponse CreateLoginInventoryFailedResponse() | ||
253 | { | ||
254 | return GenerateFailureResponse( | ||
255 | "key", | ||
256 | "The avatar inventory service is not responding. Please notify your login region operator.", | ||
257 | "false"); | ||
258 | } | ||
259 | |||
260 | public XmlRpcResponse CreateAlreadyLoggedInResponse() | ||
261 | { | ||
262 | return | ||
263 | (GenerateFailureResponse("presence", | ||
264 | "You appear to be already logged in. " + | ||
265 | "If this is not the case please wait for your session to timeout. " + | ||
266 | "If this takes longer than a few minutes please contact the grid owner. " + | ||
267 | "Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously.", | ||
268 | "false")); | ||
269 | } | ||
270 | |||
271 | public OSD CreateAlreadyLoggedInResponseLLSD() | ||
272 | { | ||
273 | return GenerateFailureResponseLLSD( | ||
274 | "presence", | ||
275 | "You appear to be already logged in. " + | ||
276 | "If this is not the case please wait for your session to timeout. " + | ||
277 | "If this takes longer than a few minutes please contact the grid owner", | ||
278 | "false"); | ||
279 | } | ||
280 | |||
281 | public XmlRpcResponse CreateLoginBlockedResponse() | ||
282 | { | ||
283 | return | ||
284 | (GenerateFailureResponse("presence", | ||
285 | "Logins are currently restricted. Please try again later", | ||
286 | "false")); | ||
287 | } | ||
288 | |||
289 | public OSD CreateLoginBlockedResponseLLSD() | ||
290 | { | ||
291 | return GenerateFailureResponseLLSD( | ||
292 | "presence", | ||
293 | "Logins are currently restricted. Please try again later", | ||
294 | "false"); | ||
295 | } | ||
296 | |||
297 | public XmlRpcResponse CreateDeadRegionResponse() | ||
298 | { | ||
299 | return | ||
300 | (GenerateFailureResponse("key", | ||
301 | "The region you are attempting to log into is not responding. Please select another region and try again.", | ||
302 | "false")); | ||
303 | } | ||
304 | |||
305 | public OSD CreateDeadRegionResponseLLSD() | ||
306 | { | ||
307 | return GenerateFailureResponseLLSD( | ||
308 | "key", | ||
309 | "The region you are attempting to log into is not responding. Please select another region and try again.", | ||
310 | "false"); | ||
311 | } | ||
312 | |||
313 | public XmlRpcResponse CreateGridErrorResponse() | ||
314 | { | ||
315 | return | ||
316 | (GenerateFailureResponse("key", | ||
317 | "Error connecting to grid. Could not percieve credentials from login XML.", | ||
318 | "false")); | ||
319 | } | ||
320 | |||
321 | public OSD CreateGridErrorResponseLLSD() | ||
322 | { | ||
323 | return GenerateFailureResponseLLSD( | ||
324 | "key", | ||
325 | "Error connecting to grid. Could not perceive credentials from login XML.", | ||
326 | "false"); | ||
327 | } | ||
328 | |||
329 | #endregion | ||
330 | |||
331 | public virtual XmlRpcResponse ToXmlRpcResponse() | ||
332 | { | ||
333 | try | ||
334 | { | ||
335 | Hashtable responseData = new Hashtable(); | ||
336 | |||
337 | loginFlagsHash = new Hashtable(); | ||
338 | loginFlagsHash["daylight_savings"] = DST; | ||
339 | loginFlagsHash["stipend_since_login"] = StipendSinceLogin; | ||
340 | loginFlagsHash["gendered"] = Gendered; | ||
341 | loginFlagsHash["ever_logged_in"] = EverLoggedIn; | ||
342 | loginFlags.Add(loginFlagsHash); | ||
343 | |||
344 | responseData["first_name"] = Firstname; | ||
345 | responseData["last_name"] = Lastname; | ||
346 | responseData["agent_access"] = agentAccess; | ||
347 | responseData["agent_access_max"] = agentAccessMax; | ||
348 | |||
349 | globalTexturesHash = new Hashtable(); | ||
350 | globalTexturesHash["sun_texture_id"] = SunTexture; | ||
351 | globalTexturesHash["cloud_texture_id"] = CloudTexture; | ||
352 | globalTexturesHash["moon_texture_id"] = MoonTexture; | ||
353 | globalTextures.Add(globalTexturesHash); | ||
354 | // this.eventCategories.Add(this.eventCategoriesHash); | ||
355 | |||
356 | AddToUIConfig("allow_first_life", allowFirstLife); | ||
357 | uiConfig.Add(uiConfigHash); | ||
358 | |||
359 | responseData["sim_port"] = (Int32) SimPort; | ||
360 | responseData["sim_ip"] = SimAddress; | ||
361 | responseData["http_port"] = (Int32)SimHttpPort; | ||
362 | |||
363 | responseData["agent_id"] = AgentID.ToString(); | ||
364 | responseData["session_id"] = SessionID.ToString(); | ||
365 | responseData["secure_session_id"] = SecureSessionID.ToString(); | ||
366 | responseData["circuit_code"] = CircuitCode; | ||
367 | responseData["seconds_since_epoch"] = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
368 | responseData["login-flags"] = loginFlags; | ||
369 | responseData["global-textures"] = globalTextures; | ||
370 | responseData["seed_capability"] = seedCapability; | ||
371 | |||
372 | responseData["event_categories"] = eventCategories; | ||
373 | responseData["event_notifications"] = new ArrayList(); // todo | ||
374 | responseData["classified_categories"] = classifiedCategories; | ||
375 | responseData["ui-config"] = uiConfig; | ||
376 | |||
377 | if (agentInventory != null) | ||
378 | { | ||
379 | responseData["inventory-skeleton"] = agentInventory; | ||
380 | responseData["inventory-root"] = inventoryRoot; | ||
381 | } | ||
382 | responseData["inventory-skel-lib"] = inventoryLibrary; | ||
383 | responseData["inventory-lib-root"] = inventoryLibRoot; | ||
384 | responseData["gestures"] = activeGestures; | ||
385 | responseData["inventory-lib-owner"] = inventoryLibraryOwner; | ||
386 | responseData["initial-outfit"] = initialOutfit; | ||
387 | responseData["start_location"] = startLocation; | ||
388 | responseData["seed_capability"] = seedCapability; | ||
389 | responseData["home"] = home; | ||
390 | responseData["look_at"] = lookAt; | ||
391 | responseData["message"] = welcomeMessage; | ||
392 | responseData["region_x"] = (Int32)(RegionX * Constants.RegionSize); | ||
393 | responseData["region_y"] = (Int32)(RegionY * Constants.RegionSize); | ||
394 | |||
395 | if (m_buddyList != null) | ||
396 | { | ||
397 | responseData["buddy-list"] = m_buddyList.ToArray(); | ||
398 | } | ||
399 | |||
400 | responseData["login"] = "true"; | ||
401 | xmlRpcResponse.Value = responseData; | ||
402 | |||
403 | return (xmlRpcResponse); | ||
404 | } | ||
405 | catch (Exception e) | ||
406 | { | ||
407 | m_log.Warn("[CLIENT]: LoginResponse: Error creating XML-RPC Response: " + e.Message); | ||
408 | |||
409 | return (GenerateFailureResponse("Internal Error", "Error generating Login Response", "false")); | ||
410 | } | ||
411 | } | ||
412 | |||
413 | public OSD ToLLSDResponse() | ||
414 | { | ||
415 | try | ||
416 | { | ||
417 | OSDMap map = new OSDMap(); | ||
418 | |||
419 | map["first_name"] = OSD.FromString(Firstname); | ||
420 | map["last_name"] = OSD.FromString(Lastname); | ||
421 | map["agent_access"] = OSD.FromString(agentAccess); | ||
422 | map["agent_access_max"] = OSD.FromString(agentAccessMax); | ||
423 | |||
424 | map["sim_port"] = OSD.FromInteger(SimPort); | ||
425 | map["sim_ip"] = OSD.FromString(SimAddress); | ||
426 | |||
427 | map["agent_id"] = OSD.FromUUID(AgentID); | ||
428 | map["session_id"] = OSD.FromUUID(SessionID); | ||
429 | map["secure_session_id"] = OSD.FromUUID(SecureSessionID); | ||
430 | map["circuit_code"] = OSD.FromInteger(CircuitCode); | ||
431 | map["seconds_since_epoch"] = OSD.FromInteger((int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds); | ||
432 | |||
433 | #region Login Flags | ||
434 | |||
435 | OSDMap loginFlagsLLSD = new OSDMap(); | ||
436 | loginFlagsLLSD["daylight_savings"] = OSD.FromString(DST); | ||
437 | loginFlagsLLSD["stipend_since_login"] = OSD.FromString(StipendSinceLogin); | ||
438 | loginFlagsLLSD["gendered"] = OSD.FromString(Gendered); | ||
439 | loginFlagsLLSD["ever_logged_in"] = OSD.FromString(EverLoggedIn); | ||
440 | map["login-flags"] = WrapOSDMap(loginFlagsLLSD); | ||
441 | |||
442 | #endregion Login Flags | ||
443 | |||
444 | #region Global Textures | ||
445 | |||
446 | OSDMap globalTexturesLLSD = new OSDMap(); | ||
447 | globalTexturesLLSD["sun_texture_id"] = OSD.FromString(SunTexture); | ||
448 | globalTexturesLLSD["cloud_texture_id"] = OSD.FromString(CloudTexture); | ||
449 | globalTexturesLLSD["moon_texture_id"] = OSD.FromString(MoonTexture); | ||
450 | |||
451 | map["global-textures"] = WrapOSDMap(globalTexturesLLSD); | ||
452 | |||
453 | #endregion Global Textures | ||
454 | |||
455 | map["seed_capability"] = OSD.FromString(seedCapability); | ||
456 | |||
457 | map["event_categories"] = ArrayListToOSDArray(eventCategories); | ||
458 | //map["event_notifications"] = new OSDArray(); // todo | ||
459 | map["classified_categories"] = ArrayListToOSDArray(classifiedCategories); | ||
460 | |||
461 | #region UI Config | ||
462 | |||
463 | OSDMap uiConfigLLSD = new OSDMap(); | ||
464 | uiConfigLLSD["allow_first_life"] = OSD.FromString(allowFirstLife); | ||
465 | map["ui-config"] = WrapOSDMap(uiConfigLLSD); | ||
466 | |||
467 | #endregion UI Config | ||
468 | |||
469 | #region Inventory | ||
470 | |||
471 | map["inventory-skeleton"] = ArrayListToOSDArray(agentInventory); | ||
472 | |||
473 | map["inventory-skel-lib"] = ArrayListToOSDArray(inventoryLibrary); | ||
474 | map["inventory-root"] = ArrayListToOSDArray(inventoryRoot); ; | ||
475 | map["inventory-lib-root"] = ArrayListToOSDArray(inventoryLibRoot); | ||
476 | map["inventory-lib-owner"] = ArrayListToOSDArray(inventoryLibraryOwner); | ||
477 | |||
478 | #endregion Inventory | ||
479 | |||
480 | map["gestures"] = ArrayListToOSDArray(activeGestures); | ||
481 | |||
482 | map["initial-outfit"] = ArrayListToOSDArray(initialOutfit); | ||
483 | map["start_location"] = OSD.FromString(startLocation); | ||
484 | |||
485 | map["seed_capability"] = OSD.FromString(seedCapability); | ||
486 | map["home"] = OSD.FromString(home); | ||
487 | map["look_at"] = OSD.FromString(lookAt); | ||
488 | map["message"] = OSD.FromString(welcomeMessage); | ||
489 | map["region_x"] = OSD.FromInteger(RegionX * Constants.RegionSize); | ||
490 | map["region_y"] = OSD.FromInteger(RegionY * Constants.RegionSize); | ||
491 | |||
492 | if (m_buddyList != null) | ||
493 | { | ||
494 | map["buddy-list"] = ArrayListToOSDArray(m_buddyList.ToArray()); | ||
495 | } | ||
496 | |||
497 | map["login"] = OSD.FromString("true"); | ||
498 | |||
499 | return map; | ||
500 | } | ||
501 | catch (Exception e) | ||
502 | { | ||
503 | m_log.Warn("[CLIENT]: LoginResponse: Error creating LLSD Response: " + e.Message); | ||
504 | |||
505 | return GenerateFailureResponseLLSD("Internal Error", "Error generating Login Response", "false"); | ||
506 | } | ||
507 | } | ||
508 | |||
509 | public OSDArray ArrayListToOSDArray(ArrayList arrlst) | ||
510 | { | ||
511 | OSDArray llsdBack = new OSDArray(); | ||
512 | foreach (Hashtable ht in arrlst) | ||
513 | { | ||
514 | OSDMap mp = new OSDMap(); | ||
515 | foreach (DictionaryEntry deHt in ht) | ||
516 | { | ||
517 | mp.Add((string)deHt.Key, OSDString.FromObject(deHt.Value)); | ||
518 | } | ||
519 | llsdBack.Add(mp); | ||
520 | } | ||
521 | return llsdBack; | ||
522 | } | ||
523 | |||
524 | private static OSDArray WrapOSDMap(OSDMap wrapMe) | ||
525 | { | ||
526 | OSDArray array = new OSDArray(); | ||
527 | array.Add(wrapMe); | ||
528 | return array; | ||
529 | } | ||
530 | |||
531 | public void SetEventCategories(string category, string value) | ||
532 | { | ||
533 | // this.eventCategoriesHash[category] = value; | ||
534 | //TODO | ||
535 | } | ||
536 | |||
537 | public void AddToUIConfig(string itemName, string item) | ||
538 | { | ||
539 | uiConfigHash[itemName] = item; | ||
540 | } | ||
541 | |||
542 | public void AddClassifiedCategory(Int32 ID, string categoryName) | ||
543 | { | ||
544 | Hashtable hash = new Hashtable(); | ||
545 | hash["category_name"] = categoryName; | ||
546 | hash["category_id"] = ID; | ||
547 | classifiedCategories.Add(hash); | ||
548 | // this.classifiedCategoriesHash.Clear(); | ||
549 | } | ||
550 | |||
551 | #region Properties | ||
552 | |||
553 | public string Login | ||
554 | { | ||
555 | get { return login; } | ||
556 | set { login = value; } | ||
557 | } | ||
558 | |||
559 | public string DST | ||
560 | { | ||
561 | get { return dst; } | ||
562 | set { dst = value; } | ||
563 | } | ||
564 | |||
565 | public string StipendSinceLogin | ||
566 | { | ||
567 | get { return stipendSinceLogin; } | ||
568 | set { stipendSinceLogin = value; } | ||
569 | } | ||
570 | |||
571 | public string Gendered | ||
572 | { | ||
573 | get { return gendered; } | ||
574 | set { gendered = value; } | ||
575 | } | ||
576 | |||
577 | public string EverLoggedIn | ||
578 | { | ||
579 | get { return everLoggedIn; } | ||
580 | set { everLoggedIn = value; } | ||
581 | } | ||
582 | |||
583 | public uint SimPort | ||
584 | { | ||
585 | get { return simPort; } | ||
586 | set { simPort = value; } | ||
587 | } | ||
588 | |||
589 | public uint SimHttpPort | ||
590 | { | ||
591 | get { return simHttpPort; } | ||
592 | set { simHttpPort = value; } | ||
593 | } | ||
594 | |||
595 | public string SimAddress | ||
596 | { | ||
597 | get { return simAddress; } | ||
598 | set { simAddress = value; } | ||
599 | } | ||
600 | |||
601 | public UUID AgentID | ||
602 | { | ||
603 | get { return agentID; } | ||
604 | set { agentID = value; } | ||
605 | } | ||
606 | |||
607 | public UUID SessionID | ||
608 | { | ||
609 | get { return sessionID; } | ||
610 | set { sessionID = value; } | ||
611 | } | ||
612 | |||
613 | public UUID SecureSessionID | ||
614 | { | ||
615 | get { return secureSessionID; } | ||
616 | set { secureSessionID = value; } | ||
617 | } | ||
618 | |||
619 | public Int32 CircuitCode | ||
620 | { | ||
621 | get { return circuitCode; } | ||
622 | set { circuitCode = value; } | ||
623 | } | ||
624 | |||
625 | public uint RegionX | ||
626 | { | ||
627 | get { return regionX; } | ||
628 | set { regionX = value; } | ||
629 | } | ||
630 | |||
631 | public uint RegionY | ||
632 | { | ||
633 | get { return regionY; } | ||
634 | set { regionY = value; } | ||
635 | } | ||
636 | |||
637 | public string SunTexture | ||
638 | { | ||
639 | get { return sunTexture; } | ||
640 | set { sunTexture = value; } | ||
641 | } | ||
642 | |||
643 | public string CloudTexture | ||
644 | { | ||
645 | get { return cloudTexture; } | ||
646 | set { cloudTexture = value; } | ||
647 | } | ||
648 | |||
649 | public string MoonTexture | ||
650 | { | ||
651 | get { return moonTexture; } | ||
652 | set { moonTexture = value; } | ||
653 | } | ||
654 | |||
655 | public string Firstname | ||
656 | { | ||
657 | get { return firstname; } | ||
658 | set { firstname = value; } | ||
659 | } | ||
660 | |||
661 | public string Lastname | ||
662 | { | ||
663 | get { return lastname; } | ||
664 | set { lastname = value; } | ||
665 | } | ||
666 | |||
667 | public string AgentAccess | ||
668 | { | ||
669 | get { return agentAccess; } | ||
670 | set { agentAccess = value; } | ||
671 | } | ||
672 | |||
673 | public string AgentAccessMax | ||
674 | { | ||
675 | get { return agentAccessMax; } | ||
676 | set { agentAccessMax = value; } | ||
677 | } | ||
678 | |||
679 | public string StartLocation | ||
680 | { | ||
681 | get { return startLocation; } | ||
682 | set { startLocation = value; } | ||
683 | } | ||
684 | |||
685 | public string LookAt | ||
686 | { | ||
687 | get { return lookAt; } | ||
688 | set { lookAt = value; } | ||
689 | } | ||
690 | |||
691 | public string SeedCapability | ||
692 | { | ||
693 | get { return seedCapability; } | ||
694 | set { seedCapability = value; } | ||
695 | } | ||
696 | |||
697 | public string ErrorReason | ||
698 | { | ||
699 | get { return errorReason; } | ||
700 | set { errorReason = value; } | ||
701 | } | ||
702 | |||
703 | public string ErrorMessage | ||
704 | { | ||
705 | get { return errorMessage; } | ||
706 | set { errorMessage = value; } | ||
707 | } | ||
708 | |||
709 | public ArrayList InventoryRoot | ||
710 | { | ||
711 | get { return inventoryRoot; } | ||
712 | set { inventoryRoot = value; } | ||
713 | } | ||
714 | |||
715 | public ArrayList InventorySkeleton | ||
716 | { | ||
717 | get { return agentInventory; } | ||
718 | set { agentInventory = value; } | ||
719 | } | ||
720 | |||
721 | public ArrayList InventoryLibrary | ||
722 | { | ||
723 | get { return inventoryLibrary; } | ||
724 | set { inventoryLibrary = value; } | ||
725 | } | ||
726 | |||
727 | public ArrayList InventoryLibraryOwner | ||
728 | { | ||
729 | get { return inventoryLibraryOwner; } | ||
730 | set { inventoryLibraryOwner = value; } | ||
731 | } | ||
732 | |||
733 | public ArrayList InventoryLibRoot | ||
734 | { | ||
735 | get { return inventoryLibRoot; } | ||
736 | set { inventoryLibRoot = value; } | ||
737 | } | ||
738 | |||
739 | public ArrayList ActiveGestures | ||
740 | { | ||
741 | get { return activeGestures; } | ||
742 | set { activeGestures = value; } | ||
743 | } | ||
744 | |||
745 | public string Home | ||
746 | { | ||
747 | get { return home; } | ||
748 | set { home = value; } | ||
749 | } | ||
750 | |||
751 | public string Message | ||
752 | { | ||
753 | get { return welcomeMessage; } | ||
754 | set { welcomeMessage = value; } | ||
755 | } | ||
756 | |||
757 | public BuddyList BuddList | ||
758 | { | ||
759 | get { return m_buddyList; } | ||
760 | set { m_buddyList = value; } | ||
761 | } | ||
762 | |||
763 | #endregion | ||
764 | |||
765 | public class UserInfo | ||
766 | { | ||
767 | public string firstname; | ||
768 | public string lastname; | ||
769 | public ulong homeregionhandle; | ||
770 | public Vector3 homepos; | ||
771 | public Vector3 homelookat; | ||
772 | } | ||
773 | |||
774 | public class BuddyList | ||
775 | { | ||
776 | public List<BuddyInfo> Buddies = new List<BuddyInfo>(); | ||
777 | |||
778 | public void AddNewBuddy(BuddyInfo buddy) | ||
779 | { | ||
780 | if (!Buddies.Contains(buddy)) | ||
781 | { | ||
782 | Buddies.Add(buddy); | ||
783 | } | ||
784 | } | ||
785 | |||
786 | public ArrayList ToArray() | ||
787 | { | ||
788 | ArrayList buddyArray = new ArrayList(); | ||
789 | foreach (BuddyInfo buddy in Buddies) | ||
790 | { | ||
791 | buddyArray.Add(buddy.ToHashTable()); | ||
792 | } | ||
793 | return buddyArray; | ||
794 | } | ||
795 | |||
796 | public class BuddyInfo | ||
797 | { | ||
798 | public int BuddyRightsHave = 1; | ||
799 | public int BuddyRightsGiven = 1; | ||
800 | public UUID BuddyID; | ||
801 | |||
802 | public BuddyInfo(string buddyID) | ||
803 | { | ||
804 | BuddyID = new UUID(buddyID); | ||
805 | } | ||
806 | |||
807 | public BuddyInfo(UUID buddyID) | ||
808 | { | ||
809 | BuddyID = buddyID; | ||
810 | } | ||
811 | |||
812 | public Hashtable ToHashTable() | ||
813 | { | ||
814 | Hashtable hTable = new Hashtable(); | ||
815 | hTable["buddy_rights_has"] = BuddyRightsHave; | ||
816 | hTable["buddy_rights_given"] = BuddyRightsGiven; | ||
817 | hTable["buddy_id"] = BuddyID.ToString(); | ||
818 | return hTable; | ||
819 | } | ||
820 | } | ||
821 | } | ||
822 | } | ||
823 | } | ||