diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 84 |
1 files changed, 41 insertions, 43 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index fa23590..56c654f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -95,8 +95,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
95 | 95 | ||
96 | foreach (AvatarAttachment att in a.GetAttachments()) | 96 | foreach (AvatarAttachment att in a.GetAttachments()) |
97 | { | 97 | { |
98 | InventoryItemBase item = new InventoryItemBase(att.ItemID, account.PrincipalID); | 98 | InventoryItemBase item = Scene.InventoryService.GetItem(account.PrincipalID, att.ItemID); |
99 | item = Scene.InventoryService.GetItem(item); | ||
100 | if (item != null) | 99 | if (item != null) |
101 | a.SetAttachment(att.AttachPoint, att.ItemID, item.AssetID); | 100 | a.SetAttachment(att.AttachPoint, att.ItemID, item.AssetID); |
102 | else | 101 | else |
@@ -161,10 +160,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
161 | scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); | 160 | scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); |
162 | //scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject; | 161 | //scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject; |
163 | 162 | ||
164 | m_incomingSceneObjectEngine | 163 | m_incomingSceneObjectEngine |
165 | = new JobEngine( | 164 | = new JobEngine( |
166 | string.Format("HG Incoming Scene Object Engine ({0})", scene.Name), | 165 | string.Format("HG Incoming Scene Object Engine ({0})", scene.Name), |
167 | "HG INCOMING SCENE OBJECT ENGINE"); | 166 | "HG INCOMING SCENE OBJECT ENGINE", 30000); |
168 | 167 | ||
169 | StatsManager.RegisterStat( | 168 | StatsManager.RegisterStat( |
170 | new Stat( | 169 | new Stat( |
@@ -239,13 +238,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
239 | return region; | 238 | return region; |
240 | } | 239 | } |
241 | 240 | ||
242 | protected override bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | 241 | protected override bool NeedsClosing(GridRegion reg, bool OutViewRange) |
243 | { | 242 | { |
244 | if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 243 | if (OutViewRange) |
245 | return true; | 244 | return true; |
246 | 245 | ||
247 | int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID); | 246 | int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID); |
248 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) | 247 | if (flags == -1 || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) |
249 | return true; | 248 | return true; |
250 | 249 | ||
251 | return false; | 250 | return false; |
@@ -263,7 +262,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
263 | } | 262 | } |
264 | } | 263 | } |
265 | 264 | ||
266 | protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) | 265 | protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, EntityTransferContext ctx, out string reason, out bool logout) |
267 | { | 266 | { |
268 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI); | 267 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI); |
269 | reason = string.Empty; | 268 | reason = string.Empty; |
@@ -273,7 +272,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
273 | { | 272 | { |
274 | // this user is going to another grid | 273 | // this user is going to another grid |
275 | // for local users, check if HyperGrid teleport is allowed, based on user level | 274 | // for local users, check if HyperGrid teleport is allowed, based on user level |
276 | if (Scene.UserManagementModule.IsLocalGridUser(sp.UUID) && sp.UserLevel < m_levelHGTeleport) | 275 | if (Scene.UserManagementModule.IsLocalGridUser(sp.UUID) && sp.GodController.UserLevel < m_levelHGTeleport) |
277 | { | 276 | { |
278 | m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel."); | 277 | m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel."); |
279 | reason = "Hypergrid teleport not allowed"; | 278 | reason = "Hypergrid teleport not allowed"; |
@@ -292,7 +291,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
292 | 291 | ||
293 | GridRegion source = new GridRegion(Scene.RegionInfo); | 292 | GridRegion source = new GridRegion(Scene.RegionInfo); |
294 | source.RawServerURI = m_GatekeeperURI; | 293 | source.RawServerURI = m_GatekeeperURI; |
295 | 294 | ||
296 | bool success = connector.LoginAgentToGrid(source, agentCircuit, reg, finalDestination, false, out reason); | 295 | bool success = connector.LoginAgentToGrid(source, agentCircuit, reg, finalDestination, false, out reason); |
297 | logout = success; // flag for later logout from this grid; this is an HG TP | 296 | logout = success; // flag for later logout from this grid; this is an HG TP |
298 | 297 | ||
@@ -308,7 +307,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
308 | } | 307 | } |
309 | } | 308 | } |
310 | 309 | ||
311 | return base.CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout); | 310 | return base.CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, ctx, out reason, out logout); |
311 | } | ||
312 | |||
313 | public override void TriggerTeleportHome(UUID id, IClientAPI client) | ||
314 | { | ||
315 | TeleportHome(id, client); | ||
312 | } | 316 | } |
313 | 317 | ||
314 | protected override bool ValidateGenericConditions(ScenePresence sp, GridRegion reg, GridRegion finalDestination, uint teleportFlags, out string reason) | 318 | protected override bool ValidateGenericConditions(ScenePresence sp, GridRegion reg, GridRegion finalDestination, uint teleportFlags, out string reason) |
@@ -328,7 +332,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
328 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: RestrictAppearanceAbroad is ON. Checking generic appearance"); | 332 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: RestrictAppearanceAbroad is ON. Checking generic appearance"); |
329 | 333 | ||
330 | // Check wearables | 334 | // Check wearables |
331 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) | 335 | for (int i = 0; i < sp.Appearance.Wearables.Length ; i++) |
332 | { | 336 | { |
333 | for (int j = 0; j < sp.Appearance.Wearables[i].Count; j++) | 337 | for (int j = 0; j < sp.Appearance.Wearables[i].Count; j++) |
334 | { | 338 | { |
@@ -337,13 +341,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
337 | 341 | ||
338 | bool found = false; | 342 | bool found = false; |
339 | foreach (AvatarAppearance a in ExportedAppearance) | 343 | foreach (AvatarAppearance a in ExportedAppearance) |
340 | if (a.Wearables[i] != null) | 344 | if (i < a.Wearables.Length && a.Wearables[i] != null) |
341 | { | 345 | { |
342 | found = true; | 346 | found = true; |
343 | break; | 347 | break; |
344 | } | 348 | } |
345 | 349 | ||
346 | if (!found) | 350 | if (!found) |
347 | { | 351 | { |
348 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Wearable not allowed to go outside {0}", i); | 352 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Wearable not allowed to go outside {0}", i); |
349 | return false; | 353 | return false; |
@@ -351,7 +355,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
351 | 355 | ||
352 | found = false; | 356 | found = false; |
353 | foreach (AvatarAppearance a in ExportedAppearance) | 357 | foreach (AvatarAppearance a in ExportedAppearance) |
354 | if (sp.Appearance.Wearables[i][j].AssetID == a.Wearables[i][j].AssetID) | 358 | if (i < a.Wearables.Length && sp.Appearance.Wearables[i][j].AssetID == a.Wearables[i][j].AssetID) |
355 | { | 359 | { |
356 | found = true; | 360 | found = true; |
357 | break; | 361 | break; |
@@ -412,7 +416,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
412 | // // Rez needed npc attachments | 416 | // // Rez needed npc attachments |
413 | // Scene.AttachmentsModule.RezAttachments(sp); | 417 | // Scene.AttachmentsModule.RezAttachments(sp); |
414 | 418 | ||
415 | 419 | ||
416 | // IAvatarFactoryModule module = Scene.RequestModuleInterface<IAvatarFactoryModule>(); | 420 | // IAvatarFactoryModule module = Scene.RequestModuleInterface<IAvatarFactoryModule>(); |
417 | // //module.SendAppearance(sp.UUID); | 421 | // //module.SendAppearance(sp.UUID); |
418 | // module.RequestRebake(sp, false); | 422 | // module.RequestRebake(sp, false); |
@@ -429,11 +433,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
429 | // return base.UpdateAgent(reg, finalDestination, agentData, sp); | 433 | // return base.UpdateAgent(reg, finalDestination, agentData, sp); |
430 | //} | 434 | //} |
431 | 435 | ||
432 | public override void TriggerTeleportHome(UUID id, IClientAPI client) | 436 | |
433 | { | ||
434 | TeleportHome(id, client); | ||
435 | } | ||
436 | |||
437 | public override bool TeleportHome(UUID id, IClientAPI client) | 437 | public override bool TeleportHome(UUID id, IClientAPI client) |
438 | { | 438 | { |
439 | m_log.DebugFormat( | 439 | m_log.DebugFormat( |
@@ -449,7 +449,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
449 | } | 449 | } |
450 | 450 | ||
451 | // Foreign user wants to go home | 451 | // Foreign user wants to go home |
452 | // | 452 | // |
453 | AgentCircuitData aCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); | 453 | AgentCircuitData aCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); |
454 | if (aCircuit == null || (aCircuit != null && !aCircuit.ServiceURLs.ContainsKey("HomeURI"))) | 454 | if (aCircuit == null || (aCircuit != null && !aCircuit.ServiceURLs.ContainsKey("HomeURI"))) |
455 | { | 455 | { |
@@ -470,7 +470,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
470 | { | 470 | { |
471 | m_log.Debug("[HG ENTITY TRANSFER MODULE]: GetHomeRegion call failed ", e); | 471 | m_log.Debug("[HG ENTITY TRANSFER MODULE]: GetHomeRegion call failed ", e); |
472 | } | 472 | } |
473 | 473 | ||
474 | if (finalDestination == null) | 474 | if (finalDestination == null) |
475 | { | 475 | { |
476 | client.SendTeleportFailed("Your home region could not be found"); | 476 | client.SendTeleportFailed("Your home region could not be found"); |
@@ -487,13 +487,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
487 | } | 487 | } |
488 | 488 | ||
489 | GridRegion homeGatekeeper = MakeRegion(aCircuit); | 489 | GridRegion homeGatekeeper = MakeRegion(aCircuit); |
490 | 490 | ||
491 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}", | 491 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}", |
492 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ServerURI, homeGatekeeper.RegionName); | 492 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ServerURI, homeGatekeeper.RegionName); |
493 | 493 | ||
494 | DoTeleport( | 494 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); |
495 | sp, homeGatekeeper, finalDestination, | ||
496 | position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); | ||
497 | return true; | 495 | return true; |
498 | } | 496 | } |
499 | 497 | ||
@@ -505,7 +503,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
505 | /// <param name="position"></param> | 503 | /// <param name="position"></param> |
506 | public override void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm) | 504 | public override void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm) |
507 | { | 505 | { |
508 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}", | 506 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}", |
509 | (lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position); | 507 | (lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position); |
510 | 508 | ||
511 | if (lm.Gatekeeper == string.Empty) | 509 | if (lm.Gatekeeper == string.Empty) |
@@ -523,7 +521,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
523 | remoteClient, info.RegionHandle, lm.Position, | 521 | remoteClient, info.RegionHandle, lm.Position, |
524 | Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); | 522 | Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); |
525 | } | 523 | } |
526 | else | 524 | else |
527 | { | 525 | { |
528 | // Foreign region | 526 | // Foreign region |
529 | GatekeeperServiceConnector gConn = new GatekeeperServiceConnector(); | 527 | GatekeeperServiceConnector gConn = new GatekeeperServiceConnector(); |
@@ -583,7 +581,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
583 | jobsRemoved, commonIdToRemove, jobsToReinsert.Count); | 581 | jobsRemoved, commonIdToRemove, jobsToReinsert.Count); |
584 | 582 | ||
585 | if (jobsToReinsert.Count > 0) | 583 | if (jobsToReinsert.Count > 0) |
586 | { | 584 | { |
587 | foreach (JobEngine.Job jobToReinsert in jobsToReinsert) | 585 | foreach (JobEngine.Job jobToReinsert in jobsToReinsert) |
588 | m_incomingSceneObjectEngine.QueueJob(jobToReinsert); | 586 | m_incomingSceneObjectEngine.QueueJob(jobToReinsert); |
589 | } | 587 | } |
@@ -613,16 +611,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
613 | if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) | 611 | if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) |
614 | { | 612 | { |
615 | m_incomingSceneObjectEngine.QueueJob( | 613 | m_incomingSceneObjectEngine.QueueJob( |
616 | string.Format("HG UUID Gather for attachment {0} for {1}", so.Name, aCircuit.Name), | 614 | string.Format("HG UUID Gather for attachment {0} for {1}", so.Name, aCircuit.Name), |
617 | () => | 615 | () => |
618 | { | 616 | { |
619 | string url = aCircuit.ServiceURLs["AssetServerURI"].ToString(); | 617 | string url = aCircuit.ServiceURLs["AssetServerURI"].ToString(); |
620 | // m_log.DebugFormat( | 618 | // m_log.DebugFormat( |
621 | // "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset service {2}", | 619 | // "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset service {2}", |
622 | // so.Name, so.AttachedAvatar, url); | 620 | // so.Name, so.AttachedAvatar, url); |
623 | 621 | ||
624 | IDictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>(); | 622 | IDictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>(); |
625 | HGUuidGatherer uuidGatherer | 623 | HGUuidGatherer uuidGatherer |
626 | = new HGUuidGatherer(Scene.AssetService, url, ids); | 624 | = new HGUuidGatherer(Scene.AssetService, url, ids); |
627 | uuidGatherer.AddForInspection(so); | 625 | uuidGatherer.AddForInspection(so); |
628 | 626 | ||
@@ -648,7 +646,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
648 | RemoveIncomingSceneObjectJobs(so.OwnerID.ToString()); | 646 | RemoveIncomingSceneObjectJobs(so.OwnerID.ToString()); |
649 | 647 | ||
650 | return; | 648 | return; |
651 | } | 649 | } |
652 | } | 650 | } |
653 | 651 | ||
654 | // m_log.DebugFormat( | 652 | // m_log.DebugFormat( |
@@ -659,7 +657,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
659 | { | 657 | { |
660 | int tickStart = Util.EnvironmentTickCount(); | 658 | int tickStart = Util.EnvironmentTickCount(); |
661 | 659 | ||
662 | uuidGatherer.FetchAsset(kvp.Key); | 660 | uuidGatherer.FetchAsset(kvp.Key); |
663 | 661 | ||
664 | int ticksElapsed = Util.EnvironmentTickCountSubtract(tickStart); | 662 | int ticksElapsed = Util.EnvironmentTickCountSubtract(tickStart); |
665 | 663 | ||
@@ -672,15 +670,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
672 | RemoveIncomingSceneObjectJobs(so.OwnerID.ToString()); | 670 | RemoveIncomingSceneObjectJobs(so.OwnerID.ToString()); |
673 | 671 | ||
674 | return; | 672 | return; |
675 | } | 673 | } |
676 | } | 674 | } |
677 | 675 | ||
678 | base.HandleIncomingSceneObject(so, newPosition); | 676 | base.HandleIncomingSceneObject(so, newPosition); |
679 | 677 | ||
680 | // m_log.DebugFormat( | 678 | // m_log.DebugFormat( |
681 | // "[HG ENTITY TRANSFER MODULE]: Completed incoming attachment {0} for HG user {1} with asset server {2}", | 679 | // "[HG ENTITY TRANSFER MODULE]: Completed incoming attachment {0} for HG user {1} with asset server {2}", |
682 | // so.Name, so.OwnerID, url); | 680 | // so.Name, so.OwnerID, url); |
683 | }, | 681 | }, |
684 | so.OwnerID.ToString()); | 682 | so.OwnerID.ToString()); |
685 | } | 683 | } |
686 | } | 684 | } |
@@ -700,7 +698,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
700 | string url = aCircuit.ServiceURLs["HomeURI"].ToString(); | 698 | string url = aCircuit.ServiceURLs["HomeURI"].ToString(); |
701 | IUserAgentService security = new UserAgentServiceConnector(url); | 699 | IUserAgentService security = new UserAgentServiceConnector(url); |
702 | return security.VerifyClient(aCircuit.SessionID, token); | 700 | return security.VerifyClient(aCircuit.SessionID, token); |
703 | } | 701 | } |
704 | else | 702 | else |
705 | { | 703 | { |
706 | m_log.DebugFormat( | 704 | m_log.DebugFormat( |
@@ -748,7 +746,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
748 | GridRegion region = new GridRegion(); | 746 | GridRegion region = new GridRegion(); |
749 | 747 | ||
750 | Uri uri = null; | 748 | Uri uri = null; |
751 | if (!aCircuit.ServiceURLs.ContainsKey("HomeURI") || | 749 | if (!aCircuit.ServiceURLs.ContainsKey("HomeURI") || |
752 | (aCircuit.ServiceURLs.ContainsKey("HomeURI") && !Uri.TryCreate(aCircuit.ServiceURLs["HomeURI"].ToString(), UriKind.Absolute, out uri))) | 750 | (aCircuit.ServiceURLs.ContainsKey("HomeURI") && !Uri.TryCreate(aCircuit.ServiceURLs["HomeURI"].ToString(), UriKind.Absolute, out uri))) |
753 | return null; | 751 | return null; |
754 | 752 | ||
@@ -760,4 +758,4 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
760 | return region; | 758 | return region; |
761 | } | 759 | } |
762 | } | 760 | } |
763 | } \ No newline at end of file | 761 | } |