From b699af87dc5abca607f449caaee1a1ecc4131bf3 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 16 Dec 2013 15:10:09 -0500 Subject: [PATCH 1/3] Populate user preferences with UserAccount email if it is present, else return an error indicating no email is on record for the user. --- OpenSim/Data/MySQL/MySQLUserProfilesData.cs | 16 +++-- OpenSim/Data/SQLite/SQLiteUserProfilesData.cs | 3 +- .../UserProfilesService.cs | 61 +++++++++++++++++++ 3 files changed, 73 insertions(+), 7 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs index dca80c30aa..48044f04aa 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs @@ -927,15 +927,19 @@ namespace OpenSim.Data.MySQL } else { + dbcon.Close(); + dbcon.Open(); + + query = "INSERT INTO usersettings VALUES "; + query += "(?uuid,'false','false', ?Email)"; + using (MySqlCommand put = new MySqlCommand(query, dbcon)) { - query = "INSERT INTO usersettings VALUES "; - query += "(?Id,'false','false', '')"; - lock(Lock) - { - put.ExecuteNonQuery(); - } + put.Parameters.AddWithValue("?Email", pref.EMail); + put.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); + + put.ExecuteNonQuery(); } } } diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs index 70ce07c261..0a6c625d34 100644 --- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs @@ -810,11 +810,12 @@ namespace OpenSim.Data.SQLite else { query = "INSERT INTO usersettings VALUES "; - query += "(:Id,'false','false', '')"; + query += "(:Id,'false','false', :Email)"; using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand()) { put.Parameters.AddWithValue(":Id", pref.UserId.ToString()); + put.Parameters.AddWithValue(":Email", pref.EMail); put.ExecuteNonQuery(); } diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs index 69c7b91957..dd26cdcb13 100644 --- a/OpenSim/Services/UserProfilesService/UserProfilesService.cs +++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs @@ -37,6 +37,7 @@ using OpenSim.Data; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; +using OpenSim.Services.UserAccountService; namespace OpenSim.Services.ProfilesService { @@ -166,11 +167,71 @@ namespace OpenSim.Services.ProfilesService #region User Preferences public bool UserPreferencesUpdate(ref UserPreferences pref, ref string result) { + if(string.IsNullOrEmpty(pref.EMail)) + { + UserAccount account = new UserAccount(); + if(userAccounts is UserAccountService.UserAccountService) + { + try + { + account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); + if(string.IsNullOrEmpty(account.Email)) + { + result = "No Email address on record!"; + return false; + } + else + pref.EMail = account.Email; + } + catch + { + m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account"); + result = "Missing Email address!"; + return false; + } + } + else + { + m_log.Info ("[PROFILES]: UserAccountService: Could not get user account"); + result = "Missing Email address!"; + return false; + } + } return ProfilesData.UpdateUserPreferences(ref pref, ref result); } public bool UserPreferencesRequest(ref UserPreferences pref, ref string result) { + if(string.IsNullOrEmpty(pref.EMail)) + { + UserAccount account = new UserAccount(); + if(userAccounts is UserAccountService.UserAccountService) + { + try + { + account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); + if(string.IsNullOrEmpty(account.Email)) + { + result = "No Email address on record!"; + return false; + } + else + pref.EMail = account.Email; + } + catch + { + m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account"); + result = "Missing Email address!"; + return false; + } + } + else + { + m_log.Info ("[PROFILES]: UserAccountService: Could not get user account"); + result = "Missing Email address!"; + return false; + } + } return ProfilesData.GetUserPreferences(ref pref, ref result); } #endregion User Preferences From 017ae9132ef6be0bbc111c66e658edb2ad73e58e Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 16 Dec 2013 15:43:34 -0500 Subject: [PATCH 2/3] Fix issue with editing notes for other avatars --- OpenSim/Data/MySQL/MySQLUserProfilesData.cs | 4 ++++ .../CoreModules/Avatar/UserProfiles/UserProfileModule.cs | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs index 48044f04aa..13e0a57cae 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs @@ -546,6 +546,10 @@ namespace OpenSim.Data.MySQL reader.Read(); notes.Notes = OSD.FromString((string)reader["notes"]); } + else + { + notes.Notes = OSD.FromString(""); + } } } } diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 697a73eaa1..e13bf4f58a 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -760,8 +760,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles IClientAPI remoteClient = (IClientAPI)sender; string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); - note.TargetId = remoteClient.AgentId; - UUID.TryParse(args[0], out note.UserId); + note.UserId = remoteClient.AgentId; + UUID.TryParse(args[0], out note.TargetId); object Note = (object)note; if(!JsonRpcRequest(ref Note, "avatarnotesrequest", serverURI, UUID.Random().ToString())) From 3ab559efa9b76c9738a1a712021e81466252388f Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 4 Jan 2014 21:18:37 +0000 Subject: [PATCH 3/3] Dynamically adjust to the number of visual params sent. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index c27e613486..0b8acebd02 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3631,7 +3631,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); // TODO: don't create new blocks if recycling an old packet - avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; + avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length]; avp.ObjectData.TextureEntry = textureEntry; AvatarAppearancePacket.VisualParamBlock avblock = null;