aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/UserProfilesService/UserProfilesService.cs
diff options
context:
space:
mode:
authorBlueWall2013-12-16 15:10:09 -0500
committerBlueWall2013-12-16 17:36:04 -0500
commitb03ec6137f462486a3469f6ba4bbd363dc85295f (patch)
tree7758ff41f80956b007acb281432e855cdbdd9668 /OpenSim/Services/UserProfilesService/UserProfilesService.cs
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-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/Services/UserProfilesService/UserProfilesService.cs61
1 files changed, 61 insertions, 0 deletions
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