Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.csavinationmerge
commit
648e258b8e
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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 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;
|
||||
|
|
@ -120,5 +120,25 @@ namespace OpenSim.Framework
|
|||
sequenceNum = args["seq_num"].AsInteger();
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
Animation other = obj as Animation;
|
||||
if (other != null)
|
||||
{
|
||||
return (other.AnimID == this.AnimID
|
||||
&& other.SequenceNum == this.SequenceNum
|
||||
&& other.ObjectID == this.ObjectID);
|
||||
}
|
||||
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "AnimID=" + AnimID.ToString()
|
||||
+ "/seq=" + SequenceNum.ToString()
|
||||
+ "/objID=" + ObjectID.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* 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 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -26,27 +26,25 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Messages.Linden;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
|
||||
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
|
||||
|
|
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)
|
||||
|
|
|
@ -28,8 +28,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
using OpenSim.Framework;
|
||||
|
||||
using Animation = OpenSim.Framework.Animation;
|
||||
|
@ -60,6 +63,12 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
|||
ResetDefaultAnimation();
|
||||
}
|
||||
|
||||
public AnimationSet(OSDArray pArray)
|
||||
{
|
||||
ResetDefaultAnimation();
|
||||
FromOSDArray(pArray);
|
||||
}
|
||||
|
||||
public bool HasAnimation(UUID animID)
|
||||
{
|
||||
if (m_defaultAnimation.AnimID == animID)
|
||||
|
@ -218,5 +227,106 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
|||
foreach (OpenSim.Framework.Animation anim in theArray)
|
||||
m_animations.Add(anim);
|
||||
}
|
||||
|
||||
// Create representation of this AnimationSet as an OSDArray.
|
||||
// First two entries in the array are the default and implicitDefault animations
|
||||
// followed by the other animations.
|
||||
public OSDArray ToOSDArray()
|
||||
{
|
||||
OSDArray ret = new OSDArray();
|
||||
ret.Add(DefaultAnimation.PackUpdateMessage());
|
||||
ret.Add(ImplicitDefaultAnimation.PackUpdateMessage());
|
||||
|
||||
foreach (OpenSim.Framework.Animation anim in m_animations)
|
||||
ret.Add(anim.PackUpdateMessage());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void FromOSDArray(OSDArray pArray)
|
||||
{
|
||||
this.Clear();
|
||||
|
||||
if (pArray.Count >= 1)
|
||||
{
|
||||
m_defaultAnimation = new OpenSim.Framework.Animation((OSDMap)pArray[0]);
|
||||
}
|
||||
if (pArray.Count >= 2)
|
||||
{
|
||||
m_implicitDefaultAnimation = new OpenSim.Framework.Animation((OSDMap)pArray[1]);
|
||||
}
|
||||
for (int ii = 2; ii < pArray.Count; ii++)
|
||||
{
|
||||
m_animations.Add(new OpenSim.Framework.Animation((OSDMap)pArray[ii]));
|
||||
}
|
||||
}
|
||||
|
||||
// Compare two AnimationSets and return 'true' if the default animations are the same
|
||||
// and all of the animations in the list are equal.
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
AnimationSet other = obj as AnimationSet;
|
||||
if (other != null)
|
||||
{
|
||||
if (this.DefaultAnimation.Equals(other.DefaultAnimation)
|
||||
&& this.ImplicitDefaultAnimation.Equals(other.ImplicitDefaultAnimation))
|
||||
{
|
||||
// The defaults are the same. Is the list of animations the same?
|
||||
OpenSim.Framework.Animation[] thisAnims = this.ToArray();
|
||||
OpenSim.Framework.Animation[] otherAnims = other.ToArray();
|
||||
if (thisAnims.Length == 0 && otherAnims.Length == 0)
|
||||
return true; // the common case
|
||||
if (thisAnims.Length == otherAnims.Length)
|
||||
{
|
||||
// Do this the hard way but since the list is usually short this won't take long.
|
||||
foreach (OpenSim.Framework.Animation thisAnim in thisAnims)
|
||||
{
|
||||
bool found = false;
|
||||
foreach (OpenSim.Framework.Animation otherAnim in otherAnims)
|
||||
{
|
||||
if (thisAnim.Equals(otherAnim))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
// If anything is not in the other list, these are not equal
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Found everything in the other list. Since lists are equal length, they must be equal.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Don't know what was passed, but the base system will figure it out for me.
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder buff = new StringBuilder();
|
||||
buff.Append("dflt=");
|
||||
buff.Append(DefaultAnimation.ToString());
|
||||
buff.Append(",iDflt=");
|
||||
if (DefaultAnimation == ImplicitDefaultAnimation)
|
||||
buff.Append("same");
|
||||
else
|
||||
buff.Append(ImplicitDefaultAnimation.ToString());
|
||||
if (m_animations.Count > 0)
|
||||
{
|
||||
buff.Append(",anims=");
|
||||
foreach (OpenSim.Framework.Animation anim in m_animations)
|
||||
{
|
||||
buff.Append("<");
|
||||
buff.Append(anim.ToString());
|
||||
buff.Append(">,");
|
||||
}
|
||||
}
|
||||
return buff.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,5 +104,31 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
|||
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of the animation given a UUID. If there is no matching animation
|
||||
/// return the UUID as a string.
|
||||
/// </summary>
|
||||
public static string GetDefaultAnimationName(UUID uuid)
|
||||
{
|
||||
string ret = "unknown";
|
||||
if (AnimsUUID.ContainsValue(uuid))
|
||||
{
|
||||
foreach (KeyValuePair<string, UUID> kvp in AnimsUUID)
|
||||
{
|
||||
if (kvp.Value == uuid)
|
||||
{
|
||||
ret = kvp.Key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = uuid.ToString();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -93,7 +93,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
|||
GetAnimName(animID), animID, m_scenePresence.Name);
|
||||
|
||||
if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID))
|
||||
{
|
||||
SendAnimPack();
|
||||
}
|
||||
}
|
||||
|
||||
// Called from scripts
|
||||
|
@ -132,7 +134,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
|||
GetAnimName(animID), animID, m_scenePresence.Name);
|
||||
|
||||
if (m_animations.Remove(animID, allowNoDefault))
|
||||
{
|
||||
SendAnimPack();
|
||||
}
|
||||
}
|
||||
|
||||
public void avnChangeAnim(UUID animID, bool addRemove, bool sendPack)
|
||||
|
@ -180,8 +184,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
|||
/// The movement animation is reserved for "main" animations
|
||||
/// that are mutually exclusive, e.g. flying and sitting.
|
||||
/// </summary>
|
||||
public void TrySetMovementAnimation(string anim)
|
||||
/// <returns>'true' if the animation was updated</returns>
|
||||
public bool TrySetMovementAnimation(string anim)
|
||||
{
|
||||
bool ret = false;
|
||||
if (!m_scenePresence.IsChildAgent)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
|
@ -198,6 +204,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
|||
// 16384 is CHANGED_ANIMATION
|
||||
m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION});
|
||||
SendAnimPack();
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -206,6 +213,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
|||
"[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}",
|
||||
anim, m_scenePresence.Name);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -439,8 +447,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
|||
/// <summary>
|
||||
/// Update the movement animation of this avatar according to its current state
|
||||
/// </summary>
|
||||
public void UpdateMovementAnimations()
|
||||
/// <returns>'true' if the animation was changed</returns>
|
||||
public bool UpdateMovementAnimations()
|
||||
{
|
||||
bool ret = false;
|
||||
lock (m_animations)
|
||||
{
|
||||
string newMovementAnimation = DetermineMovementAnimation();
|
||||
|
@ -454,9 +464,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
|||
|
||||
// Only set it if it's actually changed, give a script
|
||||
// a chance to stop a default animation
|
||||
TrySetMovementAnimation(CurrentMovementAnimation);
|
||||
ret = TrySetMovementAnimation(CurrentMovementAnimation);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public UUID[] GetAnimationArray()
|
||||
|
|
|
@ -974,6 +974,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public delegate void RegionStarted(Scene scene);
|
||||
public event RegionStarted OnRegionStarted;
|
||||
|
||||
public delegate void RegionHeartbeatStart(Scene scene);
|
||||
public event RegionHeartbeatStart OnRegionHeartbeatStart;
|
||||
public delegate void RegionHeartbeatEnd(Scene scene);
|
||||
public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
|
||||
|
||||
|
@ -3096,6 +3098,27 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void TriggerRegionHeartbeatStart(Scene scene)
|
||||
{
|
||||
RegionHeartbeatStart handler = OnRegionHeartbeatStart;
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
foreach (RegionHeartbeatStart d in handler.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(scene);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatStart failed - continuing {0} - {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerRegionHeartbeatEnd(Scene scene)
|
||||
{
|
||||
RegionHeartbeatEnd handler = OnRegionHeartbeatEnd;
|
||||
|
|
|
@ -1569,6 +1569,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
try
|
||||
{
|
||||
EventManager.TriggerRegionHeartbeatStart(this);
|
||||
|
||||
// Apply taints in terrain module to terrain in physics scene
|
||||
if (Frame % m_update_terrain == 0)
|
||||
{
|
||||
|
|
|
@ -2310,6 +2310,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
AddToPhysicalScene(false);
|
||||
|
||||
Animator.TrySetMovementAnimation("STAND");
|
||||
TriggerScenePresenceUpdated();
|
||||
}
|
||||
|
||||
private SceneObjectPart FindNextAvailableSitTarget(UUID targetID)
|
||||
|
@ -2408,7 +2409,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
ControllingClient.SendSitResponse(
|
||||
part.UUID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook);
|
||||
|
||||
m_requestedSitTargetUUID = targetID;
|
||||
m_requestedSitTargetUUID = part.UUID;
|
||||
|
||||
HandleAgentSit(ControllingClient, UUID);
|
||||
|
||||
|
@ -2436,7 +2437,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (part != null)
|
||||
{
|
||||
m_requestedSitTargetID = part.LocalId;
|
||||
m_requestedSitTargetUUID = targetID;
|
||||
m_requestedSitTargetUUID = part.UUID;
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -2635,6 +2636,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
Animator.TrySetMovementAnimation(sitAnimation);
|
||||
SendAvatarDataToAllAgents();
|
||||
TriggerScenePresenceUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2643,6 +2645,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick..
|
||||
m_AngularVelocity = Vector3.Zero;
|
||||
Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
|
||||
TriggerScenePresenceUpdated();
|
||||
SitGround = true;
|
||||
RemoveFromPhysicalScene();
|
||||
}
|
||||
|
@ -2659,11 +2662,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public void HandleStartAnim(IClientAPI remoteClient, UUID animID)
|
||||
{
|
||||
Animator.AddAnimation(animID, UUID.Zero);
|
||||
TriggerScenePresenceUpdated();
|
||||
}
|
||||
|
||||
public void HandleStopAnim(IClientAPI remoteClient, UUID animID)
|
||||
{
|
||||
Animator.RemoveAnimation(animID, false);
|
||||
TriggerScenePresenceUpdated();
|
||||
}
|
||||
|
||||
public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack)
|
||||
|
@ -3693,7 +3698,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
// if (m_updateCount > 0)
|
||||
// {
|
||||
Animator.UpdateMovementAnimations();
|
||||
if (Animator.UpdateMovementAnimations())
|
||||
TriggerScenePresenceUpdated();
|
||||
// m_updateCount--;
|
||||
// }
|
||||
|
||||
|
|
|
@ -841,7 +841,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
|
|||
requrl = String.Format("{0}&chan_roll_off={1}", requrl, m_vivoxChannelRollOff);
|
||||
requrl = String.Format("{0}&chan_dist_model={1}", requrl, m_vivoxChannelDistanceModel);
|
||||
requrl = String.Format("{0}&chan_max_range={1}", requrl, m_vivoxChannelMaximumRange);
|
||||
requrl = String.Format("{0}&chan_ckamping_distance={1}", requrl, m_vivoxChannelClampingDistance);
|
||||
requrl = String.Format("{0}&chan_clamping_distance={1}", requrl, m_vivoxChannelClampingDistance);
|
||||
|
||||
XmlElement resp = VivoxCall(requrl, true);
|
||||
if (XmlFind(resp, "response.level0.body.chan_uri", out channelUri))
|
||||
|
|
|
@ -54,6 +54,9 @@ public static class BSParam
|
|||
// ===================
|
||||
// From:
|
||||
|
||||
public static bool UseSeparatePhysicsThread { get; private set; }
|
||||
public static float PhysicsTimeStep { get; private set; }
|
||||
|
||||
// Level of Detail values kept as float because that's what the Meshmerizer wants
|
||||
public static float MeshLOD { get; private set; }
|
||||
public static float MeshCircularLOD { get; private set; }
|
||||
|
@ -354,6 +357,11 @@ public static class BSParam
|
|||
// v = value (appropriate type)
|
||||
private static ParameterDefnBase[] ParameterDefinitions =
|
||||
{
|
||||
new ParameterDefn<bool>("UseSeparatePhysicsThread", "If 'true', the physics engine runs independent from the simulator heartbeat",
|
||||
false ),
|
||||
new ParameterDefn<float>("PhysicsTimeStep", "If separate thread, seconds to simulate each interval",
|
||||
0.1f ),
|
||||
|
||||
new ParameterDefn<bool>("MeshSculptedPrim", "Whether to create meshes for sculpties",
|
||||
true,
|
||||
(s) => { return ShouldMeshSculptedPrim; },
|
||||
|
|
|
@ -1513,7 +1513,8 @@ public class BSPrim : BSPhysObject
|
|||
CurrentEntityProperties = entprop;
|
||||
|
||||
// Note that BSPrim can be overloaded by BSPrimLinkable which controls updates from root and children prims.
|
||||
base.RequestPhysicsterseUpdate();
|
||||
|
||||
PhysScene.PostUpdate(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,12 +56,23 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
public string BulletEngineName { get; private set; }
|
||||
public BSAPITemplate PE;
|
||||
|
||||
// If the physics engine is running on a separate thread
|
||||
public Thread m_physicsThread;
|
||||
|
||||
public Dictionary<uint, BSPhysObject> PhysObjects;
|
||||
public BSShapeCollection Shapes;
|
||||
|
||||
// Keeping track of the objects with collisions so we can report begin and end of a collision
|
||||
public HashSet<BSPhysObject> ObjectsWithCollisions = new HashSet<BSPhysObject>();
|
||||
public HashSet<BSPhysObject> ObjectsWithNoMoreCollisions = new HashSet<BSPhysObject>();
|
||||
|
||||
// All the collision processing is protected with this lock object
|
||||
public Object CollisionLock = new Object();
|
||||
|
||||
// Properties are updated here
|
||||
public Object UpdateLock = new Object();
|
||||
public HashSet<BSPhysObject> ObjectsWithUpdates = new HashSet<BSPhysObject>();
|
||||
|
||||
// Keep track of all the avatars so we can send them a collision event
|
||||
// every tick so OpenSim will update its animation.
|
||||
private HashSet<BSPhysObject> m_avatars = new HashSet<BSPhysObject>();
|
||||
|
@ -77,12 +88,19 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
public BSConstraintCollection Constraints { get; private set; }
|
||||
|
||||
// Simulation parameters
|
||||
internal float m_physicsStepTime; // if running independently, the interval simulated by default
|
||||
|
||||
internal int m_maxSubSteps;
|
||||
internal float m_fixedTimeStep;
|
||||
internal long m_simulationStep = 0;
|
||||
internal float NominalFrameRate { get; set; }
|
||||
|
||||
internal float m_simulatedTime; // the time simulated previously. Used for physics framerate calc.
|
||||
|
||||
internal long m_simulationStep = 0; // The current simulation step.
|
||||
public long SimulationStep { get { return m_simulationStep; } }
|
||||
internal float LastTimeStep { get; private set; }
|
||||
|
||||
internal float LastTimeStep { get; private set; } // The simulation time from the last invocation of Simulate()
|
||||
|
||||
internal float NominalFrameRate { get; set; } // Parameterized ideal frame rate that simulation is scaled to
|
||||
|
||||
// Physical objects can register for prestep or poststep events
|
||||
public delegate void PreStepAction(float timeStep);
|
||||
|
@ -90,7 +108,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
public event PreStepAction BeforeStep;
|
||||
public event PostStepAction AfterStep;
|
||||
|
||||
// A value of the time now so all the collision and update routines do not have to get their own
|
||||
// A value of the time 'now' so all the collision and update routines do not have to get their own
|
||||
// Set to 'now' just before all the prims and actors are called for collisions and updates
|
||||
public int SimulationNowTime { get; private set; }
|
||||
|
||||
|
@ -188,6 +206,9 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
PhysObjects = new Dictionary<uint, BSPhysObject>();
|
||||
Shapes = new BSShapeCollection(this);
|
||||
|
||||
m_simulatedTime = 0f;
|
||||
LastTimeStep = 0.1f;
|
||||
|
||||
// Allocate pinned memory to pass parameters.
|
||||
UnmanagedParams = new ConfigurationParameters[1];
|
||||
|
||||
|
@ -227,10 +248,20 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
TerrainManager = new BSTerrainManager(this);
|
||||
TerrainManager.CreateInitialGroundPlaneAndTerrain();
|
||||
|
||||
// Put some informational messages into the log file.
|
||||
m_log.WarnFormat("{0} Linksets implemented with {1}", LogHeader, (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation);
|
||||
|
||||
InTaintTime = false;
|
||||
m_initialized = true;
|
||||
|
||||
// If the physics engine runs on its own thread, start same.
|
||||
if (BSParam.UseSeparatePhysicsThread)
|
||||
{
|
||||
// The physics simulation should happen independently of the heartbeat loop
|
||||
m_physicsThread = new Thread(BulletSPluginPhysicsThread);
|
||||
m_physicsThread.Name = BulletEngineName;
|
||||
m_physicsThread.Start();
|
||||
}
|
||||
}
|
||||
|
||||
// All default parameter values are set here. There should be no values set in the
|
||||
|
@ -270,6 +301,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
}
|
||||
else
|
||||
{
|
||||
// Nothing in the configuration INI file so assume unmanaged and other defaults.
|
||||
BulletEngineName = "BulletUnmanaged";
|
||||
m_physicsLoggingEnabled = false;
|
||||
VehicleLoggingEnabled = false;
|
||||
|
@ -317,6 +349,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
|
||||
switch (selectionName)
|
||||
{
|
||||
case "bullet":
|
||||
case "bulletunmanaged":
|
||||
ret = new BSAPIUnman(engineName, this);
|
||||
break;
|
||||
|
@ -494,25 +527,41 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
#endregion // Prim and Avatar addition and removal
|
||||
|
||||
#region Simulation
|
||||
// Simulate one timestep
|
||||
|
||||
// Call from the simulator to send physics information to the simulator objects.
|
||||
// This pushes all the collision and property update events into the objects in
|
||||
// the simulator and, since it is on the heartbeat thread, there is an implicit
|
||||
// locking of those data structures from other heartbeat events.
|
||||
// If the physics engine is running on a separate thread, the update information
|
||||
// will be in the ObjectsWithCollions and ObjectsWithUpdates structures.
|
||||
public override float Simulate(float timeStep)
|
||||
{
|
||||
if (!BSParam.UseSeparatePhysicsThread)
|
||||
{
|
||||
DoPhysicsStep(timeStep);
|
||||
}
|
||||
return SendUpdatesToSimulator(timeStep);
|
||||
}
|
||||
|
||||
// Call the physics engine to do one 'timeStep' and collect collisions and updates
|
||||
// into ObjectsWithCollisions and ObjectsWithUpdates data structures.
|
||||
private void DoPhysicsStep(float timeStep)
|
||||
{
|
||||
// prevent simulation until we've been initialized
|
||||
if (!m_initialized) return 5.0f;
|
||||
if (!m_initialized) return;
|
||||
|
||||
LastTimeStep = timeStep;
|
||||
|
||||
int updatedEntityCount = 0;
|
||||
int collidersCount = 0;
|
||||
|
||||
int beforeTime = 0;
|
||||
int beforeTime = Util.EnvironmentTickCount();
|
||||
int simTime = 0;
|
||||
|
||||
// update the prim states while we know the physics engine is not busy
|
||||
int numTaints = _taintOperations.Count;
|
||||
|
||||
InTaintTime = true; // Only used for debugging so locking is not necessary.
|
||||
|
||||
// update the prim states while we know the physics engine is not busy
|
||||
ProcessTaints();
|
||||
|
||||
// Some of the physical objects requre individual, pre-step calls
|
||||
|
@ -535,18 +584,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
int numSubSteps = 0;
|
||||
try
|
||||
{
|
||||
if (PhysicsLogging.Enabled)
|
||||
beforeTime = Util.EnvironmentTickCount();
|
||||
|
||||
numSubSteps = PE.PhysicsStep(World, timeStep, m_maxSubSteps, m_fixedTimeStep, out updatedEntityCount, out collidersCount);
|
||||
|
||||
if (PhysicsLogging.Enabled)
|
||||
{
|
||||
simTime = Util.EnvironmentTickCountSubtract(beforeTime);
|
||||
DetailLog("{0},Simulate,call, frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}, objWColl={7}",
|
||||
DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps,
|
||||
updatedEntityCount, collidersCount, ObjectsWithCollisions.Count);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -558,77 +597,62 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
collidersCount = 0;
|
||||
}
|
||||
|
||||
// Make the physics engine dump useful statistics periodically
|
||||
if (PhysicsMetricDumpFrames != 0 && ((m_simulationStep % PhysicsMetricDumpFrames) == 0))
|
||||
PE.DumpPhysicsStatistics(World);
|
||||
|
||||
// Get a value for 'now' so all the collision and update routines don't have to get their own.
|
||||
SimulationNowTime = Util.EnvironmentTickCount();
|
||||
|
||||
// If there were collisions, process them by sending the event to the prim.
|
||||
// Collisions must be processed before updates.
|
||||
if (collidersCount > 0)
|
||||
// Send collision information to the colliding objects. The objects decide if the collision
|
||||
// is 'real' (like linksets don't collide with themselves) and the individual objects
|
||||
// know if the simulator has subscribed to collisions.
|
||||
lock (CollisionLock)
|
||||
{
|
||||
for (int ii = 0; ii < collidersCount; ii++)
|
||||
if (collidersCount > 0)
|
||||
{
|
||||
uint cA = m_collisionArray[ii].aID;
|
||||
uint cB = m_collisionArray[ii].bID;
|
||||
Vector3 point = m_collisionArray[ii].point;
|
||||
Vector3 normal = m_collisionArray[ii].normal;
|
||||
float penetration = m_collisionArray[ii].penetration;
|
||||
SendCollision(cA, cB, point, normal, penetration);
|
||||
SendCollision(cB, cA, point, -normal, penetration);
|
||||
}
|
||||
}
|
||||
|
||||
// The above SendCollision's batch up the collisions on the objects.
|
||||
// Now push the collisions into the simulator.
|
||||
if (ObjectsWithCollisions.Count > 0)
|
||||
{
|
||||
foreach (BSPhysObject bsp in ObjectsWithCollisions)
|
||||
if (!bsp.SendCollisions())
|
||||
for (int ii = 0; ii < collidersCount; ii++)
|
||||
{
|
||||
// If the object is done colliding, see that it's removed from the colliding list
|
||||
ObjectsWithNoMoreCollisions.Add(bsp);
|
||||
}
|
||||
}
|
||||
|
||||
// This is a kludge to get avatar movement updates.
|
||||
// The simulator expects collisions for avatars even if there are have been no collisions.
|
||||
// The event updates avatar animations and stuff.
|
||||
// If you fix avatar animation updates, remove this overhead and let normal collision processing happen.
|
||||
foreach (BSPhysObject bsp in m_avatars)
|
||||
if (!ObjectsWithCollisions.Contains(bsp)) // don't call avatars twice
|
||||
bsp.SendCollisions();
|
||||
|
||||
// Objects that are done colliding are removed from the ObjectsWithCollisions list.
|
||||
// Not done above because it is inside an iteration of ObjectWithCollisions.
|
||||
// This complex collision processing is required to create an empty collision
|
||||
// event call after all real collisions have happened on an object. This enables
|
||||
// the simulator to generate the 'collision end' event.
|
||||
if (ObjectsWithNoMoreCollisions.Count > 0)
|
||||
{
|
||||
foreach (BSPhysObject po in ObjectsWithNoMoreCollisions)
|
||||
ObjectsWithCollisions.Remove(po);
|
||||
ObjectsWithNoMoreCollisions.Clear();
|
||||
}
|
||||
// Done with collisions.
|
||||
|
||||
// If any of the objects had updated properties, tell the object it has been changed by the physics engine
|
||||
if (updatedEntityCount > 0)
|
||||
{
|
||||
for (int ii = 0; ii < updatedEntityCount; ii++)
|
||||
{
|
||||
EntityProperties entprop = m_updateArray[ii];
|
||||
BSPhysObject pobj;
|
||||
if (PhysObjects.TryGetValue(entprop.ID, out pobj))
|
||||
{
|
||||
pobj.UpdateProperties(entprop);
|
||||
uint cA = m_collisionArray[ii].aID;
|
||||
uint cB = m_collisionArray[ii].bID;
|
||||
Vector3 point = m_collisionArray[ii].point;
|
||||
Vector3 normal = m_collisionArray[ii].normal;
|
||||
float penetration = m_collisionArray[ii].penetration;
|
||||
SendCollision(cA, cB, point, normal, penetration);
|
||||
SendCollision(cB, cA, point, -normal, penetration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If any of the objects had updated properties, tell the managed objects about the update
|
||||
// and remember that there was a change so it will be passed to the simulator.
|
||||
lock (UpdateLock)
|
||||
{
|
||||
if (updatedEntityCount > 0)
|
||||
{
|
||||
for (int ii = 0; ii < updatedEntityCount; ii++)
|
||||
{
|
||||
EntityProperties entprop = m_updateArray[ii];
|
||||
BSPhysObject pobj;
|
||||
if (PhysObjects.TryGetValue(entprop.ID, out pobj))
|
||||
{
|
||||
pobj.UpdateProperties(entprop);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Some actors want to know when the simulation step is complete.
|
||||
TriggerPostStepEvent(timeStep);
|
||||
|
||||
simTime = Util.EnvironmentTickCountSubtract(beforeTime);
|
||||
if (PhysicsLogging.Enabled)
|
||||
{
|
||||
DetailLog("{0},DoPhysicsStep,call, frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}, objWColl={7}",
|
||||
DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps,
|
||||
updatedEntityCount, collidersCount, ObjectsWithCollisions.Count);
|
||||
}
|
||||
|
||||
// The following causes the unmanaged code to output ALL the values found in ALL the objects in the world.
|
||||
// Only enable this in a limited test world with few objects.
|
||||
if (m_physicsPhysicalDumpEnabled)
|
||||
|
@ -637,7 +661,84 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
// The physics engine returns the number of milliseconds it simulated this call.
|
||||
// These are summed and normalized to one second and divided by 1000 to give the reported physics FPS.
|
||||
// Multiply by a fixed nominal frame rate to give a rate similar to the simulator (usually 55).
|
||||
return (float)numSubSteps * m_fixedTimeStep * 1000f * NominalFrameRate;
|
||||
m_simulatedTime += (float)numSubSteps * m_fixedTimeStep * 1000f * NominalFrameRate;
|
||||
}
|
||||
|
||||
// Called by a BSPhysObject to note that it has changed properties and this information
|
||||
// should be passed up to the simulator at the proper time.
|
||||
// Note: this is called by the BSPhysObject from invocation via DoPhysicsStep() above so
|
||||
// this is is under UpdateLock.
|
||||
public void PostUpdate(BSPhysObject updatee)
|
||||
{
|
||||
ObjectsWithUpdates.Add(updatee);
|
||||
}
|
||||
|
||||
// The simulator thinks it is physics time so return all the collisions and position
|
||||
// updates that were collected in actual physics simulation.
|
||||
private float SendUpdatesToSimulator(float timeStep)
|
||||
{
|
||||
if (!m_initialized) return 5.0f;
|
||||
|
||||
DetailLog("{0},SendUpdatesToSimulator,collisions={1},updates={2},simedTime={3}",
|
||||
BSScene.DetailLogZero, ObjectsWithCollisions.Count, ObjectsWithUpdates.Count, m_simulatedTime);
|
||||
// Push the collisions into the simulator.
|
||||
lock (CollisionLock)
|
||||
{
|
||||
if (ObjectsWithCollisions.Count > 0)
|
||||
{
|
||||
foreach (BSPhysObject bsp in ObjectsWithCollisions)
|
||||
if (!bsp.SendCollisions())
|
||||
{
|
||||
// If the object is done colliding, see that it's removed from the colliding list
|
||||
ObjectsWithNoMoreCollisions.Add(bsp);
|
||||
}
|
||||
}
|
||||
|
||||
// This is a kludge to get avatar movement updates.
|
||||
// The simulator expects collisions for avatars even if there are have been no collisions.
|
||||
// The event updates avatar animations and stuff.
|
||||
// If you fix avatar animation updates, remove this overhead and let normal collision processing happen.
|
||||
foreach (BSPhysObject bsp in m_avatars)
|
||||
if (!ObjectsWithCollisions.Contains(bsp)) // don't call avatars twice
|
||||
bsp.SendCollisions();
|
||||
|
||||
// Objects that are done colliding are removed from the ObjectsWithCollisions list.
|
||||
// Not done above because it is inside an iteration of ObjectWithCollisions.
|
||||
// This complex collision processing is required to create an empty collision
|
||||
// event call after all real collisions have happened on an object. This allows
|
||||
// the simulator to generate the 'collision end' event.
|
||||
if (ObjectsWithNoMoreCollisions.Count > 0)
|
||||
{
|
||||
foreach (BSPhysObject po in ObjectsWithNoMoreCollisions)
|
||||
ObjectsWithCollisions.Remove(po);
|
||||
ObjectsWithNoMoreCollisions.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Call the simulator for each object that has physics property updates.
|
||||
HashSet<BSPhysObject> updatedObjects = null;
|
||||
lock (UpdateLock)
|
||||
{
|
||||
if (ObjectsWithUpdates.Count > 0)
|
||||
{
|
||||
updatedObjects = ObjectsWithUpdates;
|
||||
ObjectsWithUpdates = new HashSet<BSPhysObject>();
|
||||
}
|
||||
}
|
||||
if (updatedObjects != null)
|
||||
{
|
||||
foreach (BSPhysObject obj in updatedObjects)
|
||||
{
|
||||
obj.RequestPhysicsterseUpdate();
|
||||
}
|
||||
updatedObjects.Clear();
|
||||
}
|
||||
|
||||
// Return the framerate simulated to give the above returned results.
|
||||
// (Race condition here but this is just bookkeeping so rare mistakes do not merit a lock).
|
||||
float simTime = m_simulatedTime;
|
||||
m_simulatedTime = 0f;
|
||||
return simTime;
|
||||
}
|
||||
|
||||
// Something has collided
|
||||
|
@ -656,7 +757,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
return;
|
||||
}
|
||||
|
||||
// The terrain is not in the physical object list so 'collidee' can be null when Collide() is called.
|
||||
// Note: the terrain is not in the physical object list so 'collidee' can be null when Collide() is called.
|
||||
BSPhysObject collidee = null;
|
||||
PhysObjects.TryGetValue(collidingWith, out collidee);
|
||||
|
||||
|
@ -664,13 +765,39 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
|
||||
if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration))
|
||||
{
|
||||
// If a collision was posted, remember to send it to the simulator
|
||||
// If a collision was 'good', remember to send it to the simulator
|
||||
ObjectsWithCollisions.Add(collider);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public void BulletSPluginPhysicsThread()
|
||||
{
|
||||
while (m_initialized)
|
||||
{
|
||||
int beginSimulationRealtimeMS = Util.EnvironmentTickCount();
|
||||
DoPhysicsStep(BSParam.PhysicsTimeStep);
|
||||
int simulationRealtimeMS = Util.EnvironmentTickCountSubtract(beginSimulationRealtimeMS);
|
||||
int simulationTimeVsRealtimeDifferenceMS = ((int)(BSParam.PhysicsTimeStep*1000f)) - simulationRealtimeMS;
|
||||
|
||||
if (simulationTimeVsRealtimeDifferenceMS > 0)
|
||||
{
|
||||
// The simulation of the time interval took less than realtime.
|
||||
// Do a sleep for the rest of realtime.
|
||||
DetailLog("{0},BulletSPluginPhysicsThread,sleeping={1}", BSScene.DetailLogZero, simulationTimeVsRealtimeDifferenceMS);
|
||||
Thread.Sleep(simulationTimeVsRealtimeDifferenceMS);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The simulation took longer than realtime.
|
||||
// Do some scaling of simulation time.
|
||||
// TODO.
|
||||
DetailLog("{0},BulletSPluginPhysicsThread,longerThanRealtime={1}", BSScene.DetailLogZero, simulationTimeVsRealtimeDifferenceMS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Simulation
|
||||
|
||||
public override void GetResults() { }
|
||||
|
|
|
@ -37,6 +37,8 @@ using OpenSim.Region.ScriptEngine.Interfaces;
|
|||
using OpenSim.Region.ScriptEngine.Shared;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
|
||||
using Timer=OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
|
@ -45,15 +47,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
/// </summary>
|
||||
public class AsyncCommandManager
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static Thread cmdHandlerThread;
|
||||
private static int cmdHandlerThreadCycleSleepms;
|
||||
|
||||
private static List<IScene> m_Scenes = new List<IScene>();
|
||||
/// <summary>
|
||||
/// Lock for reading/writing static components of AsyncCommandManager.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This lock exists so that multiple threads from different engines and/or different copies of the same engine
|
||||
/// are prevented from running non-thread safe code (e.g. read/write of lists) concurrently.
|
||||
/// </remarks>
|
||||
private static object staticLock = new object();
|
||||
|
||||
private static List<IScriptEngine> m_ScriptEngines =
|
||||
new List<IScriptEngine>();
|
||||
|
||||
public IScriptEngine m_ScriptEngine;
|
||||
private IScene m_Scene;
|
||||
|
||||
private static Dictionary<IScriptEngine, Dataserver> m_Dataserver =
|
||||
new Dictionary<IScriptEngine, Dataserver>();
|
||||
|
@ -70,67 +81,99 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
public Dataserver DataserverPlugin
|
||||
{
|
||||
get { return m_Dataserver[m_ScriptEngine]; }
|
||||
get
|
||||
{
|
||||
lock (staticLock)
|
||||
return m_Dataserver[m_ScriptEngine];
|
||||
}
|
||||
}
|
||||
|
||||
public Timer TimerPlugin
|
||||
{
|
||||
get { return m_Timer[m_ScriptEngine]; }
|
||||
get
|
||||
{
|
||||
lock (staticLock)
|
||||
return m_Timer[m_ScriptEngine];
|
||||
}
|
||||
}
|
||||
|
||||
public HttpRequest HttpRequestPlugin
|
||||
{
|
||||
get { return m_HttpRequest[m_ScriptEngine]; }
|
||||
get
|
||||
{
|
||||
lock (staticLock)
|
||||
return m_HttpRequest[m_ScriptEngine];
|
||||
}
|
||||
}
|
||||
|
||||
public Listener ListenerPlugin
|
||||
{
|
||||
get { return m_Listener[m_ScriptEngine]; }
|
||||
get
|
||||
{
|
||||
lock (staticLock)
|
||||
return m_Listener[m_ScriptEngine];
|
||||
}
|
||||
}
|
||||
|
||||
public SensorRepeat SensorRepeatPlugin
|
||||
{
|
||||
get { return m_SensorRepeat[m_ScriptEngine]; }
|
||||
get
|
||||
{
|
||||
lock (staticLock)
|
||||
return m_SensorRepeat[m_ScriptEngine];
|
||||
}
|
||||
}
|
||||
|
||||
public XmlRequest XmlRequestPlugin
|
||||
{
|
||||
get { return m_XmlRequest[m_ScriptEngine]; }
|
||||
get
|
||||
{
|
||||
lock (staticLock)
|
||||
return m_XmlRequest[m_ScriptEngine];
|
||||
}
|
||||
}
|
||||
|
||||
public IScriptEngine[] ScriptEngines
|
||||
{
|
||||
get { return m_ScriptEngines.ToArray(); }
|
||||
get
|
||||
{
|
||||
lock (staticLock)
|
||||
return m_ScriptEngines.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public AsyncCommandManager(IScriptEngine _ScriptEngine)
|
||||
{
|
||||
m_ScriptEngine = _ScriptEngine;
|
||||
m_Scene = m_ScriptEngine.World;
|
||||
|
||||
if (m_Scenes.Count == 0)
|
||||
ReadConfig();
|
||||
// If there is more than one scene in the simulator or multiple script engines are used on the same region
|
||||
// then more than one thread could arrive at this block of code simultaneously. However, it cannot be
|
||||
// executed concurrently both because concurrent list operations are not thread-safe and because of other
|
||||
// race conditions such as the later check of cmdHandlerThread == null.
|
||||
lock (staticLock)
|
||||
{
|
||||
if (m_ScriptEngines.Count == 0)
|
||||
ReadConfig();
|
||||
|
||||
if (!m_Scenes.Contains(m_Scene))
|
||||
m_Scenes.Add(m_Scene);
|
||||
if (!m_ScriptEngines.Contains(m_ScriptEngine))
|
||||
m_ScriptEngines.Add(m_ScriptEngine);
|
||||
if (!m_ScriptEngines.Contains(m_ScriptEngine))
|
||||
m_ScriptEngines.Add(m_ScriptEngine);
|
||||
|
||||
// Create instances of all plugins
|
||||
if (!m_Dataserver.ContainsKey(m_ScriptEngine))
|
||||
m_Dataserver[m_ScriptEngine] = new Dataserver(this);
|
||||
if (!m_Timer.ContainsKey(m_ScriptEngine))
|
||||
m_Timer[m_ScriptEngine] = new Timer(this);
|
||||
if (!m_HttpRequest.ContainsKey(m_ScriptEngine))
|
||||
m_HttpRequest[m_ScriptEngine] = new HttpRequest(this);
|
||||
if (!m_Listener.ContainsKey(m_ScriptEngine))
|
||||
m_Listener[m_ScriptEngine] = new Listener(this);
|
||||
if (!m_SensorRepeat.ContainsKey(m_ScriptEngine))
|
||||
m_SensorRepeat[m_ScriptEngine] = new SensorRepeat(this);
|
||||
if (!m_XmlRequest.ContainsKey(m_ScriptEngine))
|
||||
m_XmlRequest[m_ScriptEngine] = new XmlRequest(this);
|
||||
// Create instances of all plugins
|
||||
if (!m_Dataserver.ContainsKey(m_ScriptEngine))
|
||||
m_Dataserver[m_ScriptEngine] = new Dataserver(this);
|
||||
if (!m_Timer.ContainsKey(m_ScriptEngine))
|
||||
m_Timer[m_ScriptEngine] = new Timer(this);
|
||||
if (!m_HttpRequest.ContainsKey(m_ScriptEngine))
|
||||
m_HttpRequest[m_ScriptEngine] = new HttpRequest(this);
|
||||
if (!m_Listener.ContainsKey(m_ScriptEngine))
|
||||
m_Listener[m_ScriptEngine] = new Listener(this);
|
||||
if (!m_SensorRepeat.ContainsKey(m_ScriptEngine))
|
||||
m_SensorRepeat[m_ScriptEngine] = new SensorRepeat(this);
|
||||
if (!m_XmlRequest.ContainsKey(m_ScriptEngine))
|
||||
m_XmlRequest[m_ScriptEngine] = new XmlRequest(this);
|
||||
|
||||
StartThread();
|
||||
StartThread();
|
||||
}
|
||||
}
|
||||
|
||||
private static void StartThread()
|
||||
|
@ -179,42 +222,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
{
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(cmdHandlerThreadCycleSleepms);
|
||||
Thread.Sleep(cmdHandlerThreadCycleSleepms);
|
||||
|
||||
DoOneCmdHandlerPass();
|
||||
DoOneCmdHandlerPass();
|
||||
|
||||
Watchdog.UpdateThread();
|
||||
}
|
||||
Watchdog.UpdateThread();
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[ASYNC COMMAND MANAGER]: Exception in command handler pass: ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void DoOneCmdHandlerPass()
|
||||
{
|
||||
// Check HttpRequests
|
||||
m_HttpRequest[m_ScriptEngines[0]].CheckHttpRequests();
|
||||
|
||||
// Check XMLRPCRequests
|
||||
m_XmlRequest[m_ScriptEngines[0]].CheckXMLRPCRequests();
|
||||
|
||||
foreach (IScriptEngine s in m_ScriptEngines)
|
||||
lock (staticLock)
|
||||
{
|
||||
// Check Listeners
|
||||
m_Listener[s].CheckListeners();
|
||||
// Check HttpRequests
|
||||
m_HttpRequest[m_ScriptEngines[0]].CheckHttpRequests();
|
||||
|
||||
// Check timers
|
||||
m_Timer[s].CheckTimerEvents();
|
||||
// Check XMLRPCRequests
|
||||
m_XmlRequest[m_ScriptEngines[0]].CheckXMLRPCRequests();
|
||||
|
||||
// Check Sensors
|
||||
m_SensorRepeat[s].CheckSenseRepeaterEvents();
|
||||
foreach (IScriptEngine s in m_ScriptEngines)
|
||||
{
|
||||
// Check Listeners
|
||||
m_Listener[s].CheckListeners();
|
||||
|
||||
// Check dataserver
|
||||
m_Dataserver[s].ExpireRequests();
|
||||
// Check timers
|
||||
m_Timer[s].CheckTimerEvents();
|
||||
|
||||
// Check Sensors
|
||||
m_SensorRepeat[s].CheckSenseRepeaterEvents();
|
||||
|
||||
// Check dataserver
|
||||
m_Dataserver[s].ExpireRequests();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,31 +270,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
public static void RemoveScript(IScriptEngine engine, uint localID, UUID itemID)
|
||||
{
|
||||
// Remove a specific script
|
||||
// m_log.DebugFormat("[ASYNC COMMAND MANAGER]: Removing facilities for script {0}", itemID);
|
||||
|
||||
// Remove dataserver events
|
||||
m_Dataserver[engine].RemoveEvents(localID, itemID);
|
||||
|
||||
// Remove from: Timers
|
||||
m_Timer[engine].UnSetTimerEvents(localID, itemID);
|
||||
|
||||
// Remove from: HttpRequest
|
||||
IHttpRequestModule iHttpReq = engine.World.RequestModuleInterface<IHttpRequestModule>();
|
||||
if (iHttpReq != null)
|
||||
iHttpReq.StopHttpRequest(localID, itemID);
|
||||
|
||||
IWorldComm comms = engine.World.RequestModuleInterface<IWorldComm>();
|
||||
if (comms != null)
|
||||
comms.DeleteListener(itemID);
|
||||
|
||||
IXMLRPC xmlrpc = engine.World.RequestModuleInterface<IXMLRPC>();
|
||||
if (xmlrpc != null)
|
||||
lock (staticLock)
|
||||
{
|
||||
xmlrpc.DeleteChannels(itemID);
|
||||
xmlrpc.CancelSRDRequests(itemID);
|
||||
}
|
||||
// Remove dataserver events
|
||||
m_Dataserver[engine].RemoveEvents(localID, itemID);
|
||||
|
||||
// Remove Sensors
|
||||
m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
|
||||
// Remove from: Timers
|
||||
m_Timer[engine].UnSetTimerEvents(localID, itemID);
|
||||
|
||||
// Remove from: HttpRequest
|
||||
IHttpRequestModule iHttpReq = engine.World.RequestModuleInterface<IHttpRequestModule>();
|
||||
if (iHttpReq != null)
|
||||
iHttpReq.StopHttpRequest(localID, itemID);
|
||||
|
||||
IWorldComm comms = engine.World.RequestModuleInterface<IWorldComm>();
|
||||
if (comms != null)
|
||||
comms.DeleteListener(itemID);
|
||||
|
||||
IXMLRPC xmlrpc = engine.World.RequestModuleInterface<IXMLRPC>();
|
||||
if (xmlrpc != null)
|
||||
{
|
||||
xmlrpc.DeleteChannels(itemID);
|
||||
xmlrpc.CancelSRDRequests(itemID);
|
||||
}
|
||||
|
||||
// Remove Sensors
|
||||
m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -260,10 +308,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
/// <returns></returns>
|
||||
public static SensorRepeat GetSensorRepeatPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_SensorRepeat.ContainsKey(engine))
|
||||
return m_SensorRepeat[engine];
|
||||
else
|
||||
return null;
|
||||
lock (staticLock)
|
||||
{
|
||||
if (m_SensorRepeat.ContainsKey(engine))
|
||||
return m_SensorRepeat[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -273,10 +324,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
/// <returns></returns>
|
||||
public static Dataserver GetDataserverPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_Dataserver.ContainsKey(engine))
|
||||
return m_Dataserver[engine];
|
||||
else
|
||||
return null;
|
||||
lock (staticLock)
|
||||
{
|
||||
if (m_Dataserver.ContainsKey(engine))
|
||||
return m_Dataserver[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -286,10 +340,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
/// <returns></returns>
|
||||
public static Timer GetTimerPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_Timer.ContainsKey(engine))
|
||||
return m_Timer[engine];
|
||||
else
|
||||
return null;
|
||||
lock (staticLock)
|
||||
{
|
||||
if (m_Timer.ContainsKey(engine))
|
||||
return m_Timer[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -299,10 +356,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
/// <returns></returns>
|
||||
public static Listener GetListenerPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_Listener.ContainsKey(engine))
|
||||
return m_Listener[engine];
|
||||
else
|
||||
return null;
|
||||
lock (staticLock)
|
||||
{
|
||||
if (m_Listener.ContainsKey(engine))
|
||||
return m_Listener[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void StateChange(IScriptEngine engine, uint localID, UUID itemID)
|
||||
|
@ -332,28 +392,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
{
|
||||
List<Object> data = new List<Object>();
|
||||
|
||||
Object[] listeners = m_Listener[engine].GetSerializationData(itemID);
|
||||
if (listeners.Length > 0)
|
||||
lock (staticLock)
|
||||
{
|
||||
data.Add("listener");
|
||||
data.Add(listeners.Length);
|
||||
data.AddRange(listeners);
|
||||
}
|
||||
Object[] listeners = m_Listener[engine].GetSerializationData(itemID);
|
||||
if (listeners.Length > 0)
|
||||
{
|
||||
data.Add("listener");
|
||||
data.Add(listeners.Length);
|
||||
data.AddRange(listeners);
|
||||
}
|
||||
|
||||
Object[] timers=m_Timer[engine].GetSerializationData(itemID);
|
||||
if (timers.Length > 0)
|
||||
{
|
||||
data.Add("timer");
|
||||
data.Add(timers.Length);
|
||||
data.AddRange(timers);
|
||||
}
|
||||
Object[] timers=m_Timer[engine].GetSerializationData(itemID);
|
||||
if (timers.Length > 0)
|
||||
{
|
||||
data.Add("timer");
|
||||
data.Add(timers.Length);
|
||||
data.AddRange(timers);
|
||||
}
|
||||
|
||||
Object[] sensors = m_SensorRepeat[engine].GetSerializationData(itemID);
|
||||
if (sensors.Length > 0)
|
||||
{
|
||||
data.Add("sensor");
|
||||
data.Add(sensors.Length);
|
||||
data.AddRange(sensors);
|
||||
Object[] sensors = m_SensorRepeat[engine].GetSerializationData(itemID);
|
||||
if (sensors.Length > 0)
|
||||
{
|
||||
data.Add("sensor");
|
||||
data.Add(sensors.Length);
|
||||
data.AddRange(sensors);
|
||||
}
|
||||
}
|
||||
|
||||
return data.ToArray();
|
||||
|
@ -378,41 +441,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
idx+=len;
|
||||
|
||||
lock (staticLock)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case "listener":
|
||||
m_Listener[engine].CreateFromData(localID, itemID,
|
||||
hostID, item);
|
||||
break;
|
||||
case "timer":
|
||||
m_Timer[engine].CreateFromData(localID, itemID,
|
||||
hostID, item);
|
||||
break;
|
||||
case "sensor":
|
||||
m_SensorRepeat[engine].CreateFromData(localID,
|
||||
itemID, hostID, item);
|
||||
break;
|
||||
case "listener":
|
||||
m_Listener[engine].CreateFromData(localID, itemID,
|
||||
hostID, item);
|
||||
break;
|
||||
case "timer":
|
||||
m_Timer[engine].CreateFromData(localID, itemID,
|
||||
hostID, item);
|
||||
break;
|
||||
case "sensor":
|
||||
m_SensorRepeat[engine].CreateFromData(localID,
|
||||
itemID, hostID, item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Check llRemoteData channels
|
||||
|
||||
#endregion
|
||||
|
||||
#region Check llListeners
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// If set to true then threads and stuff should try to make a graceful exit
|
||||
/// </summary>
|
||||
public bool PleaseShutdown
|
||||
{
|
||||
get { return _PleaseShutdown; }
|
||||
set { _PleaseShutdown = value; }
|
||||
}
|
||||
private bool _PleaseShutdown = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* 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.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,461 @@
|
|||
/*
|
||||
* 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.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,75 @@
|
|||
/*
|
||||
* 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 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,187 @@
|
|||
/*
|
||||
* 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.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,86 @@
|
|||
/*
|
||||
* 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.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");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -111,3 +111,4 @@ project can always be found at http://opensimulator.org.
|
|||
|
||||
Thanks for trying OpenSim, we hope it is a pleasant experience.
|
||||
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1028,6 +1028,12 @@
|
|||
;# {InitialTerrain} {} {Initial terrain type} {pinhead-island flat} pinhead-island
|
||||
; InitialTerrain = "pinhead-island"
|
||||
|
||||
[UserProfiles]
|
||||
;# {ProfileURL} {} {Set url to UserProfilesService} {}
|
||||
;; Set the value of the url to your UserProfilesService
|
||||
;; If un-set / "" the module is disabled
|
||||
;; ProfileServiceURL = 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,
|
||||
|
|
|
@ -373,6 +373,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
|
||||
|
||||
|
@ -917,56 +930,49 @@
|
|||
;force_simple_prim_meshing = true
|
||||
|
||||
[BulletSim]
|
||||
; World parameters
|
||||
; All the BulletSim parameters can be displayed with the console command "physics get all"
|
||||
; and all are defined in the source file OpenSim/Regions/Physics/BulletSPlugin/BSParam.cs.
|
||||
|
||||
; There are two bullet physics libraries, bulletunmanaged is the default and is a native c++ dll
|
||||
; bulletxna is a managed C# dll. They have comparible functionality.. the c++ is much faster.
|
||||
|
||||
; bulletxna is a managed C# dll. They have comparible functionality but the c++ one is much faster.
|
||||
BulletEngine = "bulletunmanaged"
|
||||
; BulletEngine = "bulletxna"
|
||||
|
||||
; Terrain Implementation {1|0} 0 for HeightField, 1 for Mesh terrain. If you're using the bulletxna engine,
|
||||
; you will want to switch to the heightfield option
|
||||
TerrainImplementation = 1
|
||||
; TerrainImplementation = 0
|
||||
; Terrain Implementation
|
||||
TerrainImplementation = 1 ; 0=Heightfield, 1=mesh
|
||||
; For mesh terrain, the detail of the created mesh. '1' gives 256x256 (heightfield resolution). '2'
|
||||
; gives 512x512. Etc. Cannot be larger than '4'. Higher magnification uses lots of memory.
|
||||
TerrainMeshMagnification = 2
|
||||
|
||||
Gravity = -9.80665
|
||||
; Avatar physics height adjustments. http://opensimulator.org/wiki/BulletSim#Adjusting_Avatar_Height
|
||||
AvatarHeightLowFudge = -0.2 ; Adjustment at low end of height range
|
||||
AvatarHeightMidFudge = 0.1 ; Adjustment at mid point of avatar height range
|
||||
AvatarHeightHighFudge = 0.1 ; Adjustment at high end of height range
|
||||
|
||||
TerrainFriction = 0.30
|
||||
TerrainHitFraction = 0.8
|
||||
TerrainRestitution = 0
|
||||
TerrainCollisionMargin = 0.04
|
||||
|
||||
AvatarFriction = 0.2
|
||||
AvatarStandingFriction = 0.95
|
||||
AvatarRestitution = 0.0
|
||||
AvatarDensity = 3.5
|
||||
AvatarCapsuleWidth = 0.6
|
||||
AvatarCapsuleDepth = 0.45
|
||||
AvatarCapsuleHeight = 1.5
|
||||
AvatarContactProcessingThreshold = 0.1
|
||||
|
||||
MaxObjectMass = 10000.01
|
||||
|
||||
CollisionMargin = 0.04
|
||||
|
||||
; Linkset implmentation
|
||||
; Default linkset implmentation
|
||||
; 'Constraint' uses physics constraints to hold linkset together. 'Compound' builds a compound
|
||||
; shape from the children shapes to create a single physical shape. 'Compound' uses a lot less CPU time.
|
||||
LinkImplementation = 1 ; 0=constraint, 1=compound
|
||||
|
||||
; Whether to mesh sculpties
|
||||
; If 'true', turn scuplties into meshes
|
||||
MeshSculptedPrim = true
|
||||
|
||||
; If 'true', force simple prims (box and sphere) to be meshed
|
||||
; If 'false', the Bullet native special case shape is used for square rectangles and even dimensioned spheres
|
||||
ForceSimplePrimMeshing = false
|
||||
|
||||
; Bullet step parameters
|
||||
MaxSubSteps = 10
|
||||
FixedTimeStep = .01667
|
||||
; If 'true', when creating meshes, remove all triangles that have two equal vertexes.
|
||||
; Happens often in sculpties. If turned off, there will be some doorways that cannot be walked through.
|
||||
ShouldRemoveZeroWidthTriangles = true
|
||||
|
||||
; If 'true', use convex hull definition in mesh asset if present.
|
||||
ShouldUseAssetHulls = true
|
||||
|
||||
; If there are thousands of physical objects, these maximums should be increased.
|
||||
MaxCollisionsPerFrame = 2048
|
||||
MaxUpdatesPerFrame = 8192
|
||||
|
||||
; Detailed physics debug logging
|
||||
; Detailed physics debug logging. Very verbose.
|
||||
PhysicsLoggingEnabled = False
|
||||
PhysicsLoggingDir = "."
|
||||
VehicleLoggingEnabled = 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
|
@ -282,6 +282,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/"/>
|
||||
|
@ -1360,6 +1361,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>
|
||||
|
@ -2102,6 +2139,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