From febe78d06249cd4d36a86e97610dd45ab518a757 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Sat, 31 May 2008 12:18:29 +0000
Subject: * Implements UserServer logoff in a few situations * User tries to
log-in but is already logged in. Userserver will send message to simulator
user was in to log the user out there. * From the UserServer, admin types
'logoff-user firstname lastname message'. * Some regions may not get the
message because they're not updated yet.
---
OpenSim/Framework/Communications/IUserService.cs | 7 +++++++
OpenSim/Framework/Communications/LoginService.cs | 15 ++++++++++++++-
OpenSim/Framework/Communications/UserManagerBase.cs | 15 +++++++++++++++
OpenSim/Framework/IRegionCommsListener.cs | 3 +++
OpenSim/Framework/IUserData.cs | 7 +------
OpenSim/Framework/RegionCommsListener.cs | 13 +++++++++++++
OpenSim/Framework/Servers/BaseOpenSimServer.cs | 1 +
7 files changed, 54 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs
index 67a8c78..59ad188 100644
--- a/OpenSim/Framework/Communications/IUserService.cs
+++ b/OpenSim/Framework/Communications/IUserService.cs
@@ -113,6 +113,13 @@ namespace OpenSim.Framework.Communications
/// Get's the User Appearance
AvatarAppearance GetUserAppearance(LLUUID user);
+ ///
+ /// Updates the current region the User is in
+ ///
+ /// User Region the Avatar is IN
+ /// User Region the Avatar is IN
+ void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle);
+
void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance);
void AddAttachment(LLUUID user, LLUUID attach);
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index bd0fa53..08b071f 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -79,7 +79,15 @@ namespace OpenSim.Framework.Communications
/// The existing response
/// The user profile
public abstract void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest);
+
+ ///
+ /// If the user is already logged in, try to notify the region that the user they've got is dead.
+ ///
+ ///
+ public virtual void LogOffUser(UserProfileData theUser, string message)
+ {
+ }
///
/// Get the initial login inventory skeleton (in other words, the folder structure) for the given user.
///
@@ -196,9 +204,14 @@ namespace OpenSim.Framework.Communications
// because of some problem, for instance, the crashment of server or client,
// the user cannot log in any longer.
userProfile.CurrentAgent.AgentOnline = false;
- m_userManager.CommitAgent(ref userProfile);
+ m_userManager.CommitAgent(ref userProfile);
+
+ // try to tell the region that their user is dead.
+ LogOffUser(userProfile, "You were logged off because you logged in from another location");
+
// Reject the login
+
m_log.InfoFormat(
"[LOGIN END]: Notifying user {0} {1} that they are already logged in",
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 87e06f1..8985bb6 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -187,6 +187,21 @@ namespace OpenSim.Framework.Communications
return null;
}
+ public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle)
+ {
+ foreach (KeyValuePair plugin in _plugins)
+ {
+ try
+ {
+ plugin.Value.UpdateUserCurrentRegion(avatarid, regionuuid, regionhandle);
+ }
+ catch (Exception e)
+ {
+ m_log.Info("[USERSTORAGE]: Unable to updateuser location via " + plugin.Key + "(" + e.ToString() + ")");
+ }
+ }
+ }
+
///
/// Loads a user's friend list
///
diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs
index 1476855..ce84a40 100644
--- a/OpenSim/Framework/IRegionCommsListener.cs
+++ b/OpenSim/Framework/IRegionCommsListener.cs
@@ -50,6 +50,8 @@ namespace OpenSim.Framework
public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData);
+ public delegate void LogOffUser(ulong regionHandle, LLUUID agentID, LLUUID regionSecret, string message);
+
public interface IRegionCommsListener
{
event ExpectUserDelegate OnExpectUser;
@@ -63,5 +65,6 @@ namespace OpenSim.Framework
event CloseAgentConnection OnCloseAgentConnection;
event RegionUp OnRegionUp;
event ChildAgentUpdate OnChildAgentUpdate;
+ event LogOffUser OnLogOffUser;
}
}
\ No newline at end of file
diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs
index 0b25f7e..5952713 100644
--- a/OpenSim/Framework/IUserData.cs
+++ b/OpenSim/Framework/IUserData.cs
@@ -98,13 +98,8 @@ namespace OpenSim.Framework
/// UserProfile to update
bool UpdateUserProfile(UserProfileData user);
- ///
- /// Updates the current region the User is in
- ///
- /// User Region the Avatar is IN
- /// User Region the Avatar is IN
- void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid);
+ void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle);
///
/// Adds a new agent to the database
///
diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs
index c4c5813..4045b44 100644
--- a/OpenSim/Framework/RegionCommsListener.cs
+++ b/OpenSim/Framework/RegionCommsListener.cs
@@ -45,6 +45,7 @@ namespace OpenSim.Framework
private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate;
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
private RegionUp handlerRegionUp = null; // OnRegionUp;
+ private LogOffUser handlerLogOffUser = null;
#region IRegionCommsListener Members
@@ -59,6 +60,7 @@ namespace OpenSim.Framework
public event CloseAgentConnection OnCloseAgentConnection;
public event RegionUp OnRegionUp;
public event ChildAgentUpdate OnChildAgentUpdate;
+ public event LogOffUser OnLogOffUser;
#endregion
@@ -79,6 +81,17 @@ namespace OpenSim.Framework
return false;
}
+ // From User Server
+ public virtual void TriggerLogOffUser(ulong regionHandle, LLUUID agentID, LLUUID RegionSecret, string message)
+ {
+ handlerLogOffUser = OnLogOffUser;
+ if (handlerLogOffUser != null)
+ {
+ handlerLogOffUser(regionHandle, agentID, RegionSecret, message);
+ }
+
+ }
+
public virtual bool TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData, int XMLMethod)
{
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index fcbc5a1..60c6883 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -84,6 +84,7 @@ namespace OpenSim.Framework.Servers
Notice("show uptime - show server startup and uptime.");
Notice("shutdown - shutdown the server.\n");
+
break;
case "show":
--
cgit v1.1