diff options
author | Justin Clarke Casey | 2008-09-12 20:12:03 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-09-12 20:12:03 +0000 |
commit | 52a4c4d82f9c5b808e6c61fd51c1c70e42865565 (patch) | |
tree | f63a4ea443597b2d79ad6c2b7acff058c4437425 /OpenSim/Framework | |
parent | remove hidden faces inside prim meshes to improve memory use and startup time (diff) | |
download | opensim-SC-52a4c4d82f9c5b808e6c61fd51c1c70e42865565.zip opensim-SC-52a4c4d82f9c5b808e6c61fd51c1c70e42865565.tar.gz opensim-SC-52a4c4d82f9c5b808e6c61fd51c1c70e42865565.tar.bz2 opensim-SC-52a4c4d82f9c5b808e6c61fd51c1c70e42865565.tar.xz |
* Check in first part of http://opensimulator.org/mantis/view.php?id=2073
* This patch aims to introduce look at direction persistence between logins. It won't be active until the second part of the patch is committed in about two weeks time. At
this point, region servers that haven't upgraded past this revision may run into problems
* This checkin upgrades the user database. As always, we recommend you have backups in case something goes wrong.
* Many thanks to tyre for this patch.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Communications/CommunicationsManager.cs | 14 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/IUserService.cs | 13 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/LoginService.cs | 35 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/UserManagerBase.cs | 196 | ||||
-rw-r--r-- | OpenSim/Framework/Constants.cs | 48 | ||||
-rw-r--r-- | OpenSim/Framework/UserAgentData.cs | 98 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 2 |
7 files changed, 235 insertions, 171 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index e6413e8..969bdd8 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs | |||
@@ -276,13 +276,25 @@ namespace OpenSim.Framework.Communications | |||
276 | /// <param name="userid"></param> | 276 | /// <param name="userid"></param> |
277 | /// <param name="regionid"></param> | 277 | /// <param name="regionid"></param> |
278 | /// <param name="regionhandle"></param> | 278 | /// <param name="regionhandle"></param> |
279 | /// <param name="position"></param> | ||
280 | /// <param name="lookat"></param> | ||
281 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) | ||
282 | { | ||
283 | m_userService.LogOffUser(userid, regionid, regionhandle, position, lookat); | ||
284 | } | ||
285 | |||
286 | /// <summary> | ||
287 | /// Logs off a user and does the appropriate communications (deprecated as of 2008-08-27) | ||
288 | /// </summary> | ||
289 | /// <param name="userid"></param> | ||
290 | /// <param name="regionid"></param> | ||
291 | /// <param name="regionhandle"></param> | ||
279 | /// <param name="posx"></param> | 292 | /// <param name="posx"></param> |
280 | /// <param name="posy"></param> | 293 | /// <param name="posy"></param> |
281 | /// <param name="posz"></param> | 294 | /// <param name="posz"></param> |
282 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) | 295 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) |
283 | { | 296 | { |
284 | m_userService.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); | 297 | m_userService.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); |
285 | |||
286 | } | 298 | } |
287 | 299 | ||
288 | /// <summary> | 300 | /// <summary> |
diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs index 07ea437..7e3c77b 100644 --- a/OpenSim/Framework/Communications/IUserService.cs +++ b/OpenSim/Framework/Communications/IUserService.cs | |||
@@ -106,7 +106,18 @@ namespace OpenSim.Framework.Communications | |||
106 | /// Logs off a user on the user server | 106 | /// Logs off a user on the user server |
107 | /// </summary> | 107 | /// </summary> |
108 | /// <param name="UserID">UUID of the user</param> | 108 | /// <param name="UserID">UUID of the user</param> |
109 | /// <param name="regionData">UUID of the Region</param> | 109 | /// <param name="regionID">UUID of the Region</param> |
110 | /// <param name="regionhandle">regionhandle</param> | ||
111 | /// <param name="position">final position</param> | ||
112 | /// <param name="lookat">final lookat</param> | ||
113 | void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat); | ||
114 | |||
115 | /// <summary> | ||
116 | /// Logs off a user on the user server (deprecated as of 2008-08-27) | ||
117 | /// </summary> | ||
118 | /// <param name="UserID">UUID of the user</param> | ||
119 | /// <param name="regionID">UUID of the Region</param> | ||
120 | /// <param name="regionhandle">regionhandle</param> | ||
110 | /// <param name="posx">final position x</param> | 121 | /// <param name="posx">final position x</param> |
111 | /// <param name="posy">final position y</param> | 122 | /// <param name="posy">final position y</param> |
112 | /// <param name="posz">final position z</param> | 123 | /// <param name="posz">final position z</param> |
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 7cdbf6c..26ae3c6 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs | |||
@@ -258,30 +258,19 @@ namespace OpenSim.Framework.Communications | |||
258 | InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; | 258 | InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; |
259 | ArrayList InventoryLibRoot = new ArrayList(); | 259 | ArrayList InventoryLibRoot = new ArrayList(); |
260 | InventoryLibRoot.Add(InventoryLibRootHash); | 260 | InventoryLibRoot.Add(InventoryLibRootHash); |
261 | logResponse.InventoryLibRoot = InventoryLibRoot; | ||
262 | 261 | ||
262 | logResponse.InventoryLibRoot = InventoryLibRoot; | ||
263 | logResponse.InventoryLibraryOwner = GetLibraryOwner(); | 263 | logResponse.InventoryLibraryOwner = GetLibraryOwner(); |
264 | |||
265 | logResponse.InventoryRoot = InventoryRoot; | 264 | logResponse.InventoryRoot = InventoryRoot; |
266 | logResponse.InventorySkeleton = AgentInventoryArray; | 265 | logResponse.InventorySkeleton = AgentInventoryArray; |
267 | logResponse.InventoryLibrary = GetInventoryLibrary(); | 266 | logResponse.InventoryLibrary = GetInventoryLibrary(); |
268 | 267 | ||
269 | // Circuit Code | 268 | logResponse.CircuitCode = (Int32)Util.RandomClass.Next(); |
270 | uint circode = (uint) (Util.RandomClass.Next()); | ||
271 | |||
272 | logResponse.Lastname = userProfile.SurName; | 269 | logResponse.Lastname = userProfile.SurName; |
273 | logResponse.Firstname = userProfile.FirstName; | 270 | logResponse.Firstname = userProfile.FirstName; |
274 | logResponse.AgentID = agentID.ToString(); | 271 | logResponse.AgentID = agentID.ToString(); |
275 | logResponse.SessionID = userProfile.CurrentAgent.SessionID.ToString(); | 272 | logResponse.SessionID = userProfile.CurrentAgent.SessionID.ToString(); |
276 | logResponse.SecureSessionID = userProfile.CurrentAgent.SecureSessionID.ToString(); | 273 | logResponse.SecureSessionID = userProfile.CurrentAgent.SecureSessionID.ToString(); |
277 | |||
278 | logResponse.CircuitCode = (Int32) circode; | ||
279 | //logResponse.RegionX = 0; //overwritten | ||
280 | //logResponse.RegionY = 0; //overwritten | ||
281 | logResponse.Home = "!!null temporary value {home}!!"; // Overwritten | ||
282 | //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; | ||
283 | //logResponse.SimAddress = "127.0.0.1"; //overwritten | ||
284 | //logResponse.SimPort = 0; //overwritten | ||
285 | logResponse.Message = GetMessage(); | 274 | logResponse.Message = GetMessage(); |
286 | logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID)); | 275 | logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID)); |
287 | logResponse.StartLocation = startLocationRequest; | 276 | logResponse.StartLocation = startLocationRequest; |
@@ -322,6 +311,11 @@ namespace OpenSim.Framework.Communications | |||
322 | } | 311 | } |
323 | } | 312 | } |
324 | 313 | ||
314 | /// <summary> | ||
315 | /// Called when we receive the client's initial LLSD login_to_simulator request message | ||
316 | /// </summary> | ||
317 | /// <param name="request">The LLSD request</param> | ||
318 | /// <returns>The response to send</returns> | ||
325 | public LLSD LLSDLoginMethod(LLSD request) | 319 | public LLSD LLSDLoginMethod(LLSD request) |
326 | { | 320 | { |
327 | // Temporary fix | 321 | // Temporary fix |
@@ -432,30 +426,19 @@ namespace OpenSim.Framework.Communications | |||
432 | InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; | 426 | InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; |
433 | ArrayList InventoryLibRoot = new ArrayList(); | 427 | ArrayList InventoryLibRoot = new ArrayList(); |
434 | InventoryLibRoot.Add(InventoryLibRootHash); | 428 | InventoryLibRoot.Add(InventoryLibRootHash); |
435 | logResponse.InventoryLibRoot = InventoryLibRoot; | ||
436 | 429 | ||
430 | logResponse.InventoryLibRoot = InventoryLibRoot; | ||
437 | logResponse.InventoryLibraryOwner = GetLibraryOwner(); | 431 | logResponse.InventoryLibraryOwner = GetLibraryOwner(); |
438 | |||
439 | logResponse.InventoryRoot = InventoryRoot; | 432 | logResponse.InventoryRoot = InventoryRoot; |
440 | logResponse.InventorySkeleton = AgentInventoryArray; | 433 | logResponse.InventorySkeleton = AgentInventoryArray; |
441 | logResponse.InventoryLibrary = GetInventoryLibrary(); | 434 | logResponse.InventoryLibrary = GetInventoryLibrary(); |
442 | 435 | ||
443 | // Circuit Code | 436 | logResponse.CircuitCode = (Int32)Util.RandomClass.Next(); |
444 | uint circode = (uint)(Util.RandomClass.Next()); | ||
445 | |||
446 | logResponse.Lastname = userProfile.SurName; | 437 | logResponse.Lastname = userProfile.SurName; |
447 | logResponse.Firstname = userProfile.FirstName; | 438 | logResponse.Firstname = userProfile.FirstName; |
448 | logResponse.AgentID = agentID.ToString(); | 439 | logResponse.AgentID = agentID.ToString(); |
449 | logResponse.SessionID = userProfile.CurrentAgent.SessionID.ToString(); | 440 | logResponse.SessionID = userProfile.CurrentAgent.SessionID.ToString(); |
450 | logResponse.SecureSessionID = userProfile.CurrentAgent.SecureSessionID.ToString(); | 441 | logResponse.SecureSessionID = userProfile.CurrentAgent.SecureSessionID.ToString(); |
451 | |||
452 | logResponse.CircuitCode = (Int32)circode; | ||
453 | //logResponse.RegionX = 0; //overwritten | ||
454 | //logResponse.RegionY = 0; //overwritten | ||
455 | logResponse.Home = "!!null temporary value {home}!!"; // Overwritten | ||
456 | //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; | ||
457 | //logResponse.SimAddress = "127.0.0.1"; //overwritten | ||
458 | //logResponse.SimPort = 0; //overwritten | ||
459 | logResponse.Message = GetMessage(); | 442 | logResponse.Message = GetMessage(); |
460 | logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID)); | 443 | logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID)); |
461 | logResponse.StartLocation = startLocationRequest; | 444 | logResponse.StartLocation = startLocationRequest; |
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index b6564bf..75c4dc1 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -388,84 +388,115 @@ namespace OpenSim.Framework.Communications | |||
388 | // Profile UUID | 388 | // Profile UUID |
389 | agent.ProfileID = profile.ID; | 389 | agent.ProfileID = profile.ID; |
390 | 390 | ||
391 | // Current position (from Home) | 391 | // Current location/position/alignment |
392 | agent.Handle = profile.HomeRegion; | 392 | if (profile.CurrentAgent != null) |
393 | agent.Position = profile.HomeLocation; | ||
394 | |||
395 | // If user specified additional start, use that | ||
396 | if (requestData.ContainsKey("start")) | ||
397 | { | 393 | { |
398 | string startLoc = ((string)requestData["start"]).Trim(); | 394 | agent.Region = profile.CurrentAgent.Region; |
399 | if (("last" == startLoc) && (profile.CurrentAgent != null)) | 395 | agent.Handle = profile.CurrentAgent.Handle; |
400 | { | 396 | agent.Position = profile.CurrentAgent.Position; |
401 | if ((profile.CurrentAgent.Position.X > 0) | 397 | agent.LookAt = profile.CurrentAgent.LookAt; |
402 | && (profile.CurrentAgent.Position.Y > 0) | 398 | } |
403 | && (profile.CurrentAgent.Position.Z > 0) | 399 | else |
404 | ) | 400 | { |
405 | { | 401 | agent.Region = profile.HomeRegionID; |
406 | // TODO: Right now, currentRegion has not been used in GridServer for requesting region. | 402 | agent.Handle = profile.HomeRegion; |
407 | // TODO: It is only using currentHandle. | 403 | agent.Position = profile.HomeLocation; |
408 | agent.Region = profile.CurrentAgent.Region; | 404 | agent.LookAt = profile.HomeLookAt; |
409 | agent.Handle = profile.CurrentAgent.Handle; | ||
410 | agent.Position = profile.CurrentAgent.Position; | ||
411 | } | ||
412 | } | ||
413 | |||
414 | // if (!(startLoc == "last" || startLoc == "home")) | ||
415 | // { | ||
416 | // // Format: uri:Ahern&162&213&34 | ||
417 | // try | ||
418 | // { | ||
419 | // string[] parts = startLoc.Remove(0, 4).Split('&'); | ||
420 | // //string region = parts[0]; | ||
421 | // | ||
422 | // //////////////////////////////////////////////////// | ||
423 | // //SimProfile SimInfo = new SimProfile(); | ||
424 | // //SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); | ||
425 | // } | ||
426 | // catch (Exception) | ||
427 | // { | ||
428 | // } | ||
429 | // } | ||
430 | } | 405 | } |
431 | 406 | ||
432 | // What time did the user login? | 407 | // What time did the user login? |
433 | agent.LoginTime = Util.UnixTimeSinceEpoch(); | 408 | agent.LoginTime = Util.UnixTimeSinceEpoch(); |
434 | agent.LogoutTime = 0; | 409 | agent.LogoutTime = 0; |
435 | 410 | ||
436 | // Current location | 411 | profile.CurrentAgent = agent; |
437 | agent.InitialRegion = UUID.Zero; // Fill in later | 412 | } |
438 | agent.Region = UUID.Zero; // Fill in later | 413 | |
414 | public void CreateAgent(UserProfileData profile, LLSD request) | ||
415 | { | ||
416 | UserAgentData agent = new UserAgentData(); | ||
417 | |||
418 | // User connection | ||
419 | agent.AgentOnline = true; | ||
420 | |||
421 | //if (request.Params.Count > 1) | ||
422 | //{ | ||
423 | // IPEndPoint RemoteIPEndPoint = (IPEndPoint)request.Params[1]; | ||
424 | // agent.AgentIP = RemoteIPEndPoint.Address.ToString(); | ||
425 | // agent.AgentPort = (uint)RemoteIPEndPoint.Port; | ||
426 | //} | ||
427 | |||
428 | // Generate sessions | ||
429 | RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); | ||
430 | byte[] randDataS = new byte[16]; | ||
431 | byte[] randDataSS = new byte[16]; | ||
432 | rand.GetBytes(randDataS); | ||
433 | rand.GetBytes(randDataSS); | ||
434 | |||
435 | agent.SecureSessionID = new UUID(randDataSS, 0); | ||
436 | agent.SessionID = new UUID(randDataS, 0); | ||
437 | |||
438 | // Profile UUID | ||
439 | agent.ProfileID = profile.ID; | ||
440 | |||
441 | // Current location/position/alignment | ||
442 | if (profile.CurrentAgent != null) | ||
443 | { | ||
444 | agent.Region = profile.CurrentAgent.Region; | ||
445 | agent.Handle = profile.CurrentAgent.Handle; | ||
446 | agent.Position = profile.CurrentAgent.Position; | ||
447 | agent.LookAt = profile.CurrentAgent.LookAt; | ||
448 | } | ||
449 | else | ||
450 | { | ||
451 | agent.Region = profile.HomeRegionID; | ||
452 | agent.Handle = profile.HomeRegion; | ||
453 | agent.Position = profile.HomeLocation; | ||
454 | agent.LookAt = profile.HomeLookAt; | ||
455 | } | ||
456 | |||
457 | // What time did the user login? | ||
458 | agent.LoginTime = Util.UnixTimeSinceEpoch(); | ||
459 | agent.LogoutTime = 0; | ||
439 | 460 | ||
440 | profile.CurrentAgent = agent; | 461 | profile.CurrentAgent = agent; |
441 | } | 462 | } |
442 | 463 | ||
443 | /// <summary> | 464 | /// <summary> |
465 | /// Saves a target agent to the database | ||
466 | /// </summary> | ||
467 | /// <param name="profile">The users profile</param> | ||
468 | /// <returns>Successful?</returns> | ||
469 | public bool CommitAgent(ref UserProfileData profile) | ||
470 | { | ||
471 | // TODO: how is this function different from setUserProfile? -> Add AddUserAgent() here and commit both tables "users" and "agents" | ||
472 | // TODO: what is the logic should be? | ||
473 | bool ret = false; | ||
474 | ret = AddUserAgent(profile.CurrentAgent); | ||
475 | ret = ret & UpdateUserProfile(profile); | ||
476 | return ret; | ||
477 | } | ||
478 | |||
479 | /// <summary> | ||
444 | /// Process a user logoff from OpenSim. | 480 | /// Process a user logoff from OpenSim. |
445 | /// </summary> | 481 | /// </summary> |
446 | /// <param name="userid"></param> | 482 | /// <param name="userid"></param> |
447 | /// <param name="regionid"></param> | 483 | /// <param name="regionid"></param> |
448 | /// <param name="regionhandle"></param> | 484 | /// <param name="regionhandle"></param> |
449 | /// <param name="posx"></param> | 485 | /// <param name="position"></param> |
450 | /// <param name="posy"></param> | 486 | /// <param name="lookat"></param> |
451 | /// <param name="posz"></param> | 487 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) |
452 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) | ||
453 | { | 488 | { |
454 | if (StatsManager.UserStats != null) | 489 | if (StatsManager.UserStats != null) |
455 | StatsManager.UserStats.AddLogout(); | 490 | StatsManager.UserStats.AddLogout(); |
456 | 491 | ||
457 | UserProfileData userProfile; | 492 | UserProfileData userProfile = GetUserProfile(userid); |
458 | UserAgentData userAgent; | ||
459 | Vector3 currentPos = new Vector3(posx, posy, posz); | ||
460 | |||
461 | userProfile = GetUserProfile(userid); | ||
462 | 493 | ||
463 | if (userProfile != null) | 494 | if (userProfile != null) |
464 | { | 495 | { |
465 | // This line needs to be in side the above if statement or the UserServer will crash on some logouts. | 496 | // This line needs to be in side the above if statement or the UserServer will crash on some logouts. |
466 | m_log.Info("[LOGOUT]: " + userProfile.FirstName + " " + userProfile.SurName + " from " + regionhandle + "(" + posx + "," + posy + "," + posz + ")"); | 497 | m_log.Info("[LOGOUT]: " + userProfile.FirstName + " " + userProfile.SurName + " from " + regionhandle + "(" + position.X + "," + position.Y + "," + position.Z + ")"); |
467 | 498 | ||
468 | userAgent = userProfile.CurrentAgent; | 499 | UserAgentData userAgent = userProfile.CurrentAgent; |
469 | if (userAgent != null) | 500 | if (userAgent != null) |
470 | { | 501 | { |
471 | userAgent.AgentOnline = false; | 502 | userAgent.AgentOnline = false; |
@@ -475,10 +506,11 @@ namespace OpenSim.Framework.Communications | |||
475 | { | 506 | { |
476 | userAgent.Region = regionid; | 507 | userAgent.Region = regionid; |
477 | } | 508 | } |
478 | |||
479 | userAgent.Handle = regionhandle; | 509 | userAgent.Handle = regionhandle; |
480 | userAgent.Position = currentPos; | 510 | userAgent.Position = position; |
481 | userProfile.CurrentAgent = userAgent; | 511 | userAgent.LookAt = lookat; |
512 | //userProfile.CurrentAgent = userAgent; | ||
513 | userProfile.LastLogin = userAgent.LogoutTime; | ||
482 | 514 | ||
483 | CommitAgent(ref userProfile); | 515 | CommitAgent(ref userProfile); |
484 | } | 516 | } |
@@ -494,54 +526,18 @@ namespace OpenSim.Framework.Communications | |||
494 | } | 526 | } |
495 | } | 527 | } |
496 | 528 | ||
497 | public void CreateAgent(UserProfileData profile, LLSD request) | ||
498 | { | ||
499 | UserAgentData agent = new UserAgentData(); | ||
500 | |||
501 | // User connection | ||
502 | agent.AgentOnline = true; | ||
503 | |||
504 | // Generate sessions | ||
505 | RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); | ||
506 | byte[] randDataS = new byte[16]; | ||
507 | byte[] randDataSS = new byte[16]; | ||
508 | rand.GetBytes(randDataS); | ||
509 | rand.GetBytes(randDataSS); | ||
510 | |||
511 | agent.SecureSessionID = new UUID(randDataSS, 0); | ||
512 | agent.SessionID = new UUID(randDataS, 0); | ||
513 | |||
514 | // Profile UUID | ||
515 | agent.ProfileID = profile.ID; | ||
516 | |||
517 | // Current position (from Home) | ||
518 | agent.Handle = profile.HomeRegion; | ||
519 | agent.Position = profile.HomeLocation; | ||
520 | |||
521 | // What time did the user login? | ||
522 | agent.LoginTime = Util.UnixTimeSinceEpoch(); | ||
523 | agent.LogoutTime = 0; | ||
524 | |||
525 | // Current location | ||
526 | agent.InitialRegion = UUID.Zero; // Fill in later | ||
527 | agent.Region = UUID.Zero; // Fill in later | ||
528 | |||
529 | profile.CurrentAgent = agent; | ||
530 | } | ||
531 | |||
532 | /// <summary> | 529 | /// <summary> |
533 | /// Saves a target agent to the database | 530 | /// Process a user logoff from OpenSim (deprecated as of 2008-08-27) |
534 | /// </summary> | 531 | /// </summary> |
535 | /// <param name="profile">The users profile</param> | 532 | /// <param name="userid"></param> |
536 | /// <returns>Successful?</returns> | 533 | /// <param name="regionid"></param> |
537 | public bool CommitAgent(ref UserProfileData profile) | 534 | /// <param name="regionhandle"></param> |
535 | /// <param name="posx"></param> | ||
536 | /// <param name="posy"></param> | ||
537 | /// <param name="posz"></param> | ||
538 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) | ||
538 | { | 539 | { |
539 | // TODO: how is this function different from setUserProfile? -> Add AddUserAgent() here and commit both tables "users" and "agents" | 540 | LogOffUser(userid, regionid, regionhandle, new Vector3(posx, posy, posz), new Vector3()); |
540 | // TODO: what is the logic should be? | ||
541 | bool ret = false; | ||
542 | ret = AddUserAgent(profile.CurrentAgent); | ||
543 | ret = ret & UpdateUserProfile(profile); | ||
544 | return ret; | ||
545 | } | 541 | } |
546 | 542 | ||
547 | #endregion | 543 | #endregion |
diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs index 316d2a3..61eb35e 100644 --- a/OpenSim/Framework/Constants.cs +++ b/OpenSim/Framework/Constants.cs | |||
@@ -24,6 +24,7 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | using System; | ||
27 | 28 | ||
28 | namespace OpenSim.Framework | 29 | namespace OpenSim.Framework |
29 | { | 30 | { |
@@ -40,5 +41,50 @@ namespace OpenSim.Framework | |||
40 | EstateBans = 20, | 41 | EstateBans = 20, |
41 | EstateManagers = 24 | 42 | EstateManagers = 24 |
42 | } | 43 | } |
44 | |||
45 | [Flags]public enum TeleportFlags : uint | ||
46 | { | ||
47 | /// <summary>No flags set, or teleport failed</summary> | ||
48 | Default = 0, | ||
49 | /// <summary>Set when newbie leaves help island for first time</summary> | ||
50 | SetHomeToTarget = 1 << 0, | ||
51 | /// <summary></summary> | ||
52 | SetLastToTarget = 1 << 1, | ||
53 | /// <summary>Via Lure</summary> | ||
54 | ViaLure = 1 << 2, | ||
55 | /// <summary>Via Landmark</summary> | ||
56 | ViaLandmark = 1 << 3, | ||
57 | /// <summary>Via Location</summary> | ||
58 | ViaLocation = 1 << 4, | ||
59 | /// <summary>Via Home</summary> | ||
60 | ViaHome = 1 << 5, | ||
61 | /// <summary>Via Telehub</summary> | ||
62 | ViaTelehub = 1 << 6, | ||
63 | /// <summary>Via Login</summary> | ||
64 | ViaLogin = 1 << 7, | ||
65 | /// <summary>Linden Summoned</summary> | ||
66 | ViaGodlikeLure = 1 << 8, | ||
67 | /// <summary>Linden Forced me</summary> | ||
68 | Godlike = 1 << 9, | ||
69 | /// <summary></summary> | ||
70 | NineOneOne = 1 << 10, | ||
71 | /// <summary>Agent Teleported Home via Script</summary> | ||
72 | DisableCancel = 1 << 11, | ||
73 | /// <summary></summary> | ||
74 | ViaRegionID = 1 << 12, | ||
75 | /// <summary></summary> | ||
76 | IsFlying = 1 << 13, | ||
77 | /// <summary></summary> | ||
78 | ResetHome = 1 << 14, | ||
79 | /// <summary>forced to new location for example when avatar is banned or ejected</summary> | ||
80 | ForceRedirect = 1 << 15, | ||
81 | /// <summary>Teleport Finished via a Lure</summary> | ||
82 | FinishedViaLure = 1 << 26, | ||
83 | /// <summary>Finished, Sim Changed</summary> | ||
84 | FinishedViaNewSim = 1 << 28, | ||
85 | /// <summary>Finished, Same Sim</summary> | ||
86 | FinishedViaSameSim = 1 << 29 | ||
87 | } | ||
88 | |||
43 | } | 89 | } |
44 | } \ No newline at end of file | 90 | } |
diff --git a/OpenSim/Framework/UserAgentData.cs b/OpenSim/Framework/UserAgentData.cs index 03a65c5..506a5e0 100644 --- a/OpenSim/Framework/UserAgentData.cs +++ b/OpenSim/Framework/UserAgentData.cs | |||
@@ -36,34 +36,35 @@ namespace OpenSim.Framework | |||
36 | public class UserAgentData | 36 | public class UserAgentData |
37 | { | 37 | { |
38 | /// <summary> | 38 | /// <summary> |
39 | /// The IP address of the user | 39 | /// The UUID of the users avatar (not the agent!) |
40 | /// </summary> | 40 | /// </summary> |
41 | private string agentIP = String.Empty; | 41 | private UUID UUID; |
42 | 42 | ||
43 | /// <summary> | 43 | /// <summary> |
44 | /// Is the user online? | 44 | /// The session ID for the user (also the agent ID) |
45 | /// </summary> | 45 | /// </summary> |
46 | private bool agentOnline; | 46 | private UUID sessionID; |
47 | 47 | ||
48 | /// <summary> | 48 | /// <summary> |
49 | /// The port of the user | 49 | /// The "secure" session ID for the user |
50 | /// </summary> | 50 | /// </summary> |
51 | private uint agentPort; | 51 | /// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks> |
52 | private UUID secureSessionID; | ||
52 | 53 | ||
53 | /// <summary> | 54 | /// <summary> |
54 | /// Region handle of the current region the user is in | 55 | /// The IP address of the user |
55 | /// </summary> | 56 | /// </summary> |
56 | private ulong currentHandle; | 57 | private string agentIP = String.Empty; |
57 | 58 | ||
58 | /// <summary> | 59 | /// <summary> |
59 | /// The position of the user within the region | 60 | /// The port of the user |
60 | /// </summary> | 61 | /// </summary> |
61 | private Vector3 currentPos; | 62 | private uint agentPort; |
62 | 63 | ||
63 | /// <summary> | 64 | /// <summary> |
64 | /// Current region the user is logged into | 65 | /// Is the user online? |
65 | /// </summary> | 66 | /// </summary> |
66 | private UUID currentRegion; | 67 | private bool agentOnline; |
67 | 68 | ||
68 | /// <summary> | 69 | /// <summary> |
69 | /// A unix timestamp from when the user logged in | 70 | /// A unix timestamp from when the user logged in |
@@ -76,25 +77,29 @@ namespace OpenSim.Framework | |||
76 | private int logoutTime; | 77 | private int logoutTime; |
77 | 78 | ||
78 | /// <summary> | 79 | /// <summary> |
79 | /// The region the user logged into initially | 80 | /// Region ID the user is logged into |
80 | /// </summary> | 81 | /// </summary> |
81 | private UUID regionID; | 82 | private UUID regionID; |
82 | 83 | ||
83 | /// <summary> | 84 | /// <summary> |
84 | /// The "secure" session ID for the user | 85 | /// Region handle of the current region the user is in |
85 | /// </summary> | 86 | /// </summary> |
86 | /// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks> | 87 | private ulong regionHandle; |
87 | private UUID secureSessionID; | ||
88 | 88 | ||
89 | /// <summary> | 89 | /// <summary> |
90 | /// The session ID for the user (also the agent ID) | 90 | /// The position of the user within the region |
91 | /// </summary> | 91 | /// </summary> |
92 | private UUID sessionID; | 92 | private Vector3 currentPos; |
93 | 93 | ||
94 | /// <summary> | 94 | /// <summary> |
95 | /// The UUID of the users avatar (not the agent!) | 95 | /// Current direction the user is looking at |
96 | /// </summary> | 96 | /// </summary> |
97 | private UUID UUID; | 97 | private Vector3 currentLookAt = Vector3.Zero; |
98 | |||
99 | /// <summary> | ||
100 | /// The region the user logged into initially | ||
101 | /// </summary> | ||
102 | private UUID originRegionID; | ||
98 | 103 | ||
99 | public virtual UUID ProfileID | 104 | public virtual UUID ProfileID |
100 | { | 105 | { |
@@ -102,6 +107,18 @@ namespace OpenSim.Framework | |||
102 | set { UUID = value; } | 107 | set { UUID = value; } |
103 | } | 108 | } |
104 | 109 | ||
110 | public virtual UUID SessionID | ||
111 | { | ||
112 | get { return sessionID; } | ||
113 | set { sessionID = value; } | ||
114 | } | ||
115 | |||
116 | public virtual UUID SecureSessionID | ||
117 | { | ||
118 | get { return secureSessionID; } | ||
119 | set { secureSessionID = value; } | ||
120 | } | ||
121 | |||
105 | public virtual string AgentIP | 122 | public virtual string AgentIP |
106 | { | 123 | { |
107 | get { return agentIP; } | 124 | get { return agentIP; } |
@@ -120,24 +137,6 @@ namespace OpenSim.Framework | |||
120 | set { agentOnline = value; } | 137 | set { agentOnline = value; } |
121 | } | 138 | } |
122 | 139 | ||
123 | public virtual UUID SessionID | ||
124 | { | ||
125 | get { return sessionID; } | ||
126 | set { sessionID = value; } | ||
127 | } | ||
128 | |||
129 | public virtual UUID SecureSessionID | ||
130 | { | ||
131 | get { return secureSessionID; } | ||
132 | set { secureSessionID = value; } | ||
133 | } | ||
134 | |||
135 | public virtual UUID InitialRegion | ||
136 | { | ||
137 | get { return regionID; } | ||
138 | set { regionID = value; } | ||
139 | } | ||
140 | |||
141 | public virtual int LoginTime | 140 | public virtual int LoginTime |
142 | { | 141 | { |
143 | get { return loginTime; } | 142 | get { return loginTime; } |
@@ -152,14 +151,14 @@ namespace OpenSim.Framework | |||
152 | 151 | ||
153 | public virtual UUID Region | 152 | public virtual UUID Region |
154 | { | 153 | { |
155 | get { return currentRegion; } | 154 | get { return regionID; } |
156 | set { currentRegion = value; } | 155 | set { regionID = value; } |
157 | } | 156 | } |
158 | 157 | ||
159 | public virtual ulong Handle | 158 | public virtual ulong Handle |
160 | { | 159 | { |
161 | get { return currentHandle; } | 160 | get { return regionHandle; } |
162 | set { currentHandle = value; } | 161 | set { regionHandle = value; } |
163 | } | 162 | } |
164 | 163 | ||
165 | public virtual Vector3 Position | 164 | public virtual Vector3 Position |
@@ -168,6 +167,7 @@ namespace OpenSim.Framework | |||
168 | set { currentPos = value; } | 167 | set { currentPos = value; } |
169 | } | 168 | } |
170 | 169 | ||
170 | /* 2008-08-28-tyre: Not really useful | ||
171 | public virtual float PositionX | 171 | public virtual float PositionX |
172 | { | 172 | { |
173 | get { return currentPos.X; } | 173 | get { return currentPos.X; } |
@@ -185,5 +185,19 @@ namespace OpenSim.Framework | |||
185 | get { return currentPos.Z; } | 185 | get { return currentPos.Z; } |
186 | set { currentPos.Z = value; } | 186 | set { currentPos.Z = value; } |
187 | } | 187 | } |
188 | */ | ||
189 | |||
190 | public virtual Vector3 LookAt | ||
191 | { | ||
192 | get { return currentLookAt; } | ||
193 | set { currentLookAt = value; } | ||
194 | } | ||
195 | |||
196 | public virtual UUID InitialRegion | ||
197 | { | ||
198 | get { return originRegionID; } | ||
199 | set { originRegionID = value; } | ||
200 | } | ||
201 | |||
188 | } | 202 | } |
189 | } | 203 | } |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index d289978..333ab81 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -678,6 +678,7 @@ namespace OpenSim.Framework | |||
678 | } | 678 | } |
679 | } | 679 | } |
680 | 680 | ||
681 | /* 2008-08-28-tyre: Obsolete (see LocalLoginService UserLoginService) | ||
681 | public static string[] ParseStartLocationRequest(string startLocationRequest) | 682 | public static string[] ParseStartLocationRequest(string startLocationRequest) |
682 | { | 683 | { |
683 | string[] returnstring = new string[4]; | 684 | string[] returnstring = new string[4]; |
@@ -715,6 +716,7 @@ namespace OpenSim.Framework | |||
715 | } | 716 | } |
716 | return returnstring; | 717 | return returnstring; |
717 | } | 718 | } |
719 | */ | ||
718 | 720 | ||
719 | public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args) | 721 | public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args) |
720 | { | 722 | { |