Merge branch 'master' into dev
Conflicts: OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs OpenSim/Region/Framework/Scenes/Scene.csdsg
commit
9556e0079b
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
// using OpenSim.Region.Framework.Interfaces;
|
||||
|
||||
namespace OpenSim.Framework.Capabilities
|
||||
{
|
||||
/// <summary>
|
||||
/// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that
|
||||
/// we can popup a message on the user's client if the inventory service has permanently failed). But I didn't want
|
||||
/// to just pass the whole Scene into CAPS.
|
||||
/// </summary>
|
||||
public delegate IClientAPI GetClientDelegate(UUID agentID);
|
||||
|
||||
public class Caps
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_httpListenerHostName;
|
||||
private uint m_httpListenPort;
|
||||
|
||||
/// <summary>
|
||||
/// This is the uuid portion of every CAPS path. It is used to make capability urls private to the requester.
|
||||
/// </summary>
|
||||
private string m_capsObjectPath;
|
||||
public string CapsObjectPath { get { return m_capsObjectPath; } }
|
||||
|
||||
private CapsHandlers m_capsHandlers;
|
||||
private Dictionary<string, string> m_externalCapsHandlers;
|
||||
|
||||
private IHttpServer m_httpListener;
|
||||
private UUID m_agentID;
|
||||
private string m_regionName;
|
||||
|
||||
public UUID AgentID
|
||||
{
|
||||
get { return m_agentID; }
|
||||
}
|
||||
|
||||
public string RegionName
|
||||
{
|
||||
get { return m_regionName; }
|
||||
}
|
||||
|
||||
public string HostName
|
||||
{
|
||||
get { return m_httpListenerHostName; }
|
||||
}
|
||||
|
||||
public uint Port
|
||||
{
|
||||
get { return m_httpListenPort; }
|
||||
}
|
||||
|
||||
public IHttpServer HttpListener
|
||||
{
|
||||
get { return m_httpListener; }
|
||||
}
|
||||
|
||||
public bool SSLCaps
|
||||
{
|
||||
get { return m_httpListener.UseSSL; }
|
||||
}
|
||||
public string SSLCommonName
|
||||
{
|
||||
get { return m_httpListener.SSLCommonName; }
|
||||
}
|
||||
public CapsHandlers CapsHandlers
|
||||
{
|
||||
get { return m_capsHandlers; }
|
||||
}
|
||||
public Dictionary<string, string> ExternalCapsHandlers
|
||||
{
|
||||
get { return m_externalCapsHandlers; }
|
||||
}
|
||||
|
||||
public Caps(IHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
|
||||
UUID agent, string regionName)
|
||||
{
|
||||
m_capsObjectPath = capsPath;
|
||||
m_httpListener = httpServer;
|
||||
m_httpListenerHostName = httpListen;
|
||||
|
||||
m_httpListenPort = httpPort;
|
||||
|
||||
if (httpServer != null && httpServer.UseSSL)
|
||||
{
|
||||
m_httpListenPort = httpServer.SSLPort;
|
||||
httpListen = httpServer.SSLCommonName;
|
||||
httpPort = httpServer.SSLPort;
|
||||
}
|
||||
|
||||
m_agentID = agent;
|
||||
m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
|
||||
m_externalCapsHandlers = new Dictionary<string, string>();
|
||||
m_regionName = regionName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register a handler. This allows modules to register handlers.
|
||||
/// </summary>
|
||||
/// <param name="capName"></param>
|
||||
/// <param name="handler"></param>
|
||||
public void RegisterHandler(string capName, IRequestHandler handler)
|
||||
{
|
||||
m_capsHandlers[capName] = handler;
|
||||
//m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register an external handler. The service for this capability is somewhere else
|
||||
/// given by the URL.
|
||||
/// </summary>
|
||||
/// <param name="capsName"></param>
|
||||
/// <param name="url"></param>
|
||||
public void RegisterHandler(string capsName, string url)
|
||||
{
|
||||
m_externalCapsHandlers.Add(capsName, url);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove all CAPS service handlers.
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="httpListener"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="restMethod"></param>
|
||||
public void DeregisterHandlers()
|
||||
{
|
||||
if (m_capsHandlers != null)
|
||||
{
|
||||
foreach (string capsName in m_capsHandlers.Caps)
|
||||
{
|
||||
m_capsHandlers.Remove(capsName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,7 +31,6 @@ using System.Collections.Specialized;
|
|||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using Mono.Addins;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
|
@ -39,90 +38,23 @@ using OpenMetaverse.StructuredData;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Assets
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class GetMeshModule : INonSharedRegionModule
|
||||
public class GetMeshHandler
|
||||
{
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
private IAssetService m_assetService;
|
||||
private bool m_enabled = true;
|
||||
|
||||
#region IRegionModuleBase Members
|
||||
|
||||
|
||||
public Type ReplaceableInterface
|
||||
public GetMeshHandler(IAssetService assService)
|
||||
{
|
||||
get { return null; }
|
||||
m_assetService = assService;
|
||||
}
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig meshConfig = source.Configs["Mesh"];
|
||||
if (meshConfig == null)
|
||||
return;
|
||||
|
||||
m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true);
|
||||
}
|
||||
|
||||
public void AddRegion(Scene pScene)
|
||||
{
|
||||
m_scene = pScene;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
m_scene = null;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
|
||||
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
|
||||
|
||||
public void Close() { }
|
||||
|
||||
public string Name { get { return "GetMeshModule"; } }
|
||||
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
if(!m_enabled)
|
||||
return;
|
||||
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
// m_log.Info("[GETMESH]: /CAPS/" + capID);
|
||||
|
||||
caps.RegisterHandler("GetMesh",
|
||||
new RestHTTPHandler("GET", "/CAPS/" + capID,
|
||||
delegate(Hashtable m_dhttpMethod)
|
||||
{
|
||||
return ProcessGetMesh(m_dhttpMethod, agentID, caps);
|
||||
}));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap)
|
||||
{
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenSim.Framework.Servers;
|
||||
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class GetMeshServerConnector : ServiceConnector
|
||||
{
|
||||
private IAssetService m_AssetService;
|
||||
private string m_ConfigName = "CapsService";
|
||||
|
||||
public GetMeshServerConnector(IConfigSource config, IHttpServer server, string configName) :
|
||||
base(config, server, configName)
|
||||
{
|
||||
if (configName != String.Empty)
|
||||
m_ConfigName = configName;
|
||||
|
||||
IConfig serverConfig = config.Configs[m_ConfigName];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
|
||||
|
||||
string assetService = serverConfig.GetString("AssetService", String.Empty);
|
||||
|
||||
if (assetService == String.Empty)
|
||||
throw new Exception("No AssetService in config file");
|
||||
|
||||
Object[] args = new Object[] { config };
|
||||
m_AssetService =
|
||||
ServerUtils.LoadPlugin<IAssetService>(assetService, args);
|
||||
|
||||
if (m_AssetService == null)
|
||||
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
|
||||
|
||||
GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService);
|
||||
IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(),
|
||||
delegate(Hashtable m_dhttpMethod)
|
||||
{
|
||||
return gmeshHandler.ProcessGetMesh(m_dhttpMethod, UUID.Zero, null);
|
||||
});
|
||||
server.AddStreamHandler(reqHandler);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -42,39 +42,16 @@ using OpenSim.Framework;
|
|||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
#region Stream Handler
|
||||
|
||||
public delegate byte[] StreamHandlerCallback(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse);
|
||||
|
||||
public class StreamHandler : BaseStreamHandler
|
||||
{
|
||||
StreamHandlerCallback m_callback;
|
||||
|
||||
public StreamHandler(string httpMethod, string path, StreamHandlerCallback callback)
|
||||
: base(httpMethod, path)
|
||||
{
|
||||
m_callback = callback;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
return m_callback(path, request, httpRequest, httpResponse);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Stream Handler
|
||||
|
||||
public class GetTextureModule : IRegionModule
|
||||
public class GetTextureHandler : BaseStreamHandler
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private Scene m_scene;
|
||||
private IAssetService m_assetService;
|
||||
|
||||
public const string DefaultFormat = "x-j2c";
|
||||
|
@ -82,44 +59,22 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
// TODO: Change this to a config option
|
||||
const string REDIRECT_URL = null;
|
||||
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene pScene, IConfigSource pSource)
|
||||
public GetTextureHandler(string path, IAssetService assService) :
|
||||
base("GET", path)
|
||||
{
|
||||
m_scene = pScene;
|
||||
m_assetService = assService;
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
}
|
||||
|
||||
public void Close() { }
|
||||
|
||||
public string Name { get { return "GetTextureModule"; } }
|
||||
public bool IsSharedModule { get { return false; } }
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
// m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private byte[] ProcessGetTexture(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
//m_log.DebugFormat("[GETTEXTURE]: called in {0}", m_scene.RegionInfo.RegionName);
|
||||
|
||||
// Try to parse the texture ID from the request URL
|
||||
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
||||
string textureStr = query.GetOne("texture_id");
|
||||
string format = query.GetOne("format");
|
||||
|
||||
m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr);
|
||||
|
||||
if (m_assetService == null)
|
||||
{
|
||||
m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service");
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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 Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class GetTextureServerConnector : ServiceConnector
|
||||
{
|
||||
private IAssetService m_AssetService;
|
||||
private string m_ConfigName = "CapsService";
|
||||
|
||||
public GetTextureServerConnector(IConfigSource config, IHttpServer server, string configName) :
|
||||
base(config, server, configName)
|
||||
{
|
||||
if (configName != String.Empty)
|
||||
m_ConfigName = configName;
|
||||
|
||||
IConfig serverConfig = config.Configs[m_ConfigName];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
|
||||
|
||||
string assetService = serverConfig.GetString("AssetService", String.Empty);
|
||||
|
||||
if (assetService == String.Empty)
|
||||
throw new Exception("No AssetService in config file");
|
||||
|
||||
Object[] args = new Object[] { config };
|
||||
m_AssetService =
|
||||
ServerUtils.LoadPlugin<IAssetService>(assetService, args);
|
||||
|
||||
if (m_AssetService == null)
|
||||
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
|
||||
|
||||
server.AddStreamHandler(new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,299 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
|
||||
public class WebFetchInvDescHandler
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IInventoryService m_InventoryService;
|
||||
private ILibraryService m_LibraryService;
|
||||
private object m_fetchLock = new Object();
|
||||
|
||||
public WebFetchInvDescHandler(IInventoryService invService, ILibraryService libService)
|
||||
{
|
||||
m_InventoryService = invService;
|
||||
m_LibraryService = libService;
|
||||
}
|
||||
|
||||
public string FetchInventoryDescendentsRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
// nasty temporary hack here, the linden client falsely
|
||||
// identifies the uuid 00000000-0000-0000-0000-000000000000
|
||||
// as a string which breaks us
|
||||
//
|
||||
// correctly mark it as a uuid
|
||||
//
|
||||
request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
|
||||
|
||||
// another hack <integer>1</integer> results in a
|
||||
// System.ArgumentException: Object type System.Int32 cannot
|
||||
// be converted to target type: System.Boolean
|
||||
//
|
||||
request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
|
||||
request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
try
|
||||
{
|
||||
hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
|
||||
}
|
||||
catch (LLSD.LLSDParseException pe)
|
||||
{
|
||||
m_log.Error("[AGENT INVENTORY]: Fetch error: " + pe.Message);
|
||||
m_log.Error("Request: " + request.ToString());
|
||||
}
|
||||
|
||||
ArrayList foldersrequested = (ArrayList)hash["folders"];
|
||||
|
||||
string response = "";
|
||||
lock (m_fetchLock)
|
||||
{
|
||||
for (int i = 0; i < foldersrequested.Count; i++)
|
||||
{
|
||||
string inventoryitemstr = "";
|
||||
Hashtable inventoryhash = (Hashtable)foldersrequested[i];
|
||||
|
||||
LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents();
|
||||
|
||||
try
|
||||
{
|
||||
LLSDHelpers.DeserialiseOSDMap(inventoryhash, llsdRequest);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Debug("[CAPS]: caught exception doing OSD deserialize" + e);
|
||||
}
|
||||
LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest);
|
||||
|
||||
inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply);
|
||||
inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", "");
|
||||
inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", "");
|
||||
|
||||
response += inventoryitemstr;
|
||||
}
|
||||
|
||||
|
||||
if (response.Length == 0)
|
||||
{
|
||||
// Ter-guess: If requests fail a lot, the client seems to stop requesting descendants.
|
||||
// Therefore, I'm concluding that the client only has so many threads available to do requests
|
||||
// and when a thread stalls.. is stays stalled.
|
||||
// Therefore we need to return something valid
|
||||
response = "<llsd><map><key>folders</key><array /></map></llsd>";
|
||||
}
|
||||
else
|
||||
{
|
||||
response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>";
|
||||
}
|
||||
|
||||
//m_log.DebugFormat("[CAPS]: Replying to CAPS fetch inventory request with following xml");
|
||||
//m_log.Debug("[CAPS] "+response);
|
||||
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Construct an LLSD reply packet to a CAPS inventory request
|
||||
/// </summary>
|
||||
/// <param name="invFetch"></param>
|
||||
/// <returns></returns>
|
||||
private LLSDInventoryDescendents FetchInventoryReply(LLSDFetchInventoryDescendents invFetch)
|
||||
{
|
||||
LLSDInventoryDescendents reply = new LLSDInventoryDescendents();
|
||||
LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents();
|
||||
contents.agent_id = invFetch.owner_id;
|
||||
contents.owner_id = invFetch.owner_id;
|
||||
contents.folder_id = invFetch.folder_id;
|
||||
|
||||
reply.folders.Array.Add(contents);
|
||||
InventoryCollection inv = new InventoryCollection();
|
||||
inv.Folders = new List<InventoryFolderBase>();
|
||||
inv.Items = new List<InventoryItemBase>();
|
||||
int version = 0;
|
||||
|
||||
inv = Fetch(invFetch.owner_id, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version);
|
||||
|
||||
if (inv.Folders != null)
|
||||
{
|
||||
foreach (InventoryFolderBase invFolder in inv.Folders)
|
||||
{
|
||||
contents.categories.Array.Add(ConvertInventoryFolder(invFolder));
|
||||
}
|
||||
}
|
||||
|
||||
if (inv.Items != null)
|
||||
{
|
||||
foreach (InventoryItemBase invItem in inv.Items)
|
||||
{
|
||||
contents.items.Array.Add(ConvertInventoryItem(invItem));
|
||||
}
|
||||
}
|
||||
|
||||
contents.descendents = contents.items.Array.Count + contents.categories.Array.Count;
|
||||
contents.version = version;
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
public InventoryCollection Fetch(UUID agentID, UUID folderID, UUID ownerID,
|
||||
bool fetchFolders, bool fetchItems, int sortOrder, out int version)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[WEBFETCHINVENTORYDESCENDANTS]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
|
||||
fetchFolders, fetchItems, folderID, agentID);
|
||||
|
||||
version = 0;
|
||||
InventoryFolderImpl fold;
|
||||
if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner)
|
||||
if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
|
||||
{
|
||||
InventoryCollection ret = new InventoryCollection();
|
||||
ret.Folders = new List<InventoryFolderBase>();
|
||||
ret.Items = fold.RequestListOfItems();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
InventoryCollection contents = new InventoryCollection();
|
||||
|
||||
if (folderID != UUID.Zero)
|
||||
{
|
||||
contents = m_InventoryService.GetFolderContent(agentID, folderID);
|
||||
InventoryFolderBase containingFolder = new InventoryFolderBase();
|
||||
containingFolder.ID = folderID;
|
||||
containingFolder.Owner = agentID;
|
||||
containingFolder = m_InventoryService.GetFolder(containingFolder);
|
||||
if (containingFolder != null)
|
||||
version = containingFolder.Version;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Lost itemsm don't really need a version
|
||||
version = 1;
|
||||
}
|
||||
|
||||
return contents;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Convert an internal inventory folder object into an LLSD object.
|
||||
/// </summary>
|
||||
/// <param name="invFolder"></param>
|
||||
/// <returns></returns>
|
||||
private LLSDInventoryFolder ConvertInventoryFolder(InventoryFolderBase invFolder)
|
||||
{
|
||||
LLSDInventoryFolder llsdFolder = new LLSDInventoryFolder();
|
||||
llsdFolder.folder_id = invFolder.ID;
|
||||
llsdFolder.parent_id = invFolder.ParentID;
|
||||
llsdFolder.name = invFolder.Name;
|
||||
if (invFolder.Type < 0 || invFolder.Type >= TaskInventoryItem.Types.Length)
|
||||
llsdFolder.type = "-1";
|
||||
else
|
||||
llsdFolder.type = TaskInventoryItem.Types[invFolder.Type];
|
||||
llsdFolder.preferred_type = "-1";
|
||||
|
||||
return llsdFolder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert an internal inventory item object into an LLSD object.
|
||||
/// </summary>
|
||||
/// <param name="invItem"></param>
|
||||
/// <returns></returns>
|
||||
private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem)
|
||||
{
|
||||
LLSDInventoryItem llsdItem = new LLSDInventoryItem();
|
||||
llsdItem.asset_id = invItem.AssetID;
|
||||
llsdItem.created_at = invItem.CreationDate;
|
||||
llsdItem.desc = invItem.Description;
|
||||
llsdItem.flags = (int)invItem.Flags;
|
||||
llsdItem.item_id = invItem.ID;
|
||||
llsdItem.name = invItem.Name;
|
||||
llsdItem.parent_id = invItem.Folder;
|
||||
try
|
||||
{
|
||||
// TODO reevaluate after upgrade to libomv >= r2566. Probably should use UtilsConversions.
|
||||
llsdItem.type = TaskInventoryItem.Types[invItem.AssetType];
|
||||
llsdItem.inv_type = TaskInventoryItem.InvTypes[invItem.InvType];
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[CAPS]: Problem setting asset {0} inventory {1} types while converting inventory item {2}: {3}", invItem.AssetType, invItem.InvType, invItem.Name, e.Message);
|
||||
}
|
||||
llsdItem.permissions = new LLSDPermissions();
|
||||
llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
|
||||
llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions;
|
||||
llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions;
|
||||
llsdItem.permissions.group_id = invItem.GroupID;
|
||||
llsdItem.permissions.group_mask = (int)invItem.GroupPermissions;
|
||||
llsdItem.permissions.is_owner_group = invItem.GroupOwned;
|
||||
llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions;
|
||||
llsdItem.permissions.owner_id = invItem.Owner;
|
||||
llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
|
||||
llsdItem.sale_info = new LLSDSaleInfo();
|
||||
llsdItem.sale_info.sale_price = invItem.SalePrice;
|
||||
switch (invItem.SaleType)
|
||||
{
|
||||
default:
|
||||
llsdItem.sale_info.sale_type = "not";
|
||||
break;
|
||||
case 1:
|
||||
llsdItem.sale_info.sale_type = "original";
|
||||
break;
|
||||
case 2:
|
||||
llsdItem.sale_info.sale_type = "copy";
|
||||
break;
|
||||
case 3:
|
||||
llsdItem.sale_info.sale_type = "contents";
|
||||
break;
|
||||
}
|
||||
|
||||
return llsdItem;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* 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 Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class WebFetchInvDescServerConnector : ServiceConnector
|
||||
{
|
||||
private IInventoryService m_InventoryService;
|
||||
private ILibraryService m_LibraryService;
|
||||
private string m_ConfigName = "CapsService";
|
||||
|
||||
public WebFetchInvDescServerConnector(IConfigSource config, IHttpServer server, string configName) :
|
||||
base(config, server, configName)
|
||||
{
|
||||
if (configName != String.Empty)
|
||||
m_ConfigName = configName;
|
||||
|
||||
IConfig serverConfig = config.Configs[m_ConfigName];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
|
||||
|
||||
string invService = serverConfig.GetString("InventoryService", String.Empty);
|
||||
|
||||
if (invService == String.Empty)
|
||||
throw new Exception("No InventoryService in config file");
|
||||
|
||||
Object[] args = new Object[] { config };
|
||||
m_InventoryService =
|
||||
ServerUtils.LoadPlugin<IInventoryService>(invService, args);
|
||||
|
||||
if (m_InventoryService == null)
|
||||
throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName));
|
||||
|
||||
string libService = serverConfig.GetString("LibraryService", String.Empty);
|
||||
m_LibraryService =
|
||||
ServerUtils.LoadPlugin<ILibraryService>(libService, args);
|
||||
|
||||
WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
|
||||
IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/, webFetchHandler.FetchInventoryDescendentsRequest);
|
||||
server.AddStreamHandler(reqHandler);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -151,27 +151,6 @@ namespace OpenSim.Framework
|
|||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create AgentCircuitData from a Serializable AgentCircuitData
|
||||
/// </summary>
|
||||
/// <param name="cAgent"></param>
|
||||
public AgentCircuitData(sAgentCircuitData cAgent)
|
||||
{
|
||||
AgentID = new UUID(cAgent.AgentID);
|
||||
SessionID = new UUID(cAgent.SessionID);
|
||||
SecureSessionID = new UUID(cAgent.SecureSessionID);
|
||||
startpos = new Vector3(cAgent.startposx, cAgent.startposy, cAgent.startposz);
|
||||
firstname = cAgent.firstname;
|
||||
lastname = cAgent.lastname;
|
||||
circuitcode = cAgent.circuitcode;
|
||||
child = cAgent.child;
|
||||
InventoryFolder = new UUID(cAgent.InventoryFolder);
|
||||
BaseFolder = new UUID(cAgent.BaseFolder);
|
||||
CapsPath = cAgent.CapsPath;
|
||||
ChildrenCapSeeds = cAgent.ChildrenCapSeeds;
|
||||
Viewer = cAgent.Viewer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json
|
||||
/// </summary>
|
||||
|
@ -369,52 +348,4 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Serializable Agent Circuit Data
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class sAgentCircuitData
|
||||
{
|
||||
public Guid AgentID;
|
||||
public Guid BaseFolder;
|
||||
public string CapsPath = String.Empty;
|
||||
public Dictionary<ulong, string> ChildrenCapSeeds;
|
||||
public bool child;
|
||||
public uint circuitcode;
|
||||
public string firstname;
|
||||
public Guid InventoryFolder;
|
||||
public string lastname;
|
||||
public Guid SecureSessionID;
|
||||
public Guid SessionID;
|
||||
public float startposx;
|
||||
public float startposy;
|
||||
public float startposz;
|
||||
public string Viewer;
|
||||
public string Channel;
|
||||
public string Mac;
|
||||
public string Id0;
|
||||
|
||||
public sAgentCircuitData()
|
||||
{
|
||||
}
|
||||
|
||||
public sAgentCircuitData(AgentCircuitData cAgent)
|
||||
{
|
||||
AgentID = cAgent.AgentID.Guid;
|
||||
SessionID = cAgent.SessionID.Guid;
|
||||
SecureSessionID = cAgent.SecureSessionID.Guid;
|
||||
startposx = cAgent.startpos.X;
|
||||
startposy = cAgent.startpos.Y;
|
||||
startposz = cAgent.startpos.Z;
|
||||
firstname = cAgent.firstname;
|
||||
lastname = cAgent.lastname;
|
||||
circuitcode = cAgent.circuitcode;
|
||||
child = cAgent.child;
|
||||
InventoryFolder = cAgent.InventoryFolder.Guid;
|
||||
BaseFolder = cAgent.BaseFolder.Guid;
|
||||
CapsPath = cAgent.CapsPath;
|
||||
ChildrenCapSeeds = cAgent.ChildrenCapSeeds;
|
||||
Viewer = cAgent.Viewer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -27,7 +27,7 @@
|
|||
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Capabilities
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// Capabilities utility methods
|
|
@ -62,7 +62,7 @@ namespace OpenSim.Framework
|
|||
UUID AgentID { get; set; }
|
||||
|
||||
OSDMap Pack();
|
||||
void Unpack(OSDMap map);
|
||||
void Unpack(OSDMap map, IScene scene);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -122,7 +122,7 @@ namespace OpenSim.Framework
|
|||
return args;
|
||||
}
|
||||
|
||||
public void Unpack(OSDMap args)
|
||||
public void Unpack(OSDMap args, IScene scene)
|
||||
{
|
||||
if (args.ContainsKey("region_handle"))
|
||||
UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
|
||||
|
@ -329,6 +329,10 @@ namespace OpenSim.Framework
|
|||
|
||||
public string CallbackURI;
|
||||
|
||||
// These two must have the same Count
|
||||
public List<ISceneObject> AttachmentObjects;
|
||||
public List<string> AttachmentObjectStates;
|
||||
|
||||
public virtual OSDMap Pack()
|
||||
{
|
||||
m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
|
||||
|
@ -441,7 +445,30 @@ namespace OpenSim.Framework
|
|||
if ((CallbackURI != null) && (!CallbackURI.Equals("")))
|
||||
args["callback_uri"] = OSD.FromString(CallbackURI);
|
||||
|
||||
// Attachment objects for fatpack messages
|
||||
if (AttachmentObjects != null)
|
||||
{
|
||||
int i = 0;
|
||||
OSDArray attObjs = new OSDArray(AttachmentObjects.Count);
|
||||
foreach (ISceneObject so in AttachmentObjects)
|
||||
{
|
||||
OSDMap info = new OSDMap(4);
|
||||
info["sog"] = OSD.FromString(so.ToXml2());
|
||||
info["extra"] = OSD.FromString(so.ExtraToXmlString());
|
||||
info["modified"] = OSD.FromBoolean(so.HasGroupChanged);
|
||||
try
|
||||
{
|
||||
info["state"] = OSD.FromString(AttachmentObjectStates[i++]);
|
||||
}
|
||||
catch (IndexOutOfRangeException e)
|
||||
{
|
||||
m_log.WarnFormat("[CHILD AGENT DATA]: scripts list is shorter than object list.");
|
||||
}
|
||||
|
||||
attObjs.Add(info);
|
||||
}
|
||||
args["attach_objects"] = attObjs;
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
|
@ -450,7 +477,7 @@ namespace OpenSim.Framework
|
|||
/// Avoiding reflection makes it painful to write, but that's the price!
|
||||
/// </summary>
|
||||
/// <param name="hash"></param>
|
||||
public virtual void Unpack(OSDMap args)
|
||||
public virtual void Unpack(OSDMap args, IScene scene)
|
||||
{
|
||||
m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data");
|
||||
|
||||
|
@ -628,6 +655,26 @@ namespace OpenSim.Framework
|
|||
|
||||
if (args["callback_uri"] != null)
|
||||
CallbackURI = args["callback_uri"].AsString();
|
||||
|
||||
// Attachment objects
|
||||
if (args["attach_objects"] != null && args["attach_objects"].Type == OSDType.Array)
|
||||
{
|
||||
OSDArray attObjs = (OSDArray)(args["attach_objects"]);
|
||||
AttachmentObjects = new List<ISceneObject>();
|
||||
AttachmentObjectStates = new List<string>();
|
||||
foreach (OSD o in attObjs)
|
||||
{
|
||||
if (o.Type == OSDType.Map)
|
||||
{
|
||||
OSDMap info = (OSDMap)o;
|
||||
ISceneObject so = scene.DeserializeObject(info["sog"].AsString());
|
||||
so.ExtraFromXmlString(info["extra"].AsString());
|
||||
so.HasGroupChanged = info["modified"].AsBoolean();
|
||||
AttachmentObjects.Add(so);
|
||||
AttachmentObjectStates.Add(info["state"].AsString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AgentData()
|
||||
|
@ -655,9 +702,9 @@ namespace OpenSim.Framework
|
|||
return base.Pack();
|
||||
}
|
||||
|
||||
public override void Unpack(OSDMap map)
|
||||
public override void Unpack(OSDMap map, IScene scene)
|
||||
{
|
||||
base.Unpack(map);
|
||||
base.Unpack(map, scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,10 +31,9 @@ using System.Net;
|
|||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
[Serializable]
|
||||
public class ClientInfo
|
||||
{
|
||||
public sAgentCircuitData agentcircuit;
|
||||
public AgentCircuitData agentcircuit;
|
||||
|
||||
public Dictionary<uint, byte[]> needAck;
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ namespace OpenSim.Framework.Tests
|
|||
position2 = new AgentPosition();
|
||||
|
||||
Assert.IsFalse(position2.AgentID == position1.AgentID, "Test Error, position2 should be a blank uninitialized AgentPosition");
|
||||
position2.Unpack(position1.Pack());
|
||||
position2.Unpack(position1.Pack(), null);
|
||||
|
||||
Assert.IsTrue(position2.AgentID == position1.AgentID, "Agent ID didn't unpack the same way it packed");
|
||||
Assert.IsTrue(position2.Position == position1.Position, "Position didn't unpack the same way it packed");
|
||||
|
|
|
@ -140,19 +140,19 @@ namespace OpenSim.Framework
|
|||
/// PUT JSON-encoded data to a web service that returns LLSD or
|
||||
/// JSON data
|
||||
/// </summary>
|
||||
public static OSDMap PutToService(string url, OSDMap data)
|
||||
public static OSDMap PutToService(string url, OSDMap data, int timeout)
|
||||
{
|
||||
return ServiceOSDRequest(url,data,"PUT",10000);
|
||||
return ServiceOSDRequest(url,data, "PUT", timeout);
|
||||
}
|
||||
|
||||
public static OSDMap PostToService(string url, OSDMap data)
|
||||
|
||||
public static OSDMap PostToService(string url, OSDMap data, int timeout)
|
||||
{
|
||||
return ServiceOSDRequest(url,data,"POST",10000);
|
||||
return ServiceOSDRequest(url, data, "POST", timeout);
|
||||
}
|
||||
|
||||
public static OSDMap GetFromService(string url)
|
||||
|
||||
public static OSDMap GetFromService(string url, int timeout)
|
||||
{
|
||||
return ServiceOSDRequest(url,null,"GET",10000);
|
||||
return ServiceOSDRequest(url, null, "GET", timeout);
|
||||
}
|
||||
|
||||
public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout)
|
||||
|
@ -177,9 +177,9 @@ namespace OpenSim.Framework
|
|||
// If there is some input, write it into the request
|
||||
if (data != null)
|
||||
{
|
||||
string strBuffer = OSDParser.SerializeJsonString(data);
|
||||
string strBuffer = OSDParser.SerializeJsonString(data);
|
||||
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer);
|
||||
|
||||
|
||||
request.ContentType = "application/json";
|
||||
request.ContentLength = buffer.Length; //Count bytes to send
|
||||
using (Stream requestStream = request.GetRequestStream())
|
||||
|
|
|
@ -0,0 +1,938 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
using OpenMetaverse;
|
||||
using Nini.Config;
|
||||
using log4net;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Region.Framework;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
public delegate void UpLoadedAsset(
|
||||
string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder,
|
||||
byte[] data, string inventoryType, string assetType);
|
||||
|
||||
public delegate void UploadedBakedTexture(UUID assetID, byte[] data);
|
||||
|
||||
public delegate UUID UpdateItem(UUID itemID, byte[] data);
|
||||
|
||||
public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors);
|
||||
|
||||
public delegate void NewInventoryItem(UUID userID, InventoryItemBase item);
|
||||
|
||||
public delegate void NewAsset(AssetBase asset);
|
||||
|
||||
public delegate UUID ItemUpdatedCallback(UUID userID, UUID itemID, byte[] data);
|
||||
|
||||
public delegate ArrayList TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID,
|
||||
bool isScriptRunning, byte[] data);
|
||||
|
||||
public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID,
|
||||
bool fetchFolders, bool fetchItems, int sortOrder, out int version);
|
||||
|
||||
/// <summary>
|
||||
/// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that
|
||||
/// we can popup a message on the user's client if the inventory service has permanently failed). But I didn't want
|
||||
/// to just pass the whole Scene into CAPS.
|
||||
/// </summary>
|
||||
public delegate IClientAPI GetClientDelegate(UUID agentID);
|
||||
|
||||
public class BunchOfCaps
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_Scene;
|
||||
private Caps m_HostCapsObj;
|
||||
|
||||
private static readonly string m_requestPath = "0000/";
|
||||
// private static readonly string m_mapLayerPath = "0001/";
|
||||
private static readonly string m_newInventory = "0002/";
|
||||
//private static readonly string m_requestTexture = "0003/";
|
||||
private static readonly string m_notecardUpdatePath = "0004/";
|
||||
private static readonly string m_notecardTaskUpdatePath = "0005/";
|
||||
// private static readonly string m_fetchInventoryPath = "0006/";
|
||||
// private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule.
|
||||
private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule.
|
||||
|
||||
|
||||
// These are callbacks which will be setup by the scene so that we can update scene data when we
|
||||
// receive capability calls
|
||||
public NewInventoryItem AddNewInventoryItem = null;
|
||||
public NewAsset AddNewAsset = null;
|
||||
public ItemUpdatedCallback ItemUpdatedCall = null;
|
||||
public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null;
|
||||
public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null;
|
||||
public GetClientDelegate GetClient = null;
|
||||
|
||||
private bool m_persistBakedTextures = false;
|
||||
private IAssetService m_assetService;
|
||||
private bool m_dumpAssetsToFile;
|
||||
private string m_regionName;
|
||||
|
||||
public BunchOfCaps(Scene scene, Caps caps)
|
||||
{
|
||||
m_Scene = scene;
|
||||
m_HostCapsObj = caps;
|
||||
IConfigSource config = m_Scene.Config;
|
||||
if (config != null)
|
||||
{
|
||||
IConfig sconfig = config.Configs["Startup"];
|
||||
if (sconfig != null)
|
||||
m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
|
||||
}
|
||||
|
||||
m_assetService = m_Scene.AssetService;
|
||||
m_regionName = m_Scene.RegionInfo.RegionName;
|
||||
|
||||
RegisterHandlers();
|
||||
|
||||
AddNewInventoryItem = m_Scene.AddUploadedInventoryItem;
|
||||
ItemUpdatedCall = m_Scene.CapsUpdateInventoryItemAsset;
|
||||
TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset;
|
||||
CAPSFetchInventoryDescendents = m_Scene.HandleFetchInventoryDescendentsCAPS;
|
||||
GetClient = m_Scene.SceneContents.GetControllingClient;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register a bunch of CAPS http service handlers
|
||||
/// </summary>
|
||||
public void RegisterHandlers()
|
||||
{
|
||||
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
|
||||
|
||||
RegisterRegionServiceHandlers(capsBase);
|
||||
RegisterInventoryServiceHandlers(capsBase);
|
||||
}
|
||||
|
||||
public void RegisterRegionServiceHandlers(string capsBase)
|
||||
{
|
||||
try
|
||||
{
|
||||
// the root of all evil
|
||||
m_HostCapsObj.RegisterHandler("SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest));
|
||||
m_log.DebugFormat(
|
||||
"[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID);
|
||||
|
||||
//m_capsHandlers["MapLayer"] =
|
||||
// new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST",
|
||||
// capsBase + m_mapLayerPath,
|
||||
// GetMapLayer);
|
||||
IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory);
|
||||
m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req);
|
||||
m_HostCapsObj.RegisterHandler("UpdateScriptTask", req);
|
||||
m_HostCapsObj.RegisterHandler("UploadBakedTexture", new RestStreamHandler("POST", capsBase + m_uploadBakedTexturePath, UploadBakedTexture));
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[CAPS]: " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterInventoryServiceHandlers(string capsBase)
|
||||
{
|
||||
try
|
||||
{
|
||||
// I don't think this one works...
|
||||
m_HostCapsObj.RegisterHandler("NewFileAgentInventory", new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST",
|
||||
capsBase + m_newInventory,
|
||||
NewAgentInventoryRequest));
|
||||
IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory);
|
||||
m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req);
|
||||
m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req);
|
||||
m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req);
|
||||
|
||||
// As of RC 1.22.9 of the Linden client this is
|
||||
// supported
|
||||
|
||||
//m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest);
|
||||
|
||||
// justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and
|
||||
// subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires
|
||||
// enhancements (probably filling out the folder part of the LLSD reply) to our CAPS service,
|
||||
// but when I went on the Linden grid, the
|
||||
// simulators I visited (version 1.21) were, surprisingly, no longer supplying this capability. Instead,
|
||||
// the 1.19.1.4 client appeared to be happily flowing inventory data over UDP
|
||||
//
|
||||
// This is very probably just a temporary measure - once the CAPS service appears again on the Linden grid
|
||||
// we will be
|
||||
// able to get the data we need to implement the necessary part of the protocol to fix the issue above.
|
||||
// m_capsHandlers["FetchInventoryDescendents"] =
|
||||
// new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryRequest);
|
||||
|
||||
// m_capsHandlers["FetchInventoryDescendents"] =
|
||||
// new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST",
|
||||
// capsBase + m_fetchInventory,
|
||||
// FetchInventory));
|
||||
// m_capsHandlers["RequestTextureDownload"] = new RestStreamHandler("POST",
|
||||
// capsBase + m_requestTexture,
|
||||
// RequestTexture);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[CAPS]: " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Construct a client response detailing all the capabilities this server can provide.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <param name="httpRequest">HTTP request header object</param>
|
||||
/// <param name="httpResponse">HTTP response header object</param>
|
||||
/// <returns></returns>
|
||||
public string SeedCapRequest(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName);
|
||||
|
||||
if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint))
|
||||
{
|
||||
m_log.DebugFormat("[CAPS]: Unauthorized CAPS client");
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
Hashtable caps = m_HostCapsObj.CapsHandlers.CapsDetails;
|
||||
// Add the external too
|
||||
foreach (KeyValuePair<string, string> kvp in m_HostCapsObj.ExternalCapsHandlers)
|
||||
caps[kvp.Key] = kvp.Value;
|
||||
|
||||
string result = LLSDHelpers.SerialiseLLSDReply(caps);
|
||||
|
||||
//m_log.DebugFormat("[CAPS] CapsRequest {0}", result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called by the script task update handler. Provides a URL to which the client can upload a new asset.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <param name="httpRequest">HTTP request header object</param>
|
||||
/// <param name="httpResponse">HTTP response header object</param>
|
||||
/// <returns></returns>
|
||||
public string ScriptTaskInventory(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_log.Debug("[CAPS]: ScriptTaskInventory Request in region: " + m_regionName);
|
||||
//m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param);
|
||||
|
||||
Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
|
||||
LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate();
|
||||
LLSDHelpers.DeserialiseOSDMap(hash, llsdUpdateRequest);
|
||||
|
||||
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||
|
||||
TaskInventoryScriptUpdater uploader =
|
||||
new TaskInventoryScriptUpdater(
|
||||
llsdUpdateRequest.item_id,
|
||||
llsdUpdateRequest.task_id,
|
||||
llsdUpdateRequest.is_script_running,
|
||||
capsBase + uploaderPath,
|
||||
m_HostCapsObj.HttpListener,
|
||||
m_dumpAssetsToFile);
|
||||
uploader.OnUpLoad += TaskScriptUpdated;
|
||||
|
||||
m_HostCapsObj.HttpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
|
||||
|
||||
string protocol = "http://";
|
||||
|
||||
if (m_HostCapsObj.SSLCaps)
|
||||
protocol = "https://";
|
||||
|
||||
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase +
|
||||
uploaderPath;
|
||||
|
||||
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
|
||||
uploadResponse.uploader = uploaderURL;
|
||||
uploadResponse.state = "upload";
|
||||
|
||||
// m_log.InfoFormat("[CAPS]: " +
|
||||
// "ScriptTaskInventory response: {0}",
|
||||
// LLSDHelpers.SerialiseLLSDReply(uploadResponse)));
|
||||
|
||||
return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[CAPS]: " + e.ToString());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when new asset data for an agent inventory item update has been uploaded.
|
||||
/// </summary>
|
||||
/// <param name="itemID">Item to update</param>
|
||||
/// <param name="primID">Prim containing item to update</param>
|
||||
/// <param name="isScriptRunning">Signals whether the script to update is currently running</param>
|
||||
/// <param name="data">New asset data</param>
|
||||
public void TaskScriptUpdated(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors)
|
||||
{
|
||||
if (TaskScriptUpdatedCall != null)
|
||||
{
|
||||
ArrayList e = TaskScriptUpdatedCall(m_HostCapsObj.AgentID, itemID, primID, isScriptRunning, data);
|
||||
foreach (Object item in e)
|
||||
errors.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public string UploadBakedTexture(string request, string path,
|
||||
string param, OSHttpRequest httpRequest,
|
||||
OSHttpResponse httpResponse)
|
||||
{
|
||||
try
|
||||
{
|
||||
// m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " +
|
||||
// m_regionName);
|
||||
|
||||
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||
|
||||
BakedTextureUploader uploader =
|
||||
new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener);
|
||||
uploader.OnUpLoad += BakedTextureUploaded;
|
||||
|
||||
m_HostCapsObj.HttpListener.AddStreamHandler(
|
||||
new BinaryStreamHandler("POST", capsBase + uploaderPath,
|
||||
uploader.uploaderCaps));
|
||||
|
||||
string protocol = "http://";
|
||||
|
||||
if (m_HostCapsObj.SSLCaps)
|
||||
protocol = "https://";
|
||||
|
||||
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" +
|
||||
m_HostCapsObj.Port.ToString() + capsBase + uploaderPath;
|
||||
|
||||
LLSDAssetUploadResponse uploadResponse =
|
||||
new LLSDAssetUploadResponse();
|
||||
uploadResponse.uploader = uploaderURL;
|
||||
uploadResponse.state = "upload";
|
||||
|
||||
return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[CAPS]: " + e.ToString());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void BakedTextureUploaded(UUID assetID, byte[] data)
|
||||
{
|
||||
// m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
|
||||
|
||||
AssetBase asset;
|
||||
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString());
|
||||
asset.Data = data;
|
||||
asset.Temporary = true;
|
||||
asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are
|
||||
m_assetService.Store(asset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when new asset data for an agent inventory item update has been uploaded.
|
||||
/// </summary>
|
||||
/// <param name="itemID">Item to update</param>
|
||||
/// <param name="data">New asset data</param>
|
||||
/// <returns></returns>
|
||||
public UUID ItemUpdated(UUID itemID, byte[] data)
|
||||
{
|
||||
if (ItemUpdatedCall != null)
|
||||
{
|
||||
return ItemUpdatedCall(m_HostCapsObj.AgentID, itemID, data);
|
||||
}
|
||||
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="llsdRequest"></param>
|
||||
/// <returns></returns>
|
||||
public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest)
|
||||
{
|
||||
//m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString());
|
||||
//m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type);
|
||||
|
||||
if (llsdRequest.asset_type == "texture" ||
|
||||
llsdRequest.asset_type == "animation" ||
|
||||
llsdRequest.asset_type == "sound")
|
||||
{
|
||||
IClientAPI client = null;
|
||||
IScene scene = null;
|
||||
if (GetClient != null)
|
||||
{
|
||||
client = GetClient(m_HostCapsObj.AgentID);
|
||||
scene = client.Scene;
|
||||
|
||||
IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>();
|
||||
|
||||
if (mm != null)
|
||||
{
|
||||
if (!mm.UploadCovered(client, mm.UploadCharge))
|
||||
{
|
||||
if (client != null)
|
||||
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
|
||||
|
||||
LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
|
||||
errorResponse.uploader = "";
|
||||
errorResponse.state = "error";
|
||||
return errorResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string assetName = llsdRequest.name;
|
||||
string assetDes = llsdRequest.description;
|
||||
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
|
||||
UUID newAsset = UUID.Random();
|
||||
UUID newInvItem = UUID.Random();
|
||||
UUID parentFolder = llsdRequest.folder_id;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||
|
||||
AssetUploader uploader =
|
||||
new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
|
||||
llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile);
|
||||
m_HostCapsObj.HttpListener.AddStreamHandler(
|
||||
new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
|
||||
|
||||
string protocol = "http://";
|
||||
|
||||
if (m_HostCapsObj.SSLCaps)
|
||||
protocol = "https://";
|
||||
|
||||
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase +
|
||||
uploaderPath;
|
||||
|
||||
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
|
||||
uploadResponse.uploader = uploaderURL;
|
||||
uploadResponse.state = "upload";
|
||||
uploader.OnUpLoad += UploadCompleteHandler;
|
||||
return uploadResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="assetID"></param>
|
||||
/// <param name="inventoryItem"></param>
|
||||
/// <param name="data"></param>
|
||||
public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID,
|
||||
UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
|
||||
string assetType)
|
||||
{
|
||||
sbyte assType = 0;
|
||||
sbyte inType = 0;
|
||||
|
||||
if (inventoryType == "sound")
|
||||
{
|
||||
inType = 1;
|
||||
assType = 1;
|
||||
}
|
||||
else if (inventoryType == "animation")
|
||||
{
|
||||
inType = 19;
|
||||
assType = 20;
|
||||
}
|
||||
else if (inventoryType == "wearable")
|
||||
{
|
||||
inType = 18;
|
||||
switch (assetType)
|
||||
{
|
||||
case "bodypart":
|
||||
assType = 13;
|
||||
break;
|
||||
case "clothing":
|
||||
assType = 5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AssetBase asset;
|
||||
asset = new AssetBase(assetID, assetName, assType, m_HostCapsObj.AgentID.ToString());
|
||||
asset.Data = data;
|
||||
if (AddNewAsset != null)
|
||||
AddNewAsset(asset);
|
||||
else if (m_assetService != null)
|
||||
m_assetService.Store(asset);
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.Owner = m_HostCapsObj.AgentID;
|
||||
item.CreatorId = m_HostCapsObj.AgentID.ToString();
|
||||
item.CreatorData = String.Empty;
|
||||
item.ID = inventoryItem;
|
||||
item.AssetID = asset.FullID;
|
||||
item.Description = assetDescription;
|
||||
item.Name = assetName;
|
||||
item.AssetType = assType;
|
||||
item.InvType = inType;
|
||||
item.Folder = parentFolder;
|
||||
item.CurrentPermissions = (uint)PermissionMask.All;
|
||||
item.BasePermissions = (uint)PermissionMask.All;
|
||||
item.EveryOnePermissions = 0;
|
||||
item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
if (AddNewInventoryItem != null)
|
||||
{
|
||||
AddNewInventoryItem(m_HostCapsObj.AgentID, item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="mapReq"></param>
|
||||
/// <returns></returns>
|
||||
public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq)
|
||||
{
|
||||
m_log.Debug("[CAPS]: MapLayer Request in region: " + m_regionName);
|
||||
LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
|
||||
mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse());
|
||||
return mapResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected static OSDMapLayer GetOSDMapLayerResponse()
|
||||
{
|
||||
OSDMapLayer mapLayer = new OSDMapLayer();
|
||||
mapLayer.Right = 5000;
|
||||
mapLayer.Top = 5000;
|
||||
mapLayer.ImageID = new UUID("00000000-0000-1111-9999-000000000006");
|
||||
|
||||
return mapLayer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public string RequestTexture(string request, string path, string param)
|
||||
{
|
||||
m_log.Debug("texture request " + request);
|
||||
// Needs implementing (added to remove compiler warning)
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Called by the notecard update handler. Provides a URL to which the client can upload a new asset.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public string NoteCardAgentInventory(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
//m_log.Debug("[CAPS]: NoteCardAgentInventory Request in region: " + m_regionName + "\n" + request);
|
||||
//m_log.Debug("[CAPS]: NoteCardAgentInventory Request is: " + request);
|
||||
|
||||
//OpenMetaverse.StructuredData.OSDMap hash = (OpenMetaverse.StructuredData.OSDMap)OpenMetaverse.StructuredData.LLSDParser.DeserializeBinary(Utils.StringToBytes(request));
|
||||
Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
|
||||
LLSDItemUpdate llsdRequest = new LLSDItemUpdate();
|
||||
LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest);
|
||||
|
||||
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||
|
||||
ItemUpdater uploader =
|
||||
new ItemUpdater(llsdRequest.item_id, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile);
|
||||
uploader.OnUpLoad += ItemUpdated;
|
||||
|
||||
m_HostCapsObj.HttpListener.AddStreamHandler(
|
||||
new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
|
||||
|
||||
string protocol = "http://";
|
||||
|
||||
if (m_HostCapsObj.SSLCaps)
|
||||
protocol = "https://";
|
||||
|
||||
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase +
|
||||
uploaderPath;
|
||||
|
||||
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
|
||||
uploadResponse.uploader = uploaderURL;
|
||||
uploadResponse.state = "upload";
|
||||
|
||||
// m_log.InfoFormat("[CAPS]: " +
|
||||
// "NoteCardAgentInventory response: {0}",
|
||||
// LLSDHelpers.SerialiseLLSDReply(uploadResponse)));
|
||||
|
||||
return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
|
||||
}
|
||||
}
|
||||
|
||||
public class AssetUploader
|
||||
{
|
||||
public event UpLoadedAsset OnUpLoad;
|
||||
private UpLoadedAsset handlerUpLoad = null;
|
||||
|
||||
private string uploaderPath = String.Empty;
|
||||
private UUID newAssetID;
|
||||
private UUID inventoryItemID;
|
||||
private UUID parentFolder;
|
||||
private IHttpServer httpListener;
|
||||
private bool m_dumpAssetsToFile;
|
||||
private string m_assetName = String.Empty;
|
||||
private string m_assetDes = String.Empty;
|
||||
|
||||
private string m_invType = String.Empty;
|
||||
private string m_assetType = String.Empty;
|
||||
|
||||
public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem,
|
||||
UUID parentFolderID, string invType, string assetType, string path,
|
||||
IHttpServer httpServer, bool dumpAssetsToFile)
|
||||
{
|
||||
m_assetName = assetName;
|
||||
m_assetDes = description;
|
||||
newAssetID = assetID;
|
||||
inventoryItemID = inventoryItem;
|
||||
uploaderPath = path;
|
||||
httpListener = httpServer;
|
||||
parentFolder = parentFolderID;
|
||||
m_assetType = assetType;
|
||||
m_invType = invType;
|
||||
m_dumpAssetsToFile = dumpAssetsToFile;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public string uploaderCaps(byte[] data, string path, string param)
|
||||
{
|
||||
UUID inv = inventoryItemID;
|
||||
string res = String.Empty;
|
||||
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
|
||||
uploadComplete.new_asset = newAssetID.ToString();
|
||||
uploadComplete.new_inventory_item = inv;
|
||||
uploadComplete.state = "complete";
|
||||
|
||||
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
|
||||
|
||||
httpListener.RemoveStreamHandler("POST", uploaderPath);
|
||||
|
||||
// TODO: probably make this a better set of extensions here
|
||||
string extension = ".jp2";
|
||||
if (m_invType != "image")
|
||||
{
|
||||
extension = ".dat";
|
||||
}
|
||||
|
||||
if (m_dumpAssetsToFile)
|
||||
{
|
||||
SaveAssetToFile(m_assetName + extension, data);
|
||||
}
|
||||
handlerUpLoad = OnUpLoad;
|
||||
if (handlerUpLoad != null)
|
||||
{
|
||||
handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
///Left this in and commented in case there are unforseen issues
|
||||
//private void SaveAssetToFile(string filename, byte[] data)
|
||||
//{
|
||||
// FileStream fs = File.Create(filename);
|
||||
// BinaryWriter bw = new BinaryWriter(fs);
|
||||
// bw.Write(data);
|
||||
// bw.Close();
|
||||
// fs.Close();
|
||||
//}
|
||||
private static void SaveAssetToFile(string filename, byte[] data)
|
||||
{
|
||||
string assetPath = "UserAssets";
|
||||
if (!Directory.Exists(assetPath))
|
||||
{
|
||||
Directory.CreateDirectory(assetPath);
|
||||
}
|
||||
FileStream fs = File.Create(Path.Combine(assetPath, Util.safeFileName(filename)));
|
||||
BinaryWriter bw = new BinaryWriter(fs);
|
||||
bw.Write(data);
|
||||
bw.Close();
|
||||
fs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This class is a callback invoked when a client sends asset data to
|
||||
/// an agent inventory notecard update url
|
||||
/// </summary>
|
||||
public class ItemUpdater
|
||||
{
|
||||
public event UpdateItem OnUpLoad;
|
||||
|
||||
private UpdateItem handlerUpdateItem = null;
|
||||
|
||||
private string uploaderPath = String.Empty;
|
||||
private UUID inventoryItemID;
|
||||
private IHttpServer httpListener;
|
||||
private bool m_dumpAssetToFile;
|
||||
|
||||
public ItemUpdater(UUID inventoryItem, string path, IHttpServer httpServer, bool dumpAssetToFile)
|
||||
{
|
||||
m_dumpAssetToFile = dumpAssetToFile;
|
||||
|
||||
inventoryItemID = inventoryItem;
|
||||
uploaderPath = path;
|
||||
httpListener = httpServer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public string uploaderCaps(byte[] data, string path, string param)
|
||||
{
|
||||
UUID inv = inventoryItemID;
|
||||
string res = String.Empty;
|
||||
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
|
||||
UUID assetID = UUID.Zero;
|
||||
handlerUpdateItem = OnUpLoad;
|
||||
if (handlerUpdateItem != null)
|
||||
{
|
||||
assetID = handlerUpdateItem(inv, data);
|
||||
}
|
||||
|
||||
uploadComplete.new_asset = assetID.ToString();
|
||||
uploadComplete.new_inventory_item = inv;
|
||||
uploadComplete.state = "complete";
|
||||
|
||||
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
|
||||
|
||||
httpListener.RemoveStreamHandler("POST", uploaderPath);
|
||||
|
||||
if (m_dumpAssetToFile)
|
||||
{
|
||||
SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
///Left this in and commented in case there are unforseen issues
|
||||
//private void SaveAssetToFile(string filename, byte[] data)
|
||||
//{
|
||||
// FileStream fs = File.Create(filename);
|
||||
// BinaryWriter bw = new BinaryWriter(fs);
|
||||
// bw.Write(data);
|
||||
// bw.Close();
|
||||
// fs.Close();
|
||||
//}
|
||||
private static void SaveAssetToFile(string filename, byte[] data)
|
||||
{
|
||||
string assetPath = "UserAssets";
|
||||
if (!Directory.Exists(assetPath))
|
||||
{
|
||||
Directory.CreateDirectory(assetPath);
|
||||
}
|
||||
FileStream fs = File.Create(Path.Combine(assetPath, filename));
|
||||
BinaryWriter bw = new BinaryWriter(fs);
|
||||
bw.Write(data);
|
||||
bw.Close();
|
||||
fs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This class is a callback invoked when a client sends asset data to
|
||||
/// a task inventory script update url
|
||||
/// </summary>
|
||||
public class TaskInventoryScriptUpdater
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public event UpdateTaskScript OnUpLoad;
|
||||
|
||||
private UpdateTaskScript handlerUpdateTaskScript = null;
|
||||
|
||||
private string uploaderPath = String.Empty;
|
||||
private UUID inventoryItemID;
|
||||
private UUID primID;
|
||||
private bool isScriptRunning;
|
||||
private IHttpServer httpListener;
|
||||
private bool m_dumpAssetToFile;
|
||||
|
||||
public TaskInventoryScriptUpdater(UUID inventoryItemID, UUID primID, int isScriptRunning,
|
||||
string path, IHttpServer httpServer, bool dumpAssetToFile)
|
||||
{
|
||||
m_dumpAssetToFile = dumpAssetToFile;
|
||||
|
||||
this.inventoryItemID = inventoryItemID;
|
||||
this.primID = primID;
|
||||
|
||||
// This comes in over the packet as an integer, but actually appears to be treated as a bool
|
||||
this.isScriptRunning = (0 == isScriptRunning ? false : true);
|
||||
|
||||
uploaderPath = path;
|
||||
httpListener = httpServer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public string uploaderCaps(byte[] data, string path, string param)
|
||||
{
|
||||
try
|
||||
{
|
||||
// m_log.InfoFormat("[CAPS]: " +
|
||||
// "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}",
|
||||
// data, path, param));
|
||||
|
||||
string res = String.Empty;
|
||||
LLSDTaskScriptUploadComplete uploadComplete = new LLSDTaskScriptUploadComplete();
|
||||
|
||||
ArrayList errors = new ArrayList();
|
||||
handlerUpdateTaskScript = OnUpLoad;
|
||||
if (handlerUpdateTaskScript != null)
|
||||
{
|
||||
handlerUpdateTaskScript(inventoryItemID, primID, isScriptRunning, data, ref errors);
|
||||
}
|
||||
|
||||
uploadComplete.new_asset = inventoryItemID;
|
||||
uploadComplete.compiled = errors.Count > 0 ? false : true;
|
||||
uploadComplete.state = "complete";
|
||||
uploadComplete.errors = new OSDArray();
|
||||
uploadComplete.errors.Array = errors;
|
||||
|
||||
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
|
||||
|
||||
httpListener.RemoveStreamHandler("POST", uploaderPath);
|
||||
|
||||
if (m_dumpAssetToFile)
|
||||
{
|
||||
SaveAssetToFile("updatedtaskscript" + Util.RandomClass.Next(1, 1000) + ".dat", data);
|
||||
}
|
||||
|
||||
// m_log.InfoFormat("[CAPS]: TaskInventoryScriptUpdater.uploaderCaps res: {0}", res);
|
||||
|
||||
return res;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[CAPS]: " + e.ToString());
|
||||
}
|
||||
|
||||
// XXX Maybe this should be some meaningful error packet
|
||||
return null;
|
||||
}
|
||||
///Left this in and commented in case there are unforseen issues
|
||||
//private void SaveAssetToFile(string filename, byte[] data)
|
||||
//{
|
||||
// FileStream fs = File.Create(filename);
|
||||
// BinaryWriter bw = new BinaryWriter(fs);
|
||||
// bw.Write(data);
|
||||
// bw.Close();
|
||||
// fs.Close();
|
||||
//}
|
||||
private static void SaveAssetToFile(string filename, byte[] data)
|
||||
{
|
||||
string assetPath = "UserAssets";
|
||||
if (!Directory.Exists(assetPath))
|
||||
{
|
||||
Directory.CreateDirectory(assetPath);
|
||||
}
|
||||
FileStream fs = File.Create(Path.Combine(assetPath, filename));
|
||||
BinaryWriter bw = new BinaryWriter(fs);
|
||||
bw.Write(data);
|
||||
bw.Close();
|
||||
fs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public class BakedTextureUploader
|
||||
{
|
||||
public event UploadedBakedTexture OnUpLoad;
|
||||
private UploadedBakedTexture handlerUpLoad = null;
|
||||
|
||||
private string uploaderPath = String.Empty;
|
||||
private UUID newAssetID;
|
||||
private IHttpServer httpListener;
|
||||
|
||||
public BakedTextureUploader(string path, IHttpServer httpServer)
|
||||
{
|
||||
newAssetID = UUID.Random();
|
||||
uploaderPath = path;
|
||||
httpListener = httpServer;
|
||||
// m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
public string uploaderCaps(byte[] data, string path, string param)
|
||||
{
|
||||
handlerUpLoad = OnUpLoad;
|
||||
if (handlerUpLoad != null)
|
||||
{
|
||||
Util.FireAndForget(delegate(object o) { handlerUpLoad(newAssetID, data); });
|
||||
}
|
||||
|
||||
string res = String.Empty;
|
||||
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
|
||||
uploadComplete.new_asset = newAssetID.ToString();
|
||||
uploadComplete.new_inventory_item = UUID.Zero;
|
||||
uploadComplete.state = "complete";
|
||||
|
||||
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
|
||||
|
||||
httpListener.RemoveStreamHandler("POST", uploaderPath);
|
||||
|
||||
// m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using Mono.Addins;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
[assembly: Addin("LindenCaps", "0.1")]
|
||||
[assembly: AddinDependency("OpenSim", "0.5")]
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class BunchOfCapsModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_Scene;
|
||||
|
||||
#region INonSharedRegionModule
|
||||
|
||||
public string Name { get { return "BunchOfCapsModule"; } }
|
||||
|
||||
public Type ReplaceableInterface { get { return null; } }
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
}
|
||||
|
||||
public void Close() { }
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
m_Scene = scene;
|
||||
m_Scene.EventManager.OnRegisterCaps += OnRegisterCaps;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public void PostInitialise() { }
|
||||
#endregion
|
||||
|
||||
private void OnRegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
new BunchOfCaps(m_Scene, caps);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -33,6 +33,7 @@ using System.Reflection;
|
|||
using System.Threading;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using Mono.Addins;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Messages.Linden;
|
||||
using OpenMetaverse.Packets;
|
||||
|
@ -45,7 +46,7 @@ using OpenSim.Region.Framework.Scenes;
|
|||
using BlockingLLSDQueue = OpenSim.Framework.BlockingQueue<OpenMetaverse.StructuredData.OSD>;
|
||||
using Caps=OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
public struct QueueItem
|
||||
{
|
||||
|
@ -53,6 +54,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
public OSDMap body;
|
||||
}
|
||||
|
||||
//[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class EventQueueGetModule : IEventQueue, IRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
@ -275,9 +277,9 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
public void OnRegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
// Register an event queue for the client
|
||||
|
||||
|
||||
//m_log.DebugFormat(
|
||||
// "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}",
|
||||
// "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}",
|
||||
// agentID, caps, m_scene.RegionInfo.RegionName);
|
||||
|
||||
// Let's instantiate a Queue for this agent right now
|
||||
|
@ -320,7 +322,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
{
|
||||
return ProcessQueue(m_dhttpMethod, agentID, caps);
|
||||
}));
|
||||
|
||||
|
||||
// This will persist this beyond the expiry of the caps handlers
|
||||
MainServer.Instance.AddPollServiceHTTPHandler(
|
||||
capsBase + EventQueueGetUUID.ToString() + "/", EventQueuePoll, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID));
|
||||
|
@ -525,7 +527,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
}
|
||||
if (AvatarID != UUID.Zero)
|
||||
{
|
||||
return ProcessQueue(request, AvatarID, m_scene.CapsModule.GetCapsHandlerForUser(AvatarID));
|
||||
return ProcessQueue(request, AvatarID, m_scene.CapsModule.GetCapsForUser(AvatarID));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -720,5 +722,15 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
OSD item = EventQueueHelper.PlacesQuery(groupUpdate);
|
||||
Enqueue(item, avatarID);
|
||||
}
|
||||
|
||||
public OSD ScriptRunningEvent(UUID objectID, UUID itemID, bool running, bool mono)
|
||||
{
|
||||
return EventQueueHelper.ScriptRunningReplyEvent(objectID, itemID, running, mono);
|
||||
}
|
||||
|
||||
public OSD BuildEvent(string eventName, OSD eventBody)
|
||||
{
|
||||
return EventQueueHelper.BuildEvent(eventName, eventBody);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,7 +32,7 @@ using OpenMetaverse.Packets;
|
|||
using OpenMetaverse.StructuredData;
|
||||
using OpenMetaverse.Messages.Linden;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
public class EventQueueHelper
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
// return result;
|
||||
// }
|
||||
|
||||
public static OSD buildEvent(string eventName, OSD eventBody)
|
||||
public static OSD BuildEvent(string eventName, OSD eventBody)
|
||||
{
|
||||
OSDMap llsdEvent = new OSDMap(2);
|
||||
llsdEvent.Add("message", new OSDString(eventName));
|
||||
|
@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
OSDMap llsdBody = new OSDMap(1);
|
||||
llsdBody.Add("SimulatorInfo", arr);
|
||||
|
||||
return buildEvent("EnableSimulator", llsdBody);
|
||||
return BuildEvent("EnableSimulator", llsdBody);
|
||||
}
|
||||
|
||||
public static OSD DisableSimulator(ulong handle)
|
||||
|
@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
OSDMap llsdBody = new OSDMap(0);
|
||||
//llsdBody.Add("SimulatorInfo", arr);
|
||||
|
||||
return buildEvent("DisableSimulator", llsdBody);
|
||||
return BuildEvent("DisableSimulator", llsdBody);
|
||||
}
|
||||
|
||||
public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt,
|
||||
|
@ -144,7 +144,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
llsdBody.Add("AgentData", agentDataArr);
|
||||
llsdBody.Add("RegionData", regionDataArr);
|
||||
|
||||
return buildEvent("CrossedRegion", llsdBody);
|
||||
return BuildEvent("CrossedRegion", llsdBody);
|
||||
}
|
||||
|
||||
public static OSD TeleportFinishEvent(
|
||||
|
@ -167,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
OSDMap body = new OSDMap();
|
||||
body.Add("Info", infoArr);
|
||||
|
||||
return buildEvent("TeleportFinish", body);
|
||||
return BuildEvent("TeleportFinish", body);
|
||||
}
|
||||
|
||||
public static OSD ScriptRunningReplyEvent(UUID objectID, UUID itemID, bool running, bool mono)
|
||||
|
@ -184,7 +184,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
OSDMap body = new OSDMap();
|
||||
body.Add("Script", scriptArr);
|
||||
|
||||
return buildEvent("ScriptRunningReply", body);
|
||||
return BuildEvent("ScriptRunningReply", body);
|
||||
}
|
||||
|
||||
public static OSD EstablishAgentCommunication(UUID agentID, string simIpAndPort, string seedcap)
|
||||
|
@ -194,12 +194,12 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
body.Add("sim-ip-and-port", new OSDString(simIpAndPort));
|
||||
body.Add("seed-capability", new OSDString(seedcap));
|
||||
|
||||
return buildEvent("EstablishAgentCommunication", body);
|
||||
return BuildEvent("EstablishAgentCommunication", body);
|
||||
}
|
||||
|
||||
public static OSD KeepAliveEvent()
|
||||
{
|
||||
return buildEvent("FAKEEVENT", new OSDMap());
|
||||
return BuildEvent("FAKEEVENT", new OSDMap());
|
||||
}
|
||||
|
||||
public static OSD AgentParams(UUID agentID, bool checkEstate, int godLevel, bool limitedToEstate)
|
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using Mono.Addins;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Capabilities.Handlers;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class GetMeshModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
private IAssetService m_AssetService;
|
||||
private bool m_Enabled = true;
|
||||
private string m_URL;
|
||||
|
||||
#region IRegionModuleBase Members
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig config = source.Configs["ClientStack.LindenCaps"];
|
||||
if (config == null)
|
||||
return;
|
||||
|
||||
m_URL = config.GetString("Cap_GetMesh", string.Empty);
|
||||
// Cap doesn't exist
|
||||
if (m_URL != string.Empty)
|
||||
m_Enabled = true;
|
||||
}
|
||||
|
||||
public void AddRegion(Scene pScene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_scene = pScene;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
m_scene = null;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_AssetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
}
|
||||
|
||||
|
||||
public void Close() { }
|
||||
|
||||
public string Name { get { return "GetMeshModule"; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
//caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||
if (m_URL == "localhost")
|
||||
{
|
||||
m_log.InfoFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService);
|
||||
IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(),
|
||||
delegate(Hashtable m_dhttpMethod)
|
||||
{
|
||||
return gmeshHandler.ProcessGetMesh(m_dhttpMethod, UUID.Zero, null);
|
||||
});
|
||||
|
||||
caps.RegisterHandler("GetMesh", reqHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.InfoFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler("GetMesh", m_URL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using Mono.Addins;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenMetaverse.Imaging;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OpenSim.Capabilities.Handlers;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class GetTextureModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private Scene m_scene;
|
||||
private IAssetService m_assetService;
|
||||
|
||||
private bool m_Enabled = false;
|
||||
|
||||
// TODO: Change this to a config option
|
||||
const string REDIRECT_URL = null;
|
||||
|
||||
private string m_URL;
|
||||
|
||||
#region ISharedRegionModule Members
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig config = source.Configs["ClientStack.LindenCaps"];
|
||||
if (config == null)
|
||||
return;
|
||||
|
||||
m_URL = config.GetString("Cap_GetTexture", string.Empty);
|
||||
// Cap doesn't exist
|
||||
if (m_URL != string.Empty)
|
||||
m_Enabled = true;
|
||||
}
|
||||
|
||||
public void AddRegion(Scene s)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_scene = s;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene s)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
m_scene = null;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene s)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close() { }
|
||||
|
||||
public string Name { get { return "GetTextureModule"; } }
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
//caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||
if (m_URL == "localhost")
|
||||
{
|
||||
m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.InfoFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler("GetTexture", m_URL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -45,7 +45,7 @@ using OpenSim.Services.Interfaces;
|
|||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Assets
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule
|
||||
|
@ -171,8 +171,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
|
|||
UUID parentFolder = llsdRequest.folder_id;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000") + "/";
|
||||
|
||||
Caps.AssetUploader uploader =
|
||||
new Caps.AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
|
||||
AssetUploader uploader =
|
||||
new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
|
||||
llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile);
|
||||
MainServer.Instance.AddStreamHandler(
|
||||
new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
|
|
@ -39,7 +39,7 @@ using OpenSim.Region.Framework.Interfaces;
|
|||
using OpenSim.Region.Framework.Scenes;
|
||||
using Caps=OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
public class ObjectAdd : IRegionModule
|
||||
{
|
|
@ -48,10 +48,9 @@ using OSD = OpenMetaverse.StructuredData.OSD;
|
|||
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using ExtraParamType = OpenMetaverse.ExtraParamType;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class UploadObjectAssetModule : INonSharedRegionModule
|
||||
|
@ -374,4 +373,4 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
return String.Format("<binary encoding=\"base64\">{0}</binary>", Convert.ToBase64String(resultbytes));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using Mono.Addins;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OpenSim.Capabilities.Handlers;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class WebFetchInvDescModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private Scene m_scene;
|
||||
|
||||
private IInventoryService m_InventoryService;
|
||||
private ILibraryService m_LibraryService;
|
||||
private bool m_Enabled = false;
|
||||
private string m_URL;
|
||||
|
||||
#region ISharedRegionModule Members
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig config = source.Configs["ClientStack.LindenCaps"];
|
||||
if (config == null)
|
||||
return;
|
||||
|
||||
m_URL = config.GetString("Cap_WebFetchInventoryDescendents", string.Empty);
|
||||
// Cap doesn't exist
|
||||
if (m_URL != string.Empty)
|
||||
m_Enabled = true;
|
||||
}
|
||||
|
||||
public void AddRegion(Scene s)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_scene = s;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene s)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
m_scene = null;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene s)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_InventoryService = m_scene.InventoryService; ;
|
||||
m_LibraryService = m_scene.LibraryService;
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close() { }
|
||||
|
||||
public string Name { get { return "WebFetchInvDescModule"; } }
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
//caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||
if (m_URL == "localhost")
|
||||
{
|
||||
m_log.InfoFormat("[WEBFETCHINVENTORYDESCENDANTS]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
|
||||
IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), webFetchHandler.FetchInventoryDescendentsRequest);
|
||||
caps.RegisterHandler("WebFetchInventoryDescendents", reqHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.InfoFormat("[WEBFETCHINVENTORYDESCENDANTS]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler("WebFetchInventoryDescendents", m_URL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -11740,7 +11740,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
info.userEP = m_userEndPoint;
|
||||
info.proxyEP = null;
|
||||
info.agentcircuit = new sAgentCircuitData(RequestClientInfo());
|
||||
info.agentcircuit = RequestClientInfo();
|
||||
|
||||
return info;
|
||||
}
|
|
@ -562,14 +562,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
/// <param name="sp"></param>
|
||||
/// <param name="so"></param>
|
||||
/// <param name="attachmentpoint"></param>
|
||||
/// <param name="AttachOffset"></param>
|
||||
/// <param name="attachOffset"></param>
|
||||
/// <param name="silent"></param>
|
||||
protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 AttachOffset, bool silent)
|
||||
protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
|
||||
{
|
||||
// don't attach attachments to child agents
|
||||
if (avatar.IsChildAgent) return;
|
||||
|
||||
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name);
|
||||
m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", Name, avatar.Name,
|
||||
attachmentpoint, attachOffset, so.RootPart.AttachedPos);
|
||||
|
||||
so.DetachFromBackup();
|
||||
|
||||
|
@ -590,8 +589,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
so.RootPart.PhysActor = null;
|
||||
}
|
||||
|
||||
so.AbsolutePosition = AttachOffset;
|
||||
so.RootPart.AttachedPos = AttachOffset;
|
||||
so.AbsolutePosition = attachOffset;
|
||||
so.RootPart.AttachedPos = attachOffset;
|
||||
so.RootPart.IsAttachment = true;
|
||||
|
||||
so.RootPart.SetParentLocalId(avatar.LocalId);
|
||||
|
|
|
@ -31,6 +31,7 @@ using System.Collections.Generic;
|
|||
using System.Reflection;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using Mono.Addins;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
|
@ -38,8 +39,9 @@ using OpenSim.Region.Framework.Interfaces;
|
|||
using OpenSim.Region.Framework.Scenes;
|
||||
using Caps=OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Agent.Capabilities
|
||||
namespace OpenSim.Region.CoreModules.Framework
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class CapabilitiesModule : INonSharedRegionModule, ICapabilitiesModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
@ -49,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
|
|||
/// <summary>
|
||||
/// Each agent has its own capabilities handler.
|
||||
/// </summary>
|
||||
protected Dictionary<UUID, Caps> m_capsHandlers = new Dictionary<UUID, Caps>();
|
||||
protected Dictionary<UUID, Caps> m_capsObjects = new Dictionary<UUID, Caps>();
|
||||
|
||||
protected Dictionary<UUID, string> capsPaths = new Dictionary<UUID, string>();
|
||||
protected Dictionary<UUID, Dictionary<ulong, string>> childrenSeeds
|
||||
|
@ -93,19 +95,19 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
|
|||
get { return null; }
|
||||
}
|
||||
|
||||
public void AddCapsHandler(UUID agentId)
|
||||
public void CreateCaps(UUID agentId)
|
||||
{
|
||||
if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId))
|
||||
return;
|
||||
|
||||
String capsObjectPath = GetCapsPath(agentId);
|
||||
|
||||
if (m_capsHandlers.ContainsKey(agentId))
|
||||
if (m_capsObjects.ContainsKey(agentId))
|
||||
{
|
||||
Caps oldCaps = m_capsHandlers[agentId];
|
||||
Caps oldCaps = m_capsObjects[agentId];
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[CAPS]: Reregistering caps for agent {0}. Old caps path {1}, new caps path {2}. ",
|
||||
"[CAPS]: Recreating caps for agent {0}. Old caps path {1}, new caps path {2}. ",
|
||||
agentId, oldCaps.CapsObjectPath, capsObjectPath);
|
||||
// This should not happen. The caller code is confused. We need to fix that.
|
||||
// CAPs can never be reregistered, or the client will be confused.
|
||||
|
@ -113,39 +115,29 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
|
|||
//return;
|
||||
}
|
||||
|
||||
Caps caps
|
||||
= new Caps(m_scene,
|
||||
m_scene.AssetService, MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
|
||||
Caps caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
|
||||
(MainServer.Instance == null) ? 0: MainServer.Instance.Port,
|
||||
capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName);
|
||||
capsObjectPath, agentId, m_scene.RegionInfo.RegionName);
|
||||
|
||||
caps.RegisterHandlers();
|
||||
m_capsObjects[agentId] = caps;
|
||||
|
||||
m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps);
|
||||
|
||||
caps.AddNewInventoryItem = m_scene.AddUploadedInventoryItem;
|
||||
caps.ItemUpdatedCall = m_scene.CapsUpdateInventoryItemAsset;
|
||||
caps.TaskScriptUpdatedCall = m_scene.CapsUpdateTaskInventoryScriptAsset;
|
||||
caps.CAPSFetchInventoryDescendents = m_scene.HandleFetchInventoryDescendentsCAPS;
|
||||
caps.GetClient = m_scene.SceneContents.GetControllingClient;
|
||||
|
||||
m_capsHandlers[agentId] = caps;
|
||||
}
|
||||
|
||||
public void RemoveCapsHandler(UUID agentId)
|
||||
public void RemoveCaps(UUID agentId)
|
||||
{
|
||||
if (childrenSeeds.ContainsKey(agentId))
|
||||
{
|
||||
childrenSeeds.Remove(agentId);
|
||||
}
|
||||
|
||||
lock (m_capsHandlers)
|
||||
lock (m_capsObjects)
|
||||
{
|
||||
if (m_capsHandlers.ContainsKey(agentId))
|
||||
if (m_capsObjects.ContainsKey(agentId))
|
||||
{
|
||||
m_capsHandlers[agentId].DeregisterHandlers();
|
||||
m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsHandlers[agentId]);
|
||||
m_capsHandlers.Remove(agentId);
|
||||
m_capsObjects[agentId].DeregisterHandlers();
|
||||
m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsObjects[agentId]);
|
||||
m_capsObjects.Remove(agentId);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -156,20 +148,20 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
|
|||
}
|
||||
}
|
||||
|
||||
public Caps GetCapsHandlerForUser(UUID agentId)
|
||||
public Caps GetCapsForUser(UUID agentId)
|
||||
{
|
||||
lock (m_capsHandlers)
|
||||
lock (m_capsObjects)
|
||||
{
|
||||
if (m_capsHandlers.ContainsKey(agentId))
|
||||
if (m_capsObjects.ContainsKey(agentId))
|
||||
{
|
||||
return m_capsHandlers[agentId];
|
||||
return m_capsObjects[agentId];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void NewUserConnection(AgentCircuitData agent)
|
||||
public void SetAgentCapsSeeds(AgentCircuitData agent)
|
||||
{
|
||||
capsPaths[agent.AgentID] = agent.CapsPath;
|
||||
childrenSeeds[agent.AgentID]
|
||||
|
@ -239,7 +231,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
|
|||
System.Text.StringBuilder caps = new System.Text.StringBuilder();
|
||||
caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName);
|
||||
|
||||
foreach (KeyValuePair<UUID, Caps> kvp in m_capsHandlers)
|
||||
foreach (KeyValuePair<UUID, Caps> kvp in m_capsObjects)
|
||||
{
|
||||
caps.AppendFormat("** User {0}:\n", kvp.Key);
|
||||
for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); )
|
||||
|
@ -247,6 +239,8 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
|
|||
Uri uri = new Uri(kvp2.Value.ToString());
|
||||
caps.AppendFormat(" {0} = {1}\n", kvp2.Key, uri.PathAndQuery);
|
||||
}
|
||||
foreach (KeyValuePair<string, string> kvp3 in kvp.Value.ExternalCapsHandlers)
|
||||
caps.AppendFormat(" {0} = {1}\n", kvp3.Key, kvp3.Value);
|
||||
}
|
||||
|
||||
MainConsole.Instance.Output(caps.ToString());
|
|
@ -285,11 +285,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
}
|
||||
|
||||
string reason;
|
||||
if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out reason))
|
||||
string version;
|
||||
if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason))
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason);
|
||||
return;
|
||||
}
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version);
|
||||
|
||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||
|
||||
|
@ -371,20 +373,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
|
||||
}
|
||||
|
||||
// Expect avatar crossing is a heavy-duty function at the destination.
|
||||
// That is where MakeRoot is called, which fetches appearance and inventory.
|
||||
// Plus triggers OnMakeRoot, which spawns a series of asynchronous updates.
|
||||
//m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId,
|
||||
// position, false);
|
||||
|
||||
//{
|
||||
// avatar.ControllingClient.SendTeleportFailed("Problem with destination.");
|
||||
// // We should close that agent we just created over at destination...
|
||||
// List<ulong> lst = new List<ulong>();
|
||||
// lst.Add(reg.RegionHandle);
|
||||
// SendCloseChildAgentAsync(avatar.UUID, lst);
|
||||
// return;
|
||||
//}
|
||||
|
||||
SetInTransit(sp.UUID);
|
||||
|
||||
|
@ -426,7 +414,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
// TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
|
||||
// trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
|
||||
// that the client contacted the destination before we send the attachments and close things here.
|
||||
// that the client contacted the destination before we close things here.
|
||||
if (!WaitForCallback(sp.UUID))
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
|
@ -437,14 +425,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
return;
|
||||
}
|
||||
|
||||
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
|
||||
CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
|
||||
// For backwards compatibility
|
||||
if (version == "Unknown" || version == string.Empty)
|
||||
{
|
||||
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one...");
|
||||
CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
|
||||
}
|
||||
|
||||
// May need to logout or other cleanup
|
||||
AgentHasMovedAway(sp, logout);
|
||||
|
||||
// Well, this is it. The agent is over there.
|
||||
KillEntity(sp.Scene, sp.LocalId);
|
||||
|
||||
// May need to logout or other cleanup
|
||||
AgentHasMovedAway(sp.ControllingClient.SessionId, logout);
|
||||
|
||||
// Now let's make it officially a child agent
|
||||
sp.MakeChildAgent();
|
||||
|
@ -485,7 +479,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
// Fail. Reset it back
|
||||
sp.IsChildAgent = false;
|
||||
|
||||
ReInstantiateScripts(sp);
|
||||
ResetFromTransit(sp.UUID);
|
||||
|
||||
EnableChildAgents(sp);
|
||||
|
@ -513,8 +507,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
}
|
||||
|
||||
protected virtual void AgentHasMovedAway(UUID sessionID, bool logout)
|
||||
protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
|
||||
{
|
||||
foreach (SceneObjectGroup sop in sp.Attachments)
|
||||
{
|
||||
sop.Scene.DeleteSceneObject(sop, true);
|
||||
}
|
||||
sp.Attachments.Clear();
|
||||
}
|
||||
|
||||
protected void KillEntity(Scene scene, uint localID)
|
||||
|
@ -784,7 +783,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
|
||||
string reason;
|
||||
if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out reason))
|
||||
string version;
|
||||
if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out version, out reason))
|
||||
{
|
||||
agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
|
||||
if (r == null)
|
||||
|
@ -804,7 +804,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
agent.InTransit();
|
||||
|
||||
CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync;
|
||||
d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, CrossAgentToNewRegionCompleted, d);
|
||||
d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -861,17 +861,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
icon.EndInvoke(iar);
|
||||
}
|
||||
|
||||
public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying);
|
||||
public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version);
|
||||
|
||||
/// <summary>
|
||||
/// This Closes child agents on neighbouring regions
|
||||
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
|
||||
/// </summary>
|
||||
protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying)
|
||||
protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version)
|
||||
{
|
||||
ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
|
||||
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3}", agent.Firstname, agent.Lastname, neighbourx, neighboury);
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version);
|
||||
|
||||
Scene m_scene = agent.Scene;
|
||||
|
||||
|
@ -930,6 +930,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
if (!WaitForCallback(agent.UUID))
|
||||
{
|
||||
m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent");
|
||||
ReInstantiateScripts(agent);
|
||||
ResetFromTransit(agent.UUID);
|
||||
|
||||
// Yikes! We should just have a ref to scene here.
|
||||
|
@ -945,7 +946,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
agent.SendOtherAgentsAvatarDataToMe();
|
||||
agent.SendOtherAgentsAppearanceToMe();
|
||||
|
||||
CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
|
||||
// Backwards compatibility
|
||||
if (version == "Unknown" || version == string.Empty)
|
||||
{
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one...");
|
||||
CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
|
||||
}
|
||||
|
||||
AgentHasMovedAway(agent, false);
|
||||
|
||||
// the user may change their profile information in other region,
|
||||
// so the userinfo in UserProfileCache is not reliable any more, delete it
|
||||
|
@ -1752,7 +1760,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
return false;
|
||||
}
|
||||
|
||||
protected void ReInstantiateScripts(ScenePresence sp)
|
||||
{
|
||||
int i = 0;
|
||||
sp.Attachments.ForEach(delegate(SceneObjectGroup sog)
|
||||
{
|
||||
sog.SetState(sp.InTransitScriptStates[i++], sp.Scene);
|
||||
sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0);
|
||||
sog.ResumeScripts();
|
||||
});
|
||||
|
||||
sp.InTransitScriptStates.Clear();
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
|
|
@ -142,11 +142,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
return false;
|
||||
}
|
||||
|
||||
protected override void AgentHasMovedAway(UUID sessionID, bool logout)
|
||||
protected override void AgentHasMovedAway(ScenePresence sp, bool logout)
|
||||
{
|
||||
base.AgentHasMovedAway(sp, logout);
|
||||
if (logout)
|
||||
// Log them out of this grid
|
||||
m_aScene.PresenceService.LogoutAgent(sessionID);
|
||||
m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
|
||||
}
|
||||
|
||||
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
|
||||
|
|
|
@ -371,7 +371,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
}
|
||||
|
||||
// This is a hook to do some per-asset post-processing for subclasses that need that
|
||||
ExportAsset(remoteClient.AgentId, assetID);
|
||||
if (remoteClient != null)
|
||||
ExportAsset(remoteClient.AgentId, assetID);
|
||||
|
||||
return assetID;
|
||||
}
|
||||
|
|
|
@ -575,7 +575,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
|
|||
string derezAvatarPath = "/agent/" + AvatarRezCapUUID + "/rez_avatar/derez";
|
||||
// Get a reference to the user's cap so we can pull out the Caps Object Path
|
||||
Caps userCap
|
||||
= homeScene.CapsModule.GetCapsHandlerForUser(agentData.AgentID);
|
||||
= homeScene.CapsModule.GetCapsForUser(agentData.AgentID);
|
||||
|
||||
string rezHttpProtocol = "http://";
|
||||
string regionCapsHttpProtocol = "http://";
|
||||
|
@ -700,7 +700,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
|
|||
{
|
||||
// Get a referenceokay - to their Cap object so we can pull out the capobjectroot
|
||||
Caps userCap
|
||||
= homeScene.CapsModule.GetCapsHandlerForUser(userData.AgentID);
|
||||
= homeScene.CapsModule.GetCapsForUser(userData.AgentID);
|
||||
|
||||
//Update the circuit data in the region so this user is authorized
|
||||
homeScene.UpdateCircuitData(userData);
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
<RegionModule id="PrimCountModule" type="OpenSim.Region.CoreModules.World.Land.PrimCountModule" />
|
||||
<RegionModule id="ExportSerialisationModule" type="OpenSim.Region.CoreModules.World.Serialiser.SerialiserModule" />
|
||||
<RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" />
|
||||
<RegionModule id="CapabilitiesModule" type="OpenSim.Region.CoreModules.Agent.Capabilities.CapabilitiesModule" />
|
||||
<RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" />
|
||||
<RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" />
|
||||
<RegionModule id="Warp3DImageModule" type="OpenSim.Region.CoreModules.World.Warp3DMap.Warp3DImageModule" />
|
||||
|
|
|
@ -41,6 +41,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// Version of this service
|
||||
private const string m_Version = "SIMULATION/0.1";
|
||||
|
||||
private List<Scene> m_sceneList = new List<Scene>();
|
||||
|
||||
private IEntityTransferModule m_AgentTransferModule;
|
||||
|
@ -257,9 +260,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason)
|
||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
|
||||
{
|
||||
reason = "Communications failure";
|
||||
version = m_Version;
|
||||
if (destination == null)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
return true;
|
||||
|
||||
// else do the remote thing
|
||||
if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
|
||||
if (!m_localBackend.IsLocalRegion(destination.RegionID))
|
||||
{
|
||||
return m_remoteConnector.CreateAgent(destination, aCircuit, teleportFlags, out reason);
|
||||
}
|
||||
|
@ -230,19 +230,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
|
||||
}
|
||||
|
||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason)
|
||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
|
||||
{
|
||||
reason = "Communications failure";
|
||||
version = "Unknown";
|
||||
if (destination == null)
|
||||
return false;
|
||||
|
||||
// Try local first
|
||||
if (m_localBackend.QueryAccess(destination, id, position, out reason))
|
||||
if (m_localBackend.QueryAccess(destination, id, position, out version, out reason))
|
||||
return true;
|
||||
|
||||
// else do the remote thing
|
||||
if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
|
||||
return m_remoteConnector.QueryAccess(destination, id, position, out reason);
|
||||
if (!m_localBackend.IsLocalRegion(destination.RegionID))
|
||||
return m_remoteConnector.QueryAccess(destination, id, position, out version, out reason);
|
||||
|
||||
return false;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ using OpenSim.Framework.Capabilities;
|
|||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using Caps=OpenSim.Framework.Capabilities.Caps;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Region.DataSnapshot
|
||||
{
|
||||
|
|
|
@ -34,31 +34,27 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
{
|
||||
public interface ICapabilitiesModule
|
||||
{
|
||||
void NewUserConnection(AgentCircuitData agent);
|
||||
|
||||
/// <summary>
|
||||
/// Add a caps handler for the given agent. If the CAPS handler already exists for this agent,
|
||||
/// then it is replaced by a new CAPS handler.
|
||||
///
|
||||
/// FIXME: On login this is called twice, once for the login and once when the connection is made.
|
||||
/// This is somewhat innefficient and should be fixed. The initial login creation is necessary
|
||||
/// since the client asks for capabilities immediately after being informed of the seed.
|
||||
/// </summary>
|
||||
/// <param name="agentId"></param>
|
||||
/// <param name="capsObjectPath"></param>
|
||||
void AddCapsHandler(UUID agentId);
|
||||
void CreateCaps(UUID agentId);
|
||||
|
||||
/// <summary>
|
||||
/// Remove the caps handler for a given agent.
|
||||
/// </summary>
|
||||
/// <param name="agentId"></param>
|
||||
void RemoveCapsHandler(UUID agentId);
|
||||
void RemoveCaps(UUID agentId);
|
||||
|
||||
/// <summary>
|
||||
/// Will return null if the agent doesn't have a caps handler registered
|
||||
/// </summary>
|
||||
/// <param name="agentId"></param>
|
||||
Caps GetCapsHandlerForUser(UUID agentId);
|
||||
Caps GetCapsForUser(UUID agentId);
|
||||
|
||||
void SetAgentCapsSeeds(AgentCircuitData agent);
|
||||
|
||||
Dictionary<ulong, string> GetChildrenSeeds(UUID agentID);
|
||||
|
||||
|
|
|
@ -57,5 +57,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
bool isModerator, bool textMute);
|
||||
void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID);
|
||||
void GroupMembership(AgentGroupDataUpdatePacket groupUpdate, UUID avatarID);
|
||||
OSD ScriptRunningEvent(UUID objectID, UUID itemID, bool running, bool mono);
|
||||
OSD BuildEvent(string eventName, OSD eventBody);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1732,7 +1732,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
// Increment the frame counter
|
||||
++Frame;
|
||||
|
||||
try
|
||||
{
|
||||
// Check if any objects have reached their targets
|
||||
|
@ -2907,7 +2906,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <returns></returns>
|
||||
public bool IncomingCreateObject(ISceneObject sog)
|
||||
{
|
||||
//m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
|
||||
//m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
|
||||
// ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);
|
||||
|
||||
SceneObjectGroup newObject;
|
||||
try
|
||||
{
|
||||
|
@ -2925,9 +2926,29 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return false;
|
||||
}
|
||||
|
||||
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
|
||||
|
||||
newObject.ResumeScripts();
|
||||
// For attachments, we need to wait until the agent is root
|
||||
// before we restart the scripts, or else some functions won't work.
|
||||
if (!newObject.IsAttachment)
|
||||
{
|
||||
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
|
||||
newObject.ResumeScripts();
|
||||
}
|
||||
else
|
||||
{
|
||||
ScenePresence sp;
|
||||
if (TryGetScenePresence(newObject.OwnerID, out sp))
|
||||
{
|
||||
// If the scene presence is here and already a root
|
||||
// agent, we came from a ;egacy region. Start the scripts
|
||||
// here as they used to start.
|
||||
// TODO: Remove in 0.7.3
|
||||
if (!sp.IsChildAgent)
|
||||
{
|
||||
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
|
||||
newObject.ResumeScripts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do this as late as possible so that listeners have full access to the incoming object
|
||||
EventManager.TriggerOnIncomingSceneObject(newObject);
|
||||
|
@ -3044,17 +3065,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
ScenePresence sp = GetScenePresence(sog.OwnerID);
|
||||
|
||||
if (sp != null)
|
||||
{
|
||||
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(sp.UUID);
|
||||
return sp.GetStateSource();
|
||||
|
||||
if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
|
||||
{
|
||||
// This will get your attention
|
||||
//m_log.Error("[XXX] Triggering CHANGED_TELEPORT");
|
||||
|
||||
return 5; // StateSource.Teleporting
|
||||
}
|
||||
}
|
||||
return 2; // StateSource.PrimCrossing
|
||||
}
|
||||
|
||||
|
@ -3632,8 +3644,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
// If there is a CAPS handler, remove it now.
|
||||
// A Synced server region will not have a CAPS handler for its presences
|
||||
if(CapsModule != null && CapsModule.GetCapsHandlerForUser(agentID) != null)
|
||||
CapsModule.RemoveCapsHandler(agentID);
|
||||
if (CapsModule != null && CapsModule.GetCapsForUser(agentID) != null)
|
||||
CapsModule.RemoveCaps(agentID);
|
||||
|
||||
// REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
|
||||
// this method is doing is HORRIBLE!!!
|
||||
|
@ -3912,8 +3924,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (CapsModule != null)
|
||||
{
|
||||
CapsModule.NewUserConnection(agent);
|
||||
CapsModule.AddCapsHandler(agent.AgentID);
|
||||
CapsModule.SetAgentCapsSeeds(agent);
|
||||
CapsModule.CreateCaps(agent.AgentID);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3931,7 +3943,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
sp.AdjustKnownSeeds();
|
||||
|
||||
if (CapsModule != null)
|
||||
CapsModule.NewUserConnection(agent);
|
||||
CapsModule.SetAgentCapsSeeds(agent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -234,6 +234,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// holds the seed cap for the child agent in that region
|
||||
private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Copy of the script states while the agent is in transit. This state may
|
||||
/// need to be placed back in case of transfer fail.
|
||||
/// </summary>
|
||||
public List<string> InTransitScriptStates
|
||||
{
|
||||
get { return m_InTransitScriptStates; }
|
||||
}
|
||||
private List<string> m_InTransitScriptStates = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Implemented Control Flags
|
||||
/// </summary>
|
||||
|
@ -883,6 +893,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
//m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count);
|
||||
|
||||
bool wasChild = m_isChildAgent;
|
||||
m_isChildAgent = false;
|
||||
|
||||
IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
|
||||
if (gm != null)
|
||||
m_grouptitle = gm.GetGroupTitle(m_uuid);
|
||||
|
@ -972,14 +985,21 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Animator.SendAnimPack();
|
||||
|
||||
m_scene.SwapRootAgentCount(false);
|
||||
|
||||
//CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid);
|
||||
//if (userInfo != null)
|
||||
// userInfo.FetchInventory();
|
||||
//else
|
||||
// m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
|
||||
|
||||
m_isChildAgent = false;
|
||||
|
||||
// The initial login scene presence is already root when it gets here
|
||||
// and it has already rezzed the attachments and started their scripts.
|
||||
// We do the following only for non-login agents, because their scripts
|
||||
// haven't started yet.
|
||||
if (wasChild && Attachments != null && Attachments.Count > 0)
|
||||
{
|
||||
m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments...");
|
||||
// Resume scripts
|
||||
Attachments.ForEach(delegate(SceneObjectGroup sog)
|
||||
{
|
||||
sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
|
||||
sog.ResumeScripts();
|
||||
});
|
||||
}
|
||||
|
||||
// send the animations of the other presences to me
|
||||
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
|
||||
|
@ -991,6 +1011,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_scene.EventManager.TriggerOnMakeRootAgent(this);
|
||||
}
|
||||
|
||||
public int GetStateSource()
|
||||
{
|
||||
AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(UUID);
|
||||
|
||||
if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
|
||||
{
|
||||
// This will get your attention
|
||||
//m_log.Error("[XXX] Triggering CHANGED_TELEPORT");
|
||||
|
||||
return 5; // StateSource.Teleporting
|
||||
}
|
||||
return 2; // StateSource.PrimCrossing
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This turns a root agent into a child agent
|
||||
/// when an agent departs this region for a neighbor, this gets called.
|
||||
|
@ -1182,7 +1216,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
AbsolutePosition = pos;
|
||||
}
|
||||
|
||||
m_isChildAgent = false;
|
||||
bool m_flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
|
||||
MakeRootAgent(AbsolutePosition, m_flying);
|
||||
|
||||
|
@ -2450,6 +2483,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
// vars to support reduced update frequency when velocity is unchanged
|
||||
private Vector3 lastVelocitySentToAllClients = Vector3.Zero;
|
||||
private Vector3 lastPositionSentToAllClients = Vector3.Zero;
|
||||
private int lastTerseUpdateToAllClientsTick = Util.EnvironmentTickCount();
|
||||
|
||||
/// <summary>
|
||||
|
@ -2469,14 +2503,29 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
int currentTick = Util.EnvironmentTickCount();
|
||||
|
||||
// decrease update frequency when avatar is moving but velocity is not changing
|
||||
if (m_velocity.Length() < 0.01f
|
||||
|| Vector3.Distance(lastVelocitySentToAllClients, m_velocity) > 0.01f
|
||||
|| currentTick - lastTerseUpdateToAllClientsTick > 1500)
|
||||
// Decrease update frequency when avatar is moving but velocity is
|
||||
// not changing.
|
||||
// If there is a mismatch between distance travelled and expected
|
||||
// distance based on last velocity sent and velocity hasnt changed,
|
||||
// then send a new terse update
|
||||
|
||||
float timeSinceLastUpdate = (currentTick - lastTerseUpdateToAllClientsTick) * 0.001f;
|
||||
|
||||
Vector3 expectedPosition = lastPositionSentToAllClients + lastVelocitySentToAllClients * timeSinceLastUpdate;
|
||||
|
||||
float distanceError = Vector3.Distance(OffsetPosition, expectedPosition);
|
||||
|
||||
float speed = Velocity.Length();
|
||||
float velocidyDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity);
|
||||
|
||||
if (speed < 0.01f // allow rotation updates if avatar position is unchanged
|
||||
|| Math.Abs(distanceError) > 0.25f // arbitrary distance error threshold
|
||||
|| velocidyDiff > 0.01f) // did velocity change from last update?
|
||||
{
|
||||
m_perfMonMS = currentTick;
|
||||
lastVelocitySentToAllClients = m_velocity;
|
||||
lastVelocitySentToAllClients = Velocity;
|
||||
lastTerseUpdateToAllClientsTick = currentTick;
|
||||
lastPositionSentToAllClients = OffsetPosition;
|
||||
|
||||
m_scene.ForEachClient(SendTerseUpdateToClient);
|
||||
|
||||
|
@ -3188,54 +3237,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
cAgent.Appearance = new AvatarAppearance(m_appearance);
|
||||
|
||||
/*
|
||||
try
|
||||
{
|
||||
// We might not pass the Wearables in all cases...
|
||||
// They're only needed so that persistent changes to the appearance
|
||||
// are preserved in the new region where the user is moving to.
|
||||
// But in Hypergrid we might not let this happen.
|
||||
int i = 0;
|
||||
UUID[] wears = new UUID[m_appearance.Wearables.Length * 2];
|
||||
foreach (AvatarWearable aw in m_appearance.Wearables)
|
||||
{
|
||||
if (aw != null)
|
||||
{
|
||||
wears[i++] = aw.ItemID;
|
||||
wears[i++] = aw.AssetID;
|
||||
}
|
||||
else
|
||||
{
|
||||
wears[i++] = UUID.Zero;
|
||||
wears[i++] = UUID.Zero;
|
||||
}
|
||||
}
|
||||
cAgent.Wearables = wears;
|
||||
|
||||
cAgent.VisualParams = m_appearance.VisualParams;
|
||||
|
||||
if (m_appearance.Texture != null)
|
||||
cAgent.AgentTextures = m_appearance.Texture.GetBytes();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message);
|
||||
}
|
||||
|
||||
//Attachments
|
||||
List<int> attPoints = m_appearance.GetAttachedPoints();
|
||||
if (attPoints != null)
|
||||
{
|
||||
//m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count);
|
||||
int i = 0;
|
||||
AvatarAttachment[] attachs = new AvatarAttachment[attPoints.Count];
|
||||
foreach (int point in attPoints)
|
||||
{
|
||||
attachs[i++] = new AvatarAttachment(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point));
|
||||
}
|
||||
cAgent.Attachments = attachs;
|
||||
}
|
||||
*/
|
||||
lock (scriptedcontrols)
|
||||
{
|
||||
ControllerData[] controls = new ControllerData[scriptedcontrols.Count];
|
||||
|
@ -3255,9 +3256,29 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
catch { }
|
||||
|
||||
// cAgent.GroupID = ??
|
||||
// Groups???
|
||||
|
||||
// Attachment objects
|
||||
if (m_attachments != null && m_attachments.Count > 0)
|
||||
{
|
||||
cAgent.AttachmentObjects = new List<ISceneObject>();
|
||||
cAgent.AttachmentObjectStates = new List<string>();
|
||||
IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
|
||||
m_InTransitScriptStates.Clear();
|
||||
foreach (SceneObjectGroup sog in m_attachments)
|
||||
{
|
||||
// We need to make a copy and pass that copy
|
||||
// because of transfers withn the same sim
|
||||
ISceneObject clone = sog.CloneForNewScene();
|
||||
// Attachment module assumes that GroupPosition holds the offsets...!
|
||||
((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
|
||||
((SceneObjectGroup)clone).RootPart.IsAttachment = false;
|
||||
cAgent.AttachmentObjects.Add(clone);
|
||||
string state = sog.GetStateSnapshot();
|
||||
cAgent.AttachmentObjectStates.Add(state);
|
||||
m_InTransitScriptStates.Add(state);
|
||||
// Let's remove the scripts of the original object here
|
||||
sog.RemoveScriptInstances(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CopyFrom(AgentData cAgent)
|
||||
|
@ -3298,50 +3319,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
AddToPhysicalScene(isFlying);
|
||||
}
|
||||
|
||||
/*
|
||||
uint i = 0;
|
||||
try
|
||||
{
|
||||
if (cAgent.Wearables == null)
|
||||
cAgent.Wearables = new UUID[0];
|
||||
AvatarWearable[] wears = new AvatarWearable[cAgent.Wearables.Length / 2];
|
||||
for (uint n = 0; n < cAgent.Wearables.Length; n += 2)
|
||||
{
|
||||
UUID itemId = cAgent.Wearables[n];
|
||||
UUID assetId = cAgent.Wearables[n + 1];
|
||||
wears[i++] = new AvatarWearable(itemId, assetId);
|
||||
}
|
||||
// m_appearance.Wearables = wears;
|
||||
Primitive.TextureEntry textures = null;
|
||||
if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1)
|
||||
textures = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length);
|
||||
|
||||
byte[] visuals = null;
|
||||
|
||||
if ((cAgent.VisualParams != null) && (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
|
||||
visuals = (byte[])cAgent.VisualParams.Clone();
|
||||
|
||||
m_appearance = new AvatarAppearance(cAgent.AgentID,wears,textures,visuals);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message);
|
||||
}
|
||||
|
||||
// Attachments
|
||||
try
|
||||
{
|
||||
if (cAgent.Attachments != null)
|
||||
{
|
||||
m_appearance.ClearAttachments();
|
||||
foreach (AvatarAttachment att in cAgent.Attachments)
|
||||
{
|
||||
m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
*/
|
||||
try
|
||||
{
|
||||
lock (scriptedcontrols)
|
||||
|
@ -3371,8 +3348,18 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
catch { }
|
||||
|
||||
//cAgent.GroupID = ??
|
||||
//Groups???
|
||||
if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
|
||||
{
|
||||
m_attachments = new List<SceneObjectGroup>();
|
||||
int i = 0;
|
||||
foreach (ISceneObject so in cAgent.AttachmentObjects)
|
||||
{
|
||||
((SceneObjectGroup)so).LocalId = 0;
|
||||
((SceneObjectGroup)so).RootPart.UpdateFlag = 0;
|
||||
so.SetState(cAgent.AttachmentObjectStates[i++], m_scene);
|
||||
m_scene.IncomingCreateObject(so);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool CopyAgent(out IAgentData agent)
|
||||
|
|
|
@ -34,12 +34,9 @@ using Nini.Config;
|
|||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.CoreModules.Framework.EventQueue;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
|
@ -472,7 +469,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
if (queue != null)
|
||||
{
|
||||
queue.Enqueue(EventQueueHelper.buildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId);
|
||||
queue.Enqueue(queue.BuildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,13 +39,11 @@ using OpenMetaverse.StructuredData;
|
|||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Region.CoreModules.Framework.EventQueue;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags;
|
||||
|
||||
|
||||
|
@ -1154,7 +1152,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
if (queue != null)
|
||||
{
|
||||
queue.Enqueue(EventQueueHelper.buildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient));
|
||||
queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -88,7 +88,8 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
|
||||
decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache");
|
||||
cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps);
|
||||
useMeshiesPhysicsMesh = mesh_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh);
|
||||
if(mesh_config != null)
|
||||
useMeshiesPhysicsMesh = mesh_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -41,7 +41,6 @@ using log4net;
|
|||
using Nini.Config;
|
||||
using Amib.Threading;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.CoreModules.Framework.EventQueue;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.ScriptEngine.Shared;
|
||||
|
@ -1287,7 +1286,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
}
|
||||
else
|
||||
{
|
||||
eq.Enqueue(EventQueueHelper.ScriptRunningReplyEvent(objectID, itemID, GetScriptState(itemID), true),
|
||||
eq.Enqueue(eq.ScriptRunningEvent(objectID, itemID, GetScriptState(itemID), true),
|
||||
controllingClient.AgentId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ using OpenSim.Region.Framework.Interfaces;
|
|||
using OpenSim.Region.Framework.Scenes;
|
||||
using Mono.Data.SqliteClient;
|
||||
|
||||
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
using OSD = OpenMetaverse.StructuredData.OSD;
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
public class AgentHandler
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private ISimulationService m_SimulationService;
|
||||
|
||||
protected bool m_Proxy = false;
|
||||
|
@ -275,7 +276,7 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
AgentData agent = new AgentData();
|
||||
try
|
||||
{
|
||||
agent.Unpack(args);
|
||||
agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -295,7 +296,7 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
AgentPosition agent = new AgentPosition();
|
||||
try
|
||||
{
|
||||
agent.Unpack(args);
|
||||
agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -342,7 +343,8 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
destination.RegionID = regionID;
|
||||
|
||||
string reason;
|
||||
bool result = m_SimulationService.QueryAccess(destination, id, position, out reason);
|
||||
string version;
|
||||
bool result = m_SimulationService.QueryAccess(destination, id, position, out version, out reason);
|
||||
|
||||
responsedata["int_response_code"] = HttpStatusCode.OK;
|
||||
|
||||
|
@ -350,6 +352,7 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
|
||||
resp["success"] = OSD.FromBoolean(result);
|
||||
resp["reason"] = OSD.FromString(reason);
|
||||
resp["version"] = OSD.FromString(version);
|
||||
|
||||
responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
|
||||
}
|
||||
|
|
|
@ -314,7 +314,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
|
||||
args["teleport_flags"] = OSD.FromString(flags.ToString());
|
||||
|
||||
OSDMap result = WebUtil.PostToService(uri,args);
|
||||
OSDMap result = WebUtil.PostToService(uri, args, 20000);
|
||||
if (result["Success"].AsBoolean())
|
||||
{
|
||||
OSDMap unpacked = (OSDMap)result["_Result"];
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
|
||||
args["teleport_flags"] = OSD.FromString(flags.ToString());
|
||||
|
||||
OSDMap result = WebUtil.PostToService(uri,args);
|
||||
OSDMap result = WebUtil.PostToService(uri, args, 20000);
|
||||
if (result["Success"].AsBoolean())
|
||||
return true;
|
||||
|
||||
|
@ -126,7 +126,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
/// </summary>
|
||||
public bool UpdateAgent(GridRegion destination, AgentData data)
|
||||
{
|
||||
return UpdateAgent(destination, (IAgentData)data);
|
||||
return UpdateAgent(destination, (IAgentData)data, 200000); // yes, 200 seconds
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -181,7 +181,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
}
|
||||
}
|
||||
|
||||
UpdateAgent(destination,(IAgentData)pos);
|
||||
UpdateAgent(destination, (IAgentData)pos, 10000);
|
||||
}
|
||||
|
||||
// unreachable
|
||||
|
@ -191,7 +191,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
/// <summary>
|
||||
/// This is the worker function to send AgentData to a neighbor region
|
||||
/// </summary>
|
||||
private bool UpdateAgent(GridRegion destination, IAgentData cAgentData)
|
||||
private bool UpdateAgent(GridRegion destination, IAgentData cAgentData, int timeout)
|
||||
{
|
||||
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: UpdateAgent start");
|
||||
|
||||
|
@ -207,7 +207,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
args["destination_name"] = OSD.FromString(destination.RegionName);
|
||||
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
|
||||
|
||||
OSDMap result = WebUtil.PutToService(uri,args);
|
||||
OSDMap result = WebUtil.PutToService(uri, args, timeout);
|
||||
return result["Success"].AsBoolean();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -233,7 +233,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
|
||||
try
|
||||
{
|
||||
OSDMap result = WebUtil.GetFromService(uri);
|
||||
OSDMap result = WebUtil.GetFromService(uri, 10000);
|
||||
if (result["Success"].AsBoolean())
|
||||
{
|
||||
// OSDMap args = Util.GetOSDMap(result["_RawResult"].AsString());
|
||||
|
@ -241,7 +241,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
if (args != null)
|
||||
{
|
||||
agent = new CompleteAgentData();
|
||||
agent.Unpack(args);
|
||||
agent.Unpack(args, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -256,9 +256,10 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason)
|
||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
|
||||
{
|
||||
reason = "Failed to contact destination";
|
||||
version = "Unknown";
|
||||
|
||||
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position);
|
||||
|
||||
|
@ -275,9 +276,16 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
{
|
||||
OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000);
|
||||
bool success = result["success"].AsBoolean();
|
||||
reason = result["reason"].AsString();
|
||||
if (result.ContainsKey("_Result"))
|
||||
{
|
||||
OSDMap data = (OSDMap)result["_Result"];
|
||||
|
||||
//m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}", uri, success);
|
||||
reason = data["reason"].AsString();
|
||||
if (data["version"] != null && data["version"].AsString() != string.Empty)
|
||||
version = data["version"].AsString();
|
||||
|
||||
m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1} version {2} ({3})", uri, success, version, data["version"].AsString());
|
||||
}
|
||||
|
||||
if (!success)
|
||||
{
|
||||
|
@ -384,7 +392,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
args["destination_name"] = OSD.FromString(destination.RegionName);
|
||||
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
|
||||
|
||||
WebUtil.PostToService(uri, args);
|
||||
WebUtil.PostToService(uri, args, 40000);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace OpenSim.Services.Interfaces
|
|||
|
||||
bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent);
|
||||
|
||||
bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason);
|
||||
bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason);
|
||||
|
||||
/// <summary>
|
||||
/// Message from receiving region to departing region, telling it got contacted by the client.
|
||||
|
|
|
@ -32,7 +32,6 @@ using System.Net;
|
|||
using System.Reflection;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
|
||||
|
|
|
@ -38,7 +38,6 @@ using Nini.Config;
|
|||
using OpenMetaverse;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
|
|
@ -39,7 +39,6 @@ using OpenSim.Region.Physics.Manager;
|
|||
using OpenSim.Region.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.CoreModules.Agent.Capabilities;
|
||||
using OpenSim.Region.CoreModules.Avatar.Gods;
|
||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset;
|
||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication;
|
||||
|
|
|
@ -292,6 +292,20 @@
|
|||
;; building's lights to possibly not be rendered.
|
||||
; DisableFacelights = "false"
|
||||
|
||||
[ClientStack.LindenCaps]
|
||||
;; For the long list of capabilities, see OpenSimDefaults.ini
|
||||
;; Here are the few ones you may want to change. Possible values
|
||||
;; are:
|
||||
;; "" -- empty, capability disabled
|
||||
;; "localhost" -- capability enabled and served by the simulator
|
||||
;; "<url>" -- capability enabled and served by some other server
|
||||
;;
|
||||
; These are enabled by default to localhost. Change if you see fit.
|
||||
Cap_GetTexture = "localhost"
|
||||
Cap_GetMesh = "localhost"
|
||||
; This is disabled by default. Change if you see fit. Note that
|
||||
; serving this cap from the simulators may lead to poor performace.
|
||||
Cap_WebFetchInventoryDescendents = ""
|
||||
|
||||
[Chat]
|
||||
;# {whisper_distance} {} {Distance at which a whisper is heard, in meters?} {} 10
|
||||
|
|
|
@ -408,6 +408,74 @@
|
|||
;
|
||||
;DisableFacelights = "false"
|
||||
|
||||
[ClientStack.LindenCaps]
|
||||
;; Long list of capabilities taken from
|
||||
;; http://wiki.secondlife.com/wiki/Current_Sim_Capabilities
|
||||
;; Not all are supported by OpenSim. The ones supported are
|
||||
;; set to localhost. These defaults can be overwritten
|
||||
;; in OpenSim.ini
|
||||
;;
|
||||
Cap_AttachmentResources = ""
|
||||
Cap_AvatarPickerSearch = ""
|
||||
Cap_ChatSessionRequest = ""
|
||||
Cap_CopyInventoryFromNotecard = ""
|
||||
Cap_DispatchRegionInfo = ""
|
||||
Cap_EstateChangeInfo = ""
|
||||
Cap_EventQueueGet = "localhost"
|
||||
Cap_FetchInventory = ""
|
||||
Cap_ObjectMedia = "localhost"
|
||||
Cap_ObjectMediaNavigate = "localhost"
|
||||
Cap_FetchLib = ""
|
||||
Cap_FetchLibDescendents = ""
|
||||
Cap_GetDisplayNames = ""
|
||||
Cap_GetTexture = "localhost"
|
||||
Cap_GetMesh = "localhost"
|
||||
Cap_GetObjectCost = ""
|
||||
Cap_GetObjectPhysicsData = ""
|
||||
Cap_GroupProposalBallot = ""
|
||||
Cap_HomeLocation = ""
|
||||
Cap_LandResources = ""
|
||||
Cap_MapLayer = "localhost"
|
||||
Cap_MapLayerGod = "localhost"
|
||||
Cap_NewFileAgentInventory = "localhost"
|
||||
Cap_NewFileAgentInventoryVariablePrice = "localhost"
|
||||
Cap_ObjectAdd = "localhost"
|
||||
Cap_ParcelPropertiesUpdate = "localhost"
|
||||
Cap_ParcelMediaURLFilterList = ""
|
||||
Cap_ParcelNavigateMedia = ""
|
||||
Cap_ParcelVoiceInfoRequest = ""
|
||||
Cap_ProductInfoRequest = ""
|
||||
Cap_ProvisionVoiceAccountRequest = ""
|
||||
Cap_RemoteParcelRequest = "localhost"
|
||||
Cap_RequestTextureDownload = ""
|
||||
Cap_SearchStatRequest = ""
|
||||
Cap_SearchStatTracking = ""
|
||||
Cap_SendPostcard = ""
|
||||
Cap_SendUserReport = ""
|
||||
Cap_SendUserReportWithScreenshot = ""
|
||||
Cap_ServerReleaseNotes = ""
|
||||
Cap_SimConsole = ""
|
||||
Cap_SimulatorFeatures = ""
|
||||
Cap_SetDisplayName = ""
|
||||
Cap_StartGroupProposal = ""
|
||||
Cap_TextureStats = ""
|
||||
Cap_UntrustedSimulatorMessage = ""
|
||||
Cap_UpdateAgentInformation = ""
|
||||
Cap_UpdateAgentLanguage = ""
|
||||
Cap_UpdateGestureAgentInventory = ""
|
||||
Cap_UpdateNotecardAgentInventory = "localhost"
|
||||
Cap_UpdateScriptAgent = "localhost"
|
||||
Cap_UpdateGestureTaskInventory = ""
|
||||
Cap_UpdateNotecardTaskInventory = "localhost"
|
||||
Cap_UpdateScriptTask = "localhost"
|
||||
Cap_UploadBakedTexture = "localhost"
|
||||
Cap_UploadObjectAsset = "localhost"
|
||||
Cap_ViewerStartAuction = ""
|
||||
Cap_ViewerStats = ""
|
||||
; This last one is supported by OpenSim, but may
|
||||
; lead to poor sim performance if served by the simulators,
|
||||
; so it is disabled by default.
|
||||
Cap_WebFetchInventoryDescendents = ""
|
||||
|
||||
[Chat]
|
||||
; Controls whether the chat module is enabled. Default is true.
|
||||
|
|
151
prebuild.xml
151
prebuild.xml
|
@ -695,19 +695,19 @@
|
|||
</Files>
|
||||
</Project>
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Framework.Capabilities" path="OpenSim/Framework/Capabilities" type="Library">
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Capabilities" path="OpenSim/Capabilities" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
<OutputPath>../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
<OutputPath>../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../../bin/</ReferencePath>
|
||||
<ReferencePath>../../bin/</ReferencePath>
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="System.Web"/>
|
||||
|
@ -716,20 +716,20 @@
|
|||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Framework.Statistics"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<!-- FIXME: The OpenMetaverse.dll reference can be dropped when the TransferRequestPacket reference is removed from the code -->
|
||||
<Reference name="Nini" path="../../../bin/"/>
|
||||
<Reference name="log4net" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../bin/"/>
|
||||
<Reference name="Nini" path="../../bin/"/>
|
||||
<Reference name="log4net" path="../../bin/"/>
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true">
|
||||
<Match pattern="*.cs" recurse="false">
|
||||
<Exclude name="Tests" pattern="Tests"/>
|
||||
</Match>
|
||||
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Framework.Communications" path="OpenSim/Framework/Communications" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
|
@ -749,7 +749,6 @@
|
|||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.AssetLoader.Filesystem"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="OpenSim.Framework.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework.Servers"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
|
@ -795,7 +794,7 @@
|
|||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Capabilities"/>
|
||||
<Reference name="OpenSim.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework.Communications"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
|
@ -1220,7 +1219,6 @@
|
|||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
|
@ -1252,7 +1250,6 @@
|
|||
<Reference name="System"/>
|
||||
<Reference name="System.Core"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
|
@ -1306,7 +1303,6 @@
|
|||
</Files>
|
||||
</Project>
|
||||
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Server.Handlers" path="OpenSim/Server/Handlers" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
|
@ -1345,6 +1341,47 @@
|
|||
</Project>
|
||||
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Capabilities.Handlers" path="OpenSim/Capabilities/Handlers" 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.Drawing"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="System.Web"/>
|
||||
<Reference name="System.Core"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Server.Base"/>
|
||||
<Reference name="OpenSim.Server.Handlers"/>
|
||||
<Reference name="OpenSim.Services.Base"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="Nini" path="../../../bin/"/>
|
||||
<Reference name="log4net" path="../../../bin/"/>
|
||||
<Reference name="DotNetOpenId" path="../../../bin/"/>
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true">
|
||||
<Exclude pattern="Tests"/>
|
||||
</Match>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
|
||||
<Project frameworkVersion="v3_5" name="Robust" path="OpenSim/Server" type="Exe">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
|
@ -1437,8 +1474,8 @@
|
|||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="CSJ2K" path="../../../bin/"/>
|
||||
<Reference name="Warp3D" path="../../../bin/" localCopy="true"/>
|
||||
<Reference name="OpenSim.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework.Communications"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="OpenSim.Region.Framework"/>
|
||||
|
@ -1548,43 +1585,89 @@
|
|||
</Project>
|
||||
|
||||
<!-- ClientStack Plugins -->
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Region.ClientStack.LindenUDP" path="OpenSim/Region/ClientStack/LindenUDP" type="Library">
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Region.ClientStack.LindenUDP" path="OpenSim/Region/ClientStack/Linden/UDP" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../../../bin/</OutputPath>
|
||||
<OutputPath>../../../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../../../bin/</OutputPath>
|
||||
<OutputPath>../../../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../../../bin/</ReferencePath>
|
||||
<ReferencePath>../../../../../bin/</ReferencePath>
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Core"/>
|
||||
<Reference name="System.Drawing"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../../bin/"/>
|
||||
<Reference name="System.Web"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../../../bin/"/>
|
||||
<Reference name="OpenSim.Region.Framework"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="OpenSim.Framework.Servers"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Communications"/>
|
||||
<Reference name="OpenSim.Framework.Statistics"/>
|
||||
<Reference name="OpenSim.Region.ClientStack"/>
|
||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="XMLRPC" path="../../../../bin/"/>
|
||||
<Reference name="Nini" path="../../../../bin/"/>
|
||||
<Reference name="log4net" path="../../../../bin/"/>
|
||||
<Reference name="C5" path="../../../../bin/"/>
|
||||
<Reference name="Nini" path="../../../../bin/"/>
|
||||
<Reference name="Mono.Addins" path="../../../../bin/"/>
|
||||
<Reference name="Nini" path="../../../../../bin/"/>
|
||||
<Reference name="log4net" path="../../../../../bin/"/>
|
||||
<Reference name="C5" path="../../../../../bin/"/>
|
||||
<Reference name="Nini" path="../../../../../bin/"/>
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="false"/>
|
||||
<Match pattern="*.cs" recurse="true">
|
||||
<Exclude name="Tests" pattern="Tests"/>
|
||||
</Match>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Region.ClientStack.LindenCaps" path="OpenSim/Region/ClientStack/Linden/Caps" 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="System.Drawing"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="System.Web"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../../../bin/"/>
|
||||
<Reference name="OpenSim.Region.Framework"/>
|
||||
<Reference name="OpenSim.Capabilities"/>
|
||||
<Reference name="OpenSim.Capabilities.Handlers"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Servers"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="Mono.Addins" path="../../../../../bin/"/>
|
||||
<Reference name="Nini" path="../../../../../bin/"/>
|
||||
<Reference name="log4net" path="../../../../../bin/"/>
|
||||
<Reference name="Nini" path="../../../../../bin/"/>
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true">
|
||||
<Exclude name="Tests" pattern="Tests"/>
|
||||
</Match>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
|
@ -1609,16 +1692,16 @@
|
|||
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="PumaCode.SvnDotNet" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Communications"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="OpenSim.Framework.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Framework.Statistics"/>
|
||||
<Reference name="OpenSim.Region.ClientStack.LindenUDP"/>
|
||||
<Reference name="OpenSim.Region.CoreModules"/>
|
||||
<Reference name="OpenSim.Region.ClientStack.LindenUDP"/>
|
||||
<Reference name="OpenSim.Region.Framework"/>
|
||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||
<Reference name="OpenSim.Server.Base"/>
|
||||
|
@ -1949,8 +2032,8 @@
|
|||
<Reference name="System"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="System.Data"/>
|
||||
<Reference name="OpenSim.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework.Communications"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers"/>
|
||||
|
@ -2381,13 +2464,13 @@
|
|||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="OpenSim.Region.Framework"/>
|
||||
<Reference name="OpenSim.Region.CoreModules"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers"/>
|
||||
<Reference name="OpenSim.Framework.Capabilities"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Framework.Statistics"/>
|
||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||
|
|
Loading…
Reference in New Issue