aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorandy2007-05-14 01:00:52 +0000
committerandy2007-05-14 01:00:52 +0000
commit6361bb7664ec4cf78430d2a8ec7856971ad411cd (patch)
tree66929b5436b354dc75b60f6a7e1496f8c3258351
parentsome more try/catch (diff)
downloadopensim-SC-6361bb7664ec4cf78430d2a8ec7856971ad411cd.zip
opensim-SC-6361bb7664ec4cf78430d2a8ec7856971ad411cd.tar.gz
opensim-SC-6361bb7664ec4cf78430d2a8ec7856971ad411cd.tar.bz2
opensim-SC-6361bb7664ec4cf78430d2a8ec7856971ad411cd.tar.xz
Added exception handling.
-rw-r--r--OpenSim.Servers/LoginResponse.cs266
1 files changed, 144 insertions, 122 deletions
diff --git a/OpenSim.Servers/LoginResponse.cs b/OpenSim.Servers/LoginResponse.cs
index ac4d2ab..7333d1f 100644
--- a/OpenSim.Servers/LoginResponse.cs
+++ b/OpenSim.Servers/LoginResponse.cs
@@ -143,69 +143,78 @@ namespace OpenSim.UserServer
143 143
144 public void SetDefaultValues() 144 public void SetDefaultValues()
145 { 145 {
146 this.DST = "N"; 146 try
147 this.StipendSinceLogin = "N"; 147 {
148 this.Gendered = "Y"; 148 this.DST = "N";
149 this.EverLoggedIn = "Y"; 149 this.StipendSinceLogin = "N";
150 this.login = "false"; 150 this.Gendered = "Y";
151 this.firstname = "Test"; 151 this.EverLoggedIn = "Y";
152 this.lastname = "User"; 152 this.login = "false";
153 this.agentAccess = "M"; 153 this.firstname = "Test";
154 this.startLocation = "last"; 154 this.lastname = "User";
155 this.allowFirstLife = "Y"; 155 this.agentAccess = "M";
156 156 this.startLocation = "last";
157 this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; 157 this.allowFirstLife = "Y";
158 this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; 158
159 this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; 159 this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271";
160 160 this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
161 this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; 161 this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
162 this.ErrorReason = "key"; 162
163 this.welcomeMessage = "Welcome to OpenSim!"; 163 this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock.";
164 this.seedCapability = ""; 164 this.ErrorReason = "key";
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() + "]}"; 165 this.welcomeMessage = "Welcome to OpenSim!";
166 this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; 166 this.seedCapability = "";
167 this.RegionX = (uint)255232; 167 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() + "]}";
168 this.RegionY = (uint)254976; 168 this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
169 169 this.RegionX = (uint)255232;
170 // Classifieds; 170 this.RegionY = (uint)254976;
171 this.AddClassifiedCategory((Int32)1, "Shopping"); 171
172 this.AddClassifiedCategory((Int32)2, "Land Rental"); 172 // Classifieds;
173 this.AddClassifiedCategory((Int32)3, "Property Rental"); 173 this.AddClassifiedCategory((Int32)1, "Shopping");
174 this.AddClassifiedCategory((Int32)4, "Special Attraction"); 174 this.AddClassifiedCategory((Int32)2, "Land Rental");
175 this.AddClassifiedCategory((Int32)5, "New Products"); 175 this.AddClassifiedCategory((Int32)3, "Property Rental");
176 this.AddClassifiedCategory((Int32)6, "Employment"); 176 this.AddClassifiedCategory((Int32)4, "Special Attraction");
177 this.AddClassifiedCategory((Int32)7, "Wanted"); 177 this.AddClassifiedCategory((Int32)5, "New Products");
178 this.AddClassifiedCategory((Int32)8, "Service"); 178 this.AddClassifiedCategory((Int32)6, "Employment");
179 this.AddClassifiedCategory((Int32)9, "Personal"); 179 this.AddClassifiedCategory((Int32)7, "Wanted");
180 180 this.AddClassifiedCategory((Int32)8, "Service");
181 int SessionRand = Util.RandomClass.Next(1, 999); 181 this.AddClassifiedCategory((Int32)9, "Personal");
182 this.SessionID = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797"); 182
183 this.SecureSessionID = LLUUID.Random(); 183 int SessionRand = Util.RandomClass.Next(1, 999);
184 184 this.SessionID = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
185 this.userProfile.Inventory.CreateRootFolder(this.userProfile.UUID, true); 185 this.SecureSessionID = LLUUID.Random();
186 this.baseFolderID = this.userProfile.Inventory.GetFolderID("Textures"); 186
187 this.inventoryFolderID = this.userProfile.Inventory.GetFolderID("My Inventory-"); 187 this.userProfile.Inventory.CreateRootFolder(this.userProfile.UUID, true);
188 Hashtable InventoryRootHash = new Hashtable(); 188 this.baseFolderID = this.userProfile.Inventory.GetFolderID("Textures");
189 InventoryRootHash["folder_id"] = this.userProfile.Inventory.InventoryRoot.FolderID.ToStringHyphenated(); 189 this.inventoryFolderID = this.userProfile.Inventory.GetFolderID("My Inventory-");
190 this.inventoryRoot.Add(InventoryRootHash); 190 Hashtable InventoryRootHash = new Hashtable();
191 191 InventoryRootHash["folder_id"] = this.userProfile.Inventory.InventoryRoot.FolderID.ToStringHyphenated();
192 Hashtable TempHash; 192 this.inventoryRoot.Add(InventoryRootHash);
193 foreach (InventoryFolder InvFolder in this.userProfile.Inventory.InventoryFolders.Values) 193
194 { 194 Hashtable TempHash;
195 TempHash = new Hashtable(); 195 foreach (InventoryFolder InvFolder in this.userProfile.Inventory.InventoryFolders.Values)
196 TempHash["name"] = InvFolder.FolderName; 196 {
197 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); 197 TempHash = new Hashtable();
198 TempHash["version"] = (Int32)InvFolder.Version; 198 TempHash["name"] = InvFolder.FolderName;
199 TempHash["type_default"] = (Int32)InvFolder.DefaultType; 199 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
200 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); 200 TempHash["version"] = (Int32)InvFolder.Version;
201 this.agentInventory.Add(TempHash); 201 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
202 } 202 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
203 203 this.agentInventory.Add(TempHash);
204 204 }
205 Hashtable InitialOutfitHash = new Hashtable(); 205
206 InitialOutfitHash["folder_name"] = "Nightclub Female"; 206 Hashtable InitialOutfitHash = new Hashtable();
207 InitialOutfitHash["gender"] = "female"; 207 InitialOutfitHash["folder_name"] = "Nightclub Female";
208 this.initialOutfit.Add(InitialOutfitHash); 208 InitialOutfitHash["gender"] = "female";
209 this.initialOutfit.Add(InitialOutfitHash);
210 }
211 catch (Exception e)
212 {
213 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(
214 OpenSim.Framework.Console.LogPriority.LOW,
215 "LoginResponse: Unable to set default values: " + e.Message
216 );
217 }
209 218
210 } // SetDefaultValues 219 } // SetDefaultValues
211 220
@@ -251,66 +260,79 @@ namespace OpenSim.UserServer
251 260
252 public XmlRpcResponse ToXmlRpcResponse() 261 public XmlRpcResponse ToXmlRpcResponse()
253 { 262 {
254 Hashtable responseData = new Hashtable(); 263 try
255 264 {
256 this.loginFlagsHash = new Hashtable(); 265
257 this.loginFlagsHash["daylight_savings"] = this.DST; 266 Hashtable responseData = new Hashtable();
258 this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin; 267
259 this.loginFlagsHash["gendered"] = this.Gendered; 268 this.loginFlagsHash = new Hashtable();
260 this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn; 269 this.loginFlagsHash["daylight_savings"] = this.DST;
261 this.loginFlags.Add(this.loginFlagsHash); 270 this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin;
262 271 this.loginFlagsHash["gendered"] = this.Gendered;
263 responseData["first_name"] = this.Firstname; 272 this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn;
264 responseData["last_name"] = this.Lastname; 273 this.loginFlags.Add(this.loginFlagsHash);
265 responseData["agent_access"] = this.agentAccess; 274
266 275 responseData["first_name"] = this.Firstname;
267 this.globalTexturesHash = new Hashtable(); 276 responseData["last_name"] = this.Lastname;
268 this.globalTexturesHash["sun_texture_id"] = this.SunTexture; 277 responseData["agent_access"] = this.agentAccess;
269 this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture; 278
270 this.globalTexturesHash["moon_texture_id"] = this.MoonTexture; 279 this.globalTexturesHash = new Hashtable();
271 this.globalTextures.Add(this.globalTexturesHash); 280 this.globalTexturesHash["sun_texture_id"] = this.SunTexture;
272 this.eventCategories.Add(this.eventCategoriesHash); 281 this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture;
273 282 this.globalTexturesHash["moon_texture_id"] = this.MoonTexture;
274 this.AddToUIConfig("allow_first_life", this.allowFirstLife); 283 this.globalTextures.Add(this.globalTexturesHash);
275 this.uiConfig.Add(this.uiConfigHash); 284 this.eventCategories.Add(this.eventCategoriesHash);
276 285
277 // Create a agent and session LLUUID 286 this.AddToUIConfig("allow_first_life", this.allowFirstLife);
278 this.agentID = this.GetAgentId(); 287 this.uiConfig.Add(this.uiConfigHash);
279 288
280 responseData["sim_port"] = this.SimPort; 289 // Create a agent and session LLUUID
281 responseData["sim_ip"] = this.SimAddress; 290 this.agentID = this.GetAgentId();
282 responseData["agent_id"] = this.AgentID.ToStringHyphenated(); 291
283 responseData["session_id"] = this.SessionID.ToStringHyphenated(); 292 responseData["sim_port"] = this.SimPort;
284 responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated(); 293 responseData["sim_ip"] = this.SimAddress;
285 responseData["circuit_code"] = this.CircuitCode; 294 responseData["agent_id"] = this.AgentID.ToStringHyphenated();
286 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 295 responseData["session_id"] = this.SessionID.ToStringHyphenated();
287 responseData["login-flags"] = this.loginFlags; 296 responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated();
288 responseData["global-textures"] = this.globalTextures; 297 responseData["circuit_code"] = this.CircuitCode;
289 responseData["seed_capability"] = this.seedCapability; 298 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
290 299 responseData["login-flags"] = this.loginFlags;
291 responseData["event_categories"] = this.eventCategories; 300 responseData["global-textures"] = this.globalTextures;
292 responseData["event_notifications"] = new ArrayList(); // todo 301 responseData["seed_capability"] = this.seedCapability;
293 responseData["classified_categories"] = this.classifiedCategories; 302
294 responseData["ui-config"] = this.uiConfig; 303 responseData["event_categories"] = this.eventCategories;
295 304 responseData["event_notifications"] = new ArrayList(); // todo
296 responseData["inventory-skeleton"] = this.agentInventory; 305 responseData["classified_categories"] = this.classifiedCategories;
297 responseData["inventory-skel-lib"] = new ArrayList(); // todo 306 responseData["ui-config"] = this.uiConfig;
298 responseData["inventory-root"] = this.inventoryRoot; 307
299 responseData["gestures"] = new ArrayList(); // todo 308 responseData["inventory-skeleton"] = this.agentInventory;
300 responseData["inventory-lib-owner"] = new ArrayList(); // todo 309 responseData["inventory-skel-lib"] = new ArrayList(); // todo
301 responseData["initial-outfit"] = this.initialOutfit; 310 responseData["inventory-root"] = this.inventoryRoot;
302 responseData["start_location"] = this.startLocation; 311 responseData["gestures"] = new ArrayList(); // todo
303 responseData["seed_capability"] = this.seedCapability; 312 responseData["inventory-lib-owner"] = new ArrayList(); // todo
304 responseData["home"] = this.home; 313 responseData["initial-outfit"] = this.initialOutfit;
305 responseData["look_at"] = this.lookAt; 314 responseData["start_location"] = this.startLocation;
306 responseData["message"] = this.welcomeMessage; 315 responseData["seed_capability"] = this.seedCapability;
307 responseData["region_x"] = (Int32)this.RegionX * 256; 316 responseData["home"] = this.home;
308 responseData["region_y"] = (Int32)this.RegionY * 256; 317 responseData["look_at"] = this.lookAt;
309 318 responseData["message"] = this.welcomeMessage;
310 responseData["login"] = "true"; 319 responseData["region_x"] = (Int32)this.RegionX * 256;
311 this.xmlRpcResponse.Value = responseData; 320 responseData["region_y"] = (Int32)this.RegionY * 256;
321
322 responseData["login"] = "true";
323 this.xmlRpcResponse.Value = responseData;
324
325 return (this.xmlRpcResponse);
326 }
327 catch (Exception e)
328 {
329 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(
330 OpenSim.Framework.Console.LogPriority.LOW,
331 "LoginResponse: Error creating XML-RPC Response: " + e.Message
332 );
333 return (this.GenerateFailureResponse("Internal Error", "Error generating Login Response", "false"));
312 334
313 return (this.xmlRpcResponse); 335 }
314 336
315 } // ToXmlRpcResponse 337 } // ToXmlRpcResponse
316 338