* 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.
This commit is contained in:
Teravus Ovares
2008-05-31 12:18:29 +00:00
parent f2f183b307
commit febe78d062
21 changed files with 344 additions and 17 deletions

View File

@@ -113,6 +113,13 @@ namespace OpenSim.Framework.Communications
/// Get's the User Appearance
AvatarAppearance GetUserAppearance(LLUUID user);
/// <summary>
/// Updates the current region the User is in
/// </summary>
/// <param name="avatarid">User Region the Avatar is IN</param>
/// <param name="retionuuid">User Region the Avatar is IN</param>
void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle);
void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance);
void AddAttachment(LLUUID user, LLUUID attach);

View File

@@ -79,7 +79,15 @@ namespace OpenSim.Framework.Communications
/// <param name="response">The existing response</param>
/// <param name="theUser">The user profile</param>
public abstract void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest);
/// <summary>
/// If the user is already logged in, try to notify the region that the user they've got is dead.
/// </summary>
/// <param name="theUser"></param>
public virtual void LogOffUser(UserProfileData theUser, string message)
{
}
/// <summary>
/// Get the initial login inventory skeleton (in other words, the folder structure) for the given user.
/// </summary>
@@ -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",

View File

@@ -187,6 +187,21 @@ namespace OpenSim.Framework.Communications
return null;
}
public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle)
{
foreach (KeyValuePair<string, IUserData> 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() + ")");
}
}
}
/// <summary>
/// Loads a user's friend list
/// </summary>

View File

@@ -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;
}
}

View File

@@ -98,13 +98,8 @@ namespace OpenSim.Framework
/// <param name="user">UserProfile to update</param>
bool UpdateUserProfile(UserProfileData user);
/// <summary>
/// Updates the current region the User is in
/// </summary>
/// <param name="avatarid">User Region the Avatar is IN</param>
/// <param name="retionuuid">User Region the Avatar is IN</param>
void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid);
void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle);
/// <summary>
/// Adds a new agent to the database
/// </summary>

View File

@@ -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)
{

View File

@@ -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":