aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBlueWall2013-12-16 15:10:09 -0500
committerBlueWall2013-12-16 16:25:14 -0500
commitb699af87dc5abca607f449caaee1a1ecc4131bf3 (patch)
tree797174ee5f00417afbebb7f039a2d1b3e444d80d
parentBackport profile fixes (diff)
downloadopensim-SC_OLD-b699af87dc5abca607f449caaee1a1ecc4131bf3.zip
opensim-SC_OLD-b699af87dc5abca607f449caaee1a1ecc4131bf3.tar.gz
opensim-SC_OLD-b699af87dc5abca607f449caaee1a1ecc4131bf3.tar.bz2
opensim-SC_OLD-b699af87dc5abca607f449caaee1a1ecc4131bf3.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.
-rw-r--r--OpenSim/Data/MySQL/MySQLUserProfilesData.cs16
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserProfilesData.cs3
-rw-r--r--OpenSim/Services/UserProfilesService/UserProfilesService.cs61
3 files changed, 73 insertions, 7 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
index dca80c3..48044f0 100644
--- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
@@ -927,15 +927,19 @@ namespace OpenSim.Data.MySQL
927 } 927 }
928 else 928 else
929 { 929 {
930 dbcon.Close();
931 dbcon.Open();
932
933 query = "INSERT INTO usersettings VALUES ";
934 query += "(?uuid,'false','false', ?Email)";
935
930 using (MySqlCommand put = new MySqlCommand(query, dbcon)) 936 using (MySqlCommand put = new MySqlCommand(query, dbcon))
931 { 937 {
932 query = "INSERT INTO usersettings VALUES ";
933 query += "(?Id,'false','false', '')";
934 938
935 lock(Lock) 939 put.Parameters.AddWithValue("?Email", pref.EMail);
936 { 940 put.Parameters.AddWithValue("?uuid", pref.UserId.ToString());
937 put.ExecuteNonQuery(); 941
938 } 942 put.ExecuteNonQuery();
939 } 943 }
940 } 944 }
941 } 945 }
diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
index 70ce07c..0a6c625 100644
--- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
@@ -810,11 +810,12 @@ namespace OpenSim.Data.SQLite
810 else 810 else
811 { 811 {
812 query = "INSERT INTO usersettings VALUES "; 812 query = "INSERT INTO usersettings VALUES ";
813 query += "(:Id,'false','false', '')"; 813 query += "(:Id,'false','false', :Email)";
814 814
815 using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand()) 815 using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand())
816 { 816 {
817 put.Parameters.AddWithValue(":Id", pref.UserId.ToString()); 817 put.Parameters.AddWithValue(":Id", pref.UserId.ToString());
818 put.Parameters.AddWithValue(":Email", pref.EMail);
818 put.ExecuteNonQuery(); 819 put.ExecuteNonQuery();
819 820
820 } 821 }
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;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenMetaverse.StructuredData; 38using OpenMetaverse.StructuredData;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Services.UserAccountService;
40 41
41namespace OpenSim.Services.ProfilesService 42namespace 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