From 4e30f862af218de783552ffc2ca68ae8a11509c5 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 18 Mar 2008 03:09:38 +0000 Subject: [PATCH] Building on Joha's update... * Server now listens to the client's start location request for 'home' or 'last' and sends the user to the home location or the last location. --- .../Framework/Communications/LoginService.cs | 22 ++++++++++++-- OpenSim/Grid/UserServer/UserLoginService.cs | 30 +++++++++++++++---- .../Communications/Local/LocalLoginService.cs | 18 +++++++++-- 3 files changed, 60 insertions(+), 10 deletions(-) diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index fc02ff6a52..5547c24f59 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs @@ -93,6 +93,14 @@ namespace OpenSim.Framework.UserManagement (requestData.Contains("passwd") || requestData.Contains("web_login_key"))); bool GoodLogin = false; + string startLocationRequest = "last"; + + if (requestData.Contains("start")) + { + startLocationRequest = (string)requestData["start"]; + m_log.Info("[LOGIN]: Client Requested Start: " + (string)requestData["start"]); + } + UserProfileData userProfile; LoginResponse logResponse = new LoginResponse(); @@ -213,7 +221,7 @@ namespace OpenSim.Framework.UserManagement try { - CustomiseResponse(logResponse, userProfile); + CustomiseResponse(logResponse, userProfile, startLocationRequest); } catch (Exception e) { @@ -252,6 +260,8 @@ namespace OpenSim.Framework.UserManagement { bool GoodLogin = false; + string startLocationRequest = "last"; + UserProfileData userProfile = null; LoginResponse logResponse = new LoginResponse(); @@ -265,6 +275,12 @@ namespace OpenSim.Framework.UserManagement string lastname = map["last"].AsString(); string passwd = map["passwd"].AsString(); + if (map.ContainsKey("start")) + { + m_log.Info("[LOGIN]: StartLocation Requested: " + map["start"].AsString()); + startLocationRequest = map["start"].AsString(); + } + userProfile = GetTheUser(firstname, lastname); if (userProfile == null) { @@ -342,7 +358,7 @@ namespace OpenSim.Framework.UserManagement try { - CustomiseResponse(logResponse, userProfile); + CustomiseResponse(logResponse, userProfile, startLocationRequest); } catch (Exception ex) { @@ -376,7 +392,7 @@ namespace OpenSim.Framework.UserManagement /// /// The existing response /// The user profile - public virtual void CustomiseResponse(LoginResponse response, UserProfileData theUser) + public virtual void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest) { } diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index e03ac3a44c..c8d06191ee 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs @@ -71,7 +71,7 @@ namespace OpenSim.Grid.UserServer /// /// The existing response /// The user profile - public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) + public override void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest) { bool tryDefault = false; //CFK: Since the try is always "tried", the "Home Location" message should always appear, so comment this one. @@ -79,10 +79,30 @@ namespace OpenSim.Grid.UserServer try { - RegionProfileData SimInfo = - RegionProfileData.RequestSimProfileData( - theUser.currentAgent.currentHandle, m_config.GridServerURL, - m_config.GridSendKey, m_config.GridRecvKey); + RegionProfileData SimInfo = null; + if (startLocationRequest == "last") + { + SimInfo = + RegionProfileData.RequestSimProfileData( + theUser.currentAgent.currentHandle, m_config.GridServerURL, + m_config.GridSendKey, m_config.GridRecvKey); + } + else if (startLocationRequest == "home") + { + SimInfo = + RegionProfileData.RequestSimProfileData( + theUser.homeRegion, m_config.GridServerURL, + m_config.GridSendKey, m_config.GridRecvKey); + + } + else + { + // TODO: Parse out startlocationrequest string in the format; 'uri:RegionName&X&Y&Z' + SimInfo = + RegionProfileData.RequestSimProfileData( + theUser.currentAgent.currentHandle, m_config.GridServerURL, + m_config.GridSendKey, m_config.GridRecvKey); + } // Customise the response //CFK: This is redundant and the next message should always appear. diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index d7b3a58025..6088890866 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs @@ -123,9 +123,23 @@ namespace OpenSim.Region.Communications.Local } } - public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) + public override void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest) { - ulong currentRegion = theUser.currentAgent.currentHandle; + ulong currentRegion = 0; + if (startLocationRequest == "last") + { + currentRegion = theUser.currentAgent.currentHandle; + } + else if (startLocationRequest == "home") + { + currentRegion = theUser.homeRegion; + } + else + { + // TODO: Parse string in the following format: 'uri:RegionName&X&Y&Z' + currentRegion = theUser.currentAgent.currentHandle; + } + RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion); if (reg != null)