diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLUserProfilesData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserProfilesData.cs | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs index 6ed3b06..8b50c54 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs | |||
@@ -899,7 +899,7 @@ namespace OpenSim.Data.MySQL | |||
899 | } | 899 | } |
900 | 900 | ||
901 | #region User Preferences | 901 | #region User Preferences |
902 | public bool GetUserPreferences(ref UserPreferences pref, ref string result) | 902 | public OSDArray GetUserPreferences(UUID avatarId) |
903 | { | 903 | { |
904 | string query = string.Empty; | 904 | string query = string.Empty; |
905 | 905 | ||
@@ -916,16 +916,19 @@ namespace OpenSim.Data.MySQL | |||
916 | dbcon.Open(); | 916 | dbcon.Open(); |
917 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 917 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
918 | { | 918 | { |
919 | cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString()); | 919 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
920 | 920 | ||
921 | using (MySqlDataReader reader = cmd.ExecuteReader()) | 921 | using (MySqlDataReader reader = cmd.ExecuteReader()) |
922 | { | 922 | { |
923 | if(reader.HasRows) | 923 | if(reader.HasRows) |
924 | { | 924 | { |
925 | reader.Read(); | 925 | reader.Read(); |
926 | bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); | 926 | OSDMap record = new OSDMap(); |
927 | bool.TryParse((string)reader["visible"], out pref.Visible); | 927 | |
928 | pref.EMail = (string)reader["email"]; | 928 | record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"])); |
929 | record.Add("visible",OSD.FromString((string)reader["visible"])); | ||
930 | record.Add("email",OSD.FromString((string)reader["email"])); | ||
931 | data.Add(record); | ||
929 | } | 932 | } |
930 | else | 933 | else |
931 | { | 934 | { |
@@ -938,8 +941,8 @@ namespace OpenSim.Data.MySQL | |||
938 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) | 941 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) |
939 | { | 942 | { |
940 | 943 | ||
941 | put.Parameters.AddWithValue("?Email", pref.EMail); | 944 | // put.Parameters.AddWithValue("?Email", pref.EMail); |
942 | put.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); | 945 | // put.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); |
943 | 946 | ||
944 | put.ExecuteNonQuery(); | 947 | put.ExecuteNonQuery(); |
945 | } | 948 | } |
@@ -952,19 +955,17 @@ namespace OpenSim.Data.MySQL | |||
952 | { | 955 | { |
953 | m_log.DebugFormat("[PROFILES_DATA]" + | 956 | m_log.DebugFormat("[PROFILES_DATA]" + |
954 | ": Get preferences exception {0}", e.Message); | 957 | ": Get preferences exception {0}", e.Message); |
955 | result = e.Message; | ||
956 | return false; | ||
957 | } | 958 | } |
958 | return true; | 959 | return data; |
959 | } | 960 | } |
960 | 961 | ||
961 | public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) | 962 | public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId ) |
962 | { | 963 | { |
963 | string query = string.Empty; | 964 | string query = string.Empty; |
964 | 965 | ||
965 | query += "UPDATE usersettings SET "; | 966 | query += "UPDATE userpsettings SET "; |
966 | query += "imviaemail=?ImViaEmail, "; | 967 | query += "imviaemail=?ImViaEmail, "; |
967 | query += "visible=?Visible "; | 968 | query += "visible=?Visible,"; |
968 | query += "WHERE useruuid=?uuid"; | 969 | query += "WHERE useruuid=?uuid"; |
969 | 970 | ||
970 | try | 971 | try |
@@ -974,11 +975,14 @@ namespace OpenSim.Data.MySQL | |||
974 | dbcon.Open(); | 975 | dbcon.Open(); |
975 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 976 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
976 | { | 977 | { |
977 | cmd.Parameters.AddWithValue("?ImViaEmail", pref.IMViaEmail); | 978 | cmd.Parameters.AddWithValue("?ImViaEmail", emailIm.ToString().ToLower ()); |
978 | cmd.Parameters.AddWithValue("?Visible", pref.Visible); | 979 | cmd.Parameters.AddWithValue("?WantText", visible.ToString().ToLower ()); |
979 | cmd.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); | 980 | cmd.Parameters.AddWithValue("?uuid", avatarId.ToString()); |
980 | 981 | ||
981 | cmd.ExecuteNonQuery(); | 982 | lock(Lock) |
983 | { | ||
984 | cmd.ExecuteNonQuery(); | ||
985 | } | ||
982 | } | 986 | } |
983 | } | 987 | } |
984 | } | 988 | } |
@@ -986,7 +990,6 @@ namespace OpenSim.Data.MySQL | |||
986 | { | 990 | { |
987 | m_log.DebugFormat("[PROFILES_DATA]" + | 991 | m_log.DebugFormat("[PROFILES_DATA]" + |
988 | ": AgentInterestsUpdate exception {0}", e.Message); | 992 | ": AgentInterestsUpdate exception {0}", e.Message); |
989 | result = e.Message; | ||
990 | return false; | 993 | return false; |
991 | } | 994 | } |
992 | return true; | 995 | return true; |