diff options
Diffstat (limited to '')
5 files changed, 167 insertions, 54 deletions
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) |