Fix handling of user preference updates where no email address is supplied
parent
7813780eba
commit
12108bf6e9
|
@ -916,6 +916,9 @@ namespace OpenSim.Data.MySQL
|
||||||
bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
|
bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
|
||||||
bool.TryParse((string)reader["visible"], out pref.Visible);
|
bool.TryParse((string)reader["visible"], out pref.Visible);
|
||||||
pref.EMail = (string)reader["email"];
|
pref.EMail = (string)reader["email"];
|
||||||
|
|
||||||
|
if(string.IsNullOrEmpty(pref.EMail))
|
||||||
|
pref.EMail = "No EMail Address Provided";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -954,7 +957,8 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
query += "UPDATE usersettings SET ";
|
query += "UPDATE usersettings SET ";
|
||||||
query += "imviaemail=?ImViaEmail, ";
|
query += "imviaemail=?ImViaEmail, ";
|
||||||
query += "visible=?Visible ";
|
query += "visible=?Visible, ";
|
||||||
|
query += "email=?EMail ";
|
||||||
query += "WHERE useruuid=?uuid";
|
query += "WHERE useruuid=?uuid";
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -967,6 +971,7 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.Parameters.AddWithValue("?ImViaEmail", pref.IMViaEmail.ToString().ToLower());
|
cmd.Parameters.AddWithValue("?ImViaEmail", pref.IMViaEmail.ToString().ToLower());
|
||||||
cmd.Parameters.AddWithValue("?Visible", pref.Visible.ToString().ToLower());
|
cmd.Parameters.AddWithValue("?Visible", pref.Visible.ToString().ToLower());
|
||||||
cmd.Parameters.AddWithValue("?uuid", pref.UserId.ToString());
|
cmd.Parameters.AddWithValue("?uuid", pref.UserId.ToString());
|
||||||
|
cmd.Parameters.AddWithValue("?EMail", pref.EMail.ToString().ToLower());
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
@ -975,7 +980,7 @@ namespace OpenSim.Data.MySQL
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PROFILES_DATA]" +
|
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||||
": AgentInterestsUpdate exception {0}", e.Message);
|
": UserPreferencesUpdate exception {0} {1}", e.Message, e.InnerException);
|
||||||
result = e.Message;
|
result = e.Message;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -902,6 +902,9 @@ namespace OpenSim.Data.PGSQL
|
||||||
bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
|
bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
|
||||||
bool.TryParse((string)reader["visible"], out pref.Visible);
|
bool.TryParse((string)reader["visible"], out pref.Visible);
|
||||||
pref.EMail = (string)reader["email"];
|
pref.EMail = (string)reader["email"];
|
||||||
|
|
||||||
|
if(string.IsNullOrEmpty(pref.EMail))
|
||||||
|
pref.EMail = "No EMail Address Provided";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -936,6 +939,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
query += "UPDATE usersettings SET ";
|
query += "UPDATE usersettings SET ";
|
||||||
query += "imviaemail=:ImViaEmail, ";
|
query += "imviaemail=:ImViaEmail, ";
|
||||||
query += "visible=:Visible, ";
|
query += "visible=:Visible, ";
|
||||||
|
query += "email=:Email ";
|
||||||
query += "WHERE useruuid=:uuid";
|
query += "WHERE useruuid=:uuid";
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -947,6 +951,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
{
|
{
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("ImViaEmail", pref.IMViaEmail.ToString().ToLower ()));
|
cmd.Parameters.Add(m_database.CreateParameter("ImViaEmail", pref.IMViaEmail.ToString().ToLower ()));
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("Visible", pref.Visible.ToString().ToLower ()));
|
cmd.Parameters.Add(m_database.CreateParameter("Visible", pref.Visible.ToString().ToLower ()));
|
||||||
|
cmd.Parameters.Add(m_database.CreateParameter("EMail", pref.EMail.ToString().ToLower ()));
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("uuid", pref.UserId.ToString()));
|
cmd.Parameters.Add(m_database.CreateParameter("uuid", pref.UserId.ToString()));
|
||||||
|
|
||||||
lock(Lock)
|
lock(Lock)
|
||||||
|
|
|
@ -747,7 +747,8 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
query += "UPDATE usersettings SET ";
|
query += "UPDATE usersettings SET ";
|
||||||
query += "imviaemail=:ImViaEmail, ";
|
query += "imviaemail=:ImViaEmail, ";
|
||||||
query += "visible=:Visible ";
|
query += "visible=:Visible, ";
|
||||||
|
query += "email=:EMail ";
|
||||||
query += "WHERE useruuid=:uuid";
|
query += "WHERE useruuid=:uuid";
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -757,6 +758,7 @@ namespace OpenSim.Data.SQLite
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
cmd.Parameters.AddWithValue(":ImViaEmail", pref.IMViaEmail);
|
cmd.Parameters.AddWithValue(":ImViaEmail", pref.IMViaEmail);
|
||||||
cmd.Parameters.AddWithValue(":Visible", pref.Visible);
|
cmd.Parameters.AddWithValue(":Visible", pref.Visible);
|
||||||
|
cmd.Parameters.AddWithValue(":EMail", pref.EMail);
|
||||||
cmd.Parameters.AddWithValue(":uuid", pref.UserId.ToString());
|
cmd.Parameters.AddWithValue(":uuid", pref.UserId.ToString());
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
|
@ -797,6 +799,9 @@ namespace OpenSim.Data.SQLite
|
||||||
bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
|
bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
|
||||||
bool.TryParse((string)reader["visible"], out pref.Visible);
|
bool.TryParse((string)reader["visible"], out pref.Visible);
|
||||||
pref.EMail = (string)reader["email"];
|
pref.EMail = (string)reader["email"];
|
||||||
|
|
||||||
|
if(string.IsNullOrEmpty(pref.EMail))
|
||||||
|
pref.EMail = "No EMail Address Provided";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,6 @@ namespace OpenSim.Services.ProfilesService
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
IUserAccountService userAccounts;
|
IUserAccountService userAccounts;
|
||||||
IAuthenticationService authService;
|
|
||||||
|
|
||||||
public UserProfilesService(IConfigSource config, string configName):
|
public UserProfilesService(IConfigSource config, string configName):
|
||||||
base(config, configName)
|
base(config, configName)
|
||||||
|
@ -55,7 +54,7 @@ namespace OpenSim.Services.ProfilesService
|
||||||
IConfig Config = config.Configs[configName];
|
IConfig Config = config.Configs[configName];
|
||||||
if (Config == null)
|
if (Config == null)
|
||||||
{
|
{
|
||||||
m_log.Warn("[PROFILES]: No configuration found!");
|
m_log.Warn("[PROFILES SERVICE]: No configuration found!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Object[] args = null;
|
Object[] args = null;
|
||||||
|
@ -66,9 +65,6 @@ namespace OpenSim.Services.ProfilesService
|
||||||
userAccounts = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
|
userAccounts = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
|
||||||
|
|
||||||
args = new Object[] { config };
|
args = new Object[] { config };
|
||||||
string authServiceConfig = Config.GetString("AuthenticationServiceModule", String.Empty);
|
|
||||||
if (accountService != string.Empty)
|
|
||||||
authService = ServerUtils.LoadPlugin<IAuthenticationService>(authServiceConfig, args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Classifieds
|
#region Classifieds
|
||||||
|
@ -176,23 +172,22 @@ namespace OpenSim.Services.ProfilesService
|
||||||
account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId);
|
account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId);
|
||||||
if(string.IsNullOrEmpty(account.Email))
|
if(string.IsNullOrEmpty(account.Email))
|
||||||
{
|
{
|
||||||
result = "No Email address on record!";
|
pref.EMail = string.Empty;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pref.EMail = account.Email;
|
pref.EMail = account.Email;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account");
|
m_log.Error ("[PROFILES SERVICE]: UserAccountService Exception: Could not get user account");
|
||||||
result = "Missing Email address!";
|
result = "UserAccountService settings error in UserProfileService!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Info ("[PROFILES]: UserAccountService: Could not get user account");
|
m_log.Error ("[PROFILES SERVICE]: UserAccountService: Could not get user account");
|
||||||
result = "Missing Email address!";
|
result = "UserAccountService settings error in UserProfileService!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,23 +206,22 @@ namespace OpenSim.Services.ProfilesService
|
||||||
account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId);
|
account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId);
|
||||||
if(string.IsNullOrEmpty(account.Email))
|
if(string.IsNullOrEmpty(account.Email))
|
||||||
{
|
{
|
||||||
result = "No Email address on record!";
|
pref.EMail = string.Empty;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pref.EMail = account.Email;
|
pref.EMail = account.Email;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account");
|
m_log.Error ("[PROFILES SERVICE]: UserAccountService Exception: Could not get user account");
|
||||||
result = "Missing Email address!";
|
result = "UserAccountService settings error in UserProfileService!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Info ("[PROFILES]: UserAccountService: Could not get user account");
|
m_log.Error ("[PROFILES SERVICE]: UserAccountService: Could not get user account");
|
||||||
result = "Missing Email address!";
|
result = "UserAccountService settings error in UserProfileService!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace OpenSim.Services.ProfilesService
|
||||||
{
|
{
|
||||||
if(string.IsNullOrEmpty(configName))
|
if(string.IsNullOrEmpty(configName))
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[PROFILES]: Configuration section not given!");
|
m_log.WarnFormat("[PROFILES SERVICE]: Configuration section not given!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue