aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/UserManager/LoginResponse.cs
diff options
context:
space:
mode:
authorlbsa712007-06-29 13:51:21 +0000
committerlbsa712007-06-29 13:51:21 +0000
commitf6deaf8a65693d022f58961a007f2492c9ac97fa (patch)
tree7428eccc93a3f64f46e08d7269bc337f3d26d8a8 /OpenSim/Framework/UserManager/LoginResponse.cs
parentDeleted some files that are no longer in use. (I am sure I deleted these yest... (diff)
parent*Hopefully fixed the empty dialog box error on client when logging in on sand... (diff)
downloadopensim-SC-f6deaf8a65693d022f58961a007f2492c9ac97fa.zip
opensim-SC-f6deaf8a65693d022f58961a007f2492c9ac97fa.tar.gz
opensim-SC-f6deaf8a65693d022f58961a007f2492c9ac97fa.tar.bz2
opensim-SC-f6deaf8a65693d022f58961a007f2492c9ac97fa.tar.xz
Switched in NameSpaceChanges
Diffstat (limited to 'OpenSim/Framework/UserManager/LoginResponse.cs')
-rw-r--r--OpenSim/Framework/UserManager/LoginResponse.cs646
1 files changed, 646 insertions, 0 deletions
diff --git a/OpenSim/Framework/UserManager/LoginResponse.cs b/OpenSim/Framework/UserManager/LoginResponse.cs
new file mode 100644
index 0000000..d1cd8cf
--- /dev/null
+++ b/OpenSim/Framework/UserManager/LoginResponse.cs
@@ -0,0 +1,646 @@
1using System;
2using System.Text;
3using System.Text.RegularExpressions;
4using System.Threading;
5using System.Collections;
6using System.Xml;
7using libsecondlife;
8using OpenSim.Framework.Utilities;
9using OpenSim.Framework.Interfaces;
10using Nwc.XmlRpc;
11
12namespace OpenSim.Framework.UserManagement
13{
14
15 /// <summary>
16 /// A temp class to handle login response.
17 /// Should make use of UserProfileManager where possible.
18 /// </summary>
19
20 public class LoginResponse
21 {
22 private Hashtable loginFlagsHash;
23 private Hashtable globalTexturesHash;
24 private Hashtable loginError;
25 private Hashtable eventCategoriesHash;
26 private Hashtable uiConfigHash;
27 private Hashtable classifiedCategoriesHash;
28
29 private ArrayList loginFlags;
30 private ArrayList globalTextures;
31 private ArrayList eventCategories;
32 private ArrayList uiConfig;
33 private ArrayList classifiedCategories;
34 private ArrayList inventoryRoot;
35 private ArrayList initialOutfit;
36 private ArrayList agentInventory;
37
38 private UserInfo userProfile;
39
40 private LLUUID agentID;
41 private LLUUID sessionID;
42 private LLUUID secureSessionID;
43
44 // Login Flags
45 private string dst;
46 private string stipendSinceLogin;
47 private string gendered;
48 private string everLoggedIn;
49 private string login;
50 private int simPort;
51 private string simAddress;
52 private string agentAccess;
53 private Int32 circuitCode;
54 private uint regionX;
55 private uint regionY;
56
57 // Login
58 private string firstname;
59 private string lastname;
60
61 // Global Textures
62 private string sunTexture;
63 private string cloudTexture;
64 private string moonTexture;
65
66 // Error Flags
67 private string errorReason;
68 private string errorMessage;
69
70 // Response
71 private XmlRpcResponse xmlRpcResponse;
72 private XmlRpcResponse defaultXmlRpcResponse;
73
74 private string welcomeMessage;
75 private string startLocation;
76 private string allowFirstLife;
77 private string home;
78 private string seedCapability;
79 private string lookAt;
80
81 public LoginResponse()
82 {
83 this.loginFlags = new ArrayList();
84 this.globalTextures = new ArrayList();
85 this.eventCategories = new ArrayList();
86 this.uiConfig = new ArrayList();
87 this.classifiedCategories = new ArrayList();
88
89 this.loginError = new Hashtable();
90 this.eventCategoriesHash = new Hashtable();
91 this.classifiedCategoriesHash = new Hashtable();
92 this.uiConfigHash = new Hashtable();
93
94 this.defaultXmlRpcResponse = new XmlRpcResponse();
95 this.userProfile = new UserInfo();
96 this.inventoryRoot = new ArrayList();
97 this.initialOutfit = new ArrayList();
98 this.agentInventory = new ArrayList();
99
100 this.xmlRpcResponse = new XmlRpcResponse();
101 this.defaultXmlRpcResponse = new XmlRpcResponse();
102
103 this.SetDefaultValues();
104 } // LoginServer
105
106 public void SetDefaultValues()
107 {
108 this.DST = "N";
109 this.StipendSinceLogin = "N";
110 this.Gendered = "Y";
111 this.EverLoggedIn = "Y";
112 this.login = "false";
113 this.firstname = "Test";
114 this.lastname = "User";
115 this.agentAccess = "M";
116 this.startLocation = "last";
117 this.allowFirstLife = "Y";
118
119 this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271";
120 this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
121 this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
122
123 this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock.";
124 this.ErrorReason = "key";
125 this.welcomeMessage = "Welcome to OpenSim!";
126 this.seedCapability = "";
127 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() + "]}";
128 this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
129 this.RegionX = (uint)255232;
130 this.RegionY = (uint)254976;
131
132 // Classifieds;
133 this.AddClassifiedCategory((Int32)1, "Shopping");
134 this.AddClassifiedCategory((Int32)2, "Land Rental");
135 this.AddClassifiedCategory((Int32)3, "Property Rental");
136 this.AddClassifiedCategory((Int32)4, "Special Attraction");
137 this.AddClassifiedCategory((Int32)5, "New Products");
138 this.AddClassifiedCategory((Int32)6, "Employment");
139 this.AddClassifiedCategory((Int32)7, "Wanted");
140 this.AddClassifiedCategory((Int32)8, "Service");
141 this.AddClassifiedCategory((Int32)9, "Personal");
142
143
144 this.SessionID = LLUUID.Random();
145 this.SecureSessionID = LLUUID.Random();
146 this.AgentID = LLUUID.Random();
147
148 Hashtable InitialOutfitHash = new Hashtable();
149 InitialOutfitHash["folder_name"] = "Nightclub Female";
150 InitialOutfitHash["gender"] = "female";
151 this.initialOutfit.Add(InitialOutfitHash);
152
153
154 } // SetDefaultValues
155
156 #region Login Failure Methods
157 public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login)
158 {
159 // Overwrite any default values;
160 this.xmlRpcResponse = new XmlRpcResponse();
161
162 // Ensure Login Failed message/reason;
163 this.ErrorMessage = message;
164 this.ErrorReason = reason;
165
166 this.loginError["reason"] = this.ErrorReason;
167 this.loginError["message"] = this.ErrorMessage;
168 this.loginError["login"] = login;
169 this.xmlRpcResponse.Value = this.loginError;
170 return (this.xmlRpcResponse);
171 } // GenerateResponse
172
173 public XmlRpcResponse CreateFailedResponse()
174 {
175 return (this.CreateLoginFailedResponse());
176 } // CreateErrorConnectingToGridResponse()
177
178 public XmlRpcResponse CreateLoginFailedResponse()
179 {
180 return (this.GenerateFailureResponse("key", "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", "false"));
181 } // LoginFailedResponse
182
183 public XmlRpcResponse CreateAlreadyLoggedInResponse()
184 {
185 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"));
186 } // CreateAlreadyLoggedInResponse()
187
188 public XmlRpcResponse CreateDeadRegionResponse()
189 {
190 return (this.GenerateFailureResponse("key", "The region you are attempting to log into is not responding. Please select another region and try again.", "false"));
191 }
192
193 public XmlRpcResponse CreateGridErrorResponse()
194 {
195 return (this.GenerateFailureResponse("key", "Error connecting to grid. Could not percieve credentials from login XML.", "false"));
196 }
197
198 #endregion
199
200 public XmlRpcResponse ToXmlRpcResponse()
201 {
202 try
203 {
204
205 Hashtable responseData = new Hashtable();
206
207 this.loginFlagsHash = new Hashtable();
208 this.loginFlagsHash["daylight_savings"] = this.DST;
209 this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin;
210 this.loginFlagsHash["gendered"] = this.Gendered;
211 this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn;
212 this.loginFlags.Add(this.loginFlagsHash);
213
214 responseData["first_name"] = this.Firstname;
215 responseData["last_name"] = this.Lastname;
216 responseData["agent_access"] = this.agentAccess;
217
218 this.globalTexturesHash = new Hashtable();
219 this.globalTexturesHash["sun_texture_id"] = this.SunTexture;
220 this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture;
221 this.globalTexturesHash["moon_texture_id"] = this.MoonTexture;
222 this.globalTextures.Add(this.globalTexturesHash);
223 this.eventCategories.Add(this.eventCategoriesHash);
224
225 this.AddToUIConfig("allow_first_life", this.allowFirstLife);
226 this.uiConfig.Add(this.uiConfigHash);
227
228 responseData["sim_port"] =(Int32) this.SimPort;
229 responseData["sim_ip"] = this.SimAddress;
230 Console.MainLog.Instance.Warn("SIM IP: " + responseData["sim_ip"] + "; SIM PORT: " + responseData["sim_port"]);
231 responseData["agent_id"] = this.AgentID.ToStringHyphenated();
232 responseData["session_id"] = this.SessionID.ToStringHyphenated();
233 responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated();
234 responseData["circuit_code"] = this.CircuitCode;
235 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
236 responseData["login-flags"] = this.loginFlags;
237 responseData["global-textures"] = this.globalTextures;
238 responseData["seed_capability"] = this.seedCapability;
239
240 responseData["event_categories"] = this.eventCategories;
241 responseData["event_notifications"] = new ArrayList(); // todo
242 responseData["classified_categories"] = this.classifiedCategories;
243 responseData["ui-config"] = this.uiConfig;
244
245 responseData["inventory-skeleton"] = this.agentInventory;
246 responseData["inventory-skel-lib"] = new ArrayList(); // todo
247 responseData["inventory-root"] = this.inventoryRoot;
248 responseData["gestures"] = new ArrayList(); // todo
249 responseData["inventory-lib-owner"] = new ArrayList(); // todo
250 responseData["initial-outfit"] = this.initialOutfit;
251 responseData["start_location"] = this.startLocation;
252 responseData["seed_capability"] = this.seedCapability;
253 responseData["home"] = this.home;
254 responseData["look_at"] = this.lookAt;
255 responseData["message"] = this.welcomeMessage;
256 responseData["region_x"] = (Int32)this.RegionX * 256;
257 responseData["region_y"] = (Int32)this.RegionY * 256;
258
259 //responseData["inventory-lib-root"] = new ArrayList(); // todo
260 //responseData["buddy-list"] = new ArrayList(); // todo
261
262 responseData["login"] = "true";
263 this.xmlRpcResponse.Value = responseData;
264
265 return (this.xmlRpcResponse);
266 }
267 catch (Exception e)
268 {
269 OpenSim.Framework.Console.MainLog.Instance.WriteLine(
270 OpenSim.Framework.Console.LogPriority.LOW,
271 "LoginResponse: Error creating XML-RPC Response: " + e.Message
272 );
273 return (this.GenerateFailureResponse("Internal Error", "Error generating Login Response", "false"));
274
275 }
276
277 } // ToXmlRpcResponse
278
279 public void SetEventCategories(string category, string value)
280 {
281 this.eventCategoriesHash[category] = value;
282 } // SetEventCategories
283
284 public void AddToUIConfig(string itemName, string item)
285 {
286 this.uiConfigHash[itemName] = item;
287 } // SetUIConfig
288
289 public void AddClassifiedCategory(Int32 ID, string categoryName)
290 {
291 this.classifiedCategoriesHash["category_name"] = categoryName;
292 this.classifiedCategoriesHash["category_id"] = ID;
293 this.classifiedCategories.Add(this.classifiedCategoriesHash);
294 // this.classifiedCategoriesHash.Clear();
295 } // SetClassifiedCategory
296
297 #region Properties
298 public string Login
299 {
300 get
301 {
302 return this.login;
303 }
304 set
305 {
306 this.login = value;
307 }
308 } // Login
309
310 public string DST
311 {
312 get
313 {
314 return this.dst;
315 }
316 set
317 {
318 this.dst = value;
319 }
320 } // DST
321
322 public string StipendSinceLogin
323 {
324 get
325 {
326 return this.stipendSinceLogin;
327 }
328 set
329 {
330 this.stipendSinceLogin = value;
331 }
332 } // StipendSinceLogin
333
334 public string Gendered
335 {
336 get
337 {
338 return this.gendered;
339 }
340 set
341 {
342 this.gendered = value;
343 }
344 } // Gendered
345
346 public string EverLoggedIn
347 {
348 get
349 {
350 return this.everLoggedIn;
351 }
352 set
353 {
354 this.everLoggedIn = value;
355 }
356 } // EverLoggedIn
357
358 public int SimPort
359 {
360 get
361 {
362 return this.simPort;
363 }
364 set
365 {
366 this.simPort = value;
367 }
368 } // SimPort
369
370 public string SimAddress
371 {
372 get
373 {
374 return this.simAddress;
375 }
376 set
377 {
378 this.simAddress = value;
379 }
380 } // SimAddress
381
382 public LLUUID AgentID
383 {
384 get
385 {
386 return this.agentID;
387 }
388 set
389 {
390 this.agentID = value;
391 }
392 } // AgentID
393
394 public LLUUID SessionID
395 {
396 get
397 {
398 return this.sessionID;
399 }
400 set
401 {
402 this.sessionID = value;
403 }
404 } // SessionID
405
406 public LLUUID SecureSessionID
407 {
408 get
409 {
410 return this.secureSessionID;
411 }
412 set
413 {
414 this.secureSessionID = value;
415 }
416 } // SecureSessionID
417
418 public Int32 CircuitCode
419 {
420 get
421 {
422 return this.circuitCode;
423 }
424 set
425 {
426 this.circuitCode = value;
427 }
428 } // CircuitCode
429
430 public uint RegionX
431 {
432 get
433 {
434 return this.regionX;
435 }
436 set
437 {
438 this.regionX = value;
439 }
440 } // RegionX
441
442 public uint RegionY
443 {
444 get
445 {
446 return this.regionY;
447 }
448 set
449 {
450 this.regionY = value;
451 }
452 } // RegionY
453
454 public string SunTexture
455 {
456 get
457 {
458 return this.sunTexture;
459 }
460 set
461 {
462 this.sunTexture = value;
463 }
464 } // SunTexture
465
466 public string CloudTexture
467 {
468 get
469 {
470 return this.cloudTexture;
471 }
472 set
473 {
474 this.cloudTexture = value;
475 }
476 } // CloudTexture
477
478 public string MoonTexture
479 {
480 get
481 {
482 return this.moonTexture;
483 }
484 set
485 {
486 this.moonTexture = value;
487 }
488 } // MoonTexture
489
490 public string Firstname
491 {
492 get
493 {
494 return this.firstname;
495 }
496 set
497 {
498 this.firstname = value;
499 }
500 } // Firstname
501
502 public string Lastname
503 {
504 get
505 {
506 return this.lastname;
507 }
508 set
509 {
510 this.lastname = value;
511 }
512 } // Lastname
513
514 public string AgentAccess
515 {
516 get
517 {
518 return this.agentAccess;
519 }
520 set
521 {
522 this.agentAccess = value;
523 }
524 }
525
526 public string StartLocation
527 {
528 get
529 {
530 return this.startLocation;
531 }
532 set
533 {
534 this.startLocation = value;
535 }
536 } // StartLocation
537
538 public string LookAt
539 {
540 get
541 {
542 return this.lookAt;
543 }
544 set
545 {
546 this.lookAt = value;
547 }
548 }
549
550 public string SeedCapability
551 {
552 get
553 {
554 return this.seedCapability;
555 }
556 set
557 {
558 this.seedCapability = value;
559 }
560 } // SeedCapability
561
562 public string ErrorReason
563 {
564 get
565 {
566 return this.errorReason;
567 }
568 set
569 {
570 this.errorReason = value;
571 }
572 } // ErrorReason
573
574 public string ErrorMessage
575 {
576 get
577 {
578 return this.errorMessage;
579 }
580 set
581 {
582 this.errorMessage = value;
583 }
584 } // ErrorMessage
585
586 public ArrayList InventoryRoot
587 {
588 get
589 {
590 return this.inventoryRoot;
591 }
592 set
593 {
594 this.inventoryRoot = value;
595 }
596 }
597
598 public ArrayList InventorySkeleton
599 {
600 get
601 {
602 return this.agentInventory;
603 }
604 set
605 {
606 this.agentInventory = value;
607 }
608 }
609
610 public string Home
611 {
612 get
613 {
614 return this.home;
615 }
616 set
617 {
618 this.home = value;
619 }
620 }
621
622 public string Message
623 {
624 get
625 {
626 return this.welcomeMessage;
627 }
628 set
629 {
630 this.welcomeMessage = value;
631 }
632 }
633 #endregion
634
635
636 public class UserInfo
637 {
638 public string firstname;
639 public string lastname;
640 public ulong homeregionhandle;
641 public LLVector3 homepos;
642 public LLVector3 homelookat;
643 }
644 }
645}
646