* 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.
This commit is contained in:
Justin Clarke Casey
2008-09-12 20:12:03 +00:00
parent febb781779
commit 52a4c4d82f
14 changed files with 528 additions and 464 deletions

View File

@@ -276,13 +276,25 @@ namespace OpenSim.Framework.Communications
/// <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)
{
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="posy"></param>
/// <param name="posz"></param>
public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz)
{
m_userService.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
}
/// <summary>

View File

@@ -106,7 +106,18 @@ namespace OpenSim.Framework.Communications
/// 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="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="posy">final position y</param>
/// <param name="posz">final position z</param>

View File

@@ -258,30 +258,19 @@ namespace OpenSim.Framework.Communications
InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
ArrayList InventoryLibRoot = new ArrayList();
InventoryLibRoot.Add(InventoryLibRootHash);
logResponse.InventoryLibRoot = InventoryLibRoot;
logResponse.InventoryLibraryOwner = GetLibraryOwner();
logResponse.InventoryRoot = InventoryRoot;
logResponse.InventorySkeleton = AgentInventoryArray;
logResponse.InventoryLibrary = GetInventoryLibrary();
// Circuit Code
uint circode = (uint) (Util.RandomClass.Next());
logResponse.CircuitCode = (Int32)Util.RandomClass.Next();
logResponse.Lastname = userProfile.SurName;
logResponse.Firstname = userProfile.FirstName;
logResponse.AgentID = agentID.ToString();
logResponse.SessionID = userProfile.CurrentAgent.SessionID.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.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID));
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)
{
// Temporary fix
@@ -432,30 +426,19 @@ namespace OpenSim.Framework.Communications
InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
ArrayList InventoryLibRoot = new ArrayList();
InventoryLibRoot.Add(InventoryLibRootHash);
logResponse.InventoryLibRoot = InventoryLibRoot;
logResponse.InventoryLibraryOwner = GetLibraryOwner();
logResponse.InventoryRoot = InventoryRoot;
logResponse.InventorySkeleton = AgentInventoryArray;
logResponse.InventoryLibrary = GetInventoryLibrary();
// Circuit Code
uint circode = (uint)(Util.RandomClass.Next());
logResponse.CircuitCode = (Int32)Util.RandomClass.Next();
logResponse.Lastname = userProfile.SurName;
logResponse.Firstname = userProfile.FirstName;
logResponse.AgentID = agentID.ToString();
logResponse.SessionID = userProfile.CurrentAgent.SessionID.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.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID));
logResponse.StartLocation = startLocationRequest;

View File

@@ -388,112 +388,29 @@ namespace OpenSim.Framework.Communications
// Profile UUID
agent.ProfileID = profile.ID;
// Current position (from Home)
agent.Handle = profile.HomeRegion;
agent.Position = profile.HomeLocation;
// If user specified additional start, use that
if (requestData.ContainsKey("start"))
// Current location/position/alignment
if (profile.CurrentAgent != null)
{
string startLoc = ((string)requestData["start"]).Trim();
if (("last" == startLoc) && (profile.CurrentAgent != null))
{
if ((profile.CurrentAgent.Position.X > 0)
&& (profile.CurrentAgent.Position.Y > 0)
&& (profile.CurrentAgent.Position.Z > 0)
)
{
// TODO: Right now, currentRegion has not been used in GridServer for requesting region.
// TODO: It is only using currentHandle.
agent.Region = profile.CurrentAgent.Region;
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)
// {
// }
// }
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?
agent.LoginTime = Util.UnixTimeSinceEpoch();
agent.LogoutTime = 0;
// Current location
agent.InitialRegion = UUID.Zero; // Fill in later
agent.Region = UUID.Zero; // Fill in later
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)
{
UserAgentData agent = new UserAgentData();
@@ -501,6 +418,13 @@ namespace OpenSim.Framework.Communications
// User connection
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
RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
byte[] randDataS = new byte[16];
@@ -514,18 +438,26 @@ namespace OpenSim.Framework.Communications
// Profile UUID
agent.ProfileID = profile.ID;
// Current position (from Home)
agent.Handle = profile.HomeRegion;
agent.Position = profile.HomeLocation;
// Current location/position/alignment
if (profile.CurrentAgent != null)
{
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?
agent.LoginTime = Util.UnixTimeSinceEpoch();
agent.LogoutTime = 0;
// Current location
agent.InitialRegion = UUID.Zero; // Fill in later
agent.Region = UUID.Zero; // Fill in later
profile.CurrentAgent = agent;
}
@@ -544,6 +476,70 @@ namespace OpenSim.Framework.Communications
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
/// <summary>

View File

@@ -24,6 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
namespace OpenSim.Framework
{
@@ -40,5 +41,50 @@ namespace OpenSim.Framework
EstateBans = 20,
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
}
}
}
}

View File

@@ -35,35 +35,36 @@ namespace OpenSim.Framework
/// </summary>
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>
/// The IP address of the user
/// </summary>
private string agentIP = String.Empty;
/// <summary>
/// Is the user online?
/// </summary>
private bool agentOnline;
/// <summary>
/// The port of the user
/// </summary>
private uint agentPort;
/// <summary>
/// Region handle of the current region the user is in
/// Is the user online?
/// </summary>
private ulong currentHandle;
/// <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;
private bool agentOnline;
/// <summary>
/// A unix timestamp from when the user logged in
@@ -76,25 +77,29 @@ namespace OpenSim.Framework
private int logoutTime;
/// <summary>
/// The region the user logged into initially
/// Region ID the user is logged into
/// </summary>
private UUID regionID;
/// <summary>
/// The "secure" session ID for the user
/// Region handle of the current region the user is in
/// </summary>
/// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks>
private UUID secureSessionID;
private ulong regionHandle;
/// <summary>
/// The session ID for the user (also the agent ID)
/// The position of the user within the region
/// </summary>
private UUID sessionID;
private Vector3 currentPos;
/// <summary>
/// The UUID of the users avatar (not the agent!)
/// Current direction the user is looking at
/// </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
{
@@ -102,6 +107,18 @@ namespace OpenSim.Framework
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
{
get { return agentIP; }
@@ -120,24 +137,6 @@ namespace OpenSim.Framework
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
{
get { return loginTime; }
@@ -152,14 +151,14 @@ namespace OpenSim.Framework
public virtual UUID Region
{
get { return currentRegion; }
set { currentRegion = value; }
get { return regionID; }
set { regionID = value; }
}
public virtual ulong Handle
{
get { return currentHandle; }
set { currentHandle = value; }
get { return regionHandle; }
set { regionHandle = value; }
}
public virtual Vector3 Position
@@ -168,6 +167,7 @@ namespace OpenSim.Framework
set { currentPos = value; }
}
/* 2008-08-28-tyre: Not really useful
public virtual float PositionX
{
get { return currentPos.X; }
@@ -185,5 +185,19 @@ namespace OpenSim.Framework
get { return currentPos.Z; }
set { currentPos.Z = value; }
}
*/
public virtual Vector3 LookAt
{
get { return currentLookAt; }
set { currentLookAt = value; }
}
public virtual UUID InitialRegion
{
get { return originRegionID; }
set { originRegionID = value; }
}
}
}

View File

@@ -678,6 +678,7 @@ namespace OpenSim.Framework
}
}
/* 2008-08-28-tyre: Obsolete (see LocalLoginService UserLoginService)
public static string[] ParseStartLocationRequest(string startLocationRequest)
{
string[] returnstring = new string[4];
@@ -715,6 +716,7 @@ namespace OpenSim.Framework
}
return returnstring;
}
*/
public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args)
{