diff options
author | Diva Canto | 2010-06-12 11:11:13 -0700 |
---|---|---|
committer | Diva Canto | 2010-06-12 11:11:13 -0700 |
commit | e6efe34b4c7481ef3818905508cdcea6a4c8a9c8 (patch) | |
tree | db2163c6698086d3fd0272d373b05de8c992c978 /OpenSim/Region/Framework | |
parent | Preserving the link numbers is a serializer's highest duty. (diff) | |
download | opensim-SC_OLD-e6efe34b4c7481ef3818905508cdcea6a4c8a9c8.zip opensim-SC_OLD-e6efe34b4c7481ef3818905508cdcea6a4c8a9c8.tar.gz opensim-SC_OLD-e6efe34b4c7481ef3818905508cdcea6a4c8a9c8.tar.bz2 opensim-SC_OLD-e6efe34b4c7481ef3818905508cdcea6a4c8a9c8.tar.xz |
* Added CHANGED_TELEPORT event trigger upon inter-sim teleports.
* Cleaned up NewUserConnection.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 138 |
1 files changed, 80 insertions, 58 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9594e6b..2b2c04a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2480,7 +2480,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2480 | 2480 | ||
2481 | 2481 | ||
2482 | /// <summary> | 2482 | /// <summary> |
2483 | /// Called when objects or attachments cross the border between regions. | 2483 | /// Called when objects or attachments cross the border, or teleport, between regions. |
2484 | /// </summary> | 2484 | /// </summary> |
2485 | /// <param name="sog"></param> | 2485 | /// <param name="sog"></param> |
2486 | /// <returns></returns> | 2486 | /// <returns></returns> |
@@ -2510,6 +2510,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2510 | 2510 | ||
2511 | // Do this as late as possible so that listeners have full access to the incoming object | 2511 | // Do this as late as possible so that listeners have full access to the incoming object |
2512 | EventManager.TriggerOnIncomingSceneObject(newObject); | 2512 | EventManager.TriggerOnIncomingSceneObject(newObject); |
2513 | |||
2514 | TriggerEventsOnScriptedAttachments(newObject); | ||
2513 | 2515 | ||
2514 | return true; | 2516 | return true; |
2515 | } | 2517 | } |
@@ -2577,22 +2579,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2577 | // Fix up attachment Parent Local ID | 2579 | // Fix up attachment Parent Local ID |
2578 | ScenePresence sp = GetScenePresence(sceneObject.OwnerID); | 2580 | ScenePresence sp = GetScenePresence(sceneObject.OwnerID); |
2579 | 2581 | ||
2580 | //uint parentLocalID = 0; | ||
2581 | if (sp != null) | 2582 | if (sp != null) |
2582 | { | 2583 | { |
2583 | //parentLocalID = sp.LocalId; | ||
2584 | |||
2585 | //sceneObject.RootPart.IsAttachment = true; | ||
2586 | //sceneObject.RootPart.SetParentLocalId(parentLocalID); | ||
2587 | 2584 | ||
2588 | SceneObjectGroup grp = sceneObject; | 2585 | SceneObjectGroup grp = sceneObject; |
2589 | 2586 | ||
2590 | //RootPrim.SetParentLocalId(parentLocalID); | ||
2591 | |||
2592 | m_log.DebugFormat( | 2587 | m_log.DebugFormat( |
2593 | "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID); | 2588 | "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID); |
2594 | |||
2595 | //grp.SetFromAssetID(grp.RootPart.LastOwnerID); | ||
2596 | m_log.DebugFormat( | 2589 | m_log.DebugFormat( |
2597 | "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); | 2590 | "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); |
2598 | 2591 | ||
@@ -2602,7 +2595,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2602 | AttachmentsModule.AttachObject( | 2595 | AttachmentsModule.AttachObject( |
2603 | sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); | 2596 | sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); |
2604 | 2597 | ||
2605 | //grp.SendGroupFullUpdate(); | ||
2606 | } | 2598 | } |
2607 | else | 2599 | else |
2608 | { | 2600 | { |
@@ -2630,6 +2622,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2630 | 2622 | ||
2631 | return true; | 2623 | return true; |
2632 | } | 2624 | } |
2625 | |||
2626 | private void TriggerEventsOnScriptedAttachments(SceneObjectGroup sog) | ||
2627 | { | ||
2628 | ScenePresence sp = GetScenePresence(sog.OwnerID); | ||
2629 | |||
2630 | if (sp != null) | ||
2631 | { | ||
2632 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(sp.UUID); | ||
2633 | |||
2634 | if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default)) | ||
2635 | { | ||
2636 | // This will get your attention | ||
2637 | //m_log.Error("[XXX] Triggering "); | ||
2638 | |||
2639 | // Trigger CHANGED_TELEPORT | ||
2640 | sp.Scene.EventManager.TriggerOnScriptChangedEvent(sog.LocalId, (uint)Changed.TELEPORT); | ||
2641 | } | ||
2642 | |||
2643 | } | ||
2644 | } | ||
2645 | |||
2633 | #endregion | 2646 | #endregion |
2634 | 2647 | ||
2635 | #region Add/Remove Avatar Methods | 2648 | #region Add/Remove Avatar Methods |
@@ -3437,6 +3450,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3437 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) | 3450 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) |
3438 | { | 3451 | { |
3439 | TeleportFlags tp = (TeleportFlags)teleportFlags; | 3452 | TeleportFlags tp = (TeleportFlags)teleportFlags; |
3453 | reason = String.Empty; | ||
3454 | |||
3440 | //Teleport flags: | 3455 | //Teleport flags: |
3441 | // | 3456 | // |
3442 | // TeleportFlags.ViaGodlikeLure - Border Crossing | 3457 | // TeleportFlags.ViaGodlikeLure - Border Crossing |
@@ -3444,52 +3459,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
3444 | // TeleportFlags.TeleportFlags.ViaLure - Teleport request sent by another user | 3459 | // TeleportFlags.TeleportFlags.ViaLure - Teleport request sent by another user |
3445 | // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport | 3460 | // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport |
3446 | 3461 | ||
3447 | |||
3448 | if (LoginsDisabled) | ||
3449 | { | ||
3450 | reason = "Logins Disabled"; | ||
3451 | return false; | ||
3452 | } | ||
3453 | // Don't disable this log message - it's too helpful | 3462 | // Don't disable this log message - it's too helpful |
3454 | m_log.InfoFormat( | 3463 | m_log.InfoFormat( |
3455 | "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})", | 3464 | "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})", |
3456 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3465 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3457 | agent.AgentID, agent.circuitcode, teleportFlags); | 3466 | agent.AgentID, agent.circuitcode, teleportFlags); |
3458 | 3467 | ||
3459 | reason = String.Empty; | 3468 | if (LoginsDisabled) |
3460 | try | ||
3461 | { | ||
3462 | if (!VerifyUserPresence(agent, out reason)) | ||
3463 | return false; | ||
3464 | } | ||
3465 | catch (Exception e) | ||
3466 | { | 3469 | { |
3467 | m_log.DebugFormat("[CONNECTION BEGIN]: Exception verifying presence {0}", e.Message); | 3470 | reason = "Logins Disabled"; |
3468 | return false; | 3471 | return false; |
3469 | } | 3472 | } |
3470 | 3473 | ||
3471 | try | 3474 | ScenePresence sp = GetScenePresence(agent.AgentID); |
3472 | { | 3475 | |
3473 | if (!AuthorizeUser(agent, out reason)) | 3476 | if (sp != null && !sp.IsChildAgent) |
3474 | return false; | ||
3475 | } | ||
3476 | catch (Exception e) | ||
3477 | { | 3477 | { |
3478 | m_log.DebugFormat("[CONNECTION BEGIN]: Exception authorizing user {0}", e.Message); | 3478 | // We have a zombie from a crashed session. |
3479 | return false; | 3479 | // Or the same user is trying to be root twice here, won't work. |
3480 | // Kill it. | ||
3481 | m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName); | ||
3482 | sp.ControllingClient.Close(); | ||
3483 | sp = null; | ||
3480 | } | 3484 | } |
3481 | 3485 | ||
3482 | m_log.InfoFormat( | ||
3483 | "[CONNECTION BEGIN]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | ||
3484 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | ||
3485 | agent.AgentID, agent.circuitcode); | ||
3486 | |||
3487 | CapsModule.NewUserConnection(agent); | ||
3488 | |||
3489 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | 3486 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); |
3490 | 3487 | ||
3491 | //On login or border crossing test land permisions | 3488 | //On login test land permisions |
3492 | if (tp != TeleportFlags.Default) | 3489 | if (tp == TeleportFlags.ViaLogin) |
3493 | { | 3490 | { |
3494 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3491 | if (land != null && !TestLandRestrictions(agent, land, out reason)) |
3495 | { | 3492 | { |
@@ -3497,8 +3494,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
3497 | } | 3494 | } |
3498 | } | 3495 | } |
3499 | 3496 | ||
3500 | ScenePresence sp = GetScenePresence(agent.AgentID); | 3497 | if (sp == null) // We don't have an [child] agent here already |
3501 | if (sp != null) | 3498 | { |
3499 | |||
3500 | try | ||
3501 | { | ||
3502 | if (!VerifyUserPresence(agent, out reason)) | ||
3503 | return false; | ||
3504 | } | ||
3505 | catch (Exception e) | ||
3506 | { | ||
3507 | m_log.DebugFormat("[CONNECTION BEGIN]: Exception verifying presence {0}", e.Message); | ||
3508 | return false; | ||
3509 | } | ||
3510 | |||
3511 | try | ||
3512 | { | ||
3513 | if (!AuthorizeUser(agent, out reason)) | ||
3514 | return false; | ||
3515 | } | ||
3516 | catch (Exception e) | ||
3517 | { | ||
3518 | m_log.DebugFormat("[CONNECTION BEGIN]: Exception authorizing user {0}", e.Message); | ||
3519 | return false; | ||
3520 | } | ||
3521 | |||
3522 | m_log.InfoFormat( | ||
3523 | "[CONNECTION BEGIN]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | ||
3524 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | ||
3525 | agent.AgentID, agent.circuitcode); | ||
3526 | |||
3527 | CapsModule.NewUserConnection(agent); | ||
3528 | CapsModule.AddCapsHandler(agent.AgentID); | ||
3529 | } | ||
3530 | else | ||
3502 | { | 3531 | { |
3503 | if (sp.IsChildAgent) | 3532 | if (sp.IsChildAgent) |
3504 | { | 3533 | { |
@@ -3507,22 +3536,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3507 | agent.AgentID, RegionInfo.RegionName); | 3536 | agent.AgentID, RegionInfo.RegionName); |
3508 | 3537 | ||
3509 | sp.AdjustKnownSeeds(); | 3538 | sp.AdjustKnownSeeds(); |
3510 | 3539 | CapsModule.NewUserConnection(agent); | |
3511 | return true; | ||
3512 | } | ||
3513 | else | ||
3514 | { | ||
3515 | // We have a zombie from a crashed session. Kill it. | ||
3516 | m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName); | ||
3517 | sp.ControllingClient.Close(); | ||
3518 | } | 3540 | } |
3519 | } | 3541 | } |
3520 | 3542 | ||
3521 | CapsModule.AddCapsHandler(agent.AgentID); | ||
3522 | 3543 | ||
3523 | if (!agent.child) | 3544 | // In all cases, add or update the circuit data with the new agent circuit data and teleport flags |
3545 | agent.teleportFlags = teleportFlags; | ||
3546 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | ||
3547 | |||
3548 | if (tp == TeleportFlags.ViaLogin) | ||
3524 | { | 3549 | { |
3525 | if (TestBorderCross(agent.startpos,Cardinals.E)) | 3550 | if (TestBorderCross(agent.startpos, Cardinals.E)) |
3526 | { | 3551 | { |
3527 | Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); | 3552 | Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); |
3528 | agent.startpos.X = crossedBorder.BorderLine.Z - 1; | 3553 | agent.startpos.X = crossedBorder.BorderLine.Z - 1; |
@@ -3587,9 +3612,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3587 | } | 3612 | } |
3588 | } | 3613 | } |
3589 | 3614 | ||
3590 | agent.teleportFlags = teleportFlags; | ||
3591 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | ||
3592 | |||
3593 | return true; | 3615 | return true; |
3594 | } | 3616 | } |
3595 | 3617 | ||