From 1842388bb4dcf5ecd57732ffa877b6ca1a3dec7b Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 6 Dec 2013 02:52:13 -0500 Subject: Add support for user preferences (im via email) --- .../Avatar/UserProfiles/UserProfileModule.cs | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar/UserProfiles') 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 // Notes client.AddGenericPacketHandler("avatarnotesrequest", NotesRequest); client.OnAvatarNotesUpdate += NotesUpdate; + + // Preferences + client.OnUserInfoRequest += UserPreferencesRequest; + client.OnUpdateUserInfo += UpdateUserPreferences; } #endregion Region Event Handlers @@ -799,6 +803,69 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles } #endregion Notes + #region User Preferences + /// <summary> + /// Updates the user preferences. + /// </summary> + /// <param name='imViaEmail'> + /// Im via email. + /// </param> + /// <param name='visible'> + /// Visible. + /// </param> + /// <param name='remoteClient'> + /// Remote client. + /// </param> + public void UpdateUserPreferences(bool imViaEmail, bool visible, IClientAPI remoteClient) + { + UserPreferences pref = new UserPreferences(); + + pref.UserId = remoteClient.AgentId; + pref.IMViaEmail = imViaEmail; + pref.Visible = visible; + + string serverURI = string.Empty; + bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); + + object Pref = pref; + if(!JsonRpcRequest(ref Pref, "user_preferences_update", serverURI, UUID.Random().ToString())) + { + m_log.InfoFormat("[PROFILES]: UserPreferences update error"); + remoteClient.SendAgentAlertMessage("Error updating preferences", false); + return; + } + } + + /// <summary> + /// Users the preferences request. + /// </summary> + /// <param name='remoteClient'> + /// Remote client. + /// </param> + public void UserPreferencesRequest(IClientAPI remoteClient) + { + UserPreferences pref = new UserPreferences(); + + pref.UserId = remoteClient.AgentId; + + string serverURI = string.Empty; + bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); + + + object Pref = (object)pref; + if(!JsonRpcRequest(ref Pref, "user_preferences_request", serverURI, UUID.Random().ToString())) + { + m_log.InfoFormat("[PROFILES]: UserPreferences request error"); + remoteClient.SendAgentAlertMessage("Error requesting preferences", false); + return; + } + pref = (UserPreferences) Pref; + + remoteClient.SendUserInfoReply(pref.IMViaEmail, pref.Visible, pref.EMail); + + } + #endregion User Preferences + #region Avatar Properties /// <summary> /// Update the avatars interests . -- cgit v1.1 From 141d771a931140402cfa0575cf31e7116540f7d0 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 16 Dec 2013 15:43:34 -0500 Subject: Fix issue with editing notes for other avatars --- OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar/UserProfiles') diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index b21082f..bfa30e6 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -758,8 +758,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles IClientAPI remoteClient = (IClientAPI)sender; string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); - note.TargetId = remoteClient.AgentId; - UUID.TryParse(args[0], out note.UserId); + note.UserId = remoteClient.AgentId; + UUID.TryParse(args[0], out note.TargetId); object Note = (object)note; if(!JsonRpcRequest(ref Note, "avatarnotesrequest", serverURI, UUID.Random().ToString())) -- cgit v1.1