aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/PGSQL
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/PGSQL')
-rw-r--r--OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs29
-rw-r--r--OpenSim/Data/PGSQL/Resources/UserProfiles.migrations9
2 files changed, 15 insertions, 23 deletions
diff --git a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
index 46f57d8..f4e41b4 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 bool GetUserPreferences(ref UserPreferences pref, ref string result) 877 public OSDArray GetUserPreferences(UUID avatarId)
878 { 878 {
879 string query = string.Empty; 879 string query = string.Empty;
880 880
@@ -891,16 +891,19 @@ 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", pref.UserId.ToString()); 894 cmd.Parameters.AddWithValue("Id", avatarId.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 bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); 901 OSDMap record = new OSDMap();
902 bool.TryParse((string)reader["visible"], out pref.Visible); 902
903 pref.EMail = (string)reader["email"]; 903 record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"]));
904 record.Add("visible",OSD.FromString((string)reader["visible"]));
905 record.Add("email",OSD.FromString((string)reader["email"]));
906 data.Add(record);
904 } 907 }
905 else 908 else
906 { 909 {
@@ -923,16 +926,15 @@ namespace OpenSim.Data.PGSQL
923 { 926 {
924 m_log.DebugFormat("[PROFILES_DATA]" + 927 m_log.DebugFormat("[PROFILES_DATA]" +
925 ": Get preferences exception {0}", e.Message); 928 ": Get preferences exception {0}", e.Message);
926 result = e.Message;
927 } 929 }
928 return true; 930 return data;
929 } 931 }
930 932
931 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) 933 public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId )
932 { 934 {
933 string query = string.Empty; 935 string query = string.Empty;
934 936
935 query += "UPDATE usersettings SET "; 937 query += "UPDATE userpsettings SET ";
936 query += "imviaemail=:ImViaEmail, "; 938 query += "imviaemail=:ImViaEmail, ";
937 query += "visible=:Visible,"; 939 query += "visible=:Visible,";
938 query += "WHERE useruuid=:uuid"; 940 query += "WHERE useruuid=:uuid";
@@ -944,9 +946,9 @@ namespace OpenSim.Data.PGSQL
944 dbcon.Open(); 946 dbcon.Open();
945 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) 947 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
946 { 948 {
947 cmd.Parameters.AddWithValue("ImViaEmail", pref.IMViaEmail.ToString().ToLower ()); 949 cmd.Parameters.AddWithValue("ImViaEmail", emailIm.ToString().ToLower ());
948 cmd.Parameters.AddWithValue("Visible", pref.Visible.ToString().ToLower ()); 950 cmd.Parameters.AddWithValue("WantText", visible.ToString().ToLower ());
949 cmd.Parameters.AddWithValue("uuid", pref.UserId.ToString()); 951 cmd.Parameters.AddWithValue("uuid", avatarId.ToString());
950 952
951 lock(Lock) 953 lock(Lock)
952 { 954 {
@@ -959,7 +961,6 @@ namespace OpenSim.Data.PGSQL
959 { 961 {
960 m_log.DebugFormat("[PROFILES_DATA]" + 962 m_log.DebugFormat("[PROFILES_DATA]" +
961 ": AgentInterestsUpdate exception {0}", e.Message); 963 ": AgentInterestsUpdate exception {0}", e.Message);
962 result = e.Message;
963 return false; 964 return false;
964 } 965 }
965 return true; 966 return true;
diff --git a/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations b/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations
index 4fcaa8e..f23c870 100644
--- a/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations
+++ b/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations
@@ -81,12 +81,3 @@ CREATE TABLE userdata (
81 81
82commit; 82commit;
83 83
84:VERSION 3 # -------------------------------
85begin;
86CREATE TABLE usersettings (
87 "useruuid" char(36) NOT NULL,
88 "imviaemail" bytea NOT NULL,
89 "visible" bytea NOT NULL,
90 PRIMARY KEY ("useruuid")
91);
92commit; \ No newline at end of file