diff options
author | BlueWall | 2013-12-06 02:52:13 -0500 |
---|---|---|
committer | BlueWall | 2013-12-06 02:52:13 -0500 |
commit | 1842388bb4dcf5ecd57732ffa877b6ca1a3dec7b (patch) | |
tree | 0d1feaac1a3ae79aa11cc435553f086a3d581581 /OpenSim/Region/CoreModules/Avatar | |
parent | Adding profile partners fix to SQLite and PgSQL drivers (diff) | |
download | opensim-SC_OLD-1842388bb4dcf5ecd57732ffa877b6ca1a3dec7b.zip opensim-SC_OLD-1842388bb4dcf5ecd57732ffa877b6ca1a3dec7b.tar.gz opensim-SC_OLD-1842388bb4dcf5ecd57732ffa877b6ca1a3dec7b.tar.bz2 opensim-SC_OLD-1842388bb4dcf5ecd57732ffa877b6ca1a3dec7b.tar.xz |
Add support for user preferences (im via email)
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 56ff2bd..b21082f 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 | ||
@@ -799,6 +803,69 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
799 | } | 803 | } |
800 | #endregion Notes | 804 | #endregion Notes |
801 | 805 | ||
806 | #region User Preferences | ||
807 | /// <summary> | ||
808 | /// Updates the user preferences. | ||
809 | /// </summary> | ||
810 | /// <param name='imViaEmail'> | ||
811 | /// Im via email. | ||
812 | /// </param> | ||
813 | /// <param name='visible'> | ||
814 | /// Visible. | ||
815 | /// </param> | ||
816 | /// <param name='remoteClient'> | ||
817 | /// Remote client. | ||
818 | /// </param> | ||
819 | public void UpdateUserPreferences(bool imViaEmail, bool visible, IClientAPI remoteClient) | ||
820 | { | ||
821 | UserPreferences pref = new UserPreferences(); | ||
822 | |||
823 | pref.UserId = remoteClient.AgentId; | ||
824 | pref.IMViaEmail = imViaEmail; | ||
825 | pref.Visible = visible; | ||
826 | |||
827 | string serverURI = string.Empty; | ||
828 | bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); | ||
829 | |||
830 | object Pref = pref; | ||
831 | if(!JsonRpcRequest(ref Pref, "user_preferences_update", serverURI, UUID.Random().ToString())) | ||
832 | { | ||
833 | m_log.InfoFormat("[PROFILES]: UserPreferences update error"); | ||
834 | remoteClient.SendAgentAlertMessage("Error updating preferences", false); | ||
835 | return; | ||
836 | } | ||
837 | } | ||
838 | |||
839 | /// <summary> | ||
840 | /// Users the preferences request. | ||
841 | /// </summary> | ||
842 | /// <param name='remoteClient'> | ||
843 | /// Remote client. | ||
844 | /// </param> | ||
845 | public void UserPreferencesRequest(IClientAPI remoteClient) | ||
846 | { | ||
847 | UserPreferences pref = new UserPreferences(); | ||
848 | |||
849 | pref.UserId = remoteClient.AgentId; | ||
850 | |||
851 | string serverURI = string.Empty; | ||
852 | bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); | ||
853 | |||
854 | |||
855 | object Pref = (object)pref; | ||
856 | if(!JsonRpcRequest(ref Pref, "user_preferences_request", serverURI, UUID.Random().ToString())) | ||
857 | { | ||
858 | m_log.InfoFormat("[PROFILES]: UserPreferences request error"); | ||
859 | remoteClient.SendAgentAlertMessage("Error requesting preferences", false); | ||
860 | return; | ||
861 | } | ||
862 | pref = (UserPreferences) Pref; | ||
863 | |||
864 | remoteClient.SendUserInfoReply(pref.IMViaEmail, pref.Visible, pref.EMail); | ||
865 | |||
866 | } | ||
867 | #endregion User Preferences | ||
868 | |||
802 | #region Avatar Properties | 869 | #region Avatar Properties |
803 | /// <summary> | 870 | /// <summary> |
804 | /// Update the avatars interests . | 871 | /// Update the avatars interests . |