From 5745aa0f865542b3cfdb0c656bd440dc7c2614b7 Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Fri, 6 Dec 2013 02:52:13 -0500
Subject: Backport profile fixes
---
.../Avatar/UserProfiles/UserProfileModule.cs | 67 ++++++++++++++++++++++
.../LocalUserProfilesServiceConnector.cs | 2 +
2 files changed, 69 insertions(+)
(limited to 'OpenSim/Region')
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
// Notes
client.AddGenericPacketHandler("avatarnotesrequest", NotesRequest);
client.OnAvatarNotesUpdate += NotesUpdate;
+
+ // Preferences
+ client.OnUserInfoRequest += UserPreferencesRequest;
+ client.OnUpdateUserInfo += UpdateUserPreferences;
}
#endregion Region Event Handlers
@@ -802,6 +806,69 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
}
#endregion Notes
+ #region User Preferences
+ ///
+ /// Updates the user preferences.
+ ///
+ ///
+ /// Im via email.
+ ///
+ ///
+ /// Visible.
+ ///
+ ///
+ /// Remote client.
+ ///
+ 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;
+ }
+ }
+
+ ///
+ /// Users the preferences request.
+ ///
+ ///
+ /// Remote client.
+ ///
+ 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
///
/// 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
Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest);
Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate);
Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate);
+ Server.AddJsonRPCHandler("user_preferences_update", handler.UserPreferenecesUpdate);
+ Server.AddJsonRPCHandler("user_preferences_request", handler.UserPreferencesRequest);
Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest);
Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData);
Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData);
--
cgit v1.1