aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs')
-rw-r--r--OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs29
1 files changed, 14 insertions, 15 deletions
diff --git a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
index f4e41b4..46f57d8 100644
--- a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
@@ -874,7 +874,7 @@ namespace OpenSim.Data.PGSQL
874 } 874 }
875 875
876 #region User Preferences 876 #region User Preferences
877 public OSDArray GetUserPreferences(UUID avatarId) 877 public bool GetUserPreferences(ref UserPreferences pref, ref string result)
878 { 878 {
879 string query = string.Empty; 879 string query = string.Empty;
880 880
@@ -891,19 +891,16 @@ namespace OpenSim.Data.PGSQL
891 dbcon.Open(); 891 dbcon.Open();
892 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) 892 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
893 { 893 {
894 cmd.Parameters.AddWithValue("Id", avatarId.ToString()); 894 cmd.Parameters.AddWithValue("Id", pref.UserId.ToString());
895 895
896 using (NpgsqlDataReader reader = cmd.ExecuteReader()) 896 using (NpgsqlDataReader reader = cmd.ExecuteReader())
897 { 897 {
898 if(reader.HasRows) 898 if(reader.HasRows)
899 { 899 {
900 reader.Read(); 900 reader.Read();
901 OSDMap record = new OSDMap(); 901 bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
902 902 bool.TryParse((string)reader["visible"], out pref.Visible);
903 record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"])); 903 pref.EMail = (string)reader["email"];
904 record.Add("visible",OSD.FromString((string)reader["visible"]));
905 record.Add("email",OSD.FromString((string)reader["email"]));
906 data.Add(record);
907 } 904 }
908 else 905 else
909 { 906 {
@@ -926,15 +923,16 @@ namespace OpenSim.Data.PGSQL
926 { 923 {
927 m_log.DebugFormat("[PROFILES_DATA]" + 924 m_log.DebugFormat("[PROFILES_DATA]" +
928 ": Get preferences exception {0}", e.Message); 925 ": Get preferences exception {0}", e.Message);
926 result = e.Message;
929 } 927 }
930 return data; 928 return true;
931 } 929 }
932 930
933 public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId ) 931 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
934 { 932 {
935 string query = string.Empty; 933 string query = string.Empty;
936 934
937 query += "UPDATE userpsettings SET "; 935 query += "UPDATE usersettings SET ";
938 query += "imviaemail=:ImViaEmail, "; 936 query += "imviaemail=:ImViaEmail, ";
939 query += "visible=:Visible,"; 937 query += "visible=:Visible,";
940 query += "WHERE useruuid=:uuid"; 938 query += "WHERE useruuid=:uuid";
@@ -946,9 +944,9 @@ namespace OpenSim.Data.PGSQL
946 dbcon.Open(); 944 dbcon.Open();
947 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) 945 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
948 { 946 {
949 cmd.Parameters.AddWithValue("ImViaEmail", emailIm.ToString().ToLower ()); 947 cmd.Parameters.AddWithValue("ImViaEmail", pref.IMViaEmail.ToString().ToLower ());
950 cmd.Parameters.AddWithValue("WantText", visible.ToString().ToLower ()); 948 cmd.Parameters.AddWithValue("Visible", pref.Visible.ToString().ToLower ());
951 cmd.Parameters.AddWithValue("uuid", avatarId.ToString()); 949 cmd.Parameters.AddWithValue("uuid", pref.UserId.ToString());
952 950
953 lock(Lock) 951 lock(Lock)
954 { 952 {
@@ -961,6 +959,7 @@ namespace OpenSim.Data.PGSQL
961 { 959 {
962 m_log.DebugFormat("[PROFILES_DATA]" + 960 m_log.DebugFormat("[PROFILES_DATA]" +
963 ": AgentInterestsUpdate exception {0}", e.Message); 961 ": AgentInterestsUpdate exception {0}", e.Message);
962 result = e.Message;
964 return false; 963 return false;
965 } 964 }
966 return true; 965 return true;