Merge branch 'work' contains UserProfiles with Robust service and updates region module using JsonRpc messaging. Requres no databse changes (but backup existing data before use).
commit
e85c70223a
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Data
|
||||
{
|
||||
|
||||
public interface IProfilesData
|
||||
{
|
||||
OSDArray GetClassifiedRecords(UUID creatorId);
|
||||
bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result);
|
||||
bool DeleteClassifiedRecord(UUID recordId);
|
||||
OSDArray GetAvatarPicks(UUID avatarId);
|
||||
UserProfilePick GetPickInfo(UUID avatarId, UUID pickId);
|
||||
bool UpdatePicksRecord(UserProfilePick pick);
|
||||
bool DeletePicksRecord(UUID pickId);
|
||||
bool GetAvatarNotes(ref UserProfileNotes note);
|
||||
bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result);
|
||||
bool GetAvatarProperties(ref UserProfileProperties props, ref string result);
|
||||
bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result);
|
||||
bool UpdateAvatarInterests(UserProfileProperties up, ref string result);
|
||||
bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result);
|
||||
bool GetUserAppData(ref UserAppData props, ref string result);
|
||||
bool SetUserAppData(UserAppData props, ref string result);
|
||||
OSDArray GetUserImageAssets(UUID avatarId);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,83 @@
|
|||
:VERSION 1 # -------------------------------
|
||||
|
||||
begin;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `classifieds` (
|
||||
`classifieduuid` char(36) NOT NULL,
|
||||
`creatoruuid` char(36) NOT NULL,
|
||||
`creationdate` int(20) NOT NULL,
|
||||
`expirationdate` int(20) NOT NULL,
|
||||
`category` varchar(20) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`description` text NOT NULL,
|
||||
`parceluuid` char(36) NOT NULL,
|
||||
`parentestate` int(11) NOT NULL,
|
||||
`snapshotuuid` char(36) NOT NULL,
|
||||
`simname` varchar(255) NOT NULL,
|
||||
`posglobal` varchar(255) NOT NULL,
|
||||
`parcelname` varchar(255) NOT NULL,
|
||||
`classifiedflags` int(8) NOT NULL,
|
||||
`priceforlisting` int(5) NOT NULL,
|
||||
PRIMARY KEY (`classifieduuid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `usernotes` (
|
||||
`useruuid` varchar(36) NOT NULL,
|
||||
`targetuuid` varchar(36) NOT NULL,
|
||||
`notes` text NOT NULL,
|
||||
UNIQUE KEY `useruuid` (`useruuid`,`targetuuid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `userpicks` (
|
||||
`pickuuid` varchar(36) NOT NULL,
|
||||
`creatoruuid` varchar(36) NOT NULL,
|
||||
`toppick` enum('true','false') NOT NULL,
|
||||
`parceluuid` varchar(36) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`description` text NOT NULL,
|
||||
`snapshotuuid` varchar(36) NOT NULL,
|
||||
`user` varchar(255) NOT NULL,
|
||||
`originalname` varchar(255) NOT NULL,
|
||||
`simname` varchar(255) NOT NULL,
|
||||
`posglobal` varchar(255) NOT NULL,
|
||||
`sortorder` int(2) NOT NULL,
|
||||
`enabled` enum('true','false') NOT NULL,
|
||||
PRIMARY KEY (`pickuuid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `userprofile` (
|
||||
`useruuid` varchar(36) NOT NULL,
|
||||
`profilePartner` varchar(36) NOT NULL,
|
||||
`profileAllowPublish` binary(1) NOT NULL,
|
||||
`profileMaturePublish` binary(1) NOT NULL,
|
||||
`profileURL` varchar(255) NOT NULL,
|
||||
`profileWantToMask` int(3) NOT NULL,
|
||||
`profileWantToText` text NOT NULL,
|
||||
`profileSkillsMask` int(3) NOT NULL,
|
||||
`profileSkillsText` text NOT NULL,
|
||||
`profileLanguages` text NOT NULL,
|
||||
`profileImage` varchar(36) NOT NULL,
|
||||
`profileAboutText` text NOT NULL,
|
||||
`profileFirstImage` varchar(36) NOT NULL,
|
||||
`profileFirstText` text NOT NULL,
|
||||
PRIMARY KEY (`useruuid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
commit;
|
||||
|
||||
:VERSION 2 # -------------------------------
|
||||
|
||||
begin;
|
||||
CREATE TABLE IF NOT EXISTS `userdata` (
|
||||
`UserId` char(36) NOT NULL,
|
||||
`TagId` varchar(64) NOT NULL,
|
||||
`DataKey` varchar(255),
|
||||
`DataVal` varchar(255),
|
||||
PRIMARY KEY (`UserId`,`TagId`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
commit;
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
using System;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public class UserClassifiedAdd
|
||||
{
|
||||
public UUID ClassifiedId = UUID.Zero;
|
||||
public UUID CreatorId = UUID.Zero;
|
||||
public int CreationDate = 0;
|
||||
public int ExpirationDate = 0;
|
||||
public int Category = 0;
|
||||
public string Name = string.Empty;
|
||||
public string Description = string.Empty;
|
||||
public UUID ParcelId = UUID.Zero;
|
||||
public int ParentEstate = 0;
|
||||
public UUID SnapshotId = UUID.Zero;
|
||||
public string SimName = string.Empty;
|
||||
public string GlobalPos = "<0,0,0>";
|
||||
public string ParcelName = string.Empty;
|
||||
public byte Flags = 0;
|
||||
public int Price = 0;
|
||||
}
|
||||
|
||||
public class UserProfileProperties
|
||||
{
|
||||
public UUID UserId = UUID.Zero;
|
||||
public UUID PartnerId = UUID.Zero;
|
||||
public bool PublishProfile = false;
|
||||
public bool PublishMature = false;
|
||||
public string WebUrl = string.Empty;
|
||||
public int WantToMask = 0;
|
||||
public string WantToText = string.Empty;
|
||||
public int SkillsMask = 0;
|
||||
public string SkillsText = string.Empty;
|
||||
public string Language = string.Empty;
|
||||
public UUID ImageId = UUID.Zero;
|
||||
public string AboutText = string.Empty;
|
||||
public UUID FirstLifeImageId = UUID.Zero;
|
||||
public string FirstLifeText = string.Empty;
|
||||
}
|
||||
|
||||
public class UserProfilePick
|
||||
{
|
||||
public UUID PickId = UUID.Zero;
|
||||
public UUID CreatorId = UUID.Zero;
|
||||
public bool TopPick = false;
|
||||
public string Name = string.Empty;
|
||||
public string OriginalName = string.Empty;
|
||||
public string Desc = string.Empty;
|
||||
public UUID ParcelId = UUID.Zero;
|
||||
public UUID SnapshotId = UUID.Zero;
|
||||
public string User = string.Empty;
|
||||
public string SimName = string.Empty;
|
||||
public string GlobalPos = "<0,0,0>";
|
||||
public int SortOrder = 0;
|
||||
public bool Enabled = false;
|
||||
}
|
||||
|
||||
public class UserProfileNotes
|
||||
{
|
||||
public UUID UserId;
|
||||
public UUID TargetId;
|
||||
public string Notes;
|
||||
}
|
||||
|
||||
public class UserAccountProperties
|
||||
{
|
||||
public string EmailAddress = string.Empty;
|
||||
public string Firstname = string.Empty;
|
||||
public string LastName = string.Empty;
|
||||
public string Password = string.Empty;
|
||||
public string UserId = string.Empty;
|
||||
}
|
||||
|
||||
public class UserAccountAuth
|
||||
{
|
||||
public string UserId = UUID.Zero.ToString();
|
||||
public string Password = string.Empty;
|
||||
}
|
||||
|
||||
public class UserAppData
|
||||
{
|
||||
public string TagId = string.Empty;
|
||||
public string DataKey = string.Empty;
|
||||
public string UserId = UUID.Zero.ToString();
|
||||
public string DataVal = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,176 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using Mono.Addins;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Profile
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BasicProfileModule")]
|
||||
public class BasicProfileModule : IProfileModule, ISharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
//
|
||||
// Module vars
|
||||
//
|
||||
private List<Scene> m_Scenes = new List<Scene>();
|
||||
private bool m_Enabled = false;
|
||||
|
||||
#region ISharedRegionModule
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled");
|
||||
m_Enabled = true;
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
lock (m_Scenes)
|
||||
{
|
||||
if (!m_Scenes.Contains(scene))
|
||||
{
|
||||
m_Scenes.Add(scene);
|
||||
// Hook up events
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
scene.RegisterModuleInterface<IProfileModule>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
lock (m_Scenes)
|
||||
{
|
||||
m_Scenes.Remove(scene);
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "BasicProfileModule"; }
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return typeof(IProfileModule); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// New Client Event Handler
|
||||
private void OnNewClient(IClientAPI client)
|
||||
{
|
||||
//Profile
|
||||
client.OnRequestAvatarProperties += RequestAvatarProperties;
|
||||
}
|
||||
|
||||
public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
|
||||
{
|
||||
IScene s = remoteClient.Scene;
|
||||
if (!(s is Scene))
|
||||
return;
|
||||
|
||||
// Scene scene = (Scene)s;
|
||||
|
||||
string profileUrl = String.Empty;
|
||||
string aboutText = String.Empty;
|
||||
string firstLifeAboutText = String.Empty;
|
||||
UUID image = UUID.Zero;
|
||||
UUID firstLifeImage = UUID.Zero;
|
||||
UUID partner = UUID.Zero;
|
||||
uint wantMask = 0;
|
||||
string wantText = String.Empty;
|
||||
uint skillsMask = 0;
|
||||
string skillsText = String.Empty;
|
||||
string languages = String.Empty;
|
||||
|
||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, avatarID);
|
||||
|
||||
string name = "Avatar";
|
||||
int created = 0;
|
||||
if (account != null)
|
||||
{
|
||||
name = account.FirstName + " " + account.LastName;
|
||||
created = account.Created;
|
||||
}
|
||||
Byte[] charterMember = Utils.StringToBytes(name);
|
||||
|
||||
profileUrl = "No profile data";
|
||||
aboutText = string.Empty;
|
||||
firstLifeAboutText = string.Empty;
|
||||
image = UUID.Zero;
|
||||
firstLifeImage = UUID.Zero;
|
||||
partner = UUID.Zero;
|
||||
|
||||
remoteClient.SendAvatarProperties(avatarID, aboutText,
|
||||
Util.ToDateTime(created).ToString(
|
||||
"M/d/yyyy", CultureInfo.InvariantCulture),
|
||||
charterMember, firstLifeAboutText,
|
||||
(uint)(0 & 0xff),
|
||||
firstLifeImage, image, profileUrl, partner);
|
||||
|
||||
//Viewer expects interest data when it asks for properties.
|
||||
remoteClient.SendAvatarInterestsReply(avatarID, wantMask, wantText,
|
||||
skillsMask, skillsText, languages);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,226 @@
|
|||
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Server.Handlers;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalUserProfilesServicesConnector")]
|
||||
public class LocalUserProfilesServicesConnector : ISharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Dictionary<UUID, Scene> regions = new Dictionary<UUID, Scene>();
|
||||
|
||||
public IUserProfilesService ServiceModule
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "LocalUserProfilesServicesConnector";
|
||||
}
|
||||
}
|
||||
|
||||
public string ConfigName
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public LocalUserProfilesServicesConnector()
|
||||
{
|
||||
m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector no params");
|
||||
}
|
||||
|
||||
public LocalUserProfilesServicesConnector(IConfigSource source)
|
||||
{
|
||||
m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector instantiated directly.");
|
||||
InitialiseService(source);
|
||||
}
|
||||
|
||||
public void InitialiseService(IConfigSource source)
|
||||
{
|
||||
ConfigName = "UserProfilesService";
|
||||
|
||||
// Instantiate the request handler
|
||||
IHttpServer Server = MainServer.Instance;
|
||||
|
||||
IConfig config = source.Configs[ConfigName];
|
||||
if (config == null)
|
||||
{
|
||||
m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: UserProfilesService missing from OpenSim.ini");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!config.GetBoolean("Enabled",false))
|
||||
{
|
||||
Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Enabled = true;
|
||||
|
||||
string serviceDll = config.GetString("LocalServiceModule",
|
||||
String.Empty);
|
||||
|
||||
if (serviceDll == String.Empty)
|
||||
{
|
||||
m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: No LocalServiceModule named in section UserProfilesService");
|
||||
return;
|
||||
}
|
||||
|
||||
Object[] args = new Object[] { source, ConfigName };
|
||||
ServiceModule =
|
||||
ServerUtils.LoadPlugin<IUserProfilesService>(serviceDll,
|
||||
args);
|
||||
|
||||
if (ServiceModule == null)
|
||||
{
|
||||
m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: Can't load user profiles service");
|
||||
return;
|
||||
}
|
||||
|
||||
Enabled = true;
|
||||
|
||||
JsonRpcProfileHandlers handler = new JsonRpcProfileHandlers(ServiceModule);
|
||||
|
||||
Server.AddJsonRPCHandler("avatarclassifiedsrequest", handler.AvatarClassifiedsRequest);
|
||||
Server.AddJsonRPCHandler("classified_update", handler.ClassifiedUpdate);
|
||||
Server.AddJsonRPCHandler("classifieds_info_query", handler.ClassifiedInfoRequest);
|
||||
Server.AddJsonRPCHandler("classified_delete", handler.ClassifiedDelete);
|
||||
Server.AddJsonRPCHandler("avatarpicksrequest", handler.AvatarPicksRequest);
|
||||
Server.AddJsonRPCHandler("pickinforequest", handler.PickInfoRequest);
|
||||
Server.AddJsonRPCHandler("picks_update", handler.PicksUpdate);
|
||||
Server.AddJsonRPCHandler("picks_delete", handler.PicksDelete);
|
||||
Server.AddJsonRPCHandler("avatarnotesrequest", handler.AvatarNotesRequest);
|
||||
Server.AddJsonRPCHandler("avatar_notes_update", handler.NotesUpdate);
|
||||
Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest);
|
||||
Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate);
|
||||
Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate);
|
||||
Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest);
|
||||
Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData);
|
||||
Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData);
|
||||
|
||||
}
|
||||
|
||||
#region ISharedRegionModule implementation
|
||||
|
||||
void ISharedRegionModule.PostInitialise()
|
||||
{
|
||||
if(!Enabled)
|
||||
return;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRegionModuleBase implementation
|
||||
|
||||
void IRegionModuleBase.Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig moduleConfig = source.Configs["Modules"];
|
||||
if (moduleConfig != null)
|
||||
{
|
||||
string name = moduleConfig.GetString("UserProfilesServices", "");
|
||||
if (name == Name)
|
||||
{
|
||||
InitialiseService(source);
|
||||
m_log.Info("[LOCAL USERPROFILES SERVICE CONNECTOR]: Local user profiles connector enabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IRegionModuleBase.Close()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void IRegionModuleBase.AddRegion(Scene scene)
|
||||
{
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
||||
lock (regions)
|
||||
{
|
||||
if (regions.ContainsKey(scene.RegionInfo.RegionID))
|
||||
m_log.ErrorFormat("[LOCAL USERPROFILES SERVICE CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!");
|
||||
else
|
||||
regions.Add(scene.RegionInfo.RegionID, scene);
|
||||
}
|
||||
}
|
||||
|
||||
void IRegionModuleBase.RemoveRegion(Scene scene)
|
||||
{
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
||||
lock (regions)
|
||||
{
|
||||
if (regions.ContainsKey(scene.RegionInfo.RegionID))
|
||||
regions.Remove(scene.RegionInfo.RegionID);
|
||||
}
|
||||
}
|
||||
|
||||
void IRegionModuleBase.RegionLoaded(Scene scene)
|
||||
{
|
||||
if (!Enabled)
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -56,6 +56,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
|||
|
||||
public LocalGridServicesConnector()
|
||||
{
|
||||
m_log.Debug("[LOCAL GRID SERVICE CONNECTOR]: LocalGridServicesConnector no parms.");
|
||||
}
|
||||
|
||||
public LocalGridServicesConnector(IConfigSource source)
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Profiles
|
||||
{
|
||||
public class UserProfilesConnector: ServiceConnector
|
||||
{
|
||||
static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
|
||||
// Our Local Module
|
||||
public IUserProfilesService ServiceModule
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
// The HTTP server.
|
||||
public IHttpServer Server
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public string ConfigName
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public UserProfilesConnector(IConfigSource config, IHttpServer server, string configName) :
|
||||
base(config, server, configName)
|
||||
{
|
||||
ConfigName = "UserProfilesService";
|
||||
if(!string.IsNullOrEmpty(configName))
|
||||
ConfigName = configName;
|
||||
|
||||
IConfig serverConfig = config.Configs[ConfigName];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section {0} in config file", ConfigName));
|
||||
|
||||
if(!serverConfig.GetBoolean("Enabled",false))
|
||||
{
|
||||
Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Enabled = true;
|
||||
|
||||
Server = server;
|
||||
|
||||
string service = serverConfig.GetString("LocalServiceModule", String.Empty);
|
||||
|
||||
Object[] args = new Object[] { config, ConfigName };
|
||||
ServiceModule = ServerUtils.LoadPlugin<IUserProfilesService>(service, args);
|
||||
|
||||
JsonRpcProfileHandlers handler = new JsonRpcProfileHandlers(ServiceModule);
|
||||
|
||||
Server.AddJsonRPCHandler("avatarclassifiedsrequest", handler.AvatarClassifiedsRequest);
|
||||
Server.AddJsonRPCHandler("classified_update", handler.ClassifiedUpdate);
|
||||
Server.AddJsonRPCHandler("classifieds_info_query", handler.ClassifiedInfoRequest);
|
||||
Server.AddJsonRPCHandler("classified_delete", handler.ClassifiedDelete);
|
||||
Server.AddJsonRPCHandler("avatarpicksrequest", handler.AvatarPicksRequest);
|
||||
Server.AddJsonRPCHandler("pickinforequest", handler.PickInfoRequest);
|
||||
Server.AddJsonRPCHandler("picks_update", handler.PicksUpdate);
|
||||
Server.AddJsonRPCHandler("picks_delete", handler.PicksDelete);
|
||||
Server.AddJsonRPCHandler("avatarnotesrequest", handler.AvatarNotesRequest);
|
||||
Server.AddJsonRPCHandler("avatar_notes_update", handler.NotesUpdate);
|
||||
Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest);
|
||||
Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate);
|
||||
Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate);
|
||||
Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest);
|
||||
// Server.AddJsonRPCHandler("user_preferences_request", handler.UserPreferencesRequest);
|
||||
// Server.AddJsonRPCHandler("user_preferences_update", handler.UserPreferencesUpdate);
|
||||
// Server.AddJsonRPCHandler("user_account_create", handler.UserAccountCreate);
|
||||
// Server.AddJsonRPCHandler("user_account_auth", handler.UserAccountAuth);
|
||||
// Server.AddJsonRPCHandler("user_account_test", handler.UserAccountTest);
|
||||
Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData);
|
||||
Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,434 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using log4net;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Server.Handlers
|
||||
{
|
||||
public class UserProfilesHandlers
|
||||
{
|
||||
public UserProfilesHandlers ()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class JsonRpcProfileHandlers
|
||||
{
|
||||
static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public IUserProfilesService Service
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public JsonRpcProfileHandlers(IUserProfilesService service)
|
||||
{
|
||||
Service = service;
|
||||
}
|
||||
|
||||
#region Classifieds
|
||||
/// <summary>
|
||||
/// Request avatar's classified ads.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// An array containing all the calassified uuid and it's name created by the creator id
|
||||
/// </returns>
|
||||
/// <param name='json'>
|
||||
/// Our parameters are in the OSDMap json["params"]
|
||||
/// </param>
|
||||
/// <param name='response'>
|
||||
/// If set to <c>true</c> response.
|
||||
/// </param>
|
||||
public bool AvatarClassifiedsRequest(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
m_log.DebugFormat ("Classified Request");
|
||||
return false;
|
||||
}
|
||||
|
||||
OSDMap request = (OSDMap)json["params"];
|
||||
UUID creatorId = new UUID(request["creatorId"].AsString());
|
||||
|
||||
|
||||
OSDArray data = (OSDArray) Service.AvatarClassifiedsRequest(creatorId);
|
||||
response.Result = data;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ClassifiedUpdate(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
response.Error.Message = "Error parsing classified update request";
|
||||
m_log.DebugFormat ("Classified Update Request");
|
||||
return false;
|
||||
}
|
||||
|
||||
string result = string.Empty;
|
||||
UserClassifiedAdd ad = new UserClassifiedAdd();
|
||||
object Ad = (object)ad;
|
||||
OSD.DeserializeMembers(ref Ad, (OSDMap)json["params"]);
|
||||
if(Service.ClassifiedUpdate(ad, ref result))
|
||||
{
|
||||
response.Result = OSD.SerializeMembers(ad);
|
||||
return true;
|
||||
}
|
||||
|
||||
response.Error.Code = ErrorCode.InternalError;
|
||||
response.Error.Message = string.Format("{0}", result);
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ClassifiedDelete(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
m_log.DebugFormat ("Classified Delete Request");
|
||||
return false;
|
||||
}
|
||||
|
||||
OSDMap request = (OSDMap)json["params"];
|
||||
UUID classifiedId = new UUID(request["classifiedID"].AsString());
|
||||
|
||||
OSDMap res = new OSDMap();
|
||||
res["result"] = OSD.FromString("success");
|
||||
response.Result = res;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public bool ClassifiedInfoRequest(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
response.Error.Message = "no parameters supplied";
|
||||
m_log.DebugFormat ("Classified Info Request");
|
||||
return false;
|
||||
}
|
||||
|
||||
string result = string.Empty;
|
||||
UserClassifiedAdd ad = new UserClassifiedAdd();
|
||||
object Ad = (object)ad;
|
||||
OSD.DeserializeMembers(ref Ad, (OSDMap)json["params"]);
|
||||
if(Service.ClassifiedInfoRequest(ref ad, ref result))
|
||||
{
|
||||
response.Result = OSD.SerializeMembers(ad);
|
||||
return true;
|
||||
}
|
||||
|
||||
response.Error.Code = ErrorCode.InternalError;
|
||||
response.Error.Message = string.Format("{0}", result);
|
||||
return false;
|
||||
}
|
||||
#endregion Classifieds
|
||||
|
||||
#region Picks
|
||||
public bool AvatarPicksRequest(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
m_log.DebugFormat ("Avatar Picks Request");
|
||||
return false;
|
||||
}
|
||||
|
||||
OSDMap request = (OSDMap)json["params"];
|
||||
UUID creatorId = new UUID(request["creatorId"].AsString());
|
||||
|
||||
|
||||
OSDArray data = (OSDArray) Service.AvatarPicksRequest(creatorId);
|
||||
response.Result = data;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool PickInfoRequest(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
response.Error.Message = "no parameters supplied";
|
||||
m_log.DebugFormat ("Avatar Picks Info Request");
|
||||
return false;
|
||||
}
|
||||
|
||||
string result = string.Empty;
|
||||
UserProfilePick pick = new UserProfilePick();
|
||||
object Pick = (object)pick;
|
||||
OSD.DeserializeMembers(ref Pick, (OSDMap)json["params"]);
|
||||
if(Service.PickInfoRequest(ref pick, ref result))
|
||||
{
|
||||
response.Result = OSD.SerializeMembers(pick);
|
||||
return true;
|
||||
}
|
||||
|
||||
response.Error.Code = ErrorCode.InternalError;
|
||||
response.Error.Message = string.Format("{0}", result);
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool PicksUpdate(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
response.Error.Message = "no parameters supplied";
|
||||
m_log.DebugFormat ("Avatar Picks Update Request");
|
||||
return false;
|
||||
}
|
||||
|
||||
string result = string.Empty;
|
||||
UserProfilePick pick = new UserProfilePick();
|
||||
object Pick = (object)pick;
|
||||
OSD.DeserializeMembers(ref Pick, (OSDMap)json["params"]);
|
||||
if(Service.PicksUpdate(ref pick, ref result))
|
||||
{
|
||||
response.Result = OSD.SerializeMembers(pick);
|
||||
return true;
|
||||
}
|
||||
|
||||
response.Error.Code = ErrorCode.InternalError;
|
||||
response.Error.Message = "unable to update pick";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool PicksDelete(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
m_log.DebugFormat ("Avatar Picks Delete Request");
|
||||
return false;
|
||||
}
|
||||
|
||||
OSDMap request = (OSDMap)json["params"];
|
||||
UUID pickId = new UUID(request["pickId"].AsString());
|
||||
if(Service.PicksDelete(pickId))
|
||||
return true;
|
||||
|
||||
response.Error.Code = ErrorCode.InternalError;
|
||||
response.Error.Message = "data error removing record";
|
||||
return false;
|
||||
}
|
||||
#endregion Picks
|
||||
|
||||
#region Notes
|
||||
public bool AvatarNotesRequest(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
response.Error.Message = "Params missing";
|
||||
m_log.DebugFormat ("Avatar Notes Request");
|
||||
return false;
|
||||
}
|
||||
|
||||
string result = string.Empty;
|
||||
UserProfileNotes note = new UserProfileNotes();
|
||||
object Note = (object)note;
|
||||
OSD.DeserializeMembers(ref Note, (OSDMap)json["params"]);
|
||||
if(Service.AvatarNotesRequest(ref note))
|
||||
{
|
||||
response.Result = OSD.SerializeMembers(note);
|
||||
return true;
|
||||
}
|
||||
|
||||
object Notes = (object) note;
|
||||
OSD.DeserializeMembers(ref Notes, (OSDMap)json["params"]);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool NotesUpdate(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
response.Error.Message = "No parameters";
|
||||
m_log.DebugFormat ("Avatar Notes Update Request");
|
||||
return false;
|
||||
}
|
||||
|
||||
string result = string.Empty;
|
||||
UserProfileNotes note = new UserProfileNotes();
|
||||
object Notes = (object) note;
|
||||
OSD.DeserializeMembers(ref Notes, (OSDMap)json["params"]);
|
||||
if(Service.NotesUpdate(ref note, ref result))
|
||||
{
|
||||
response.Result = OSD.SerializeMembers(note);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endregion Notes
|
||||
|
||||
#region Profile Properties
|
||||
public bool AvatarPropertiesRequest(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
response.Error.Message = "no parameters supplied";
|
||||
m_log.DebugFormat ("Avatar Properties Request");
|
||||
return false;
|
||||
}
|
||||
|
||||
string result = string.Empty;
|
||||
UserProfileProperties props = new UserProfileProperties();
|
||||
object Props = (object)props;
|
||||
OSD.DeserializeMembers(ref Props, (OSDMap)json["params"]);
|
||||
if(Service.AvatarPropertiesRequest(ref props, ref result))
|
||||
{
|
||||
response.Result = OSD.SerializeMembers(props);
|
||||
return true;
|
||||
}
|
||||
|
||||
response.Error.Code = ErrorCode.InternalError;
|
||||
response.Error.Message = string.Format("{0}", result);
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool AvatarPropertiesUpdate(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
response.Error.Message = "no parameters supplied";
|
||||
m_log.DebugFormat ("Avatar Properties Update Request");
|
||||
return false;
|
||||
}
|
||||
|
||||
string result = string.Empty;
|
||||
UserProfileProperties props = new UserProfileProperties();
|
||||
object Props = (object)props;
|
||||
OSD.DeserializeMembers(ref Props, (OSDMap)json["params"]);
|
||||
if(Service.AvatarPropertiesUpdate(ref props, ref result))
|
||||
{
|
||||
response.Result = OSD.SerializeMembers(props);
|
||||
return true;
|
||||
}
|
||||
|
||||
response.Error.Code = ErrorCode.InternalError;
|
||||
response.Error.Message = string.Format("{0}", result);
|
||||
return false;
|
||||
}
|
||||
#endregion Profile Properties
|
||||
|
||||
#region Interests
|
||||
public bool AvatarInterestsUpdate(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
response.Error.Message = "no parameters supplied";
|
||||
m_log.DebugFormat ("Avatar Interests Update Request");
|
||||
return false;
|
||||
}
|
||||
|
||||
string result = string.Empty;
|
||||
UserProfileProperties props = new UserProfileProperties();
|
||||
object Props = (object)props;
|
||||
OSD.DeserializeMembers(ref Props, (OSDMap)json["params"]);
|
||||
if(Service.AvatarInterestsUpdate(props, ref result))
|
||||
{
|
||||
response.Result = OSD.SerializeMembers(props);
|
||||
return true;
|
||||
}
|
||||
|
||||
response.Error.Code = ErrorCode.InternalError;
|
||||
response.Error.Message = string.Format("{0}", result);
|
||||
return false;
|
||||
}
|
||||
#endregion Interests
|
||||
|
||||
#region Utility
|
||||
public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
m_log.DebugFormat ("Avatar Image Assets Request");
|
||||
return false;
|
||||
}
|
||||
|
||||
OSDMap request = (OSDMap)json["params"];
|
||||
UUID avatarId = new UUID(request["avatarId"].AsString());
|
||||
|
||||
OSDArray data = (OSDArray) Service.AvatarImageAssetsRequest(avatarId);
|
||||
response.Result = data;
|
||||
|
||||
return true;
|
||||
}
|
||||
#endregion Utiltiy
|
||||
|
||||
#region UserData
|
||||
public bool RequestUserAppData(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
response.Error.Message = "no parameters supplied";
|
||||
m_log.DebugFormat ("User Application Service URL Request: No Parameters!");
|
||||
return false;
|
||||
}
|
||||
|
||||
string result = string.Empty;
|
||||
UserAppData props = new UserAppData();
|
||||
object Props = (object)props;
|
||||
OSD.DeserializeMembers(ref Props, (OSDMap)json["params"]);
|
||||
if(Service.RequestUserAppData(ref props, ref result))
|
||||
{
|
||||
OSDMap res = new OSDMap();
|
||||
res["result"] = OSD.FromString("success");
|
||||
res["token"] = OSD.FromString (result);
|
||||
response.Result = res;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
response.Error.Code = ErrorCode.InternalError;
|
||||
response.Error.Message = string.Format("{0}", result);
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool UpdateUserAppData(OSDMap json, ref JsonRpcResponse response)
|
||||
{
|
||||
if(!json.ContainsKey("params"))
|
||||
{
|
||||
response.Error.Code = ErrorCode.ParseError;
|
||||
response.Error.Message = "no parameters supplied";
|
||||
m_log.DebugFormat ("User App Data Update Request");
|
||||
return false;
|
||||
}
|
||||
|
||||
string result = string.Empty;
|
||||
UserAppData props = new UserAppData();
|
||||
object Props = (object)props;
|
||||
OSD.DeserializeMembers(ref Props, (OSDMap)json["params"]);
|
||||
if(Service.SetUserAppData(props, ref result))
|
||||
{
|
||||
response.Result = OSD.SerializeMembers(props);
|
||||
return true;
|
||||
}
|
||||
|
||||
response.Error.Code = ErrorCode.InternalError;
|
||||
response.Error.Message = string.Format("{0}", result);
|
||||
return false;
|
||||
}
|
||||
#endregion UserData
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using OpenSim.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
namespace OpenSim.Services.Interfaces
|
||||
{
|
||||
public interface IUserProfilesService
|
||||
{
|
||||
#region Classifieds
|
||||
OSD AvatarClassifiedsRequest(UUID creatorId);
|
||||
bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result);
|
||||
bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result);
|
||||
bool ClassifiedDelete(UUID recordId);
|
||||
#endregion Classifieds
|
||||
|
||||
#region Picks
|
||||
OSD AvatarPicksRequest(UUID creatorId);
|
||||
bool PickInfoRequest(ref UserProfilePick pick, ref string result);
|
||||
bool PicksUpdate(ref UserProfilePick pick, ref string result);
|
||||
bool PicksDelete(UUID pickId);
|
||||
#endregion Picks
|
||||
|
||||
#region Notes
|
||||
bool AvatarNotesRequest(ref UserProfileNotes note);
|
||||
bool NotesUpdate(ref UserProfileNotes note, ref string result);
|
||||
#endregion Notes
|
||||
|
||||
#region Profile Properties
|
||||
bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result);
|
||||
bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result);
|
||||
#endregion Profile Properties
|
||||
|
||||
#region Interests
|
||||
bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result);
|
||||
#endregion Interests
|
||||
|
||||
#region Utility
|
||||
OSD AvatarImageAssetsRequest(UUID avatarId);
|
||||
#endregion Utility
|
||||
|
||||
#region UserData
|
||||
bool RequestUserAppData(ref UserAppData prop, ref string result);
|
||||
bool SetUserAppData(UserAppData prop, ref string result);
|
||||
#endregion UserData
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Nini.Config;
|
||||
using log4net;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Services.UserAccountService;
|
||||
using OpenSim.Data;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Services.ProfilesService
|
||||
{
|
||||
public class UserProfilesService: UserProfilesServiceBase, IUserProfilesService
|
||||
{
|
||||
static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
IUserAccountService userAccounts;
|
||||
IAuthenticationService authService;
|
||||
|
||||
public UserProfilesService(IConfigSource config, string configName):
|
||||
base(config, configName)
|
||||
{
|
||||
IConfig Config = config.Configs[configName];
|
||||
if (Config == null)
|
||||
{
|
||||
m_log.Warn("[PROFILES]: No configuration found!");
|
||||
return;
|
||||
}
|
||||
Object[] args = null;
|
||||
|
||||
args = new Object[] { config };
|
||||
string accountService = Config.GetString("UserAccountService", String.Empty);
|
||||
if (accountService != string.Empty)
|
||||
userAccounts = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
|
||||
|
||||
args = new Object[] { config };
|
||||
string authServiceConfig = Config.GetString("AuthenticationServiceModule", String.Empty);
|
||||
if (accountService != string.Empty)
|
||||
authService = ServerUtils.LoadPlugin<IAuthenticationService>(authServiceConfig, args);
|
||||
}
|
||||
|
||||
#region Classifieds
|
||||
public OSD AvatarClassifiedsRequest(UUID creatorId)
|
||||
{
|
||||
OSDArray records = ProfilesData.GetClassifiedRecords(creatorId);
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
public bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result)
|
||||
{
|
||||
if(!ProfilesData.UpdateClassifiedRecord(ad, ref result))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
result = "success";
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ClassifiedDelete(UUID recordId)
|
||||
{
|
||||
if(ProfilesData.DeleteClassifiedRecord(recordId))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result)
|
||||
{
|
||||
if(ProfilesData.GetClassifiedInfo(ref ad, ref result))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
#endregion Classifieds
|
||||
|
||||
#region Picks
|
||||
public OSD AvatarPicksRequest(UUID creatorId)
|
||||
{
|
||||
OSDArray records = ProfilesData.GetAvatarPicks(creatorId);
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
public bool PickInfoRequest(ref UserProfilePick pick, ref string result)
|
||||
{
|
||||
pick = ProfilesData.GetPickInfo(pick.CreatorId, pick.PickId);
|
||||
result = "OK";
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool PicksUpdate(ref UserProfilePick pick, ref string result)
|
||||
{
|
||||
return ProfilesData.UpdatePicksRecord(pick);
|
||||
}
|
||||
|
||||
public bool PicksDelete(UUID pickId)
|
||||
{
|
||||
return ProfilesData.DeletePicksRecord(pickId);
|
||||
}
|
||||
#endregion Picks
|
||||
|
||||
#region Notes
|
||||
public bool AvatarNotesRequest(ref UserProfileNotes note)
|
||||
{
|
||||
return ProfilesData.GetAvatarNotes(ref note);
|
||||
}
|
||||
|
||||
public bool NotesUpdate(ref UserProfileNotes note, ref string result)
|
||||
{
|
||||
return ProfilesData.UpdateAvatarNotes(ref note, ref result);
|
||||
}
|
||||
#endregion Notes
|
||||
|
||||
#region Profile Properties
|
||||
public bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result)
|
||||
{
|
||||
return ProfilesData.GetAvatarProperties(ref prop, ref result);
|
||||
}
|
||||
|
||||
public bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result)
|
||||
{
|
||||
return ProfilesData.UpdateAvatarProperties(ref prop, ref result);
|
||||
}
|
||||
#endregion Profile Properties
|
||||
|
||||
#region Interests
|
||||
public bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result)
|
||||
{
|
||||
return ProfilesData.UpdateAvatarInterests(prop, ref result);
|
||||
}
|
||||
#endregion Interests
|
||||
|
||||
#region Utility
|
||||
public OSD AvatarImageAssetsRequest(UUID avatarId)
|
||||
{
|
||||
OSDArray records = ProfilesData.GetUserImageAssets(avatarId);
|
||||
return records;
|
||||
}
|
||||
#endregion Utility
|
||||
|
||||
#region UserData
|
||||
public bool RequestUserAppData(ref UserAppData prop, ref string result)
|
||||
{
|
||||
return ProfilesData.GetUserAppData(ref prop, ref result);
|
||||
}
|
||||
|
||||
public bool SetUserAppData(UserAppData prop, ref string result)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endregion UserData
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using Nini.Config;
|
||||
using log4net;
|
||||
using OpenSim.Services.Base;
|
||||
using OpenSim.Data;
|
||||
|
||||
namespace OpenSim.Services.ProfilesService
|
||||
{
|
||||
public class UserProfilesServiceBase: ServiceBase
|
||||
{
|
||||
static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public IProfilesData ProfilesData;
|
||||
|
||||
public string ConfigName
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public UserProfilesServiceBase(IConfigSource config, string configName):
|
||||
base(config)
|
||||
{
|
||||
if(string.IsNullOrEmpty(configName))
|
||||
{
|
||||
m_log.WarnFormat("[PROFILES]: Configuration section not given!");
|
||||
return;
|
||||
}
|
||||
|
||||
string dllName = String.Empty;
|
||||
string connString = null;
|
||||
string realm = String.Empty;
|
||||
|
||||
IConfig dbConfig = config.Configs["DatabaseService"];
|
||||
if (dbConfig != null)
|
||||
{
|
||||
if (dllName == String.Empty)
|
||||
dllName = dbConfig.GetString("StorageProvider", String.Empty);
|
||||
if (string.IsNullOrEmpty(connString))
|
||||
connString = dbConfig.GetString("ConnectionString", String.Empty);
|
||||
}
|
||||
|
||||
IConfig ProfilesConfig = config.Configs[configName];
|
||||
if (ProfilesConfig != null)
|
||||
{
|
||||
connString = ProfilesConfig.GetString("ConnectionString", connString);
|
||||
realm = ProfilesConfig.GetString("Realm", realm);
|
||||
}
|
||||
|
||||
ProfilesData = LoadPlugin<IProfilesData>(dllName, new Object[] { connString });
|
||||
if (ProfilesData == null)
|
||||
throw new Exception("Could not find a storage interface in the given module");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1032,6 +1032,12 @@
|
|||
;# {InitialTerrain} {} {Initial terrain type} {pinhead-island flat} pinhead-island
|
||||
; InitialTerrain = "pinhead-island"
|
||||
|
||||
[Profile]
|
||||
;# {ProfileURL} {} {Set url to UserProfilesService} {}
|
||||
;; Set the value of the url to your UserProfilesService
|
||||
;; If un-set / "" the module is disabled
|
||||
;; ProfileURL = http://127.0.0.1:8002
|
||||
|
||||
[Architecture]
|
||||
;# {Include-Architecture} {} {Choose one of the following architectures} {config-include/Standalone.ini config-include/StandaloneHypergrid.ini config-include/Grid.ini config-include/GridHypergrid.ini config-include/SimianGrid.ini config-include/HyperSimianGrid.ini} config-include/Standalone.ini
|
||||
;; Uncomment one of the following includes as required. For instance, to create a standalone OpenSim,
|
||||
|
|
|
@ -377,6 +377,19 @@
|
|||
AllowRegionRestartFromClient = true
|
||||
|
||||
|
||||
[UserProfiles]
|
||||
;# {ProfileURL} {} {Set url to UserProfilesService} {}
|
||||
;; Set the value of the url to your UserProfilesService
|
||||
;; If un-set / "" the module is disabled
|
||||
;; If the ProfileURL is not set, then very BASIC
|
||||
;; profile support will be configured. If the ProfileURL is set to a
|
||||
;; valid URL, then full profile support will be configured. The URL
|
||||
;; points to your grid's Robust user profiles service
|
||||
;;
|
||||
; ProfileURL = http://127.0.0.1:9000
|
||||
|
||||
|
||||
|
||||
[SMTP]
|
||||
enabled = false
|
||||
|
||||
|
|
|
@ -71,10 +71,12 @@ HGInventoryServiceConnector = "HGInventoryService@8002/OpenSim.Server.Handlers.d
|
|||
HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:AssetServiceConnector"
|
||||
;; Uncomment this if you want Groups V2, HG to work
|
||||
; HGGroupsServiceConnector = "8002/OpenSim.Addons.Groups.dll:HGGroupsServiceRobustConnector"
|
||||
|
||||
;; Additions for other add-on modules. For example:
|
||||
;; WifiServerConnector = "8002/Diva.Wifi.dll:WifiServerConnector"
|
||||
|
||||
;; Uncomment for UserProfiles see [UserProfilesService] to configure...
|
||||
; UserProfilesServiceConnector = "8002/OpenSim.Server.Handlers.dll:UserProfilesConnector"
|
||||
|
||||
; * This is common for all services, it's the network setup for the entire
|
||||
; * server instance, if none is specified above
|
||||
; *
|
||||
|
@ -595,4 +597,12 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset
|
|||
;; Can overwrite the default in [Hypergrid], but probably shouldn't
|
||||
; HomeURI = "http://127.0.0.1:8002"
|
||||
|
||||
[UserProfilesService]
|
||||
LocalServiceModule = "OpenSim.Services.UserProfilesService.dll:UserProfilesService"
|
||||
Enabled = false
|
||||
;; Configure this for separate profiles database
|
||||
;; ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;Old Guids=true;"
|
||||
;; Realm = UserProfiles
|
||||
UserAccountService = OpenSim.Services.UserAccountService.dll:UserAccountService
|
||||
AuthenticationServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto
|
|||
;; Uncomment this if you want Groups V2 to work
|
||||
;GroupsServiceConnector = "8003/OpenSim.Addons.Groups.dll:GroupsServiceRobustConnector"
|
||||
|
||||
;; Uncomment for UserProfiles see [UserProfilesService] to configure...
|
||||
; UserProfilesServiceConnector = "8002/OpenSim.Server.Handlers.dll:UserProfilesConnector"
|
||||
|
||||
; * This is common for all services, it's the network setup for the entire
|
||||
; * server instance, if none is specified above
|
||||
|
@ -391,4 +393,13 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto
|
|||
; password help: optional: page providing password assistance for users of your grid
|
||||
;password = http://127.0.0.1/password
|
||||
|
||||
[UserProfilesService]
|
||||
LocalServiceModule = "OpenSim.Services.UserProfilesService.dll:UserProfilesService"
|
||||
Enabled = false
|
||||
;; Configure this for separate profiles database
|
||||
;; ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;Old Guids=true;"
|
||||
;; Realm = UserProfiles
|
||||
UserAccountService = OpenSim.Services.UserAccountService.dll:UserAccountService
|
||||
AuthenticationServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||
|
||||
|
||||
|
|
|
@ -352,3 +352,19 @@
|
|||
;; If appearance is restricted, which accounts' appearances are allowed to be exported?
|
||||
;; Comma-separated list of account names
|
||||
AccountForAppearance = "Test User, Astronaut Smith"
|
||||
|
||||
;; UserProfiles Service
|
||||
;;
|
||||
;; To use, set Enabled to true then configure for your site...
|
||||
[UserProfilesService]
|
||||
LocalServiceModule = "OpenSim.Services.UserProfilesService.dll:UserProfilesService"
|
||||
Enabled = false
|
||||
|
||||
;; Configure this for separate databse
|
||||
; ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;"
|
||||
; Realm = UserProfiles
|
||||
|
||||
UserAccountService = OpenSim.Services.UserAccountService.dll:UserAccountService
|
||||
AuthenticationServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
GridUserServices = "LocalGridUserServicesConnector"
|
||||
SimulationServices = "RemoteSimulationConnectorModule"
|
||||
AvatarServices = "LocalAvatarServicesConnector"
|
||||
UserProfilesServices = "LocalUserProfilesServicesConnector"
|
||||
MapImageService = "MapImageServiceModule"
|
||||
EntityTransferModule = "HGEntityTransferModule"
|
||||
InventoryAccessModule = "HGInventoryAccessModule"
|
||||
|
@ -184,7 +185,6 @@
|
|||
UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService"
|
||||
InGatekeeper = True
|
||||
|
||||
|
||||
;; This should always be the very last thing on this file
|
||||
[Includes]
|
||||
Include-Common = "config-include/StandaloneCommon.ini"
|
||||
|
|
38
prebuild.xml
38
prebuild.xml
|
@ -281,6 +281,7 @@
|
|||
<Reference name="System.Data"/>
|
||||
<Reference name="XMLRPC" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../bin/"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="log4net" path="../../bin/"/>
|
||||
|
@ -1239,6 +1240,42 @@
|
|||
</Files>
|
||||
</Project>
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Services.UserProfilesService" path="OpenSim/Services/UserProfilesService" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../../bin/</ReferencePath>
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Core"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Services.UserAccountService"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="OpenSim.Services.Connectors"/>
|
||||
<Reference name="OpenSim.Services.Base"/>
|
||||
<Reference name="OpenSim.Server.Base"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
|
||||
<Reference name="Nini" path="../../../bin/"/>
|
||||
<Reference name="log4net" path="../../../bin/"/>
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true"/>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Server.Handlers" path="OpenSim/Server/Handlers" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
|
@ -1977,6 +2014,7 @@
|
|||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
|
||||
<Reference name="MySql.Data" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Region.Framework"/>
|
||||
|
|
Loading…
Reference in New Issue