diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteUserData.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs index 420b6e5..448ef85 100644 --- a/OpenSim/Data/SQLite/SQLiteUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserData.cs | |||
@@ -481,6 +481,37 @@ namespace OpenSim.Data.SQLite | |||
481 | 481 | ||
482 | } | 482 | } |
483 | 483 | ||
484 | private bool ExistsFirstLastName(String fname, String lname) | ||
485 | { | ||
486 | string FindUser = "select * from users where (username=:username and surname=:surname)"; | ||
487 | using (SqliteCommand cmd = new SqliteCommand(FindUser, g_conn)) | ||
488 | { | ||
489 | cmd.Parameters.Add(new SqliteParameter(":username", fname)); | ||
490 | cmd.Parameters.Add(new SqliteParameter(":surname", lname)); | ||
491 | try | ||
492 | { | ||
493 | using (IDataReader reader = cmd.ExecuteReader()) | ||
494 | { | ||
495 | if(reader.Read()) | ||
496 | { | ||
497 | reader.Close(); | ||
498 | return true; | ||
499 | } | ||
500 | else | ||
501 | { | ||
502 | reader.Close(); | ||
503 | return false; | ||
504 | } | ||
505 | } | ||
506 | } | ||
507 | catch (Exception ex) | ||
508 | { | ||
509 | m_log.Error("[USER DB]: Exception searching for user's first and last name: " + ex.ToString()); | ||
510 | return false; | ||
511 | } | ||
512 | } | ||
513 | } | ||
514 | |||
484 | /// <summary> | 515 | /// <summary> |
485 | /// Creates a new user profile | 516 | /// Creates a new user profile |
486 | /// </summary> | 517 | /// </summary> |
@@ -488,6 +519,10 @@ namespace OpenSim.Data.SQLite | |||
488 | override public void AddNewUserProfile(UserProfileData user) | 519 | override public void AddNewUserProfile(UserProfileData user) |
489 | { | 520 | { |
490 | DataTable users = ds.Tables["users"]; | 521 | DataTable users = ds.Tables["users"]; |
522 | UUID zero = UUID.Zero; | ||
523 | if (ExistsFirstLastName(user.FirstName, user.SurName) || user.ID == zero) | ||
524 | return; | ||
525 | |||
491 | lock (ds) | 526 | lock (ds) |
492 | { | 527 | { |
493 | DataRow row = users.Rows.Find(Util.ToRawUuidString(user.ID)); | 528 | DataRow row = users.Rows.Find(Util.ToRawUuidString(user.ID)); |