diff options
author | BlueWall | 2013-12-16 15:10:09 -0500 |
---|---|---|
committer | BlueWall | 2013-12-16 17:36:04 -0500 |
commit | b03ec6137f462486a3469f6ba4bbd363dc85295f (patch) | |
tree | 7758ff41f80956b007acb281432e855cdbdd9668 /OpenSim | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-b03ec6137f462486a3469f6ba4bbd363dc85295f.zip opensim-SC-b03ec6137f462486a3469f6ba4bbd363dc85295f.tar.gz opensim-SC-b03ec6137f462486a3469f6ba4bbd363dc85295f.tar.bz2 opensim-SC-b03ec6137f462486a3469f6ba4bbd363dc85295f.tar.xz |
Populate user preferences with UserAccount email if it is present, else return an error indicating no email is on record for the user.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserProfilesData.cs | 16 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteUserProfilesData.cs | 3 | ||||
-rw-r--r-- | OpenSim/Services/UserProfilesService/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 63492c2..0bf9595 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs | |||
@@ -925,15 +925,19 @@ namespace OpenSim.Data.MySQL | |||
925 | } | 925 | } |
926 | else | 926 | else |
927 | { | 927 | { |
928 | dbcon.Close(); | ||
929 | dbcon.Open(); | ||
930 | |||
931 | query = "INSERT INTO usersettings VALUES "; | ||
932 | query += "(?uuid,'false','false', ?Email)"; | ||
933 | |||
928 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) | 934 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) |
929 | { | 935 | { |
930 | query = "INSERT INTO usersettings VALUES "; | ||
931 | query += "(?Id,'false','false', '')"; | ||
932 | 936 | ||
933 | lock(Lock) | 937 | put.Parameters.AddWithValue("?Email", pref.EMail); |
934 | { | 938 | put.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); |
935 | put.ExecuteNonQuery(); | 939 | |
936 | } | 940 | put.ExecuteNonQuery(); |
937 | } | 941 | } |
938 | } | 942 | } |
939 | } | 943 | } |
diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs index 916a226..90d45e9 100644 --- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs | |||
@@ -808,11 +808,12 @@ namespace OpenSim.Data.SQLite | |||
808 | else | 808 | else |
809 | { | 809 | { |
810 | query = "INSERT INTO usersettings VALUES "; | 810 | query = "INSERT INTO usersettings VALUES "; |
811 | query += "(:Id,'false','false', '')"; | 811 | query += "(:Id,'false','false', :Email)"; |
812 | 812 | ||
813 | using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand()) | 813 | using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand()) |
814 | { | 814 | { |
815 | put.Parameters.AddWithValue(":Id", pref.UserId.ToString()); | 815 | put.Parameters.AddWithValue(":Id", pref.UserId.ToString()); |
816 | put.Parameters.AddWithValue(":Email", pref.EMail); | ||
816 | put.ExecuteNonQuery(); | 817 | put.ExecuteNonQuery(); |
817 | 818 | ||
818 | } | 819 | } |
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs index 69c7b91..dd26cdc 100644 --- a/OpenSim/Services/UserProfilesService/UserProfilesService.cs +++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs | |||
@@ -37,6 +37,7 @@ using OpenSim.Data; | |||
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using OpenMetaverse.StructuredData; | 38 | using OpenMetaverse.StructuredData; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Services.UserAccountService; | ||
40 | 41 | ||
41 | namespace OpenSim.Services.ProfilesService | 42 | namespace OpenSim.Services.ProfilesService |
42 | { | 43 | { |
@@ -166,11 +167,71 @@ namespace OpenSim.Services.ProfilesService | |||
166 | #region User Preferences | 167 | #region User Preferences |
167 | public bool UserPreferencesUpdate(ref UserPreferences pref, ref string result) | 168 | public bool UserPreferencesUpdate(ref UserPreferences pref, ref string result) |
168 | { | 169 | { |
170 | if(string.IsNullOrEmpty(pref.EMail)) | ||
171 | { | ||
172 | UserAccount account = new UserAccount(); | ||
173 | if(userAccounts is UserAccountService.UserAccountService) | ||
174 | { | ||
175 | try | ||
176 | { | ||
177 | account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); | ||
178 | if(string.IsNullOrEmpty(account.Email)) | ||
179 | { | ||
180 | result = "No Email address on record!"; | ||
181 | return false; | ||
182 | } | ||
183 | else | ||
184 | pref.EMail = account.Email; | ||
185 | } | ||
186 | catch | ||
187 | { | ||
188 | m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account"); | ||
189 | result = "Missing Email address!"; | ||
190 | return false; | ||
191 | } | ||
192 | } | ||
193 | else | ||
194 | { | ||
195 | m_log.Info ("[PROFILES]: UserAccountService: Could not get user account"); | ||
196 | result = "Missing Email address!"; | ||
197 | return false; | ||
198 | } | ||
199 | } | ||
169 | return ProfilesData.UpdateUserPreferences(ref pref, ref result); | 200 | return ProfilesData.UpdateUserPreferences(ref pref, ref result); |
170 | } | 201 | } |
171 | 202 | ||
172 | public bool UserPreferencesRequest(ref UserPreferences pref, ref string result) | 203 | public bool UserPreferencesRequest(ref UserPreferences pref, ref string result) |
173 | { | 204 | { |
205 | if(string.IsNullOrEmpty(pref.EMail)) | ||
206 | { | ||
207 | UserAccount account = new UserAccount(); | ||
208 | if(userAccounts is UserAccountService.UserAccountService) | ||
209 | { | ||
210 | try | ||
211 | { | ||
212 | account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); | ||
213 | if(string.IsNullOrEmpty(account.Email)) | ||
214 | { | ||
215 | result = "No Email address on record!"; | ||
216 | return false; | ||
217 | } | ||
218 | else | ||
219 | pref.EMail = account.Email; | ||
220 | } | ||
221 | catch | ||
222 | { | ||
223 | m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account"); | ||
224 | result = "Missing Email address!"; | ||
225 | return false; | ||
226 | } | ||
227 | } | ||
228 | else | ||
229 | { | ||
230 | m_log.Info ("[PROFILES]: UserAccountService: Could not get user account"); | ||
231 | result = "Missing Email address!"; | ||
232 | return false; | ||
233 | } | ||
234 | } | ||
174 | return ProfilesData.GetUserPreferences(ref pref, ref result); | 235 | return ProfilesData.GetUserPreferences(ref pref, ref result); |
175 | } | 236 | } |
176 | #endregion User Preferences | 237 | #endregion User Preferences |