aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/UserServer/UserLoginService.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-09-07 04:20:47 +0000
committerJustin Clarke Casey2008-09-07 04:20:47 +0000
commit260b1413065df3df2c5c43853b2b01b11bc2d8e7 (patch)
tree267ddeeb3b7a34c5a7fa1015aa29f28d44f8ec6a /OpenSim/Grid/UserServer/UserLoginService.cs
parentClean up some of the nonsensical use of ScriptSleep (diff)
downloadopensim-SC_OLD-260b1413065df3df2c5c43853b2b01b11bc2d8e7.zip
opensim-SC_OLD-260b1413065df3df2c5c43853b2b01b11bc2d8e7.tar.gz
opensim-SC_OLD-260b1413065df3df2c5c43853b2b01b11bc2d8e7.tar.bz2
opensim-SC_OLD-260b1413065df3df2c5c43853b2b01b11bc2d8e7.tar.xz
* refactor: Remove duplication in UserLoginService where most of the emergency region login code is a cut and paste job of the preceding normal region login code
* also, properly tell the user if no region can be contacted, rather than letting the login proceed only to fail later when authentication fails on the region side * copying and pasting code... it makes me cry inside... so sad...
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs430
1 files changed, 170 insertions, 260 deletions
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index efd0654..8683daf 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -138,173 +138,192 @@ namespace OpenSim.Grid.UserServer
138 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser, 138 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser,
139 string startLocationRequest) 139 string startLocationRequest)
140 { 140 {
141 bool tryDefault = false; 141 RegionProfileData SimInfo;
142 //CFK: Since the try is always "tried", the "Home Location" message should always appear, so comment this one. 142 RegionProfileData HomeInfo;
143 //CFK: m_log.Info("[LOGIN]: Load information from the gridserver"); 143 int start_x = -1;
144 int start_y = -1;
145 int start_z = -1;
144 146
145 try 147 // use the homeRegionID if it is stored already. If not, use the regionHandle as before
148 if (theUser.HomeRegionID != UUID.Zero)
146 { 149 {
147 RegionProfileData SimInfo; 150 HomeInfo =
148 RegionProfileData HomeInfo; 151 RegionProfileData.RequestSimProfileData(
149 int start_x = -1; 152 theUser.HomeRegionID, m_config.GridServerURL,
150 int start_y = -1; 153 m_config.GridSendKey, m_config.GridRecvKey);
151 int start_z = -1; 154 }
152 155 else
153 // use the homeRegionID if it is stored already. If not, use the regionHandle as before 156 {
154 if (theUser.HomeRegionID != UUID.Zero) 157 HomeInfo =
155 { 158 RegionProfileData.RequestSimProfileData(
156 HomeInfo = 159 theUser.HomeRegion, m_config.GridServerURL,
157 RegionProfileData.RequestSimProfileData( 160 m_config.GridSendKey, m_config.GridRecvKey);
158 theUser.HomeRegionID, m_config.GridServerURL, 161 }
159 m_config.GridSendKey, m_config.GridRecvKey);
160 }
161 else
162 {
163 HomeInfo =
164 RegionProfileData.RequestSimProfileData(
165 theUser.HomeRegion, m_config.GridServerURL,
166 m_config.GridSendKey, m_config.GridRecvKey);
167 }
168 162
169 if (startLocationRequest == "last") 163 if (startLocationRequest == "last")
164 {
165 SimInfo =
166 RegionProfileData.RequestSimProfileData(
167 theUser.CurrentAgent.Handle, m_config.GridServerURL,
168 m_config.GridSendKey, m_config.GridRecvKey);
169 }
170 else if (startLocationRequest == "home")
171 {
172 SimInfo = HomeInfo;
173 }
174 else
175 {
176 string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest);
177 m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" +
178 startLocationRequestParsed[1] + ", 3:" + startLocationRequestParsed[2] + ", 4:" +
179 startLocationRequestParsed[3]);
180 if (startLocationRequestParsed[0] == "last")
170 { 181 {
171 SimInfo = 182 SimInfo =
172 RegionProfileData.RequestSimProfileData( 183 RegionProfileData.RequestSimProfileData(
173 theUser.CurrentAgent.Handle, m_config.GridServerURL, 184 theUser.CurrentAgent.Handle, m_config.GridServerURL,
174 m_config.GridSendKey, m_config.GridRecvKey); 185 m_config.GridSendKey, m_config.GridRecvKey);
175 } 186 }
176 else if (startLocationRequest == "home")
177 {
178 SimInfo = HomeInfo;
179 }
180 else 187 else
181 { 188 {
182 string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest); 189 m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]);
183 m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + 190 SimInfo =
184 startLocationRequestParsed[1] + ", 3:" + startLocationRequestParsed[2] + ", 4:" + 191 RegionProfileData.RequestSimProfileData(
185 startLocationRequestParsed[3]); 192 startLocationRequestParsed[0], m_config.GridServerURL,
186 if (startLocationRequestParsed[0] == "last") 193 m_config.GridSendKey, m_config.GridRecvKey);
194
195 if (SimInfo == null)
187 { 196 {
188 SimInfo = 197 m_log.Info("[LOGIN]: Didn't find region with a close name match sending to home location");
189 RegionProfileData.RequestSimProfileData( 198 SimInfo = HomeInfo;
190 theUser.CurrentAgent.Handle, m_config.GridServerURL,
191 m_config.GridSendKey, m_config.GridRecvKey);
192 } 199 }
193 else 200 else
194 { 201 {
195 m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]); 202 start_x = Convert.ToInt32(startLocationRequestParsed[1]);
196 SimInfo = 203 start_y = Convert.ToInt32(startLocationRequestParsed[2]);
197 RegionProfileData.RequestSimProfileData( 204 start_z = Convert.ToInt32(startLocationRequestParsed[3]);
198 startLocationRequestParsed[0], m_config.GridServerURL, 205
199 m_config.GridSendKey, m_config.GridRecvKey); 206 if (start_x >= 0 && start_y >= 0 && start_z >= 0)
200
201 if (SimInfo == null)
202 { 207 {
203 m_log.Info("[LOGIN]: Didn't find region with a close name match sending to home location"); 208 Vector3 tmp_v = new Vector3(start_x, start_y, start_z);
204 SimInfo = HomeInfo; 209 theUser.CurrentAgent.Position = tmp_v;
205 } 210 }
206 else
207 {
208 start_x = Convert.ToInt32(startLocationRequestParsed[1]);
209 start_y = Convert.ToInt32(startLocationRequestParsed[2]);
210 start_z = Convert.ToInt32(startLocationRequestParsed[3]);
211 }
212 } 211 }
213 } 212 }
213 }
214 214
215 // Customise the response 215 // Customise the response
216 //CFK: This is redundant and the next message should always appear. 216 //CFK: This is redundant and the next message should always appear.
217 //CFK: m_log.Info("[LOGIN]: Home Location"); 217 //CFK: m_log.Info("[LOGIN]: Home Location");
218 if (HomeInfo != null) 218 if (HomeInfo != null)
219 { 219 {
220 response.Home = 220 response.Home =
221 string.Format( 221 string.Format(
222 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", 222 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
223 (HomeInfo.regionLocX*Constants.RegionSize), 223 (HomeInfo.regionLocX*Constants.RegionSize),
224 (HomeInfo.regionLocY*Constants.RegionSize), 224 (HomeInfo.regionLocY*Constants.RegionSize),
225 theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z, 225 theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
226 theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); 226 theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
227 } 227 }
228 else 228 else
229 { 229 {
230 // Emergency mode: Home-region isn't available, so we can't request the region info. 230 // Emergency mode: Home-region isn't available, so we can't request the region info.
231 // Use the stored home regionHandle instead. 231 // Use the stored home regionHandle instead.
232 // NOTE: If the home-region moves, this will be wrong until the users update their user-profile again 232 // NOTE: If the home-region moves, this will be wrong until the users update their user-profile again
233 ulong regionX = theUser.HomeRegion >> 32; 233 ulong regionX = theUser.HomeRegion >> 32;
234 ulong regionY = theUser.HomeRegion & 0xffffffff; 234 ulong regionY = theUser.HomeRegion & 0xffffffff;
235 response.Home = 235 response.Home =
236 string.Format( 236 string.Format(
237 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", 237 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
238 regionX, regionY, 238 regionX, regionY,
239 theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z, 239 theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
240 theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); 240 theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
241 m_log.InfoFormat("[LOGIN] Home region of user {0} {1} is not available; using computed region position {2} {3}", 241 m_log.InfoFormat("[LOGIN] Home region of user {0} {1} is not available; using computed region position {2} {3}",
242 theUser.FirstName, theUser.SurName, 242 theUser.FirstName, theUser.SurName,
243 regionX, regionY); 243 regionX, regionY);
244 } 244 }
245 245
246 if (!PrepareLoginToRegion(SimInfo, theUser, response))
247 {
248 // Send him to default region instead
249 // Load information from the gridserver
250 ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) |
251 ((ulong) m_config.DefaultY * Constants.RegionSize);
252
253 m_log.Warn(
254 "[LOGIN]: Sending user to default region " + defaultHandle + " instead");
255
256 SimInfo = RegionProfileData.RequestSimProfileData(
257 defaultHandle, m_config.GridServerURL,
258 m_config.GridSendKey, m_config.GridRecvKey);
259
260 // Customise the response
261 response.Home =
262 string.Format(
263 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
264 (SimInfo.regionLocX * Constants.RegionSize),
265 (SimInfo.regionLocY*Constants.RegionSize),
266 theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
267 theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
268
269 if (!PrepareLoginToRegion(SimInfo, theUser, response))
270 response.CreateDeadRegionResponse();
271 }
272 }
273
274 /// <summary>
275 /// Prepare a login to the given region. This involves both telling the region to expect a connection
276 /// and appropriately customising the response to the user.
277 /// </summary>
278 /// <param name="sim"></param>
279 /// <param name="user"></param>
280 /// <param name="response"></param>
281 /// <returns>true if the region was successfully contacted, false otherwise</returns>
282 private bool PrepareLoginToRegion(RegionProfileData sim, UserProfileData user, LoginResponse response)
283 {
284 try
285 {
246 // Destination 286 // Destination
247 //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into 287 m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + sim.regionLocX + "; Region Y: " + sim.regionLocY);
248 //CFK: the next one for X & Y and comment this one. 288
249 //CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + 289 response.SimAddress = Util.GetHostFromURL(sim.serverURI).ToString();
250 //CFK: "; Region Y: " + SimInfo.regionLocY); 290 response.SimPort = uint.Parse(sim.serverURI.Split(new char[] {'/', ':'})[4]);
251 response.SimAddress = Util.GetHostFromURL(SimInfo.serverURI).ToString(); 291 response.RegionX = sim.regionLocX;
252 response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] {'/', ':'})[4]); 292 response.RegionY = sim.regionLocY;
253 response.RegionX = SimInfo.regionLocX;
254 response.RegionY = SimInfo.regionLocY;
255 293
256 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI 294 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
257 string capsPath = Util.GetRandomCapsPath(); 295 string capsPath = Util.GetRandomCapsPath();
258 response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; 296 response.SeedCapability = sim.httpServerURI + "CAPS/" + capsPath + "0000/";
259
260 m_log.DebugFormat(
261 "[LOGIN]: Sending new CAPS seed url {0} to client {1}",
262 response.SeedCapability, response.AgentID);
263 297
264 // Notify the target of an incoming user 298 // Notify the target of an incoming user
265 //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into 299 m_log.Info("[LOGIN]: Telling " + sim.regionName + " (" + sim.serverURI + ") to prepare for client connection");
266 //CFK: the next one for X & Y and comment this one. 300
267 //CFK: m_log.Info("[LOGIN]: " + SimInfo.regionName + " (" + SimInfo.serverURI + ") " + 301 // Update agent with target sim
268 //CFK: SimInfo.regionLocX + "," + SimInfo.regionLocY); 302 user.CurrentAgent.Region = sim.UUID;
269 303 user.CurrentAgent.Handle = sim.regionHandle;
270 theUser.CurrentAgent.Region = SimInfo.UUID; 304
271 theUser.CurrentAgent.Handle = SimInfo.regionHandle;
272 if (start_x >= 0 && start_y >= 0 && start_z >= 0)
273 {
274 Vector3 tmp_v = new Vector3(start_x, start_y, start_z);
275 theUser.CurrentAgent.Position = tmp_v;
276 }
277 // Prepare notification 305 // Prepare notification
278 Hashtable SimParams = new Hashtable(); 306 Hashtable SimParams = new Hashtable();
279 SimParams["session_id"] = theUser.CurrentAgent.SessionID.ToString(); 307 SimParams["session_id"] = user.CurrentAgent.SessionID.ToString();
280 SimParams["secure_session_id"] = theUser.CurrentAgent.SecureSessionID.ToString(); 308 SimParams["secure_session_id"] = user.CurrentAgent.SecureSessionID.ToString();
281 SimParams["firstname"] = theUser.FirstName; 309 SimParams["firstname"] = user.FirstName;
282 SimParams["lastname"] = theUser.SurName; 310 SimParams["lastname"] = user.SurName;
283 SimParams["agent_id"] = theUser.ID.ToString(); 311 SimParams["agent_id"] = user.ID.ToString();
284 SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode); 312 SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode);
285 SimParams["startpos_x"] = theUser.CurrentAgent.Position.X.ToString(); 313 SimParams["startpos_x"] = user.CurrentAgent.Position.X.ToString();
286 SimParams["startpos_y"] = theUser.CurrentAgent.Position.Y.ToString(); 314 SimParams["startpos_y"] = user.CurrentAgent.Position.Y.ToString();
287 SimParams["startpos_z"] = theUser.CurrentAgent.Position.Z.ToString(); 315 SimParams["startpos_z"] = user.CurrentAgent.Position.Z.ToString();
288 SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString(); 316 SimParams["regionhandle"] = user.CurrentAgent.Handle.ToString();
289 SimParams["caps_path"] = capsPath; 317 SimParams["caps_path"] = capsPath;
290 ArrayList SendParams = new ArrayList(); 318 ArrayList SendParams = new ArrayList();
291 SendParams.Add(SimParams); 319 SendParams.Add(SimParams);
292 320
293 // Update agent with target sim 321 m_log.Info("[LOGIN]: Informing region at " + sim.httpServerURI);
294 322
295 m_log.InfoFormat( 323 // Send
296 "[LOGIN]: Telling region {0} @ {1},{2} ({3}) to expect user connection",
297 SimInfo.regionName, response.RegionX, response.RegionY, SimInfo.httpServerURI);
298
299 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); 324 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
300 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); 325 XmlRpcResponse GridResp = GridReq.Send(sim.httpServerURI, 6000);
301 326
302 if (GridResp.IsFault)
303 {
304 m_log.ErrorFormat(
305 "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}",
306 SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
307 }
308 if (!GridResp.IsFault) 327 if (!GridResp.IsFault)
309 { 328 {
310 bool responseSuccess = true; 329 bool responseSuccess = true;
@@ -317,7 +336,6 @@ namespace OpenSim.Grid.UserServer
317 if ((string) resp["success"] == "FALSE") 336 if ((string) resp["success"] == "FALSE")
318 { 337 {
319 responseSuccess = false; 338 responseSuccess = false;
320 tryDefault = true;
321 } 339 }
322 } 340 }
323 } 341 }
@@ -327,141 +345,33 @@ namespace OpenSim.Grid.UserServer
327 handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; 345 handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation;
328 if (handlerUserLoggedInAtLocation != null) 346 if (handlerUserLoggedInAtLocation != null)
329 { 347 {
330 //m_log.Info("[LOGIN]: Letting other objects know about login"); 348 m_log.Info("[LOGIN]: Letting listeners know about successful login");
331 handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, 349 handlerUserLoggedInAtLocation(user.ID, user.CurrentAgent.SessionID,
332 theUser.CurrentAgent.Region, 350 user.CurrentAgent.Region,
333 theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, 351 user.CurrentAgent.Handle,
334 theUser.CurrentAgent.Position.Y, 352 user.CurrentAgent.Position.X,
335 theUser.CurrentAgent.Position.Z, 353 user.CurrentAgent.Position.Y,
336 theUser.FirstName, theUser.SurName); 354 user.CurrentAgent.Position.Z,
337 } 355 user.FirstName, user.SurName);
338 }
339 }
340 }
341 catch (Exception e)
342 {
343 m_log.ErrorFormat("[LOGIN]: Requested region for login not available, {0}", e);
344 tryDefault = true;
345 }
346
347 if (tryDefault)
348 {
349 // Send him to default region instead
350 // Load information from the gridserver
351
352 ulong defaultHandle = (((ulong) m_config.DefaultX*Constants.RegionSize) << 32) |
353 ((ulong) m_config.DefaultY*Constants.RegionSize);
354
355 m_log.Warn(
356 "[LOGIN]: Sending user to default region " + defaultHandle + " instead");
357
358 try
359 {
360 RegionProfileData SimInfo = RegionProfileData.RequestSimProfileData(
361 defaultHandle, m_config.GridServerURL,
362 m_config.GridSendKey, m_config.GridRecvKey);
363
364 // Customise the response
365 m_log.Info("[LOGIN]: Home Location");
366 response.Home =
367 string.Format(
368 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
369 (SimInfo.regionLocX*Constants.RegionSize),
370 (SimInfo.regionLocY*Constants.RegionSize),
371 theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
372 theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
373
374
375 // Destination
376 m_log.Info("[LOGIN]: " +
377 "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
378 SimInfo.regionLocY);
379 response.SimAddress = Util.GetHostFromURL(SimInfo.serverURI).ToString();
380 response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] {'/', ':'})[4]);
381 response.RegionX = SimInfo.regionLocX;
382 response.RegionY = SimInfo.regionLocY;
383
384 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
385 string capsPath = Util.GetRandomCapsPath();
386 response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
387
388 // Notify the target of an incoming user
389 m_log.Info("[LOGIN]: Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")");
390
391 // Update agent with target sim
392 theUser.CurrentAgent.Region = SimInfo.UUID;
393 theUser.CurrentAgent.Handle = SimInfo.regionHandle;
394
395 // Prepare notification
396 Hashtable SimParams = new Hashtable();
397 SimParams["session_id"] = theUser.CurrentAgent.SessionID.ToString();
398 SimParams["secure_session_id"] = theUser.CurrentAgent.SecureSessionID.ToString();
399 SimParams["firstname"] = theUser.FirstName;
400 SimParams["lastname"] = theUser.SurName;
401 SimParams["agent_id"] = theUser.ID.ToString();
402 SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode);
403 SimParams["startpos_x"] = theUser.CurrentAgent.Position.X.ToString();
404 SimParams["startpos_y"] = theUser.CurrentAgent.Position.Y.ToString();
405 SimParams["startpos_z"] = theUser.CurrentAgent.Position.Z.ToString();
406 SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString();
407 SimParams["caps_path"] = capsPath;
408 ArrayList SendParams = new ArrayList();
409 SendParams.Add(SimParams);
410
411 m_log.Info("[LOGIN]: Informing region at " + SimInfo.httpServerURI);
412 // Send
413 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
414 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
415
416 if (!GridResp.IsFault)
417 {
418 bool responseSuccess = true;
419
420
421 if (GridResp.Value != null)
422 {
423 Hashtable resp = (Hashtable) GridResp.Value;
424 if (resp.ContainsKey("success"))
425 {
426 if ((string) resp["success"] == "FALSE")
427 {
428 responseSuccess = false;
429 }
430 }
431 }
432
433 if (responseSuccess)
434 {
435 handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation;
436 if (handlerUserLoggedInAtLocation != null)
437 {
438 m_log.Info("[LOGIN]: Letting other objects know about login");
439 handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID,
440 theUser.CurrentAgent.Region,
441 theUser.CurrentAgent.Handle,
442 theUser.CurrentAgent.Position.X,
443 theUser.CurrentAgent.Position.Y,
444 theUser.CurrentAgent.Position.Z,
445 theUser.FirstName, theUser.SurName);
446 }
447 }
448 else
449 {
450 response.CreateDeadRegionResponse();
451 } 356 }
452 } 357 }
453 else 358 else
454 { 359 {
455 response.CreateDeadRegionResponse(); 360 return false;
456 } 361 }
457 } 362 }
458 363 else
459 catch (Exception e)
460 { 364 {
461 m_log.Warn("[LOGIN]: Default region also not available"); 365 return false;
462 m_log.Warn("[LOGIN]: " + e);
463 } 366 }
464 } 367 }
368 catch (Exception e)
369 {
370 m_log.ErrorFormat("[LOGIN]: Region not available for login, {0}", e);
371 return false;
372 }
373
374 return true;
465 } 375 }
466 376
467 // See LoginService 377 // See LoginService