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 ++++++++++++++++++++++ OpenSim/Framework/Data.DB4o/DB4oUserData.cs | 5 +-- OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs | 5 +-- OpenSim/Framework/Data.MySQL/MySQLUserData.cs | 4 --- OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs | 6 ++-- OpenSim/Framework/Data.SQLite/SQLiteUserData.cs | 4 --- OpenSim/Framework/IUserData.cs | 6 ---- OpenSim/Framework/IUserService.cs | 10 ++++++ 9 files changed, 65 insertions(+), 25 deletions(-) (limited to 'OpenSim/Framework') 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(); diff --git a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs index 47521e4..6059cbe 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs @@ -169,10 +169,7 @@ namespace OpenSim.Framework.Data.DB4o //MainLog.Instance.Verbose("USER", "Stub UpdateUserCUrrentRegion called"); } - public void LogOffUser(LLUUID avatarid) - { - //MainLog.Instance.Verbose("USER", "Stub LogOffUser called"); - } + public List GeneratePickerResults(LLUUID queryID, string query) { diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs index 429ed39..aa0526c 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs @@ -129,10 +129,7 @@ namespace OpenSim.Framework.Data.MSSQL MainLog.Instance.Verbose("USER", "Stub UpdateUserCUrrentRegion called"); } - public void LogOffUser(LLUUID avatarid) - { - MainLog.Instance.Verbose("USER", "Stub LogOffUser called"); - } + public List GeneratePickerResults(LLUUID queryID, string query) { diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs index f637db6..2ee20e0 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs @@ -331,10 +331,6 @@ namespace OpenSim.Framework.Data.MySQL MainLog.Instance.Verbose("USER", "Stub UpdateUserCUrrentRegion called"); } - public void LogOffUser(LLUUID avatarid) - { - MainLog.Instance.Verbose("USER", "Stub LogOffUser called"); - } public List GeneratePickerResults(LLUUID queryID, string query) { diff --git a/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs b/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs index 1364d3e..2e22f00 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs @@ -188,9 +188,9 @@ namespace OpenSim.Framework.Data.SQLite } else if (prim.Stopped) { - MainLog.Instance.Verbose("DATASTORE", - "Adding stopped obj: " + obj.UUID + " to region: " + regionUUID); - addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); + //MainLog.Instance.Verbose("DATASTORE", + //"Adding stopped obj: " + obj.UUID + " to region: " + regionUUID); + //addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); } else { diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs index ed8275e..ac7340d 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs @@ -234,10 +234,6 @@ namespace OpenSim.Framework.Data.SQLite MainLog.Instance.Verbose("USER", "Stub UpdateUserCUrrentRegion called"); } - public void LogOffUser(LLUUID avatarid) - { - MainLog.Instance.Verbose("USER", "Stub LogOffUser called"); - } public List GeneratePickerResults(LLUUID queryID, string query) { diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs index 9fd6fa8..45ba7fa 100644 --- a/OpenSim/Framework/IUserData.cs +++ b/OpenSim/Framework/IUserData.cs @@ -106,12 +106,6 @@ namespace OpenSim.Framework void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid); /// - /// Log User Off - /// - /// avatar to log off - void LogOffUser(LLUUID avatarid); - - /// /// Adds a new agent to the database /// /// The agent to add diff --git a/OpenSim/Framework/IUserService.cs b/OpenSim/Framework/IUserService.cs index 2b59c25..f1f3c81 100644 --- a/OpenSim/Framework/IUserService.cs +++ b/OpenSim/Framework/IUserService.cs @@ -73,6 +73,16 @@ namespace OpenSim.Framework void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms); /// + /// Logs off a user on the user server + /// + /// UUID of the user + /// UUID of the Region + /// final position x + /// final position y + /// final position z + void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz); + + /// /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner /// /// The agent that we're retreiving the friends Data. -- cgit v1.1