diff options
author | Melanie | 2010-06-12 19:15:59 +0100 |
---|---|---|
committer | Melanie | 2010-06-12 19:15:59 +0100 |
commit | 5e4bee0f3410533461bf6c06349564d734252b22 (patch) | |
tree | 5ad0136bd5259a983b3cf42c7d5475632d162431 | |
parent | Merge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/va... (diff) | |
parent | Change name of method to better reflect what it does (diff) | |
download | opensim-SC-5e4bee0f3410533461bf6c06349564d734252b22.zip opensim-SC-5e4bee0f3410533461bf6c06349564d734252b22.tar.gz opensim-SC-5e4bee0f3410533461bf6c06349564d734252b22.tar.bz2 opensim-SC-5e4bee0f3410533461bf6c06349564d734252b22.tar.xz |
Merge branch 'master' into careminster-presence-refactor
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 139 |
2 files changed, 80 insertions, 61 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 5e2c04c..3fcc0e8 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1132,7 +1132,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1132 | string reason = String.Empty; | 1132 | string reason = String.Empty; |
1133 | 1133 | ||
1134 | 1134 | ||
1135 | bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, 0, out reason); // m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, 0, out reason); | 1135 | bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); |
1136 | 1136 | ||
1137 | if (regionAccepted && newAgent) | 1137 | if (regionAccepted && newAgent) |
1138 | { | 1138 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7bea166..b58bfb8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2508,7 +2508,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2508 | 2508 | ||
2509 | 2509 | ||
2510 | /// <summary> | 2510 | /// <summary> |
2511 | /// Called when objects or attachments cross the border between regions. | 2511 | /// Called when objects or attachments cross the border, or teleport, between regions. |
2512 | /// </summary> | 2512 | /// </summary> |
2513 | /// <param name="sog"></param> | 2513 | /// <param name="sog"></param> |
2514 | /// <returns></returns> | 2514 | /// <returns></returns> |
@@ -2538,6 +2538,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2538 | 2538 | ||
2539 | // Do this as late as possible so that listeners have full access to the incoming object | 2539 | // Do this as late as possible so that listeners have full access to the incoming object |
2540 | EventManager.TriggerOnIncomingSceneObject(newObject); | 2540 | EventManager.TriggerOnIncomingSceneObject(newObject); |
2541 | |||
2542 | TriggerChangedTeleport(newObject); | ||
2541 | 2543 | ||
2542 | return true; | 2544 | return true; |
2543 | } | 2545 | } |
@@ -2605,22 +2607,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2605 | // Fix up attachment Parent Local ID | 2607 | // Fix up attachment Parent Local ID |
2606 | ScenePresence sp = GetScenePresence(sceneObject.OwnerID); | 2608 | ScenePresence sp = GetScenePresence(sceneObject.OwnerID); |
2607 | 2609 | ||
2608 | //uint parentLocalID = 0; | ||
2609 | if (sp != null) | 2610 | if (sp != null) |
2610 | { | 2611 | { |
2611 | //parentLocalID = sp.LocalId; | ||
2612 | |||
2613 | //sceneObject.RootPart.IsAttachment = true; | ||
2614 | //sceneObject.RootPart.SetParentLocalId(parentLocalID); | ||
2615 | 2612 | ||
2616 | SceneObjectGroup grp = sceneObject; | 2613 | SceneObjectGroup grp = sceneObject; |
2617 | 2614 | ||
2618 | //RootPrim.SetParentLocalId(parentLocalID); | ||
2619 | |||
2620 | m_log.DebugFormat( | 2615 | m_log.DebugFormat( |
2621 | "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID); | 2616 | "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID); |
2622 | |||
2623 | //grp.SetFromAssetID(grp.RootPart.LastOwnerID); | ||
2624 | m_log.DebugFormat( | 2617 | m_log.DebugFormat( |
2625 | "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); | 2618 | "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); |
2626 | 2619 | ||
@@ -2630,7 +2623,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2630 | AttachmentsModule.AttachObject( | 2623 | AttachmentsModule.AttachObject( |
2631 | sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); | 2624 | sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); |
2632 | 2625 | ||
2633 | //grp.SendGroupFullUpdate(); | ||
2634 | } | 2626 | } |
2635 | else | 2627 | else |
2636 | { | 2628 | { |
@@ -2658,6 +2650,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2658 | 2650 | ||
2659 | return true; | 2651 | return true; |
2660 | } | 2652 | } |
2653 | |||
2654 | private void TriggerChangedTeleport(SceneObjectGroup sog) | ||
2655 | { | ||
2656 | ScenePresence sp = GetScenePresence(sog.OwnerID); | ||
2657 | |||
2658 | if (sp != null) | ||
2659 | { | ||
2660 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(sp.UUID); | ||
2661 | |||
2662 | if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default)) | ||
2663 | { | ||
2664 | // This will get your attention | ||
2665 | //m_log.Error("[XXX] Triggering "); | ||
2666 | |||
2667 | // Trigger CHANGED_TELEPORT | ||
2668 | sp.Scene.EventManager.TriggerOnScriptChangedEvent(sog.LocalId, (uint)Changed.TELEPORT); | ||
2669 | } | ||
2670 | |||
2671 | } | ||
2672 | } | ||
2673 | |||
2661 | #endregion | 2674 | #endregion |
2662 | 2675 | ||
2663 | #region Add/Remove Avatar Methods | 2676 | #region Add/Remove Avatar Methods |
@@ -3465,6 +3478,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3465 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) | 3478 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) |
3466 | { | 3479 | { |
3467 | TeleportFlags tp = (TeleportFlags)teleportFlags; | 3480 | TeleportFlags tp = (TeleportFlags)teleportFlags; |
3481 | reason = String.Empty; | ||
3482 | |||
3468 | //Teleport flags: | 3483 | //Teleport flags: |
3469 | // | 3484 | // |
3470 | // TeleportFlags.ViaGodlikeLure - Border Crossing | 3485 | // TeleportFlags.ViaGodlikeLure - Border Crossing |
@@ -3472,52 +3487,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
3472 | // TeleportFlags.TeleportFlags.ViaLure - Teleport request sent by another user | 3487 | // TeleportFlags.TeleportFlags.ViaLure - Teleport request sent by another user |
3473 | // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport | 3488 | // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport |
3474 | 3489 | ||
3475 | |||
3476 | if (LoginsDisabled) | ||
3477 | { | ||
3478 | reason = "Logins Disabled"; | ||
3479 | return false; | ||
3480 | } | ||
3481 | // Don't disable this log message - it's too helpful | 3490 | // Don't disable this log message - it's too helpful |
3482 | m_log.InfoFormat( | 3491 | m_log.InfoFormat( |
3483 | "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})", | 3492 | "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})", |
3484 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3493 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3485 | agent.AgentID, agent.circuitcode, teleportFlags); | 3494 | agent.AgentID, agent.circuitcode, teleportFlags); |
3486 | 3495 | ||
3487 | reason = String.Empty; | 3496 | if (LoginsDisabled) |
3488 | try | ||
3489 | { | ||
3490 | if (!VerifyUserPresence(agent, out reason)) | ||
3491 | return false; | ||
3492 | } | ||
3493 | catch (Exception e) | ||
3494 | { | 3497 | { |
3495 | m_log.DebugFormat("[CONNECTION BEGIN]: Exception verifying presence {0}", e.Message); | 3498 | reason = "Logins Disabled"; |
3496 | return false; | 3499 | return false; |
3497 | } | 3500 | } |
3498 | 3501 | ||
3499 | try | 3502 | ScenePresence sp = GetScenePresence(agent.AgentID); |
3500 | { | 3503 | |
3501 | if (!AuthorizeUser(agent, out reason)) | 3504 | if (sp != null && !sp.IsChildAgent) |
3502 | return false; | ||
3503 | } | ||
3504 | catch (Exception e) | ||
3505 | { | 3505 | { |
3506 | m_log.DebugFormat("[CONNECTION BEGIN]: Exception authorizing user {0}", e.Message); | 3506 | // We have a zombie from a crashed session. |
3507 | return false; | 3507 | // Or the same user is trying to be root twice here, won't work. |
3508 | // Kill it. | ||
3509 | m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName); | ||
3510 | sp.ControllingClient.Close(); | ||
3511 | sp = null; | ||
3508 | } | 3512 | } |
3509 | 3513 | ||
3510 | m_log.InfoFormat( | ||
3511 | "[CONNECTION BEGIN]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | ||
3512 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | ||
3513 | agent.AgentID, agent.circuitcode); | ||
3514 | |||
3515 | CapsModule.NewUserConnection(agent); | ||
3516 | |||
3517 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | 3514 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); |
3518 | 3515 | ||
3519 | //On login or border crossing test land permisions | 3516 | //On login test land permisions |
3520 | if (tp != TeleportFlags.Default) | 3517 | if (tp == TeleportFlags.ViaLogin) |
3521 | { | 3518 | { |
3522 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3519 | if (land != null && !TestLandRestrictions(agent, land, out reason)) |
3523 | { | 3520 | { |
@@ -3525,8 +3522,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
3525 | } | 3522 | } |
3526 | } | 3523 | } |
3527 | 3524 | ||
3528 | ScenePresence sp = GetScenePresence(agent.AgentID); | 3525 | if (sp == null) // We don't have an [child] agent here already |
3529 | if (sp != null) | 3526 | { |
3527 | |||
3528 | try | ||
3529 | { | ||
3530 | if (!VerifyUserPresence(agent, out reason)) | ||
3531 | return false; | ||
3532 | } | ||
3533 | catch (Exception e) | ||
3534 | { | ||
3535 | m_log.DebugFormat("[CONNECTION BEGIN]: Exception verifying presence {0}", e.Message); | ||
3536 | return false; | ||
3537 | } | ||
3538 | |||
3539 | try | ||
3540 | { | ||
3541 | if (!AuthorizeUser(agent, out reason)) | ||
3542 | return false; | ||
3543 | } | ||
3544 | catch (Exception e) | ||
3545 | { | ||
3546 | m_log.DebugFormat("[CONNECTION BEGIN]: Exception authorizing user {0}", e.Message); | ||
3547 | return false; | ||
3548 | } | ||
3549 | |||
3550 | m_log.InfoFormat( | ||
3551 | "[CONNECTION BEGIN]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | ||
3552 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | ||
3553 | agent.AgentID, agent.circuitcode); | ||
3554 | |||
3555 | CapsModule.NewUserConnection(agent); | ||
3556 | CapsModule.AddCapsHandler(agent.AgentID); | ||
3557 | } | ||
3558 | else | ||
3530 | { | 3559 | { |
3531 | if (sp.IsChildAgent) | 3560 | if (sp.IsChildAgent) |
3532 | { | 3561 | { |
@@ -3535,25 +3564,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3535 | agent.AgentID, RegionInfo.RegionName); | 3564 | agent.AgentID, RegionInfo.RegionName); |
3536 | 3565 | ||
3537 | sp.AdjustKnownSeeds(); | 3566 | sp.AdjustKnownSeeds(); |
3538 | 3567 | CapsModule.NewUserConnection(agent); | |
3539 | return true; | ||
3540 | } | ||
3541 | else | ||
3542 | { | ||
3543 | // We have a zombie from a crashed session. Kill it. | ||
3544 | m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName); | ||
3545 | sp.ControllingClient.Close(false); | ||
3546 | } | 3568 | } |
3547 | } | 3569 | } |
3548 | 3570 | ||
3549 | CapsModule.AddCapsHandler(agent.AgentID); | ||
3550 | 3571 | ||
3551 | if ((teleportFlags & ((uint)TeleportFlags.ViaLandmark | (uint)TeleportFlags.ViaLocation | (uint)TeleportFlags.ViaLandmark | (uint)TeleportFlags.Default)) != 0) | 3572 | // In all cases, add or update the circuit data with the new agent circuit data and teleport flags |
3552 | System.Threading.Thread.Sleep(2000); | 3573 | agent.teleportFlags = teleportFlags; |
3574 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | ||
3553 | 3575 | ||
3554 | if (!agent.child) | 3576 | if (tp == TeleportFlags.ViaLogin) |
3555 | { | 3577 | { |
3556 | if (TestBorderCross(agent.startpos,Cardinals.E)) | 3578 | if (TestBorderCross(agent.startpos, Cardinals.E)) |
3557 | { | 3579 | { |
3558 | Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); | 3580 | Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); |
3559 | agent.startpos.X = crossedBorder.BorderLine.Z - 1; | 3581 | agent.startpos.X = crossedBorder.BorderLine.Z - 1; |
@@ -3621,9 +3643,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3621 | */// This is now handled properly in ScenePresence.MakeRootAgent | 3643 | */// This is now handled properly in ScenePresence.MakeRootAgent |
3622 | } | 3644 | } |
3623 | 3645 | ||
3624 | agent.teleportFlags = teleportFlags; | ||
3625 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | ||
3626 | |||
3627 | return true; | 3646 | return true; |
3628 | } | 3647 | } |
3629 | 3648 | ||