diff options
author | BlueWall | 2014-11-23 14:25:48 -0500 |
---|---|---|
committer | BlueWall | 2014-11-23 14:25:48 -0500 |
commit | 12108bf6e9dc16b6b4b1fe344c1b12ed31a1e4b4 (patch) | |
tree | e2d852f5675e7f6714f11dca84fc658bffa8ad8f | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-12108bf6e9dc16b6b4b1fe344c1b12ed31a1e4b4.zip opensim-SC-12108bf6e9dc16b6b4b1fe344c1b12ed31a1e4b4.tar.gz opensim-SC-12108bf6e9dc16b6b4b1fe344c1b12ed31a1e4b4.tar.bz2 opensim-SC-12108bf6e9dc16b6b4b1fe344c1b12ed31a1e4b4.tar.xz |
Fix handling of user preference updates where no email address is supplied
5 files changed, 36 insertions, 27 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs index cab0ca8..da05ff0 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs | |||
@@ -915,7 +915,10 @@ namespace OpenSim.Data.MySQL | |||
915 | reader.Read(); | 915 | reader.Read(); |
916 | bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); | 916 | bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); |
917 | bool.TryParse((string)reader["visible"], out pref.Visible); | 917 | bool.TryParse((string)reader["visible"], out pref.Visible); |
918 | pref.EMail = (string)reader["email"]; | 918 | pref.EMail = (string)reader["email"]; |
919 | |||
920 | if(string.IsNullOrEmpty(pref.EMail)) | ||
921 | pref.EMail = "No EMail Address Provided"; | ||
919 | } | 922 | } |
920 | else | 923 | else |
921 | { | 924 | { |
@@ -954,7 +957,8 @@ namespace OpenSim.Data.MySQL | |||
954 | 957 | ||
955 | query += "UPDATE usersettings SET "; | 958 | query += "UPDATE usersettings SET "; |
956 | query += "imviaemail=?ImViaEmail, "; | 959 | query += "imviaemail=?ImViaEmail, "; |
957 | query += "visible=?Visible "; | 960 | query += "visible=?Visible, "; |
961 | query += "email=?EMail "; | ||
958 | query += "WHERE useruuid=?uuid"; | 962 | query += "WHERE useruuid=?uuid"; |
959 | 963 | ||
960 | try | 964 | try |
@@ -966,7 +970,8 @@ namespace OpenSim.Data.MySQL | |||
966 | { | 970 | { |
967 | cmd.Parameters.AddWithValue("?ImViaEmail", pref.IMViaEmail.ToString().ToLower()); | 971 | cmd.Parameters.AddWithValue("?ImViaEmail", pref.IMViaEmail.ToString().ToLower()); |
968 | cmd.Parameters.AddWithValue("?Visible", pref.Visible.ToString().ToLower()); | 972 | cmd.Parameters.AddWithValue("?Visible", pref.Visible.ToString().ToLower()); |
969 | cmd.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); | 973 | cmd.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); |
974 | cmd.Parameters.AddWithValue("?EMail", pref.EMail.ToString().ToLower()); | ||
970 | 975 | ||
971 | cmd.ExecuteNonQuery(); | 976 | cmd.ExecuteNonQuery(); |
972 | } | 977 | } |
@@ -975,7 +980,7 @@ namespace OpenSim.Data.MySQL | |||
975 | catch (Exception e) | 980 | catch (Exception e) |
976 | { | 981 | { |
977 | m_log.ErrorFormat("[PROFILES_DATA]" + | 982 | m_log.ErrorFormat("[PROFILES_DATA]" + |
978 | ": AgentInterestsUpdate exception {0}", e.Message); | 983 | ": UserPreferencesUpdate exception {0} {1}", e.Message, e.InnerException); |
979 | result = e.Message; | 984 | result = e.Message; |
980 | return false; | 985 | return false; |
981 | } | 986 | } |
diff --git a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs index 4a08100..e263857 100644 --- a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs +++ b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs | |||
@@ -901,7 +901,10 @@ namespace OpenSim.Data.PGSQL | |||
901 | reader.Read(); | 901 | reader.Read(); |
902 | bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); | 902 | bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); |
903 | bool.TryParse((string)reader["visible"], out pref.Visible); | 903 | bool.TryParse((string)reader["visible"], out pref.Visible); |
904 | pref.EMail = (string)reader["email"]; | 904 | pref.EMail = (string)reader["email"]; |
905 | |||
906 | if(string.IsNullOrEmpty(pref.EMail)) | ||
907 | pref.EMail = "No EMail Address Provided"; | ||
905 | } | 908 | } |
906 | else | 909 | else |
907 | { | 910 | { |
@@ -935,7 +938,8 @@ namespace OpenSim.Data.PGSQL | |||
935 | 938 | ||
936 | query += "UPDATE usersettings SET "; | 939 | query += "UPDATE usersettings SET "; |
937 | query += "imviaemail=:ImViaEmail, "; | 940 | query += "imviaemail=:ImViaEmail, "; |
938 | query += "visible=:Visible,"; | 941 | query += "visible=:Visible, "; |
942 | query += "email=:Email "; | ||
939 | query += "WHERE useruuid=:uuid"; | 943 | query += "WHERE useruuid=:uuid"; |
940 | 944 | ||
941 | try | 945 | try |
@@ -946,7 +950,8 @@ namespace OpenSim.Data.PGSQL | |||
946 | using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) | 950 | using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) |
947 | { | 951 | { |
948 | cmd.Parameters.Add(m_database.CreateParameter("ImViaEmail", pref.IMViaEmail.ToString().ToLower ())); | 952 | cmd.Parameters.Add(m_database.CreateParameter("ImViaEmail", pref.IMViaEmail.ToString().ToLower ())); |
949 | cmd.Parameters.Add(m_database.CreateParameter("Visible", pref.Visible.ToString().ToLower ())); | 953 | cmd.Parameters.Add(m_database.CreateParameter("Visible", pref.Visible.ToString().ToLower ())); |
954 | cmd.Parameters.Add(m_database.CreateParameter("EMail", pref.EMail.ToString().ToLower ())); | ||
950 | cmd.Parameters.Add(m_database.CreateParameter("uuid", pref.UserId.ToString())); | 955 | cmd.Parameters.Add(m_database.CreateParameter("uuid", pref.UserId.ToString())); |
951 | 956 | ||
952 | lock(Lock) | 957 | lock(Lock) |
diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs index 7bf3bd5..fd6a1c5 100644 --- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs | |||
@@ -747,7 +747,8 @@ namespace OpenSim.Data.SQLite | |||
747 | 747 | ||
748 | query += "UPDATE usersettings SET "; | 748 | query += "UPDATE usersettings SET "; |
749 | query += "imviaemail=:ImViaEmail, "; | 749 | query += "imviaemail=:ImViaEmail, "; |
750 | query += "visible=:Visible "; | 750 | query += "visible=:Visible, "; |
751 | query += "email=:EMail "; | ||
751 | query += "WHERE useruuid=:uuid"; | 752 | query += "WHERE useruuid=:uuid"; |
752 | 753 | ||
753 | try | 754 | try |
@@ -757,6 +758,7 @@ namespace OpenSim.Data.SQLite | |||
757 | cmd.CommandText = query; | 758 | cmd.CommandText = query; |
758 | cmd.Parameters.AddWithValue(":ImViaEmail", pref.IMViaEmail); | 759 | cmd.Parameters.AddWithValue(":ImViaEmail", pref.IMViaEmail); |
759 | cmd.Parameters.AddWithValue(":Visible", pref.Visible); | 760 | cmd.Parameters.AddWithValue(":Visible", pref.Visible); |
761 | cmd.Parameters.AddWithValue(":EMail", pref.EMail); | ||
760 | cmd.Parameters.AddWithValue(":uuid", pref.UserId.ToString()); | 762 | cmd.Parameters.AddWithValue(":uuid", pref.UserId.ToString()); |
761 | 763 | ||
762 | cmd.ExecuteNonQuery(); | 764 | cmd.ExecuteNonQuery(); |
@@ -796,7 +798,10 @@ namespace OpenSim.Data.SQLite | |||
796 | { | 798 | { |
797 | bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); | 799 | bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); |
798 | bool.TryParse((string)reader["visible"], out pref.Visible); | 800 | bool.TryParse((string)reader["visible"], out pref.Visible); |
799 | pref.EMail = (string)reader["email"]; | 801 | pref.EMail = (string)reader["email"]; |
802 | |||
803 | if(string.IsNullOrEmpty(pref.EMail)) | ||
804 | pref.EMail = "No EMail Address Provided"; | ||
800 | } | 805 | } |
801 | else | 806 | else |
802 | { | 807 | { |
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs index c752055..675cd07 100644 --- a/OpenSim/Services/UserProfilesService/UserProfilesService.cs +++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs | |||
@@ -47,7 +47,6 @@ namespace OpenSim.Services.ProfilesService | |||
47 | MethodBase.GetCurrentMethod().DeclaringType); | 47 | MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | IUserAccountService userAccounts; | 49 | IUserAccountService userAccounts; |
50 | IAuthenticationService authService; | ||
51 | 50 | ||
52 | public UserProfilesService(IConfigSource config, string configName): | 51 | public UserProfilesService(IConfigSource config, string configName): |
53 | base(config, configName) | 52 | base(config, configName) |
@@ -55,7 +54,7 @@ namespace OpenSim.Services.ProfilesService | |||
55 | IConfig Config = config.Configs[configName]; | 54 | IConfig Config = config.Configs[configName]; |
56 | if (Config == null) | 55 | if (Config == null) |
57 | { | 56 | { |
58 | m_log.Warn("[PROFILES]: No configuration found!"); | 57 | m_log.Warn("[PROFILES SERVICE]: No configuration found!"); |
59 | return; | 58 | return; |
60 | } | 59 | } |
61 | Object[] args = null; | 60 | Object[] args = null; |
@@ -66,9 +65,6 @@ namespace OpenSim.Services.ProfilesService | |||
66 | userAccounts = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); | 65 | userAccounts = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); |
67 | 66 | ||
68 | args = new Object[] { config }; | 67 | args = new Object[] { config }; |
69 | string authServiceConfig = Config.GetString("AuthenticationServiceModule", String.Empty); | ||
70 | if (accountService != string.Empty) | ||
71 | authService = ServerUtils.LoadPlugin<IAuthenticationService>(authServiceConfig, args); | ||
72 | } | 68 | } |
73 | 69 | ||
74 | #region Classifieds | 70 | #region Classifieds |
@@ -176,23 +172,22 @@ namespace OpenSim.Services.ProfilesService | |||
176 | account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); | 172 | account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); |
177 | if(string.IsNullOrEmpty(account.Email)) | 173 | if(string.IsNullOrEmpty(account.Email)) |
178 | { | 174 | { |
179 | result = "No Email address on record!"; | 175 | pref.EMail = string.Empty; |
180 | return false; | ||
181 | } | 176 | } |
182 | else | 177 | else |
183 | pref.EMail = account.Email; | 178 | pref.EMail = account.Email; |
184 | } | 179 | } |
185 | catch | 180 | catch |
186 | { | 181 | { |
187 | m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account"); | 182 | m_log.Error ("[PROFILES SERVICE]: UserAccountService Exception: Could not get user account"); |
188 | result = "Missing Email address!"; | 183 | result = "UserAccountService settings error in UserProfileService!"; |
189 | return false; | 184 | return false; |
190 | } | 185 | } |
191 | } | 186 | } |
192 | else | 187 | else |
193 | { | 188 | { |
194 | m_log.Info ("[PROFILES]: UserAccountService: Could not get user account"); | 189 | m_log.Error ("[PROFILES SERVICE]: UserAccountService: Could not get user account"); |
195 | result = "Missing Email address!"; | 190 | result = "UserAccountService settings error in UserProfileService!"; |
196 | return false; | 191 | return false; |
197 | } | 192 | } |
198 | } | 193 | } |
@@ -211,23 +206,22 @@ namespace OpenSim.Services.ProfilesService | |||
211 | account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); | 206 | account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); |
212 | if(string.IsNullOrEmpty(account.Email)) | 207 | if(string.IsNullOrEmpty(account.Email)) |
213 | { | 208 | { |
214 | result = "No Email address on record!"; | 209 | pref.EMail = string.Empty; |
215 | return false; | ||
216 | } | 210 | } |
217 | else | 211 | else |
218 | pref.EMail = account.Email; | 212 | pref.EMail = account.Email; |
219 | } | 213 | } |
220 | catch | 214 | catch |
221 | { | 215 | { |
222 | m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account"); | 216 | m_log.Error ("[PROFILES SERVICE]: UserAccountService Exception: Could not get user account"); |
223 | result = "Missing Email address!"; | 217 | result = "UserAccountService settings error in UserProfileService!"; |
224 | return false; | 218 | return false; |
225 | } | 219 | } |
226 | } | 220 | } |
227 | else | 221 | else |
228 | { | 222 | { |
229 | m_log.Info ("[PROFILES]: UserAccountService: Could not get user account"); | 223 | m_log.Error ("[PROFILES SERVICE]: UserAccountService: Could not get user account"); |
230 | result = "Missing Email address!"; | 224 | result = "UserAccountService settings error in UserProfileService!"; |
231 | return false; | 225 | return false; |
232 | } | 226 | } |
233 | } | 227 | } |
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs index bc24ec2..c31578f 100644 --- a/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs +++ b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs | |||
@@ -52,7 +52,7 @@ namespace OpenSim.Services.ProfilesService | |||
52 | { | 52 | { |
53 | if(string.IsNullOrEmpty(configName)) | 53 | if(string.IsNullOrEmpty(configName)) |
54 | { | 54 | { |
55 | m_log.WarnFormat("[PROFILES]: Configuration section not given!"); | 55 | m_log.WarnFormat("[PROFILES SERVICE]: Configuration section not given!"); |
56 | return; | 56 | return; |
57 | } | 57 | } |
58 | 58 | ||