diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/SQLite/Resources/UserProfiles.migrations | 12 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteUserProfilesData.cs | 85 |
2 files changed, 95 insertions, 2 deletions
diff --git a/OpenSim/Data/SQLite/Resources/UserProfiles.migrations b/OpenSim/Data/SQLite/Resources/UserProfiles.migrations index 16581f6..86434e8 100644 --- a/OpenSim/Data/SQLite/Resources/UserProfiles.migrations +++ b/OpenSim/Data/SQLite/Resources/UserProfiles.migrations | |||
@@ -88,3 +88,15 @@ CREATE TABLE IF NOT EXISTS userdata ( | |||
88 | 88 | ||
89 | commit; | 89 | commit; |
90 | 90 | ||
91 | |||
92 | :VERSION 3 # ------------------------------- | ||
93 | |||
94 | begin; | ||
95 | CREATE TABLE IF NOT EXISTS usersettings ( | ||
96 | useruuid char(36) NOT NULL, | ||
97 | imviaemail binary(1) NOT NULL, | ||
98 | visible binary(1) NOT NULL, | ||
99 | email varchar(254) NOT NULL, | ||
100 | PRIMARY KEY (useruuid) | ||
101 | ) | ||
102 | commit; \ No newline at end of file | ||
diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs index cc1dac1..916a226 100644 --- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs | |||
@@ -679,7 +679,6 @@ namespace OpenSim.Data.SQLite | |||
679 | string query = string.Empty; | 679 | string query = string.Empty; |
680 | 680 | ||
681 | query += "UPDATE userprofile SET "; | 681 | query += "UPDATE userprofile SET "; |
682 | query += "profilePartner=:profilePartner, "; | ||
683 | query += "profileURL=:profileURL, "; | 682 | query += "profileURL=:profileURL, "; |
684 | query += "profileImage=:image, "; | 683 | query += "profileImage=:image, "; |
685 | query += "profileAboutText=:abouttext,"; | 684 | query += "profileAboutText=:abouttext,"; |
@@ -693,7 +692,6 @@ namespace OpenSim.Data.SQLite | |||
693 | { | 692 | { |
694 | cmd.CommandText = query; | 693 | cmd.CommandText = query; |
695 | cmd.Parameters.AddWithValue(":profileURL", props.WebUrl); | 694 | cmd.Parameters.AddWithValue(":profileURL", props.WebUrl); |
696 | cmd.Parameters.AddWithValue(":profilePartner", props.PartnerId.ToString()); | ||
697 | cmd.Parameters.AddWithValue(":image", props.ImageId.ToString()); | 695 | cmd.Parameters.AddWithValue(":image", props.ImageId.ToString()); |
698 | cmd.Parameters.AddWithValue(":abouttext", props.AboutText); | 696 | cmd.Parameters.AddWithValue(":abouttext", props.AboutText); |
699 | cmd.Parameters.AddWithValue(":firstlifeimage", props.FirstLifeImageId.ToString()); | 697 | cmd.Parameters.AddWithValue(":firstlifeimage", props.FirstLifeImageId.ToString()); |
@@ -749,6 +747,89 @@ namespace OpenSim.Data.SQLite | |||
749 | } | 747 | } |
750 | return true; | 748 | return true; |
751 | } | 749 | } |
750 | |||
751 | public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) | ||
752 | { | ||
753 | string query = string.Empty; | ||
754 | |||
755 | query += "UPDATE usersettings SET "; | ||
756 | query += "imviaemail=:ImViaEmail, "; | ||
757 | query += "visible=:Visible "; | ||
758 | query += "WHERE useruuid=:uuid"; | ||
759 | |||
760 | try | ||
761 | { | ||
762 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
763 | { | ||
764 | cmd.CommandText = query; | ||
765 | cmd.Parameters.AddWithValue(":ImViaEmail", pref.IMViaEmail); | ||
766 | cmd.Parameters.AddWithValue(":Visible", pref.Visible); | ||
767 | cmd.Parameters.AddWithValue(":uuid", pref.UserId.ToString()); | ||
768 | |||
769 | cmd.ExecuteNonQuery(); | ||
770 | } | ||
771 | } | ||
772 | catch (Exception e) | ||
773 | { | ||
774 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
775 | ": AgentInterestsUpdate exception {0}", e.Message); | ||
776 | result = e.Message; | ||
777 | return false; | ||
778 | } | ||
779 | return true; | ||
780 | } | ||
781 | |||
782 | public bool GetUserPreferences(ref UserPreferences pref, ref string result) | ||
783 | { | ||
784 | IDataReader reader = null; | ||
785 | string query = string.Empty; | ||
786 | |||
787 | query += "SELECT imviaemail,visible,email FROM "; | ||
788 | query += "usersettings WHERE "; | ||
789 | query += "useruuid = :Id"; | ||
790 | |||
791 | OSDArray data = new OSDArray(); | ||
792 | |||
793 | try | ||
794 | { | ||
795 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
796 | { | ||
797 | cmd.CommandText = query; | ||
798 | cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString()); | ||
799 | |||
800 | using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | ||
801 | { | ||
802 | if(reader.Read()) | ||
803 | { | ||
804 | bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); | ||
805 | bool.TryParse((string)reader["visible"], out pref.Visible); | ||
806 | pref.EMail = (string)reader["email"]; | ||
807 | } | ||
808 | else | ||
809 | { | ||
810 | query = "INSERT INTO usersettings VALUES "; | ||
811 | query += "(:Id,'false','false', '')"; | ||
812 | |||
813 | using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand()) | ||
814 | { | ||
815 | put.Parameters.AddWithValue(":Id", pref.UserId.ToString()); | ||
816 | put.ExecuteNonQuery(); | ||
817 | |||
818 | } | ||
819 | } | ||
820 | } | ||
821 | } | ||
822 | } | ||
823 | catch (Exception e) | ||
824 | { | ||
825 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
826 | ": Get preferences exception {0}", e.Message); | ||
827 | result = e.Message; | ||
828 | return false; | ||
829 | } | ||
830 | return true; | ||
831 | } | ||
832 | |||
752 | public bool GetUserAppData(ref UserAppData props, ref string result) | 833 | public bool GetUserAppData(ref UserAppData props, ref string result) |
753 | { | 834 | { |
754 | IDataReader reader = null; | 835 | IDataReader reader = null; |