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