diff options
author | BlueWall | 2013-12-06 02:52:13 -0500 |
---|---|---|
committer | BlueWall | 2013-12-06 14:30:37 -0500 |
commit | 5745aa0f865542b3cfdb0c656bd440dc7c2614b7 (patch) | |
tree | bce17900c7a761bb589bddec60b7923ea377ebe7 | |
parent | Added support for attachments to group notices when using Flotsam groups. (diff) | |
download | opensim-SC_OLD-5745aa0f865542b3cfdb0c656bd440dc7c2614b7.zip opensim-SC_OLD-5745aa0f865542b3cfdb0c656bd440dc7c2614b7.tar.gz opensim-SC_OLD-5745aa0f865542b3cfdb0c656bd440dc7c2614b7.tar.bz2 opensim-SC_OLD-5745aa0f865542b3cfdb0c656bd440dc7c2614b7.tar.xz |
Backport profile fixes
12 files changed, 274 insertions, 21 deletions
diff --git a/OpenSim/Data/IProfilesData.cs b/OpenSim/Data/IProfilesData.cs index 0de7f68..7fb075d 100644 --- a/OpenSim/Data/IProfilesData.cs +++ b/OpenSim/Data/IProfilesData.cs | |||
@@ -48,6 +48,8 @@ namespace OpenSim.Data | |||
48 | bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result); | 48 | bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result); |
49 | bool UpdateAvatarInterests(UserProfileProperties up, ref string result); | 49 | bool UpdateAvatarInterests(UserProfileProperties up, ref string result); |
50 | bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result); | 50 | bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result); |
51 | bool UpdateUserPreferences(ref UserPreferences pref, ref string result); | ||
52 | bool GetUserPreferences(ref UserPreferences pref, ref string result); | ||
51 | bool GetUserAppData(ref UserAppData props, ref string result); | 53 | bool GetUserAppData(ref UserAppData props, ref string result); |
52 | bool SetUserAppData(UserAppData props, ref string result); | 54 | bool SetUserAppData(UserAppData props, ref string result); |
53 | OSDArray GetUserImageAssets(UUID avatarId); | 55 | OSDArray GetUserImageAssets(UUID avatarId); |
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs index 4c6c8e3..dca80c3 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs | |||
@@ -897,7 +897,7 @@ namespace OpenSim.Data.MySQL | |||
897 | } | 897 | } |
898 | 898 | ||
899 | #region User Preferences | 899 | #region User Preferences |
900 | public OSDArray GetUserPreferences(UUID avatarId) | 900 | public bool GetUserPreferences(ref UserPreferences pref, ref string result) |
901 | { | 901 | { |
902 | string query = string.Empty; | 902 | string query = string.Empty; |
903 | 903 | ||
@@ -914,19 +914,16 @@ namespace OpenSim.Data.MySQL | |||
914 | dbcon.Open(); | 914 | dbcon.Open(); |
915 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 915 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
916 | { | 916 | { |
917 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 917 | cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString()); |
918 | 918 | ||
919 | using (MySqlDataReader reader = cmd.ExecuteReader()) | 919 | using (MySqlDataReader reader = cmd.ExecuteReader()) |
920 | { | 920 | { |
921 | if(reader.HasRows) | 921 | if(reader.HasRows) |
922 | { | 922 | { |
923 | reader.Read(); | 923 | reader.Read(); |
924 | OSDMap record = new OSDMap(); | 924 | bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); |
925 | 925 | bool.TryParse((string)reader["visible"], out pref.Visible); | |
926 | record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"])); | 926 | pref.EMail = (string)reader["email"]; |
927 | record.Add("visible",OSD.FromString((string)reader["visible"])); | ||
928 | record.Add("email",OSD.FromString((string)reader["email"])); | ||
929 | data.Add(record); | ||
930 | } | 927 | } |
931 | else | 928 | else |
932 | { | 929 | { |
@@ -949,17 +946,19 @@ namespace OpenSim.Data.MySQL | |||
949 | { | 946 | { |
950 | m_log.DebugFormat("[PROFILES_DATA]" + | 947 | m_log.DebugFormat("[PROFILES_DATA]" + |
951 | ": Get preferences exception {0}", e.Message); | 948 | ": Get preferences exception {0}", e.Message); |
949 | result = e.Message; | ||
950 | return false; | ||
952 | } | 951 | } |
953 | return data; | 952 | return true; |
954 | } | 953 | } |
955 | 954 | ||
956 | public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId ) | 955 | public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) |
957 | { | 956 | { |
958 | string query = string.Empty; | 957 | string query = string.Empty; |
959 | 958 | ||
960 | query += "UPDATE userpsettings SET "; | 959 | query += "UPDATE usersettings SET "; |
961 | query += "imviaemail=?ImViaEmail, "; | 960 | query += "imviaemail=?ImViaEmail, "; |
962 | query += "visible=?Visible,"; | 961 | query += "visible=?Visible "; |
963 | query += "WHERE useruuid=?uuid"; | 962 | query += "WHERE useruuid=?uuid"; |
964 | 963 | ||
965 | try | 964 | try |
@@ -969,14 +968,11 @@ namespace OpenSim.Data.MySQL | |||
969 | dbcon.Open(); | 968 | dbcon.Open(); |
970 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 969 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
971 | { | 970 | { |
972 | cmd.Parameters.AddWithValue("?ImViaEmail", emailIm.ToString().ToLower ()); | 971 | cmd.Parameters.AddWithValue("?ImViaEmail", pref.IMViaEmail); |
973 | cmd.Parameters.AddWithValue("?WantText", visible.ToString().ToLower ()); | 972 | cmd.Parameters.AddWithValue("?Visible", pref.Visible); |
974 | cmd.Parameters.AddWithValue("?uuid", avatarId.ToString()); | 973 | cmd.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); |
975 | 974 | ||
976 | lock(Lock) | 975 | cmd.ExecuteNonQuery(); |
977 | { | ||
978 | cmd.ExecuteNonQuery(); | ||
979 | } | ||
980 | } | 976 | } |
981 | } | 977 | } |
982 | } | 978 | } |
@@ -984,6 +980,7 @@ namespace OpenSim.Data.MySQL | |||
984 | { | 980 | { |
985 | m_log.DebugFormat("[PROFILES_DATA]" + | 981 | m_log.DebugFormat("[PROFILES_DATA]" + |
986 | ": AgentInterestsUpdate exception {0}", e.Message); | 982 | ": AgentInterestsUpdate exception {0}", e.Message); |
983 | result = e.Message; | ||
987 | return false; | 984 | return false; |
988 | } | 985 | } |
989 | return true; | 986 | return true; |
diff --git a/OpenSim/Data/MySQL/Resources/UserProfiles.migrations b/OpenSim/Data/MySQL/Resources/UserProfiles.migrations index c29f1ab..bd325da 100644 --- a/OpenSim/Data/MySQL/Resources/UserProfiles.migrations +++ b/OpenSim/Data/MySQL/Resources/UserProfiles.migrations | |||
@@ -81,3 +81,13 @@ CREATE TABLE IF NOT EXISTS `userdata` ( | |||
81 | 81 | ||
82 | commit; | 82 | commit; |
83 | 83 | ||
84 | :VERSION 3 # ------------------------------- | ||
85 | begin; | ||
86 | CREATE 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; | ||
93 | commit; \ No newline at end of file | ||
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..70ce07c 100644 --- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs | |||
@@ -749,6 +749,89 @@ namespace OpenSim.Data.SQLite | |||
749 | } | 749 | } |
750 | return true; | 750 | return true; |
751 | } | 751 | } |
752 | |||
753 | public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) | ||
754 | { | ||
755 | string query = string.Empty; | ||
756 | |||
757 | query += "UPDATE usersettings SET "; | ||
758 | query += "imviaemail=:ImViaEmail, "; | ||
759 | query += "visible=:Visible "; | ||
760 | query += "WHERE useruuid=:uuid"; | ||
761 | |||
762 | try | ||
763 | { | ||
764 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
765 | { | ||
766 | cmd.CommandText = query; | ||
767 | cmd.Parameters.AddWithValue(":ImViaEmail", pref.IMViaEmail); | ||
768 | cmd.Parameters.AddWithValue(":Visible", pref.Visible); | ||
769 | cmd.Parameters.AddWithValue(":uuid", pref.UserId.ToString()); | ||
770 | |||
771 | cmd.ExecuteNonQuery(); | ||
772 | } | ||
773 | } | ||
774 | catch (Exception e) | ||
775 | { | ||
776 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
777 | ": AgentInterestsUpdate exception {0}", e.Message); | ||
778 | result = e.Message; | ||
779 | return false; | ||
780 | } | ||
781 | return true; | ||
782 | } | ||
783 | |||
784 | public bool GetUserPreferences(ref UserPreferences pref, ref string result) | ||
785 | { | ||
786 | IDataReader reader = null; | ||
787 | string query = string.Empty; | ||
788 | |||
789 | query += "SELECT imviaemail,visible,email FROM "; | ||
790 | query += "usersettings WHERE "; | ||
791 | query += "useruuid = :Id"; | ||
792 | |||
793 | OSDArray data = new OSDArray(); | ||
794 | |||
795 | try | ||
796 | { | ||
797 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
798 | { | ||
799 | cmd.CommandText = query; | ||
800 | cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString()); | ||
801 | |||
802 | using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | ||
803 | { | ||
804 | if(reader.Read()) | ||
805 | { | ||
806 | bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); | ||
807 | bool.TryParse((string)reader["visible"], out pref.Visible); | ||
808 | pref.EMail = (string)reader["email"]; | ||
809 | } | ||
810 | else | ||
811 | { | ||
812 | query = "INSERT INTO usersettings VALUES "; | ||
813 | query += "(:Id,'false','false', '')"; | ||
814 | |||
815 | using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand()) | ||
816 | { | ||
817 | put.Parameters.AddWithValue(":Id", pref.UserId.ToString()); | ||
818 | put.ExecuteNonQuery(); | ||
819 | |||
820 | } | ||
821 | } | ||
822 | } | ||
823 | } | ||
824 | } | ||
825 | catch (Exception e) | ||
826 | { | ||
827 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
828 | ": Get preferences exception {0}", e.Message); | ||
829 | result = e.Message; | ||
830 | return false; | ||
831 | } | ||
832 | return true; | ||
833 | } | ||
834 | |||
752 | public bool GetUserAppData(ref UserAppData props, ref string result) | 835 | public bool GetUserAppData(ref UserAppData props, ref string result) |
753 | { | 836 | { |
754 | IDataReader reader = null; | 837 | IDataReader reader = null; |
diff --git a/OpenSim/Framework/UserProfiles.cs b/OpenSim/Framework/UserProfiles.cs index 6133591..492f6b9 100644 --- a/OpenSim/Framework/UserProfiles.cs +++ b/OpenSim/Framework/UserProfiles.cs | |||
@@ -90,6 +90,14 @@ namespace OpenSim.Framework | |||
90 | public UUID TargetId; | 90 | public UUID TargetId; |
91 | public string Notes; | 91 | public string Notes; |
92 | } | 92 | } |
93 | |||
94 | public class UserPreferences | ||
95 | { | ||
96 | public UUID UserId; | ||
97 | public bool IMViaEmail = false; | ||
98 | public bool Visible = false; | ||
99 | public string EMail = string.Empty; | ||
100 | } | ||
93 | 101 | ||
94 | public class UserAccountProperties | 102 | public class UserAccountProperties |
95 | { | 103 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 966a05c..697a73e 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | |||
@@ -270,6 +270,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
270 | // Notes | 270 | // Notes |
271 | client.AddGenericPacketHandler("avatarnotesrequest", NotesRequest); | 271 | client.AddGenericPacketHandler("avatarnotesrequest", NotesRequest); |
272 | client.OnAvatarNotesUpdate += NotesUpdate; | 272 | client.OnAvatarNotesUpdate += NotesUpdate; |
273 | |||
274 | // Preferences | ||
275 | client.OnUserInfoRequest += UserPreferencesRequest; | ||
276 | client.OnUpdateUserInfo += UpdateUserPreferences; | ||
273 | } | 277 | } |
274 | #endregion Region Event Handlers | 278 | #endregion Region Event Handlers |
275 | 279 | ||
@@ -802,6 +806,69 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
802 | } | 806 | } |
803 | #endregion Notes | 807 | #endregion Notes |
804 | 808 | ||
809 | #region User Preferences | ||
810 | /// <summary> | ||
811 | /// Updates the user preferences. | ||
812 | /// </summary> | ||
813 | /// <param name='imViaEmail'> | ||
814 | /// Im via email. | ||
815 | /// </param> | ||
816 | /// <param name='visible'> | ||
817 | /// Visible. | ||
818 | /// </param> | ||
819 | /// <param name='remoteClient'> | ||
820 | /// Remote client. | ||
821 | /// </param> | ||
822 | public void UpdateUserPreferences(bool imViaEmail, bool visible, IClientAPI remoteClient) | ||
823 | { | ||
824 | UserPreferences pref = new UserPreferences(); | ||
825 | |||
826 | pref.UserId = remoteClient.AgentId; | ||
827 | pref.IMViaEmail = imViaEmail; | ||
828 | pref.Visible = visible; | ||
829 | |||
830 | string serverURI = string.Empty; | ||
831 | bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); | ||
832 | |||
833 | object Pref = pref; | ||
834 | if(!JsonRpcRequest(ref Pref, "user_preferences_update", serverURI, UUID.Random().ToString())) | ||
835 | { | ||
836 | m_log.InfoFormat("[PROFILES]: UserPreferences update error"); | ||
837 | remoteClient.SendAgentAlertMessage("Error updating preferences", false); | ||
838 | return; | ||
839 | } | ||
840 | } | ||
841 | |||
842 | /// <summary> | ||
843 | /// Users the preferences request. | ||
844 | /// </summary> | ||
845 | /// <param name='remoteClient'> | ||
846 | /// Remote client. | ||
847 | /// </param> | ||
848 | public void UserPreferencesRequest(IClientAPI remoteClient) | ||
849 | { | ||
850 | UserPreferences pref = new UserPreferences(); | ||
851 | |||
852 | pref.UserId = remoteClient.AgentId; | ||
853 | |||
854 | string serverURI = string.Empty; | ||
855 | bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); | ||
856 | |||
857 | |||
858 | object Pref = (object)pref; | ||
859 | if(!JsonRpcRequest(ref Pref, "user_preferences_request", serverURI, UUID.Random().ToString())) | ||
860 | { | ||
861 | m_log.InfoFormat("[PROFILES]: UserPreferences request error"); | ||
862 | remoteClient.SendAgentAlertMessage("Error requesting preferences", false); | ||
863 | return; | ||
864 | } | ||
865 | pref = (UserPreferences) Pref; | ||
866 | |||
867 | remoteClient.SendUserInfoReply(pref.IMViaEmail, pref.Visible, pref.EMail); | ||
868 | |||
869 | } | ||
870 | #endregion User Preferences | ||
871 | |||
805 | #region Avatar Properties | 872 | #region Avatar Properties |
806 | /// <summary> | 873 | /// <summary> |
807 | /// Update the avatars interests . | 874 | /// Update the avatars interests . |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs index 323535a..4701ee6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs | |||
@@ -153,6 +153,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile | |||
153 | Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest); | 153 | Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest); |
154 | Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); | 154 | Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); |
155 | Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); | 155 | Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); |
156 | Server.AddJsonRPCHandler("user_preferences_update", handler.UserPreferenecesUpdate); | ||
157 | Server.AddJsonRPCHandler("user_preferences_request", handler.UserPreferencesRequest); | ||
156 | Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest); | 158 | Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest); |
157 | Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); | 159 | Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); |
158 | Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); | 160 | Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); |
diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs index 28dbbc2..6403882 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs | |||
@@ -104,6 +104,8 @@ namespace OpenSim.Server.Handlers.Profiles | |||
104 | Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest); | 104 | Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest); |
105 | Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); | 105 | Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); |
106 | Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); | 106 | Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); |
107 | Server.AddJsonRPCHandler("user_preferences_update", handler.UserPreferenecesUpdate); | ||
108 | Server.AddJsonRPCHandler("user_preferences_request", handler.UserPreferencesRequest); | ||
107 | Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest); | 109 | Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest); |
108 | Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); | 110 | Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); |
109 | Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); | 111 | Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); |
diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs index f5f0794..d30cc22 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs | |||
@@ -381,6 +381,59 @@ namespace OpenSim.Server.Handlers | |||
381 | } | 381 | } |
382 | #endregion Interests | 382 | #endregion Interests |
383 | 383 | ||
384 | #region User Preferences | ||
385 | public bool UserPreferencesRequest(OSDMap json, ref JsonRpcResponse response) | ||
386 | { | ||
387 | if(!json.ContainsKey("params")) | ||
388 | { | ||
389 | response.Error.Code = ErrorCode.ParseError; | ||
390 | m_log.DebugFormat ("User Preferences Request"); | ||
391 | return false; | ||
392 | } | ||
393 | |||
394 | string result = string.Empty; | ||
395 | UserPreferences prefs = new UserPreferences(); | ||
396 | object Prefs = (object)prefs; | ||
397 | OSD.DeserializeMembers(ref Prefs, (OSDMap)json["params"]); | ||
398 | if(Service.UserPreferencesRequest(ref prefs, ref result)) | ||
399 | { | ||
400 | response.Result = OSD.SerializeMembers(prefs); | ||
401 | return true; | ||
402 | } | ||
403 | |||
404 | response.Error.Code = ErrorCode.InternalError; | ||
405 | response.Error.Message = string.Format("{0}", result); | ||
406 | m_log.InfoFormat("[PROFILES]: User preferences request error - {0}", response.Error.Message); | ||
407 | return false; | ||
408 | } | ||
409 | |||
410 | public bool UserPreferenecesUpdate(OSDMap json, ref JsonRpcResponse response) | ||
411 | { | ||
412 | if(!json.ContainsKey("params")) | ||
413 | { | ||
414 | response.Error.Code = ErrorCode.ParseError; | ||
415 | response.Error.Message = "no parameters supplied"; | ||
416 | m_log.DebugFormat ("User Preferences Update Request"); | ||
417 | return false; | ||
418 | } | ||
419 | |||
420 | string result = string.Empty; | ||
421 | UserPreferences prefs = new UserPreferences(); | ||
422 | object Prefs = (object)prefs; | ||
423 | OSD.DeserializeMembers(ref Prefs, (OSDMap)json["params"]); | ||
424 | if(Service.UserPreferencesUpdate(ref prefs, ref result)) | ||
425 | { | ||
426 | response.Result = OSD.SerializeMembers(prefs); | ||
427 | return true; | ||
428 | } | ||
429 | |||
430 | response.Error.Code = ErrorCode.InternalError; | ||
431 | response.Error.Message = string.Format("{0}", result); | ||
432 | m_log.InfoFormat("[PROFILES]: User preferences update error - {0}", response.Error.Message); | ||
433 | return false; | ||
434 | } | ||
435 | #endregion User Preferences | ||
436 | |||
384 | #region Utility | 437 | #region Utility |
385 | public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response) | 438 | public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response) |
386 | { | 439 | { |
diff --git a/OpenSim/Services/Interfaces/IUserProfilesService.cs b/OpenSim/Services/Interfaces/IUserProfilesService.cs index 319d307..121baa8 100644 --- a/OpenSim/Services/Interfaces/IUserProfilesService.cs +++ b/OpenSim/Services/Interfaces/IUserProfilesService.cs | |||
@@ -57,6 +57,11 @@ namespace OpenSim.Services.Interfaces | |||
57 | bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result); | 57 | bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result); |
58 | bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result); | 58 | bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result); |
59 | #endregion Profile Properties | 59 | #endregion Profile Properties |
60 | |||
61 | #region User Preferences | ||
62 | bool UserPreferencesRequest(ref UserPreferences pref, ref string result); | ||
63 | bool UserPreferencesUpdate(ref UserPreferences pref, ref string result); | ||
64 | #endregion User Preferences | ||
60 | 65 | ||
61 | #region Interests | 66 | #region Interests |
62 | bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result); | 67 | bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result); |
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs index d00f34d..69c7b91 100644 --- a/OpenSim/Services/UserProfilesService/UserProfilesService.cs +++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs | |||
@@ -163,6 +163,18 @@ namespace OpenSim.Services.ProfilesService | |||
163 | } | 163 | } |
164 | #endregion Interests | 164 | #endregion Interests |
165 | 165 | ||
166 | #region User Preferences | ||
167 | public bool UserPreferencesUpdate(ref UserPreferences pref, ref string result) | ||
168 | { | ||
169 | return ProfilesData.UpdateUserPreferences(ref pref, ref result); | ||
170 | } | ||
171 | |||
172 | public bool UserPreferencesRequest(ref UserPreferences pref, ref string result) | ||
173 | { | ||
174 | return ProfilesData.GetUserPreferences(ref pref, ref result); | ||
175 | } | ||
176 | #endregion User Preferences | ||
177 | |||
166 | #region Utility | 178 | #region Utility |
167 | public OSD AvatarImageAssetsRequest(UUID avatarId) | 179 | public OSD AvatarImageAssetsRequest(UUID avatarId) |
168 | { | 180 | { |