diff options
Diffstat (limited to 'OpenSim/Grid/UserServer.Modules/UserLoginService.cs')
-rw-r--r-- | OpenSim/Grid/UserServer.Modules/UserLoginService.cs | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs index 01d5537..2ca5ada 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs | |||
@@ -34,6 +34,7 @@ using System.Text.RegularExpressions; | |||
34 | using log4net; | 34 | using log4net; |
35 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using Nini.Config; | ||
37 | using OpenSim.Data; | 38 | using OpenSim.Data; |
38 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Communications; | 40 | using OpenSim.Framework.Communications; |
@@ -42,6 +43,9 @@ using OpenSim.Framework.Communications.Cache; | |||
42 | using OpenSim.Framework.Capabilities; | 43 | using OpenSim.Framework.Capabilities; |
43 | using OpenSim.Framework.Servers; | 44 | using OpenSim.Framework.Servers; |
44 | using OpenSim.Framework.Servers.HttpServer; | 45 | using OpenSim.Framework.Servers.HttpServer; |
46 | using OpenSim.Services.Interfaces; | ||
47 | using OpenSim.Services.Connectors; | ||
48 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
45 | 49 | ||
46 | namespace OpenSim.Grid.UserServer.Modules | 50 | namespace OpenSim.Grid.UserServer.Modules |
47 | { | 51 | { |
@@ -63,6 +67,8 @@ namespace OpenSim.Grid.UserServer.Modules | |||
63 | public UserConfig m_config; | 67 | public UserConfig m_config; |
64 | private readonly IRegionProfileRouter m_regionProfileService; | 68 | private readonly IRegionProfileRouter m_regionProfileService; |
65 | 69 | ||
70 | private IGridService m_GridService; | ||
71 | |||
66 | protected BaseHttpServer m_httpServer; | 72 | protected BaseHttpServer m_httpServer; |
67 | 73 | ||
68 | public UserLoginService( | 74 | public UserLoginService( |
@@ -76,6 +82,8 @@ namespace OpenSim.Grid.UserServer.Modules | |||
76 | m_defaultHomeY = m_config.DefaultY; | 82 | m_defaultHomeY = m_config.DefaultY; |
77 | m_interInventoryService = inventoryService; | 83 | m_interInventoryService = inventoryService; |
78 | m_regionProfileService = regionProfileService; | 84 | m_regionProfileService = regionProfileService; |
85 | |||
86 | m_GridService = new GridServicesConnector(config.GridServerURL.ToString()); | ||
79 | } | 87 | } |
80 | 88 | ||
81 | public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers) | 89 | public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers) |
@@ -203,47 +211,37 @@ namespace OpenSim.Grid.UserServer.Modules | |||
203 | 211 | ||
204 | protected override RegionInfo RequestClosestRegion(string region) | 212 | protected override RegionInfo RequestClosestRegion(string region) |
205 | { | 213 | { |
206 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(region, | 214 | return GridRegionToRegionInfo(m_GridService.GetRegionByName(UUID.Zero, region)); |
207 | m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | ||
208 | |||
209 | if (profileData != null) | ||
210 | { | ||
211 | return profileData.ToRegionInfo(); | ||
212 | } | ||
213 | else | ||
214 | { | ||
215 | return null; | ||
216 | } | ||
217 | } | 215 | } |
218 | 216 | ||
219 | protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) | 217 | protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) |
220 | { | 218 | { |
221 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionHandle, | 219 | uint x = 0, y = 0; |
222 | m_config.GridServerURL, m_config.GridSendKey, | 220 | Utils.LongToUInts(homeRegionHandle, out x, out y); |
223 | m_config.GridRecvKey); | 221 | return GridRegionToRegionInfo(m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y)); |
224 | if (profileData != null) | ||
225 | { | ||
226 | return profileData.ToRegionInfo(); | ||
227 | } | ||
228 | else | ||
229 | { | ||
230 | return null; | ||
231 | } | ||
232 | } | 222 | } |
233 | 223 | ||
234 | protected override RegionInfo GetRegionInfo(UUID homeRegionId) | 224 | protected override RegionInfo GetRegionInfo(UUID homeRegionId) |
235 | { | 225 | { |
236 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionId, | 226 | return GridRegionToRegionInfo(m_GridService.GetRegionByUUID(UUID.Zero, homeRegionId)); |
237 | m_config.GridServerURL, m_config.GridSendKey, | 227 | } |
238 | m_config.GridRecvKey); | 228 | |
239 | if (profileData != null) | 229 | private RegionInfo GridRegionToRegionInfo(GridRegion gregion) |
240 | { | 230 | { |
241 | return profileData.ToRegionInfo(); | 231 | if (gregion == null) |
242 | } | ||
243 | else | ||
244 | { | ||
245 | return null; | 232 | return null; |
246 | } | 233 | |
234 | RegionInfo rinfo = new RegionInfo(); | ||
235 | rinfo.ExternalHostName = gregion.ExternalHostName; | ||
236 | rinfo.HttpPort = gregion.HttpPort; | ||
237 | rinfo.InternalEndPoint = gregion.InternalEndPoint; | ||
238 | rinfo.RegionID = gregion.RegionID; | ||
239 | rinfo.RegionLocX = (uint)(gregion.RegionLocX / Constants.RegionSize); | ||
240 | rinfo.RegionLocY = (uint)(gregion.RegionLocY / Constants.RegionSize); | ||
241 | rinfo.RegionName = gregion.RegionName; | ||
242 | rinfo.ScopeID = gregion.ScopeID; | ||
243 | |||
244 | return rinfo; | ||
247 | } | 245 | } |
248 | 246 | ||
249 | protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient) | 247 | protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient) |