* 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 <user> and also a logout<user>
ThreadPoolClientBranch
Teravus Ovares 2008-01-20 23:08:50 +00:00
parent 59d7165f40
commit a3851b3812
15 changed files with 135 additions and 27 deletions

View File

@ -163,6 +163,19 @@ namespace OpenSim.Framework.Communications
{
m_userService.AddNewUserFriend(friendlistowner, friend, perms);
}
/// <summary>
/// Logs off a user and does the appropriate communications
/// </summary>
/// <param name="userid"></param>
/// <param name="regionid"></param>
/// <param name="regionhandle"></param>
/// <param name="posx"></param>
/// <param name="posy"></param>
/// <param name="posz"></param>
public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz)
{
m_userService.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
}
/// <summary>
/// Delete friend on friendlistowner's friendlist.

View File

@ -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();

View File

@ -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<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
{

View File

@ -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<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
{

View File

@ -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<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
{

View File

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

View File

@ -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<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
{

View File

@ -105,12 +105,6 @@ namespace OpenSim.Framework
/// <param name="retionuuid">User Region the Avatar is IN</param>
void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid);
/// <summary>
/// Log User Off
/// </summary>
/// <param name="avatarid">avatar to log off</param>
void LogOffUser(LLUUID avatarid);
/// <summary>
/// Adds a new agent to the database
/// </summary>

View File

@ -72,6 +72,16 @@ namespace OpenSim.Framework
/// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms);
/// <summary>
/// Logs off a user on the user server
/// </summary>
/// <param name="UserID">UUID of the user</param>
/// <param name="regionData">UUID of the Region</param>
/// <param name="posx">final position x</param>
/// <param name="posy">final position y</param>
/// <param name="posz">final position z</param>
void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz);
/// <summary>
/// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner
/// </summary>

View File

@ -388,7 +388,7 @@ namespace OpenSim.Grid.MessagingServer
LLUUID AgentID = new LLUUID((string)requestData["agent_id"]);
ProcessLogOff(AgentID);
//ProcessLogOff(AgentID);
return new XmlRpcResponse();

View File

@ -115,6 +115,7 @@ namespace OpenSim.Grid.UserServer
httpServer.AddXmlRPCHandler("remove_user_friend", m_userManager.XmlRpcResponseXmlRPCRemoveUserFriend);
httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms);
httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList);
httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID);
// Message Server ---> User Server
httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer);

View File

@ -317,6 +317,43 @@ namespace OpenSim.Grid.UserServer
return ProfileToXmlRPCResponse(userProfile);
}
public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request)
{
XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0];
UserProfileData userProfile;
if (requestData.Contains("avatar_uuid"))
{
try
{
LLUUID userUUID = new LLUUID((string)requestData["avatar_uuid"]);
LLUUID RegionID = new LLUUID((string)requestData["region_uuid"]);
ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
float posx = (float)Convert.ToDecimal((string)requestData["region_pos_x"]);
float posy = (float)Convert.ToDecimal((string)requestData["region_pos_y"]);
float posz = (float)Convert.ToDecimal((string)requestData["region_pos_z"]);
LogOffUser(userUUID, RegionID, regionhandle, posx, posy, posz);
}
catch (FormatException)
{
OpenSim.Framework.Console.MainLog.Instance.Warn("LOGOUT", "Error in Logout XMLRPC Params");
return response;
}
}
else
{
return CreateUnknownUserErrorResponse();
}
return response;
}
#endregion
public override UserProfileData SetupMasterUser(string firstName, string lastName)

View File

@ -375,6 +375,9 @@ namespace OpenSim.Region.Communications.OGS1
return neighbours;
}
/// <summary>
/// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates
/// </summary>

View File

@ -130,7 +130,31 @@ namespace OpenSim.Region.Communications.OGS1
return buddylist;
}
/// <summary>
/// Logs off a user on the user server
/// </summary>
/// <param name="UserID">UUID of the user</param>
/// <param name="regionData">UUID of the Region</param>
/// <param name="posx">final position x</param>
/// <param name="posy">final position y</param>
/// <param name="posz">final position z</param>
public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz)
{
Hashtable param = new Hashtable();
param["avatar_uuid"] = userid.UUID.ToString();
param["region_uuid"] = regionid.UUID.ToString();
param["region_handle"] = regionhandle.ToString();
param["region_pos_x"] = posx.ToString();
param["region_pos_y"] = posy.ToString();
param["region_pos_z"] = posz.ToString();
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("logout_of_simulator", parameters);
XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
}
public UserProfileData GetUserProfile(string firstName, string lastName)
{
return GetUserProfile(firstName + " " + lastName);

View File

@ -1285,6 +1285,9 @@ namespace OpenSim.Region.Environment.Scenes
else
{
m_innerScene.removeUserCount(true);
CommsManager.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle,
avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y,
avatar.AbsolutePosition.Z);
}
}
catch (NullReferenceException)