From a3851b3812aae6221714b1e61656d0853fce7124 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 20 Jan 2008 23:08:50 +0000 Subject: * Added hooks for logout to all IUserService and all that implement it. * Added a Logout message with a name on the console * Added a *fixme* message to figure out why the current agent session is null * After updating you may notice that there's a login and also a logout --- .../Communications/CommunicationsManager.cs | 13 ++++++++ .../Framework/Communications/UserManagerBase.cs | 37 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) (limited to 'OpenSim/Framework/Communications') diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index a07b165..baf24f0 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -163,6 +163,19 @@ namespace OpenSim.Framework.Communications { m_userService.AddNewUserFriend(friendlistowner, friend, perms); } + /// + /// Logs off a user and does the appropriate communications + /// + /// + /// + /// + /// + /// + /// + public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz) + { + m_userService.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); + } /// /// Delete friend on friendlistowner's friendlist. diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 4216553..8821776 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -411,7 +411,44 @@ namespace OpenSim.Framework.UserManagement profile.currentAgent = agent; } + public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz) + { + UserProfileData userProfile; + UserAgentData userAgent; + LLVector3 currentPos = new LLVector3(posx, posy, posz); + + userProfile = GetUserProfile(userid); + + if (userProfile != null) + { + + userAgent = userProfile.currentAgent; + if (userAgent != null) + { + userAgent.agentOnline = false; + userAgent.logoutTime = Util.UnixTimeSinceEpoch(); + userAgent.sessionID = LLUUID.Zero; + userAgent.currentRegion = regionid; + userAgent.currentHandle = regionhandle; + + userAgent.currentPos = currentPos; + + userProfile.currentAgent = userAgent; + + CommitAgent(ref userProfile); + } + else + { + MainLog.Instance.Verbose("LOGOUT", "didn't save logout position, currentAgent is null *do Fix "); + } + MainLog.Instance.Verbose("LOGOUT", userProfile.username + " " + userProfile.surname); + } + else + { + MainLog.Instance.Warn("LOGOUT", "Unknown User logged out"); + } + } public void CreateAgent(UserProfileData profile, LLSD request) { UserAgentData agent = new UserAgentData(); -- cgit v1.1