From c176caeb05c2264654b764e4d010561da60c24fc Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 10 Apr 2008 13:53:06 +0000 Subject: moved fields to properties for UserDataProfile, which was actually a little more work than I expected given the copious use of out params. --- .../Communications/Cache/CachedUserInfo.cs | 10 +-- .../Communications/CommunicationsManager.cs | 10 +-- OpenSim/Framework/Communications/LoginService.cs | 46 +++++++------- .../Framework/Communications/UserManagerBase.cs | 72 +++++++++++----------- 4 files changed, 69 insertions(+), 69 deletions(-) (limited to 'OpenSim/Framework/Communications') diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index e39333b..75fe1aa 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -114,7 +114,7 @@ namespace OpenSim.Framework.Communications.Cache // "[INVENTORY CACHE]: Received folder {0} {1} for user {2}", // folderInfo.name, folderInfo.folderID, userID); - if (userID == UserProfile.UUID) + if (userID == UserProfile.Id) { if (RootFolder == null) { @@ -169,7 +169,7 @@ namespace OpenSim.Framework.Communications.Cache /// public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) { - if ((userID == UserProfile.UUID) && (RootFolder != null)) + if ((userID == UserProfile.Id) && (RootFolder != null)) { if (itemInfo.Folder == RootFolder.ID) { @@ -194,7 +194,7 @@ namespace OpenSim.Framework.Communications.Cache public void AddItem(LLUUID userID, InventoryItemBase itemInfo) { - if ((userID == UserProfile.UUID) && (RootFolder != null)) + if ((userID == UserProfile.Id) && (RootFolder != null)) { ItemReceive(userID, itemInfo); m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); @@ -203,7 +203,7 @@ namespace OpenSim.Framework.Communications.Cache public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo) { - if ((userID == UserProfile.UUID) && (RootFolder != null)) + if ((userID == UserProfile.Id) && (RootFolder != null)) { m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); } @@ -212,7 +212,7 @@ namespace OpenSim.Framework.Communications.Cache public bool DeleteItem(LLUUID userID, InventoryItemBase item) { bool result = false; - if ((userID == UserProfile.UUID) && (RootFolder != null)) + if ((userID == UserProfile.Id) && (RootFolder != null)) { result = RootFolder.DeleteItem(item.ID); if (result) diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 95a0e05..6b01d8f 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -164,9 +164,9 @@ namespace OpenSim.Framework.Communications } else { - m_inventoryService.CreateNewUserInventory(userProf.UUID); + m_inventoryService.CreateNewUserInventory(userProf.Id); m_log.Info("[USERS]: Created new inventory set for " + firstName + " " + lastName); - return userProf.UUID; + return userProf.Id; } } @@ -249,9 +249,9 @@ namespace OpenSim.Framework.Communications UserProfileData profileData = m_userService.GetUserProfile(uuid); if (profileData != null) { - LLUUID profileId = profileData.UUID; - string firstname = profileData.username; - string lastname = profileData.surname; + LLUUID profileId = profileData.Id; + string firstname = profileData.FirstName; + string lastname = profileData.SurName; remote_client.SendNameReply(profileId, firstname, lastname); } diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 6f558a0..e5ad7a0 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 @@ -207,7 +207,7 @@ namespace OpenSim.Framework.UserManagement try { - LLUUID agentID = userProfile.UUID; + LLUUID agentID = userProfile.Id; // Inventory Library Section InventoryData inventData = GetInventorySkeleton(agentID); @@ -217,16 +217,16 @@ namespace OpenSim.Framework.UserManagement InventoryRootHash["folder_id"] = inventData.RootFolderID.ToString(); ArrayList InventoryRoot = new ArrayList(); InventoryRoot.Add(InventoryRootHash); - userProfile.rootInventoryFolderID = inventData.RootFolderID; + userProfile.RootInventoryFolderID = inventData.RootFolderID; // Circuit Code uint circode = (uint) (Util.RandomClass.Next()); - logResponse.Lastname = userProfile.surname; - logResponse.Firstname = userProfile.username; + 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,9 +334,9 @@ 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; + userProfile.CurrentAgent = null; m_userManager.CommitAgent(ref userProfile); // Reject the login @@ -349,7 +349,7 @@ namespace OpenSim.Framework.UserManagement try { - LLUUID agentID = userProfile.UUID; + LLUUID agentID = userProfile.Id; // Inventory Library Section InventoryData inventData = GetInventorySkeleton(agentID); @@ -359,16 +359,16 @@ namespace OpenSim.Framework.UserManagement InventoryRootHash["folder_id"] = inventData.RootFolderID.ToString(); ArrayList InventoryRoot = new ArrayList(); InventoryRoot.Add(InventoryRootHash); - userProfile.rootInventoryFolderID = inventData.RootFolderID; + userProfile.RootInventoryFolderID = inventData.RootFolderID; // Circuit Code uint circode = (uint)(Util.RandomClass.Next()); - logResponse.Lastname = userProfile.surname; - logResponse.Firstname = userProfile.username; + 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(); @@ -491,7 +491,7 @@ namespace OpenSim.Framework.UserManagement if (goodweblogin) { LLUUID webloginkey = LLUUID.Random(); - m_userManager.StoreWebLoginKey(user.UUID, webloginkey); + m_userManager.StoreWebLoginKey(user.Id, webloginkey); statuscode = 301; string redirectURL = "about:blank?redirect-http-hack=" + @@ -639,7 +639,7 @@ namespace OpenSim.Framework.UserManagement public virtual bool AuthenticateUser(UserProfileData profile, string password) { bool passwordSuccess = false; - m_log.InfoFormat("[LOGIN]: Authenticating {0} {1} ({2})", profile.username, profile.surname, profile.UUID); + m_log.InfoFormat("[LOGIN]: Authenticating {0} {1} ({2})", profile.FirstName, profile.SurName, profile.Id); // Web Login method seems to also occasionally send the hashed password itself @@ -650,13 +650,13 @@ namespace OpenSim.Framework.UserManagement password = password.Remove(0, 3); //remove $1$ - string s = Util.Md5Hash(password + ":" + profile.passwordSalt); + string s = Util.Md5Hash(password + ":" + profile.PasswordSalt); // Testing... //m_log.Info("[LOGIN]: SubHash:" + s + " userprofile:" + profile.passwordHash); //m_log.Info("[LOGIN]: userprofile:" + profile.passwordHash + " SubCT:" + password); - passwordSuccess = (profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase) - || profile.passwordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase)); + passwordSuccess = (profile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase) + || profile.PasswordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase)); return passwordSuccess; } @@ -664,10 +664,10 @@ namespace OpenSim.Framework.UserManagement public virtual bool AuthenticateUser(UserProfileData profile, LLUUID webloginkey) { bool passwordSuccess = false; - m_log.InfoFormat("[LOGIN]: Authenticating {0} {1} ({2})", profile.username, profile.surname, profile.UUID); + m_log.InfoFormat("[LOGIN]: Authenticating {0} {1} ({2})", profile.FirstName, profile.SurName, profile.Id); // Match web login key unless it's the default weblogin key LLUUID.Zero - passwordSuccess = ((profile.webLoginKey==webloginkey) && profile.webLoginKey != LLUUID.Zero); + passwordSuccess = ((profile.WebLoginKey==webloginkey) && profile.WebLoginKey != LLUUID.Zero); return passwordSuccess; } diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 332583c..02be6bd 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -96,7 +96,7 @@ namespace OpenSim.Framework.UserManagement if (profile != null) { - profile.currentAgent = getUserAgent(profile.UUID); + profile.CurrentAgent = getUserAgent(profile.Id); return profile; } } @@ -113,7 +113,7 @@ namespace OpenSim.Framework.UserManagement if (null != profile) { - profile.currentAgent = getUserAgent(profile.UUID); + profile.CurrentAgent = getUserAgent(profile.Id); return profile; } } @@ -298,7 +298,7 @@ namespace OpenSim.Framework.UserManagement public void clearUserAgent(LLUUID agentID) { UserProfileData profile = GetUserProfile(agentID); - profile.currentAgent = null; + profile.CurrentAgent = null; setUserProfile(profile); } @@ -355,28 +355,28 @@ namespace OpenSim.Framework.UserManagement agent.sessionID = new LLUUID(randDataS, 0); // Profile UUID - agent.UUID = profile.UUID; + agent.UUID = 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")) { string startLoc = ((string)requestData["start"]).Trim(); - if (("last" == startLoc) && (profile.currentAgent != null)) + 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; } } @@ -406,7 +406,7 @@ namespace OpenSim.Framework.UserManagement agent.regionID = LLUUID.Zero; // Fill in later agent.currentRegion = LLUUID.Zero; // Fill in later - profile.currentAgent = agent; + profile.CurrentAgent = agent; } /// @@ -432,9 +432,9 @@ namespace OpenSim.Framework.UserManagement 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.username + " " + userProfile.surname + " from " + regionhandle + "(" + posx + "," + posy + "," + posz + ")"); + m_log.Info("[LOGOUT]: " + userProfile.FirstName + " " + userProfile.SurName + " from " + regionhandle + "(" + posx + "," + posy + "," + posz + ")"); - userAgent = userProfile.currentAgent; + userAgent = userProfile.CurrentAgent; if (userAgent != null) { userAgent.agentOnline = false; @@ -447,7 +447,7 @@ namespace OpenSim.Framework.UserManagement userAgent.currentHandle = regionhandle; userAgent.currentPos = currentPos; - userProfile.currentAgent = userAgent; + userProfile.CurrentAgent = userAgent; CommitAgent(ref userProfile); } @@ -481,11 +481,11 @@ namespace OpenSim.Framework.UserManagement agent.sessionID = new LLUUID(randDataS, 0); // Profile UUID - agent.UUID = profile.UUID; + agent.UUID = 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(); @@ -495,7 +495,7 @@ namespace OpenSim.Framework.UserManagement agent.regionID = LLUUID.Zero; // Fill in later agent.currentRegion = LLUUID.Zero; // Fill in later - profile.currentAgent = agent; + profile.CurrentAgent = agent; } /// @@ -508,7 +508,7 @@ namespace OpenSim.Framework.UserManagement // TODO: how is this function different from setUserProfile? -> Add AddUserAgent() here and commit both tables "users" and "agents" // TODO: what is the logic should be? bool ret = false; - ret = AddUserAgent(profile.currentAgent); + ret = AddUserAgent(profile.CurrentAgent); ret = ret & setUserProfile(profile); return ret; } @@ -522,16 +522,16 @@ namespace OpenSim.Framework.UserManagement public LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) { UserProfileData user = new UserProfileData(); - user.homeLocation = new LLVector3(128, 128, 100); - user.UUID = LLUUID.Random(); - user.username = firstName; - user.surname = lastName; - user.passwordHash = pass; - user.passwordSalt = String.Empty; - user.created = Util.UnixTimeSinceEpoch(); - user.homeLookAt = new LLVector3(100, 100, 100); - user.homeRegionX = regX; - user.homeRegionY = regY; + user.HomeLocation = new LLVector3(128, 128, 100); + user.Id = LLUUID.Random(); + user.FirstName = firstName; + user.SurName = lastName; + user.PasswordHash = pass; + user.PasswordSalt = String.Empty; + user.Created = Util.UnixTimeSinceEpoch(); + user.HomeLookAt = new LLVector3(100, 100, 100); + user.HomeRegionX = regX; + user.HomeRegionY = regY; foreach (KeyValuePair plugin in _plugins) { @@ -545,14 +545,14 @@ namespace OpenSim.Framework.UserManagement } } - return user.UUID; + return user.Id; } public bool UpdateUserProfileProperties(UserProfileData UserProfile) { - if (null == GetUserProfile(UserProfile.UUID)) + if (null == GetUserProfile(UserProfile.Id)) { - m_log.Info("[USERSTORAGE]: Failed to find User by UUID " + UserProfile.UUID.ToString()); + m_log.Info("[USERSTORAGE]: Failed to find User by UUID " + UserProfile.Id.ToString()); return false; } foreach (KeyValuePair plugin in _plugins) @@ -563,7 +563,7 @@ namespace OpenSim.Framework.UserManagement } catch (Exception e) { - m_log.Info("[USERSTORAGE]: Unable to update user " + UserProfile.UUID.ToString() + m_log.Info("[USERSTORAGE]: Unable to update user " + UserProfile.Id.ToString() + " via " + plugin.Key + "(" + e.ToString() + ")"); return false; } -- cgit v1.1