Populate user preferences with UserAccount email if it is present, else return an error indicating no email is on record for the user.
parent
5745aa0f86
commit
b699af87dc
|
@ -927,13 +927,18 @@ 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.Parameters.AddWithValue("?Email", pref.EMail);
|
||||
put.Parameters.AddWithValue("?uuid", pref.UserId.ToString());
|
||||
|
||||
put.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
@ -941,7 +946,6 @@ namespace OpenSim.Data.MySQL
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[PROFILES_DATA]" +
|
||||
|
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue