From ef7dfae41c728d10cfe835cb256958c354449f1b Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 10 Apr 2008 14:37:17 +0000 Subject: changing UserAgentData to use properties. This caused more grief than expected, as monodevelop doesn't like to refactor properties of properties. --- OpenSim/Framework/Communications/LoginService.cs | 14 +-- .../Framework/Communications/UserManagerBase.cs | 62 +++++----- OpenSim/Framework/UserAgentData.cs | 133 +++++++++++++++++++-- 3 files changed, 159 insertions(+), 50 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 4f314bc..afe7359 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs @@ -184,13 +184,13 @@ namespace OpenSim.Framework.UserManagement else { // If we already have a session... - if (userProfile.CurrentAgent != null && userProfile.CurrentAgent.agentOnline) + if (userProfile.CurrentAgent != null && userProfile.CurrentAgent.AgentOnline) { //TODO: The following statements can cause trouble: // If agentOnline could not turn from true back to false normally // because of some problem, for instance, the crashment of server or client, // the user cannot log in any longer. - userProfile.CurrentAgent.agentOnline = false; + userProfile.CurrentAgent.AgentOnline = false; m_userManager.CommitAgent(ref userProfile); // Reject the login @@ -225,8 +225,8 @@ namespace OpenSim.Framework.UserManagement 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.SessionID = userProfile.CurrentAgent.SessionID.ToString(); + logResponse.SecureSessionID = userProfile.CurrentAgent.SecureSessionID.ToString(); logResponse.InventoryRoot = InventoryRoot; logResponse.InventorySkeleton = AgentInventoryArray; logResponse.InventoryLibrary = GetInventoryLibrary(); @@ -334,7 +334,7 @@ namespace OpenSim.Framework.UserManagement else { // If we already have a session... - if (userProfile.CurrentAgent != null && userProfile.CurrentAgent.agentOnline) + if (userProfile.CurrentAgent != null && userProfile.CurrentAgent.AgentOnline) { userProfile.CurrentAgent = null; m_userManager.CommitAgent(ref userProfile); @@ -367,8 +367,8 @@ namespace OpenSim.Framework.UserManagement 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.SessionID = userProfile.CurrentAgent.SessionID.ToString(); + logResponse.SecureSessionID = userProfile.CurrentAgent.SecureSessionID.ToString(); logResponse.InventoryRoot = InventoryRoot; logResponse.InventorySkeleton = AgentInventoryArray; logResponse.InventoryLibrary = GetInventoryLibrary(); diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 91c284c..0473701 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -342,7 +342,7 @@ namespace OpenSim.Framework.UserManagement UserAgentData agent = new UserAgentData(); // User connection - agent.agentOnline = true; + agent.AgentOnline = true; // Generate sessions RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); @@ -351,15 +351,15 @@ namespace OpenSim.Framework.UserManagement rand.GetBytes(randDataS); rand.GetBytes(randDataSS); - agent.secureSessionID = new LLUUID(randDataSS, 0); - agent.sessionID = new LLUUID(randDataS, 0); + agent.SecureSessionID = new LLUUID(randDataSS, 0); + agent.SessionID = new LLUUID(randDataS, 0); // Profile UUID - agent.UUID = profile.ID; + agent.ProfileID = profile.ID; // Current position (from Home) - agent.currentHandle = profile.HomeRegion; - agent.currentPos = profile.HomeLocation; + agent.CurrentHandle = profile.HomeRegion; + agent.CurrentPos = profile.HomeLocation; // If user specified additional start, use that if (requestData.ContainsKey("start")) @@ -367,16 +367,16 @@ namespace OpenSim.Framework.UserManagement string startLoc = ((string)requestData["start"]).Trim(); if (("last" == startLoc) && (profile.CurrentAgent != null)) { - if ((profile.CurrentAgent.currentPos.X > 0) - && (profile.CurrentAgent.currentPos.Y > 0) - && (profile.CurrentAgent.currentPos.Z > 0) + if ((profile.CurrentAgent.CurrentPos.X > 0) + && (profile.CurrentAgent.CurrentPos.Y > 0) + && (profile.CurrentAgent.CurrentPos.Z > 0) ) { // TODO: Right now, currentRegion has not been used in GridServer for requesting region. // TODO: It is only using currentHandle. - agent.currentRegion = profile.CurrentAgent.currentRegion; - agent.currentHandle = profile.CurrentAgent.currentHandle; - agent.currentPos = profile.CurrentAgent.currentPos; + agent.CurrentRegion = profile.CurrentAgent.CurrentRegion; + agent.CurrentHandle = profile.CurrentAgent.CurrentHandle; + agent.CurrentPos = profile.CurrentAgent.CurrentPos; } } @@ -399,12 +399,12 @@ namespace OpenSim.Framework.UserManagement } // What time did the user login? - agent.loginTime = Util.UnixTimeSinceEpoch(); - agent.logoutTime = 0; + agent.LoginTime = Util.UnixTimeSinceEpoch(); + agent.LogoutTime = 0; // Current location - agent.regionID = LLUUID.Zero; // Fill in later - agent.currentRegion = LLUUID.Zero; // Fill in later + agent.RegionID = LLUUID.Zero; // Fill in later + agent.CurrentRegion = LLUUID.Zero; // Fill in later profile.CurrentAgent = agent; } @@ -437,16 +437,16 @@ namespace OpenSim.Framework.UserManagement userAgent = userProfile.CurrentAgent; if (userAgent != null) { - userAgent.agentOnline = false; - userAgent.logoutTime = Util.UnixTimeSinceEpoch(); + userAgent.AgentOnline = false; + userAgent.LogoutTime = Util.UnixTimeSinceEpoch(); //userAgent.sessionID = LLUUID.Zero; if (regionid != LLUUID.Zero) { - userAgent.currentRegion = regionid; + userAgent.CurrentRegion = regionid; } - userAgent.currentHandle = regionhandle; - userAgent.currentPos = currentPos; + userAgent.CurrentHandle = regionhandle; + userAgent.CurrentPos = currentPos; userProfile.CurrentAgent = userAgent; CommitAgent(ref userProfile); @@ -468,7 +468,7 @@ namespace OpenSim.Framework.UserManagement UserAgentData agent = new UserAgentData(); // User connection - agent.agentOnline = true; + agent.AgentOnline = true; // Generate sessions RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); @@ -477,23 +477,23 @@ namespace OpenSim.Framework.UserManagement rand.GetBytes(randDataS); rand.GetBytes(randDataSS); - agent.secureSessionID = new LLUUID(randDataSS, 0); - agent.sessionID = new LLUUID(randDataS, 0); + agent.SecureSessionID = new LLUUID(randDataSS, 0); + agent.SessionID = new LLUUID(randDataS, 0); // Profile UUID - agent.UUID = profile.ID; + agent.ProfileID = profile.ID; // Current position (from Home) - agent.currentHandle = profile.HomeRegion; - agent.currentPos = profile.HomeLocation; + agent.CurrentHandle = profile.HomeRegion; + agent.CurrentPos = profile.HomeLocation; // What time did the user login? - agent.loginTime = Util.UnixTimeSinceEpoch(); - agent.logoutTime = 0; + agent.LoginTime = Util.UnixTimeSinceEpoch(); + agent.LogoutTime = 0; // Current location - agent.regionID = LLUUID.Zero; // Fill in later - agent.currentRegion = LLUUID.Zero; // Fill in later + agent.RegionID = LLUUID.Zero; // Fill in later + agent.CurrentRegion = LLUUID.Zero; // Fill in later profile.CurrentAgent = agent; } diff --git a/OpenSim/Framework/UserAgentData.cs b/OpenSim/Framework/UserAgentData.cs index 8c6baf0..18e8580 100644 --- a/OpenSim/Framework/UserAgentData.cs +++ b/OpenSim/Framework/UserAgentData.cs @@ -38,62 +38,171 @@ namespace OpenSim.Framework /// /// The UUID of the users avatar (not the agent!) /// - public LLUUID UUID; + private LLUUID UUID; /// /// The IP address of the user /// - public string agentIP = String.Empty; + private string agentIP = String.Empty; /// /// The port of the user + /// - public uint agentPort; + private uint agentPort; /// /// Is the user online? /// - public bool agentOnline; + private bool agentOnline; /// /// The session ID for the user (also the agent ID) /// - public LLUUID sessionID; + private LLUUID sessionID; /// /// The "secure" session ID for the user /// /// Not very secure. Dont rely on it for anything more than Linden Lab does. - public LLUUID secureSessionID; + private LLUUID secureSessionID; /// /// The region the user logged into initially /// - public LLUUID regionID; + private LLUUID regionID; /// /// A unix timestamp from when the user logged in /// - public int loginTime; + private int loginTime; /// /// When this agent expired and logged out, 0 if still online /// - public int logoutTime; + private int logoutTime; /// /// Current region the user is logged into /// - public LLUUID currentRegion; + private LLUUID currentRegion; /// /// Region handle of the current region the user is in /// - public ulong currentHandle; + private ulong currentHandle; /// /// The position of the user within the region /// - public LLVector3 currentPos; + private LLVector3 currentPos; + + public LLUUID ProfileID { + get { + return UUID; + } + set { + UUID = value; + } + } + + public string AgentIP { + get { + return agentIP; + } + set { + agentIP = value; + } + } + + public uint AgentPort { + get { + return agentPort; + } + set { + agentPort = value; + } + } + + public bool AgentOnline { + get { + return agentOnline; + } + set { + agentOnline = value; + } + } + + public LLUUID SessionID { + get { + return sessionID; + } + set { + sessionID = value; + } + } + + public LLUUID SecureSessionID { + get { + return secureSessionID; + } + set { + secureSessionID = value; + } + } + + public LLUUID RegionID { + get { + return regionID; + } + set { + regionID = value; + } + } + + public int LoginTime { + get { + return loginTime; + } + set { + loginTime = value; + } + } + + public int LogoutTime { + get { + return logoutTime; + } + set { + logoutTime = value; + } + } + + public LLUUID CurrentRegion { + get { + return currentRegion; + } + set { + currentRegion = value; + } + } + + public ulong CurrentHandle { + get { + return currentHandle; + } + set { + currentHandle = value; + } + } + + public LLVector3 CurrentPos { + get { + return currentPos; + } + set { + currentPos = value; + } + } } } -- cgit v1.1