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