Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

master-beforevarregion
Diva Canto 2013-12-06 16:02:03 -08:00
commit 5047bd7b44
18 changed files with 314 additions and 60 deletions

View File

@ -48,6 +48,8 @@ namespace OpenSim.Data
bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result); bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result);
bool UpdateAvatarInterests(UserProfileProperties up, ref string result); bool UpdateAvatarInterests(UserProfileProperties up, ref string result);
bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result); bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result);
bool UpdateUserPreferences(ref UserPreferences pref, ref string result);
bool GetUserPreferences(ref UserPreferences pref, ref string result);
bool GetUserAppData(ref UserAppData props, ref string result); bool GetUserAppData(ref UserAppData props, ref string result);
bool SetUserAppData(UserAppData props, ref string result); bool SetUserAppData(UserAppData props, ref string result);
OSDArray GetUserImageAssets(UUID avatarId); OSDArray GetUserImageAssets(UUID avatarId);

View File

@ -736,7 +736,6 @@ namespace OpenSim.Data.MySQL
string query = string.Empty; string query = string.Empty;
query += "UPDATE userprofile SET "; query += "UPDATE userprofile SET ";
query += "profilePartner=?profilePartner, ";
query += "profileURL=?profileURL, "; query += "profileURL=?profileURL, ";
query += "profileImage=?image, "; query += "profileImage=?image, ";
query += "profileAboutText=?abouttext,"; query += "profileAboutText=?abouttext,";
@ -752,7 +751,6 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{ {
cmd.Parameters.AddWithValue("?profileURL", props.WebUrl); cmd.Parameters.AddWithValue("?profileURL", props.WebUrl);
cmd.Parameters.AddWithValue("?profilePartner", props.PartnerId.ToString());
cmd.Parameters.AddWithValue("?image", props.ImageId.ToString()); cmd.Parameters.AddWithValue("?image", props.ImageId.ToString());
cmd.Parameters.AddWithValue("?abouttext", props.AboutText); cmd.Parameters.AddWithValue("?abouttext", props.AboutText);
cmd.Parameters.AddWithValue("?firstlifeimage", props.FirstLifeImageId.ToString()); cmd.Parameters.AddWithValue("?firstlifeimage", props.FirstLifeImageId.ToString());
@ -897,7 +895,7 @@ namespace OpenSim.Data.MySQL
} }
#region User Preferences #region User Preferences
public OSDArray GetUserPreferences(UUID avatarId) public bool GetUserPreferences(ref UserPreferences pref, ref string result)
{ {
string query = string.Empty; string query = string.Empty;
@ -914,19 +912,16 @@ namespace OpenSim.Data.MySQL
dbcon.Open(); dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{ {
cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());
using (MySqlDataReader reader = cmd.ExecuteReader()) using (MySqlDataReader reader = cmd.ExecuteReader())
{ {
if(reader.HasRows) if(reader.HasRows)
{ {
reader.Read(); reader.Read();
OSDMap record = new OSDMap(); bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
bool.TryParse((string)reader["visible"], out pref.Visible);
record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"])); pref.EMail = (string)reader["email"];
record.Add("visible",OSD.FromString((string)reader["visible"]));
record.Add("email",OSD.FromString((string)reader["email"]));
data.Add(record);
} }
else else
{ {
@ -949,17 +944,19 @@ namespace OpenSim.Data.MySQL
{ {
m_log.DebugFormat("[PROFILES_DATA]" + m_log.DebugFormat("[PROFILES_DATA]" +
": Get preferences exception {0}", e.Message); ": Get preferences exception {0}", e.Message);
result = e.Message;
return false;
} }
return data; return true;
} }
public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId ) public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
{ {
string query = string.Empty; string query = string.Empty;
query += "UPDATE userpsettings SET "; query += "UPDATE usersettings SET ";
query += "imviaemail=?ImViaEmail, "; query += "imviaemail=?ImViaEmail, ";
query += "visible=?Visible,"; query += "visible=?Visible ";
query += "WHERE useruuid=?uuid"; query += "WHERE useruuid=?uuid";
try try
@ -969,14 +966,11 @@ namespace OpenSim.Data.MySQL
dbcon.Open(); dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{ {
cmd.Parameters.AddWithValue("?ImViaEmail", emailIm.ToString().ToLower ()); cmd.Parameters.AddWithValue("?ImViaEmail", pref.IMViaEmail);
cmd.Parameters.AddWithValue("?WantText", visible.ToString().ToLower ()); cmd.Parameters.AddWithValue("?Visible", pref.Visible);
cmd.Parameters.AddWithValue("?uuid", avatarId.ToString()); cmd.Parameters.AddWithValue("?uuid", pref.UserId.ToString());
lock(Lock) cmd.ExecuteNonQuery();
{
cmd.ExecuteNonQuery();
}
} }
} }
} }
@ -984,6 +978,7 @@ namespace OpenSim.Data.MySQL
{ {
m_log.DebugFormat("[PROFILES_DATA]" + m_log.DebugFormat("[PROFILES_DATA]" +
": AgentInterestsUpdate exception {0}", e.Message); ": AgentInterestsUpdate exception {0}", e.Message);
result = e.Message;
return false; return false;
} }
return true; return true;

View File

@ -81,3 +81,13 @@ CREATE TABLE IF NOT EXISTS `userdata` (
commit; commit;
:VERSION 3 # -------------------------------
begin;
CREATE TABLE IF NOT EXISTS `usersettings` (
`useruuid` varchar(36) NOT NULL,
`imviaemail` enum('true','false') NOT NULL,
`visible` enum('true','false') NOT NULL,
`email` varchar(254) NOT NULL,
PRIMARY KEY (`useruuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
commit;

View File

@ -206,7 +206,7 @@ namespace OpenSim.Data.PGSQL
DataTable schemaTable = result.GetSchemaTable(); DataTable schemaTable = result.GetSchemaTable();
foreach (DataRow row in schemaTable.Rows) foreach (DataRow row in schemaTable.Rows)
m_ColumnNames.Add(row["column_name"].ToString()); m_ColumnNames.Add(row["ColumnName"].ToString());
} }
foreach (string s in m_ColumnNames) foreach (string s in m_ColumnNames)

View File

@ -715,7 +715,6 @@ namespace OpenSim.Data.PGSQL
string query = string.Empty; string query = string.Empty;
query += "UPDATE userprofile SET "; query += "UPDATE userprofile SET ";
query += "profilePartner=:profilePartner, ";
query += "profileURL=:profileURL, "; query += "profileURL=:profileURL, ";
query += "profileImage=:image, "; query += "profileImage=:image, ";
query += "profileAboutText=:abouttext,"; query += "profileAboutText=:abouttext,";
@ -731,7 +730,6 @@ namespace OpenSim.Data.PGSQL
using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
{ {
cmd.Parameters.AddWithValue("profileURL", props.WebUrl); cmd.Parameters.AddWithValue("profileURL", props.WebUrl);
cmd.Parameters.AddWithValue("profilePartner", props.PartnerId.ToString());
cmd.Parameters.AddWithValue("image", props.ImageId.ToString()); cmd.Parameters.AddWithValue("image", props.ImageId.ToString());
cmd.Parameters.AddWithValue("abouttext", props.AboutText); cmd.Parameters.AddWithValue("abouttext", props.AboutText);
cmd.Parameters.AddWithValue("firstlifeimage", props.FirstLifeImageId.ToString()); cmd.Parameters.AddWithValue("firstlifeimage", props.FirstLifeImageId.ToString());
@ -876,7 +874,7 @@ namespace OpenSim.Data.PGSQL
} }
#region User Preferences #region User Preferences
public OSDArray GetUserPreferences(UUID avatarId) public bool GetUserPreferences(ref UserPreferences pref, ref string result)
{ {
string query = string.Empty; string query = string.Empty;
@ -893,19 +891,16 @@ namespace OpenSim.Data.PGSQL
dbcon.Open(); dbcon.Open();
using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
{ {
cmd.Parameters.AddWithValue("Id", avatarId.ToString()); cmd.Parameters.AddWithValue("Id", pref.UserId.ToString());
using (NpgsqlDataReader reader = cmd.ExecuteReader()) using (NpgsqlDataReader reader = cmd.ExecuteReader())
{ {
if(reader.HasRows) if(reader.HasRows)
{ {
reader.Read(); reader.Read();
OSDMap record = new OSDMap(); bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
bool.TryParse((string)reader["visible"], out pref.Visible);
record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"])); pref.EMail = (string)reader["email"];
record.Add("visible",OSD.FromString((string)reader["visible"]));
record.Add("email",OSD.FromString((string)reader["email"]));
data.Add(record);
} }
else else
{ {
@ -928,15 +923,16 @@ namespace OpenSim.Data.PGSQL
{ {
m_log.DebugFormat("[PROFILES_DATA]" + m_log.DebugFormat("[PROFILES_DATA]" +
": Get preferences exception {0}", e.Message); ": Get preferences exception {0}", e.Message);
result = e.Message;
} }
return data; return true;
} }
public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId ) public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
{ {
string query = string.Empty; string query = string.Empty;
query += "UPDATE userpsettings SET "; query += "UPDATE usersettings SET ";
query += "imviaemail=:ImViaEmail, "; query += "imviaemail=:ImViaEmail, ";
query += "visible=:Visible,"; query += "visible=:Visible,";
query += "WHERE useruuid=:uuid"; query += "WHERE useruuid=:uuid";
@ -948,9 +944,9 @@ namespace OpenSim.Data.PGSQL
dbcon.Open(); dbcon.Open();
using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
{ {
cmd.Parameters.AddWithValue("ImViaEmail", emailIm.ToString().ToLower ()); cmd.Parameters.AddWithValue("ImViaEmail", pref.IMViaEmail.ToString().ToLower ());
cmd.Parameters.AddWithValue("WantText", visible.ToString().ToLower ()); cmd.Parameters.AddWithValue("Visible", pref.Visible.ToString().ToLower ());
cmd.Parameters.AddWithValue("uuid", avatarId.ToString()); cmd.Parameters.AddWithValue("uuid", pref.UserId.ToString());
lock(Lock) lock(Lock)
{ {
@ -963,6 +959,7 @@ namespace OpenSim.Data.PGSQL
{ {
m_log.DebugFormat("[PROFILES_DATA]" + m_log.DebugFormat("[PROFILES_DATA]" +
": AgentInterestsUpdate exception {0}", e.Message); ": AgentInterestsUpdate exception {0}", e.Message);
result = e.Message;
return false; return false;
} }
return true; return true;

View File

@ -81,3 +81,12 @@ CREATE TABLE userdata (
commit; commit;
:VERSION 3 # -------------------------------
begin;
CREATE TABLE usersettings (
"useruuid" char(36) NOT NULL,
"imviaemail" bytea NOT NULL,
"visible" bytea NOT NULL,
PRIMARY KEY ("useruuid")
);
commit;

View File

@ -88,3 +88,15 @@ CREATE TABLE IF NOT EXISTS userdata (
commit; commit;
:VERSION 3 # -------------------------------
begin;
CREATE TABLE IF NOT EXISTS usersettings (
useruuid char(36) NOT NULL,
imviaemail binary(1) NOT NULL,
visible binary(1) NOT NULL,
email varchar(254) NOT NULL,
PRIMARY KEY (useruuid)
)
commit;

View File

@ -679,7 +679,6 @@ namespace OpenSim.Data.SQLite
string query = string.Empty; string query = string.Empty;
query += "UPDATE userprofile SET "; query += "UPDATE userprofile SET ";
query += "profilePartner=:profilePartner, ";
query += "profileURL=:profileURL, "; query += "profileURL=:profileURL, ";
query += "profileImage=:image, "; query += "profileImage=:image, ";
query += "profileAboutText=:abouttext,"; query += "profileAboutText=:abouttext,";
@ -693,7 +692,6 @@ namespace OpenSim.Data.SQLite
{ {
cmd.CommandText = query; cmd.CommandText = query;
cmd.Parameters.AddWithValue(":profileURL", props.WebUrl); cmd.Parameters.AddWithValue(":profileURL", props.WebUrl);
cmd.Parameters.AddWithValue(":profilePartner", props.PartnerId.ToString());
cmd.Parameters.AddWithValue(":image", props.ImageId.ToString()); cmd.Parameters.AddWithValue(":image", props.ImageId.ToString());
cmd.Parameters.AddWithValue(":abouttext", props.AboutText); cmd.Parameters.AddWithValue(":abouttext", props.AboutText);
cmd.Parameters.AddWithValue(":firstlifeimage", props.FirstLifeImageId.ToString()); cmd.Parameters.AddWithValue(":firstlifeimage", props.FirstLifeImageId.ToString());
@ -749,6 +747,89 @@ namespace OpenSim.Data.SQLite
} }
return true; return true;
} }
public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
{
string query = string.Empty;
query += "UPDATE usersettings SET ";
query += "imviaemail=:ImViaEmail, ";
query += "visible=:Visible ";
query += "WHERE useruuid=:uuid";
try
{
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
{
cmd.CommandText = query;
cmd.Parameters.AddWithValue(":ImViaEmail", pref.IMViaEmail);
cmd.Parameters.AddWithValue(":Visible", pref.Visible);
cmd.Parameters.AddWithValue(":uuid", pref.UserId.ToString());
cmd.ExecuteNonQuery();
}
}
catch (Exception e)
{
m_log.DebugFormat("[PROFILES_DATA]" +
": AgentInterestsUpdate exception {0}", e.Message);
result = e.Message;
return false;
}
return true;
}
public bool GetUserPreferences(ref UserPreferences pref, ref string result)
{
IDataReader reader = null;
string query = string.Empty;
query += "SELECT imviaemail,visible,email FROM ";
query += "usersettings WHERE ";
query += "useruuid = :Id";
OSDArray data = new OSDArray();
try
{
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
{
cmd.CommandText = query;
cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());
using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
if(reader.Read())
{
bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
bool.TryParse((string)reader["visible"], out pref.Visible);
pref.EMail = (string)reader["email"];
}
else
{
query = "INSERT INTO usersettings VALUES ";
query += "(:Id,'false','false', '')";
using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand())
{
put.Parameters.AddWithValue(":Id", pref.UserId.ToString());
put.ExecuteNonQuery();
}
}
}
}
}
catch (Exception e)
{
m_log.DebugFormat("[PROFILES_DATA]" +
": Get preferences exception {0}", e.Message);
result = e.Message;
return false;
}
return true;
}
public bool GetUserAppData(ref UserAppData props, ref string result) public bool GetUserAppData(ref UserAppData props, ref string result)
{ {
IDataReader reader = null; IDataReader reader = null;

View File

@ -90,6 +90,14 @@ namespace OpenSim.Framework
public UUID TargetId; public UUID TargetId;
public string Notes; public string Notes;
} }
public class UserPreferences
{
public UUID UserId;
public bool IMViaEmail = false;
public bool Visible = false;
public string EMail = string.Empty;
}
public class UserAccountProperties public class UserAccountProperties
{ {

View File

@ -498,24 +498,28 @@ namespace OpenSim.Region.ClientStack.Linden
if (inventoryType == "sound") if (inventoryType == "sound")
{ {
inType = 1; inType = (sbyte)InventoryType.Sound;
assType = 1; assType = (sbyte)AssetType.Sound;
}
else if (inventoryType == "snapshot")
{
inType = (sbyte)InventoryType.Snapshot;
} }
else if (inventoryType == "animation") else if (inventoryType == "animation")
{ {
inType = 19; inType = (sbyte)InventoryType.Animation;
assType = 20; assType = (sbyte)AssetType.Animation;
} }
else if (inventoryType == "wearable") else if (inventoryType == "wearable")
{ {
inType = 18; inType = (sbyte)InventoryType.Wearable;
switch (assetType) switch (assetType)
{ {
case "bodypart": case "bodypart":
assType = 13; assType = (sbyte)AssetType.Bodypart;
break; break;
case "clothing": case "clothing":
assType = 5; assType = (sbyte)AssetType.Clothing;
break; break;
} }
} }

View File

@ -270,6 +270,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
// Notes // Notes
client.AddGenericPacketHandler("avatarnotesrequest", NotesRequest); client.AddGenericPacketHandler("avatarnotesrequest", NotesRequest);
client.OnAvatarNotesUpdate += NotesUpdate; client.OnAvatarNotesUpdate += NotesUpdate;
// Preferences
client.OnUserInfoRequest += UserPreferencesRequest;
client.OnUpdateUserInfo += UpdateUserPreferences;
} }
#endregion Region Event Handlers #endregion Region Event Handlers
@ -799,6 +803,69 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
} }
#endregion Notes #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 #region Avatar Properties
/// <summary> /// <summary>
/// Update the avatars interests . /// Update the avatars interests .

View File

@ -153,6 +153,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile
Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest); Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest);
Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate);
Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); 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("image_assets_request", handler.AvatarImageAssetsRequest);
Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData);
Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData);

View File

@ -40,7 +40,6 @@ using log4net;
using Nini.Config; using Nini.Config;
using System.Reflection; using System.Reflection;
using System.IO; using System.IO;
using ComponentAce.Compression.Libs.zlib;
namespace OpenSim.Region.Physics.Meshing namespace OpenSim.Region.Physics.Meshing
{ {
@ -549,7 +548,6 @@ namespace OpenSim.Region.Physics.Meshing
return true; return true;
} }
/// <summary> /// <summary>
/// decompresses a gzipped OSD object /// decompresses a gzipped OSD object
/// </summary> /// </summary>
@ -564,15 +562,13 @@ namespace OpenSim.Region.Physics.Meshing
{ {
using (MemoryStream outMs = new MemoryStream()) using (MemoryStream outMs = new MemoryStream())
{ {
using (ZOutputStream zOut = new ZOutputStream(outMs)) using (DeflateStream decompressionStream = new DeflateStream(inMs, CompressionMode.Decompress))
{ {
byte[] readBuffer = new byte[2048]; byte[] readBuffer = new byte[2048];
int readLen = 0; inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header
while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0)
{ decompressionStream.CopyTo(outMs);
zOut.Write(readBuffer, 0, readLen);
}
zOut.Flush();
outMs.Seek(0, SeekOrigin.Begin); outMs.Seek(0, SeekOrigin.Begin);
byte[] decompressedBuf = outMs.GetBuffer(); byte[] decompressedBuf = outMs.GetBuffer();

View File

@ -104,6 +104,8 @@ namespace OpenSim.Server.Handlers.Profiles
Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest); Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest);
Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate);
Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); 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("image_assets_request", handler.AvatarImageAssetsRequest);
Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData);
Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData);

View File

@ -381,6 +381,59 @@ namespace OpenSim.Server.Handlers
} }
#endregion Interests #endregion Interests
#region User Preferences
public bool UserPreferencesRequest(OSDMap json, ref JsonRpcResponse response)
{
if(!json.ContainsKey("params"))
{
response.Error.Code = ErrorCode.ParseError;
m_log.DebugFormat ("User Preferences Request");
return false;
}
string result = string.Empty;
UserPreferences prefs = new UserPreferences();
object Prefs = (object)prefs;
OSD.DeserializeMembers(ref Prefs, (OSDMap)json["params"]);
if(Service.UserPreferencesRequest(ref prefs, ref result))
{
response.Result = OSD.SerializeMembers(prefs);
return true;
}
response.Error.Code = ErrorCode.InternalError;
response.Error.Message = string.Format("{0}", result);
m_log.InfoFormat("[PROFILES]: User preferences request error - {0}", response.Error.Message);
return false;
}
public bool UserPreferenecesUpdate(OSDMap json, ref JsonRpcResponse response)
{
if(!json.ContainsKey("params"))
{
response.Error.Code = ErrorCode.ParseError;
response.Error.Message = "no parameters supplied";
m_log.DebugFormat ("User Preferences Update Request");
return false;
}
string result = string.Empty;
UserPreferences prefs = new UserPreferences();
object Prefs = (object)prefs;
OSD.DeserializeMembers(ref Prefs, (OSDMap)json["params"]);
if(Service.UserPreferencesUpdate(ref prefs, ref result))
{
response.Result = OSD.SerializeMembers(prefs);
return true;
}
response.Error.Code = ErrorCode.InternalError;
response.Error.Message = string.Format("{0}", result);
m_log.InfoFormat("[PROFILES]: User preferences update error - {0}", response.Error.Message);
return false;
}
#endregion User Preferences
#region Utility #region Utility
public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response) public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response)
{ {

View File

@ -57,6 +57,11 @@ namespace OpenSim.Services.Interfaces
bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result); bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result);
bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result); bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result);
#endregion Profile Properties #endregion Profile Properties
#region User Preferences
bool UserPreferencesRequest(ref UserPreferences pref, ref string result);
bool UserPreferencesUpdate(ref UserPreferences pref, ref string result);
#endregion User Preferences
#region Interests #region Interests
bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result); bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result);

View File

@ -163,6 +163,18 @@ namespace OpenSim.Services.ProfilesService
} }
#endregion Interests #endregion Interests
#region User Preferences
public bool UserPreferencesUpdate(ref UserPreferences pref, ref string result)
{
return ProfilesData.UpdateUserPreferences(ref pref, ref result);
}
public bool UserPreferencesRequest(ref UserPreferences pref, ref string result)
{
return ProfilesData.GetUserPreferences(ref pref, ref result);
}
#endregion User Preferences
#region Utility #region Utility
public OSD AvatarImageAssetsRequest(UUID avatarId) public OSD AvatarImageAssetsRequest(UUID avatarId)
{ {

View File

@ -585,7 +585,6 @@
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="log4net" path="../../../../bin/"/> <Reference name="log4net" path="../../../../bin/"/>
<Reference name="zlib.net" path="../../../../bin/"/>
<Files> <Files>
<Match pattern="*.cs" recurse="true"/> <Match pattern="*.cs" recurse="true"/>