mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
Add support for user preferences (im via email)
This commit is contained in:
@@ -104,6 +104,8 @@ namespace OpenSim.Server.Handlers.Profiles
|
||||
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);
|
||||
|
||||
@@ -381,6 +381,59 @@ namespace OpenSim.Server.Handlers
|
||||
}
|
||||
#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
|
||||
public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user