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 ++++++++++++++++++++++
.../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 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
+ ///
+ /// 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
From 1496de7ce99079d3d7bf046db088c3d6e2a97bcb Mon Sep 17 00:00:00 2001
From: dahlia
Date: Fri, 6 Dec 2013 15:58:19 -0800
Subject: use System.IO.Compression.DeflateStream for mesh decompression in an
attempt to reduce mesh asset decoding failures
---
OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 1f08b03..e313a30 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -40,7 +40,6 @@ using log4net;
using Nini.Config;
using System.Reflection;
using System.IO;
-using ComponentAce.Compression.Libs.zlib;
namespace OpenSim.Region.Physics.Meshing
{
@@ -549,7 +548,6 @@ namespace OpenSim.Region.Physics.Meshing
return true;
}
-
///
/// decompresses a gzipped OSD object
///
@@ -564,15 +562,13 @@ namespace OpenSim.Region.Physics.Meshing
{
using (MemoryStream outMs = new MemoryStream())
{
- using (ZOutputStream zOut = new ZOutputStream(outMs))
+ using (DeflateStream decompressionStream = new DeflateStream(inMs, CompressionMode.Decompress))
{
byte[] readBuffer = new byte[2048];
- int readLen = 0;
- while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0)
- {
- zOut.Write(readBuffer, 0, readLen);
- }
- zOut.Flush();
+ inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header
+
+ decompressionStream.CopyTo(outMs);
+
outMs.Seek(0, SeekOrigin.Begin);
byte[] decompressedBuf = outMs.GetBuffer();
--
cgit v1.1
From c0380d1bfe596afe33659cc69ae99a09018f9908 Mon Sep 17 00:00:00 2001
From: dahlia
Date: Fri, 6 Dec 2013 16:24:44 -0800
Subject: apparently mono DeflateStream has no CopyTo method =(
---
OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index e313a30..d96de4a 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -566,8 +566,12 @@ namespace OpenSim.Region.Physics.Meshing
{
byte[] readBuffer = new byte[2048];
inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header
+ int readLen = 0;
- decompressionStream.CopyTo(outMs);
+ while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0)
+ outMs.Write(readBuffer, 0, readLen);
+
+ outMs.Flush();
outMs.Seek(0, SeekOrigin.Begin);
--
cgit v1.1