aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLUserProfilesData.cs39
-rw-r--r--OpenSim/Data/MySQL/Resources/UserProfiles.migrations10
2 files changed, 21 insertions, 28 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
index 63492c2..dc88f94 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 bool GetUserPreferences(ref UserPreferences pref, ref string result) 898 public OSDArray GetUserPreferences(UUID avatarId)
899 { 899 {
900 string query = string.Empty; 900 string query = string.Empty;
901 901
@@ -912,16 +912,19 @@ 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", pref.UserId.ToString()); 915 cmd.Parameters.AddWithValue("?Id", avatarId.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 bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); 922 OSDMap record = new OSDMap();
923 bool.TryParse((string)reader["visible"], out pref.Visible); 923
924 pref.EMail = (string)reader["email"]; 924 record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"]));
925 record.Add("visible",OSD.FromString((string)reader["visible"]));
926 record.Add("email",OSD.FromString((string)reader["email"]));
927 data.Add(record);
925 } 928 }
926 else 929 else
927 { 930 {
@@ -944,19 +947,17 @@ namespace OpenSim.Data.MySQL
944 { 947 {
945 m_log.DebugFormat("[PROFILES_DATA]" + 948 m_log.DebugFormat("[PROFILES_DATA]" +
946 ": Get preferences exception {0}", e.Message); 949 ": Get preferences exception {0}", e.Message);
947 result = e.Message;
948 return false;
949 } 950 }
950 return true; 951 return data;
951 } 952 }
952 953
953 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) 954 public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId )
954 { 955 {
955 string query = string.Empty; 956 string query = string.Empty;
956 957
957 query += "UPDATE usersettings SET "; 958 query += "UPDATE userpsettings SET ";
958 query += "imviaemail=?ImViaEmail, "; 959 query += "imviaemail=?ImViaEmail, ";
959 query += "visible=?Visible "; 960 query += "visible=?Visible,";
960 query += "WHERE useruuid=?uuid"; 961 query += "WHERE useruuid=?uuid";
961 962
962 try 963 try
@@ -966,11 +967,14 @@ namespace OpenSim.Data.MySQL
966 dbcon.Open(); 967 dbcon.Open();
967 using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) 968 using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
968 { 969 {
969 cmd.Parameters.AddWithValue("?ImViaEmail", pref.IMViaEmail); 970 cmd.Parameters.AddWithValue("?ImViaEmail", emailIm.ToString().ToLower ());
970 cmd.Parameters.AddWithValue("?Visible", pref.Visible); 971 cmd.Parameters.AddWithValue("?WantText", visible.ToString().ToLower ());
971 cmd.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); 972 cmd.Parameters.AddWithValue("?uuid", avatarId.ToString());
972 973
973 cmd.ExecuteNonQuery(); 974 lock(Lock)
975 {
976 cmd.ExecuteNonQuery();
977 }
974 } 978 }
975 } 979 }
976 } 980 }
@@ -978,7 +982,6 @@ namespace OpenSim.Data.MySQL
978 { 982 {
979 m_log.DebugFormat("[PROFILES_DATA]" + 983 m_log.DebugFormat("[PROFILES_DATA]" +
980 ": AgentInterestsUpdate exception {0}", e.Message); 984 ": AgentInterestsUpdate exception {0}", e.Message);
981 result = e.Message;
982 return false; 985 return false;
983 } 986 }
984 return true; 987 return true;
diff --git a/OpenSim/Data/MySQL/Resources/UserProfiles.migrations b/OpenSim/Data/MySQL/Resources/UserProfiles.migrations
index bd325da..c29f1ab 100644
--- a/OpenSim/Data/MySQL/Resources/UserProfiles.migrations
+++ b/OpenSim/Data/MySQL/Resources/UserProfiles.migrations
@@ -81,13 +81,3 @@ CREATE TABLE IF NOT EXISTS `userdata` (
81 81
82commit; 82commit;
83 83
84:VERSION 3 # -------------------------------
85begin;
86CREATE TABLE IF NOT EXISTS `usersettings` (
87 `useruuid` varchar(36) NOT NULL,
88 `imviaemail` enum('true','false') NOT NULL,
89 `visible` enum('true','false') NOT NULL,
90 `email` varchar(254) NOT NULL,
91 PRIMARY KEY (`useruuid`)
92) ENGINE=MyISAM DEFAULT CHARSET=latin1;
93commit; \ No newline at end of file