diff options
Diffstat (limited to '')
16 files changed, 270 insertions, 582 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 1386e86..7dd9087 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | |||
@@ -152,6 +152,9 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
152 | /// <param name="j2kData">JPEG2000 data</param> | 152 | /// <param name="j2kData">JPEG2000 data</param> |
153 | private void DoJ2KDecode(UUID assetID, byte[] j2kData) | 153 | private void DoJ2KDecode(UUID assetID, byte[] j2kData) |
154 | { | 154 | { |
155 | // m_log.DebugFormat( | ||
156 | // "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID); | ||
157 | |||
155 | //int DecodeTime = 0; | 158 | //int DecodeTime = 0; |
156 | //DecodeTime = Environment.TickCount; | 159 | //DecodeTime = Environment.TickCount; |
157 | OpenJPEG.J2KLayerInfo[] layers; | 160 | OpenJPEG.J2KLayerInfo[] layers; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 9a97925..a77646c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | |||
@@ -50,6 +50,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
50 | { | 50 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 52 | ||
53 | IUserManagement m_uMan; | ||
54 | IUserManagement UserManagementModule | ||
55 | { | ||
56 | get | ||
57 | { | ||
58 | if (m_uMan == null) | ||
59 | m_uMan = m_Scenes[0].RequestModuleInterface<IUserManagement>(); | ||
60 | return m_uMan; | ||
61 | } | ||
62 | } | ||
63 | |||
53 | #region ISharedRegionModule | 64 | #region ISharedRegionModule |
54 | public override string Name | 65 | public override string Name |
55 | { | 66 | { |
@@ -369,9 +380,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
369 | protected override FriendInfo[] GetFriendsFromService(IClientAPI client) | 380 | protected override FriendInfo[] GetFriendsFromService(IClientAPI client) |
370 | { | 381 | { |
371 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name); | 382 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name); |
383 | Boolean agentIsLocal = true; | ||
384 | if (UserManagementModule != null) | ||
385 | agentIsLocal = UserManagementModule.IsLocalGridUser(client.AgentId); | ||
372 | 386 | ||
373 | UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, client.AgentId); | 387 | if (agentIsLocal) |
374 | if (account1 != null) | ||
375 | return base.GetFriendsFromService(client); | 388 | return base.GetFriendsFromService(client); |
376 | 389 | ||
377 | FriendInfo[] finfos = new FriendInfo[0]; | 390 | FriendInfo[] finfos = new FriendInfo[0]; |
@@ -392,16 +405,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
392 | 405 | ||
393 | protected override bool StoreRights(UUID agentID, UUID friendID, int rights) | 406 | protected override bool StoreRights(UUID agentID, UUID friendID, int rights) |
394 | { | 407 | { |
395 | UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); | 408 | Boolean agentIsLocal = true; |
396 | UserAccount account2 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friendID); | 409 | Boolean friendIsLocal = true; |
410 | if (UserManagementModule != null) | ||
411 | { | ||
412 | agentIsLocal = UserManagementModule.IsLocalGridUser(agentID); | ||
413 | friendIsLocal = UserManagementModule.IsLocalGridUser(friendID); | ||
414 | } | ||
415 | |||
397 | // Are they both local users? | 416 | // Are they both local users? |
398 | if (account1 != null && account2 != null) | 417 | if (agentIsLocal && friendIsLocal) |
399 | { | 418 | { |
400 | // local grid users | 419 | // local grid users |
401 | return base.StoreRights(agentID, friendID, rights); | 420 | return base.StoreRights(agentID, friendID, rights); |
402 | } | 421 | } |
403 | 422 | ||
404 | if (account1 != null) // agent is local, friend is foreigner | 423 | if (agentIsLocal) // agent is local, friend is foreigner |
405 | { | 424 | { |
406 | FriendInfo[] finfos = GetFriends(agentID); | 425 | FriendInfo[] finfos = GetFriends(agentID); |
407 | FriendInfo finfo = GetFriend(finfos, friendID); | 426 | FriendInfo finfo = GetFriend(finfos, friendID); |
@@ -412,7 +431,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
412 | } | 431 | } |
413 | } | 432 | } |
414 | 433 | ||
415 | if (account2 != null) // agent is foreigner, friend is local | 434 | if (friendIsLocal) // agent is foreigner, friend is local |
416 | { | 435 | { |
417 | string agentUUI = GetUUI(friendID, agentID); | 436 | string agentUUI = GetUUI(friendID, agentID); |
418 | if (agentUUI != string.Empty) | 437 | if (agentUUI != string.Empty) |
@@ -427,10 +446,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
427 | 446 | ||
428 | protected override void StoreBackwards(UUID friendID, UUID agentID) | 447 | protected override void StoreBackwards(UUID friendID, UUID agentID) |
429 | { | 448 | { |
430 | UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); | 449 | Boolean agentIsLocal = true; |
431 | UserAccount account2 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friendID); | 450 | Boolean friendIsLocal = true; |
451 | if (UserManagementModule != null) | ||
452 | { | ||
453 | agentIsLocal = UserManagementModule.IsLocalGridUser(agentID); | ||
454 | friendIsLocal = UserManagementModule.IsLocalGridUser(friendID); | ||
455 | } | ||
456 | |||
432 | // Are they both local users? | 457 | // Are they both local users? |
433 | if (account1 != null && account2 != null) | 458 | if (agentIsLocal && friendIsLocal) |
434 | { | 459 | { |
435 | // local grid users | 460 | // local grid users |
436 | m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local"); | 461 | m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local"); |
@@ -444,10 +469,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
444 | 469 | ||
445 | protected override void StoreFriendships(UUID agentID, UUID friendID) | 470 | protected override void StoreFriendships(UUID agentID, UUID friendID) |
446 | { | 471 | { |
447 | UserAccount agentAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); | 472 | Boolean agentIsLocal = true; |
448 | UserAccount friendAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friendID); | 473 | Boolean friendIsLocal = true; |
474 | if (UserManagementModule != null) | ||
475 | { | ||
476 | agentIsLocal = UserManagementModule.IsLocalGridUser(agentID); | ||
477 | friendIsLocal = UserManagementModule.IsLocalGridUser(friendID); | ||
478 | } | ||
479 | |||
449 | // Are they both local users? | 480 | // Are they both local users? |
450 | if (agentAccount != null && friendAccount != null) | 481 | if (agentIsLocal && friendIsLocal) |
451 | { | 482 | { |
452 | // local grid users | 483 | // local grid users |
453 | m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local"); | 484 | m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local"); |
@@ -465,13 +496,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
465 | string agentFriendService = string.Empty; | 496 | string agentFriendService = string.Empty; |
466 | string friendFriendService = string.Empty; | 497 | string friendFriendService = string.Empty; |
467 | 498 | ||
468 | if (agentClient != null) | 499 | if (agentIsLocal) |
469 | { | 500 | { |
470 | agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode); | 501 | agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode); |
471 | agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); | 502 | agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); |
472 | agentFriendService = agentClientCircuit.ServiceURLs["FriendsServerURI"].ToString(); | 503 | agentFriendService = agentClientCircuit.ServiceURLs["FriendsServerURI"].ToString(); |
473 | } | 504 | } |
474 | if (friendClient != null) | 505 | if (friendIsLocal) |
475 | { | 506 | { |
476 | friendClientCircuit = ((Scene)(friendClient.Scene)).AuthenticateHandler.GetAgentCircuitData(friendClient.CircuitCode); | 507 | friendClientCircuit = ((Scene)(friendClient.Scene)).AuthenticateHandler.GetAgentCircuitData(friendClient.CircuitCode); |
477 | friendUUI = Util.ProduceUserUniversalIdentifier(friendClientCircuit); | 508 | friendUUI = Util.ProduceUserUniversalIdentifier(friendClientCircuit); |
@@ -484,7 +515,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
484 | // Generate a random 8-character hex number that will sign this friendship | 515 | // Generate a random 8-character hex number that will sign this friendship |
485 | string secret = UUID.Random().ToString().Substring(0, 8); | 516 | string secret = UUID.Random().ToString().Substring(0, 8); |
486 | 517 | ||
487 | if (agentAccount != null) // agent is local, 'friend' is foreigner | 518 | if (agentIsLocal) // agent is local, 'friend' is foreigner |
488 | { | 519 | { |
489 | // This may happen when the agent returned home, in which case the friend is not there | 520 | // This may happen when the agent returned home, in which case the friend is not there |
490 | // We need to look for its information in the friends list itself | 521 | // We need to look for its information in the friends list itself |
@@ -520,7 +551,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
520 | friendsConn.NewFriendship(friendID, agentUUI + ";" + secret); | 551 | friendsConn.NewFriendship(friendID, agentUUI + ";" + secret); |
521 | } | 552 | } |
522 | } | 553 | } |
523 | else if (friendAccount != null) // 'friend' is local, agent is foreigner | 554 | else if (friendIsLocal) // 'friend' is local, agent is foreigner |
524 | { | 555 | { |
525 | // store in the local friends service a reference to the foreign agent | 556 | // store in the local friends service a reference to the foreign agent |
526 | FriendsService.StoreFriend(friendID.ToString(), agentUUI + ";" + secret, 1); | 557 | FriendsService.StoreFriend(friendID.ToString(), agentUUI + ";" + secret, 1); |
@@ -553,10 +584,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
553 | 584 | ||
554 | protected override bool DeleteFriendship(UUID agentID, UUID exfriendID) | 585 | protected override bool DeleteFriendship(UUID agentID, UUID exfriendID) |
555 | { | 586 | { |
556 | UserAccount agentAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); | 587 | Boolean agentIsLocal = true; |
557 | UserAccount friendAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, exfriendID); | 588 | Boolean friendIsLocal = true; |
589 | if (UserManagementModule != null) | ||
590 | { | ||
591 | agentIsLocal = UserManagementModule.IsLocalGridUser(agentID); | ||
592 | friendIsLocal = UserManagementModule.IsLocalGridUser(exfriendID); | ||
593 | } | ||
594 | |||
558 | // Are they both local users? | 595 | // Are they both local users? |
559 | if (agentAccount != null && friendAccount != null) | 596 | if (agentIsLocal && friendIsLocal) |
560 | { | 597 | { |
561 | // local grid users | 598 | // local grid users |
562 | return base.DeleteFriendship(agentID, exfriendID); | 599 | return base.DeleteFriendship(agentID, exfriendID); |
@@ -566,7 +603,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
566 | string agentUUI = string.Empty; | 603 | string agentUUI = string.Empty; |
567 | string friendUUI = string.Empty; | 604 | string friendUUI = string.Empty; |
568 | 605 | ||
569 | if (agentAccount != null) // agent is local, 'friend' is foreigner | 606 | if (agentIsLocal) // agent is local, 'friend' is foreigner |
570 | { | 607 | { |
571 | // We need to look for its information in the friends list itself | 608 | // We need to look for its information in the friends list itself |
572 | FriendInfo[] finfos = GetFriends(agentID); | 609 | FriendInfo[] finfos = GetFriends(agentID); |
@@ -587,7 +624,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
587 | return true; | 624 | return true; |
588 | } | 625 | } |
589 | } | 626 | } |
590 | else if (friendAccount != null) // agent is foreigner, 'friend' is local | 627 | else if (friendIsLocal) // agent is foreigner, 'friend' is local |
591 | { | 628 | { |
592 | agentUUI = GetUUI(exfriendID, agentID); | 629 | agentUUI = GetUUI(exfriendID, agentID); |
593 | 630 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs index 560d913..bf1d787 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs | |||
@@ -180,10 +180,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
180 | 180 | ||
181 | // m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); | 181 | // m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); |
182 | // Is the user a local user? | 182 | // Is the user a local user? |
183 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, toAgentID); | ||
184 | string url = string.Empty; | 183 | string url = string.Empty; |
185 | bool foreigner = false; | 184 | bool foreigner = false; |
186 | if (account == null) // foreign user | 185 | if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(toAgentID)) // foreign user |
187 | { | 186 | { |
188 | url = UserManagementModule.GetUserServerURL(toAgentID, "IMServerURI"); | 187 | url = UserManagementModule.GetUserServerURL(toAgentID, "IMServerURI"); |
189 | foreigner = true; | 188 | foreigner = true; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs index dee0ad4..eb1e4b5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs | |||
@@ -43,7 +43,7 @@ using OpenSim.Services.Interfaces; | |||
43 | namespace OpenSim.Region.CoreModules.Avatar.Profile | 43 | namespace OpenSim.Region.CoreModules.Avatar.Profile |
44 | { | 44 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
46 | public class BasicProfileModule : ISharedRegionModule | 46 | public class BasicProfileModule : IProfileModule, ISharedRegionModule |
47 | { | 47 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
@@ -57,6 +57,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile | |||
57 | 57 | ||
58 | public void Initialise(IConfigSource config) | 58 | public void Initialise(IConfigSource config) |
59 | { | 59 | { |
60 | // This can be reduced later as the loader will determine | ||
61 | // whether we are needed | ||
60 | if (config.Configs["Profile"] != null) | 62 | if (config.Configs["Profile"] != null) |
61 | { | 63 | { |
62 | if (config.Configs["Profile"].GetString("Module", string.Empty) != "BasicProfileModule") | 64 | if (config.Configs["Profile"].GetString("Module", string.Empty) != "BasicProfileModule") |
@@ -65,14 +67,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile | |||
65 | 67 | ||
66 | m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled"); | 68 | m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled"); |
67 | m_Enabled = true; | 69 | m_Enabled = true; |
68 | |||
69 | } | 70 | } |
70 | 71 | ||
71 | public void AddRegion(Scene scene) | 72 | public void AddRegion(Scene scene) |
72 | { | 73 | { |
73 | if (!m_Enabled) | 74 | if (!m_Enabled) |
74 | return; | 75 | return; |
75 | 76 | ||
76 | lock (m_Scenes) | 77 | lock (m_Scenes) |
77 | { | 78 | { |
78 | if (!m_Scenes.Contains(scene)) | 79 | if (!m_Scenes.Contains(scene)) |
@@ -80,6 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile | |||
80 | m_Scenes.Add(scene); | 81 | m_Scenes.Add(scene); |
81 | // Hook up events | 82 | // Hook up events |
82 | scene.EventManager.OnNewClient += OnNewClient; | 83 | scene.EventManager.OnNewClient += OnNewClient; |
84 | scene.RegisterModuleInterface<IProfileModule>(this); | ||
83 | } | 85 | } |
84 | } | 86 | } |
85 | } | 87 | } |
@@ -116,7 +118,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile | |||
116 | 118 | ||
117 | public Type ReplaceableInterface | 119 | public Type ReplaceableInterface |
118 | { | 120 | { |
119 | get { return null; } | 121 | get { return typeof(IProfileModule); } |
120 | } | 122 | } |
121 | 123 | ||
122 | #endregion | 124 | #endregion |
@@ -170,4 +172,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile | |||
170 | } | 172 | } |
171 | 173 | ||
172 | } | 174 | } |
173 | } \ No newline at end of file | 175 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 87f292c..cbef6ce 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -676,9 +676,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
676 | Vector3 eastCross = new Vector3(boundaryDistance, 0, 0); | 676 | Vector3 eastCross = new Vector3(boundaryDistance, 0, 0); |
677 | Vector3 westCross = new Vector3(-1 * boundaryDistance, 0, 0); | 677 | Vector3 westCross = new Vector3(-1 * boundaryDistance, 0, 0); |
678 | 678 | ||
679 | // distance to edge that will trigger crossing | ||
680 | |||
681 | |||
682 | // distance into new region to place avatar | 679 | // distance into new region to place avatar |
683 | const float enterDistance = 0.5f; | 680 | const float enterDistance = 0.5f; |
684 | 681 | ||
@@ -960,29 +957,31 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
960 | m_log.DebugFormat( | 957 | m_log.DebugFormat( |
961 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.", | 958 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.", |
962 | agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName); | 959 | agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName); |
963 | 960 | ||
964 | pos = pos + (agent.Velocity); | 961 | pos = pos + agent.Velocity; |
965 | 962 | Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0); | |
963 | |||
964 | agent.RemoveFromPhysicalScene(); | ||
966 | SetInTransit(agent.UUID); | 965 | SetInTransit(agent.UUID); |
967 | AgentData cAgent = new AgentData(); | 966 | |
967 | AgentData cAgent = new AgentData(); | ||
968 | agent.CopyTo(cAgent); | 968 | agent.CopyTo(cAgent); |
969 | cAgent.Position = pos; | 969 | cAgent.Position = pos; |
970 | if (isFlying) | 970 | if (isFlying) |
971 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | 971 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; |
972 | cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + | 972 | |
973 | "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; | 973 | // We don't need the callback anymnore |
974 | 974 | cAgent.CallbackURI = String.Empty; | |
975 | |||
975 | if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) | 976 | if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) |
976 | { | 977 | { |
977 | // region doesn't take it | 978 | // region doesn't take it |
978 | ReInstantiateScripts(agent); | 979 | ReInstantiateScripts(agent); |
980 | agent.AddToPhysicalScene(isFlying); | ||
979 | ResetFromTransit(agent.UUID); | 981 | ResetFromTransit(agent.UUID); |
980 | return agent; | 982 | return agent; |
981 | } | 983 | } |
982 | 984 | ||
983 | // Next, let's close the child agent connections that are too far away. | ||
984 | agent.CloseChildAgents(neighbourx, neighboury); | ||
985 | |||
986 | //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | 985 | //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); |
987 | agent.ControllingClient.RequestClientInfo(); | 986 | agent.ControllingClient.RequestClientInfo(); |
988 | 987 | ||
@@ -999,11 +998,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
999 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); | 998 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); |
1000 | 999 | ||
1001 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | 1000 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); |
1002 | 1001 | ||
1003 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | 1002 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); |
1004 | if (eq != null) | 1003 | if (eq != null) |
1005 | { | 1004 | { |
1006 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | 1005 | eq.CrossRegion(neighbourHandle, pos, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint, |
1007 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | 1006 | capsPath, agent.UUID, agent.ControllingClient.SessionId); |
1008 | } | 1007 | } |
1009 | else | 1008 | else |
@@ -1011,32 +1010,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1011 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | 1010 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, |
1012 | capsPath); | 1011 | capsPath); |
1013 | } | 1012 | } |
1014 | 1013 | ||
1015 | if (!WaitForCallback(agent.UUID)) | 1014 | // SUCCESS! |
1016 | { | ||
1017 | m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent"); | ||
1018 | ReInstantiateScripts(agent); | ||
1019 | ResetFromTransit(agent.UUID); | ||
1020 | |||
1021 | // Yikes! We should just have a ref to scene here. | ||
1022 | //agent.Scene.InformClientOfNeighbours(agent); | ||
1023 | EnableChildAgents(agent); | ||
1024 | |||
1025 | return agent; | ||
1026 | } | ||
1027 | |||
1028 | agent.MakeChildAgent(); | 1015 | agent.MakeChildAgent(); |
1029 | 1016 | ResetFromTransit(agent.UUID); | |
1017 | |||
1030 | // now we have a child agent in this region. Request all interesting data about other (root) agents | 1018 | // now we have a child agent in this region. Request all interesting data about other (root) agents |
1031 | agent.SendOtherAgentsAvatarDataToMe(); | 1019 | agent.SendOtherAgentsAvatarDataToMe(); |
1032 | agent.SendOtherAgentsAppearanceToMe(); | 1020 | agent.SendOtherAgentsAppearanceToMe(); |
1033 | 1021 | ||
1034 | // Backwards compatibility | 1022 | // Backwards compatibility. Best effort |
1035 | if (version == "Unknown" || version == string.Empty) | 1023 | if (version == "Unknown" || version == string.Empty) |
1036 | { | 1024 | { |
1037 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one..."); | 1025 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); |
1026 | Thread.Sleep(3000); // wait a little now that we're not waiting for the callback | ||
1038 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | 1027 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); |
1039 | } | 1028 | } |
1029 | |||
1030 | |||
1031 | // Next, let's close the child agent connections that are too far away. | ||
1032 | agent.CloseChildAgents(neighbourx, neighboury); | ||
1040 | 1033 | ||
1041 | AgentHasMovedAway(agent, false); | 1034 | AgentHasMovedAway(agent, false); |
1042 | 1035 | ||
@@ -1069,16 +1062,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1069 | CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState; | 1062 | CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState; |
1070 | ScenePresence agent = icon.EndInvoke(iar); | 1063 | ScenePresence agent = icon.EndInvoke(iar); |
1071 | 1064 | ||
1072 | // If the cross was successful, this agent is a child agent | 1065 | //// If the cross was successful, this agent is a child agent |
1073 | if (agent.IsChildAgent) | 1066 | //if (agent.IsChildAgent) |
1074 | agent.Reset(); | 1067 | // agent.Reset(); |
1075 | else // Not successful | 1068 | //else // Not successful |
1076 | agent.RestoreInCurrentScene(); | 1069 | // agent.RestoreInCurrentScene(); |
1077 | 1070 | ||
1078 | // In any case | 1071 | // In any case |
1079 | agent.IsInTransit = false; | 1072 | agent.IsInTransit = false; |
1080 | 1073 | ||
1081 | //m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); | 1074 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); |
1082 | } | 1075 | } |
1083 | 1076 | ||
1084 | #endregion | 1077 | #endregion |
@@ -1712,9 +1705,23 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1712 | uint x = 0, y = 0; | 1705 | uint x = 0, y = 0; |
1713 | Utils.LongToUInts(newRegionHandle, out x, out y); | 1706 | Utils.LongToUInts(newRegionHandle, out x, out y); |
1714 | GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); | 1707 | GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); |
1715 | if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent)) | 1708 | |
1709 | if (destination == null || !CrossPrimGroupIntoNewRegion(destination, grp, silent)) | ||
1716 | { | 1710 | { |
1711 | m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID); | ||
1712 | |||
1713 | // We are going to move the object back to the old position so long as the old position | ||
1714 | // is in the region | ||
1715 | oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X,1.0f,(float)Constants.RegionSize-1); | ||
1716 | oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y,1.0f,(float)Constants.RegionSize-1); | ||
1717 | oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z,1.0f,4096.0f); | ||
1718 | |||
1717 | grp.RootPart.GroupPosition = oldGroupPosition; | 1719 | grp.RootPart.GroupPosition = oldGroupPosition; |
1720 | |||
1721 | // Need to turn off the physics flags, otherwise the object will continue to attempt to | ||
1722 | // move out of the region creating an infinite loop of failed attempts to cross | ||
1723 | grp.UpdatePrimFlags(grp.RootPart.LocalId,false,grp.IsTemporary,grp.IsPhantom,false); | ||
1724 | |||
1718 | grp.ScheduleGroupForFullUpdate(); | 1725 | grp.ScheduleGroupForFullUpdate(); |
1719 | } | 1726 | } |
1720 | } | 1727 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index cc9ba97..8d41728 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -187,8 +187,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
187 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 187 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
188 | 188 | ||
189 | // Let's find out if this is a foreign user or a local user | 189 | // Let's find out if this is a foreign user or a local user |
190 | UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, id); | 190 | IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>(); |
191 | if (account != null) | 191 | if (uMan != null && uMan.IsLocalGridUser(id)) |
192 | { | 192 | { |
193 | // local grid user | 193 | // local grid user |
194 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); | 194 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); |
@@ -227,8 +227,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
227 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | 227 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); |
228 | GridRegion homeGatekeeper = MakeRegion(aCircuit); | 228 | GridRegion homeGatekeeper = MakeRegion(aCircuit); |
229 | 229 | ||
230 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}:{5}", | 230 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}", |
231 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); | 231 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ServerURI, homeGatekeeper.RegionName); |
232 | 232 | ||
233 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); | 233 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); |
234 | } | 234 | } |
@@ -313,8 +313,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
313 | } | 313 | } |
314 | 314 | ||
315 | // Let's find out if this is a foreign user or a local user | 315 | // Let's find out if this is a foreign user or a local user |
316 | IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>(); | ||
316 | UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId); | 317 | UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId); |
317 | if (account != null) | 318 | if (uMan != null && uMan.IsLocalGridUser(obj.AgentId)) |
318 | { | 319 | { |
319 | // local grid user | 320 | // local grid user |
320 | return; | 321 | return; |
@@ -347,6 +348,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
347 | 348 | ||
348 | region.ExternalHostName = uri.Host; | 349 | region.ExternalHostName = uri.Host; |
349 | region.HttpPort = (uint)uri.Port; | 350 | region.HttpPort = (uint)uri.Port; |
351 | region.ServerURI = uri.ToString(); | ||
350 | region.RegionName = string.Empty; | 352 | region.RegionName = string.Empty; |
351 | region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); | 353 | region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); |
352 | return region; | 354 | return region; |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index 81b65c5..d20c9eb 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs | |||
@@ -73,7 +73,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
73 | 73 | ||
74 | public AssetBase FetchAsset(string url, UUID assetID) | 74 | public AssetBase FetchAsset(string url, UUID assetID) |
75 | { | 75 | { |
76 | AssetBase asset = m_scene.AssetService.Get(url + "/" + assetID.ToString()); | 76 | if (!url.EndsWith("/") && !url.EndsWith("=")) |
77 | url = url + "/"; | ||
78 | |||
79 | AssetBase asset = m_scene.AssetService.Get(url + assetID.ToString()); | ||
77 | 80 | ||
78 | if (asset != null) | 81 | if (asset != null) |
79 | { | 82 | { |
@@ -87,6 +90,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
87 | { | 90 | { |
88 | if (asset != null) | 91 | if (asset != null) |
89 | { | 92 | { |
93 | if (!url.EndsWith("/") && !url.EndsWith("=")) | ||
94 | url = url + "/"; | ||
95 | |||
90 | // See long comment in AssetCache.AddAsset | 96 | // See long comment in AssetCache.AddAsset |
91 | if (!asset.Temporary || asset.Local) | 97 | if (!asset.Temporary || asset.Local) |
92 | { | 98 | { |
@@ -99,7 +105,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
99 | Copy(asset, asset1); | 105 | Copy(asset, asset1); |
100 | try | 106 | try |
101 | { | 107 | { |
102 | asset1.ID = url + "/" + asset.ID; | 108 | asset1.ID = url + asset.ID; |
103 | } | 109 | } |
104 | catch | 110 | catch |
105 | { | 111 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 49d484b..bf24ebc 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -124,8 +124,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
124 | 124 | ||
125 | protected override string GenerateLandmark(ScenePresence presence, out string prefix, out string suffix) | 125 | protected override string GenerateLandmark(ScenePresence presence, out string prefix, out string suffix) |
126 | { | 126 | { |
127 | UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, presence.UUID); | 127 | if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(presence.UUID)) |
128 | if (account == null) | ||
129 | prefix = "HG "; | 128 | prefix = "HG "; |
130 | else | 129 | else |
131 | prefix = string.Empty; | 130 | prefix = string.Empty; |
@@ -210,12 +209,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
210 | public override bool IsForeignUser(UUID userID, out string assetServerURL) | 209 | public override bool IsForeignUser(UUID userID, out string assetServerURL) |
211 | { | 210 | { |
212 | assetServerURL = string.Empty; | 211 | assetServerURL = string.Empty; |
213 | UserAccount account = null; | ||
214 | if (m_Scene.UserAccountService != null) | ||
215 | account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID); | ||
216 | 212 | ||
217 | if (account == null) // foreign | 213 | if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(userID)) |
218 | { | 214 | { // foreign |
219 | ScenePresence sp = null; | 215 | ScenePresence sp = null; |
220 | if (m_Scene.TryGetScenePresence(userID, out sp)) | 216 | if (m_Scene.TryGetScenePresence(userID, out sp)) |
221 | { | 217 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index a40a6a4..37292d6 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -50,6 +50,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
50 | public string LastName { get; set; } | 50 | public string LastName { get; set; } |
51 | public string HomeURL { get; set; } | 51 | public string HomeURL { get; set; } |
52 | public Dictionary<string, object> ServerURLs { get; set; } | 52 | public Dictionary<string, object> ServerURLs { get; set; } |
53 | public string Title { get; set; } | ||
54 | public int Flags { get; set; } | ||
55 | public int Created { get; set; } | ||
53 | } | 56 | } |
54 | 57 | ||
55 | public class UserManagementModule : ISharedRegionModule, IUserManagement | 58 | public class UserManagementModule : ISharedRegionModule, IUserManagement |
@@ -281,6 +284,94 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
281 | return string.Empty; | 284 | return string.Empty; |
282 | } | 285 | } |
283 | 286 | ||
287 | public int GetUserFlags(UUID userID) | ||
288 | { | ||
289 | UserData userdata; | ||
290 | lock (m_UserCache) | ||
291 | m_UserCache.TryGetValue(userID, out userdata); | ||
292 | |||
293 | if (userdata.Flags == -1) | ||
294 | GetUserInfo(userID); | ||
295 | |||
296 | if (userdata.Flags != -1) | ||
297 | return userdata.Flags; | ||
298 | |||
299 | return 0; | ||
300 | } | ||
301 | |||
302 | public int GetUserCreated(UUID userID) | ||
303 | { | ||
304 | UserData userdata; | ||
305 | lock (m_UserCache) | ||
306 | m_UserCache.TryGetValue(userID, out userdata); | ||
307 | |||
308 | if (userdata.Flags == -1) | ||
309 | GetUserInfo(userID); | ||
310 | |||
311 | if (userdata.Created != -1) | ||
312 | return userdata.Created; | ||
313 | |||
314 | return 0; | ||
315 | } | ||
316 | |||
317 | public string GetUserTitle(UUID userID) | ||
318 | { | ||
319 | UserData userdata; | ||
320 | lock (m_UserCache) | ||
321 | m_UserCache.TryGetValue(userID, out userdata); | ||
322 | |||
323 | if (userdata.Flags == -1) | ||
324 | GetUserInfo(userID); | ||
325 | |||
326 | if (userdata.Created != -1) | ||
327 | return userdata.Title; | ||
328 | |||
329 | return string.Empty; | ||
330 | } | ||
331 | |||
332 | // This will cache the user data | ||
333 | // Change this to return bool | ||
334 | private bool GetUserInfo(UUID userID) | ||
335 | { | ||
336 | UserData userdata; | ||
337 | lock (m_UserCache) | ||
338 | m_UserCache.TryGetValue(userID, out userdata); | ||
339 | |||
340 | if (userdata != null) | ||
341 | { | ||
342 | // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID); | ||
343 | |||
344 | if (userdata.Flags >= 0) | ||
345 | { | ||
346 | // This is already populated | ||
347 | return true; | ||
348 | } | ||
349 | |||
350 | if (userdata.HomeURL != null && userdata.HomeURL != string.Empty) | ||
351 | { | ||
352 | m_log.DebugFormat( | ||
353 | "[USER MANAGEMENT MODULE]: Requesting user flags from '{0}' for {1}", | ||
354 | userdata.HomeURL, userID); | ||
355 | |||
356 | UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); | ||
357 | Dictionary<string, object> info = uConn.GetUserInfo(userID); | ||
358 | |||
359 | // Pull our data now | ||
360 | if (info["result"].ToString() == "success") | ||
361 | { | ||
362 | userdata.Flags = (int)info["user_flags"]; | ||
363 | userdata.Created = (int)info["user_created"]; | ||
364 | userdata.Title = (string)info["user_title"]; | ||
365 | |||
366 | return true; | ||
367 | } | ||
368 | } | ||
369 | } | ||
370 | |||
371 | return false; | ||
372 | } | ||
373 | |||
374 | |||
284 | public string GetUserUUI(UUID userID) | 375 | public string GetUserUUI(UUID userID) |
285 | { | 376 | { |
286 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID); | 377 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID); |
@@ -352,6 +443,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
352 | { | 443 | { |
353 | UserData user = new UserData(); | 444 | UserData user = new UserData(); |
354 | user.Id = id; | 445 | user.Id = id; |
446 | user.Flags = -1; | ||
447 | user.Created = -1; | ||
355 | 448 | ||
356 | if (creatorData != null && creatorData != string.Empty) | 449 | if (creatorData != null && creatorData != string.Empty) |
357 | { | 450 | { |
@@ -425,6 +518,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
425 | 518 | ||
426 | //} | 519 | //} |
427 | 520 | ||
521 | public bool IsLocalGridUser(UUID uuid) | ||
522 | { | ||
523 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid); | ||
524 | if (account == null || (account != null && !account.LocalToGrid)) | ||
525 | return false; | ||
526 | |||
527 | return true; | ||
528 | } | ||
529 | |||
428 | #endregion IUserManagement | 530 | #endregion IUserManagement |
429 | 531 | ||
430 | private void HandleShowUsers(string module, string[] cmd) | 532 | private void HandleShowUsers(string module, string[] cmd) |
diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs index cabbd31..16cbbf5 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs | |||
@@ -153,10 +153,18 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
153 | 153 | ||
154 | public void SendProfileToClient(IClientAPI client, RegionLightShareData wl) | 154 | public void SendProfileToClient(IClientAPI client, RegionLightShareData wl) |
155 | { | 155 | { |
156 | if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) | 156 | if (m_enableWindlight) |
157 | { | 157 | { |
158 | List<byte[]> param = compileWindlightSettings(wl); | 158 | if (m_scene.RegionInfo.WindlightSettings.valid) |
159 | client.SendGenericMessage("Windlight", param); | 159 | { |
160 | List<byte[]> param = compileWindlightSettings(wl); | ||
161 | client.SendGenericMessage("Windlight", param); | ||
162 | } | ||
163 | else | ||
164 | { | ||
165 | List<byte[]> param = new List<byte[]>(); | ||
166 | client.SendGenericMessage("WindlightReset", param); | ||
167 | } | ||
160 | } | 168 | } |
161 | } | 169 | } |
162 | 170 | ||
@@ -175,8 +183,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
175 | 183 | ||
176 | private void EventManager_OnSaveNewWindlightProfile() | 184 | private void EventManager_OnSaveNewWindlightProfile() |
177 | { | 185 | { |
178 | if (m_scene.RegionInfo.WindlightSettings.valid) | 186 | m_scene.ForEachRootClient(SendProfileToClient); |
179 | m_scene.ForEachRootClient(SendProfileToClient); | ||
180 | } | 187 | } |
181 | 188 | ||
182 | public void PostInitialise() | 189 | public void PostInitialise() |
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 43672d1..8fb5d75 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -411,8 +411,21 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
411 | } | 411 | } |
412 | 412 | ||
413 | Request.Timeout = HttpTimeout; | 413 | Request.Timeout = HttpTimeout; |
414 | // execute the request | 414 | try |
415 | response = (HttpWebResponse) Request.GetResponse(); | 415 | { |
416 | // execute the request | ||
417 | response = (HttpWebResponse) Request.GetResponse(); | ||
418 | } | ||
419 | catch (WebException e) | ||
420 | { | ||
421 | if (e.Status != WebExceptionStatus.ProtocolError) | ||
422 | { | ||
423 | throw; | ||
424 | } | ||
425 | response = (HttpWebResponse)e.Response; | ||
426 | } | ||
427 | |||
428 | Status = (int)response.StatusCode; | ||
416 | 429 | ||
417 | Stream resStream = response.GetResponseStream(); | 430 | Stream resStream = response.GetResponseStream(); |
418 | 431 | ||
@@ -436,17 +449,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
436 | } | 449 | } |
437 | catch (Exception e) | 450 | catch (Exception e) |
438 | { | 451 | { |
439 | if (e is WebException && ((WebException)e).Status == WebExceptionStatus.ProtocolError) | 452 | Status = (int)OSHttpStatusCode.ClientErrorJoker; |
440 | { | 453 | ResponseBody = e.Message; |
441 | HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; | ||
442 | Status = (int)webRsp.StatusCode; | ||
443 | ResponseBody = webRsp.StatusDescription; | ||
444 | } | ||
445 | else | ||
446 | { | ||
447 | Status = (int)OSHttpStatusCode.ClientErrorJoker; | ||
448 | ResponseBody = e.Message; | ||
449 | } | ||
450 | 454 | ||
451 | _finished = true; | 455 | _finished = true; |
452 | return; | 456 | return; |
@@ -457,7 +461,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
457 | response.Close(); | 461 | response.Close(); |
458 | } | 462 | } |
459 | 463 | ||
460 | Status = (int)OSHttpStatusCode.SuccessOk; | ||
461 | _finished = true; | 464 | _finished = true; |
462 | } | 465 | } |
463 | 466 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index e31be21..8395f83 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | |||
@@ -382,23 +382,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
382 | return result; | 382 | return result; |
383 | } | 383 | } |
384 | 384 | ||
385 | #region IHyperAssetService | ||
386 | |||
387 | public string GetUserAssetServer(UUID userID) | ||
388 | { | ||
389 | UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, userID); | ||
390 | |||
391 | if (account != null && account.ServiceURLs.ContainsKey("AssetServerURI") && account.ServiceURLs["AssetServerURI"] != null) | ||
392 | return account.ServiceURLs["AssetServerURI"].ToString(); | ||
393 | |||
394 | return string.Empty; | ||
395 | } | ||
396 | |||
397 | public string GetSimAssetServer() | ||
398 | { | ||
399 | return m_LocalAssetServiceURI; | ||
400 | } | ||
401 | |||
402 | #endregion | ||
403 | } | 385 | } |
404 | } | 386 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index cc5d061..2e6ec90 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | |||
@@ -170,6 +170,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
170 | 170 | ||
171 | public AssetBase GetCached(string id) | 171 | public AssetBase GetCached(string id) |
172 | { | 172 | { |
173 | // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id); | ||
174 | |||
173 | if (m_Cache != null) | 175 | if (m_Cache != null) |
174 | return m_Cache.Get(id); | 176 | return m_Cache.Get(id); |
175 | 177 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs deleted file mode 100644 index dcf08e3..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs +++ /dev/null | |||
@@ -1,223 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
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. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using Nini.Config; | ||
32 | using log4net; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Services.Interfaces; | ||
35 | |||
36 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | ||
37 | { | ||
38 | public abstract class BaseInventoryConnector : IInventoryService | ||
39 | { | ||
40 | protected static InventoryCache m_cache; | ||
41 | private static bool m_Initialized; | ||
42 | |||
43 | protected virtual void Init(IConfigSource source) | ||
44 | { | ||
45 | if (!m_Initialized) | ||
46 | { | ||
47 | m_cache = new InventoryCache(); | ||
48 | m_cache.Init(source, this); | ||
49 | m_Initialized = true; | ||
50 | } | ||
51 | } | ||
52 | |||
53 | /// <summary> | ||
54 | /// Create the entire inventory for a given user | ||
55 | /// </summary> | ||
56 | /// <param name="user"></param> | ||
57 | /// <returns></returns> | ||
58 | public abstract bool CreateUserInventory(UUID user); | ||
59 | |||
60 | /// <summary> | ||
61 | /// Gets the skeleton of the inventory -- folders only | ||
62 | /// </summary> | ||
63 | /// <param name="userId"></param> | ||
64 | /// <returns></returns> | ||
65 | public abstract List<InventoryFolderBase> GetInventorySkeleton(UUID userId); | ||
66 | |||
67 | /// <summary> | ||
68 | /// Synchronous inventory fetch. | ||
69 | /// </summary> | ||
70 | /// <param name="userID"></param> | ||
71 | /// <returns></returns> | ||
72 | public abstract InventoryCollection GetUserInventory(UUID userID); | ||
73 | |||
74 | /// <summary> | ||
75 | /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the | ||
76 | /// inventory has been received | ||
77 | /// </summary> | ||
78 | /// <param name="userID"></param> | ||
79 | /// <param name="callback"></param> | ||
80 | public abstract void GetUserInventory(UUID userID, InventoryReceiptCallback callback); | ||
81 | |||
82 | /// <summary> | ||
83 | /// Retrieve the root inventory folder for the given user. | ||
84 | /// </summary> | ||
85 | /// <param name="userID"></param> | ||
86 | /// <returns>null if no root folder was found</returns> | ||
87 | public InventoryFolderBase GetRootFolder(UUID userID) | ||
88 | { | ||
89 | // Root folder is here as system type Folder. | ||
90 | return m_cache.GetFolderForType(userID, AssetType.Folder); | ||
91 | } | ||
92 | |||
93 | public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID); | ||
94 | |||
95 | /// <summary> | ||
96 | /// Gets the user folder for the given folder-type | ||
97 | /// </summary> | ||
98 | /// <param name="userID"></param> | ||
99 | /// <param name="type"></param> | ||
100 | /// <returns></returns> | ||
101 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
102 | { | ||
103 | return m_cache.GetFolderForType(userID, type); | ||
104 | } | ||
105 | |||
106 | /// <summary> | ||
107 | /// Gets everything (folders and items) inside a folder | ||
108 | /// </summary> | ||
109 | /// <param name="userId"></param> | ||
110 | /// <param name="folderID"></param> | ||
111 | /// <returns></returns> | ||
112 | public abstract InventoryCollection GetFolderContent(UUID userID, UUID folderID); | ||
113 | |||
114 | /// <summary> | ||
115 | /// Gets the items inside a folder | ||
116 | /// </summary> | ||
117 | /// <param name="userID"></param> | ||
118 | /// <param name="folderID"></param> | ||
119 | /// <returns></returns> | ||
120 | public abstract List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID); | ||
121 | |||
122 | /// <summary> | ||
123 | /// Add a new folder to the user's inventory | ||
124 | /// </summary> | ||
125 | /// <param name="folder"></param> | ||
126 | /// <returns>true if the folder was successfully added</returns> | ||
127 | public abstract bool AddFolder(InventoryFolderBase folder); | ||
128 | |||
129 | /// <summary> | ||
130 | /// Update a folder in the user's inventory | ||
131 | /// </summary> | ||
132 | /// <param name="folder"></param> | ||
133 | /// <returns>true if the folder was successfully updated</returns> | ||
134 | public abstract bool UpdateFolder(InventoryFolderBase folder); | ||
135 | |||
136 | /// <summary> | ||
137 | /// Move an inventory folder to a new location | ||
138 | /// </summary> | ||
139 | /// <param name="folder">A folder containing the details of the new location</param> | ||
140 | /// <returns>true if the folder was successfully moved</returns> | ||
141 | public abstract bool MoveFolder(InventoryFolderBase folder); | ||
142 | |||
143 | /// <summary> | ||
144 | /// Delete a list of inventory folders (from trash) | ||
145 | /// </summary> | ||
146 | public abstract bool DeleteFolders(UUID ownerID, List<UUID> folderIDs); | ||
147 | |||
148 | /// <summary> | ||
149 | /// Purge an inventory folder of all its items and subfolders. | ||
150 | /// </summary> | ||
151 | /// <param name="folder"></param> | ||
152 | /// <returns>true if the folder was successfully purged</returns> | ||
153 | public abstract bool PurgeFolder(InventoryFolderBase folder); | ||
154 | |||
155 | /// <summary> | ||
156 | /// Add a new item to the user's inventory. | ||
157 | /// If the given item has to parent folder, it tries to find the most | ||
158 | /// suitable folder for it. | ||
159 | /// </summary> | ||
160 | /// <param name="item"></param> | ||
161 | /// <returns>true if the item was successfully added</returns> | ||
162 | public bool AddItem(InventoryItemBase item) | ||
163 | { | ||
164 | if (item == null) | ||
165 | return false; | ||
166 | |||
167 | if (item.Folder == UUID.Zero) | ||
168 | { | ||
169 | InventoryFolderBase f = GetFolderForType(item.Owner, (AssetType)item.AssetType); | ||
170 | if (f != null) | ||
171 | item.Folder = f.ID; | ||
172 | else | ||
173 | { | ||
174 | f = GetRootFolder(item.Owner); | ||
175 | if (f != null) | ||
176 | item.Folder = f.ID; | ||
177 | else | ||
178 | return false; | ||
179 | } | ||
180 | } | ||
181 | |||
182 | return AddItemPlain(item); | ||
183 | } | ||
184 | |||
185 | protected abstract bool AddItemPlain(InventoryItemBase item); | ||
186 | |||
187 | /// <summary> | ||
188 | /// Update an item in the user's inventory | ||
189 | /// </summary> | ||
190 | /// <param name="item"></param> | ||
191 | /// <returns>true if the item was successfully updated</returns> | ||
192 | public abstract bool UpdateItem(InventoryItemBase item); | ||
193 | |||
194 | public abstract bool MoveItems(UUID ownerID, List<InventoryItemBase> items); | ||
195 | |||
196 | /// <summary> | ||
197 | /// Delete an item from the user's inventory | ||
198 | /// </summary> | ||
199 | /// <param name="item"></param> | ||
200 | /// <returns>true if the item was successfully deleted</returns> | ||
201 | public abstract bool DeleteItems(UUID ownerID, List<UUID> itemIDs); | ||
202 | |||
203 | public abstract InventoryItemBase GetItem(InventoryItemBase item); | ||
204 | |||
205 | public abstract InventoryFolderBase GetFolder(InventoryFolderBase folder); | ||
206 | |||
207 | /// <summary> | ||
208 | /// Does the given user have an inventory structure? | ||
209 | /// </summary> | ||
210 | /// <param name="userID"></param> | ||
211 | /// <returns></returns> | ||
212 | public abstract bool HasInventoryForUser(UUID userID); | ||
213 | |||
214 | /// <summary> | ||
215 | /// Get the active gestures of the agent. | ||
216 | /// </summary> | ||
217 | /// <param name="userId"></param> | ||
218 | /// <returns></returns> | ||
219 | public abstract List<InventoryItemBase> GetActiveGestures(UUID userId); | ||
220 | |||
221 | public abstract int GetAssetPermissions(UUID userID, UUID assetID); | ||
222 | } | ||
223 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 0d121ed..b5c0af6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -218,9 +218,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
218 | /// <param name="userID"></param> | 218 | /// <param name="userID"></param> |
219 | private void CacheInventoryServiceURL(UUID userID) | 219 | private void CacheInventoryServiceURL(UUID userID) |
220 | { | 220 | { |
221 | if (m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID) == null) | 221 | if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(userID)) |
222 | { | 222 | { |
223 | // The user does not have a local account; let's cache its service URL | 223 | // The user is not local; let's cache its service URL |
224 | string inventoryURL = string.Empty; | 224 | string inventoryURL = string.Empty; |
225 | ScenePresence sp = null; | 225 | ScenePresence sp = null; |
226 | foreach (Scene scene in m_Scenes) | 226 | foreach (Scene scene in m_Scenes) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs deleted file mode 100644 index 2322d7c..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ /dev/null | |||
@@ -1,237 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
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. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | |||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework.Client; | ||
34 | using OpenSim.Region.Framework.Scenes; | ||
35 | |||
36 | using OpenMetaverse; | ||
37 | using Nini.Config; | ||
38 | using log4net; | ||
39 | |||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | ||
41 | { | ||
42 | public class InventoryCache | ||
43 | { | ||
44 | private static readonly ILog m_log = | ||
45 | LogManager.GetLogger( | ||
46 | MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | protected BaseInventoryConnector m_Connector; | ||
49 | protected List<Scene> m_Scenes; | ||
50 | |||
51 | // The cache proper | ||
52 | protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache; | ||
53 | |||
54 | // A cache of userIDs --> ServiceURLs, for HGBroker only | ||
55 | protected Dictionary<UUID, string> m_InventoryURLs = | ||
56 | new Dictionary<UUID, string>(); | ||
57 | |||
58 | public virtual void Init(IConfigSource source, BaseInventoryConnector connector) | ||
59 | { | ||
60 | m_Scenes = new List<Scene>(); | ||
61 | m_InventoryCache = new Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>>(); | ||
62 | m_Connector = connector; | ||
63 | } | ||
64 | |||
65 | public virtual void AddRegion(Scene scene) | ||
66 | { | ||
67 | m_Scenes.Add(scene); | ||
68 | scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; | ||
69 | scene.EventManager.OnClientClosed += OnClientClosed; | ||
70 | } | ||
71 | |||
72 | public virtual void RemoveRegion(Scene scene) | ||
73 | { | ||
74 | if ((m_Scenes != null) && m_Scenes.Contains(scene)) | ||
75 | { | ||
76 | m_Scenes.Remove(scene); | ||
77 | } | ||
78 | } | ||
79 | |||
80 | void OnMakeRootAgent(ScenePresence presence) | ||
81 | { | ||
82 | // Get system folders | ||
83 | |||
84 | // First check if they're here already | ||
85 | lock (m_InventoryCache) | ||
86 | { | ||
87 | if (m_InventoryCache.ContainsKey(presence.UUID)) | ||
88 | { | ||
89 | m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent, system folders for {0} {1} already in cache", presence.Firstname, presence.Lastname); | ||
90 | return; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | // If not, go get them and place them in the cache | ||
95 | Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID); | ||
96 | CacheInventoryServiceURL(presence.Scene, presence.UUID); | ||
97 | |||
98 | m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", | ||
99 | presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); | ||
100 | |||
101 | } | ||
102 | |||
103 | void OnClientClosed(UUID clientID, Scene scene) | ||
104 | { | ||
105 | if (m_InventoryCache.ContainsKey(clientID)) // if it's still in cache | ||
106 | { | ||
107 | ScenePresence sp = null; | ||
108 | foreach (Scene s in m_Scenes) | ||
109 | { | ||
110 | s.TryGetScenePresence(clientID, out sp); | ||
111 | if ((sp != null) && !sp.IsChildAgent && (s != scene)) | ||
112 | { | ||
113 | m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping system folders in cache", | ||
114 | scene.RegionInfo.RegionName, clientID); | ||
115 | return; | ||
116 | } | ||
117 | } | ||
118 | |||
119 | m_log.DebugFormat( | ||
120 | "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", | ||
121 | scene.RegionInfo.RegionName, clientID); | ||
122 | DropCachedSystemFolders(clientID); | ||
123 | DropInventoryServiceURL(clientID); | ||
124 | } | ||
125 | } | ||
126 | |||
127 | /// <summary> | ||
128 | /// Cache a user's 'system' folders. | ||
129 | /// </summary> | ||
130 | /// <param name="userID"></param> | ||
131 | /// <returns>Folders cached</returns> | ||
132 | protected Dictionary<AssetType, InventoryFolderBase> CacheSystemFolders(UUID userID) | ||
133 | { | ||
134 | // If not, go get them and place them in the cache | ||
135 | Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(userID); | ||
136 | |||
137 | if (folders.Count > 0) | ||
138 | lock (m_InventoryCache) | ||
139 | m_InventoryCache.Add(userID, folders); | ||
140 | |||
141 | return folders; | ||
142 | } | ||
143 | |||
144 | /// <summary> | ||
145 | /// Drop a user's cached 'system' folders | ||
146 | /// </summary> | ||
147 | /// <param name="userID"></param> | ||
148 | protected void DropCachedSystemFolders(UUID userID) | ||
149 | { | ||
150 | // Drop system folders | ||
151 | lock (m_InventoryCache) | ||
152 | if (m_InventoryCache.ContainsKey(userID)) | ||
153 | m_InventoryCache.Remove(userID); | ||
154 | } | ||
155 | |||
156 | /// <summary> | ||
157 | /// Get the system folder for a particular asset type | ||
158 | /// </summary> | ||
159 | /// <param name="userID"></param> | ||
160 | /// <param name="type"></param> | ||
161 | /// <returns></returns> | ||
162 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
163 | { | ||
164 | m_log.DebugFormat("[INVENTORY CACHE]: Getting folder for asset type {0} for user {1}", type, userID); | ||
165 | |||
166 | Dictionary<AssetType, InventoryFolderBase> folders = null; | ||
167 | |||
168 | lock (m_InventoryCache) | ||
169 | { | ||
170 | m_InventoryCache.TryGetValue(userID, out folders); | ||
171 | |||
172 | // In some situations (such as non-secured standalones), system folders can be requested without | ||
173 | // the user being logged in. So we need to try caching them here if we don't already have them. | ||
174 | if (null == folders) | ||
175 | CacheSystemFolders(userID); | ||
176 | |||
177 | m_InventoryCache.TryGetValue(userID, out folders); | ||
178 | } | ||
179 | |||
180 | if ((folders != null) && folders.ContainsKey(type)) | ||
181 | { | ||
182 | m_log.DebugFormat( | ||
183 | "[INVENTORY CACHE]: Returning folder {0} as type {1} for {2}", folders[type], type, userID); | ||
184 | |||
185 | return folders[type]; | ||
186 | } | ||
187 | |||
188 | m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID); | ||
189 | |||
190 | return null; | ||
191 | } | ||
192 | |||
193 | /// <summary> | ||
194 | /// Gets the user's inventory URL from its serviceURLs, if the user is foreign, | ||
195 | /// and sticks it in the cache | ||
196 | /// </summary> | ||
197 | /// <param name="userID"></param> | ||
198 | private void CacheInventoryServiceURL(Scene scene, UUID userID) | ||
199 | { | ||
200 | if (scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID) == null) | ||
201 | { | ||
202 | // The user does not have a local account; let's cache its service URL | ||
203 | string inventoryURL = string.Empty; | ||
204 | ScenePresence sp = null; | ||
205 | scene.TryGetScenePresence(userID, out sp); | ||
206 | if (sp != null) | ||
207 | { | ||
208 | AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
209 | if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI")) | ||
210 | { | ||
211 | inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString(); | ||
212 | if (inventoryURL != null && inventoryURL != string.Empty) | ||
213 | { | ||
214 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); | ||
215 | m_InventoryURLs.Add(userID, inventoryURL); | ||
216 | } | ||
217 | } | ||
218 | } | ||
219 | } | ||
220 | } | ||
221 | |||
222 | private void DropInventoryServiceURL(UUID userID) | ||
223 | { | ||
224 | lock (m_InventoryURLs) | ||
225 | if (m_InventoryURLs.ContainsKey(userID)) | ||
226 | m_InventoryURLs.Remove(userID); | ||
227 | } | ||
228 | |||
229 | public string GetInventoryServiceURL(UUID userID) | ||
230 | { | ||
231 | if (m_InventoryURLs.ContainsKey(userID)) | ||
232 | return m_InventoryURLs[userID]; | ||
233 | |||
234 | return null; | ||
235 | } | ||
236 | } | ||
237 | } | ||