diff options
Diffstat (limited to 'OpenSim/Grid/UserServer/UserLoginService.cs')
-rw-r--r-- | OpenSim/Grid/UserServer/UserLoginService.cs | 81 |
1 files changed, 49 insertions, 32 deletions
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 972f363..198f95c 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs | |||
@@ -40,7 +40,8 @@ using OpenSim.Framework.Communications.Cache; | |||
40 | namespace OpenSim.Grid.UserServer | 40 | namespace OpenSim.Grid.UserServer |
41 | { | 41 | { |
42 | public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, | 42 | public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, |
43 | ulong regionhandle, float positionX, float positionY, float positionZ, string firstname, string lastname); | 43 | ulong regionhandle, float positionX, float positionY, float positionZ, |
44 | string firstname, string lastname); | ||
44 | 45 | ||
45 | public class UserLoginService : LoginService | 46 | public class UserLoginService : LoginService |
46 | { | 47 | { |
@@ -55,7 +56,8 @@ namespace OpenSim.Grid.UserServer | |||
55 | public UserConfig m_config; | 56 | public UserConfig m_config; |
56 | 57 | ||
57 | public UserLoginService( | 58 | public UserLoginService( |
58 | UserManagerBase userManager, IInterServiceInventoryServices inventoryService, LibraryRootFolder libraryRootFolder, | 59 | UserManagerBase userManager, IInterServiceInventoryServices inventoryService, |
60 | LibraryRootFolder libraryRootFolder, | ||
59 | UserConfig config, string welcomeMess) | 61 | UserConfig config, string welcomeMess) |
60 | : base(userManager, libraryRootFolder, welcomeMess) | 62 | : base(userManager, libraryRootFolder, welcomeMess) |
61 | { | 63 | { |
@@ -69,8 +71,8 @@ namespace OpenSim.Grid.UserServer | |||
69 | try | 71 | try |
70 | { | 72 | { |
71 | SimInfo = RegionProfileData.RequestSimProfileData( | 73 | SimInfo = RegionProfileData.RequestSimProfileData( |
72 | theUser.CurrentAgent.Handle, m_config.GridServerURL, | 74 | theUser.CurrentAgent.Handle, m_config.GridServerURL, |
73 | m_config.GridSendKey, m_config.GridRecvKey); | 75 | m_config.GridSendKey, m_config.GridRecvKey); |
74 | 76 | ||
75 | if (SimInfo == null) | 77 | if (SimInfo == null) |
76 | { | 78 | { |
@@ -99,7 +101,8 @@ namespace OpenSim.Grid.UserServer | |||
99 | 101 | ||
100 | m_log.InfoFormat( | 102 | m_log.InfoFormat( |
101 | "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", | 103 | "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", |
102 | SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, theUser.FirstName + " " + theUser.SurName); | 104 | SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, |
105 | theUser.FirstName + " " + theUser.SurName); | ||
103 | 106 | ||
104 | try | 107 | try |
105 | { | 108 | { |
@@ -120,6 +123,7 @@ namespace OpenSim.Grid.UserServer | |||
120 | 123 | ||
121 | //base.LogOffUser(theUser); | 124 | //base.LogOffUser(theUser); |
122 | } | 125 | } |
126 | |||
123 | //public override void LogOffUser(UserProfileData theUser) | 127 | //public override void LogOffUser(UserProfileData theUser) |
124 | //{ | 128 | //{ |
125 | 129 | ||
@@ -131,7 +135,8 @@ namespace OpenSim.Grid.UserServer | |||
131 | /// <param name="response">The existing response</param> | 135 | /// <param name="response">The existing response</param> |
132 | /// <param name="theUser">The user profile</param> | 136 | /// <param name="theUser">The user profile</param> |
133 | /// <param name="startLocationRequest">Destination of the user</param> | 137 | /// <param name="startLocationRequest">Destination of the user</param> |
134 | public override void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest) | 138 | public override void CustomiseResponse(LoginResponse response, UserProfileData theUser, |
139 | string startLocationRequest) | ||
135 | { | 140 | { |
136 | bool tryDefault = false; | 141 | bool tryDefault = false; |
137 | //CFK: Since the try is always "tried", the "Home Location" message should always appear, so comment this one. | 142 | //CFK: Since the try is always "tried", the "Home Location" message should always appear, so comment this one. |
@@ -175,7 +180,9 @@ namespace OpenSim.Grid.UserServer | |||
175 | else | 180 | else |
176 | { | 181 | { |
177 | string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest); | 182 | string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest); |
178 | m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + startLocationRequestParsed[1] + ", 3:" + startLocationRequestParsed[2] + ", 4:" + startLocationRequestParsed[3]); | 183 | m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + |
184 | startLocationRequestParsed[1] + ", 3:" + startLocationRequestParsed[2] + ", 4:" + | ||
185 | startLocationRequestParsed[3]); | ||
179 | if (startLocationRequestParsed[0] == "last") | 186 | if (startLocationRequestParsed[0] == "last") |
180 | { | 187 | { |
181 | SimInfo = | 188 | SimInfo = |
@@ -187,9 +194,9 @@ namespace OpenSim.Grid.UserServer | |||
187 | { | 194 | { |
188 | m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]); | 195 | m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]); |
189 | SimInfo = | 196 | SimInfo = |
190 | RegionProfileData.RequestSimProfileData( | 197 | RegionProfileData.RequestSimProfileData( |
191 | startLocationRequestParsed[0], m_config.GridServerURL, | 198 | startLocationRequestParsed[0], m_config.GridServerURL, |
192 | m_config.GridSendKey, m_config.GridRecvKey); | 199 | m_config.GridSendKey, m_config.GridRecvKey); |
193 | 200 | ||
194 | if (SimInfo == null) | 201 | if (SimInfo == null) |
195 | { | 202 | { |
@@ -208,11 +215,13 @@ namespace OpenSim.Grid.UserServer | |||
208 | // Customise the response | 215 | // Customise the response |
209 | //CFK: This is redundant and the next message should always appear. | 216 | //CFK: This is redundant and the next message should always appear. |
210 | //CFK: m_log.Info("[LOGIN]: Home Location"); | 217 | //CFK: m_log.Info("[LOGIN]: Home Location"); |
211 | response.Home = string.Format("{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", | 218 | response.Home = |
212 | (HomeInfo.regionLocX * Constants.RegionSize), | 219 | string.Format( |
213 | (HomeInfo.regionLocY * Constants.RegionSize), | 220 | "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", |
214 | theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z, | 221 | (HomeInfo.regionLocX*Constants.RegionSize), |
215 | theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); | 222 | (HomeInfo.regionLocY*Constants.RegionSize), |
223 | theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z, | ||
224 | theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); | ||
216 | 225 | ||
217 | // Destination | 226 | // Destination |
218 | //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into | 227 | //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into |
@@ -220,7 +229,7 @@ namespace OpenSim.Grid.UserServer | |||
220 | //CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + | 229 | //CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + |
221 | //CFK: "; Region Y: " + SimInfo.regionLocY); | 230 | //CFK: "; Region Y: " + SimInfo.regionLocY); |
222 | response.SimAddress = Util.GetHostFromURL(SimInfo.serverURI).ToString(); | 231 | response.SimAddress = Util.GetHostFromURL(SimInfo.serverURI).ToString(); |
223 | response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]); | 232 | response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] {'/', ':'})[4]); |
224 | response.RegionX = SimInfo.regionLocX; | 233 | response.RegionX = SimInfo.regionLocX; |
225 | response.RegionY = SimInfo.regionLocY; | 234 | response.RegionY = SimInfo.regionLocY; |
226 | 235 | ||
@@ -283,10 +292,10 @@ namespace OpenSim.Grid.UserServer | |||
283 | 292 | ||
284 | if (GridResp.Value != null) | 293 | if (GridResp.Value != null) |
285 | { | 294 | { |
286 | Hashtable resp = (Hashtable)GridResp.Value; | 295 | Hashtable resp = (Hashtable) GridResp.Value; |
287 | if (resp.ContainsKey("success")) | 296 | if (resp.ContainsKey("success")) |
288 | { | 297 | { |
289 | if ((string)resp["success"] == "FALSE") | 298 | if ((string) resp["success"] == "FALSE") |
290 | { | 299 | { |
291 | responseSuccess = false; | 300 | responseSuccess = false; |
292 | tryDefault = true; | 301 | tryDefault = true; |
@@ -300,15 +309,18 @@ namespace OpenSim.Grid.UserServer | |||
300 | if (handlerUserLoggedInAtLocation != null) | 309 | if (handlerUserLoggedInAtLocation != null) |
301 | { | 310 | { |
302 | //m_log.Info("[LOGIN]: Letting other objects know about login"); | 311 | //m_log.Info("[LOGIN]: Letting other objects know about login"); |
303 | handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, | 312 | handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, |
304 | theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z, | 313 | theUser.CurrentAgent.Region, |
305 | theUser.FirstName, theUser.SurName); | 314 | theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, |
315 | theUser.CurrentAgent.Position.Y, | ||
316 | theUser.CurrentAgent.Position.Z, | ||
317 | theUser.FirstName, theUser.SurName); | ||
306 | } | 318 | } |
307 | } | 319 | } |
308 | } | 320 | } |
309 | } | 321 | } |
310 | catch (Exception) | 322 | catch (Exception) |
311 | //catch (System.AccessViolationException) | 323 | //catch (System.AccessViolationException) |
312 | { | 324 | { |
313 | tryDefault = true; | 325 | tryDefault = true; |
314 | } | 326 | } |
@@ -318,7 +330,8 @@ namespace OpenSim.Grid.UserServer | |||
318 | // Send him to default region instead | 330 | // Send him to default region instead |
319 | // Load information from the gridserver | 331 | // Load information from the gridserver |
320 | 332 | ||
321 | ulong defaultHandle = (((ulong)m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong)m_config.DefaultY * Constants.RegionSize); | 333 | ulong defaultHandle = (((ulong) m_config.DefaultX*Constants.RegionSize) << 32) | |
334 | ((ulong) m_config.DefaultY*Constants.RegionSize); | ||
322 | 335 | ||
323 | m_log.Warn( | 336 | m_log.Warn( |
324 | "[LOGIN]: Home region not available: sending to default " + defaultHandle); | 337 | "[LOGIN]: Home region not available: sending to default " + defaultHandle); |
@@ -345,7 +358,7 @@ namespace OpenSim.Grid.UserServer | |||
345 | "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + | 358 | "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + |
346 | SimInfo.regionLocY); | 359 | SimInfo.regionLocY); |
347 | response.SimAddress = Util.GetHostFromURL(SimInfo.serverURI).ToString(); | 360 | response.SimAddress = Util.GetHostFromURL(SimInfo.serverURI).ToString(); |
348 | response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]); | 361 | response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] {'/', ':'})[4]); |
349 | response.RegionX = SimInfo.regionLocX; | 362 | response.RegionX = SimInfo.regionLocX; |
350 | response.RegionY = SimInfo.regionLocY; | 363 | response.RegionY = SimInfo.regionLocY; |
351 | 364 | ||
@@ -391,7 +404,7 @@ namespace OpenSim.Grid.UserServer | |||
391 | Hashtable resp = (Hashtable) GridResp.Value; | 404 | Hashtable resp = (Hashtable) GridResp.Value; |
392 | if (resp.ContainsKey("success")) | 405 | if (resp.ContainsKey("success")) |
393 | { | 406 | { |
394 | if ((string)resp["success"] == "FALSE") | 407 | if ((string) resp["success"] == "FALSE") |
395 | { | 408 | { |
396 | responseSuccess = false; | 409 | responseSuccess = false; |
397 | } | 410 | } |
@@ -404,9 +417,13 @@ namespace OpenSim.Grid.UserServer | |||
404 | if (handlerUserLoggedInAtLocation != null) | 417 | if (handlerUserLoggedInAtLocation != null) |
405 | { | 418 | { |
406 | m_log.Info("[LOGIN]: Letting other objects know about login"); | 419 | m_log.Info("[LOGIN]: Letting other objects know about login"); |
407 | handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, | 420 | handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, |
408 | theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z, | 421 | theUser.CurrentAgent.Region, |
409 | theUser.FirstName, theUser.SurName); | 422 | theUser.CurrentAgent.Handle, |
423 | theUser.CurrentAgent.Position.X, | ||
424 | theUser.CurrentAgent.Position.Y, | ||
425 | theUser.CurrentAgent.Position.Z, | ||
426 | theUser.FirstName, theUser.SurName); | ||
410 | } | 427 | } |
411 | } | 428 | } |
412 | else | 429 | else |
@@ -432,8 +449,8 @@ namespace OpenSim.Grid.UserServer | |||
432 | protected override InventoryData GetInventorySkeleton(LLUUID userID) | 449 | protected override InventoryData GetInventorySkeleton(LLUUID userID) |
433 | { | 450 | { |
434 | m_log.DebugFormat( | 451 | m_log.DebugFormat( |
435 | "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}", | 452 | "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}", |
436 | m_config.InventoryUrl, userID); | 453 | m_config.InventoryUrl, userID); |
437 | 454 | ||
438 | List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID); | 455 | List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID); |
439 | 456 | ||
@@ -451,7 +468,7 @@ namespace OpenSim.Grid.UserServer | |||
451 | throw new Exception( | 468 | throw new Exception( |
452 | String.Format( | 469 | String.Format( |
453 | "The inventory creation request for user {0} did not succeed." | 470 | "The inventory creation request for user {0} did not succeed." |
454 | + " Please contact your inventory service provider for more information.", | 471 | + " Please contact your inventory service provider for more information.", |
455 | userID)); | 472 | userID)); |
456 | } | 473 | } |
457 | m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID); | 474 | m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID); |
@@ -490,4 +507,4 @@ namespace OpenSim.Grid.UserServer | |||
490 | userID)); | 507 | userID)); |
491 | } | 508 | } |
492 | } | 509 | } |
493 | } | 510 | } \ No newline at end of file |