* Check in first part of http://opensimulator.org/mantis/view.php?id=2073
* This patch aims to introduce look at direction persistence between logins. It won't be active until the second part of the patch is committed in about two weeks time. At this point, region servers that haven't upgraded past this revision may run into problems * This checkin upgrades the user database. As always, we recommend you have backups in case something goes wrong. * Many thanks to tyre for this patch.0.6.0-stable
parent
febb781779
commit
52a4c4d82f
|
@ -512,6 +512,8 @@ namespace OpenSim.Data.MySQL
|
||||||
Vector3 tmp_v;
|
Vector3 tmp_v;
|
||||||
Vector3.TryParse((string) reader["currentPos"], out tmp_v);
|
Vector3.TryParse((string) reader["currentPos"], out tmp_v);
|
||||||
retval.Position = tmp_v;
|
retval.Position = tmp_v;
|
||||||
|
Vector3.TryParse((string)reader["currentLookAt"], out tmp_v);
|
||||||
|
retval.LookAt = tmp_v;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1095,8 +1097,8 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
string sql = String.Empty;
|
string sql = String.Empty;
|
||||||
sql += "REPLACE INTO ";
|
sql += "REPLACE INTO ";
|
||||||
sql += "agents (UUID, sessionID, secureSessionID, agentIP, agentPort, agentOnline, loginTime, logoutTime, currentRegion, currentHandle, currentPos) VALUES ";
|
sql += "agents (UUID, sessionID, secureSessionID, agentIP, agentPort, agentOnline, loginTime, logoutTime, currentRegion, currentHandle, currentPos, currentLookAt) VALUES ";
|
||||||
sql += "(?UUID, ?sessionID, ?secureSessionID, ?agentIP, ?agentPort, ?agentOnline, ?loginTime, ?logoutTime, ?currentRegion, ?currentHandle, ?currentPos);";
|
sql += "(?UUID, ?sessionID, ?secureSessionID, ?agentIP, ?agentPort, ?agentOnline, ?loginTime, ?logoutTime, ?currentRegion, ?currentHandle, ?currentPos, ?currentLookAt);";
|
||||||
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
||||||
|
|
||||||
parameters["?UUID"] = agentdata.ProfileID.ToString();
|
parameters["?UUID"] = agentdata.ProfileID.ToString();
|
||||||
|
@ -1109,7 +1111,8 @@ namespace OpenSim.Data.MySQL
|
||||||
parameters["?logoutTime"] = agentdata.LogoutTime.ToString();
|
parameters["?logoutTime"] = agentdata.LogoutTime.ToString();
|
||||||
parameters["?currentRegion"] = agentdata.Region.ToString();
|
parameters["?currentRegion"] = agentdata.Region.ToString();
|
||||||
parameters["?currentHandle"] = agentdata.Handle.ToString();
|
parameters["?currentHandle"] = agentdata.Handle.ToString();
|
||||||
parameters["?currentPos"] = "<" + ((int)agentdata.Position.X).ToString() + "," + ((int)agentdata.Position.Y).ToString() + "," + ((int)agentdata.Position.Z).ToString() + ">";
|
parameters["?currentPos"] = "<" + (agentdata.Position.X).ToString() + "," + (agentdata.Position.Y).ToString() + "," + (agentdata.Position.Z).ToString() + ">";
|
||||||
|
parameters["?currentLookAt"] = "<" + (agentdata.LookAt.X).ToString() + "," + (agentdata.LookAt.Y).ToString() + "," + (agentdata.LookAt.Z).ToString() + ">";
|
||||||
|
|
||||||
bool returnval = false;
|
bool returnval = false;
|
||||||
|
|
||||||
|
|
|
@ -276,13 +276,25 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <param name="userid"></param>
|
/// <param name="userid"></param>
|
||||||
/// <param name="regionid"></param>
|
/// <param name="regionid"></param>
|
||||||
/// <param name="regionhandle"></param>
|
/// <param name="regionhandle"></param>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <param name="lookat"></param>
|
||||||
|
public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat)
|
||||||
|
{
|
||||||
|
m_userService.LogOffUser(userid, regionid, regionhandle, position, lookat);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Logs off a user and does the appropriate communications (deprecated as of 2008-08-27)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userid"></param>
|
||||||
|
/// <param name="regionid"></param>
|
||||||
|
/// <param name="regionhandle"></param>
|
||||||
/// <param name="posx"></param>
|
/// <param name="posx"></param>
|
||||||
/// <param name="posy"></param>
|
/// <param name="posy"></param>
|
||||||
/// <param name="posz"></param>
|
/// <param name="posz"></param>
|
||||||
public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz)
|
public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz)
|
||||||
{
|
{
|
||||||
m_userService.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
|
m_userService.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -106,7 +106,18 @@ namespace OpenSim.Framework.Communications
|
||||||
/// Logs off a user on the user server
|
/// Logs off a user on the user server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="UserID">UUID of the user</param>
|
/// <param name="UserID">UUID of the user</param>
|
||||||
/// <param name="regionData">UUID of the Region</param>
|
/// <param name="regionID">UUID of the Region</param>
|
||||||
|
/// <param name="regionhandle">regionhandle</param>
|
||||||
|
/// <param name="position">final position</param>
|
||||||
|
/// <param name="lookat">final lookat</param>
|
||||||
|
void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Logs off a user on the user server (deprecated as of 2008-08-27)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="UserID">UUID of the user</param>
|
||||||
|
/// <param name="regionID">UUID of the Region</param>
|
||||||
|
/// <param name="regionhandle">regionhandle</param>
|
||||||
/// <param name="posx">final position x</param>
|
/// <param name="posx">final position x</param>
|
||||||
/// <param name="posy">final position y</param>
|
/// <param name="posy">final position y</param>
|
||||||
/// <param name="posz">final position z</param>
|
/// <param name="posz">final position z</param>
|
||||||
|
|
|
@ -258,30 +258,19 @@ namespace OpenSim.Framework.Communications
|
||||||
InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
|
InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
|
||||||
ArrayList InventoryLibRoot = new ArrayList();
|
ArrayList InventoryLibRoot = new ArrayList();
|
||||||
InventoryLibRoot.Add(InventoryLibRootHash);
|
InventoryLibRoot.Add(InventoryLibRootHash);
|
||||||
|
|
||||||
logResponse.InventoryLibRoot = InventoryLibRoot;
|
logResponse.InventoryLibRoot = InventoryLibRoot;
|
||||||
|
|
||||||
logResponse.InventoryLibraryOwner = GetLibraryOwner();
|
logResponse.InventoryLibraryOwner = GetLibraryOwner();
|
||||||
|
|
||||||
logResponse.InventoryRoot = InventoryRoot;
|
logResponse.InventoryRoot = InventoryRoot;
|
||||||
logResponse.InventorySkeleton = AgentInventoryArray;
|
logResponse.InventorySkeleton = AgentInventoryArray;
|
||||||
logResponse.InventoryLibrary = GetInventoryLibrary();
|
logResponse.InventoryLibrary = GetInventoryLibrary();
|
||||||
|
|
||||||
// Circuit Code
|
logResponse.CircuitCode = (Int32)Util.RandomClass.Next();
|
||||||
uint circode = (uint) (Util.RandomClass.Next());
|
|
||||||
|
|
||||||
logResponse.Lastname = userProfile.SurName;
|
logResponse.Lastname = userProfile.SurName;
|
||||||
logResponse.Firstname = userProfile.FirstName;
|
logResponse.Firstname = userProfile.FirstName;
|
||||||
logResponse.AgentID = agentID.ToString();
|
logResponse.AgentID = agentID.ToString();
|
||||||
logResponse.SessionID = userProfile.CurrentAgent.SessionID.ToString();
|
logResponse.SessionID = userProfile.CurrentAgent.SessionID.ToString();
|
||||||
logResponse.SecureSessionID = userProfile.CurrentAgent.SecureSessionID.ToString();
|
logResponse.SecureSessionID = userProfile.CurrentAgent.SecureSessionID.ToString();
|
||||||
|
|
||||||
logResponse.CircuitCode = (Int32) circode;
|
|
||||||
//logResponse.RegionX = 0; //overwritten
|
|
||||||
//logResponse.RegionY = 0; //overwritten
|
|
||||||
logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
|
|
||||||
//logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
|
|
||||||
//logResponse.SimAddress = "127.0.0.1"; //overwritten
|
|
||||||
//logResponse.SimPort = 0; //overwritten
|
|
||||||
logResponse.Message = GetMessage();
|
logResponse.Message = GetMessage();
|
||||||
logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID));
|
logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID));
|
||||||
logResponse.StartLocation = startLocationRequest;
|
logResponse.StartLocation = startLocationRequest;
|
||||||
|
@ -322,6 +311,11 @@ namespace OpenSim.Framework.Communications
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when we receive the client's initial LLSD login_to_simulator request message
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">The LLSD request</param>
|
||||||
|
/// <returns>The response to send</returns>
|
||||||
public LLSD LLSDLoginMethod(LLSD request)
|
public LLSD LLSDLoginMethod(LLSD request)
|
||||||
{
|
{
|
||||||
// Temporary fix
|
// Temporary fix
|
||||||
|
@ -432,30 +426,19 @@ namespace OpenSim.Framework.Communications
|
||||||
InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
|
InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
|
||||||
ArrayList InventoryLibRoot = new ArrayList();
|
ArrayList InventoryLibRoot = new ArrayList();
|
||||||
InventoryLibRoot.Add(InventoryLibRootHash);
|
InventoryLibRoot.Add(InventoryLibRootHash);
|
||||||
|
|
||||||
logResponse.InventoryLibRoot = InventoryLibRoot;
|
logResponse.InventoryLibRoot = InventoryLibRoot;
|
||||||
|
|
||||||
logResponse.InventoryLibraryOwner = GetLibraryOwner();
|
logResponse.InventoryLibraryOwner = GetLibraryOwner();
|
||||||
|
|
||||||
logResponse.InventoryRoot = InventoryRoot;
|
logResponse.InventoryRoot = InventoryRoot;
|
||||||
logResponse.InventorySkeleton = AgentInventoryArray;
|
logResponse.InventorySkeleton = AgentInventoryArray;
|
||||||
logResponse.InventoryLibrary = GetInventoryLibrary();
|
logResponse.InventoryLibrary = GetInventoryLibrary();
|
||||||
|
|
||||||
// Circuit Code
|
logResponse.CircuitCode = (Int32)Util.RandomClass.Next();
|
||||||
uint circode = (uint)(Util.RandomClass.Next());
|
|
||||||
|
|
||||||
logResponse.Lastname = userProfile.SurName;
|
logResponse.Lastname = userProfile.SurName;
|
||||||
logResponse.Firstname = userProfile.FirstName;
|
logResponse.Firstname = userProfile.FirstName;
|
||||||
logResponse.AgentID = agentID.ToString();
|
logResponse.AgentID = agentID.ToString();
|
||||||
logResponse.SessionID = userProfile.CurrentAgent.SessionID.ToString();
|
logResponse.SessionID = userProfile.CurrentAgent.SessionID.ToString();
|
||||||
logResponse.SecureSessionID = userProfile.CurrentAgent.SecureSessionID.ToString();
|
logResponse.SecureSessionID = userProfile.CurrentAgent.SecureSessionID.ToString();
|
||||||
|
|
||||||
logResponse.CircuitCode = (Int32)circode;
|
|
||||||
//logResponse.RegionX = 0; //overwritten
|
|
||||||
//logResponse.RegionY = 0; //overwritten
|
|
||||||
logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
|
|
||||||
//logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
|
|
||||||
//logResponse.SimAddress = "127.0.0.1"; //overwritten
|
|
||||||
//logResponse.SimPort = 0; //overwritten
|
|
||||||
logResponse.Message = GetMessage();
|
logResponse.Message = GetMessage();
|
||||||
logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID));
|
logResponse.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID));
|
||||||
logResponse.StartLocation = startLocationRequest;
|
logResponse.StartLocation = startLocationRequest;
|
||||||
|
|
|
@ -388,112 +388,29 @@ namespace OpenSim.Framework.Communications
|
||||||
// Profile UUID
|
// Profile UUID
|
||||||
agent.ProfileID = profile.ID;
|
agent.ProfileID = profile.ID;
|
||||||
|
|
||||||
// Current position (from Home)
|
// Current location/position/alignment
|
||||||
agent.Handle = profile.HomeRegion;
|
if (profile.CurrentAgent != null)
|
||||||
agent.Position = profile.HomeLocation;
|
|
||||||
|
|
||||||
// If user specified additional start, use that
|
|
||||||
if (requestData.ContainsKey("start"))
|
|
||||||
{
|
{
|
||||||
string startLoc = ((string)requestData["start"]).Trim();
|
agent.Region = profile.CurrentAgent.Region;
|
||||||
if (("last" == startLoc) && (profile.CurrentAgent != null))
|
agent.Handle = profile.CurrentAgent.Handle;
|
||||||
{
|
agent.Position = profile.CurrentAgent.Position;
|
||||||
if ((profile.CurrentAgent.Position.X > 0)
|
agent.LookAt = profile.CurrentAgent.LookAt;
|
||||||
&& (profile.CurrentAgent.Position.Y > 0)
|
}
|
||||||
&& (profile.CurrentAgent.Position.Z > 0)
|
else
|
||||||
)
|
{
|
||||||
{
|
agent.Region = profile.HomeRegionID;
|
||||||
// TODO: Right now, currentRegion has not been used in GridServer for requesting region.
|
agent.Handle = profile.HomeRegion;
|
||||||
// TODO: It is only using currentHandle.
|
agent.Position = profile.HomeLocation;
|
||||||
agent.Region = profile.CurrentAgent.Region;
|
agent.LookAt = profile.HomeLookAt;
|
||||||
agent.Handle = profile.CurrentAgent.Handle;
|
|
||||||
agent.Position = profile.CurrentAgent.Position;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (!(startLoc == "last" || startLoc == "home"))
|
|
||||||
// {
|
|
||||||
// // Format: uri:Ahern&162&213&34
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// string[] parts = startLoc.Remove(0, 4).Split('&');
|
|
||||||
// //string region = parts[0];
|
|
||||||
//
|
|
||||||
// ////////////////////////////////////////////////////
|
|
||||||
// //SimProfile SimInfo = new SimProfile();
|
|
||||||
// //SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey);
|
|
||||||
// }
|
|
||||||
// catch (Exception)
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// What time did the user login?
|
// What time did the user login?
|
||||||
agent.LoginTime = Util.UnixTimeSinceEpoch();
|
agent.LoginTime = Util.UnixTimeSinceEpoch();
|
||||||
agent.LogoutTime = 0;
|
agent.LogoutTime = 0;
|
||||||
|
|
||||||
// Current location
|
|
||||||
agent.InitialRegion = UUID.Zero; // Fill in later
|
|
||||||
agent.Region = UUID.Zero; // Fill in later
|
|
||||||
|
|
||||||
profile.CurrentAgent = agent;
|
profile.CurrentAgent = agent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Process a user logoff from OpenSim.
|
|
||||||
/// </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(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz)
|
|
||||||
{
|
|
||||||
if (StatsManager.UserStats != null)
|
|
||||||
StatsManager.UserStats.AddLogout();
|
|
||||||
|
|
||||||
UserProfileData userProfile;
|
|
||||||
UserAgentData userAgent;
|
|
||||||
Vector3 currentPos = new Vector3(posx, posy, posz);
|
|
||||||
|
|
||||||
userProfile = GetUserProfile(userid);
|
|
||||||
|
|
||||||
if (userProfile != null)
|
|
||||||
{
|
|
||||||
// This line needs to be in side the above if statement or the UserServer will crash on some logouts.
|
|
||||||
m_log.Info("[LOGOUT]: " + userProfile.FirstName + " " + userProfile.SurName + " from " + regionhandle + "(" + posx + "," + posy + "," + posz + ")");
|
|
||||||
|
|
||||||
userAgent = userProfile.CurrentAgent;
|
|
||||||
if (userAgent != null)
|
|
||||||
{
|
|
||||||
userAgent.AgentOnline = false;
|
|
||||||
userAgent.LogoutTime = Util.UnixTimeSinceEpoch();
|
|
||||||
//userAgent.sessionID = UUID.Zero;
|
|
||||||
if (regionid != UUID.Zero)
|
|
||||||
{
|
|
||||||
userAgent.Region = regionid;
|
|
||||||
}
|
|
||||||
|
|
||||||
userAgent.Handle = regionhandle;
|
|
||||||
userAgent.Position = currentPos;
|
|
||||||
userProfile.CurrentAgent = userAgent;
|
|
||||||
|
|
||||||
CommitAgent(ref userProfile);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// If currentagent is null, we can't reference it here or the UserServer crashes!
|
|
||||||
m_log.Info("[LOGOUT]: didn't save logout position: " + userid.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.Warn("[LOGOUT]: Unknown User logged out");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CreateAgent(UserProfileData profile, LLSD request)
|
public void CreateAgent(UserProfileData profile, LLSD request)
|
||||||
{
|
{
|
||||||
UserAgentData agent = new UserAgentData();
|
UserAgentData agent = new UserAgentData();
|
||||||
|
@ -501,6 +418,13 @@ namespace OpenSim.Framework.Communications
|
||||||
// User connection
|
// User connection
|
||||||
agent.AgentOnline = true;
|
agent.AgentOnline = true;
|
||||||
|
|
||||||
|
//if (request.Params.Count > 1)
|
||||||
|
//{
|
||||||
|
// IPEndPoint RemoteIPEndPoint = (IPEndPoint)request.Params[1];
|
||||||
|
// agent.AgentIP = RemoteIPEndPoint.Address.ToString();
|
||||||
|
// agent.AgentPort = (uint)RemoteIPEndPoint.Port;
|
||||||
|
//}
|
||||||
|
|
||||||
// Generate sessions
|
// Generate sessions
|
||||||
RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
|
RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
|
||||||
byte[] randDataS = new byte[16];
|
byte[] randDataS = new byte[16];
|
||||||
|
@ -514,18 +438,26 @@ namespace OpenSim.Framework.Communications
|
||||||
// Profile UUID
|
// Profile UUID
|
||||||
agent.ProfileID = profile.ID;
|
agent.ProfileID = profile.ID;
|
||||||
|
|
||||||
// Current position (from Home)
|
// Current location/position/alignment
|
||||||
agent.Handle = profile.HomeRegion;
|
if (profile.CurrentAgent != null)
|
||||||
agent.Position = profile.HomeLocation;
|
{
|
||||||
|
agent.Region = profile.CurrentAgent.Region;
|
||||||
|
agent.Handle = profile.CurrentAgent.Handle;
|
||||||
|
agent.Position = profile.CurrentAgent.Position;
|
||||||
|
agent.LookAt = profile.CurrentAgent.LookAt;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
agent.Region = profile.HomeRegionID;
|
||||||
|
agent.Handle = profile.HomeRegion;
|
||||||
|
agent.Position = profile.HomeLocation;
|
||||||
|
agent.LookAt = profile.HomeLookAt;
|
||||||
|
}
|
||||||
|
|
||||||
// What time did the user login?
|
// What time did the user login?
|
||||||
agent.LoginTime = Util.UnixTimeSinceEpoch();
|
agent.LoginTime = Util.UnixTimeSinceEpoch();
|
||||||
agent.LogoutTime = 0;
|
agent.LogoutTime = 0;
|
||||||
|
|
||||||
// Current location
|
|
||||||
agent.InitialRegion = UUID.Zero; // Fill in later
|
|
||||||
agent.Region = UUID.Zero; // Fill in later
|
|
||||||
|
|
||||||
profile.CurrentAgent = agent;
|
profile.CurrentAgent = agent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,6 +476,70 @@ namespace OpenSim.Framework.Communications
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Process a user logoff from OpenSim.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userid"></param>
|
||||||
|
/// <param name="regionid"></param>
|
||||||
|
/// <param name="regionhandle"></param>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <param name="lookat"></param>
|
||||||
|
public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat)
|
||||||
|
{
|
||||||
|
if (StatsManager.UserStats != null)
|
||||||
|
StatsManager.UserStats.AddLogout();
|
||||||
|
|
||||||
|
UserProfileData userProfile = GetUserProfile(userid);
|
||||||
|
|
||||||
|
if (userProfile != null)
|
||||||
|
{
|
||||||
|
// This line needs to be in side the above if statement or the UserServer will crash on some logouts.
|
||||||
|
m_log.Info("[LOGOUT]: " + userProfile.FirstName + " " + userProfile.SurName + " from " + regionhandle + "(" + position.X + "," + position.Y + "," + position.Z + ")");
|
||||||
|
|
||||||
|
UserAgentData userAgent = userProfile.CurrentAgent;
|
||||||
|
if (userAgent != null)
|
||||||
|
{
|
||||||
|
userAgent.AgentOnline = false;
|
||||||
|
userAgent.LogoutTime = Util.UnixTimeSinceEpoch();
|
||||||
|
//userAgent.sessionID = UUID.Zero;
|
||||||
|
if (regionid != UUID.Zero)
|
||||||
|
{
|
||||||
|
userAgent.Region = regionid;
|
||||||
|
}
|
||||||
|
userAgent.Handle = regionhandle;
|
||||||
|
userAgent.Position = position;
|
||||||
|
userAgent.LookAt = lookat;
|
||||||
|
//userProfile.CurrentAgent = userAgent;
|
||||||
|
userProfile.LastLogin = userAgent.LogoutTime;
|
||||||
|
|
||||||
|
CommitAgent(ref userProfile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If currentagent is null, we can't reference it here or the UserServer crashes!
|
||||||
|
m_log.Info("[LOGOUT]: didn't save logout position: " + userid.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Warn("[LOGOUT]: Unknown User logged out");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Process a user logoff from OpenSim (deprecated as of 2008-08-27)
|
||||||
|
/// </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(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz)
|
||||||
|
{
|
||||||
|
LogOffUser(userid, regionid, regionhandle, new Vector3(posx, posy, posz), new Vector3());
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
|
@ -40,5 +41,50 @@ namespace OpenSim.Framework
|
||||||
EstateBans = 20,
|
EstateBans = 20,
|
||||||
EstateManagers = 24
|
EstateManagers = 24
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]public enum TeleportFlags : uint
|
||||||
|
{
|
||||||
|
/// <summary>No flags set, or teleport failed</summary>
|
||||||
|
Default = 0,
|
||||||
|
/// <summary>Set when newbie leaves help island for first time</summary>
|
||||||
|
SetHomeToTarget = 1 << 0,
|
||||||
|
/// <summary></summary>
|
||||||
|
SetLastToTarget = 1 << 1,
|
||||||
|
/// <summary>Via Lure</summary>
|
||||||
|
ViaLure = 1 << 2,
|
||||||
|
/// <summary>Via Landmark</summary>
|
||||||
|
ViaLandmark = 1 << 3,
|
||||||
|
/// <summary>Via Location</summary>
|
||||||
|
ViaLocation = 1 << 4,
|
||||||
|
/// <summary>Via Home</summary>
|
||||||
|
ViaHome = 1 << 5,
|
||||||
|
/// <summary>Via Telehub</summary>
|
||||||
|
ViaTelehub = 1 << 6,
|
||||||
|
/// <summary>Via Login</summary>
|
||||||
|
ViaLogin = 1 << 7,
|
||||||
|
/// <summary>Linden Summoned</summary>
|
||||||
|
ViaGodlikeLure = 1 << 8,
|
||||||
|
/// <summary>Linden Forced me</summary>
|
||||||
|
Godlike = 1 << 9,
|
||||||
|
/// <summary></summary>
|
||||||
|
NineOneOne = 1 << 10,
|
||||||
|
/// <summary>Agent Teleported Home via Script</summary>
|
||||||
|
DisableCancel = 1 << 11,
|
||||||
|
/// <summary></summary>
|
||||||
|
ViaRegionID = 1 << 12,
|
||||||
|
/// <summary></summary>
|
||||||
|
IsFlying = 1 << 13,
|
||||||
|
/// <summary></summary>
|
||||||
|
ResetHome = 1 << 14,
|
||||||
|
/// <summary>forced to new location for example when avatar is banned or ejected</summary>
|
||||||
|
ForceRedirect = 1 << 15,
|
||||||
|
/// <summary>Teleport Finished via a Lure</summary>
|
||||||
|
FinishedViaLure = 1 << 26,
|
||||||
|
/// <summary>Finished, Sim Changed</summary>
|
||||||
|
FinishedViaNewSim = 1 << 28,
|
||||||
|
/// <summary>Finished, Same Sim</summary>
|
||||||
|
FinishedViaSameSim = 1 << 29
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -35,35 +35,36 @@ namespace OpenSim.Framework
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UserAgentData
|
public class UserAgentData
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The UUID of the users avatar (not the agent!)
|
||||||
|
/// </summary>
|
||||||
|
private UUID UUID;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The session ID for the user (also the agent ID)
|
||||||
|
/// </summary>
|
||||||
|
private UUID sessionID;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The "secure" session ID for the user
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks>
|
||||||
|
private UUID secureSessionID;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The IP address of the user
|
/// The IP address of the user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private string agentIP = String.Empty;
|
private string agentIP = String.Empty;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Is the user online?
|
|
||||||
/// </summary>
|
|
||||||
private bool agentOnline;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The port of the user
|
/// The port of the user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private uint agentPort;
|
private uint agentPort;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Region handle of the current region the user is in
|
/// Is the user online?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private ulong currentHandle;
|
private bool agentOnline;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The position of the user within the region
|
|
||||||
/// </summary>
|
|
||||||
private Vector3 currentPos;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Current region the user is logged into
|
|
||||||
/// </summary>
|
|
||||||
private UUID currentRegion;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A unix timestamp from when the user logged in
|
/// A unix timestamp from when the user logged in
|
||||||
|
@ -76,25 +77,29 @@ namespace OpenSim.Framework
|
||||||
private int logoutTime;
|
private int logoutTime;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The region the user logged into initially
|
/// Region ID the user is logged into
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private UUID regionID;
|
private UUID regionID;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The "secure" session ID for the user
|
/// Region handle of the current region the user is in
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks>
|
private ulong regionHandle;
|
||||||
private UUID secureSessionID;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The session ID for the user (also the agent ID)
|
/// The position of the user within the region
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private UUID sessionID;
|
private Vector3 currentPos;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The UUID of the users avatar (not the agent!)
|
/// Current direction the user is looking at
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private UUID UUID;
|
private Vector3 currentLookAt = Vector3.Zero;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The region the user logged into initially
|
||||||
|
/// </summary>
|
||||||
|
private UUID originRegionID;
|
||||||
|
|
||||||
public virtual UUID ProfileID
|
public virtual UUID ProfileID
|
||||||
{
|
{
|
||||||
|
@ -102,6 +107,18 @@ namespace OpenSim.Framework
|
||||||
set { UUID = value; }
|
set { UUID = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual UUID SessionID
|
||||||
|
{
|
||||||
|
get { return sessionID; }
|
||||||
|
set { sessionID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual UUID SecureSessionID
|
||||||
|
{
|
||||||
|
get { return secureSessionID; }
|
||||||
|
set { secureSessionID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public virtual string AgentIP
|
public virtual string AgentIP
|
||||||
{
|
{
|
||||||
get { return agentIP; }
|
get { return agentIP; }
|
||||||
|
@ -120,24 +137,6 @@ namespace OpenSim.Framework
|
||||||
set { agentOnline = value; }
|
set { agentOnline = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual UUID SessionID
|
|
||||||
{
|
|
||||||
get { return sessionID; }
|
|
||||||
set { sessionID = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual UUID SecureSessionID
|
|
||||||
{
|
|
||||||
get { return secureSessionID; }
|
|
||||||
set { secureSessionID = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual UUID InitialRegion
|
|
||||||
{
|
|
||||||
get { return regionID; }
|
|
||||||
set { regionID = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual int LoginTime
|
public virtual int LoginTime
|
||||||
{
|
{
|
||||||
get { return loginTime; }
|
get { return loginTime; }
|
||||||
|
@ -152,14 +151,14 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public virtual UUID Region
|
public virtual UUID Region
|
||||||
{
|
{
|
||||||
get { return currentRegion; }
|
get { return regionID; }
|
||||||
set { currentRegion = value; }
|
set { regionID = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual ulong Handle
|
public virtual ulong Handle
|
||||||
{
|
{
|
||||||
get { return currentHandle; }
|
get { return regionHandle; }
|
||||||
set { currentHandle = value; }
|
set { regionHandle = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual Vector3 Position
|
public virtual Vector3 Position
|
||||||
|
@ -168,6 +167,7 @@ namespace OpenSim.Framework
|
||||||
set { currentPos = value; }
|
set { currentPos = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 2008-08-28-tyre: Not really useful
|
||||||
public virtual float PositionX
|
public virtual float PositionX
|
||||||
{
|
{
|
||||||
get { return currentPos.X; }
|
get { return currentPos.X; }
|
||||||
|
@ -185,5 +185,19 @@ namespace OpenSim.Framework
|
||||||
get { return currentPos.Z; }
|
get { return currentPos.Z; }
|
||||||
set { currentPos.Z = value; }
|
set { currentPos.Z = value; }
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
public virtual Vector3 LookAt
|
||||||
|
{
|
||||||
|
get { return currentLookAt; }
|
||||||
|
set { currentLookAt = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual UUID InitialRegion
|
||||||
|
{
|
||||||
|
get { return originRegionID; }
|
||||||
|
set { originRegionID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -678,6 +678,7 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 2008-08-28-tyre: Obsolete (see LocalLoginService UserLoginService)
|
||||||
public static string[] ParseStartLocationRequest(string startLocationRequest)
|
public static string[] ParseStartLocationRequest(string startLocationRequest)
|
||||||
{
|
{
|
||||||
string[] returnstring = new string[4];
|
string[] returnstring = new string[4];
|
||||||
|
@ -715,6 +716,7 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
return returnstring;
|
return returnstring;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args)
|
public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nwc.XmlRpc;
|
using Nwc.XmlRpc;
|
||||||
|
@ -127,94 +128,25 @@ namespace OpenSim.Grid.UserServer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="response">The existing response</param>
|
/// <param name="response">The existing response</param>
|
||||||
/// <param name="theUser">The user profile</param>
|
/// <param name="theUser">The user profile</param>
|
||||||
/// <param name="startLocationRequest">Destination of the user</param>
|
/// <param name="startLocationRequest">The requested start location</param>
|
||||||
public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser,
|
public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
|
||||||
string startLocationRequest)
|
|
||||||
{
|
{
|
||||||
RegionProfileData SimInfo;
|
// HomeLocation
|
||||||
RegionProfileData HomeInfo;
|
RegionProfileData homeInfo = null;
|
||||||
int start_x = -1;
|
|
||||||
int start_y = -1;
|
|
||||||
int start_z = -1;
|
|
||||||
|
|
||||||
// use the homeRegionID if it is stored already. If not, use the regionHandle as before
|
// use the homeRegionID if it is stored already. If not, use the regionHandle as before
|
||||||
if (theUser.HomeRegionID != UUID.Zero)
|
if (theUser.HomeRegionID != UUID.Zero)
|
||||||
{
|
homeInfo = RegionProfileData.RequestSimProfileData(theUser.HomeRegionID,
|
||||||
HomeInfo =
|
m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
|
||||||
RegionProfileData.RequestSimProfileData(
|
|
||||||
theUser.HomeRegionID, m_config.GridServerURL,
|
|
||||||
m_config.GridSendKey, m_config.GridRecvKey);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
homeInfo = RegionProfileData.RequestSimProfileData(theUser.HomeRegion,
|
||||||
HomeInfo =
|
m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
|
||||||
RegionProfileData.RequestSimProfileData(
|
if (homeInfo != null)
|
||||||
theUser.HomeRegion, m_config.GridServerURL,
|
|
||||||
m_config.GridSendKey, m_config.GridRecvKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (startLocationRequest == "last")
|
|
||||||
{
|
|
||||||
SimInfo =
|
|
||||||
RegionProfileData.RequestSimProfileData(
|
|
||||||
theUser.CurrentAgent.Handle, m_config.GridServerURL,
|
|
||||||
m_config.GridSendKey, m_config.GridRecvKey);
|
|
||||||
}
|
|
||||||
else if (startLocationRequest == "home")
|
|
||||||
{
|
|
||||||
SimInfo = HomeInfo;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest);
|
|
||||||
m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" +
|
|
||||||
startLocationRequestParsed[1] + ", 3:" + startLocationRequestParsed[2] + ", 4:" +
|
|
||||||
startLocationRequestParsed[3]);
|
|
||||||
if (startLocationRequestParsed[0] == "last")
|
|
||||||
{
|
|
||||||
SimInfo =
|
|
||||||
RegionProfileData.RequestSimProfileData(
|
|
||||||
theUser.CurrentAgent.Handle, m_config.GridServerURL,
|
|
||||||
m_config.GridSendKey, m_config.GridRecvKey);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]);
|
|
||||||
SimInfo =
|
|
||||||
RegionProfileData.RequestSimProfileData(
|
|
||||||
startLocationRequestParsed[0], m_config.GridServerURL,
|
|
||||||
m_config.GridSendKey, m_config.GridRecvKey);
|
|
||||||
|
|
||||||
if (SimInfo == null)
|
|
||||||
{
|
|
||||||
m_log.Info("[LOGIN]: Didn't find region with a close name match sending to home location");
|
|
||||||
SimInfo = HomeInfo;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
start_x = Convert.ToInt32(startLocationRequestParsed[1]);
|
|
||||||
start_y = Convert.ToInt32(startLocationRequestParsed[2]);
|
|
||||||
start_z = Convert.ToInt32(startLocationRequestParsed[3]);
|
|
||||||
|
|
||||||
if (start_x >= 0 && start_y >= 0 && start_z >= 0)
|
|
||||||
{
|
|
||||||
Vector3 tmp_v = new Vector3(start_x, start_y, start_z);
|
|
||||||
theUser.CurrentAgent.Position = tmp_v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Customise the response
|
|
||||||
//CFK: This is redundant and the next message should always appear.
|
|
||||||
//CFK: m_log.Info("[LOGIN]: Home Location");
|
|
||||||
if (HomeInfo != null)
|
|
||||||
{
|
{
|
||||||
response.Home =
|
response.Home =
|
||||||
string.Format(
|
string.Format(
|
||||||
"{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
|
"{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
|
||||||
(HomeInfo.regionLocX*Constants.RegionSize),
|
(homeInfo.regionLocX*Constants.RegionSize),
|
||||||
(HomeInfo.regionLocY*Constants.RegionSize),
|
(homeInfo.regionLocY*Constants.RegionSize),
|
||||||
theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
|
theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
|
||||||
theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
|
theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
|
||||||
}
|
}
|
||||||
|
@ -236,40 +168,83 @@ namespace OpenSim.Grid.UserServer
|
||||||
regionX, regionY);
|
regionX, regionY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PrepareLoginToRegion(SimInfo, theUser, response))
|
// StartLocation
|
||||||
|
RegionProfileData regionInfo = null;
|
||||||
|
if (startLocationRequest == "home")
|
||||||
{
|
{
|
||||||
// Send him to default region instead
|
regionInfo = homeInfo;
|
||||||
// Load information from the gridserver
|
theUser.CurrentAgent.Position = theUser.HomeLocation;
|
||||||
ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) |
|
response.LookAt = "[r" + theUser.HomeLookAt.X.ToString() + ",r" + theUser.HomeLookAt.Y.ToString() + ",r" + theUser.HomeLookAt.Z.ToString() + "]";
|
||||||
((ulong) m_config.DefaultY * Constants.RegionSize);
|
}
|
||||||
|
else if (startLocationRequest == "last")
|
||||||
if (defaultHandle == SimInfo.regionHandle)
|
{
|
||||||
|
regionInfo = RegionProfileData.RequestSimProfileData(theUser.CurrentAgent.Region,
|
||||||
|
m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
|
||||||
|
response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$");
|
||||||
|
Match uriMatch = reURI.Match(startLocationRequest);
|
||||||
|
if (uriMatch == null)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[LOGIN]: Not trying the default region since this is the same as the selected region");
|
m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, but can't process it", startLocationRequest);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead");
|
|
||||||
|
|
||||||
SimInfo = RegionProfileData.RequestSimProfileData(defaultHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
|
|
||||||
|
|
||||||
// Customise the response
|
|
||||||
response.Home =
|
|
||||||
string.Format(
|
|
||||||
"{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
|
|
||||||
(SimInfo.regionLocX * Constants.RegionSize),
|
|
||||||
(SimInfo.regionLocY*Constants.RegionSize),
|
|
||||||
theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
|
|
||||||
theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
|
|
||||||
|
|
||||||
if (!PrepareLoginToRegion(SimInfo, theUser, response))
|
|
||||||
{
|
{
|
||||||
response.CreateDeadRegionResponse();
|
string region = uriMatch.Groups["region"].ToString();
|
||||||
return false;
|
regionInfo = RegionProfileData.RequestSimProfileData(region,
|
||||||
|
m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
|
||||||
|
if (regionInfo == null)
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theUser.CurrentAgent.Position = new Vector3(float.Parse(uriMatch.Groups["x"].Value),
|
||||||
|
float.Parse(uriMatch.Groups["y"].Value), float.Parse(uriMatch.Groups["x"].Value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
response.LookAt = "[r0,r1,r0]";
|
||||||
|
// can be: last, home, safe, url
|
||||||
|
response.StartLocation = "url";
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
if ((regionInfo != null) && (PrepareLoginToRegion(regionInfo, theUser, response)))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartLocation not available, send him to a nearby region instead
|
||||||
|
//regionInfo = RegionProfileData.RequestSimProfileData("", m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
|
||||||
|
//m_log.InfoFormat("[LOGIN]: StartLocation not available sending to region {0}", regionInfo.regionName);
|
||||||
|
|
||||||
|
// Send him to default region instead
|
||||||
|
// Load information from the gridserver
|
||||||
|
ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) |
|
||||||
|
((ulong) m_config.DefaultY * Constants.RegionSize);
|
||||||
|
|
||||||
|
if ((regionInfo != null) && (defaultHandle == regionInfo.regionHandle))
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[LOGIN]: Not trying the default region since this is the same as the selected region");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead");
|
||||||
|
regionInfo = RegionProfileData.RequestSimProfileData(defaultHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
|
||||||
|
|
||||||
|
// Customise the response
|
||||||
|
//response.Home =
|
||||||
|
// string.Format(
|
||||||
|
// "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
|
||||||
|
// (SimInfo.regionLocX * Constants.RegionSize),
|
||||||
|
// (SimInfo.regionLocY*Constants.RegionSize),
|
||||||
|
// theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
|
||||||
|
// theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
|
||||||
|
theUser.CurrentAgent.Position = new Vector3(128,128,0);
|
||||||
|
response.StartLocation = "safe";
|
||||||
|
|
||||||
|
return PrepareLoginToRegion(regionInfo, theUser, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -280,47 +255,46 @@ namespace OpenSim.Grid.UserServer
|
||||||
/// <param name="user"></param>
|
/// <param name="user"></param>
|
||||||
/// <param name="response"></param>
|
/// <param name="response"></param>
|
||||||
/// <returns>true if the region was successfully contacted, false otherwise</returns>
|
/// <returns>true if the region was successfully contacted, false otherwise</returns>
|
||||||
private bool PrepareLoginToRegion(RegionProfileData sim, UserProfileData user, LoginResponse response)
|
private bool PrepareLoginToRegion(RegionProfileData regionInfo, UserProfileData user, LoginResponse response)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
response.SimAddress = Util.GetHostFromURL(sim.serverURI).ToString();
|
response.SimAddress = Util.GetHostFromURL(regionInfo.serverURI).ToString();
|
||||||
response.SimPort = uint.Parse(sim.serverURI.Split(new char[] {'/', ':'})[4]);
|
response.SimPort = uint.Parse(regionInfo.serverURI.Split(new char[] { '/', ':' })[4]);
|
||||||
response.RegionX = sim.regionLocX;
|
response.RegionX = regionInfo.regionLocX;
|
||||||
response.RegionY = sim.regionLocY;
|
response.RegionY = regionInfo.regionLocY;
|
||||||
|
|
||||||
//Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
|
//Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
|
||||||
string capsPath = Util.GetRandomCapsPath();
|
string capsPath = Util.GetRandomCapsPath();
|
||||||
response.SeedCapability = sim.httpServerURI + "CAPS/" + capsPath + "0000/";
|
response.SeedCapability = regionInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
|
||||||
|
|
||||||
// Notify the target of an incoming user
|
// Notify the target of an incoming user
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection",
|
"[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection",
|
||||||
sim.regionName, sim.regionLocX, sim.regionLocY, sim.serverURI);
|
regionInfo.regionName, response.RegionX, response.RegionY, regionInfo.httpServerURI);
|
||||||
|
|
||||||
// Update agent with target sim
|
// Update agent with target sim
|
||||||
user.CurrentAgent.Region = sim.UUID;
|
user.CurrentAgent.Region = regionInfo.UUID;
|
||||||
user.CurrentAgent.Handle = sim.regionHandle;
|
user.CurrentAgent.Handle = regionInfo.regionHandle;
|
||||||
|
|
||||||
// Prepare notification
|
// Prepare notification
|
||||||
Hashtable SimParams = new Hashtable();
|
Hashtable loginParams = new Hashtable();
|
||||||
SimParams["session_id"] = user.CurrentAgent.SessionID.ToString();
|
loginParams["session_id"] = user.CurrentAgent.SessionID.ToString();
|
||||||
SimParams["secure_session_id"] = user.CurrentAgent.SecureSessionID.ToString();
|
loginParams["secure_session_id"] = user.CurrentAgent.SecureSessionID.ToString();
|
||||||
SimParams["firstname"] = user.FirstName;
|
loginParams["firstname"] = user.FirstName;
|
||||||
SimParams["lastname"] = user.SurName;
|
loginParams["lastname"] = user.SurName;
|
||||||
SimParams["agent_id"] = user.ID.ToString();
|
loginParams["agent_id"] = user.ID.ToString();
|
||||||
SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode);
|
loginParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode);
|
||||||
SimParams["startpos_x"] = user.CurrentAgent.Position.X.ToString();
|
loginParams["startpos_x"] = user.CurrentAgent.Position.X.ToString();
|
||||||
SimParams["startpos_y"] = user.CurrentAgent.Position.Y.ToString();
|
loginParams["startpos_y"] = user.CurrentAgent.Position.Y.ToString();
|
||||||
SimParams["startpos_z"] = user.CurrentAgent.Position.Z.ToString();
|
loginParams["startpos_z"] = user.CurrentAgent.Position.Z.ToString();
|
||||||
SimParams["regionhandle"] = user.CurrentAgent.Handle.ToString();
|
loginParams["regionhandle"] = user.CurrentAgent.Handle.ToString();
|
||||||
SimParams["caps_path"] = capsPath;
|
loginParams["caps_path"] = capsPath;
|
||||||
|
|
||||||
ArrayList SendParams = new ArrayList();
|
ArrayList SendParams = new ArrayList();
|
||||||
SendParams.Add(SimParams);
|
SendParams.Add(loginParams);
|
||||||
|
|
||||||
// Send
|
// Send
|
||||||
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
|
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
|
||||||
XmlRpcResponse GridResp = GridReq.Send(sim.httpServerURI, 30000);
|
XmlRpcResponse GridResp = GridReq.Send(regionInfo.httpServerURI, 6000);
|
||||||
|
|
||||||
if (!GridResp.IsFault)
|
if (!GridResp.IsFault)
|
||||||
{
|
{
|
||||||
|
@ -337,7 +311,6 @@ namespace OpenSim.Grid.UserServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseSuccess)
|
if (responseSuccess)
|
||||||
{
|
{
|
||||||
handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation;
|
handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation;
|
||||||
|
|
|
@ -41,8 +41,7 @@ namespace OpenSim.Region.Communications.Local
|
||||||
|
|
||||||
public class LocalLoginService : LoginService
|
public class LocalLoginService : LoginService
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
private CommunicationsLocal m_Parent;
|
private CommunicationsLocal m_Parent;
|
||||||
|
|
||||||
|
@ -120,167 +119,167 @@ namespace OpenSim.Region.Communications.Local
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$");
|
/// <summary>
|
||||||
|
/// Customises the login response and fills in missing values.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="response">The existing response</param>
|
||||||
|
/// <param name="theUser">The user profile</param>
|
||||||
|
/// <param name="startLocationRequest">The requested start location</param>
|
||||||
public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
|
public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
|
||||||
{
|
{
|
||||||
ulong currentRegion = 0;
|
// HomeLocation
|
||||||
|
RegionInfo homeInfo = null;
|
||||||
uint locX = 0;
|
// use the homeRegionID if it is stored already. If not, use the regionHandle as before
|
||||||
uint locY = 0;
|
if (theUser.HomeRegionID != UUID.Zero)
|
||||||
uint locZ = 0;
|
homeInfo = m_Parent.GridService.RequestNeighbourInfo(theUser.HomeRegionID);
|
||||||
bool specificStartLocation = false;
|
else
|
||||||
|
homeInfo = m_Parent.GridService.RequestNeighbourInfo(theUser.HomeRegion);
|
||||||
// get start location
|
if (homeInfo != null)
|
||||||
if (startLocationRequest == "last")
|
|
||||||
{
|
{
|
||||||
currentRegion = theUser.CurrentAgent.Handle;
|
response.Home =
|
||||||
locX = (UInt32)theUser.CurrentAgent.Position.X;
|
string.Format(
|
||||||
locY = (UInt32)theUser.CurrentAgent.Position.Y;
|
"{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
|
||||||
locZ = (UInt32)theUser.CurrentAgent.Position.Z;
|
(homeInfo.RegionLocX*Constants.RegionSize),
|
||||||
response.StartLocation = "last";
|
(homeInfo.RegionLocY*Constants.RegionSize),
|
||||||
specificStartLocation = true;
|
theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
|
||||||
}
|
theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
|
||||||
else if (startLocationRequest == "home")
|
|
||||||
{
|
|
||||||
currentRegion = theUser.HomeRegion;
|
|
||||||
response.StartLocation = "home";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// use last location as default
|
// Emergency mode: Home-region isn't available, so we can't request the region info.
|
||||||
currentRegion = theUser.CurrentAgent.Handle;
|
// Use the stored home regionHandle instead.
|
||||||
|
// NOTE: If the home-region moves, this will be wrong until the users update their user-profile again
|
||||||
|
ulong regionX = theUser.HomeRegion >> 32;
|
||||||
|
ulong regionY = theUser.HomeRegion & 0xffffffff;
|
||||||
|
response.Home =
|
||||||
|
string.Format(
|
||||||
|
"{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
|
||||||
|
regionX, regionY,
|
||||||
|
theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
|
||||||
|
theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
|
||||||
|
m_log.InfoFormat("[LOGIN] Home region of user {0} {1} is not available; using computed region position {2} {3}",
|
||||||
|
theUser.FirstName, theUser.SurName,
|
||||||
|
regionX, regionY);
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartLocation
|
||||||
|
RegionInfo regionInfo = null;
|
||||||
|
if (startLocationRequest == "home")
|
||||||
|
{
|
||||||
|
regionInfo = homeInfo;
|
||||||
|
theUser.CurrentAgent.Position = theUser.HomeLocation;
|
||||||
|
response.LookAt = "[r" + theUser.HomeLookAt.X.ToString() + ",r" + theUser.HomeLookAt.Y.ToString() + ",r" + theUser.HomeLookAt.Z.ToString() + "]";
|
||||||
|
}
|
||||||
|
else if (startLocationRequest == "last")
|
||||||
|
{
|
||||||
|
regionInfo = m_Parent.GridService.RequestNeighbourInfo(theUser.CurrentAgent.Region);
|
||||||
|
response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$");
|
||||||
Match uriMatch = reURI.Match(startLocationRequest);
|
Match uriMatch = reURI.Match(startLocationRequest);
|
||||||
if (null == uriMatch)
|
if (uriMatch == null)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, but can't process it", startLocationRequest);
|
m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, but can't process it", startLocationRequest);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string region = uriMatch.Groups["region"].ToString();
|
string region = uriMatch.Groups["region"].ToString();
|
||||||
|
regionInfo = m_Parent.GridService.RequestClosestRegion(region);
|
||||||
RegionInfo r = m_Parent.GridService.RequestClosestRegion(region);
|
if (regionInfo == null)
|
||||||
if (null == r)
|
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}",
|
m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region);
|
||||||
startLocationRequest, region);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentRegion = r.RegionHandle;
|
theUser.CurrentAgent.Position = new Vector3(float.Parse(uriMatch.Groups["x"].Value),
|
||||||
locX = UInt32.Parse(uriMatch.Groups["x"].ToString());
|
float.Parse(uriMatch.Groups["y"].Value), float.Parse(uriMatch.Groups["x"].Value));
|
||||||
locY = UInt32.Parse(uriMatch.Groups["y"].ToString());
|
|
||||||
locZ = UInt32.Parse(uriMatch.Groups["z"].ToString());
|
|
||||||
// can be: last, home, safe, url
|
|
||||||
response.StartLocation = "url";
|
|
||||||
specificStartLocation = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
response.LookAt = "[r0,r1,r0]";
|
||||||
|
// can be: last, home, safe, url
|
||||||
|
response.StartLocation = "url";
|
||||||
}
|
}
|
||||||
|
|
||||||
RegionInfo homeReg = m_Parent.GridService.RequestNeighbourInfo(theUser.HomeRegion);
|
if ((regionInfo != null) && (PrepareLoginToRegion(regionInfo, theUser, response)))
|
||||||
RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion);
|
|
||||||
|
|
||||||
if ((homeReg != null) || (reg != null))
|
|
||||||
{
|
{
|
||||||
if (homeReg != null)
|
return true;
|
||||||
{
|
|
||||||
response.Home = "{'region_handle':[r" +
|
|
||||||
(homeReg.RegionLocX * Constants.RegionSize).ToString() + ",r" +
|
|
||||||
(homeReg.RegionLocY * Constants.RegionSize).ToString() + "], " +
|
|
||||||
"'position':[r" +
|
|
||||||
theUser.HomeLocation.X.ToString() + ",r" +
|
|
||||||
theUser.HomeLocation.Y.ToString() + ",r" +
|
|
||||||
theUser.HomeLocation.Z.ToString() + "], " +
|
|
||||||
"'look_at':[r" +
|
|
||||||
theUser.HomeLocation.X.ToString() + ",r" +
|
|
||||||
theUser.HomeLocation.Y.ToString() + ",r" +
|
|
||||||
theUser.HomeLocation.Z.ToString() + "]}";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.Warn("[LOGIN]: Your home region doesn't exist");
|
|
||||||
response.Home = "{'region_handle':[r" +
|
|
||||||
(reg.RegionLocX * Constants.RegionSize).ToString() + ",r" +
|
|
||||||
(reg.RegionLocY * Constants.RegionSize).ToString() + "], " +
|
|
||||||
"'position':[r" +
|
|
||||||
theUser.HomeLocation.X.ToString() + ",r" +
|
|
||||||
theUser.HomeLocation.Y.ToString() + ",r" +
|
|
||||||
theUser.HomeLocation.Z.ToString() + "], " +
|
|
||||||
"'look_at':[r" +
|
|
||||||
theUser.HomeLocation.X.ToString() + ",r" +
|
|
||||||
theUser.HomeLocation.Y.ToString() + ",r" +
|
|
||||||
theUser.HomeLocation.Z.ToString() + "]}";
|
|
||||||
}
|
|
||||||
string capsPath = Util.GetRandomCapsPath();
|
|
||||||
response.SimAddress = reg.ExternalEndPoint.Address.ToString();
|
|
||||||
response.SimPort = (uint) reg.ExternalEndPoint.Port;
|
|
||||||
response.RegionX = reg.RegionLocX;
|
|
||||||
response.RegionY = reg.RegionLocY;
|
|
||||||
|
|
||||||
m_log.DebugFormat(
|
|
||||||
"[CAPS][LOGIN]: RegionX {0} RegionY {0}", response.RegionX, response.RegionY);
|
|
||||||
|
|
||||||
response.SeedCapability = "http://" + reg.ExternalHostName + ":" +
|
|
||||||
serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
|
|
||||||
|
|
||||||
m_log.DebugFormat(
|
|
||||||
"[CAPS]: Sending new CAPS seed url {0} to client {1}",
|
|
||||||
response.SeedCapability, response.AgentID);
|
|
||||||
|
|
||||||
theUser.CurrentAgent.Region = reg.RegionID;
|
|
||||||
theUser.CurrentAgent.Handle = reg.RegionHandle;
|
|
||||||
|
|
||||||
// LoginResponse.BuddyList buddyList = new LoginResponse.BuddyList();
|
|
||||||
|
|
||||||
response.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(theUser.ID));
|
|
||||||
|
|
||||||
Login _login = new Login();
|
|
||||||
//copy data to login object
|
|
||||||
_login.First = response.Firstname;
|
|
||||||
_login.Last = response.Lastname;
|
|
||||||
_login.Agent = response.AgentID;
|
|
||||||
_login.Session = response.SessionID;
|
|
||||||
_login.SecureSession = response.SecureSessionID;
|
|
||||||
_login.CircuitCode = (uint) response.CircuitCode;
|
|
||||||
if (specificStartLocation)
|
|
||||||
_login.StartPos = new Vector3(locX, locY, locZ);
|
|
||||||
else
|
|
||||||
_login.StartPos = new Vector3(128, 128, 128);
|
|
||||||
_login.CapsPath = capsPath;
|
|
||||||
|
|
||||||
m_log.InfoFormat(
|
|
||||||
"[LOGIN]: Telling region {0} @ {1},{2} ({3}:{4}) to expect user connection",
|
|
||||||
reg.RegionName, response.RegionX, response.RegionY, response.SimAddress, response.SimPort);
|
|
||||||
|
|
||||||
handlerLoginToRegion = OnLoginToRegion;
|
|
||||||
if (handlerLoginToRegion != null)
|
|
||||||
{
|
|
||||||
handlerLoginToRegion(currentRegion, _login);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// StartLocation not available, send him to a nearby region instead
|
||||||
|
// regionInfo = m_Parent.GridService.RequestClosestRegion("");
|
||||||
|
//m_log.InfoFormat("[LOGIN]: StartLocation not available sending to region {0}", regionInfo.regionName);
|
||||||
|
|
||||||
|
// Send him to default region instead
|
||||||
|
ulong defaultHandle = (((ulong)defaultHomeX * Constants.RegionSize) << 32) |
|
||||||
|
((ulong)defaultHomeY * Constants.RegionSize);
|
||||||
|
|
||||||
|
if ((regionInfo != null) && (defaultHandle == regionInfo.RegionHandle))
|
||||||
{
|
{
|
||||||
m_log.Warn("[LOGIN]: Not found region " + currentRegion);
|
m_log.ErrorFormat("[LOGIN]: Not trying the default region since this is the same as the selected region");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead");
|
||||||
|
regionInfo = m_Parent.GridService.RequestNeighbourInfo(defaultHandle);
|
||||||
|
|
||||||
|
// Customise the response
|
||||||
|
//response.Home =
|
||||||
|
// string.Format(
|
||||||
|
// "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
|
||||||
|
// (SimInfo.regionLocX * Constants.RegionSize),
|
||||||
|
// (SimInfo.regionLocY*Constants.RegionSize),
|
||||||
|
// theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
|
||||||
|
// theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
|
||||||
|
theUser.CurrentAgent.Position = new Vector3(128,128,0);
|
||||||
|
response.StartLocation = "safe";
|
||||||
|
|
||||||
|
return PrepareLoginToRegion(regionInfo, theUser, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LoginResponse.BuddyList ConvertFriendListItem(List<FriendListItem> LFL)
|
/// <summary>
|
||||||
|
/// Prepare a login to the given region. This involves both telling the region to expect a connection
|
||||||
|
/// and appropriately customising the response to the user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sim"></param>
|
||||||
|
/// <param name="user"></param>
|
||||||
|
/// <param name="response"></param>
|
||||||
|
/// <returns>true if the region was successfully contacted, false otherwise</returns>
|
||||||
|
private bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response)
|
||||||
{
|
{
|
||||||
LoginResponse.BuddyList buddylistreturn = new LoginResponse.BuddyList();
|
response.SimAddress = regionInfo.ExternalEndPoint.Address.ToString();
|
||||||
foreach (FriendListItem fl in LFL)
|
response.SimPort = (uint)regionInfo.ExternalEndPoint.Port;
|
||||||
{
|
response.RegionX = regionInfo.RegionLocX;
|
||||||
LoginResponse.BuddyList.BuddyInfo buddyitem = new LoginResponse.BuddyList.BuddyInfo(fl.Friend);
|
response.RegionY = regionInfo.RegionLocY;
|
||||||
buddyitem.BuddyID = fl.Friend;
|
|
||||||
buddyitem.BuddyRightsHave = (int)fl.FriendListOwnerPerms;
|
string capsPath = Util.GetRandomCapsPath();
|
||||||
buddyitem.BuddyRightsGiven = (int)fl.FriendPerms;
|
response.SeedCapability = regionInfo.ServerURI + "/CAPS/" + capsPath + "0000/";
|
||||||
buddylistreturn.AddNewBuddy(buddyitem);
|
|
||||||
}
|
// Notify the target of an incoming user
|
||||||
return buddylistreturn;
|
m_log.InfoFormat(
|
||||||
|
"[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection",
|
||||||
|
regionInfo.RegionName, response.RegionX, response.RegionY, regionInfo.ServerURI);
|
||||||
|
// Update agent with target sim
|
||||||
|
user.CurrentAgent.Region = regionInfo.RegionID;
|
||||||
|
user.CurrentAgent.Handle = regionInfo.RegionHandle;
|
||||||
|
// Prepare notification
|
||||||
|
Login loginParams = new Login();
|
||||||
|
loginParams.Session = user.CurrentAgent.SessionID.ToString();
|
||||||
|
loginParams.SecureSession = user.CurrentAgent.SecureSessionID.ToString();
|
||||||
|
loginParams.First = user.FirstName;
|
||||||
|
loginParams.Last = user.SurName;
|
||||||
|
loginParams.Agent = user.ID.ToString();
|
||||||
|
loginParams.CircuitCode = Convert.ToUInt32(response.CircuitCode);
|
||||||
|
loginParams.StartPos = user.CurrentAgent.Position;
|
||||||
|
loginParams.CapsPath = capsPath;
|
||||||
|
|
||||||
|
handlerLoginToRegion = OnLoginToRegion;
|
||||||
|
if (handlerLoginToRegion == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
handlerLoginToRegion(user.CurrentAgent.Handle, loginParams);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// See LoginService
|
// See LoginService
|
||||||
|
|
|
@ -235,19 +235,22 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
/// Logs off a user on the user server
|
/// Logs off a user on the user server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="UserID">UUID of the user</param>
|
/// <param name="UserID">UUID of the user</param>
|
||||||
/// <param name="regionData">UUID of the Region</param>
|
/// <param name="regionID">UUID of the Region</param>
|
||||||
/// <param name="posx">final position x</param>
|
/// <param name="regionhandle">regionhandle</param>
|
||||||
/// <param name="posy">final position y</param>
|
/// <param name="position">final position</param>
|
||||||
/// <param name="posz">final position z</param>
|
/// <param name="lookat">final lookat</param>
|
||||||
public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz)
|
public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat)
|
||||||
{
|
{
|
||||||
Hashtable param = new Hashtable();
|
Hashtable param = new Hashtable();
|
||||||
param["avatar_uuid"] = userid.Guid.ToString();
|
param["avatar_uuid"] = userid.Guid.ToString();
|
||||||
param["region_uuid"] = regionid.Guid.ToString();
|
param["region_uuid"] = regionid.Guid.ToString();
|
||||||
param["region_handle"] = regionhandle.ToString();
|
param["region_handle"] = regionhandle.ToString();
|
||||||
param["region_pos_x"] = posx.ToString();
|
param["region_pos_x"] = position.X.ToString();
|
||||||
param["region_pos_y"] = posy.ToString();
|
param["region_pos_y"] = position.Y.ToString();
|
||||||
param["region_pos_z"] = posz.ToString();
|
param["region_pos_z"] = position.Z.ToString();
|
||||||
|
param["lookat_x"] = lookat.X.ToString();
|
||||||
|
param["lookat_y"] = lookat.Y.ToString();
|
||||||
|
param["lookat_z"] = lookat.Z.ToString();
|
||||||
|
|
||||||
IList parameters = new ArrayList();
|
IList parameters = new ArrayList();
|
||||||
parameters.Add(param);
|
parameters.Add(param);
|
||||||
|
@ -263,6 +266,20 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Logs off a user on the user server (deprecated as of 2008-08-27)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="UserID">UUID of the user</param>
|
||||||
|
/// <param name="regionID">UUID of the Region</param>
|
||||||
|
/// <param name="regionhandle">regionhandle</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(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz)
|
||||||
|
{
|
||||||
|
LogOffUser(userid, regionid, regionhandle, new Vector3(posx, posy, posz), new Vector3());
|
||||||
|
}
|
||||||
|
|
||||||
public UserProfileData GetUserProfile(string firstName, string lastName)
|
public UserProfileData GetUserProfile(string firstName, string lastName)
|
||||||
{
|
{
|
||||||
return GetUserProfile(firstName + " " + lastName);
|
return GetUserProfile(firstName + " " + lastName);
|
||||||
|
@ -672,7 +689,7 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner
|
/// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
|
/// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
|
||||||
public List<FriendListItem> GetUserFriendList(UUID friendlistowner)
|
public List<FriendListItem> GetUserFriendList(UUID friendlistowner)
|
||||||
|
|
|
@ -322,9 +322,6 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
|
||||||
useragent.LoginTime=Util.UnixTimeSinceEpoch();
|
useragent.LoginTime=Util.UnixTimeSinceEpoch();
|
||||||
useragent.LogoutTime = 0;
|
useragent.LogoutTime = 0;
|
||||||
useragent.Position=agentData.startpos;
|
useragent.Position=agentData.startpos;
|
||||||
useragent.PositionX=agentData.startpos.X;
|
|
||||||
useragent.PositionY=agentData.startpos.Y;
|
|
||||||
useragent.PositionZ=agentData.startpos.Z;
|
|
||||||
useragent.Region=reg.originRegionID;
|
useragent.Region=reg.originRegionID;
|
||||||
useragent.SecureSessionID=agentData.SecureSessionID;
|
useragent.SecureSessionID=agentData.SecureSessionID;
|
||||||
useragent.SessionID = agentData.SessionID;
|
useragent.SessionID = agentData.SessionID;
|
||||||
|
|
|
@ -579,7 +579,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="lookAt"></param>
|
/// <param name="lookAt"></param>
|
||||||
/// <param name="flags"></param>
|
/// <param name="flags"></param>
|
||||||
public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, Vector3 position,
|
public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, Vector3 position,
|
||||||
Vector3 lookAt, uint flags)
|
Vector3 lookAt, uint teleportFlags)
|
||||||
{
|
{
|
||||||
bool destRegionUp = false;
|
bool destRegionUp = false;
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
position.Z = newPosZ;
|
position.Z = newPosZ;
|
||||||
}
|
}
|
||||||
avatar.ControllingClient.SendTeleportLocationStart();
|
avatar.ControllingClient.SendTeleportLocationStart();
|
||||||
avatar.ControllingClient.SendLocalTeleport(position, lookAt, flags);
|
avatar.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
|
||||||
avatar.Teleport(position);
|
avatar.Teleport(position);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -662,7 +662,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
|
"[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
|
||||||
|
|
||||||
avatar.ControllingClient.SendRegionTeleport(reg.RegionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
|
avatar.ControllingClient.SendRegionTeleport(reg.RegionHandle, 13, reg.ExternalEndPoint, 4, teleportFlags,
|
||||||
capsPath);
|
capsPath);
|
||||||
avatar.MakeChildAgent();
|
avatar.MakeChildAgent();
|
||||||
Thread.Sleep(5000);
|
Thread.Sleep(5000);
|
||||||
|
@ -716,6 +716,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
return m_commsProvider.GridService.GetGridSettings();
|
return m_commsProvider.GridService.GetGridSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat)
|
||||||
|
{
|
||||||
|
m_commsProvider.LogOffUser(userid, regionid, regionhandle, position, lookat);
|
||||||
|
}
|
||||||
|
|
||||||
|
// deprecated as of 2008-08-27
|
||||||
public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz)
|
public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz)
|
||||||
{
|
{
|
||||||
m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
|
m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
|
||||||
|
|
|
@ -241,6 +241,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
get { return m_CameraCenter; }
|
get { return m_CameraCenter; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector3 Lookat
|
||||||
|
{
|
||||||
|
get { return Util.GetNormalizedVector(new Vector3(m_CameraAtAxis.X, m_CameraAtAxis.Y, 0)); }
|
||||||
|
}
|
||||||
|
|
||||||
private readonly string m_firstname;
|
private readonly string m_firstname;
|
||||||
|
|
||||||
public string Firstname
|
public string Firstname
|
||||||
|
|
Loading…
Reference in New Issue