aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLManager.cs9
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs14
-rw-r--r--OpenSim/Framework/Communications/IUserService.cs13
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs35
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs196
-rw-r--r--OpenSim/Framework/Constants.cs48
-rw-r--r--OpenSim/Framework/UserAgentData.cs98
-rw-r--r--OpenSim/Framework/Util.cs2
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs239
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs257
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs35
-rw-r--r--OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs5
14 files changed, 515 insertions, 451 deletions
diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs
index 6048f93..5f830bb 100644
--- a/OpenSim/Data/MySQL/MySQLManager.cs
+++ b/OpenSim/Data/MySQL/MySQLManager.cs
@@ -512,6 +512,8 @@ namespace OpenSim.Data.MySQL
512 Vector3 tmp_v; 512 Vector3 tmp_v;
513 Vector3.TryParse((string) reader["currentPos"], out tmp_v); 513 Vector3.TryParse((string) reader["currentPos"], out tmp_v);
514 retval.Position = tmp_v; 514 retval.Position = tmp_v;
515 Vector3.TryParse((string)reader["currentLookAt"], out tmp_v);
516 retval.LookAt = tmp_v;
515 } 517 }
516 else 518 else
517 { 519 {
@@ -1095,8 +1097,8 @@ namespace OpenSim.Data.MySQL
1095 { 1097 {
1096 string sql = String.Empty; 1098 string sql = String.Empty;
1097 sql += "REPLACE INTO "; 1099 sql += "REPLACE INTO ";
1098 sql += "agents (UUID, sessionID, secureSessionID, agentIP, agentPort, agentOnline, loginTime, logoutTime, currentRegion, currentHandle, currentPos) VALUES "; 1100 sql += "agents (UUID, sessionID, secureSessionID, agentIP, agentPort, agentOnline, loginTime, logoutTime, currentRegion, currentHandle, currentPos, currentLookAt) VALUES ";
1099 sql += "(?UUID, ?sessionID, ?secureSessionID, ?agentIP, ?agentPort, ?agentOnline, ?loginTime, ?logoutTime, ?currentRegion, ?currentHandle, ?currentPos);"; 1101 sql += "(?UUID, ?sessionID, ?secureSessionID, ?agentIP, ?agentPort, ?agentOnline, ?loginTime, ?logoutTime, ?currentRegion, ?currentHandle, ?currentPos, ?currentLookAt);";
1100 Dictionary<string, string> parameters = new Dictionary<string, string>(); 1102 Dictionary<string, string> parameters = new Dictionary<string, string>();
1101 1103
1102 parameters["?UUID"] = agentdata.ProfileID.ToString(); 1104 parameters["?UUID"] = agentdata.ProfileID.ToString();
@@ -1109,7 +1111,8 @@ namespace OpenSim.Data.MySQL
1109 parameters["?logoutTime"] = agentdata.LogoutTime.ToString(); 1111 parameters["?logoutTime"] = agentdata.LogoutTime.ToString();
1110 parameters["?currentRegion"] = agentdata.Region.ToString(); 1112 parameters["?currentRegion"] = agentdata.Region.ToString();
1111 parameters["?currentHandle"] = agentdata.Handle.ToString(); 1113 parameters["?currentHandle"] = agentdata.Handle.ToString();
1112 parameters["?currentPos"] = "<" + ((int)agentdata.Position.X).ToString() + "," + ((int)agentdata.Position.Y).ToString() + "," + ((int)agentdata.Position.Z).ToString() + ">"; 1114 parameters["?currentPos"] = "<" + (agentdata.Position.X).ToString() + "," + (agentdata.Position.Y).ToString() + "," + (agentdata.Position.Z).ToString() + ">";
1115 parameters["?currentLookAt"] = "<" + (agentdata.LookAt.X).ToString() + "," + (agentdata.LookAt.Y).ToString() + "," + (agentdata.LookAt.Z).ToString() + ">";
1113 1116
1114 bool returnval = false; 1117 bool returnval = false;
1115 1118
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 */
27using System;
27 28
28namespace OpenSim.Framework 29namespace 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 {
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index 07b29bd..8ab9af1 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using System.Text.RegularExpressions;
32using OpenMetaverse; 33using OpenMetaverse;
33using log4net; 34using log4net;
34using Nwc.XmlRpc; 35using Nwc.XmlRpc;
@@ -127,94 +128,25 @@ namespace OpenSim.Grid.UserServer
127 /// </summary> 128 /// </summary>
128 /// <param name="response">The existing response</param> 129 /// <param name="response">The existing response</param>
129 /// <param name="theUser">The user profile</param> 130 /// <param name="theUser">The user profile</param>
130 /// <param name="startLocationRequest">Destination of the user</param> 131 /// <param name="startLocationRequest">The requested start location</param>
131 public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, 132 public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
132 string startLocationRequest)
133 { 133 {
134 RegionProfileData SimInfo; 134 // HomeLocation
135 RegionProfileData HomeInfo; 135 RegionProfileData homeInfo = null;
136 int start_x = -1;
137 int start_y = -1;
138 int start_z = -1;
139
140 // use the homeRegionID if it is stored already. If not, use the regionHandle as before 136 // use the homeRegionID if it is stored already. If not, use the regionHandle as before
141 if (theUser.HomeRegionID != UUID.Zero) 137 if (theUser.HomeRegionID != UUID.Zero)
142 { 138 homeInfo = RegionProfileData.RequestSimProfileData(theUser.HomeRegionID,
143 HomeInfo = 139 m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
144 RegionProfileData.RequestSimProfileData(
145 theUser.HomeRegionID, m_config.GridServerURL,
146 m_config.GridSendKey, m_config.GridRecvKey);
147 }
148 else 140 else
149 { 141 homeInfo = RegionProfileData.RequestSimProfileData(theUser.HomeRegion,
150 HomeInfo = 142 m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
151 RegionProfileData.RequestSimProfileData( 143 if (homeInfo != null)
152 theUser.HomeRegion, m_config.GridServerURL,
153 m_config.GridSendKey, m_config.GridRecvKey);
154 }
155
156 if (startLocationRequest == "last")
157 {
158 SimInfo =
159 RegionProfileData.RequestSimProfileData(
160 theUser.CurrentAgent.Handle, m_config.GridServerURL,
161 m_config.GridSendKey, m_config.GridRecvKey);
162 }
163 else if (startLocationRequest == "home")
164 {
165 SimInfo = HomeInfo;
166 }
167 else
168 {
169 string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest);
170 m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" +
171 startLocationRequestParsed[1] + ", 3:" + startLocationRequestParsed[2] + ", 4:" +
172 startLocationRequestParsed[3]);
173 if (startLocationRequestParsed[0] == "last")
174 {
175 SimInfo =
176 RegionProfileData.RequestSimProfileData(
177 theUser.CurrentAgent.Handle, m_config.GridServerURL,
178 m_config.GridSendKey, m_config.GridRecvKey);
179 }
180 else
181 {
182 m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]);
183 SimInfo =
184 RegionProfileData.RequestSimProfileData(
185 startLocationRequestParsed[0], m_config.GridServerURL,
186 m_config.GridSendKey, m_config.GridRecvKey);
187
188 if (SimInfo == null)
189 {
190 m_log.Info("[LOGIN]: Didn't find region with a close name match sending to home location");
191 SimInfo = HomeInfo;
192 }
193 else
194 {
195 start_x = Convert.ToInt32(startLocationRequestParsed[1]);
196 start_y = Convert.ToInt32(startLocationRequestParsed[2]);
197 start_z = Convert.ToInt32(startLocationRequestParsed[3]);
198
199 if (start_x >= 0 && start_y >= 0 && start_z >= 0)
200 {
201 Vector3 tmp_v = new Vector3(start_x, start_y, start_z);
202 theUser.CurrentAgent.Position = tmp_v;
203 }
204 }
205 }
206 }
207
208 // Customise the response
209 //CFK: This is redundant and the next message should always appear.
210 //CFK: m_log.Info("[LOGIN]: Home Location");
211 if (HomeInfo != null)
212 { 144 {
213 response.Home = 145 response.Home =
214 string.Format( 146 string.Format(
215 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", 147 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
216 (HomeInfo.regionLocX*Constants.RegionSize), 148 (homeInfo.regionLocX*Constants.RegionSize),
217 (HomeInfo.regionLocY*Constants.RegionSize), 149 (homeInfo.regionLocY*Constants.RegionSize),
218 theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z, 150 theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
219 theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); 151 theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
220 } 152 }
@@ -236,42 +168,85 @@ namespace OpenSim.Grid.UserServer
236 regionX, regionY); 168 regionX, regionY);
237 } 169 }
238 170
239 if (!PrepareLoginToRegion(SimInfo, theUser, response)) 171 // StartLocation
172 RegionProfileData regionInfo = null;
173 if (startLocationRequest == "home")
240 { 174 {
241 // Send him to default region instead 175 regionInfo = homeInfo;
242 // Load information from the gridserver 176 theUser.CurrentAgent.Position = theUser.HomeLocation;
243 ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) | 177 response.LookAt = "[r" + theUser.HomeLookAt.X.ToString() + ",r" + theUser.HomeLookAt.Y.ToString() + ",r" + theUser.HomeLookAt.Z.ToString() + "]";
244 ((ulong) m_config.DefaultY * Constants.RegionSize); 178 }
245 179 else if (startLocationRequest == "last")
246 if (defaultHandle == SimInfo.regionHandle) 180 {
181 regionInfo = RegionProfileData.RequestSimProfileData(theUser.CurrentAgent.Region,
182 m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
183 response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]";
184 }
185 else
186 {
187 Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$");
188 Match uriMatch = reURI.Match(startLocationRequest);
189 if (uriMatch == null)
247 { 190 {
248 m_log.ErrorFormat("[LOGIN]: Not trying the default region since this is the same as the selected region"); 191 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, but can't process it", startLocationRequest);
249 return false;
250 } 192 }
193 else
194 {
195 string region = uriMatch.Groups["region"].ToString();
196 regionInfo = RegionProfileData.RequestSimProfileData(region,
197 m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
198 if (regionInfo == null)
199 {
200 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region);
201 }
202 else
203 {
204 theUser.CurrentAgent.Position = new Vector3(float.Parse(uriMatch.Groups["x"].Value),
205 float.Parse(uriMatch.Groups["y"].Value), float.Parse(uriMatch.Groups["x"].Value));
206 }
207 }
208 response.LookAt = "[r0,r1,r0]";
209 // can be: last, home, safe, url
210 response.StartLocation = "url";
211 }
251 212
252 m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); 213 if ((regionInfo != null) && (PrepareLoginToRegion(regionInfo, theUser, response)))
214 {
215 return true;
216 }
253 217
254 SimInfo = RegionProfileData.RequestSimProfileData(defaultHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); 218 // StartLocation not available, send him to a nearby region instead
219 //regionInfo = RegionProfileData.RequestSimProfileData("", m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
220 //m_log.InfoFormat("[LOGIN]: StartLocation not available sending to region {0}", regionInfo.regionName);
255 221
256 // Customise the response 222 // Send him to default region instead
257 response.Home = 223 // Load information from the gridserver
258 string.Format( 224 ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) |
259 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", 225 ((ulong) m_config.DefaultY * Constants.RegionSize);
260 (SimInfo.regionLocX * Constants.RegionSize),
261 (SimInfo.regionLocY*Constants.RegionSize),
262 theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
263 theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
264 226
265 if (!PrepareLoginToRegion(SimInfo, theUser, response)) 227 if ((regionInfo != null) && (defaultHandle == regionInfo.regionHandle))
266 { 228 {
267 response.CreateDeadRegionResponse(); 229 m_log.ErrorFormat("[LOGIN]: Not trying the default region since this is the same as the selected region");
268 return false; 230 return false;
269 }
270 } 231 }
271 232
272 return true; 233 m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead");
273 } 234 regionInfo = RegionProfileData.RequestSimProfileData(defaultHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
274 235
236 // Customise the response
237 //response.Home =
238 // string.Format(
239 // "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
240 // (SimInfo.regionLocX * Constants.RegionSize),
241 // (SimInfo.regionLocY*Constants.RegionSize),
242 // theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
243 // theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
244 theUser.CurrentAgent.Position = new Vector3(128,128,0);
245 response.StartLocation = "safe";
246
247 return PrepareLoginToRegion(regionInfo, theUser, response);
248 }
249
275 /// <summary> 250 /// <summary>
276 /// Prepare a login to the given region. This involves both telling the region to expect a connection 251 /// Prepare a login to the given region. This involves both telling the region to expect a connection
277 /// and appropriately customising the response to the user. 252 /// and appropriately customising the response to the user.
@@ -280,47 +255,46 @@ namespace OpenSim.Grid.UserServer
280 /// <param name="user"></param> 255 /// <param name="user"></param>
281 /// <param name="response"></param> 256 /// <param name="response"></param>
282 /// <returns>true if the region was successfully contacted, false otherwise</returns> 257 /// <returns>true if the region was successfully contacted, false otherwise</returns>
283 private bool PrepareLoginToRegion(RegionProfileData sim, UserProfileData user, LoginResponse response) 258 private bool PrepareLoginToRegion(RegionProfileData regionInfo, UserProfileData user, LoginResponse response)
284 { 259 {
285 try 260 try
286 { 261 {
287 response.SimAddress = Util.GetHostFromURL(sim.serverURI).ToString(); 262 response.SimAddress = Util.GetHostFromURL(regionInfo.serverURI).ToString();
288 response.SimPort = uint.Parse(sim.serverURI.Split(new char[] {'/', ':'})[4]); 263 response.SimPort = uint.Parse(regionInfo.serverURI.Split(new char[] { '/', ':' })[4]);
289 response.RegionX = sim.regionLocX; 264 response.RegionX = regionInfo.regionLocX;
290 response.RegionY = sim.regionLocY; 265 response.RegionY = regionInfo.regionLocY;
291 266
292 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI 267 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
293 string capsPath = Util.GetRandomCapsPath(); 268 string capsPath = Util.GetRandomCapsPath();
294 response.SeedCapability = sim.httpServerURI + "CAPS/" + capsPath + "0000/"; 269 response.SeedCapability = regionInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
295 270
296 // Notify the target of an incoming user 271 // Notify the target of an incoming user
297 m_log.InfoFormat( 272 m_log.InfoFormat(
298 "[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection", 273 "[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection",
299 sim.regionName, sim.regionLocX, sim.regionLocY, sim.serverURI); 274 regionInfo.regionName, response.RegionX, response.RegionY, regionInfo.httpServerURI);
300
301 // Update agent with target sim 275 // Update agent with target sim
302 user.CurrentAgent.Region = sim.UUID; 276 user.CurrentAgent.Region = regionInfo.UUID;
303 user.CurrentAgent.Handle = sim.regionHandle; 277 user.CurrentAgent.Handle = regionInfo.regionHandle;
304
305 // Prepare notification 278 // Prepare notification
306 Hashtable SimParams = new Hashtable(); 279 Hashtable loginParams = new Hashtable();
307 SimParams["session_id"] = user.CurrentAgent.SessionID.ToString(); 280 loginParams["session_id"] = user.CurrentAgent.SessionID.ToString();
308 SimParams["secure_session_id"] = user.CurrentAgent.SecureSessionID.ToString(); 281 loginParams["secure_session_id"] = user.CurrentAgent.SecureSessionID.ToString();
309 SimParams["firstname"] = user.FirstName; 282 loginParams["firstname"] = user.FirstName;
310 SimParams["lastname"] = user.SurName; 283 loginParams["lastname"] = user.SurName;
311 SimParams["agent_id"] = user.ID.ToString(); 284 loginParams["agent_id"] = user.ID.ToString();
312 SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode); 285 loginParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode);
313 SimParams["startpos_x"] = user.CurrentAgent.Position.X.ToString(); 286 loginParams["startpos_x"] = user.CurrentAgent.Position.X.ToString();
314 SimParams["startpos_y"] = user.CurrentAgent.Position.Y.ToString(); 287 loginParams["startpos_y"] = user.CurrentAgent.Position.Y.ToString();
315 SimParams["startpos_z"] = user.CurrentAgent.Position.Z.ToString(); 288 loginParams["startpos_z"] = user.CurrentAgent.Position.Z.ToString();
316 SimParams["regionhandle"] = user.CurrentAgent.Handle.ToString(); 289 loginParams["regionhandle"] = user.CurrentAgent.Handle.ToString();
317 SimParams["caps_path"] = capsPath; 290 loginParams["caps_path"] = capsPath;
291
318 ArrayList SendParams = new ArrayList(); 292 ArrayList SendParams = new ArrayList();
319 SendParams.Add(SimParams); 293 SendParams.Add(loginParams);
320 294
321 // Send 295 // Send
322 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); 296 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
323 XmlRpcResponse GridResp = GridReq.Send(sim.httpServerURI, 30000); 297 XmlRpcResponse GridResp = GridReq.Send(regionInfo.httpServerURI, 6000);
324 298
325 if (!GridResp.IsFault) 299 if (!GridResp.IsFault)
326 { 300 {
@@ -337,7 +311,6 @@ namespace OpenSim.Grid.UserServer
337 } 311 }
338 } 312 }
339 } 313 }
340
341 if (responseSuccess) 314 if (responseSuccess)
342 { 315 {
343 handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; 316 handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation;
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 93a1e46..2f7fdb7 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -41,8 +41,7 @@ namespace OpenSim.Region.Communications.Local
41 41
42 public class LocalLoginService : LoginService 42 public class LocalLoginService : LoginService
43 { 43 {
44 private static readonly ILog m_log 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 45
47 private CommunicationsLocal m_Parent; 46 private CommunicationsLocal m_Parent;
48 47
@@ -120,167 +119,167 @@ namespace OpenSim.Region.Communications.Local
120 } 119 }
121 } 120 }
122 121
123 private Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$"); 122 /// <summary>
124 123 /// Customises the login response and fills in missing values.
124 /// </summary>
125 /// <param name="response">The existing response</param>
126 /// <param name="theUser">The user profile</param>
127 /// <param name="startLocationRequest">The requested start location</param>
125 public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest) 128 public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
126 { 129 {
127 ulong currentRegion = 0; 130 // HomeLocation
128 131 RegionInfo homeInfo = null;
129 uint locX = 0; 132 // use the homeRegionID if it is stored already. If not, use the regionHandle as before
130 uint locY = 0; 133 if (theUser.HomeRegionID != UUID.Zero)
131 uint locZ = 0; 134 homeInfo = m_Parent.GridService.RequestNeighbourInfo(theUser.HomeRegionID);
132 bool specificStartLocation = false; 135 else
136 homeInfo = m_Parent.GridService.RequestNeighbourInfo(theUser.HomeRegion);
137 if (homeInfo != null)
138 {
139 response.Home =
140 string.Format(
141 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
142 (homeInfo.RegionLocX*Constants.RegionSize),
143 (homeInfo.RegionLocY*Constants.RegionSize),
144 theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
145 theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
146 }
147 else
148 {
149 // Emergency mode: Home-region isn't available, so we can't request the region info.
150 // Use the stored home regionHandle instead.
151 // NOTE: If the home-region moves, this will be wrong until the users update their user-profile again
152 ulong regionX = theUser.HomeRegion >> 32;
153 ulong regionY = theUser.HomeRegion & 0xffffffff;
154 response.Home =
155 string.Format(
156 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
157 regionX, regionY,
158 theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
159 theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
160 m_log.InfoFormat("[LOGIN] Home region of user {0} {1} is not available; using computed region position {2} {3}",
161 theUser.FirstName, theUser.SurName,
162 regionX, regionY);
163 }
133 164
134 // get start location 165 // StartLocation
135 if (startLocationRequest == "last") 166 RegionInfo regionInfo = null;
167 if (startLocationRequest == "home")
136 { 168 {
137 currentRegion = theUser.CurrentAgent.Handle; 169 regionInfo = homeInfo;
138 locX = (UInt32)theUser.CurrentAgent.Position.X; 170 theUser.CurrentAgent.Position = theUser.HomeLocation;
139 locY = (UInt32)theUser.CurrentAgent.Position.Y; 171 response.LookAt = "[r" + theUser.HomeLookAt.X.ToString() + ",r" + theUser.HomeLookAt.Y.ToString() + ",r" + theUser.HomeLookAt.Z.ToString() + "]";
140 locZ = (UInt32)theUser.CurrentAgent.Position.Z;
141 response.StartLocation = "last";
142 specificStartLocation = true;
143 } 172 }
144 else if (startLocationRequest == "home") 173 else if (startLocationRequest == "last")
145 { 174 {
146 currentRegion = theUser.HomeRegion; 175 regionInfo = m_Parent.GridService.RequestNeighbourInfo(theUser.CurrentAgent.Region);
147 response.StartLocation = "home"; 176 response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]";
148 } 177 }
149 else 178 else
150 { 179 {
151 // use last location as default 180 Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$");
152 currentRegion = theUser.CurrentAgent.Handle;
153
154 Match uriMatch = reURI.Match(startLocationRequest); 181 Match uriMatch = reURI.Match(startLocationRequest);
155 if (null == uriMatch) 182 if (uriMatch == null)
156 { 183 {
157 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, but can't process it", startLocationRequest); 184 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, but can't process it", startLocationRequest);
158 } 185 }
159 else 186 else
160 { 187 {
161 string region = uriMatch.Groups["region"].ToString(); 188 string region = uriMatch.Groups["region"].ToString();
162 189 regionInfo = m_Parent.GridService.RequestClosestRegion(region);
163 RegionInfo r = m_Parent.GridService.RequestClosestRegion(region); 190 if (regionInfo == null)
164 if (null == r)
165 { 191 {
166 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", 192 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region);
167 startLocationRequest, region);
168 } 193 }
169 else 194 else
170 { 195 {
171 currentRegion = r.RegionHandle; 196 theUser.CurrentAgent.Position = new Vector3(float.Parse(uriMatch.Groups["x"].Value),
172 locX = UInt32.Parse(uriMatch.Groups["x"].ToString()); 197 float.Parse(uriMatch.Groups["y"].Value), float.Parse(uriMatch.Groups["x"].Value));
173 locY = UInt32.Parse(uriMatch.Groups["y"].ToString());
174 locZ = UInt32.Parse(uriMatch.Groups["z"].ToString());
175 // can be: last, home, safe, url
176 response.StartLocation = "url";
177 specificStartLocation = true;
178 } 198 }
179 } 199 }
200 response.LookAt = "[r0,r1,r0]";
201 // can be: last, home, safe, url
202 response.StartLocation = "url";
180 } 203 }
181 204
182 RegionInfo homeReg = m_Parent.GridService.RequestNeighbourInfo(theUser.HomeRegion); 205 if ((regionInfo != null) && (PrepareLoginToRegion(regionInfo, theUser, response)))
183 RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion);
184
185 if ((homeReg != null) || (reg != null))
186 { 206 {
187 if (homeReg != null) 207 return true;
188 { 208 }
189 response.Home = "{'region_handle':[r" +
190 (homeReg.RegionLocX * Constants.RegionSize).ToString() + ",r" +
191 (homeReg.RegionLocY * Constants.RegionSize).ToString() + "], " +
192 "'position':[r" +
193 theUser.HomeLocation.X.ToString() + ",r" +
194 theUser.HomeLocation.Y.ToString() + ",r" +
195 theUser.HomeLocation.Z.ToString() + "], " +
196 "'look_at':[r" +
197 theUser.HomeLocation.X.ToString() + ",r" +
198 theUser.HomeLocation.Y.ToString() + ",r" +
199 theUser.HomeLocation.Z.ToString() + "]}";
200 }
201 else
202 {
203 m_log.Warn("[LOGIN]: Your home region doesn't exist");
204 response.Home = "{'region_handle':[r" +
205 (reg.RegionLocX * Constants.RegionSize).ToString() + ",r" +
206 (reg.RegionLocY * Constants.RegionSize).ToString() + "], " +
207 "'position':[r" +
208 theUser.HomeLocation.X.ToString() + ",r" +
209 theUser.HomeLocation.Y.ToString() + ",r" +
210 theUser.HomeLocation.Z.ToString() + "], " +
211 "'look_at':[r" +
212 theUser.HomeLocation.X.ToString() + ",r" +
213 theUser.HomeLocation.Y.ToString() + ",r" +
214 theUser.HomeLocation.Z.ToString() + "]}";
215 }
216 string capsPath = Util.GetRandomCapsPath();
217 response.SimAddress = reg.ExternalEndPoint.Address.ToString();
218 response.SimPort = (uint) reg.ExternalEndPoint.Port;
219 response.RegionX = reg.RegionLocX;
220 response.RegionY = reg.RegionLocY;
221
222 m_log.DebugFormat(
223 "[CAPS][LOGIN]: RegionX {0} RegionY {0}", response.RegionX, response.RegionY);
224
225 response.SeedCapability = "http://" + reg.ExternalHostName + ":" +
226 serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
227
228 m_log.DebugFormat(
229 "[CAPS]: Sending new CAPS seed url {0} to client {1}",
230 response.SeedCapability, response.AgentID);
231
232 theUser.CurrentAgent.Region = reg.RegionID;
233 theUser.CurrentAgent.Handle = reg.RegionHandle;
234
235 // LoginResponse.BuddyList buddyList = new LoginResponse.BuddyList();
236
237 response.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(theUser.ID));
238
239 Login _login = new Login();
240 //copy data to login object
241 _login.First = response.Firstname;
242 _login.Last = response.Lastname;
243 _login.Agent = response.AgentID;
244 _login.Session = response.SessionID;
245 _login.SecureSession = response.SecureSessionID;
246 _login.CircuitCode = (uint) response.CircuitCode;
247 if (specificStartLocation)
248 _login.StartPos = new Vector3(locX, locY, locZ);
249 else
250 _login.StartPos = new Vector3(128, 128, 128);
251 _login.CapsPath = capsPath;
252 209
253 m_log.InfoFormat( 210 // StartLocation not available, send him to a nearby region instead
254 "[LOGIN]: Telling region {0} @ {1},{2} ({3}:{4}) to expect user connection", 211 // regionInfo = m_Parent.GridService.RequestClosestRegion("");
255 reg.RegionName, response.RegionX, response.RegionY, response.SimAddress, response.SimPort); 212 //m_log.InfoFormat("[LOGIN]: StartLocation not available sending to region {0}", regionInfo.regionName);
256 213
257 handlerLoginToRegion = OnLoginToRegion; 214 // Send him to default region instead
258 if (handlerLoginToRegion != null) 215 ulong defaultHandle = (((ulong)defaultHomeX * Constants.RegionSize) << 32) |
259 { 216 ((ulong)defaultHomeY * Constants.RegionSize);
260 handlerLoginToRegion(currentRegion, _login); 217
261 } 218 if ((regionInfo != null) && (defaultHandle == regionInfo.RegionHandle))
262 }
263 else
264 { 219 {
265 m_log.Warn("[LOGIN]: Not found region " + currentRegion); 220 m_log.ErrorFormat("[LOGIN]: Not trying the default region since this is the same as the selected region");
266 return false; 221 return false;
267 } 222 }
268 223
269 return true; 224 m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead");
225 regionInfo = m_Parent.GridService.RequestNeighbourInfo(defaultHandle);
226
227 // Customise the response
228 //response.Home =
229 // string.Format(
230 // "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
231 // (SimInfo.regionLocX * Constants.RegionSize),
232 // (SimInfo.regionLocY*Constants.RegionSize),
233 // theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
234 // theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
235 theUser.CurrentAgent.Position = new Vector3(128,128,0);
236 response.StartLocation = "safe";
237
238 return PrepareLoginToRegion(regionInfo, theUser, response);
270 } 239 }
271 240
272 private LoginResponse.BuddyList ConvertFriendListItem(List<FriendListItem> LFL) 241 /// <summary>
242 /// Prepare a login to the given region. This involves both telling the region to expect a connection
243 /// and appropriately customising the response to the user.
244 /// </summary>
245 /// <param name="sim"></param>
246 /// <param name="user"></param>
247 /// <param name="response"></param>
248 /// <returns>true if the region was successfully contacted, false otherwise</returns>
249 private bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response)
273 { 250 {
274 LoginResponse.BuddyList buddylistreturn = new LoginResponse.BuddyList(); 251 response.SimAddress = regionInfo.ExternalEndPoint.Address.ToString();
275 foreach (FriendListItem fl in LFL) 252 response.SimPort = (uint)regionInfo.ExternalEndPoint.Port;
276 { 253 response.RegionX = regionInfo.RegionLocX;
277 LoginResponse.BuddyList.BuddyInfo buddyitem = new LoginResponse.BuddyList.BuddyInfo(fl.Friend); 254 response.RegionY = regionInfo.RegionLocY;
278 buddyitem.BuddyID = fl.Friend; 255
279 buddyitem.BuddyRightsHave = (int)fl.FriendListOwnerPerms; 256 string capsPath = Util.GetRandomCapsPath();
280 buddyitem.BuddyRightsGiven = (int)fl.FriendPerms; 257 response.SeedCapability = regionInfo.ServerURI + "/CAPS/" + capsPath + "0000/";
281 buddylistreturn.AddNewBuddy(buddyitem); 258
282 } 259 // Notify the target of an incoming user
283 return buddylistreturn; 260 m_log.InfoFormat(
261 "[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection",
262 regionInfo.RegionName, response.RegionX, response.RegionY, regionInfo.ServerURI);
263 // Update agent with target sim
264 user.CurrentAgent.Region = regionInfo.RegionID;
265 user.CurrentAgent.Handle = regionInfo.RegionHandle;
266 // Prepare notification
267 Login loginParams = new Login();
268 loginParams.Session = user.CurrentAgent.SessionID.ToString();
269 loginParams.SecureSession = user.CurrentAgent.SecureSessionID.ToString();
270 loginParams.First = user.FirstName;
271 loginParams.Last = user.SurName;
272 loginParams.Agent = user.ID.ToString();
273 loginParams.CircuitCode = Convert.ToUInt32(response.CircuitCode);
274 loginParams.StartPos = user.CurrentAgent.Position;
275 loginParams.CapsPath = capsPath;
276
277 handlerLoginToRegion = OnLoginToRegion;
278 if (handlerLoginToRegion == null)
279 return false;
280
281 handlerLoginToRegion(user.CurrentAgent.Handle, loginParams);
282 return true;
284 } 283 }
285 284
286 // See LoginService 285 // See LoginService
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 36a82a8..b8268eb 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -235,19 +235,22 @@ namespace OpenSim.Region.Communications.OGS1
235 /// Logs off a user on the user server 235 /// Logs off a user on the user server
236 /// </summary> 236 /// </summary>
237 /// <param name="UserID">UUID of the user</param> 237 /// <param name="UserID">UUID of the user</param>
238 /// <param name="regionData">UUID of the Region</param> 238 /// <param name="regionID">UUID of the Region</param>
239 /// <param name="posx">final position x</param> 239 /// <param name="regionhandle">regionhandle</param>
240 /// <param name="posy">final position y</param> 240 /// <param name="position">final position</param>
241 /// <param name="posz">final position z</param> 241 /// <param name="lookat">final lookat</param>
242 public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) 242 public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat)
243 { 243 {
244 Hashtable param = new Hashtable(); 244 Hashtable param = new Hashtable();
245 param["avatar_uuid"] = userid.Guid.ToString(); 245 param["avatar_uuid"] = userid.Guid.ToString();
246 param["region_uuid"] = regionid.Guid.ToString(); 246 param["region_uuid"] = regionid.Guid.ToString();
247 param["region_handle"] = regionhandle.ToString(); 247 param["region_handle"] = regionhandle.ToString();
248 param["region_pos_x"] = posx.ToString(); 248 param["region_pos_x"] = position.X.ToString();
249 param["region_pos_y"] = posy.ToString(); 249 param["region_pos_y"] = position.Y.ToString();
250 param["region_pos_z"] = posz.ToString(); 250 param["region_pos_z"] = position.Z.ToString();
251 param["lookat_x"] = lookat.X.ToString();
252 param["lookat_y"] = lookat.Y.ToString();
253 param["lookat_z"] = lookat.Z.ToString();
251 254
252 IList parameters = new ArrayList(); 255 IList parameters = new ArrayList();
253 parameters.Add(param); 256 parameters.Add(param);
@@ -263,6 +266,20 @@ namespace OpenSim.Region.Communications.OGS1
263 } 266 }
264 } 267 }
265 268
269 /// <summary>
270 /// Logs off a user on the user server (deprecated as of 2008-08-27)
271 /// </summary>
272 /// <param name="UserID">UUID of the user</param>
273 /// <param name="regionID">UUID of the Region</param>
274 /// <param name="regionhandle">regionhandle</param>
275 /// <param name="posx">final position x</param>
276 /// <param name="posy">final position y</param>
277 /// <param name="posz">final position z</param>
278 public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz)
279 {
280 LogOffUser(userid, regionid, regionhandle, new Vector3(posx, posy, posz), new Vector3());
281 }
282
266 public UserProfileData GetUserProfile(string firstName, string lastName) 283 public UserProfileData GetUserProfile(string firstName, string lastName)
267 { 284 {
268 return GetUserProfile(firstName + " " + lastName); 285 return GetUserProfile(firstName + " " + lastName);
@@ -672,7 +689,7 @@ namespace OpenSim.Region.Communications.OGS1
672 } 689 }
673 } 690 }
674 /// <summary> 691 /// <summary>
675 /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner 692 /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner
676 /// </summary> 693 /// </summary>
677 /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param> 694 /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
678 public List<FriendListItem> GetUserFriendList(UUID friendlistowner) 695 public List<FriendListItem> GetUserFriendList(UUID friendlistowner)
diff --git a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
index 6d06bb5..2604b3f 100644
--- a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
@@ -322,9 +322,6 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
322 useragent.LoginTime=Util.UnixTimeSinceEpoch(); 322 useragent.LoginTime=Util.UnixTimeSinceEpoch();
323 useragent.LogoutTime = 0; 323 useragent.LogoutTime = 0;
324 useragent.Position=agentData.startpos; 324 useragent.Position=agentData.startpos;
325 useragent.PositionX=agentData.startpos.X;
326 useragent.PositionY=agentData.startpos.Y;
327 useragent.PositionZ=agentData.startpos.Z;
328 useragent.Region=reg.originRegionID; 325 useragent.Region=reg.originRegionID;
329 useragent.SecureSessionID=agentData.SecureSessionID; 326 useragent.SecureSessionID=agentData.SecureSessionID;
330 useragent.SessionID = agentData.SessionID; 327 useragent.SessionID = agentData.SessionID;
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 9ff35c0..887a8da 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -579,7 +579,7 @@ namespace OpenSim.Region.Environment.Scenes
579 /// <param name="lookAt"></param> 579 /// <param name="lookAt"></param>
580 /// <param name="flags"></param> 580 /// <param name="flags"></param>
581 public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, Vector3 position, 581 public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, Vector3 position,
582 Vector3 lookAt, uint flags) 582 Vector3 lookAt, uint teleportFlags)
583 { 583 {
584 bool destRegionUp = false; 584 bool destRegionUp = false;
585 585
@@ -604,7 +604,7 @@ namespace OpenSim.Region.Environment.Scenes
604 position.Z = newPosZ; 604 position.Z = newPosZ;
605 } 605 }
606 avatar.ControllingClient.SendTeleportLocationStart(); 606 avatar.ControllingClient.SendTeleportLocationStart();
607 avatar.ControllingClient.SendLocalTeleport(position, lookAt, flags); 607 avatar.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
608 avatar.Teleport(position); 608 avatar.Teleport(position);
609 } 609 }
610 else 610 else
@@ -662,7 +662,7 @@ namespace OpenSim.Region.Environment.Scenes
662 m_log.DebugFormat( 662 m_log.DebugFormat(
663 "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID); 663 "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
664 664
665 avatar.ControllingClient.SendRegionTeleport(reg.RegionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), 665 avatar.ControllingClient.SendRegionTeleport(reg.RegionHandle, 13, reg.ExternalEndPoint, 4, teleportFlags,
666 capsPath); 666 capsPath);
667 avatar.MakeChildAgent(); 667 avatar.MakeChildAgent();
668 Thread.Sleep(5000); 668 Thread.Sleep(5000);
@@ -716,6 +716,12 @@ namespace OpenSim.Region.Environment.Scenes
716 return m_commsProvider.GridService.GetGridSettings(); 716 return m_commsProvider.GridService.GetGridSettings();
717 } 717 }
718 718
719 public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat)
720 {
721 m_commsProvider.LogOffUser(userid, regionid, regionhandle, position, lookat);
722 }
723
724 // deprecated as of 2008-08-27
719 public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) 725 public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz)
720 { 726 {
721 m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); 727 m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 1a4b0c9..abda63e 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -241,6 +241,11 @@ namespace OpenSim.Region.Environment.Scenes
241 get { return m_CameraCenter; } 241 get { return m_CameraCenter; }
242 } 242 }
243 243
244 public Vector3 Lookat
245 {
246 get { return Util.GetNormalizedVector(new Vector3(m_CameraAtAxis.X, m_CameraAtAxis.Y, 0)); }
247 }
248
244 private readonly string m_firstname; 249 private readonly string m_firstname;
245 250
246 public string Firstname 251 public string Firstname