aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLUserProfilesData.cs39
1 files changed, 18 insertions, 21 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
index dc88f94..63492c2 100644
--- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
@@ -895,7 +895,7 @@ namespace OpenSim.Data.MySQL
895 } 895 }
896 896
897 #region User Preferences 897 #region User Preferences
898 public OSDArray GetUserPreferences(UUID avatarId) 898 public bool GetUserPreferences(ref UserPreferences pref, ref string result)
899 { 899 {
900 string query = string.Empty; 900 string query = string.Empty;
901 901
@@ -912,19 +912,16 @@ namespace OpenSim.Data.MySQL
912 dbcon.Open(); 912 dbcon.Open();
913 using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) 913 using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
914 { 914 {
915 cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); 915 cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());
916 916
917 using (MySqlDataReader reader = cmd.ExecuteReader()) 917 using (MySqlDataReader reader = cmd.ExecuteReader())
918 { 918 {
919 if(reader.HasRows) 919 if(reader.HasRows)
920 { 920 {
921 reader.Read(); 921 reader.Read();
922 OSDMap record = new OSDMap(); 922 bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
923 923 bool.TryParse((string)reader["visible"], out pref.Visible);
924 record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"])); 924 pref.EMail = (string)reader["email"];
925 record.Add("visible",OSD.FromString((string)reader["visible"]));
926 record.Add("email",OSD.FromString((string)reader["email"]));
927 data.Add(record);
928 } 925 }
929 else 926 else
930 { 927 {
@@ -947,17 +944,19 @@ namespace OpenSim.Data.MySQL
947 { 944 {
948 m_log.DebugFormat("[PROFILES_DATA]" + 945 m_log.DebugFormat("[PROFILES_DATA]" +
949 ": Get preferences exception {0}", e.Message); 946 ": Get preferences exception {0}", e.Message);
947 result = e.Message;
948 return false;
950 } 949 }
951 return data; 950 return true;
952 } 951 }
953 952
954 public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId ) 953 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
955 { 954 {
956 string query = string.Empty; 955 string query = string.Empty;
957 956
958 query += "UPDATE userpsettings SET "; 957 query += "UPDATE usersettings SET ";
959 query += "imviaemail=?ImViaEmail, "; 958 query += "imviaemail=?ImViaEmail, ";
960 query += "visible=?Visible,"; 959 query += "visible=?Visible ";
961 query += "WHERE useruuid=?uuid"; 960 query += "WHERE useruuid=?uuid";
962 961
963 try 962 try
@@ -967,14 +966,11 @@ namespace OpenSim.Data.MySQL
967 dbcon.Open(); 966 dbcon.Open();
968 using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) 967 using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
969 { 968 {
970 cmd.Parameters.AddWithValue("?ImViaEmail", emailIm.ToString().ToLower ()); 969 cmd.Parameters.AddWithValue("?ImViaEmail", pref.IMViaEmail);
971 cmd.Parameters.AddWithValue("?WantText", visible.ToString().ToLower ()); 970 cmd.Parameters.AddWithValue("?Visible", pref.Visible);
972 cmd.Parameters.AddWithValue("?uuid", avatarId.ToString()); 971 cmd.Parameters.AddWithValue("?uuid", pref.UserId.ToString());
973 972
974 lock(Lock) 973 cmd.ExecuteNonQuery();
975 {
976 cmd.ExecuteNonQuery();
977 }
978 } 974 }
979 } 975 }
980 } 976 }
@@ -982,6 +978,7 @@ namespace OpenSim.Data.MySQL
982 { 978 {
983 m_log.DebugFormat("[PROFILES_DATA]" + 979 m_log.DebugFormat("[PROFILES_DATA]" +
984 ": AgentInterestsUpdate exception {0}", e.Message); 980 ": AgentInterestsUpdate exception {0}", e.Message);
981 result = e.Message;
985 return false; 982 return false;
986 } 983 }
987 return true; 984 return true;