aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorandy2007-05-11 19:33:32 +0000
committerandy2007-05-11 19:33:32 +0000
commit3e5d95405746bf83f293da655882a25a365bfcd7 (patch)
tree15b96a23ce364703764f02405f2e1c35e3f8f65a
parentGuard against re-adding an existing folder. Seemed to happen on some timeout... (diff)
downloadopensim-SC_OLD-3e5d95405746bf83f293da655882a25a365bfcd7.zip
opensim-SC_OLD-3e5d95405746bf83f293da655882a25a365bfcd7.tar.gz
opensim-SC_OLD-3e5d95405746bf83f293da655882a25a365bfcd7.tar.bz2
opensim-SC_OLD-3e5d95405746bf83f293da655882a25a365bfcd7.tar.xz
Removed the login dat file.
Diffstat (limited to '')
-rw-r--r--OpenSim.Servers/LoginResponse.cs405
1 files changed, 326 insertions, 79 deletions
diff --git a/OpenSim.Servers/LoginResponse.cs b/OpenSim.Servers/LoginResponse.cs
index 5169231..9c5db6a 100644
--- a/OpenSim.Servers/LoginResponse.cs
+++ b/OpenSim.Servers/LoginResponse.cs
@@ -38,11 +38,13 @@ using System.Security.Cryptography;
38using System.Xml; 38using System.Xml;
39using libsecondlife; 39using libsecondlife;
40using OpenSim; 40using OpenSim;
41using OpenSim.Framework.Interfaces;
42using OpenSim.Framework.Grid;
43using OpenSim.Framework.Inventory;
44using OpenSim.Framework.User; 41using OpenSim.Framework.User;
42using OpenSim.Framework.Inventory;
45using OpenSim.Framework.Utilities; 43using OpenSim.Framework.Utilities;
44using OpenSim.Framework.Interfaces;
45
46// ?
47using OpenSim.Framework.Grid;
46 48
47namespace OpenSim.UserServer 49namespace OpenSim.UserServer
48{ 50{
@@ -56,9 +58,26 @@ namespace OpenSim.UserServer
56 private Hashtable loginFlagsHash; 58 private Hashtable loginFlagsHash;
57 private Hashtable globalTexturesHash; 59 private Hashtable globalTexturesHash;
58 private Hashtable loginError; 60 private Hashtable loginError;
61 private Hashtable eventCategoriesHash;
62 private Hashtable uiConfigHash;
63 private Hashtable classifiedCategoriesHash;
59 64
60 private ArrayList loginFlags; 65 private ArrayList loginFlags;
61 private ArrayList globalTextures; 66 private ArrayList globalTextures;
67 private ArrayList eventCategories;
68 private ArrayList uiConfig;
69 private ArrayList classifiedCategories;
70 private ArrayList inventoryRoot;
71 private ArrayList initialOutfit;
72 private ArrayList agentInventory;
73
74 private UserProfile userProfile;
75
76 private LLUUID agentID;
77 private LLUUID sessionID;
78 private LLUUID secureSessionID;
79 private LLUUID baseFolderID;
80 private LLUUID inventoryFolderID;
62 81
63 // Login Flags 82 // Login Flags
64 private string dst; 83 private string dst;
@@ -68,10 +87,14 @@ namespace OpenSim.UserServer
68 private string login; 87 private string login;
69 private string simPort; 88 private string simPort;
70 private string simAddress; 89 private string simAddress;
71 private string agentID; 90 private string agentAccess;
72 private string sessionID;
73 private string secureSessionID;
74 private Int32 circuitCode; 91 private Int32 circuitCode;
92 private uint regionX;
93 private uint regionY;
94
95 // Login
96 private string firstname;
97 private string lastname;
75 98
76 // Global Textures 99 // Global Textures
77 private string sunTexture; 100 private string sunTexture;
@@ -85,65 +108,115 @@ namespace OpenSim.UserServer
85 // Response 108 // Response
86 private XmlRpcResponse xmlRpcResponse; 109 private XmlRpcResponse xmlRpcResponse;
87 private XmlRpcResponse defaultXmlRpcResponse; 110 private XmlRpcResponse defaultXmlRpcResponse;
88 private string defaultTextResponse;
89 111
90 private uint regionX; 112 private string welcomeMessage;
91 private uint regionY; 113 private string startLocation;
114 private string allowFirstLife;
115 private string home;
116 private string seedCapability;
117 private string lookAt;
92 118
93 public LoginResponse(uint regX, uint regY) 119 public LoginResponse()
94 { 120 {
95 this.loginFlags = new ArrayList(); 121 this.loginFlags = new ArrayList();
96 this.globalTextures = new ArrayList(); 122 this.globalTextures = new ArrayList();
97 this.SetDefaultValues(); 123 this.eventCategories = new ArrayList();
98 regionX = regX; 124 this.uiConfig = new ArrayList();
99 regionY = regY; 125 this.classifiedCategories = new ArrayList();
100 } // LoginServer
101 126
102 // This will go away as we replace new-login.dat: 127 this.loginError = new Hashtable();
103 private void GetDefaultResponse() 128 this.eventCategoriesHash = new Hashtable();
104 { 129 this.classifiedCategoriesHash = new Hashtable();
105 try 130 this.uiConfigHash = new Hashtable();
106 {
107 // read in default response string
108 StreamReader SR;
109 string lines;
110 SR = File.OpenText("new-login.dat");
111 131
112 this.defaultTextResponse = ""; 132 this.defaultXmlRpcResponse = new XmlRpcResponse();
113 while (!SR.EndOfStream) 133 this.userProfile = new UserProfile();
114 { 134 this.inventoryRoot = new ArrayList();
115 lines = SR.ReadLine(); 135 this.initialOutfit = new ArrayList();
116 this.defaultTextResponse += lines; 136 this.agentInventory = new ArrayList();
117 }
118 SR.Close();
119 this.defaultXmlRpcResponse = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this.defaultTextResponse);
120 }
121 catch (Exception E)
122 {
123 Console.WriteLine(E.ToString());
124 }
125 } // GetDefaultResponse
126 137
127 public void SetDefaultValues() 138 this.xmlRpcResponse = new XmlRpcResponse();
128 { 139 this.defaultXmlRpcResponse = new XmlRpcResponse();
129 this.GetDefaultResponse();
130
131 this.DST = "N";
132 this.StipendSinceLogin = "N";
133 this.Gendered = "Y";
134 this.EverLoggedIn = "Y";
135 this.login = "false";
136 140
137 this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; 141 this.SetDefaultValues();
138 this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; 142 } // LoginServer
139 this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
140 143
141 this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; 144 public void SetDefaultValues()
142 this.ErrorReason = "key"; 145 {
146 this.DST = "N";
147 this.StipendSinceLogin = "N";
148 this.Gendered = "Y";
149 this.EverLoggedIn = "Y";
150 this.login = "false";
151 this.firstname = "Test";
152 this.lastname = "User";
153 this.agentAccess = "M";
154 this.startLocation = "last";
155 this.allowFirstLife = "Y";
156
157 this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271";
158 this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
159 this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
160
161 this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock.";
162 this.ErrorReason = "key";
163 this.welcomeMessage = "Welcome to OpenSim!";
164 this.seedCapability = "";
165 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() + "]}";
166 this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
167 this.RegionX = (uint)255232;
168 this.RegionY = (uint)254976;
169
170 // Classifieds;
171 this.AddClassifiedCategory((Int32)1, "Shopping");
172 this.AddClassifiedCategory((Int32)2, "Land Rental");
173 this.AddClassifiedCategory((Int32)3, "Property Rental");
174 this.AddClassifiedCategory((Int32)4, "Special Attraction");
175 this.AddClassifiedCategory((Int32)5, "New Products");
176 this.AddClassifiedCategory((Int32)6, "Employment");
177 this.AddClassifiedCategory((Int32)7, "Wanted");
178 this.AddClassifiedCategory((Int32)8, "Service");
179 this.AddClassifiedCategory((Int32)9, "Personal");
180
181 int SessionRand = Util.RandomClass.Next(1, 999);
182 this.SessionID = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
183 this.SecureSessionID = LLUUID.Random();
184
185 this.userProfile.Inventory.CreateRootFolder(this.userProfile.UUID, true);
186 Hashtable InventoryRootHash = new Hashtable();
187 InventoryRootHash["folder_id"] = this.userProfile.Inventory.InventoryRoot.FolderID.ToStringHyphenated();
188 this.inventoryRoot.Add(InventoryRootHash);
189
190 Hashtable TempHash;
191 foreach (InventoryFolder InvFolder in this.userProfile.Inventory.InventoryFolders.Values)
192 {
193 TempHash = new Hashtable();
194 TempHash["name"] = InvFolder.FolderName;
195 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
196 TempHash["version"] = (Int32)InvFolder.Version;
197 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
198 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
199 this.agentInventory.Add(TempHash);
200 }
201
202
203 Hashtable InitialOutfitHash = new Hashtable();
204 InitialOutfitHash["folder_name"] = "Nightclub Female";
205 InitialOutfitHash["gender"] = "female";
206 this.initialOutfit.Add(InitialOutfitHash);
143 207
144 } // SetDefaultValues 208 } // SetDefaultValues
145 209
146 private XmlRpcResponse GenerateResponse(string reason, string message, string login) 210 protected virtual LLUUID GetAgentId()
211 {
212 // todo
213 LLUUID Agent;
214 int AgentRand = Util.RandomClass.Next(1, 9999);
215 Agent = new LLUUID("99998888-0100-" + AgentRand.ToString("0000") + "-8ec1-0b1d5cd6aead");
216 return Agent;
217 } // GetAgentId
218
219 private XmlRpcResponse GenerateFailureResponse(string reason, string message, string login)
147 { 220 {
148 // Overwrite any default values; 221 // Overwrite any default values;
149 this.xmlRpcResponse = new XmlRpcResponse(); 222 this.xmlRpcResponse = new XmlRpcResponse();
@@ -152,7 +225,6 @@ namespace OpenSim.UserServer
152 this.ErrorMessage = message; 225 this.ErrorMessage = message;
153 this.ErrorReason = reason; 226 this.ErrorReason = reason;
154 227
155 this.loginError = new Hashtable();
156 this.loginError["reason"] = this.ErrorReason; 228 this.loginError["reason"] = this.ErrorReason;
157 this.loginError["message"] = this.ErrorMessage; 229 this.loginError["message"] = this.ErrorMessage;
158 this.loginError["login"] = login; 230 this.loginError["login"] = login;
@@ -162,7 +234,7 @@ namespace OpenSim.UserServer
162 234
163 public XmlRpcResponse LoginFailedResponse() 235 public XmlRpcResponse LoginFailedResponse()
164 { 236 {
165 return (this.GenerateResponse("key", "You have entered an invalid name/password combination. Check Caps/lock.", "false")); 237 return (this.GenerateFailureResponse("key", "You have entered an invalid name/password combination. Check Caps/lock.", "false"));
166 } // LoginFailedResponse 238 } // LoginFailedResponse
167 239
168 public XmlRpcResponse ConnectionFailedResponse() 240 public XmlRpcResponse ConnectionFailedResponse()
@@ -172,43 +244,98 @@ namespace OpenSim.UserServer
172 244
173 public XmlRpcResponse CreateAlreadyLoggedInResponse() 245 public XmlRpcResponse CreateAlreadyLoggedInResponse()
174 { 246 {
175 return(this.GenerateResponse("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")); 247 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"));
176 } // CreateAlreadyLoggedInResponse() 248 } // CreateAlreadyLoggedInResponse()
177 249
178 public XmlRpcResponse ToXmlRpcResponse() 250 public XmlRpcResponse ToXmlRpcResponse()
179 { 251 {
180 this.xmlRpcResponse = this.defaultXmlRpcResponse; 252 Hashtable responseData = new Hashtable();
181 Hashtable responseData = (Hashtable)this.xmlRpcResponse.Value;
182 253
183 this.loginFlagsHash = new Hashtable(); 254 this.loginFlagsHash = new Hashtable();
184 this.loginFlagsHash["daylight_savings"] = this.DST; 255 this.loginFlagsHash["daylight_savings"] = this.DST;
185 this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin; 256 this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin;
186 this.loginFlagsHash["gendered"] = this.Gendered; 257 this.loginFlagsHash["gendered"] = this.Gendered;
187 this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn; 258 this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn;
188 this.loginFlags.Add(this.loginFlagsHash); 259 this.loginFlags.Add(this.loginFlagsHash);
189 260
261 responseData["first_name"] = this.Firstname;
262 responseData["last_name"] = this.Lastname;
263 responseData["agent_access"] = this.agentAccess;
264
190 this.globalTexturesHash = new Hashtable(); 265 this.globalTexturesHash = new Hashtable();
191 this.globalTexturesHash["sun_texture_id"] = this.SunTexture; 266 this.globalTexturesHash["sun_texture_id"] = this.SunTexture;
192 this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture; 267 this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture;
193 this.globalTexturesHash["moon_texture_id"] = this.MoonTexture; 268 this.globalTexturesHash["moon_texture_id"] = this.MoonTexture;
194 this.globalTextures.Add(this.globalTexturesHash); 269 this.globalTextures.Add(this.globalTexturesHash);
195 270 this.eventCategories.Add(this.eventCategoriesHash);
196 responseData["sim_port"] = Int32.Parse(this.SimPort); 271
197 responseData["sim_ip"] = this.SimAddress; 272 this.AddToUIConfig("allow_first_life", this.allowFirstLife);
198 responseData["agent_id"] = this.AgentID; 273 this.uiConfig.Add(this.uiConfigHash);
199 responseData["session_id"] = this.SessionID; 274
200 responseData["secure_session_id"] = this.SecureSessionID; 275 // Create a agent and session LLUUID
201 responseData["circuit_code"] = this.CircuitCode; 276 this.agentID = this.GetAgentId();
202 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 277
203 responseData["login-flags"] = this.loginFlags; 278 responseData["sim_port"] = this.SimPort;
204 responseData["global-textures"] = this.globalTextures; 279 responseData["sim_ip"] = this.SimAddress;
205 responseData["region_y"] = (Int32)regionY * 256; 280 responseData["agent_id"] = this.AgentID.ToStringHyphenated();
206 responseData["region_x"] = (Int32)regionX * 256; 281 responseData["session_id"] = this.SessionID.ToStringHyphenated();
282 responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated();
283 responseData["circuit_code"] = this.CircuitCode;
284 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
285 responseData["login-flags"] = this.loginFlags;
286 responseData["global-textures"] = this.globalTextures;
287 responseData["seed_capability"] = this.seedCapability;
288
289 responseData["event_categories"] = this.eventCategories;
290 responseData["event_notifications"] = new ArrayList(); // todo
291 responseData["classified_categories"] = this.classifiedCategories;
292 responseData["ui-config"] = this.uiConfig;
293
294 responseData["inventory-skeleton"] = this.agentInventory;
295 responseData["inventory-skel-lib"] = new ArrayList(); // todo
296 responseData["inventory-root"] = this.inventoryRoot;
297 responseData["gestures"] = new ArrayList(); // todo
298 responseData["inventory-lib-owner"] = new ArrayList(); // todo
299 responseData["initial-outfit"] = this.initialOutfit;
300 responseData["start_location"] = this.startLocation;
301 responseData["seed_capability"] = this.seedCapability;
302 responseData["home"] = this.home;
303 responseData["look_at"] = this.lookAt;
304 responseData["message"] = this.welcomeMessage;
305 responseData["region_x"] = this.regionX;
306 responseData["region_y"] = this.regionY;
307
308 responseData["login"] = "true";
309 this.xmlRpcResponse.Value = responseData;
310
311 // differential debuggery
312 // FileStream fs = new FileStream("loginresponse.xml", FileMode.OpenOrCreate);
313 // StreamWriter SW = new StreamWriter(fs);
314 // SW.Write(this.xmlRpcResponse.ToString());
315 // SW.Close();
207 316
208 return (this.xmlRpcResponse); 317 return (this.xmlRpcResponse);
209 318
210 } // ToXmlRpcResponse 319 } // ToXmlRpcResponse
211 320
321 public void SetEventCategories(string category, string value)
322 {
323 this.eventCategoriesHash[category] = value;
324 } // SetEventCategories
325
326 public void AddToUIConfig(string itemName, string item)
327 {
328 this.uiConfigHash[itemName] = item;
329 } // SetUIConfig
330
331 public void AddClassifiedCategory(Int32 ID, string categoryName)
332 {
333 this.classifiedCategoriesHash["category_name"] = categoryName;
334 this.classifiedCategoriesHash["category_id"] = ID;
335 this.classifiedCategories.Add(this.classifiedCategoriesHash);
336 // this.classifiedCategoriesHash.Clear();
337 } // SetClassifiedCategory
338
212 public string Login 339 public string Login
213 { 340 {
214 get 341 get
@@ -293,7 +420,7 @@ namespace OpenSim.UserServer
293 } 420 }
294 } // SimAddress 421 } // SimAddress
295 422
296 public string AgentID 423 public LLUUID AgentID
297 { 424 {
298 get 425 get
299 { 426 {
@@ -305,7 +432,7 @@ namespace OpenSim.UserServer
305 } 432 }
306 } // AgentID 433 } // AgentID
307 434
308 public string SessionID 435 public LLUUID SessionID
309 { 436 {
310 get 437 get
311 { 438 {
@@ -317,7 +444,7 @@ namespace OpenSim.UserServer
317 } 444 }
318 } // SessionID 445 } // SessionID
319 446
320 public string SecureSessionID 447 public LLUUID SecureSessionID
321 { 448 {
322 get 449 get
323 { 450 {
@@ -329,6 +456,30 @@ namespace OpenSim.UserServer
329 } 456 }
330 } // SecureSessionID 457 } // SecureSessionID
331 458
459 public LLUUID BaseFolderID
460 {
461 get
462 {
463 return this.baseFolderID;
464 }
465 set
466 {
467 this.baseFolderID = value;
468 }
469 } // BaseFolderID
470
471 public LLUUID InventoryFolderID
472 {
473 get
474 {
475 return this.inventoryFolderID;
476 }
477 set
478 {
479 this.inventoryFolderID = value;
480 }
481 } // InventoryFolderID
482
332 public Int32 CircuitCode 483 public Int32 CircuitCode
333 { 484 {
334 get 485 get
@@ -341,6 +492,30 @@ namespace OpenSim.UserServer
341 } 492 }
342 } // CircuitCode 493 } // CircuitCode
343 494
495 public uint RegionX
496 {
497 get
498 {
499 return this.regionX;
500 }
501 set
502 {
503 this.regionX = value;
504 }
505 } // RegionX
506
507 public uint RegionY
508 {
509 get
510 {
511 return this.regionY;
512 }
513 set
514 {
515 this.regionY = value;
516 }
517 } // RegionY
518
344 public string SunTexture 519 public string SunTexture
345 { 520 {
346 get 521 get
@@ -377,6 +552,78 @@ namespace OpenSim.UserServer
377 } 552 }
378 } // MoonTexture 553 } // MoonTexture
379 554
555 public string Firstname
556 {
557 get
558 {
559 return this.firstname;
560 }
561 set
562 {
563 this.firstname = value;
564 }
565 } // Firstname
566
567 public string Lastname
568 {
569 get
570 {
571 return this.lastname;
572 }
573 set
574 {
575 this.lastname = value;
576 }
577 } // Lastname
578
579 public string AgentAccess
580 {
581 get
582 {
583 return this.agentAccess;
584 }
585 set
586 {
587 this.agentAccess = value;
588 }
589 }
590
591 public string StartLocation
592 {
593 get
594 {
595 return this.startLocation;
596 }
597 set
598 {
599 this.startLocation = value;
600 }
601 } // StartLocation
602
603 public string LookAt
604 {
605 get
606 {
607 return this.lookAt;
608 }
609 set
610 {
611 this.lookAt = value;
612 }
613 }
614
615 public string SeedCapability
616 {
617 get
618 {
619 return this.seedCapability;
620 }
621 set
622 {
623 this.seedCapability = value;
624 }
625 } // SeedCapability
626
380 public string ErrorReason 627 public string ErrorReason
381 { 628 {
382 get 629 get