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.cs31
1 files changed, 14 insertions, 17 deletions
diff --git a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
index e3cbf7f..46f57d8 100644
--- a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
@@ -715,7 +715,6 @@ namespace OpenSim.Data.PGSQL
715 string query = string.Empty; 715 string query = string.Empty;
716 716
717 query += "UPDATE userprofile SET "; 717 query += "UPDATE userprofile SET ";
718 query += "profilePartner=:profilePartner, ";
719 query += "profileURL=:profileURL, "; 718 query += "profileURL=:profileURL, ";
720 query += "profileImage=:image, "; 719 query += "profileImage=:image, ";
721 query += "profileAboutText=:abouttext,"; 720 query += "profileAboutText=:abouttext,";
@@ -731,7 +730,6 @@ namespace OpenSim.Data.PGSQL
731 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) 730 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
732 { 731 {
733 cmd.Parameters.AddWithValue("profileURL", props.WebUrl); 732 cmd.Parameters.AddWithValue("profileURL", props.WebUrl);
734 cmd.Parameters.AddWithValue("profilePartner", props.PartnerId.ToString());
735 cmd.Parameters.AddWithValue("image", props.ImageId.ToString()); 733 cmd.Parameters.AddWithValue("image", props.ImageId.ToString());
736 cmd.Parameters.AddWithValue("abouttext", props.AboutText); 734 cmd.Parameters.AddWithValue("abouttext", props.AboutText);
737 cmd.Parameters.AddWithValue("firstlifeimage", props.FirstLifeImageId.ToString()); 735 cmd.Parameters.AddWithValue("firstlifeimage", props.FirstLifeImageId.ToString());
@@ -876,7 +874,7 @@ namespace OpenSim.Data.PGSQL
876 } 874 }
877 875
878 #region User Preferences 876 #region User Preferences
879 public OSDArray GetUserPreferences(UUID avatarId) 877 public bool GetUserPreferences(ref UserPreferences pref, ref string result)
880 { 878 {
881 string query = string.Empty; 879 string query = string.Empty;
882 880
@@ -893,19 +891,16 @@ namespace OpenSim.Data.PGSQL
893 dbcon.Open(); 891 dbcon.Open();
894 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) 892 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
895 { 893 {
896 cmd.Parameters.AddWithValue("Id", avatarId.ToString()); 894 cmd.Parameters.AddWithValue("Id", pref.UserId.ToString());
897 895
898 using (NpgsqlDataReader reader = cmd.ExecuteReader()) 896 using (NpgsqlDataReader reader = cmd.ExecuteReader())
899 { 897 {
900 if(reader.HasRows) 898 if(reader.HasRows)
901 { 899 {
902 reader.Read(); 900 reader.Read();
903 OSDMap record = new OSDMap(); 901 bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
904 902 bool.TryParse((string)reader["visible"], out pref.Visible);
905 record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"])); 903 pref.EMail = (string)reader["email"];
906 record.Add("visible",OSD.FromString((string)reader["visible"]));
907 record.Add("email",OSD.FromString((string)reader["email"]));
908 data.Add(record);
909 } 904 }
910 else 905 else
911 { 906 {
@@ -928,15 +923,16 @@ namespace OpenSim.Data.PGSQL
928 { 923 {
929 m_log.DebugFormat("[PROFILES_DATA]" + 924 m_log.DebugFormat("[PROFILES_DATA]" +
930 ": Get preferences exception {0}", e.Message); 925 ": Get preferences exception {0}", e.Message);
926 result = e.Message;
931 } 927 }
932 return data; 928 return true;
933 } 929 }
934 930
935 public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId ) 931 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
936 { 932 {
937 string query = string.Empty; 933 string query = string.Empty;
938 934
939 query += "UPDATE userpsettings SET "; 935 query += "UPDATE usersettings SET ";
940 query += "imviaemail=:ImViaEmail, "; 936 query += "imviaemail=:ImViaEmail, ";
941 query += "visible=:Visible,"; 937 query += "visible=:Visible,";
942 query += "WHERE useruuid=:uuid"; 938 query += "WHERE useruuid=:uuid";
@@ -948,9 +944,9 @@ namespace OpenSim.Data.PGSQL
948 dbcon.Open(); 944 dbcon.Open();
949 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) 945 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
950 { 946 {
951 cmd.Parameters.AddWithValue("ImViaEmail", emailIm.ToString().ToLower ()); 947 cmd.Parameters.AddWithValue("ImViaEmail", pref.IMViaEmail.ToString().ToLower ());
952 cmd.Parameters.AddWithValue("WantText", visible.ToString().ToLower ()); 948 cmd.Parameters.AddWithValue("Visible", pref.Visible.ToString().ToLower ());
953 cmd.Parameters.AddWithValue("uuid", avatarId.ToString()); 949 cmd.Parameters.AddWithValue("uuid", pref.UserId.ToString());
954 950
955 lock(Lock) 951 lock(Lock)
956 { 952 {
@@ -963,6 +959,7 @@ namespace OpenSim.Data.PGSQL
963 { 959 {
964 m_log.DebugFormat("[PROFILES_DATA]" + 960 m_log.DebugFormat("[PROFILES_DATA]" +
965 ": AgentInterestsUpdate exception {0}", e.Message); 961 ": AgentInterestsUpdate exception {0}", e.Message);
962 result = e.Message;
966 return false; 963 return false;
967 } 964 }
968 return true; 965 return true;