diff options
author | UbitUmarov | 2019-01-19 00:24:38 +0000 |
---|---|---|
committer | UbitUmarov | 2019-01-19 00:24:38 +0000 |
commit | cc19957e0af4c6a33edd8a6bfa9556b25c3c09f8 (patch) | |
tree | 1c1372c4390a54294d0c8b943aa44312be22bf10 | |
parent | a few changes to tp home (diff) | |
download | opensim-SC-cc19957e0af4c6a33edd8a6bfa9556b25c3c09f8.zip opensim-SC-cc19957e0af4c6a33edd8a6bfa9556b25c3c09f8.tar.gz opensim-SC-cc19957e0af4c6a33edd8a6bfa9556b25c3c09f8.tar.bz2 opensim-SC-cc19957e0af4c6a33edd8a6bfa9556b25c3c09f8.tar.xz |
a few more changes to tp home
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 47 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 65 |
2 files changed, 71 insertions, 41 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index ce88e6b..9471c90 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1394,30 +1394,42 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1394 | 1394 | ||
1395 | public virtual bool TeleportHome(UUID id, IClientAPI client) | 1395 | public virtual bool TeleportHome(UUID id, IClientAPI client) |
1396 | { | 1396 | { |
1397 | bool isSame = false; | 1397 | bool notsame = false; |
1398 | if (client != null && id == client.AgentId) | 1398 | if (client == null) |
1399 | { | 1399 | { |
1400 | isSame = true; | ||
1401 | m_log.DebugFormat( | 1400 | m_log.DebugFormat( |
1402 | "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, id); | 1401 | "[ENTITY TRANSFER MODULE]: Request to teleport {0} home", id); |
1403 | } | 1402 | } |
1404 | else | 1403 | else |
1405 | m_log.DebugFormat( | 1404 | { |
1406 | "[ENTITY TRANSFER MODULE]: Request to teleport {0} home by {1} {2}", id, client.Name, client.AgentId); | 1405 | if (id == client.AgentId) |
1406 | { | ||
1407 | m_log.DebugFormat( | ||
1408 | "[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, id); | ||
1409 | } | ||
1410 | else | ||
1411 | { | ||
1412 | notsame = true; | ||
1413 | m_log.DebugFormat( | ||
1414 | "[ENTITY TRANSFER MODULE]: Request to teleport {0} home by {1} {2}", id, client.Name, client.AgentId); | ||
1415 | } | ||
1416 | } | ||
1407 | 1417 | ||
1408 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(id); | 1418 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(id); |
1409 | if (sp == null || sp.IsDeleted || sp.IsChildAgent || sp.ControllingClient == null || !sp.ControllingClient.IsActive) | 1419 | if (sp == null || sp.IsDeleted || sp.IsChildAgent || sp.ControllingClient == null || !sp.ControllingClient.IsActive) |
1410 | { | 1420 | { |
1411 | if (isSame) | 1421 | if (notsame) |
1412 | client.SendTeleportFailed("Internal error, agent presence not found"); | 1422 | client.SendAlertMessage("TeleportHome: Agent not found in the scene"); |
1413 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); | 1423 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); |
1414 | return false; | 1424 | return false; |
1415 | } | 1425 | } |
1416 | 1426 | ||
1427 | IClientAPI targetClient = sp.ControllingClient; | ||
1417 | if (sp.IsInTransit) | 1428 | if (sp.IsInTransit) |
1418 | { | 1429 | { |
1419 | if (isSame) | 1430 | if (notsame) |
1420 | client.SendTeleportFailed("Already processing a teleport"); | 1431 | client.SendAlertMessage("TeleportHome: Agent already processing a teleport"); |
1432 | targetClient.SendTeleportFailed("Already processing a teleport"); | ||
1421 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Agent still in teleport"); | 1433 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Agent still in teleport"); |
1422 | return false; | 1434 | return false; |
1423 | } | 1435 | } |
@@ -1427,8 +1439,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1427 | if(uinfo == null) | 1439 | if(uinfo == null) |
1428 | { | 1440 | { |
1429 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE] Griduser info not found for {1}. Cannot send home.", id); | 1441 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE] Griduser info not found for {1}. Cannot send home.", id); |
1430 | if (isSame) | 1442 | if (notsame) |
1431 | client.SendTeleportFailed("Your home region could not be found."); | 1443 | client.SendAlertMessage("TeleportHome: Agent home region not found"); |
1444 | targetClient.SendTeleportFailed("Your home region not found"); | ||
1432 | return false; | 1445 | return false; |
1433 | } | 1446 | } |
1434 | 1447 | ||
@@ -1436,8 +1449,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1436 | { | 1449 | { |
1437 | // can't find the Home region: Tell viewer and abort | 1450 | // can't find the Home region: Tell viewer and abort |
1438 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE] no home set {0}", id); | 1451 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE] no home set {0}", id); |
1439 | if (isSame) | 1452 | if (notsame) |
1440 | client.SendTeleportFailed("home position set not"); | 1453 | client.SendAlertMessage("TeleportHome: Agent home not set"); |
1454 | targetClient.SendTeleportFailed("Home set not"); | ||
1441 | return false; | 1455 | return false; |
1442 | } | 1456 | } |
1443 | 1457 | ||
@@ -1446,8 +1460,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1446 | { | 1460 | { |
1447 | // can't find the Home region: Tell viewer and abort | 1461 | // can't find the Home region: Tell viewer and abort |
1448 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE] {0} home region {1} not found", id, uinfo.HomeRegionID); | 1462 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE] {0} home region {1} not found", id, uinfo.HomeRegionID); |
1449 | if (isSame) | 1463 | if (notsame) |
1450 | client.SendTeleportFailed("Your home region could not be found."); | 1464 | client.SendAlertMessage("TeleportHome: Agent home region not found"); |
1465 | targetClient.SendTeleportFailed("Home region not found"); | ||
1451 | return false; | 1466 | return false; |
1452 | } | 1467 | } |
1453 | 1468 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index c82d93a..c24b7b1 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -442,48 +442,70 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
442 | if (uMan != null && uMan.IsLocalGridUser(id)) | 442 | if (uMan != null && uMan.IsLocalGridUser(id)) |
443 | { | 443 | { |
444 | // local grid user | 444 | // local grid user |
445 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); | ||
446 | return base.TeleportHome(id, client); | 445 | return base.TeleportHome(id, client); |
447 | } | 446 | } |
448 | 447 | ||
449 | bool issame = false; | 448 | bool notsame = false; |
450 | if (client != null && id == client.AgentId) | 449 | if (client == null) |
451 | { | 450 | { |
452 | issame = true; | ||
453 | m_log.DebugFormat( | 451 | m_log.DebugFormat( |
454 | "[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, id); | 452 | "[HG ENTITY TRANSFER MODULE]: Request to teleport {0} home", id); |
455 | } | 453 | } |
456 | else | 454 | else |
457 | m_log.DebugFormat( | 455 | { |
458 | "[HG ENTITY TRANSFER MODULE]: Request to teleport {0} home by {1} {2}", id, client.Name, client.AgentId); | 456 | if (id == client.AgentId) |
457 | { | ||
458 | m_log.DebugFormat( | ||
459 | "[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, id); | ||
460 | } | ||
461 | else | ||
462 | { | ||
463 | notsame = true; | ||
464 | m_log.DebugFormat( | ||
465 | "[HG ENTITY TRANSFER MODULE]: Request to teleport {0} home by {1} {2}", id, client.Name, client.AgentId); | ||
466 | } | ||
467 | } | ||
459 | 468 | ||
460 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(id); | 469 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(id); |
461 | if (sp == null || sp.IsDeleted || sp.IsChildAgent || sp.ControllingClient == null || !sp.ControllingClient.IsActive) | 470 | if (sp == null || sp.IsDeleted || sp.IsChildAgent || sp.ControllingClient == null || !sp.ControllingClient.IsActive) |
462 | { | 471 | { |
463 | if (issame) | 472 | if (notsame) |
464 | client.SendTeleportFailed("Internal error, agent presence not found"); | 473 | client.SendAlertMessage("TeleportHome: Agent not found in the scene"); |
465 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene"); | 474 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene"); |
466 | return false; | 475 | return false; |
467 | } | 476 | } |
468 | 477 | ||
478 | IClientAPI targetClient = sp.ControllingClient; | ||
479 | |||
469 | if (sp.IsInTransit) | 480 | if (sp.IsInTransit) |
470 | { | 481 | { |
471 | if (issame) | 482 | if (notsame) |
472 | client.SendTeleportFailed("Already processing a teleport"); | 483 | client.SendAlertMessage("TeleportHome: Agent already processing a teleport"); |
484 | targetClient.SendTeleportFailed("Already processing a teleport"); | ||
473 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent still in teleport"); | 485 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent still in teleport"); |
474 | return false; | 486 | return false; |
475 | } | 487 | } |
476 | 488 | ||
477 | // Foreign user wants to go home | 489 | // Foreign user wants to go home |
478 | // | 490 | // |
479 | AgentCircuitData aCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 491 | AgentCircuitData aCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(targetClient.CircuitCode); |
480 | if (aCircuit == null || !aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 492 | if (aCircuit == null) |
481 | { | 493 | { |
482 | if (issame) | 494 | if (notsame) |
483 | client.SendTeleportFailed("Agent Home information has been lost"); | 495 | client.SendAlertMessage("TeleportHome: Agent information not found"); |
496 | targetClient.SendTeleportFailed("Home information not found"); | ||
484 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); | 497 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); |
485 | return false; | 498 | return false; |
486 | } | 499 | } |
500 | if (!aCircuit.ServiceURLs.ContainsKey("HomeURI")) | ||
501 | { | ||
502 | if (notsame) | ||
503 | client.SendAlertMessage("TeleportHome: Agent home not set"); | ||
504 | targetClient.SendTeleportFailed("Home not set"); | ||
505 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent home not set"); | ||
506 | return false; | ||
507 | } | ||
508 | |||
487 | string homeURI = aCircuit.ServiceURLs["HomeURI"].ToString(); | 509 | string homeURI = aCircuit.ServiceURLs["HomeURI"].ToString(); |
488 | 510 | ||
489 | IUserAgentService userAgentService = new UserAgentServiceConnector(homeURI); | 511 | IUserAgentService userAgentService = new UserAgentServiceConnector(homeURI); |
@@ -501,20 +523,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
501 | 523 | ||
502 | if (finalDestination == null) | 524 | if (finalDestination == null) |
503 | { | 525 | { |
504 | if (issame) | 526 | if (notsame) |
505 | client.SendTeleportFailed("Home region could not be found"); | 527 | client.SendAlertMessage("TeleportHome: Agent Home region not found"); |
528 | targetClient.SendTeleportFailed("Home region not found"); | ||
506 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); | 529 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); |
507 | return false; | 530 | return false; |
508 | } | 531 | } |
509 | 532 | ||
510 | if (sp.IsDeleted || sp.IsChildAgent || sp.IsInTransit) | ||
511 | { | ||
512 | if (issame) | ||
513 | client.SendTeleportFailed("Agent lost or started other tp"); | ||
514 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent lost or started other tp"); | ||
515 | return false; | ||
516 | } | ||
517 | |||
518 | GridRegion homeGatekeeper = MakeGateKeeperRegion(homeURI); | 533 | GridRegion homeGatekeeper = MakeGateKeeperRegion(homeURI); |
519 | 534 | ||
520 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}", | 535 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}", |