diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Capabilities/Caps.cs | 172 | ||||
-rw-r--r-- | OpenSim/Capabilities/CapsHandlers.cs (renamed from OpenSim/Framework/Capabilities/CapsHandlers.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs (renamed from OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs) | 76 | ||||
-rw-r--r-- | OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs | 79 | ||||
-rw-r--r-- | OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs (renamed from OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs) | 61 | ||||
-rw-r--r-- | OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs | 69 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSD.cs (renamed from OpenSim/Framework/Capabilities/LLSD.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDArray.cs (renamed from OpenSim/Framework/Capabilities/LLSDArray.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDAssetUploadComplete.cs (renamed from OpenSim/Framework/Capabilities/LLSDAssetUploadComplete.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDAssetUploadRequest.cs (renamed from OpenSim/Framework/Capabilities/LLSDAssetUploadRequest.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDAssetUploadResponse.cs (renamed from OpenSim/Framework/Capabilities/LLSDAssetUploadResponse.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDCapEvent.cs (renamed from OpenSim/Framework/Capabilities/LLSDCapEvent.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDEmpty.cs (renamed from OpenSim/Framework/Capabilities/LLSDEmpty.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDHelpers.cs (renamed from OpenSim/Framework/Capabilities/LLSDHelpers.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDInventoryFolder.cs (renamed from OpenSim/Framework/Capabilities/LLSDInventoryFolder.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDInventoryItem.cs (renamed from OpenSim/Framework/Capabilities/LLSDInventoryItem.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDItemUpdate.cs (renamed from OpenSim/Framework/Capabilities/LLSDItemUpdate.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDMapLayer.cs (renamed from OpenSim/Framework/Capabilities/LLSDMapLayer.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDMapLayerResponse.cs (renamed from OpenSim/Framework/Capabilities/LLSDMapLayerResponse.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDMapRequest.cs (renamed from OpenSim/Framework/Capabilities/LLSDMapRequest.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDMethod.cs (renamed from OpenSim/Framework/Capabilities/LLSDMethod.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDMethodString.cs (renamed from OpenSim/Framework/Capabilities/LLSDMethodString.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDParcelVoiceInfoResponse.cs (renamed from OpenSim/Framework/Capabilities/LLSDParcelVoiceInfoResponse.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDRemoteParcelResponse.cs (renamed from OpenSim/Framework/Capabilities/LLSDRemoteParcelResponse.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDStreamHandler.cs (renamed from OpenSim/Framework/Capabilities/LLSDStreamHandler.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDTaskInventoryUploadComplete.cs (renamed from OpenSim/Framework/Capabilities/LLSDTaskInventoryUploadComplete.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDTaskScriptUpdate.cs (renamed from OpenSim/Framework/Capabilities/LLSDTaskScriptUpdate.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDTaskScriptUploadComplete.cs (renamed from OpenSim/Framework/Capabilities/LLSDTaskScriptUploadComplete.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDTest.cs (renamed from OpenSim/Framework/Capabilities/LLSDTest.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDType.cs (renamed from OpenSim/Framework/Capabilities/LLSDType.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Capabilities/LLSDVoiceAccountResponse.cs (renamed from OpenSim/Framework/Capabilities/LLSDVoiceAccountResponse.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Framework/CapsUtil.cs (renamed from OpenSim/Framework/Capabilities/CapsUtil.cs) | 2 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs (renamed from OpenSim/Framework/Capabilities/Caps.cs) | 1405 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs | 91 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs (renamed from OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs) | 16 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs (renamed from OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs) | 18 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | 136 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 139 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs (renamed from OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs) | 6 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs (renamed from OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs) | 2 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs (renamed from OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs) | 2 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/IncomingPacket.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/IncomingPacketHistoryCollection.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/IncomingPacketHistoryCollection.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/OutgoingPacket.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLPacketServer.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs (renamed from OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs) | 54 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | 2 | ||||
-rw-r--r-- | OpenSim/Region/DataSnapshot/DataRequestHandler.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/ICapabilitiesModule.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IEventQueue.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/UserStatistics/WebStatsModule.cs | 1 | ||||
-rw-r--r-- | OpenSim/Services/LLLoginService/LLLoginResponse.cs | 1 | ||||
-rw-r--r-- | OpenSim/Services/LLLoginService/LLLoginService.cs | 1 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 1 |
72 files changed, 1393 insertions, 983 deletions
diff --git a/OpenSim/Capabilities/Caps.cs b/OpenSim/Capabilities/Caps.cs new file mode 100644 index 0000000..95bb465 --- /dev/null +++ b/OpenSim/Capabilities/Caps.cs | |||
@@ -0,0 +1,172 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.IO; | ||
32 | using System.Reflection; | ||
33 | using log4net; | ||
34 | using Nini.Config; | ||
35 | using OpenMetaverse; | ||
36 | using OpenSim.Framework.Servers; | ||
37 | using OpenSim.Framework.Servers.HttpServer; | ||
38 | using OpenSim.Services.Interfaces; | ||
39 | |||
40 | // using OpenSim.Region.Framework.Interfaces; | ||
41 | |||
42 | namespace OpenSim.Framework.Capabilities | ||
43 | { | ||
44 | /// <summary> | ||
45 | /// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that | ||
46 | /// we can popup a message on the user's client if the inventory service has permanently failed). But I didn't want | ||
47 | /// to just pass the whole Scene into CAPS. | ||
48 | /// </summary> | ||
49 | public delegate IClientAPI GetClientDelegate(UUID agentID); | ||
50 | |||
51 | public class Caps | ||
52 | { | ||
53 | private static readonly ILog m_log = | ||
54 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
55 | |||
56 | private string m_httpListenerHostName; | ||
57 | private uint m_httpListenPort; | ||
58 | |||
59 | /// <summary> | ||
60 | /// This is the uuid portion of every CAPS path. It is used to make capability urls private to the requester. | ||
61 | /// </summary> | ||
62 | private string m_capsObjectPath; | ||
63 | public string CapsObjectPath { get { return m_capsObjectPath; } } | ||
64 | |||
65 | private CapsHandlers m_capsHandlers; | ||
66 | private Dictionary<string, string> m_externalCapsHandlers; | ||
67 | |||
68 | private IHttpServer m_httpListener; | ||
69 | private UUID m_agentID; | ||
70 | private string m_regionName; | ||
71 | |||
72 | public UUID AgentID | ||
73 | { | ||
74 | get { return m_agentID; } | ||
75 | } | ||
76 | |||
77 | public string RegionName | ||
78 | { | ||
79 | get { return m_regionName; } | ||
80 | } | ||
81 | |||
82 | public string HostName | ||
83 | { | ||
84 | get { return m_httpListenerHostName; } | ||
85 | } | ||
86 | |||
87 | public uint Port | ||
88 | { | ||
89 | get { return m_httpListenPort; } | ||
90 | } | ||
91 | |||
92 | public IHttpServer HttpListener | ||
93 | { | ||
94 | get { return m_httpListener; } | ||
95 | } | ||
96 | |||
97 | public bool SSLCaps | ||
98 | { | ||
99 | get { return m_httpListener.UseSSL; } | ||
100 | } | ||
101 | public string SSLCommonName | ||
102 | { | ||
103 | get { return m_httpListener.SSLCommonName; } | ||
104 | } | ||
105 | public CapsHandlers CapsHandlers | ||
106 | { | ||
107 | get { return m_capsHandlers; } | ||
108 | } | ||
109 | |||
110 | public Caps(IHttpServer httpServer, string httpListen, uint httpPort, string capsPath, | ||
111 | UUID agent, string regionName) | ||
112 | { | ||
113 | m_capsObjectPath = capsPath; | ||
114 | m_httpListener = httpServer; | ||
115 | m_httpListenerHostName = httpListen; | ||
116 | |||
117 | m_httpListenPort = httpPort; | ||
118 | |||
119 | if (httpServer != null && httpServer.UseSSL) | ||
120 | { | ||
121 | m_httpListenPort = httpServer.SSLPort; | ||
122 | httpListen = httpServer.SSLCommonName; | ||
123 | httpPort = httpServer.SSLPort; | ||
124 | } | ||
125 | |||
126 | m_agentID = agent; | ||
127 | m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL); | ||
128 | m_externalCapsHandlers = new Dictionary<string, string>(); | ||
129 | m_regionName = regionName; | ||
130 | } | ||
131 | |||
132 | /// <summary> | ||
133 | /// Register a handler. This allows modules to register handlers. | ||
134 | /// </summary> | ||
135 | /// <param name="capName"></param> | ||
136 | /// <param name="handler"></param> | ||
137 | public void RegisterHandler(string capName, IRequestHandler handler) | ||
138 | { | ||
139 | m_capsHandlers[capName] = handler; | ||
140 | //m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path); | ||
141 | } | ||
142 | |||
143 | /// <summary> | ||
144 | /// Register an external handler. The service for this capability is somewhere else | ||
145 | /// given by the URL. | ||
146 | /// </summary> | ||
147 | /// <param name="capsName"></param> | ||
148 | /// <param name="url"></param> | ||
149 | public void RegisterHandler(string capsName, string url) | ||
150 | { | ||
151 | m_externalCapsHandlers.Add(capsName, url); | ||
152 | } | ||
153 | |||
154 | /// <summary> | ||
155 | /// Remove all CAPS service handlers. | ||
156 | /// | ||
157 | /// </summary> | ||
158 | /// <param name="httpListener"></param> | ||
159 | /// <param name="path"></param> | ||
160 | /// <param name="restMethod"></param> | ||
161 | public void DeregisterHandlers() | ||
162 | { | ||
163 | if (m_capsHandlers != null) | ||
164 | { | ||
165 | foreach (string capsName in m_capsHandlers.Caps) | ||
166 | { | ||
167 | m_capsHandlers.Remove(capsName); | ||
168 | } | ||
169 | } | ||
170 | } | ||
171 | } | ||
172 | } | ||
diff --git a/OpenSim/Framework/Capabilities/CapsHandlers.cs b/OpenSim/Capabilities/CapsHandlers.cs index e1c800e..e1c800e 100644 --- a/OpenSim/Framework/Capabilities/CapsHandlers.cs +++ b/OpenSim/Capabilities/CapsHandlers.cs | |||
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs index fc1ddef..c60abb1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs +++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs | |||
@@ -31,7 +31,6 @@ using System.Collections.Specialized; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Web; | 33 | using System.Web; |
34 | using Mono.Addins; | ||
35 | using log4net; | 34 | using log4net; |
36 | using Nini.Config; | 35 | using Nini.Config; |
37 | using OpenMetaverse; | 36 | using OpenMetaverse; |
@@ -39,90 +38,23 @@ using OpenMetaverse.StructuredData; | |||
39 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Servers; | 39 | using OpenSim.Framework.Servers; |
41 | using OpenSim.Framework.Servers.HttpServer; | 40 | using OpenSim.Framework.Servers.HttpServer; |
42 | using OpenSim.Region.Framework.Interfaces; | ||
43 | using OpenSim.Region.Framework.Scenes; | ||
44 | using OpenSim.Services.Interfaces; | 41 | using OpenSim.Services.Interfaces; |
45 | using Caps = OpenSim.Framework.Capabilities.Caps; | 42 | using Caps = OpenSim.Framework.Capabilities.Caps; |
46 | 43 | ||
47 | namespace OpenSim.Region.CoreModules.Avatar.Assets | 44 | namespace OpenSim.Capabilities.Handlers |
48 | { | 45 | { |
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 46 | public class GetMeshHandler |
50 | public class GetMeshModule : INonSharedRegionModule | ||
51 | { | 47 | { |
52 | // private static readonly ILog m_log = | 48 | // private static readonly ILog m_log = |
53 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
54 | 50 | ||
55 | private Scene m_scene; | ||
56 | private IAssetService m_assetService; | 51 | private IAssetService m_assetService; |
57 | private bool m_enabled = true; | ||
58 | 52 | ||
59 | #region IRegionModuleBase Members | 53 | public GetMeshHandler(IAssetService assService) |
60 | |||
61 | |||
62 | public Type ReplaceableInterface | ||
63 | { | ||
64 | get { return null; } | ||
65 | } | ||
66 | |||
67 | public void Initialise(IConfigSource source) | ||
68 | { | ||
69 | IConfig meshConfig = source.Configs["Mesh"]; | ||
70 | if (meshConfig == null) | ||
71 | return; | ||
72 | |||
73 | m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true); | ||
74 | } | ||
75 | |||
76 | public void AddRegion(Scene pScene) | ||
77 | { | ||
78 | m_scene = pScene; | ||
79 | } | ||
80 | |||
81 | public void RemoveRegion(Scene scene) | ||
82 | { | 54 | { |
83 | 55 | m_assetService = assService; | |
84 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | ||
85 | m_scene = null; | ||
86 | } | 56 | } |
87 | 57 | ||
88 | public void RegionLoaded(Scene scene) | ||
89 | { | ||
90 | |||
91 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | ||
92 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
93 | } | ||
94 | |||
95 | #endregion | ||
96 | |||
97 | |||
98 | #region IRegionModule Members | ||
99 | |||
100 | |||
101 | |||
102 | public void Close() { } | ||
103 | |||
104 | public string Name { get { return "GetMeshModule"; } } | ||
105 | |||
106 | |||
107 | public void RegisterCaps(UUID agentID, Caps caps) | ||
108 | { | ||
109 | if(!m_enabled) | ||
110 | return; | ||
111 | |||
112 | UUID capID = UUID.Random(); | ||
113 | |||
114 | // m_log.Info("[GETMESH]: /CAPS/" + capID); | ||
115 | |||
116 | caps.RegisterHandler("GetMesh", | ||
117 | new RestHTTPHandler("GET", "/CAPS/" + capID, | ||
118 | delegate(Hashtable m_dhttpMethod) | ||
119 | { | ||
120 | return ProcessGetMesh(m_dhttpMethod, agentID, caps); | ||
121 | })); | ||
122 | } | ||
123 | |||
124 | #endregion | ||
125 | |||
126 | public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap) | 58 | public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap) |
127 | { | 59 | { |
128 | 60 | ||
diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs new file mode 100644 index 0000000..fa5f755 --- /dev/null +++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using Nini.Config; | ||
31 | using OpenSim.Server.Base; | ||
32 | using OpenSim.Services.Interfaces; | ||
33 | using OpenSim.Framework.Servers.HttpServer; | ||
34 | using OpenSim.Server.Handlers.Base; | ||
35 | using OpenSim.Framework.Servers; | ||
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | |||
38 | using OpenMetaverse; | ||
39 | |||
40 | namespace OpenSim.Capabilities.Handlers | ||
41 | { | ||
42 | public class GetMeshServerConnector : ServiceConnector | ||
43 | { | ||
44 | private IAssetService m_AssetService; | ||
45 | private string m_ConfigName = "CapsService"; | ||
46 | |||
47 | public GetMeshServerConnector(IConfigSource config, IHttpServer server, string configName) : | ||
48 | base(config, server, configName) | ||
49 | { | ||
50 | if (configName != String.Empty) | ||
51 | m_ConfigName = configName; | ||
52 | |||
53 | IConfig serverConfig = config.Configs[m_ConfigName]; | ||
54 | if (serverConfig == null) | ||
55 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); | ||
56 | |||
57 | string assetService = serverConfig.GetString("AssetService", String.Empty); | ||
58 | |||
59 | if (assetService == String.Empty) | ||
60 | throw new Exception("No AssetService in config file"); | ||
61 | |||
62 | Object[] args = new Object[] { config }; | ||
63 | m_AssetService = | ||
64 | ServerUtils.LoadPlugin<IAssetService>(assetService, args); | ||
65 | |||
66 | if (m_AssetService == null) | ||
67 | throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); | ||
68 | |||
69 | GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); | ||
70 | IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), | ||
71 | delegate(Hashtable m_dhttpMethod) | ||
72 | { | ||
73 | return gmeshHandler.ProcessGetMesh(m_dhttpMethod, UUID.Zero, null); | ||
74 | }); | ||
75 | server.AddStreamHandler(reqHandler); | ||
76 | } | ||
77 | |||
78 | } | ||
79 | } | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index df4d561..00ff3d0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | |||
@@ -42,39 +42,16 @@ using OpenSim.Framework; | |||
42 | using OpenSim.Framework.Servers; | 42 | using OpenSim.Framework.Servers; |
43 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
44 | using OpenSim.Region.Framework.Interfaces; | 44 | using OpenSim.Region.Framework.Interfaces; |
45 | using OpenSim.Region.Framework.Scenes; | ||
46 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
47 | using Caps = OpenSim.Framework.Capabilities.Caps; | 46 | using Caps = OpenSim.Framework.Capabilities.Caps; |
48 | 47 | ||
49 | namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps | 48 | namespace OpenSim.Capabilities.Handlers |
50 | { | 49 | { |
51 | #region Stream Handler | ||
52 | 50 | ||
53 | public delegate byte[] StreamHandlerCallback(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse); | 51 | public class GetTextureHandler : BaseStreamHandler |
54 | |||
55 | public class StreamHandler : BaseStreamHandler | ||
56 | { | ||
57 | StreamHandlerCallback m_callback; | ||
58 | |||
59 | public StreamHandler(string httpMethod, string path, StreamHandlerCallback callback) | ||
60 | : base(httpMethod, path) | ||
61 | { | ||
62 | m_callback = callback; | ||
63 | } | ||
64 | |||
65 | public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
66 | { | ||
67 | return m_callback(path, request, httpRequest, httpResponse); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | #endregion Stream Handler | ||
72 | |||
73 | public class GetTextureModule : IRegionModule | ||
74 | { | 52 | { |
75 | private static readonly ILog m_log = | 53 | private static readonly ILog m_log = |
76 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
77 | private Scene m_scene; | ||
78 | private IAssetService m_assetService; | 55 | private IAssetService m_assetService; |
79 | 56 | ||
80 | public const string DefaultFormat = "x-j2c"; | 57 | public const string DefaultFormat = "x-j2c"; |
@@ -82,44 +59,22 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps | |||
82 | // TODO: Change this to a config option | 59 | // TODO: Change this to a config option |
83 | const string REDIRECT_URL = null; | 60 | const string REDIRECT_URL = null; |
84 | 61 | ||
85 | 62 | public GetTextureHandler(string path, IAssetService assService) : | |
86 | #region IRegionModule Members | 63 | base("GET", path) |
87 | |||
88 | public void Initialise(Scene pScene, IConfigSource pSource) | ||
89 | { | ||
90 | m_scene = pScene; | ||
91 | } | ||
92 | |||
93 | public void PostInitialise() | ||
94 | { | 64 | { |
95 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | 65 | m_assetService = assService; |
96 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
97 | } | 66 | } |
98 | 67 | ||
99 | public void Close() { } | 68 | public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
100 | |||
101 | public string Name { get { return "GetTextureModule"; } } | ||
102 | public bool IsSharedModule { get { return false; } } | ||
103 | |||
104 | public void RegisterCaps(UUID agentID, Caps caps) | ||
105 | { | ||
106 | UUID capID = UUID.Random(); | ||
107 | |||
108 | // m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | ||
109 | caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); | ||
110 | } | ||
111 | |||
112 | #endregion | ||
113 | |||
114 | private byte[] ProcessGetTexture(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
115 | { | 69 | { |
116 | //m_log.DebugFormat("[GETTEXTURE]: called in {0}", m_scene.RegionInfo.RegionName); | ||
117 | 70 | ||
118 | // Try to parse the texture ID from the request URL | 71 | // Try to parse the texture ID from the request URL |
119 | NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); | 72 | NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); |
120 | string textureStr = query.GetOne("texture_id"); | 73 | string textureStr = query.GetOne("texture_id"); |
121 | string format = query.GetOne("format"); | 74 | string format = query.GetOne("format"); |
122 | 75 | ||
76 | m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr); | ||
77 | |||
123 | if (m_assetService == null) | 78 | if (m_assetService == null) |
124 | { | 79 | { |
125 | m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service"); | 80 | m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service"); |
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs new file mode 100644 index 0000000..0335eac --- /dev/null +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using Nini.Config; | ||
30 | using OpenSim.Server.Base; | ||
31 | using OpenSim.Services.Interfaces; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | ||
33 | using OpenSim.Server.Handlers.Base; | ||
34 | using OpenMetaverse; | ||
35 | |||
36 | namespace OpenSim.Capabilities.Handlers | ||
37 | { | ||
38 | public class GetTextureServerConnector : ServiceConnector | ||
39 | { | ||
40 | private IAssetService m_AssetService; | ||
41 | private string m_ConfigName = "CapsService"; | ||
42 | |||
43 | public GetTextureServerConnector(IConfigSource config, IHttpServer server, string configName) : | ||
44 | base(config, server, configName) | ||
45 | { | ||
46 | if (configName != String.Empty) | ||
47 | m_ConfigName = configName; | ||
48 | |||
49 | IConfig serverConfig = config.Configs[m_ConfigName]; | ||
50 | if (serverConfig == null) | ||
51 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); | ||
52 | |||
53 | string assetService = serverConfig.GetString("AssetService", String.Empty); | ||
54 | |||
55 | if (assetService == String.Empty) | ||
56 | throw new Exception("No AssetService in config file"); | ||
57 | |||
58 | Object[] args = new Object[] { config }; | ||
59 | m_AssetService = | ||
60 | ServerUtils.LoadPlugin<IAssetService>(assetService, args); | ||
61 | |||
62 | if (m_AssetService == null) | ||
63 | throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); | ||
64 | |||
65 | server.AddStreamHandler(new GetTextureHandler("/CAPS/" + UUID.Random() + "/", m_AssetService)); | ||
66 | } | ||
67 | |||
68 | } | ||
69 | } | ||
diff --git a/OpenSim/Framework/Capabilities/LLSD.cs b/OpenSim/Capabilities/LLSD.cs index eec9e61..eec9e61 100644 --- a/OpenSim/Framework/Capabilities/LLSD.cs +++ b/OpenSim/Capabilities/LLSD.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDArray.cs b/OpenSim/Capabilities/LLSDArray.cs index 3459e49..3459e49 100644 --- a/OpenSim/Framework/Capabilities/LLSDArray.cs +++ b/OpenSim/Capabilities/LLSDArray.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Capabilities/LLSDAssetUploadComplete.cs index ab6cee5..ab6cee5 100644 --- a/OpenSim/Framework/Capabilities/LLSDAssetUploadComplete.cs +++ b/OpenSim/Capabilities/LLSDAssetUploadComplete.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDAssetUploadRequest.cs b/OpenSim/Capabilities/LLSDAssetUploadRequest.cs index 6e66f0a..6e66f0a 100644 --- a/OpenSim/Framework/Capabilities/LLSDAssetUploadRequest.cs +++ b/OpenSim/Capabilities/LLSDAssetUploadRequest.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDAssetUploadResponse.cs b/OpenSim/Capabilities/LLSDAssetUploadResponse.cs index 0d6f7f9..0d6f7f9 100644 --- a/OpenSim/Framework/Capabilities/LLSDAssetUploadResponse.cs +++ b/OpenSim/Capabilities/LLSDAssetUploadResponse.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDCapEvent.cs b/OpenSim/Capabilities/LLSDCapEvent.cs index 63abd62..63abd62 100644 --- a/OpenSim/Framework/Capabilities/LLSDCapEvent.cs +++ b/OpenSim/Capabilities/LLSDCapEvent.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDEmpty.cs b/OpenSim/Capabilities/LLSDEmpty.cs index f94fcba..f94fcba 100644 --- a/OpenSim/Framework/Capabilities/LLSDEmpty.cs +++ b/OpenSim/Capabilities/LLSDEmpty.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDHelpers.cs b/OpenSim/Capabilities/LLSDHelpers.cs index 8f1a40e..8f1a40e 100644 --- a/OpenSim/Framework/Capabilities/LLSDHelpers.cs +++ b/OpenSim/Capabilities/LLSDHelpers.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDInventoryFolder.cs b/OpenSim/Capabilities/LLSDInventoryFolder.cs index 3c216e9..3c216e9 100644 --- a/OpenSim/Framework/Capabilities/LLSDInventoryFolder.cs +++ b/OpenSim/Capabilities/LLSDInventoryFolder.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDInventoryItem.cs b/OpenSim/Capabilities/LLSDInventoryItem.cs index cce18d7..cce18d7 100644 --- a/OpenSim/Framework/Capabilities/LLSDInventoryItem.cs +++ b/OpenSim/Capabilities/LLSDInventoryItem.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDItemUpdate.cs b/OpenSim/Capabilities/LLSDItemUpdate.cs index 96e2b61..96e2b61 100644 --- a/OpenSim/Framework/Capabilities/LLSDItemUpdate.cs +++ b/OpenSim/Capabilities/LLSDItemUpdate.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDMapLayer.cs b/OpenSim/Capabilities/LLSDMapLayer.cs index 4aeb1ff..4aeb1ff 100644 --- a/OpenSim/Framework/Capabilities/LLSDMapLayer.cs +++ b/OpenSim/Capabilities/LLSDMapLayer.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Capabilities/LLSDMapLayerResponse.cs index 839e34c..839e34c 100644 --- a/OpenSim/Framework/Capabilities/LLSDMapLayerResponse.cs +++ b/OpenSim/Capabilities/LLSDMapLayerResponse.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDMapRequest.cs b/OpenSim/Capabilities/LLSDMapRequest.cs index debf387..debf387 100644 --- a/OpenSim/Framework/Capabilities/LLSDMapRequest.cs +++ b/OpenSim/Capabilities/LLSDMapRequest.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDMethod.cs b/OpenSim/Capabilities/LLSDMethod.cs index cd2574d..cd2574d 100644 --- a/OpenSim/Framework/Capabilities/LLSDMethod.cs +++ b/OpenSim/Capabilities/LLSDMethod.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDMethodString.cs b/OpenSim/Capabilities/LLSDMethodString.cs index 38700d5..38700d5 100644 --- a/OpenSim/Framework/Capabilities/LLSDMethodString.cs +++ b/OpenSim/Capabilities/LLSDMethodString.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDParcelVoiceInfoResponse.cs b/OpenSim/Capabilities/LLSDParcelVoiceInfoResponse.cs index b34a668..b34a668 100644 --- a/OpenSim/Framework/Capabilities/LLSDParcelVoiceInfoResponse.cs +++ b/OpenSim/Capabilities/LLSDParcelVoiceInfoResponse.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDRemoteParcelResponse.cs b/OpenSim/Capabilities/LLSDRemoteParcelResponse.cs index 13d69d3..13d69d3 100644 --- a/OpenSim/Framework/Capabilities/LLSDRemoteParcelResponse.cs +++ b/OpenSim/Capabilities/LLSDRemoteParcelResponse.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDStreamHandler.cs b/OpenSim/Capabilities/LLSDStreamHandler.cs index 7aaa994..7aaa994 100644 --- a/OpenSim/Framework/Capabilities/LLSDStreamHandler.cs +++ b/OpenSim/Capabilities/LLSDStreamHandler.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDTaskInventoryUploadComplete.cs b/OpenSim/Capabilities/LLSDTaskInventoryUploadComplete.cs index 47fdaca..47fdaca 100644 --- a/OpenSim/Framework/Capabilities/LLSDTaskInventoryUploadComplete.cs +++ b/OpenSim/Capabilities/LLSDTaskInventoryUploadComplete.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDTaskScriptUpdate.cs b/OpenSim/Capabilities/LLSDTaskScriptUpdate.cs index 9d7c17f..9d7c17f 100644 --- a/OpenSim/Framework/Capabilities/LLSDTaskScriptUpdate.cs +++ b/OpenSim/Capabilities/LLSDTaskScriptUpdate.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDTaskScriptUploadComplete.cs b/OpenSim/Capabilities/LLSDTaskScriptUploadComplete.cs index d308831..d308831 100644 --- a/OpenSim/Framework/Capabilities/LLSDTaskScriptUploadComplete.cs +++ b/OpenSim/Capabilities/LLSDTaskScriptUploadComplete.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDTest.cs b/OpenSim/Capabilities/LLSDTest.cs index 5f77c3d..5f77c3d 100644 --- a/OpenSim/Framework/Capabilities/LLSDTest.cs +++ b/OpenSim/Capabilities/LLSDTest.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDType.cs b/OpenSim/Capabilities/LLSDType.cs index d5ca1ab..d5ca1ab 100644 --- a/OpenSim/Framework/Capabilities/LLSDType.cs +++ b/OpenSim/Capabilities/LLSDType.cs | |||
diff --git a/OpenSim/Framework/Capabilities/LLSDVoiceAccountResponse.cs b/OpenSim/Capabilities/LLSDVoiceAccountResponse.cs index 53c11e7..53c11e7 100644 --- a/OpenSim/Framework/Capabilities/LLSDVoiceAccountResponse.cs +++ b/OpenSim/Capabilities/LLSDVoiceAccountResponse.cs | |||
diff --git a/OpenSim/Framework/Capabilities/CapsUtil.cs b/OpenSim/Framework/CapsUtil.cs index faf2708..4baf505 100644 --- a/OpenSim/Framework/Capabilities/CapsUtil.cs +++ b/OpenSim/Framework/CapsUtil.cs | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | using OpenMetaverse; | 28 | using OpenMetaverse; |
29 | 29 | ||
30 | namespace OpenSim.Framework.Capabilities | 30 | namespace OpenSim.Framework |
31 | { | 31 | { |
32 | /// <summary> | 32 | /// <summary> |
33 | /// Capabilities utility methods | 33 | /// Capabilities utility methods |
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 3be97b5..7945d5e 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -1,49 +1,28 @@ | |||
1 | /* | 1 | using System; |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | 2 | using System.Collections; |
30 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
31 | using System.IO; | 4 | using System.IO; |
32 | using System.Reflection; | 5 | using System.Reflection; |
33 | using log4net; | 6 | |
34 | using Nini.Config; | ||
35 | using OpenMetaverse; | 7 | using OpenMetaverse; |
8 | using Nini.Config; | ||
9 | using log4net; | ||
10 | |||
11 | using OpenSim.Framework; | ||
12 | using OpenSim.Framework.Capabilities; | ||
13 | using OpenSim.Region.Framework; | ||
14 | using OpenSim.Region.Framework.Scenes; | ||
36 | using OpenSim.Framework.Servers; | 15 | using OpenSim.Framework.Servers; |
37 | using OpenSim.Framework.Servers.HttpServer; | 16 | using OpenSim.Framework.Servers.HttpServer; |
38 | using OpenSim.Services.Interfaces; | 17 | using OpenSim.Services.Interfaces; |
39 | 18 | ||
40 | // using OpenSim.Region.Framework.Interfaces; | 19 | using Caps = OpenSim.Framework.Capabilities.Caps; |
41 | 20 | ||
42 | namespace OpenSim.Framework.Capabilities | 21 | namespace OpenSim.Region.ClientStack.Linden |
43 | { | 22 | { |
44 | public delegate void UpLoadedAsset( | 23 | public delegate void UpLoadedAsset( |
45 | string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, | 24 | string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, |
46 | byte[] data, string inventoryType, string assetType); | 25 | byte[] data, string inventoryType, string assetType); |
47 | 26 | ||
48 | public delegate void UploadedBakedTexture(UUID assetID, byte[] data); | 27 | public delegate void UploadedBakedTexture(UUID assetID, byte[] data); |
49 | 28 | ||
@@ -70,21 +49,13 @@ namespace OpenSim.Framework.Capabilities | |||
70 | /// </summary> | 49 | /// </summary> |
71 | public delegate IClientAPI GetClientDelegate(UUID agentID); | 50 | public delegate IClientAPI GetClientDelegate(UUID agentID); |
72 | 51 | ||
73 | public class Caps | 52 | public class BunchOfCaps |
74 | { | 53 | { |
75 | private static readonly ILog m_log = | 54 | private static readonly ILog m_log = |
76 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 55 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
77 | 56 | ||
78 | private string m_httpListenerHostName; | 57 | private Scene m_Scene; |
79 | private uint m_httpListenPort; | 58 | private Caps m_HostCapsObj; |
80 | |||
81 | /// <summary> | ||
82 | /// This is the uuid portion of every CAPS path. It is used to make capability urls private to the requester. | ||
83 | /// </summary> | ||
84 | private string m_capsObjectPath; | ||
85 | public string CapsObjectPath { get { return m_capsObjectPath; } } | ||
86 | |||
87 | private CapsHandlers m_capsHandlers; | ||
88 | 59 | ||
89 | private static readonly string m_requestPath = "0000/"; | 60 | private static readonly string m_requestPath = "0000/"; |
90 | // private static readonly string m_mapLayerPath = "0001/"; | 61 | // private static readonly string m_mapLayerPath = "0001/"; |
@@ -92,41 +63,10 @@ namespace OpenSim.Framework.Capabilities | |||
92 | //private static readonly string m_requestTexture = "0003/"; | 63 | //private static readonly string m_requestTexture = "0003/"; |
93 | private static readonly string m_notecardUpdatePath = "0004/"; | 64 | private static readonly string m_notecardUpdatePath = "0004/"; |
94 | private static readonly string m_notecardTaskUpdatePath = "0005/"; | 65 | private static readonly string m_notecardTaskUpdatePath = "0005/"; |
95 | // private static readonly string m_fetchInventoryPath = "0006/"; | 66 | // private static readonly string m_fetchInventoryPath = "0006/"; |
96 | |||
97 | // The following entries are in a module, however, they are also here so that we don't re-assign | ||
98 | // the path to another cap by mistake. | ||
99 | // private static readonly string m_parcelVoiceInfoRequestPath = "0007/"; // This is in a module. | ||
100 | // private static readonly string m_provisionVoiceAccountRequestPath = "0008/";// This is in a module. | ||
101 | |||
102 | // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. | 67 | // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. |
103 | private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule. | 68 | private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule. |
104 | 69 | ||
105 | //private string eventQueue = "0100/"; | ||
106 | private IScene m_Scene; | ||
107 | private IHttpServer m_httpListener; | ||
108 | private UUID m_agentID; | ||
109 | private IAssetService m_assetCache; | ||
110 | private int m_eventQueueCount = 1; | ||
111 | private Queue<string> m_capsEventQueue = new Queue<string>(); | ||
112 | private bool m_dumpAssetsToFile; | ||
113 | private string m_regionName; | ||
114 | private object m_fetchLock = new Object(); | ||
115 | |||
116 | private bool m_persistBakedTextures = false; | ||
117 | |||
118 | public bool SSLCaps | ||
119 | { | ||
120 | get { return m_httpListener.UseSSL; } | ||
121 | } | ||
122 | public string SSLCommonName | ||
123 | { | ||
124 | get { return m_httpListener.SSLCommonName; } | ||
125 | } | ||
126 | public CapsHandlers CapsHandlers | ||
127 | { | ||
128 | get { return m_capsHandlers; } | ||
129 | } | ||
130 | 70 | ||
131 | // These are callbacks which will be setup by the scene so that we can update scene data when we | 71 | // These are callbacks which will be setup by the scene so that we can update scene data when we |
132 | // receive capability calls | 72 | // receive capability calls |
@@ -137,47 +77,45 @@ namespace OpenSim.Framework.Capabilities | |||
137 | public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; | 77 | public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; |
138 | public GetClientDelegate GetClient = null; | 78 | public GetClientDelegate GetClient = null; |
139 | 79 | ||
140 | public Caps(IScene scene, IAssetService assetCache, IHttpServer httpServer, string httpListen, uint httpPort, string capsPath, | 80 | private bool m_persistBakedTextures = false; |
141 | UUID agent, bool dumpAssetsToFile, string regionName) | 81 | private IAssetService m_assetService; |
82 | private bool m_dumpAssetsToFile; | ||
83 | private string m_regionName; | ||
84 | private object m_fetchLock = new Object(); | ||
85 | |||
86 | public BunchOfCaps(Scene scene, Caps caps) | ||
142 | { | 87 | { |
143 | m_Scene = scene; | 88 | m_Scene = scene; |
144 | m_assetCache = assetCache; | 89 | m_HostCapsObj = caps; |
145 | m_capsObjectPath = capsPath; | ||
146 | m_httpListener = httpServer; | ||
147 | m_httpListenerHostName = httpListen; | ||
148 | |||
149 | m_httpListenPort = httpPort; | ||
150 | |||
151 | m_persistBakedTextures = false; | ||
152 | IConfigSource config = m_Scene.Config; | 90 | IConfigSource config = m_Scene.Config; |
153 | if (config != null) | 91 | if (config != null) |
154 | { | 92 | { |
155 | IConfig sconfig = config.Configs["Startup"]; | 93 | IConfig sconfig = config.Configs["Startup"]; |
156 | if (sconfig != null) | 94 | if (sconfig != null) |
157 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures",m_persistBakedTextures); | 95 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); |
158 | } | 96 | } |
159 | 97 | ||
160 | if (httpServer != null && httpServer.UseSSL) | 98 | m_assetService = m_Scene.AssetService; |
161 | { | 99 | m_regionName = m_Scene.RegionInfo.RegionName; |
162 | m_httpListenPort = httpServer.SSLPort; | 100 | |
163 | httpListen = httpServer.SSLCommonName; | 101 | RegisterHandlers(); |
164 | httpPort = httpServer.SSLPort; | 102 | |
165 | } | 103 | AddNewInventoryItem = m_Scene.AddUploadedInventoryItem; |
104 | ItemUpdatedCall = m_Scene.CapsUpdateInventoryItemAsset; | ||
105 | TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset; | ||
106 | CAPSFetchInventoryDescendents = m_Scene.HandleFetchInventoryDescendentsCAPS; | ||
107 | GetClient = m_Scene.SceneContents.GetControllingClient; | ||
166 | 108 | ||
167 | m_agentID = agent; | ||
168 | m_dumpAssetsToFile = dumpAssetsToFile; | ||
169 | m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL); | ||
170 | m_regionName = regionName; | ||
171 | } | 109 | } |
172 | 110 | ||
173 | /// <summary> | 111 | /// <summary> |
174 | /// Register all CAPS http service handlers | 112 | /// Register a bunch of CAPS http service handlers |
175 | /// </summary> | 113 | /// </summary> |
176 | public void RegisterHandlers() | 114 | public void RegisterHandlers() |
177 | { | 115 | { |
178 | DeregisterHandlers(); | 116 | m_HostCapsObj.DeregisterHandlers(); |
179 | 117 | ||
180 | string capsBase = "/CAPS/" + m_capsObjectPath; | 118 | string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; |
181 | 119 | ||
182 | RegisterRegionServiceHandlers(capsBase); | 120 | RegisterRegionServiceHandlers(capsBase); |
183 | RegisterInventoryServiceHandlers(capsBase); | 121 | RegisterInventoryServiceHandlers(capsBase); |
@@ -188,19 +126,18 @@ namespace OpenSim.Framework.Capabilities | |||
188 | try | 126 | try |
189 | { | 127 | { |
190 | // the root of all evil | 128 | // the root of all evil |
191 | m_capsHandlers["SEED"] = new RestStreamHandler("POST", capsBase + m_requestPath, CapsRequest); | 129 | m_HostCapsObj.RegisterHandler("SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest)); |
192 | m_log.DebugFormat( | 130 | m_log.DebugFormat( |
193 | "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_agentID); | 131 | "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID); |
194 | 132 | ||
195 | //m_capsHandlers["MapLayer"] = | 133 | //m_capsHandlers["MapLayer"] = |
196 | // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST", | 134 | // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST", |
197 | // capsBase + m_mapLayerPath, | 135 | // capsBase + m_mapLayerPath, |
198 | // GetMapLayer); | 136 | // GetMapLayer); |
199 | m_capsHandlers["UpdateScriptTaskInventory"] = | 137 | IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory); |
200 | new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory); | 138 | m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req); |
201 | m_capsHandlers["UpdateScriptTask"] = m_capsHandlers["UpdateScriptTaskInventory"]; | 139 | m_HostCapsObj.RegisterHandler("UpdateScriptTask", req); |
202 | m_capsHandlers["UploadBakedTexture"] = | 140 | m_HostCapsObj.RegisterHandler("UploadBakedTexture", new RestStreamHandler("POST", capsBase + m_uploadBakedTexturePath, UploadBakedTexture)); |
203 | new RestStreamHandler("POST", capsBase + m_uploadBakedTexturePath, UploadBakedTexture); | ||
204 | 141 | ||
205 | } | 142 | } |
206 | catch (Exception e) | 143 | catch (Exception e) |
@@ -214,15 +151,14 @@ namespace OpenSim.Framework.Capabilities | |||
214 | try | 151 | try |
215 | { | 152 | { |
216 | // I don't think this one works... | 153 | // I don't think this one works... |
217 | m_capsHandlers["NewFileAgentInventory"] = | 154 | m_HostCapsObj.RegisterHandler("NewFileAgentInventory", new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", |
218 | new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", | ||
219 | capsBase + m_newInventory, | 155 | capsBase + m_newInventory, |
220 | NewAgentInventoryRequest); | 156 | NewAgentInventoryRequest)); |
221 | m_capsHandlers["UpdateNotecardAgentInventory"] = | 157 | IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory); |
222 | new RestStreamHandler("POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory); | 158 | m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); |
223 | m_capsHandlers["UpdateScriptAgentInventory"] = m_capsHandlers["UpdateNotecardAgentInventory"]; | 159 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); |
224 | m_capsHandlers["UpdateScriptAgent"] = m_capsHandlers["UpdateScriptAgentInventory"]; | 160 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); |
225 | 161 | ||
226 | // As of RC 1.22.9 of the Linden client this is | 162 | // As of RC 1.22.9 of the Linden client this is |
227 | // supported | 163 | // supported |
228 | 164 | ||
@@ -256,36 +192,35 @@ namespace OpenSim.Framework.Capabilities | |||
256 | } | 192 | } |
257 | 193 | ||
258 | /// <summary> | 194 | /// <summary> |
259 | /// Register a handler. This allows modules to register handlers. | 195 | /// Construct a client response detailing all the capabilities this server can provide. |
260 | /// </summary> | ||
261 | /// <param name="capName"></param> | ||
262 | /// <param name="handler"></param> | ||
263 | public void RegisterHandler(string capName, IRequestHandler handler) | ||
264 | { | ||
265 | m_capsHandlers[capName] = handler; | ||
266 | //m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path); | ||
267 | } | ||
268 | |||
269 | /// <summary> | ||
270 | /// Remove all CAPS service handlers. | ||
271 | /// | ||
272 | /// </summary> | 196 | /// </summary> |
273 | /// <param name="httpListener"></param> | 197 | /// <param name="request"></param> |
274 | /// <param name="path"></param> | 198 | /// <param name="path"></param> |
275 | /// <param name="restMethod"></param> | 199 | /// <param name="param"></param> |
276 | public void DeregisterHandlers() | 200 | /// <param name="httpRequest">HTTP request header object</param> |
201 | /// <param name="httpResponse">HTTP response header object</param> | ||
202 | /// <returns></returns> | ||
203 | public string SeedCapRequest(string request, string path, string param, | ||
204 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
277 | { | 205 | { |
278 | if (m_capsHandlers != null) | 206 | m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); |
207 | |||
208 | if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) | ||
279 | { | 209 | { |
280 | foreach (string capsName in m_capsHandlers.Caps) | 210 | m_log.DebugFormat("[CAPS]: Unauthorized CAPS client"); |
281 | { | 211 | return string.Empty; |
282 | m_capsHandlers.Remove(capsName); | ||
283 | } | ||
284 | } | 212 | } |
213 | |||
214 | // WARNING: Add the external too | ||
215 | string result = LLSDHelpers.SerialiseLLSDReply(m_HostCapsObj.CapsHandlers.CapsDetails); | ||
216 | |||
217 | //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); | ||
218 | |||
219 | return result; | ||
285 | } | 220 | } |
286 | 221 | ||
287 | /// <summary> | 222 | /// <summary> |
288 | /// Construct a client response detailing all the capabilities this server can provide. | 223 | /// Called by the script task update handler. Provides a URL to which the client can upload a new asset. |
289 | /// </summary> | 224 | /// </summary> |
290 | /// <param name="request"></param> | 225 | /// <param name="request"></param> |
291 | /// <param name="path"></param> | 226 | /// <param name="path"></param> |
@@ -293,26 +228,282 @@ namespace OpenSim.Framework.Capabilities | |||
293 | /// <param name="httpRequest">HTTP request header object</param> | 228 | /// <param name="httpRequest">HTTP request header object</param> |
294 | /// <param name="httpResponse">HTTP response header object</param> | 229 | /// <param name="httpResponse">HTTP response header object</param> |
295 | /// <returns></returns> | 230 | /// <returns></returns> |
296 | public string CapsRequest(string request, string path, string param, | 231 | public string ScriptTaskInventory(string request, string path, string param, |
297 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 232 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
298 | { | 233 | { |
299 | m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); | 234 | try |
235 | { | ||
236 | m_log.Debug("[CAPS]: ScriptTaskInventory Request in region: " + m_regionName); | ||
237 | //m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param); | ||
238 | |||
239 | Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); | ||
240 | LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate(); | ||
241 | LLSDHelpers.DeserialiseOSDMap(hash, llsdUpdateRequest); | ||
242 | |||
243 | string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; | ||
244 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
245 | |||
246 | TaskInventoryScriptUpdater uploader = | ||
247 | new TaskInventoryScriptUpdater( | ||
248 | llsdUpdateRequest.item_id, | ||
249 | llsdUpdateRequest.task_id, | ||
250 | llsdUpdateRequest.is_script_running, | ||
251 | capsBase + uploaderPath, | ||
252 | m_HostCapsObj.HttpListener, | ||
253 | m_dumpAssetsToFile); | ||
254 | uploader.OnUpLoad += TaskScriptUpdated; | ||
255 | |||
256 | m_HostCapsObj.HttpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | ||
257 | |||
258 | string protocol = "http://"; | ||
300 | 259 | ||
301 | if (!m_Scene.CheckClient(m_agentID, httpRequest.RemoteIPEndPoint)) | 260 | if (m_HostCapsObj.SSLCaps) |
261 | protocol = "https://"; | ||
262 | |||
263 | string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + | ||
264 | uploaderPath; | ||
265 | |||
266 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | ||
267 | uploadResponse.uploader = uploaderURL; | ||
268 | uploadResponse.state = "upload"; | ||
269 | |||
270 | // m_log.InfoFormat("[CAPS]: " + | ||
271 | // "ScriptTaskInventory response: {0}", | ||
272 | // LLSDHelpers.SerialiseLLSDReply(uploadResponse))); | ||
273 | |||
274 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | ||
275 | } | ||
276 | catch (Exception e) | ||
302 | { | 277 | { |
303 | m_log.DebugFormat("[CAPS]: Unauthorized CAPS client"); | 278 | m_log.Error("[CAPS]: " + e.ToString()); |
304 | return string.Empty; | ||
305 | } | 279 | } |
306 | 280 | ||
307 | string result = LLSDHelpers.SerialiseLLSDReply(m_capsHandlers.CapsDetails); | 281 | return null; |
282 | } | ||
308 | 283 | ||
309 | //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); | 284 | /// <summary> |
285 | /// Called when new asset data for an agent inventory item update has been uploaded. | ||
286 | /// </summary> | ||
287 | /// <param name="itemID">Item to update</param> | ||
288 | /// <param name="primID">Prim containing item to update</param> | ||
289 | /// <param name="isScriptRunning">Signals whether the script to update is currently running</param> | ||
290 | /// <param name="data">New asset data</param> | ||
291 | public void TaskScriptUpdated(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors) | ||
292 | { | ||
293 | if (TaskScriptUpdatedCall != null) | ||
294 | { | ||
295 | ArrayList e = TaskScriptUpdatedCall(m_HostCapsObj.AgentID, itemID, primID, isScriptRunning, data); | ||
296 | foreach (Object item in e) | ||
297 | errors.Add(item); | ||
298 | } | ||
299 | } | ||
310 | 300 | ||
311 | return result; | 301 | public string UploadBakedTexture(string request, string path, |
302 | string param, OSHttpRequest httpRequest, | ||
303 | OSHttpResponse httpResponse) | ||
304 | { | ||
305 | try | ||
306 | { | ||
307 | // m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + | ||
308 | // m_regionName); | ||
309 | |||
310 | string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; | ||
311 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
312 | |||
313 | BakedTextureUploader uploader = | ||
314 | new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener); | ||
315 | uploader.OnUpLoad += BakedTextureUploaded; | ||
316 | |||
317 | m_HostCapsObj.HttpListener.AddStreamHandler( | ||
318 | new BinaryStreamHandler("POST", capsBase + uploaderPath, | ||
319 | uploader.uploaderCaps)); | ||
320 | |||
321 | string protocol = "http://"; | ||
322 | |||
323 | if (m_HostCapsObj.SSLCaps) | ||
324 | protocol = "https://"; | ||
325 | |||
326 | string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + | ||
327 | m_HostCapsObj.Port.ToString() + capsBase + uploaderPath; | ||
328 | |||
329 | LLSDAssetUploadResponse uploadResponse = | ||
330 | new LLSDAssetUploadResponse(); | ||
331 | uploadResponse.uploader = uploaderURL; | ||
332 | uploadResponse.state = "upload"; | ||
333 | |||
334 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | ||
335 | } | ||
336 | catch (Exception e) | ||
337 | { | ||
338 | m_log.Error("[CAPS]: " + e.ToString()); | ||
339 | } | ||
340 | |||
341 | return null; | ||
342 | } | ||
343 | |||
344 | public void BakedTextureUploaded(UUID assetID, byte[] data) | ||
345 | { | ||
346 | // m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); | ||
347 | |||
348 | AssetBase asset; | ||
349 | asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString()); | ||
350 | asset.Data = data; | ||
351 | asset.Temporary = true; | ||
352 | asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are | ||
353 | m_assetService.Store(asset); | ||
354 | } | ||
355 | |||
356 | /// <summary> | ||
357 | /// Called when new asset data for an agent inventory item update has been uploaded. | ||
358 | /// </summary> | ||
359 | /// <param name="itemID">Item to update</param> | ||
360 | /// <param name="data">New asset data</param> | ||
361 | /// <returns></returns> | ||
362 | public UUID ItemUpdated(UUID itemID, byte[] data) | ||
363 | { | ||
364 | if (ItemUpdatedCall != null) | ||
365 | { | ||
366 | return ItemUpdatedCall(m_HostCapsObj.AgentID, itemID, data); | ||
367 | } | ||
368 | |||
369 | return UUID.Zero; | ||
312 | } | 370 | } |
313 | 371 | ||
314 | // FIXME: these all should probably go into the respective region | 372 | /// <summary> |
315 | // modules | 373 | /// |
374 | /// </summary> | ||
375 | /// <param name="llsdRequest"></param> | ||
376 | /// <returns></returns> | ||
377 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) | ||
378 | { | ||
379 | //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString()); | ||
380 | //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); | ||
381 | |||
382 | if (llsdRequest.asset_type == "texture" || | ||
383 | llsdRequest.asset_type == "animation" || | ||
384 | llsdRequest.asset_type == "sound") | ||
385 | { | ||
386 | IClientAPI client = null; | ||
387 | IScene scene = null; | ||
388 | if (GetClient != null) | ||
389 | { | ||
390 | client = GetClient(m_HostCapsObj.AgentID); | ||
391 | scene = client.Scene; | ||
392 | |||
393 | IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); | ||
394 | |||
395 | if (mm != null) | ||
396 | { | ||
397 | if (!mm.UploadCovered(client, mm.UploadCharge)) | ||
398 | { | ||
399 | if (client != null) | ||
400 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | ||
401 | |||
402 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | ||
403 | errorResponse.uploader = ""; | ||
404 | errorResponse.state = "error"; | ||
405 | return errorResponse; | ||
406 | } | ||
407 | } | ||
408 | } | ||
409 | } | ||
410 | |||
411 | string assetName = llsdRequest.name; | ||
412 | string assetDes = llsdRequest.description; | ||
413 | string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; | ||
414 | UUID newAsset = UUID.Random(); | ||
415 | UUID newInvItem = UUID.Random(); | ||
416 | UUID parentFolder = llsdRequest.folder_id; | ||
417 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
418 | |||
419 | AssetUploader uploader = | ||
420 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, | ||
421 | llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile); | ||
422 | m_HostCapsObj.HttpListener.AddStreamHandler( | ||
423 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | ||
424 | |||
425 | string protocol = "http://"; | ||
426 | |||
427 | if (m_HostCapsObj.SSLCaps) | ||
428 | protocol = "https://"; | ||
429 | |||
430 | string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + | ||
431 | uploaderPath; | ||
432 | |||
433 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | ||
434 | uploadResponse.uploader = uploaderURL; | ||
435 | uploadResponse.state = "upload"; | ||
436 | uploader.OnUpLoad += UploadCompleteHandler; | ||
437 | return uploadResponse; | ||
438 | } | ||
439 | |||
440 | /// <summary> | ||
441 | /// | ||
442 | /// </summary> | ||
443 | /// <param name="assetID"></param> | ||
444 | /// <param name="inventoryItem"></param> | ||
445 | /// <param name="data"></param> | ||
446 | public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, | ||
447 | UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, | ||
448 | string assetType) | ||
449 | { | ||
450 | sbyte assType = 0; | ||
451 | sbyte inType = 0; | ||
452 | |||
453 | if (inventoryType == "sound") | ||
454 | { | ||
455 | inType = 1; | ||
456 | assType = 1; | ||
457 | } | ||
458 | else if (inventoryType == "animation") | ||
459 | { | ||
460 | inType = 19; | ||
461 | assType = 20; | ||
462 | } | ||
463 | else if (inventoryType == "wearable") | ||
464 | { | ||
465 | inType = 18; | ||
466 | switch (assetType) | ||
467 | { | ||
468 | case "bodypart": | ||
469 | assType = 13; | ||
470 | break; | ||
471 | case "clothing": | ||
472 | assType = 5; | ||
473 | break; | ||
474 | } | ||
475 | } | ||
476 | |||
477 | AssetBase asset; | ||
478 | asset = new AssetBase(assetID, assetName, assType, m_HostCapsObj.AgentID.ToString()); | ||
479 | asset.Data = data; | ||
480 | if (AddNewAsset != null) | ||
481 | AddNewAsset(asset); | ||
482 | else if (m_assetService != null) | ||
483 | m_assetService.Store(asset); | ||
484 | |||
485 | InventoryItemBase item = new InventoryItemBase(); | ||
486 | item.Owner = m_HostCapsObj.AgentID; | ||
487 | item.CreatorId = m_HostCapsObj.AgentID.ToString(); | ||
488 | item.CreatorData = String.Empty; | ||
489 | item.ID = inventoryItem; | ||
490 | item.AssetID = asset.FullID; | ||
491 | item.Description = assetDescription; | ||
492 | item.Name = assetName; | ||
493 | item.AssetType = assType; | ||
494 | item.InvType = inType; | ||
495 | item.Folder = parentFolder; | ||
496 | item.CurrentPermissions = (uint)PermissionMask.All; | ||
497 | item.BasePermissions = (uint)PermissionMask.All; | ||
498 | item.EveryOnePermissions = 0; | ||
499 | item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); | ||
500 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
501 | |||
502 | if (AddNewInventoryItem != null) | ||
503 | { | ||
504 | AddNewInventoryItem(m_HostCapsObj.AgentID, item); | ||
505 | } | ||
506 | } | ||
316 | 507 | ||
317 | /// <summary> | 508 | /// <summary> |
318 | /// Processes a fetch inventory request and sends the reply | 509 | /// Processes a fetch inventory request and sends the reply |
@@ -391,7 +582,7 @@ namespace OpenSim.Framework.Capabilities | |||
391 | return response; | 582 | return response; |
392 | } | 583 | } |
393 | 584 | ||
394 | public string FetchInventoryDescendentsRequest(string request, string path, string param,OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 585 | public string FetchInventoryDescendentsRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
395 | { | 586 | { |
396 | // nasty temporary hack here, the linden client falsely | 587 | // nasty temporary hack here, the linden client falsely |
397 | // identifies the uuid 00000000-0000-0000-0000-000000000000 | 588 | // identifies the uuid 00000000-0000-0000-0000-000000000000 |
@@ -400,7 +591,7 @@ namespace OpenSim.Framework.Capabilities | |||
400 | // correctly mark it as a uuid | 591 | // correctly mark it as a uuid |
401 | // | 592 | // |
402 | request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>"); | 593 | request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>"); |
403 | 594 | ||
404 | // another hack <integer>1</integer> results in a | 595 | // another hack <integer>1</integer> results in a |
405 | // System.ArgumentException: Object type System.Int32 cannot | 596 | // System.ArgumentException: Object type System.Int32 cannot |
406 | // be converted to target type: System.Boolean | 597 | // be converted to target type: System.Boolean |
@@ -430,11 +621,12 @@ namespace OpenSim.Framework.Capabilities | |||
430 | Hashtable inventoryhash = (Hashtable)foldersrequested[i]; | 621 | Hashtable inventoryhash = (Hashtable)foldersrequested[i]; |
431 | 622 | ||
432 | LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents(); | 623 | LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents(); |
433 | 624 | ||
434 | try{ | 625 | try |
626 | { | ||
435 | LLSDHelpers.DeserialiseOSDMap(inventoryhash, llsdRequest); | 627 | LLSDHelpers.DeserialiseOSDMap(inventoryhash, llsdRequest); |
436 | } | 628 | } |
437 | catch(Exception e) | 629 | catch (Exception e) |
438 | { | 630 | { |
439 | m_log.Debug("[CAPS]: caught exception doing OSD deserialize" + e); | 631 | m_log.Debug("[CAPS]: caught exception doing OSD deserialize" + e); |
440 | } | 632 | } |
@@ -446,8 +638,8 @@ namespace OpenSim.Framework.Capabilities | |||
446 | 638 | ||
447 | response += inventoryitemstr; | 639 | response += inventoryitemstr; |
448 | } | 640 | } |
449 | 641 | ||
450 | 642 | ||
451 | if (response.Length == 0) | 643 | if (response.Length == 0) |
452 | { | 644 | { |
453 | // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. | 645 | // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. |
@@ -467,7 +659,7 @@ namespace OpenSim.Framework.Capabilities | |||
467 | } | 659 | } |
468 | return response; | 660 | return response; |
469 | } | 661 | } |
470 | 662 | ||
471 | 663 | ||
472 | 664 | ||
473 | /// <summary> | 665 | /// <summary> |
@@ -479,8 +671,8 @@ namespace OpenSim.Framework.Capabilities | |||
479 | { | 671 | { |
480 | LLSDInventoryDescendents reply = new LLSDInventoryDescendents(); | 672 | LLSDInventoryDescendents reply = new LLSDInventoryDescendents(); |
481 | LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents(); | 673 | LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents(); |
482 | contents.agent_id = m_agentID; | 674 | contents.agent_id = m_HostCapsObj.AgentID; |
483 | contents.owner_id = invFetch.owner_id; | 675 | contents.owner_id = invFetch.owner_id; |
484 | contents.folder_id = invFetch.folder_id; | 676 | contents.folder_id = invFetch.folder_id; |
485 | 677 | ||
486 | reply.folders.Array.Add(contents); | 678 | reply.folders.Array.Add(contents); |
@@ -490,7 +682,7 @@ namespace OpenSim.Framework.Capabilities | |||
490 | int version = 0; | 682 | int version = 0; |
491 | if (CAPSFetchInventoryDescendents != null) | 683 | if (CAPSFetchInventoryDescendents != null) |
492 | { | 684 | { |
493 | inv = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version); | 685 | inv = CAPSFetchInventoryDescendents(m_HostCapsObj.AgentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version); |
494 | } | 686 | } |
495 | 687 | ||
496 | if (inv.Folders != null) | 688 | if (inv.Folders != null) |
@@ -568,24 +760,24 @@ namespace OpenSim.Framework.Capabilities | |||
568 | llsdItem.permissions.group_mask = (int)invItem.GroupPermissions; | 760 | llsdItem.permissions.group_mask = (int)invItem.GroupPermissions; |
569 | llsdItem.permissions.is_owner_group = invItem.GroupOwned; | 761 | llsdItem.permissions.is_owner_group = invItem.GroupOwned; |
570 | llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions; | 762 | llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions; |
571 | llsdItem.permissions.owner_id = m_agentID; | 763 | llsdItem.permissions.owner_id = m_HostCapsObj.AgentID; |
572 | llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; | 764 | llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; |
573 | llsdItem.sale_info = new LLSDSaleInfo(); | 765 | llsdItem.sale_info = new LLSDSaleInfo(); |
574 | llsdItem.sale_info.sale_price = invItem.SalePrice; | 766 | llsdItem.sale_info.sale_price = invItem.SalePrice; |
575 | switch (invItem.SaleType) | 767 | switch (invItem.SaleType) |
576 | { | 768 | { |
577 | default: | 769 | default: |
578 | llsdItem.sale_info.sale_type = "not"; | 770 | llsdItem.sale_info.sale_type = "not"; |
579 | break; | 771 | break; |
580 | case 1: | 772 | case 1: |
581 | llsdItem.sale_info.sale_type = "original"; | 773 | llsdItem.sale_info.sale_type = "original"; |
582 | break; | 774 | break; |
583 | case 2: | 775 | case 2: |
584 | llsdItem.sale_info.sale_type = "copy"; | 776 | llsdItem.sale_info.sale_type = "copy"; |
585 | break; | 777 | break; |
586 | case 3: | 778 | case 3: |
587 | llsdItem.sale_info.sale_type = "contents"; | 779 | llsdItem.sale_info.sale_type = "contents"; |
588 | break; | 780 | break; |
589 | } | 781 | } |
590 | 782 | ||
591 | return llsdItem; | 783 | return llsdItem; |
@@ -632,175 +824,6 @@ namespace OpenSim.Framework.Capabilities | |||
632 | return String.Empty; | 824 | return String.Empty; |
633 | } | 825 | } |
634 | 826 | ||
635 | #region EventQueue (Currently not enabled) | ||
636 | |||
637 | /// <summary> | ||
638 | /// | ||
639 | /// </summary> | ||
640 | /// <param name="request"></param> | ||
641 | /// <param name="path"></param> | ||
642 | /// <param name="param"></param> | ||
643 | /// <returns></returns> | ||
644 | public string ProcessEventQueue(string request, string path, string param) | ||
645 | { | ||
646 | string res = String.Empty; | ||
647 | |||
648 | if (m_capsEventQueue.Count > 0) | ||
649 | { | ||
650 | lock (m_capsEventQueue) | ||
651 | { | ||
652 | string item = m_capsEventQueue.Dequeue(); | ||
653 | res = item; | ||
654 | } | ||
655 | } | ||
656 | else | ||
657 | { | ||
658 | res = CreateEmptyEventResponse(); | ||
659 | } | ||
660 | return res; | ||
661 | } | ||
662 | |||
663 | /// <summary> | ||
664 | /// | ||
665 | /// </summary> | ||
666 | /// <param name="caps"></param> | ||
667 | /// <param name="ipAddressPort"></param> | ||
668 | /// <returns></returns> | ||
669 | public string CreateEstablishAgentComms(string caps, string ipAddressPort) | ||
670 | { | ||
671 | LLSDCapEvent eventItem = new LLSDCapEvent(); | ||
672 | eventItem.id = m_eventQueueCount; | ||
673 | //should be creating a EstablishAgentComms item, but there isn't a class for it yet | ||
674 | eventItem.events.Array.Add(new LLSDEmpty()); | ||
675 | string res = LLSDHelpers.SerialiseLLSDReply(eventItem); | ||
676 | m_eventQueueCount++; | ||
677 | |||
678 | m_capsEventQueue.Enqueue(res); | ||
679 | return res; | ||
680 | } | ||
681 | |||
682 | /// <summary> | ||
683 | /// | ||
684 | /// </summary> | ||
685 | /// <returns></returns> | ||
686 | public string CreateEmptyEventResponse() | ||
687 | { | ||
688 | LLSDCapEvent eventItem = new LLSDCapEvent(); | ||
689 | eventItem.id = m_eventQueueCount; | ||
690 | eventItem.events.Array.Add(new LLSDEmpty()); | ||
691 | string res = LLSDHelpers.SerialiseLLSDReply(eventItem); | ||
692 | m_eventQueueCount++; | ||
693 | return res; | ||
694 | } | ||
695 | |||
696 | #endregion | ||
697 | |||
698 | /// <summary> | ||
699 | /// Called by the script task update handler. Provides a URL to which the client can upload a new asset. | ||
700 | /// </summary> | ||
701 | /// <param name="request"></param> | ||
702 | /// <param name="path"></param> | ||
703 | /// <param name="param"></param> | ||
704 | /// <param name="httpRequest">HTTP request header object</param> | ||
705 | /// <param name="httpResponse">HTTP response header object</param> | ||
706 | /// <returns></returns> | ||
707 | public string ScriptTaskInventory(string request, string path, string param, | ||
708 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
709 | { | ||
710 | try | ||
711 | { | ||
712 | m_log.Debug("[CAPS]: ScriptTaskInventory Request in region: " + m_regionName); | ||
713 | //m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param); | ||
714 | |||
715 | Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Utils.StringToBytes(request)); | ||
716 | LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate(); | ||
717 | LLSDHelpers.DeserialiseOSDMap(hash, llsdUpdateRequest); | ||
718 | |||
719 | string capsBase = "/CAPS/" + m_capsObjectPath; | ||
720 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
721 | |||
722 | TaskInventoryScriptUpdater uploader = | ||
723 | new TaskInventoryScriptUpdater( | ||
724 | llsdUpdateRequest.item_id, | ||
725 | llsdUpdateRequest.task_id, | ||
726 | llsdUpdateRequest.is_script_running, | ||
727 | capsBase + uploaderPath, | ||
728 | m_httpListener, | ||
729 | m_dumpAssetsToFile); | ||
730 | uploader.OnUpLoad += TaskScriptUpdated; | ||
731 | |||
732 | m_httpListener.AddStreamHandler( | ||
733 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | ||
734 | |||
735 | string protocol = "http://"; | ||
736 | |||
737 | if (m_httpListener.UseSSL) | ||
738 | protocol = "https://"; | ||
739 | |||
740 | string uploaderURL = protocol + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + | ||
741 | uploaderPath; | ||
742 | |||
743 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | ||
744 | uploadResponse.uploader = uploaderURL; | ||
745 | uploadResponse.state = "upload"; | ||
746 | |||
747 | // m_log.InfoFormat("[CAPS]: " + | ||
748 | // "ScriptTaskInventory response: {0}", | ||
749 | // LLSDHelpers.SerialiseLLSDReply(uploadResponse))); | ||
750 | |||
751 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | ||
752 | } | ||
753 | catch (Exception e) | ||
754 | { | ||
755 | m_log.Error("[CAPS]: " + e.ToString()); | ||
756 | } | ||
757 | |||
758 | return null; | ||
759 | } | ||
760 | |||
761 | public string UploadBakedTexture(string request, string path, | ||
762 | string param, OSHttpRequest httpRequest, | ||
763 | OSHttpResponse httpResponse) | ||
764 | { | ||
765 | try | ||
766 | { | ||
767 | // m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + | ||
768 | // m_regionName); | ||
769 | |||
770 | string capsBase = "/CAPS/" + m_capsObjectPath; | ||
771 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
772 | |||
773 | BakedTextureUploader uploader = | ||
774 | new BakedTextureUploader(capsBase + uploaderPath, | ||
775 | m_httpListener); | ||
776 | uploader.OnUpLoad += BakedTextureUploaded; | ||
777 | |||
778 | m_httpListener.AddStreamHandler( | ||
779 | new BinaryStreamHandler("POST", capsBase + uploaderPath, | ||
780 | uploader.uploaderCaps)); | ||
781 | |||
782 | string protocol = "http://"; | ||
783 | |||
784 | if (m_httpListener.UseSSL) | ||
785 | protocol = "https://"; | ||
786 | |||
787 | string uploaderURL = protocol + m_httpListenerHostName + ":" + | ||
788 | m_httpListenPort.ToString() + capsBase + uploaderPath; | ||
789 | |||
790 | LLSDAssetUploadResponse uploadResponse = | ||
791 | new LLSDAssetUploadResponse(); | ||
792 | uploadResponse.uploader = uploaderURL; | ||
793 | uploadResponse.state = "upload"; | ||
794 | |||
795 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | ||
796 | } | ||
797 | catch (Exception e) | ||
798 | { | ||
799 | m_log.Error("[CAPS]: " + e.ToString()); | ||
800 | } | ||
801 | |||
802 | return null; | ||
803 | } | ||
804 | 827 | ||
805 | /// <summary> | 828 | /// <summary> |
806 | /// Called by the notecard update handler. Provides a URL to which the client can upload a new asset. | 829 | /// Called by the notecard update handler. Provides a URL to which the client can upload a new asset. |
@@ -814,365 +837,285 @@ namespace OpenSim.Framework.Capabilities | |||
814 | { | 837 | { |
815 | //m_log.Debug("[CAPS]: NoteCardAgentInventory Request in region: " + m_regionName + "\n" + request); | 838 | //m_log.Debug("[CAPS]: NoteCardAgentInventory Request in region: " + m_regionName + "\n" + request); |
816 | //m_log.Debug("[CAPS]: NoteCardAgentInventory Request is: " + request); | 839 | //m_log.Debug("[CAPS]: NoteCardAgentInventory Request is: " + request); |
817 | 840 | ||
818 | //OpenMetaverse.StructuredData.OSDMap hash = (OpenMetaverse.StructuredData.OSDMap)OpenMetaverse.StructuredData.LLSDParser.DeserializeBinary(Utils.StringToBytes(request)); | 841 | //OpenMetaverse.StructuredData.OSDMap hash = (OpenMetaverse.StructuredData.OSDMap)OpenMetaverse.StructuredData.LLSDParser.DeserializeBinary(Utils.StringToBytes(request)); |
819 | Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Utils.StringToBytes(request)); | 842 | Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); |
820 | LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); | 843 | LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); |
821 | LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest); | 844 | LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest); |
822 | 845 | ||
823 | string capsBase = "/CAPS/" + m_capsObjectPath; | 846 | string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; |
824 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | 847 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); |
825 | 848 | ||
826 | ItemUpdater uploader = | 849 | ItemUpdater uploader = |
827 | new ItemUpdater(llsdRequest.item_id, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile); | 850 | new ItemUpdater(llsdRequest.item_id, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile); |
828 | uploader.OnUpLoad += ItemUpdated; | 851 | uploader.OnUpLoad += ItemUpdated; |
829 | 852 | ||
830 | m_httpListener.AddStreamHandler( | 853 | m_HostCapsObj.HttpListener.AddStreamHandler( |
831 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 854 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); |
832 | 855 | ||
833 | string protocol = "http://"; | 856 | string protocol = "http://"; |
834 | 857 | ||
835 | if (m_httpListener.UseSSL) | 858 | if (m_HostCapsObj.SSLCaps) |
836 | protocol = "https://"; | 859 | protocol = "https://"; |
837 | 860 | ||
838 | string uploaderURL = protocol + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + | 861 | string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + |
839 | uploaderPath; | 862 | uploaderPath; |
840 | 863 | ||
841 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | 864 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); |
842 | uploadResponse.uploader = uploaderURL; | 865 | uploadResponse.uploader = uploaderURL; |
843 | uploadResponse.state = "upload"; | 866 | uploadResponse.state = "upload"; |
844 | 867 | ||
845 | // m_log.InfoFormat("[CAPS]: " + | 868 | // m_log.InfoFormat("[CAPS]: " + |
846 | // "NoteCardAgentInventory response: {0}", | 869 | // "NoteCardAgentInventory response: {0}", |
847 | // LLSDHelpers.SerialiseLLSDReply(uploadResponse))); | 870 | // LLSDHelpers.SerialiseLLSDReply(uploadResponse))); |
848 | 871 | ||
849 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | 872 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); |
850 | } | 873 | } |
874 | } | ||
851 | 875 | ||
852 | /// <summary> | 876 | public class AssetUploader |
853 | /// | 877 | { |
854 | /// </summary> | 878 | public event UpLoadedAsset OnUpLoad; |
855 | /// <param name="llsdRequest"></param> | 879 | private UpLoadedAsset handlerUpLoad = null; |
856 | /// <returns></returns> | 880 | |
857 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) | 881 | private string uploaderPath = String.Empty; |
858 | { | 882 | private UUID newAssetID; |
859 | //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString()); | 883 | private UUID inventoryItemID; |
860 | //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); | 884 | private UUID parentFolder; |
861 | 885 | private IHttpServer httpListener; | |
862 | if (llsdRequest.asset_type == "texture" || | 886 | private bool m_dumpAssetsToFile; |
863 | llsdRequest.asset_type == "animation" || | 887 | private string m_assetName = String.Empty; |
864 | llsdRequest.asset_type == "sound") | 888 | private string m_assetDes = String.Empty; |
865 | { | ||
866 | IClientAPI client = null; | ||
867 | IScene scene = null; | ||
868 | if (GetClient != null) | ||
869 | { | ||
870 | client = GetClient(m_agentID); | ||
871 | scene = client.Scene; | ||
872 | |||
873 | IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); | ||
874 | |||
875 | if (mm != null) | ||
876 | { | ||
877 | if (!mm.UploadCovered(client, mm.UploadCharge)) | ||
878 | { | ||
879 | if (client != null) | ||
880 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | ||
881 | |||
882 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | ||
883 | errorResponse.uploader = ""; | ||
884 | errorResponse.state = "error"; | ||
885 | return errorResponse; | ||
886 | } | ||
887 | } | ||
888 | } | ||
889 | } | ||
890 | |||
891 | |||
892 | string assetName = llsdRequest.name; | ||
893 | string assetDes = llsdRequest.description; | ||
894 | string capsBase = "/CAPS/" + m_capsObjectPath; | ||
895 | UUID newAsset = UUID.Random(); | ||
896 | UUID newInvItem = UUID.Random(); | ||
897 | UUID parentFolder = llsdRequest.folder_id; | ||
898 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
899 | |||
900 | AssetUploader uploader = | ||
901 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, | ||
902 | llsdRequest.asset_type, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile); | ||
903 | m_httpListener.AddStreamHandler( | ||
904 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | ||
905 | |||
906 | string protocol = "http://"; | ||
907 | |||
908 | if (m_httpListener.UseSSL) | ||
909 | protocol = "https://"; | ||
910 | 889 | ||
911 | string uploaderURL = protocol + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + | 890 | private string m_invType = String.Empty; |
912 | uploaderPath; | 891 | private string m_assetType = String.Empty; |
913 | 892 | ||
914 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | 893 | public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, |
915 | uploadResponse.uploader = uploaderURL; | 894 | UUID parentFolderID, string invType, string assetType, string path, |
916 | uploadResponse.state = "upload"; | 895 | IHttpServer httpServer, bool dumpAssetsToFile) |
917 | uploader.OnUpLoad += UploadCompleteHandler; | 896 | { |
918 | return uploadResponse; | 897 | m_assetName = assetName; |
898 | m_assetDes = description; | ||
899 | newAssetID = assetID; | ||
900 | inventoryItemID = inventoryItem; | ||
901 | uploaderPath = path; | ||
902 | httpListener = httpServer; | ||
903 | parentFolder = parentFolderID; | ||
904 | m_assetType = assetType; | ||
905 | m_invType = invType; | ||
906 | m_dumpAssetsToFile = dumpAssetsToFile; | ||
919 | } | 907 | } |
920 | 908 | ||
921 | /// <summary> | 909 | /// <summary> |
922 | /// | 910 | /// |
923 | /// </summary> | 911 | /// </summary> |
924 | /// <param name="assetID"></param> | ||
925 | /// <param name="inventoryItem"></param> | ||
926 | /// <param name="data"></param> | 912 | /// <param name="data"></param> |
927 | public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, | 913 | /// <param name="path"></param> |
928 | UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, | 914 | /// <param name="param"></param> |
929 | string assetType) | 915 | /// <returns></returns> |
916 | public string uploaderCaps(byte[] data, string path, string param) | ||
930 | { | 917 | { |
931 | sbyte assType = 0; | 918 | UUID inv = inventoryItemID; |
932 | sbyte inType = 0; | 919 | string res = String.Empty; |
920 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | ||
921 | uploadComplete.new_asset = newAssetID.ToString(); | ||
922 | uploadComplete.new_inventory_item = inv; | ||
923 | uploadComplete.state = "complete"; | ||
933 | 924 | ||
934 | if (inventoryType == "sound") | 925 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); |
926 | |||
927 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
928 | |||
929 | // TODO: probably make this a better set of extensions here | ||
930 | string extension = ".jp2"; | ||
931 | if (m_invType != "image") | ||
935 | { | 932 | { |
936 | inType = 1; | 933 | extension = ".dat"; |
937 | assType = 1; | ||
938 | } | 934 | } |
939 | else if (inventoryType == "animation") | 935 | |
936 | if (m_dumpAssetsToFile) | ||
940 | { | 937 | { |
941 | inType = 19; | 938 | SaveAssetToFile(m_assetName + extension, data); |
942 | assType = 20; | ||
943 | } | 939 | } |
944 | else if (inventoryType == "wearable") | 940 | handlerUpLoad = OnUpLoad; |
941 | if (handlerUpLoad != null) | ||
945 | { | 942 | { |
946 | inType = 18; | 943 | handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); |
947 | switch (assetType) | ||
948 | { | ||
949 | case "bodypart": | ||
950 | assType = 13; | ||
951 | break; | ||
952 | case "clothing": | ||
953 | assType = 5; | ||
954 | break; | ||
955 | } | ||
956 | } | 944 | } |
957 | 945 | ||
958 | AssetBase asset; | 946 | return res; |
959 | asset = new AssetBase(assetID, assetName, assType, m_agentID.ToString()); | 947 | } |
960 | asset.Data = data; | 948 | ///Left this in and commented in case there are unforseen issues |
961 | if (AddNewAsset != null) | 949 | //private void SaveAssetToFile(string filename, byte[] data) |
962 | AddNewAsset(asset); | 950 | //{ |
963 | else if (m_assetCache != null) | 951 | // FileStream fs = File.Create(filename); |
964 | m_assetCache.Store(asset); | 952 | // BinaryWriter bw = new BinaryWriter(fs); |
965 | 953 | // bw.Write(data); | |
966 | InventoryItemBase item = new InventoryItemBase(); | 954 | // bw.Close(); |
967 | item.Owner = m_agentID; | 955 | // fs.Close(); |
968 | item.CreatorId = m_agentID.ToString(); | 956 | //} |
969 | item.CreatorData = String.Empty; | 957 | private static void SaveAssetToFile(string filename, byte[] data) |
970 | item.ID = inventoryItem; | 958 | { |
971 | item.AssetID = asset.FullID; | 959 | string assetPath = "UserAssets"; |
972 | item.Description = assetDescription; | 960 | if (!Directory.Exists(assetPath)) |
973 | item.Name = assetName; | ||
974 | item.AssetType = assType; | ||
975 | item.InvType = inType; | ||
976 | item.Folder = parentFolder; | ||
977 | item.CurrentPermissions = (uint)PermissionMask.All; | ||
978 | item.BasePermissions = (uint)PermissionMask.All; | ||
979 | item.EveryOnePermissions = 0; | ||
980 | item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); | ||
981 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
982 | |||
983 | if (AddNewInventoryItem != null) | ||
984 | { | 961 | { |
985 | AddNewInventoryItem(m_agentID, item); | 962 | Directory.CreateDirectory(assetPath); |
986 | } | 963 | } |
964 | FileStream fs = File.Create(Path.Combine(assetPath, Util.safeFileName(filename))); | ||
965 | BinaryWriter bw = new BinaryWriter(fs); | ||
966 | bw.Write(data); | ||
967 | bw.Close(); | ||
968 | fs.Close(); | ||
987 | } | 969 | } |
970 | } | ||
988 | 971 | ||
989 | public void BakedTextureUploaded(UUID assetID, byte[] data) | 972 | /// <summary> |
973 | /// This class is a callback invoked when a client sends asset data to | ||
974 | /// an agent inventory notecard update url | ||
975 | /// </summary> | ||
976 | public class ItemUpdater | ||
977 | { | ||
978 | public event UpdateItem OnUpLoad; | ||
979 | |||
980 | private UpdateItem handlerUpdateItem = null; | ||
981 | |||
982 | private string uploaderPath = String.Empty; | ||
983 | private UUID inventoryItemID; | ||
984 | private IHttpServer httpListener; | ||
985 | private bool m_dumpAssetToFile; | ||
986 | |||
987 | public ItemUpdater(UUID inventoryItem, string path, IHttpServer httpServer, bool dumpAssetToFile) | ||
990 | { | 988 | { |
991 | // m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); | 989 | m_dumpAssetToFile = dumpAssetToFile; |
992 | 990 | ||
993 | AssetBase asset; | 991 | inventoryItemID = inventoryItem; |
994 | asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString()); | 992 | uploaderPath = path; |
995 | asset.Data = data; | 993 | httpListener = httpServer; |
996 | asset.Temporary = true; | ||
997 | asset.Local = ! m_persistBakedTextures; // Local assets aren't persisted, non-local are | ||
998 | m_assetCache.Store(asset); | ||
999 | } | 994 | } |
1000 | 995 | ||
1001 | /// <summary> | 996 | /// <summary> |
1002 | /// Called when new asset data for an agent inventory item update has been uploaded. | 997 | /// |
1003 | /// </summary> | 998 | /// </summary> |
1004 | /// <param name="itemID">Item to update</param> | 999 | /// <param name="data"></param> |
1005 | /// <param name="data">New asset data</param> | 1000 | /// <param name="path"></param> |
1001 | /// <param name="param"></param> | ||
1006 | /// <returns></returns> | 1002 | /// <returns></returns> |
1007 | public UUID ItemUpdated(UUID itemID, byte[] data) | 1003 | public string uploaderCaps(byte[] data, string path, string param) |
1008 | { | 1004 | { |
1009 | if (ItemUpdatedCall != null) | 1005 | UUID inv = inventoryItemID; |
1006 | string res = String.Empty; | ||
1007 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | ||
1008 | UUID assetID = UUID.Zero; | ||
1009 | handlerUpdateItem = OnUpLoad; | ||
1010 | if (handlerUpdateItem != null) | ||
1010 | { | 1011 | { |
1011 | return ItemUpdatedCall(m_agentID, itemID, data); | 1012 | assetID = handlerUpdateItem(inv, data); |
1012 | } | 1013 | } |
1013 | 1014 | ||
1014 | return UUID.Zero; | 1015 | uploadComplete.new_asset = assetID.ToString(); |
1015 | } | 1016 | uploadComplete.new_inventory_item = inv; |
1017 | uploadComplete.state = "complete"; | ||
1016 | 1018 | ||
1017 | /// <summary> | 1019 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); |
1018 | /// Called when new asset data for an agent inventory item update has been uploaded. | 1020 | |
1019 | /// </summary> | 1021 | httpListener.RemoveStreamHandler("POST", uploaderPath); |
1020 | /// <param name="itemID">Item to update</param> | 1022 | |
1021 | /// <param name="primID">Prim containing item to update</param> | 1023 | if (m_dumpAssetToFile) |
1022 | /// <param name="isScriptRunning">Signals whether the script to update is currently running</param> | ||
1023 | /// <param name="data">New asset data</param> | ||
1024 | public void TaskScriptUpdated(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors) | ||
1025 | { | ||
1026 | if (TaskScriptUpdatedCall != null) | ||
1027 | { | 1024 | { |
1028 | ArrayList e = TaskScriptUpdatedCall(m_agentID, itemID, primID, isScriptRunning, data); | 1025 | SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data); |
1029 | foreach (Object item in e) | ||
1030 | errors.Add(item); | ||
1031 | } | 1026 | } |
1032 | } | ||
1033 | 1027 | ||
1034 | public class AssetUploader | 1028 | return res; |
1029 | } | ||
1030 | ///Left this in and commented in case there are unforseen issues | ||
1031 | //private void SaveAssetToFile(string filename, byte[] data) | ||
1032 | //{ | ||
1033 | // FileStream fs = File.Create(filename); | ||
1034 | // BinaryWriter bw = new BinaryWriter(fs); | ||
1035 | // bw.Write(data); | ||
1036 | // bw.Close(); | ||
1037 | // fs.Close(); | ||
1038 | //} | ||
1039 | private static void SaveAssetToFile(string filename, byte[] data) | ||
1035 | { | 1040 | { |
1036 | public event UpLoadedAsset OnUpLoad; | 1041 | string assetPath = "UserAssets"; |
1037 | private UpLoadedAsset handlerUpLoad = null; | 1042 | if (!Directory.Exists(assetPath)) |
1038 | |||
1039 | private string uploaderPath = String.Empty; | ||
1040 | private UUID newAssetID; | ||
1041 | private UUID inventoryItemID; | ||
1042 | private UUID parentFolder; | ||
1043 | private IHttpServer httpListener; | ||
1044 | private bool m_dumpAssetsToFile; | ||
1045 | private string m_assetName = String.Empty; | ||
1046 | private string m_assetDes = String.Empty; | ||
1047 | |||
1048 | private string m_invType = String.Empty; | ||
1049 | private string m_assetType = String.Empty; | ||
1050 | |||
1051 | public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, | ||
1052 | UUID parentFolderID, string invType, string assetType, string path, | ||
1053 | IHttpServer httpServer, bool dumpAssetsToFile) | ||
1054 | { | 1043 | { |
1055 | m_assetName = assetName; | 1044 | Directory.CreateDirectory(assetPath); |
1056 | m_assetDes = description; | ||
1057 | newAssetID = assetID; | ||
1058 | inventoryItemID = inventoryItem; | ||
1059 | uploaderPath = path; | ||
1060 | httpListener = httpServer; | ||
1061 | parentFolder = parentFolderID; | ||
1062 | m_assetType = assetType; | ||
1063 | m_invType = invType; | ||
1064 | m_dumpAssetsToFile = dumpAssetsToFile; | ||
1065 | } | 1045 | } |
1046 | FileStream fs = File.Create(Path.Combine(assetPath, filename)); | ||
1047 | BinaryWriter bw = new BinaryWriter(fs); | ||
1048 | bw.Write(data); | ||
1049 | bw.Close(); | ||
1050 | fs.Close(); | ||
1051 | } | ||
1052 | } | ||
1066 | 1053 | ||
1067 | /// <summary> | 1054 | /// <summary> |
1068 | /// | 1055 | /// This class is a callback invoked when a client sends asset data to |
1069 | /// </summary> | 1056 | /// a task inventory script update url |
1070 | /// <param name="data"></param> | 1057 | /// </summary> |
1071 | /// <param name="path"></param> | 1058 | public class TaskInventoryScriptUpdater |
1072 | /// <param name="param"></param> | 1059 | { |
1073 | /// <returns></returns> | 1060 | private static readonly ILog m_log = |
1074 | public string uploaderCaps(byte[] data, string path, string param) | 1061 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
1075 | { | ||
1076 | UUID inv = inventoryItemID; | ||
1077 | string res = String.Empty; | ||
1078 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | ||
1079 | uploadComplete.new_asset = newAssetID.ToString(); | ||
1080 | uploadComplete.new_inventory_item = inv; | ||
1081 | uploadComplete.state = "complete"; | ||
1082 | 1062 | ||
1083 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | 1063 | public event UpdateTaskScript OnUpLoad; |
1084 | 1064 | ||
1085 | httpListener.RemoveStreamHandler("POST", uploaderPath); | 1065 | private UpdateTaskScript handlerUpdateTaskScript = null; |
1086 | 1066 | ||
1087 | // TODO: probably make this a better set of extensions here | 1067 | private string uploaderPath = String.Empty; |
1088 | string extension = ".jp2"; | 1068 | private UUID inventoryItemID; |
1089 | if (m_invType != "image") | 1069 | private UUID primID; |
1090 | { | 1070 | private bool isScriptRunning; |
1091 | extension = ".dat"; | 1071 | private IHttpServer httpListener; |
1092 | } | 1072 | private bool m_dumpAssetToFile; |
1093 | 1073 | ||
1094 | if (m_dumpAssetsToFile) | 1074 | public TaskInventoryScriptUpdater(UUID inventoryItemID, UUID primID, int isScriptRunning, |
1095 | { | 1075 | string path, IHttpServer httpServer, bool dumpAssetToFile) |
1096 | SaveAssetToFile(m_assetName + extension, data); | 1076 | { |
1097 | } | 1077 | m_dumpAssetToFile = dumpAssetToFile; |
1098 | handlerUpLoad = OnUpLoad; | ||
1099 | if (handlerUpLoad != null) | ||
1100 | { | ||
1101 | handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); | ||
1102 | } | ||
1103 | 1078 | ||
1104 | return res; | 1079 | this.inventoryItemID = inventoryItemID; |
1105 | } | 1080 | this.primID = primID; |
1106 | ///Left this in and commented in case there are unforseen issues | 1081 | |
1107 | //private void SaveAssetToFile(string filename, byte[] data) | 1082 | // This comes in over the packet as an integer, but actually appears to be treated as a bool |
1108 | //{ | 1083 | this.isScriptRunning = (0 == isScriptRunning ? false : true); |
1109 | // FileStream fs = File.Create(filename); | 1084 | |
1110 | // BinaryWriter bw = new BinaryWriter(fs); | 1085 | uploaderPath = path; |
1111 | // bw.Write(data); | 1086 | httpListener = httpServer; |
1112 | // bw.Close(); | ||
1113 | // fs.Close(); | ||
1114 | //} | ||
1115 | private static void SaveAssetToFile(string filename, byte[] data) | ||
1116 | { | ||
1117 | string assetPath = "UserAssets"; | ||
1118 | if (!Directory.Exists(assetPath)) | ||
1119 | { | ||
1120 | Directory.CreateDirectory(assetPath); | ||
1121 | } | ||
1122 | FileStream fs = File.Create(Path.Combine(assetPath, Util.safeFileName(filename))); | ||
1123 | BinaryWriter bw = new BinaryWriter(fs); | ||
1124 | bw.Write(data); | ||
1125 | bw.Close(); | ||
1126 | fs.Close(); | ||
1127 | } | ||
1128 | } | 1087 | } |
1129 | 1088 | ||
1130 | /// <summary> | 1089 | /// <summary> |
1131 | /// This class is a callback invoked when a client sends asset data to | 1090 | /// |
1132 | /// an agent inventory notecard update url | ||
1133 | /// </summary> | 1091 | /// </summary> |
1134 | public class ItemUpdater | 1092 | /// <param name="data"></param> |
1093 | /// <param name="path"></param> | ||
1094 | /// <param name="param"></param> | ||
1095 | /// <returns></returns> | ||
1096 | public string uploaderCaps(byte[] data, string path, string param) | ||
1135 | { | 1097 | { |
1136 | public event UpdateItem OnUpLoad; | 1098 | try |
1137 | |||
1138 | private UpdateItem handlerUpdateItem = null; | ||
1139 | |||
1140 | private string uploaderPath = String.Empty; | ||
1141 | private UUID inventoryItemID; | ||
1142 | private IHttpServer httpListener; | ||
1143 | private bool m_dumpAssetToFile; | ||
1144 | |||
1145 | public ItemUpdater(UUID inventoryItem, string path, IHttpServer httpServer, bool dumpAssetToFile) | ||
1146 | { | 1099 | { |
1147 | m_dumpAssetToFile = dumpAssetToFile; | 1100 | // m_log.InfoFormat("[CAPS]: " + |
1101 | // "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}", | ||
1102 | // data, path, param)); | ||
1148 | 1103 | ||
1149 | inventoryItemID = inventoryItem; | ||
1150 | uploaderPath = path; | ||
1151 | httpListener = httpServer; | ||
1152 | } | ||
1153 | |||
1154 | /// <summary> | ||
1155 | /// | ||
1156 | /// </summary> | ||
1157 | /// <param name="data"></param> | ||
1158 | /// <param name="path"></param> | ||
1159 | /// <param name="param"></param> | ||
1160 | /// <returns></returns> | ||
1161 | public string uploaderCaps(byte[] data, string path, string param) | ||
1162 | { | ||
1163 | UUID inv = inventoryItemID; | ||
1164 | string res = String.Empty; | 1104 | string res = String.Empty; |
1165 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | 1105 | LLSDTaskScriptUploadComplete uploadComplete = new LLSDTaskScriptUploadComplete(); |
1166 | UUID assetID = UUID.Zero; | 1106 | |
1167 | handlerUpdateItem = OnUpLoad; | 1107 | ArrayList errors = new ArrayList(); |
1168 | if (handlerUpdateItem != null) | 1108 | handlerUpdateTaskScript = OnUpLoad; |
1109 | if (handlerUpdateTaskScript != null) | ||
1169 | { | 1110 | { |
1170 | assetID = handlerUpdateItem(inv, data); | 1111 | handlerUpdateTaskScript(inventoryItemID, primID, isScriptRunning, data, ref errors); |
1171 | } | 1112 | } |
1172 | 1113 | ||
1173 | uploadComplete.new_asset = assetID.ToString(); | 1114 | uploadComplete.new_asset = inventoryItemID; |
1174 | uploadComplete.new_inventory_item = inv; | 1115 | uploadComplete.compiled = errors.Count > 0 ? false : true; |
1175 | uploadComplete.state = "complete"; | 1116 | uploadComplete.state = "complete"; |
1117 | uploadComplete.errors = new OSDArray(); | ||
1118 | uploadComplete.errors.Array = errors; | ||
1176 | 1119 | ||
1177 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | 1120 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); |
1178 | 1121 | ||
@@ -1180,189 +1123,91 @@ namespace OpenSim.Framework.Capabilities | |||
1180 | 1123 | ||
1181 | if (m_dumpAssetToFile) | 1124 | if (m_dumpAssetToFile) |
1182 | { | 1125 | { |
1183 | SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data); | 1126 | SaveAssetToFile("updatedtaskscript" + Util.RandomClass.Next(1, 1000) + ".dat", data); |
1184 | } | 1127 | } |
1185 | 1128 | ||
1129 | // m_log.InfoFormat("[CAPS]: TaskInventoryScriptUpdater.uploaderCaps res: {0}", res); | ||
1130 | |||
1186 | return res; | 1131 | return res; |
1187 | } | 1132 | } |
1188 | ///Left this in and commented in case there are unforseen issues | 1133 | catch (Exception e) |
1189 | //private void SaveAssetToFile(string filename, byte[] data) | ||
1190 | //{ | ||
1191 | // FileStream fs = File.Create(filename); | ||
1192 | // BinaryWriter bw = new BinaryWriter(fs); | ||
1193 | // bw.Write(data); | ||
1194 | // bw.Close(); | ||
1195 | // fs.Close(); | ||
1196 | //} | ||
1197 | private static void SaveAssetToFile(string filename, byte[] data) | ||
1198 | { | 1134 | { |
1199 | string assetPath = "UserAssets"; | 1135 | m_log.Error("[CAPS]: " + e.ToString()); |
1200 | if (!Directory.Exists(assetPath)) | ||
1201 | { | ||
1202 | Directory.CreateDirectory(assetPath); | ||
1203 | } | ||
1204 | FileStream fs = File.Create(Path.Combine(assetPath, filename)); | ||
1205 | BinaryWriter bw = new BinaryWriter(fs); | ||
1206 | bw.Write(data); | ||
1207 | bw.Close(); | ||
1208 | fs.Close(); | ||
1209 | } | 1136 | } |
1210 | } | ||
1211 | 1137 | ||
1212 | /// <summary> | 1138 | // XXX Maybe this should be some meaningful error packet |
1213 | /// This class is a callback invoked when a client sends asset data to | 1139 | return null; |
1214 | /// a task inventory script update url | 1140 | } |
1215 | /// </summary> | 1141 | ///Left this in and commented in case there are unforseen issues |
1216 | public class TaskInventoryScriptUpdater | 1142 | //private void SaveAssetToFile(string filename, byte[] data) |
1143 | //{ | ||
1144 | // FileStream fs = File.Create(filename); | ||
1145 | // BinaryWriter bw = new BinaryWriter(fs); | ||
1146 | // bw.Write(data); | ||
1147 | // bw.Close(); | ||
1148 | // fs.Close(); | ||
1149 | //} | ||
1150 | private static void SaveAssetToFile(string filename, byte[] data) | ||
1217 | { | 1151 | { |
1218 | public event UpdateTaskScript OnUpLoad; | 1152 | string assetPath = "UserAssets"; |
1219 | 1153 | if (!Directory.Exists(assetPath)) | |
1220 | private UpdateTaskScript handlerUpdateTaskScript = null; | ||
1221 | |||
1222 | private string uploaderPath = String.Empty; | ||
1223 | private UUID inventoryItemID; | ||
1224 | private UUID primID; | ||
1225 | private bool isScriptRunning; | ||
1226 | private IHttpServer httpListener; | ||
1227 | private bool m_dumpAssetToFile; | ||
1228 | |||
1229 | public TaskInventoryScriptUpdater(UUID inventoryItemID, UUID primID, int isScriptRunning, | ||
1230 | string path, IHttpServer httpServer, bool dumpAssetToFile) | ||
1231 | { | 1154 | { |
1232 | m_dumpAssetToFile = dumpAssetToFile; | 1155 | Directory.CreateDirectory(assetPath); |
1233 | |||
1234 | this.inventoryItemID = inventoryItemID; | ||
1235 | this.primID = primID; | ||
1236 | |||
1237 | // This comes in over the packet as an integer, but actually appears to be treated as a bool | ||
1238 | this.isScriptRunning = (0 == isScriptRunning ? false : true); | ||
1239 | |||
1240 | uploaderPath = path; | ||
1241 | httpListener = httpServer; | ||
1242 | } | 1156 | } |
1157 | FileStream fs = File.Create(Path.Combine(assetPath, filename)); | ||
1158 | BinaryWriter bw = new BinaryWriter(fs); | ||
1159 | bw.Write(data); | ||
1160 | bw.Close(); | ||
1161 | fs.Close(); | ||
1162 | } | ||
1163 | } | ||
1243 | 1164 | ||
1244 | /// <summary> | 1165 | public class BakedTextureUploader |
1245 | /// | 1166 | { |
1246 | /// </summary> | 1167 | public event UploadedBakedTexture OnUpLoad; |
1247 | /// <param name="data"></param> | 1168 | private UploadedBakedTexture handlerUpLoad = null; |
1248 | /// <param name="path"></param> | ||
1249 | /// <param name="param"></param> | ||
1250 | /// <returns></returns> | ||
1251 | public string uploaderCaps(byte[] data, string path, string param) | ||
1252 | { | ||
1253 | try | ||
1254 | { | ||
1255 | // m_log.InfoFormat("[CAPS]: " + | ||
1256 | // "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}", | ||
1257 | // data, path, param)); | ||
1258 | |||
1259 | string res = String.Empty; | ||
1260 | LLSDTaskScriptUploadComplete uploadComplete = new LLSDTaskScriptUploadComplete(); | ||
1261 | |||
1262 | ArrayList errors = new ArrayList(); | ||
1263 | handlerUpdateTaskScript = OnUpLoad; | ||
1264 | if (handlerUpdateTaskScript != null) | ||
1265 | { | ||
1266 | handlerUpdateTaskScript(inventoryItemID, primID, isScriptRunning, data, ref errors); | ||
1267 | } | ||
1268 | |||
1269 | uploadComplete.new_asset = inventoryItemID; | ||
1270 | uploadComplete.compiled = errors.Count > 0 ? false : true; | ||
1271 | uploadComplete.state = "complete"; | ||
1272 | uploadComplete.errors = new OSDArray(); | ||
1273 | uploadComplete.errors.Array = errors; | ||
1274 | |||
1275 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
1276 | |||
1277 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
1278 | |||
1279 | if (m_dumpAssetToFile) | ||
1280 | { | ||
1281 | SaveAssetToFile("updatedtaskscript" + Util.RandomClass.Next(1, 1000) + ".dat", data); | ||
1282 | } | ||
1283 | |||
1284 | // m_log.InfoFormat("[CAPS]: TaskInventoryScriptUpdater.uploaderCaps res: {0}", res); | ||
1285 | 1169 | ||
1286 | return res; | 1170 | private string uploaderPath = String.Empty; |
1287 | } | 1171 | private UUID newAssetID; |
1288 | catch (Exception e) | 1172 | private IHttpServer httpListener; |
1289 | { | ||
1290 | m_log.Error("[CAPS]: " + e.ToString()); | ||
1291 | } | ||
1292 | 1173 | ||
1293 | // XXX Maybe this should be some meaningful error packet | 1174 | public BakedTextureUploader(string path, IHttpServer httpServer) |
1294 | return null; | 1175 | { |
1295 | } | 1176 | newAssetID = UUID.Random(); |
1296 | ///Left this in and commented in case there are unforseen issues | 1177 | uploaderPath = path; |
1297 | //private void SaveAssetToFile(string filename, byte[] data) | 1178 | httpListener = httpServer; |
1298 | //{ | 1179 | // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID); |
1299 | // FileStream fs = File.Create(filename); | ||
1300 | // BinaryWriter bw = new BinaryWriter(fs); | ||
1301 | // bw.Write(data); | ||
1302 | // bw.Close(); | ||
1303 | // fs.Close(); | ||
1304 | //} | ||
1305 | private static void SaveAssetToFile(string filename, byte[] data) | ||
1306 | { | ||
1307 | string assetPath = "UserAssets"; | ||
1308 | if (!Directory.Exists(assetPath)) | ||
1309 | { | ||
1310 | Directory.CreateDirectory(assetPath); | ||
1311 | } | ||
1312 | FileStream fs = File.Create(Path.Combine(assetPath, filename)); | ||
1313 | BinaryWriter bw = new BinaryWriter(fs); | ||
1314 | bw.Write(data); | ||
1315 | bw.Close(); | ||
1316 | fs.Close(); | ||
1317 | } | ||
1318 | } | 1180 | } |
1319 | 1181 | ||
1320 | public class BakedTextureUploader | 1182 | /// <summary> |
1183 | /// | ||
1184 | /// </summary> | ||
1185 | /// <param name="data"></param> | ||
1186 | /// <param name="path"></param> | ||
1187 | /// <param name="param"></param> | ||
1188 | /// <returns></returns> | ||
1189 | public string uploaderCaps(byte[] data, string path, string param) | ||
1321 | { | 1190 | { |
1322 | public event UploadedBakedTexture OnUpLoad; | 1191 | handlerUpLoad = OnUpLoad; |
1323 | private UploadedBakedTexture handlerUpLoad = null; | 1192 | if (handlerUpLoad != null) |
1324 | |||
1325 | private string uploaderPath = String.Empty; | ||
1326 | private UUID newAssetID; | ||
1327 | private IHttpServer httpListener; | ||
1328 | |||
1329 | public BakedTextureUploader(string path, IHttpServer httpServer) | ||
1330 | { | 1193 | { |
1331 | newAssetID = UUID.Random(); | 1194 | Util.FireAndForget(delegate(object o) { handlerUpLoad(newAssetID, data); }); |
1332 | uploaderPath = path; | ||
1333 | httpListener = httpServer; | ||
1334 | // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID); | ||
1335 | } | 1195 | } |
1336 | 1196 | ||
1337 | /// <summary> | 1197 | string res = String.Empty; |
1338 | /// | 1198 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); |
1339 | /// </summary> | 1199 | uploadComplete.new_asset = newAssetID.ToString(); |
1340 | /// <param name="data"></param> | 1200 | uploadComplete.new_inventory_item = UUID.Zero; |
1341 | /// <param name="path"></param> | 1201 | uploadComplete.state = "complete"; |
1342 | /// <param name="param"></param> | ||
1343 | /// <returns></returns> | ||
1344 | public string uploaderCaps(byte[] data, string path, string param) | ||
1345 | { | ||
1346 | handlerUpLoad = OnUpLoad; | ||
1347 | if (handlerUpLoad != null) | ||
1348 | { | ||
1349 | Util.FireAndForget(delegate(object o) { handlerUpLoad(newAssetID, data); }); | ||
1350 | } | ||
1351 | |||
1352 | string res = String.Empty; | ||
1353 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | ||
1354 | uploadComplete.new_asset = newAssetID.ToString(); | ||
1355 | uploadComplete.new_inventory_item = UUID.Zero; | ||
1356 | uploadComplete.state = "complete"; | ||
1357 | 1202 | ||
1358 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | 1203 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); |
1359 | 1204 | ||
1360 | httpListener.RemoveStreamHandler("POST", uploaderPath); | 1205 | httpListener.RemoveStreamHandler("POST", uploaderPath); |
1361 | 1206 | ||
1362 | // m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID); | 1207 | // m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID); |
1363 | 1208 | ||
1364 | return res; | 1209 | return res; |
1365 | } | ||
1366 | } | 1210 | } |
1367 | } | 1211 | } |
1212 | |||
1368 | } | 1213 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs new file mode 100644 index 0000000..14160ae --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | |||
32 | using log4net; | ||
33 | using Nini.Config; | ||
34 | using OpenMetaverse; | ||
35 | using Mono.Addins; | ||
36 | |||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Region.Framework; | ||
39 | using OpenSim.Region.Framework.Interfaces; | ||
40 | using OpenSim.Region.Framework.Scenes; | ||
41 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
42 | |||
43 | [assembly: Addin("LindenCaps", "0.1")] | ||
44 | [assembly: AddinDependency("OpenSim", "0.5")] | ||
45 | namespace OpenSim.Region.ClientStack.Linden | ||
46 | { | ||
47 | |||
48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | ||
49 | public class BunchOfCapsModule : INonSharedRegionModule | ||
50 | { | ||
51 | private static readonly ILog m_log = | ||
52 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
53 | |||
54 | private Scene m_Scene; | ||
55 | |||
56 | #region INonSharedRegionModule | ||
57 | |||
58 | public string Name { get { return "BunchOfCapsModule"; } } | ||
59 | |||
60 | public Type ReplaceableInterface { get { return null; } } | ||
61 | |||
62 | public void Initialise(IConfigSource source) | ||
63 | { | ||
64 | } | ||
65 | |||
66 | public void Close() { } | ||
67 | |||
68 | public void AddRegion(Scene scene) | ||
69 | { | ||
70 | m_Scene = scene; | ||
71 | m_Scene.EventManager.OnRegisterCaps += OnRegisterCaps; | ||
72 | } | ||
73 | |||
74 | public void RemoveRegion(Scene scene) | ||
75 | { | ||
76 | } | ||
77 | |||
78 | public void RegionLoaded(Scene scene) | ||
79 | { | ||
80 | } | ||
81 | |||
82 | public void PostInitialise() { } | ||
83 | #endregion | ||
84 | |||
85 | private void OnRegisterCaps(UUID agentID, Caps caps) | ||
86 | { | ||
87 | new BunchOfCaps(m_Scene, caps); | ||
88 | } | ||
89 | |||
90 | } | ||
91 | } | ||
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 05fe3ee..4a8bb53 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | |||
@@ -33,6 +33,7 @@ using System.Reflection; | |||
33 | using System.Threading; | 33 | using System.Threading; |
34 | using log4net; | 34 | using log4net; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using Mono.Addins; | ||
36 | using OpenMetaverse; | 37 | using OpenMetaverse; |
37 | using OpenMetaverse.Messages.Linden; | 38 | using OpenMetaverse.Messages.Linden; |
38 | using OpenMetaverse.Packets; | 39 | using OpenMetaverse.Packets; |
@@ -45,7 +46,7 @@ using OpenSim.Region.Framework.Scenes; | |||
45 | using BlockingLLSDQueue = OpenSim.Framework.BlockingQueue<OpenMetaverse.StructuredData.OSD>; | 46 | using BlockingLLSDQueue = OpenSim.Framework.BlockingQueue<OpenMetaverse.StructuredData.OSD>; |
46 | using Caps=OpenSim.Framework.Capabilities.Caps; | 47 | using Caps=OpenSim.Framework.Capabilities.Caps; |
47 | 48 | ||
48 | namespace OpenSim.Region.CoreModules.Framework.EventQueue | 49 | namespace OpenSim.Region.ClientStack.Linden |
49 | { | 50 | { |
50 | public struct QueueItem | 51 | public struct QueueItem |
51 | { | 52 | { |
@@ -53,6 +54,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
53 | public OSDMap body; | 54 | public OSDMap body; |
54 | } | 55 | } |
55 | 56 | ||
57 | //[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | ||
56 | public class EventQueueGetModule : IEventQueue, IRegionModule | 58 | public class EventQueueGetModule : IEventQueue, IRegionModule |
57 | { | 59 | { |
58 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 60 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -520,7 +522,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
520 | } | 522 | } |
521 | if (AvatarID != UUID.Zero) | 523 | if (AvatarID != UUID.Zero) |
522 | { | 524 | { |
523 | return ProcessQueue(request, AvatarID, m_scene.CapsModule.GetCapsHandlerForUser(AvatarID)); | 525 | return ProcessQueue(request, AvatarID, m_scene.CapsModule.GetCapsForUser(AvatarID)); |
524 | } | 526 | } |
525 | else | 527 | else |
526 | { | 528 | { |
@@ -715,5 +717,15 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
715 | OSD item = EventQueueHelper.PlacesQuery(groupUpdate); | 717 | OSD item = EventQueueHelper.PlacesQuery(groupUpdate); |
716 | Enqueue(item, avatarID); | 718 | Enqueue(item, avatarID); |
717 | } | 719 | } |
720 | |||
721 | public OSD ScriptRunningEvent(UUID objectID, UUID itemID, bool running, bool mono) | ||
722 | { | ||
723 | return EventQueueHelper.ScriptRunningReplyEvent(objectID, itemID, running, mono); | ||
724 | } | ||
725 | |||
726 | public OSD BuildEvent(string eventName, OSD eventBody) | ||
727 | { | ||
728 | return EventQueueHelper.BuildEvent(eventName, eventBody); | ||
729 | } | ||
718 | } | 730 | } |
719 | } | 731 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index 0d7d16a..3f49aba 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs | |||
@@ -32,7 +32,7 @@ using OpenMetaverse.Packets; | |||
32 | using OpenMetaverse.StructuredData; | 32 | using OpenMetaverse.StructuredData; |
33 | using OpenMetaverse.Messages.Linden; | 33 | using OpenMetaverse.Messages.Linden; |
34 | 34 | ||
35 | namespace OpenSim.Region.CoreModules.Framework.EventQueue | 35 | namespace OpenSim.Region.ClientStack.Linden |
36 | { | 36 | { |
37 | public class EventQueueHelper | 37 | public class EventQueueHelper |
38 | { | 38 | { |
@@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
61 | // return result; | 61 | // return result; |
62 | // } | 62 | // } |
63 | 63 | ||
64 | public static OSD buildEvent(string eventName, OSD eventBody) | 64 | public static OSD BuildEvent(string eventName, OSD eventBody) |
65 | { | 65 | { |
66 | OSDMap llsdEvent = new OSDMap(2); | 66 | OSDMap llsdEvent = new OSDMap(2); |
67 | llsdEvent.Add("message", new OSDString(eventName)); | 67 | llsdEvent.Add("message", new OSDString(eventName)); |
@@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
84 | OSDMap llsdBody = new OSDMap(1); | 84 | OSDMap llsdBody = new OSDMap(1); |
85 | llsdBody.Add("SimulatorInfo", arr); | 85 | llsdBody.Add("SimulatorInfo", arr); |
86 | 86 | ||
87 | return buildEvent("EnableSimulator", llsdBody); | 87 | return BuildEvent("EnableSimulator", llsdBody); |
88 | } | 88 | } |
89 | 89 | ||
90 | public static OSD DisableSimulator(ulong handle) | 90 | public static OSD DisableSimulator(ulong handle) |
@@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
99 | OSDMap llsdBody = new OSDMap(0); | 99 | OSDMap llsdBody = new OSDMap(0); |
100 | //llsdBody.Add("SimulatorInfo", arr); | 100 | //llsdBody.Add("SimulatorInfo", arr); |
101 | 101 | ||
102 | return buildEvent("DisableSimulator", llsdBody); | 102 | return BuildEvent("DisableSimulator", llsdBody); |
103 | } | 103 | } |
104 | 104 | ||
105 | public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt, | 105 | public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt, |
@@ -144,7 +144,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
144 | llsdBody.Add("AgentData", agentDataArr); | 144 | llsdBody.Add("AgentData", agentDataArr); |
145 | llsdBody.Add("RegionData", regionDataArr); | 145 | llsdBody.Add("RegionData", regionDataArr); |
146 | 146 | ||
147 | return buildEvent("CrossedRegion", llsdBody); | 147 | return BuildEvent("CrossedRegion", llsdBody); |
148 | } | 148 | } |
149 | 149 | ||
150 | public static OSD TeleportFinishEvent( | 150 | public static OSD TeleportFinishEvent( |
@@ -167,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
167 | OSDMap body = new OSDMap(); | 167 | OSDMap body = new OSDMap(); |
168 | body.Add("Info", infoArr); | 168 | body.Add("Info", infoArr); |
169 | 169 | ||
170 | return buildEvent("TeleportFinish", body); | 170 | return BuildEvent("TeleportFinish", body); |
171 | } | 171 | } |
172 | 172 | ||
173 | public static OSD ScriptRunningReplyEvent(UUID objectID, UUID itemID, bool running, bool mono) | 173 | public static OSD ScriptRunningReplyEvent(UUID objectID, UUID itemID, bool running, bool mono) |
@@ -184,7 +184,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
184 | OSDMap body = new OSDMap(); | 184 | OSDMap body = new OSDMap(); |
185 | body.Add("Script", scriptArr); | 185 | body.Add("Script", scriptArr); |
186 | 186 | ||
187 | return buildEvent("ScriptRunningReply", body); | 187 | return BuildEvent("ScriptRunningReply", body); |
188 | } | 188 | } |
189 | 189 | ||
190 | public static OSD EstablishAgentCommunication(UUID agentID, string simIpAndPort, string seedcap) | 190 | public static OSD EstablishAgentCommunication(UUID agentID, string simIpAndPort, string seedcap) |
@@ -194,12 +194,12 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
194 | body.Add("sim-ip-and-port", new OSDString(simIpAndPort)); | 194 | body.Add("sim-ip-and-port", new OSDString(simIpAndPort)); |
195 | body.Add("seed-capability", new OSDString(seedcap)); | 195 | body.Add("seed-capability", new OSDString(seedcap)); |
196 | 196 | ||
197 | return buildEvent("EstablishAgentCommunication", body); | 197 | return BuildEvent("EstablishAgentCommunication", body); |
198 | } | 198 | } |
199 | 199 | ||
200 | public static OSD KeepAliveEvent() | 200 | public static OSD KeepAliveEvent() |
201 | { | 201 | { |
202 | return buildEvent("FAKEEVENT", new OSDMap()); | 202 | return BuildEvent("FAKEEVENT", new OSDMap()); |
203 | } | 203 | } |
204 | 204 | ||
205 | public static OSD AgentParams(UUID agentID, bool checkEstate, int godLevel, bool limitedToEstate) | 205 | public static OSD AgentParams(UUID agentID, bool checkEstate, int godLevel, bool limitedToEstate) |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs new file mode 100644 index 0000000..f2f765c --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | |||
@@ -0,0 +1,136 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Specialized; | ||
31 | using System.Reflection; | ||
32 | using System.IO; | ||
33 | using System.Web; | ||
34 | using Mono.Addins; | ||
35 | using log4net; | ||
36 | using Nini.Config; | ||
37 | using OpenMetaverse; | ||
38 | using OpenMetaverse.StructuredData; | ||
39 | using OpenSim.Capabilities.Handlers; | ||
40 | using OpenSim.Framework; | ||
41 | using OpenSim.Framework.Servers; | ||
42 | using OpenSim.Framework.Servers.HttpServer; | ||
43 | using OpenSim.Region.Framework.Interfaces; | ||
44 | using OpenSim.Region.Framework.Scenes; | ||
45 | using OpenSim.Services.Interfaces; | ||
46 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
47 | |||
48 | namespace OpenSim.Region.ClientStack.Linden | ||
49 | { | ||
50 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | ||
51 | public class GetMeshModule : INonSharedRegionModule | ||
52 | { | ||
53 | private static readonly ILog m_log = | ||
54 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
55 | |||
56 | private Scene m_scene; | ||
57 | private IAssetService m_AssetService; | ||
58 | private bool m_Enabled = true; | ||
59 | private string m_URL; | ||
60 | |||
61 | #region IRegionModuleBase Members | ||
62 | |||
63 | public Type ReplaceableInterface | ||
64 | { | ||
65 | get { return null; } | ||
66 | } | ||
67 | |||
68 | public void Initialise(IConfigSource source) | ||
69 | { | ||
70 | IConfig config = source.Configs["ClientStack.LindenCaps"]; | ||
71 | if (config == null) | ||
72 | return; | ||
73 | |||
74 | m_URL = config.GetString("Cap_GetMesh", string.Empty); | ||
75 | // Cap doesn't exist | ||
76 | if (m_URL != string.Empty) | ||
77 | m_Enabled = true; | ||
78 | } | ||
79 | |||
80 | public void AddRegion(Scene pScene) | ||
81 | { | ||
82 | if (!m_Enabled) | ||
83 | return; | ||
84 | |||
85 | m_scene = pScene; | ||
86 | } | ||
87 | |||
88 | public void RemoveRegion(Scene scene) | ||
89 | { | ||
90 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | ||
91 | m_scene = null; | ||
92 | } | ||
93 | |||
94 | public void RegionLoaded(Scene scene) | ||
95 | { | ||
96 | if (!m_Enabled) | ||
97 | return; | ||
98 | |||
99 | m_AssetService = m_scene.RequestModuleInterface<IAssetService>(); | ||
100 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
101 | } | ||
102 | |||
103 | |||
104 | public void Close() { } | ||
105 | |||
106 | public string Name { get { return "GetMeshModule"; } } | ||
107 | |||
108 | #endregion | ||
109 | |||
110 | |||
111 | public void RegisterCaps(UUID agentID, Caps caps) | ||
112 | { | ||
113 | UUID capID = UUID.Random(); | ||
114 | |||
115 | //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); | ||
116 | if (m_URL == "localhost") | ||
117 | { | ||
118 | m_log.InfoFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | ||
119 | GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); | ||
120 | IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), | ||
121 | delegate(Hashtable m_dhttpMethod) | ||
122 | { | ||
123 | return gmeshHandler.ProcessGetMesh(m_dhttpMethod, UUID.Zero, null); | ||
124 | }); | ||
125 | |||
126 | caps.RegisterHandler("GetMesh", reqHandler); | ||
127 | } | ||
128 | else | ||
129 | { | ||
130 | m_log.InfoFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); | ||
131 | caps.RegisterHandler("GetMesh", m_URL); | ||
132 | } | ||
133 | } | ||
134 | |||
135 | } | ||
136 | } | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs new file mode 100644 index 0000000..564ef31 --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -0,0 +1,139 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Specialized; | ||
31 | using System.Drawing; | ||
32 | using System.Drawing.Imaging; | ||
33 | using System.Reflection; | ||
34 | using System.IO; | ||
35 | using System.Web; | ||
36 | using log4net; | ||
37 | using Nini.Config; | ||
38 | using Mono.Addins; | ||
39 | using OpenMetaverse; | ||
40 | using OpenMetaverse.StructuredData; | ||
41 | using OpenMetaverse.Imaging; | ||
42 | using OpenSim.Framework; | ||
43 | using OpenSim.Framework.Servers; | ||
44 | using OpenSim.Framework.Servers.HttpServer; | ||
45 | using OpenSim.Region.Framework.Interfaces; | ||
46 | using OpenSim.Region.Framework.Scenes; | ||
47 | using OpenSim.Services.Interfaces; | ||
48 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
49 | using OpenSim.Capabilities.Handlers; | ||
50 | |||
51 | namespace OpenSim.Region.ClientStack.Linden | ||
52 | { | ||
53 | |||
54 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | ||
55 | public class GetTextureModule : INonSharedRegionModule | ||
56 | { | ||
57 | private static readonly ILog m_log = | ||
58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
59 | private Scene m_scene; | ||
60 | private IAssetService m_assetService; | ||
61 | |||
62 | private bool m_Enabled = false; | ||
63 | |||
64 | // TODO: Change this to a config option | ||
65 | const string REDIRECT_URL = null; | ||
66 | |||
67 | private string m_URL; | ||
68 | |||
69 | #region ISharedRegionModule Members | ||
70 | |||
71 | public void Initialise(IConfigSource source) | ||
72 | { | ||
73 | IConfig config = source.Configs["ClientStack.LindenCaps"]; | ||
74 | if (config == null) | ||
75 | return; | ||
76 | |||
77 | m_URL = config.GetString("Cap_GetTexture", string.Empty); | ||
78 | // Cap doesn't exist | ||
79 | if (m_URL != string.Empty) | ||
80 | m_Enabled = true; | ||
81 | } | ||
82 | |||
83 | public void AddRegion(Scene s) | ||
84 | { | ||
85 | if (!m_Enabled) | ||
86 | return; | ||
87 | |||
88 | m_scene = s; | ||
89 | } | ||
90 | |||
91 | public void RemoveRegion(Scene s) | ||
92 | { | ||
93 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | ||
94 | m_scene = null; | ||
95 | } | ||
96 | |||
97 | public void RegionLoaded(Scene s) | ||
98 | { | ||
99 | if (!m_Enabled) | ||
100 | return; | ||
101 | |||
102 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | ||
103 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
104 | } | ||
105 | |||
106 | public void PostInitialise() | ||
107 | { | ||
108 | } | ||
109 | |||
110 | public void Close() { } | ||
111 | |||
112 | public string Name { get { return "GetTextureModule"; } } | ||
113 | |||
114 | public Type ReplaceableInterface | ||
115 | { | ||
116 | get { return null; } | ||
117 | } | ||
118 | |||
119 | #endregion | ||
120 | |||
121 | public void RegisterCaps(UUID agentID, Caps caps) | ||
122 | { | ||
123 | UUID capID = UUID.Random(); | ||
124 | |||
125 | //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); | ||
126 | if (m_URL == "localhost") | ||
127 | { | ||
128 | m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | ||
129 | caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService)); | ||
130 | } | ||
131 | else | ||
132 | { | ||
133 | m_log.InfoFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); | ||
134 | caps.RegisterHandler("GetTexture", m_URL); | ||
135 | } | ||
136 | } | ||
137 | |||
138 | } | ||
139 | } | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs index 3d4c7b7..b7e79cc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs | |||
@@ -45,7 +45,7 @@ using OpenSim.Services.Interfaces; | |||
45 | using Caps = OpenSim.Framework.Capabilities.Caps; | 45 | using Caps = OpenSim.Framework.Capabilities.Caps; |
46 | using OpenSim.Framework.Capabilities; | 46 | using OpenSim.Framework.Capabilities; |
47 | 47 | ||
48 | namespace OpenSim.Region.CoreModules.Avatar.Assets | 48 | namespace OpenSim.Region.ClientStack.Linden |
49 | { | 49 | { |
50 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 50 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
51 | public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule | 51 | public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule |
@@ -171,8 +171,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets | |||
171 | UUID parentFolder = llsdRequest.folder_id; | 171 | UUID parentFolder = llsdRequest.folder_id; |
172 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000") + "/"; | 172 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000") + "/"; |
173 | 173 | ||
174 | Caps.AssetUploader uploader = | 174 | AssetUploader uploader = |
175 | new Caps.AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, | 175 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, |
176 | llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile); | 176 | llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile); |
177 | MainServer.Instance.AddStreamHandler( | 177 | MainServer.Instance.AddStreamHandler( |
178 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 178 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); |
diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs index a0d72ed..15139a3 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs | |||
@@ -39,7 +39,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
39 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using Caps=OpenSim.Framework.Capabilities.Caps; | 40 | using Caps=OpenSim.Framework.Capabilities.Caps; |
41 | 41 | ||
42 | namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps | 42 | namespace OpenSim.Region.ClientStack.Linden |
43 | { | 43 | { |
44 | public class ObjectAdd : IRegionModule | 44 | public class ObjectAdd : IRegionModule |
45 | { | 45 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs index 3114d7f..3809f84 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs | |||
@@ -49,7 +49,7 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap; | |||
49 | using OpenSim.Framework.Capabilities; | 49 | using OpenSim.Framework.Capabilities; |
50 | using ExtraParamType = OpenMetaverse.ExtraParamType; | 50 | using ExtraParamType = OpenMetaverse.ExtraParamType; |
51 | 51 | ||
52 | namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps | 52 | namespace OpenSim.Region.ClientStack.Linden |
53 | { | 53 | { |
54 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 54 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
55 | public class UploadObjectAssetModule : INonSharedRegionModule | 55 | public class UploadObjectAssetModule : INonSharedRegionModule |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/IncomingPacket.cs b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs index 90b3ede..90b3ede 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/IncomingPacket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/IncomingPacketHistoryCollection.cs b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacketHistoryCollection.cs index 1f73a1d..1f73a1d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/IncomingPacketHistoryCollection.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacketHistoryCollection.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index e9e2dca..e9e2dca 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 43903ce..43903ce 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index 9e0db12..9e0db12 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index ca5501d..ca5501d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index aff90c5..aff90c5 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 6eebd9d..6eebd9d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs b/OpenSim/Region/ClientStack/Linden/UDP/OutgoingPacket.cs index 76c6c14..76c6c14 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OutgoingPacket.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs index daab84f..daab84f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs index 34c21aa..34c21aa 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs index 7d0757f..7d0757f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLPacketServer.cs index e995d65..e995d65 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLPacketServer.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs index f98586d..f98586d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs index c9aac0b..c9aac0b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 29fd1a4..29fd1a4 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs index 793aefe..793aefe 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs | |||
diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index 1d8e70e..5e22c8c 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using Mono.Addins; | ||
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
@@ -38,8 +39,9 @@ using OpenSim.Region.Framework.Interfaces; | |||
38 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
39 | using Caps=OpenSim.Framework.Capabilities.Caps; | 40 | using Caps=OpenSim.Framework.Capabilities.Caps; |
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.Agent.Capabilities | 42 | namespace OpenSim.Region.CoreModules.Framework |
42 | { | 43 | { |
44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | ||
43 | public class CapabilitiesModule : INonSharedRegionModule, ICapabilitiesModule | 45 | public class CapabilitiesModule : INonSharedRegionModule, ICapabilitiesModule |
44 | { | 46 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -49,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
49 | /// <summary> | 51 | /// <summary> |
50 | /// Each agent has its own capabilities handler. | 52 | /// Each agent has its own capabilities handler. |
51 | /// </summary> | 53 | /// </summary> |
52 | protected Dictionary<UUID, Caps> m_capsHandlers = new Dictionary<UUID, Caps>(); | 54 | protected Dictionary<UUID, Caps> m_capsObjects = new Dictionary<UUID, Caps>(); |
53 | 55 | ||
54 | protected Dictionary<UUID, string> capsPaths = new Dictionary<UUID, string>(); | 56 | protected Dictionary<UUID, string> capsPaths = new Dictionary<UUID, string>(); |
55 | protected Dictionary<UUID, Dictionary<ulong, string>> childrenSeeds | 57 | protected Dictionary<UUID, Dictionary<ulong, string>> childrenSeeds |
@@ -93,19 +95,19 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
93 | get { return null; } | 95 | get { return null; } |
94 | } | 96 | } |
95 | 97 | ||
96 | public void AddCapsHandler(UUID agentId) | 98 | public void CreateCaps(UUID agentId) |
97 | { | 99 | { |
98 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId)) | 100 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId)) |
99 | return; | 101 | return; |
100 | 102 | ||
101 | String capsObjectPath = GetCapsPath(agentId); | 103 | String capsObjectPath = GetCapsPath(agentId); |
102 | 104 | ||
103 | if (m_capsHandlers.ContainsKey(agentId)) | 105 | if (m_capsObjects.ContainsKey(agentId)) |
104 | { | 106 | { |
105 | Caps oldCaps = m_capsHandlers[agentId]; | 107 | Caps oldCaps = m_capsObjects[agentId]; |
106 | 108 | ||
107 | m_log.DebugFormat( | 109 | m_log.DebugFormat( |
108 | "[CAPS]: Reregistering caps for agent {0}. Old caps path {1}, new caps path {2}. ", | 110 | "[CAPS]: Recreating caps for agent {0}. Old caps path {1}, new caps path {2}. ", |
109 | agentId, oldCaps.CapsObjectPath, capsObjectPath); | 111 | agentId, oldCaps.CapsObjectPath, capsObjectPath); |
110 | // This should not happen. The caller code is confused. We need to fix that. | 112 | // This should not happen. The caller code is confused. We need to fix that. |
111 | // CAPs can never be reregistered, or the client will be confused. | 113 | // CAPs can never be reregistered, or the client will be confused. |
@@ -113,39 +115,29 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
113 | //return; | 115 | //return; |
114 | } | 116 | } |
115 | 117 | ||
116 | Caps caps | 118 | Caps caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName, |
117 | = new Caps(m_scene, | ||
118 | m_scene.AssetService, MainServer.Instance, m_scene.RegionInfo.ExternalHostName, | ||
119 | (MainServer.Instance == null) ? 0: MainServer.Instance.Port, | 119 | (MainServer.Instance == null) ? 0: MainServer.Instance.Port, |
120 | capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName); | 120 | capsObjectPath, agentId, m_scene.RegionInfo.RegionName); |
121 | 121 | ||
122 | caps.RegisterHandlers(); | 122 | m_capsObjects[agentId] = caps; |
123 | 123 | ||
124 | m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); | 124 | m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); |
125 | |||
126 | caps.AddNewInventoryItem = m_scene.AddUploadedInventoryItem; | ||
127 | caps.ItemUpdatedCall = m_scene.CapsUpdateInventoryItemAsset; | ||
128 | caps.TaskScriptUpdatedCall = m_scene.CapsUpdateTaskInventoryScriptAsset; | ||
129 | caps.CAPSFetchInventoryDescendents = m_scene.HandleFetchInventoryDescendentsCAPS; | ||
130 | caps.GetClient = m_scene.SceneContents.GetControllingClient; | ||
131 | |||
132 | m_capsHandlers[agentId] = caps; | ||
133 | } | 125 | } |
134 | 126 | ||
135 | public void RemoveCapsHandler(UUID agentId) | 127 | public void RemoveCaps(UUID agentId) |
136 | { | 128 | { |
137 | if (childrenSeeds.ContainsKey(agentId)) | 129 | if (childrenSeeds.ContainsKey(agentId)) |
138 | { | 130 | { |
139 | childrenSeeds.Remove(agentId); | 131 | childrenSeeds.Remove(agentId); |
140 | } | 132 | } |
141 | 133 | ||
142 | lock (m_capsHandlers) | 134 | lock (m_capsObjects) |
143 | { | 135 | { |
144 | if (m_capsHandlers.ContainsKey(agentId)) | 136 | if (m_capsObjects.ContainsKey(agentId)) |
145 | { | 137 | { |
146 | m_capsHandlers[agentId].DeregisterHandlers(); | 138 | m_capsObjects[agentId].DeregisterHandlers(); |
147 | m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsHandlers[agentId]); | 139 | m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsObjects[agentId]); |
148 | m_capsHandlers.Remove(agentId); | 140 | m_capsObjects.Remove(agentId); |
149 | } | 141 | } |
150 | else | 142 | else |
151 | { | 143 | { |
@@ -156,20 +148,20 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
156 | } | 148 | } |
157 | } | 149 | } |
158 | 150 | ||
159 | public Caps GetCapsHandlerForUser(UUID agentId) | 151 | public Caps GetCapsForUser(UUID agentId) |
160 | { | 152 | { |
161 | lock (m_capsHandlers) | 153 | lock (m_capsObjects) |
162 | { | 154 | { |
163 | if (m_capsHandlers.ContainsKey(agentId)) | 155 | if (m_capsObjects.ContainsKey(agentId)) |
164 | { | 156 | { |
165 | return m_capsHandlers[agentId]; | 157 | return m_capsObjects[agentId]; |
166 | } | 158 | } |
167 | } | 159 | } |
168 | 160 | ||
169 | return null; | 161 | return null; |
170 | } | 162 | } |
171 | 163 | ||
172 | public void NewUserConnection(AgentCircuitData agent) | 164 | public void SetAgentCapsSeeds(AgentCircuitData agent) |
173 | { | 165 | { |
174 | capsPaths[agent.AgentID] = agent.CapsPath; | 166 | capsPaths[agent.AgentID] = agent.CapsPath; |
175 | childrenSeeds[agent.AgentID] | 167 | childrenSeeds[agent.AgentID] |
@@ -239,7 +231,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
239 | System.Text.StringBuilder caps = new System.Text.StringBuilder(); | 231 | System.Text.StringBuilder caps = new System.Text.StringBuilder(); |
240 | caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); | 232 | caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); |
241 | 233 | ||
242 | foreach (KeyValuePair<UUID, Caps> kvp in m_capsHandlers) | 234 | foreach (KeyValuePair<UUID, Caps> kvp in m_capsObjects) |
243 | { | 235 | { |
244 | caps.AppendFormat("** User {0}:\n", kvp.Key); | 236 | caps.AppendFormat("** User {0}:\n", kvp.Key); |
245 | for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); ) | 237 | for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); ) |
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index 2dd7767..07999d1 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs | |||
@@ -575,7 +575,7 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
575 | string derezAvatarPath = "/agent/" + AvatarRezCapUUID + "/rez_avatar/derez"; | 575 | string derezAvatarPath = "/agent/" + AvatarRezCapUUID + "/rez_avatar/derez"; |
576 | // Get a reference to the user's cap so we can pull out the Caps Object Path | 576 | // Get a reference to the user's cap so we can pull out the Caps Object Path |
577 | Caps userCap | 577 | Caps userCap |
578 | = homeScene.CapsModule.GetCapsHandlerForUser(agentData.AgentID); | 578 | = homeScene.CapsModule.GetCapsForUser(agentData.AgentID); |
579 | 579 | ||
580 | string rezHttpProtocol = "http://"; | 580 | string rezHttpProtocol = "http://"; |
581 | string regionCapsHttpProtocol = "http://"; | 581 | string regionCapsHttpProtocol = "http://"; |
@@ -700,7 +700,7 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
700 | { | 700 | { |
701 | // Get a referenceokay - to their Cap object so we can pull out the capobjectroot | 701 | // Get a referenceokay - to their Cap object so we can pull out the capobjectroot |
702 | Caps userCap | 702 | Caps userCap |
703 | = homeScene.CapsModule.GetCapsHandlerForUser(userData.AgentID); | 703 | = homeScene.CapsModule.GetCapsForUser(userData.AgentID); |
704 | 704 | ||
705 | //Update the circuit data in the region so this user is authorized | 705 | //Update the circuit data in the region so this user is authorized |
706 | homeScene.UpdateCircuitData(userData); | 706 | homeScene.UpdateCircuitData(userData); |
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index a9d247a..a0009a8 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -17,7 +17,7 @@ | |||
17 | <RegionModule id="PrimCountModule" type="OpenSim.Region.CoreModules.World.Land.PrimCountModule" /> | 17 | <RegionModule id="PrimCountModule" type="OpenSim.Region.CoreModules.World.Land.PrimCountModule" /> |
18 | <RegionModule id="ExportSerialisationModule" type="OpenSim.Region.CoreModules.World.Serialiser.SerialiserModule" /> | 18 | <RegionModule id="ExportSerialisationModule" type="OpenSim.Region.CoreModules.World.Serialiser.SerialiserModule" /> |
19 | <RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" /> | 19 | <RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" /> |
20 | <RegionModule id="CapabilitiesModule" type="OpenSim.Region.CoreModules.Agent.Capabilities.CapabilitiesModule" /> | 20 | <RegionModule id="CapabilitiesModule" type="OpenSim.Region.CoreModules.Framework.CapabilitiesModule" /> |
21 | <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" /> | 21 | <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" /> |
22 | <RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" /> | 22 | <RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" /> |
23 | <RegionModule id="Warp3DImageModule" type="OpenSim.Region.CoreModules.World.Warp3DMap.Warp3DImageModule" /> | 23 | <RegionModule id="Warp3DImageModule" type="OpenSim.Region.CoreModules.World.Warp3DMap.Warp3DImageModule" /> |
diff --git a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs index 964e4b9..a505999 100644 --- a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs +++ b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs | |||
@@ -36,7 +36,7 @@ using OpenSim.Framework.Capabilities; | |||
36 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
37 | using OpenSim.Framework.Servers.HttpServer; | 37 | using OpenSim.Framework.Servers.HttpServer; |
38 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
39 | using Caps=OpenSim.Framework.Capabilities.Caps; | 39 | using Caps = OpenSim.Framework.Capabilities.Caps; |
40 | 40 | ||
41 | namespace OpenSim.Region.DataSnapshot | 41 | namespace OpenSim.Region.DataSnapshot |
42 | { | 42 | { |
diff --git a/OpenSim/Region/Framework/Interfaces/ICapabilitiesModule.cs b/OpenSim/Region/Framework/Interfaces/ICapabilitiesModule.cs index 73bffa0..522c82d 100644 --- a/OpenSim/Region/Framework/Interfaces/ICapabilitiesModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ICapabilitiesModule.cs | |||
@@ -34,31 +34,27 @@ namespace OpenSim.Region.Framework.Interfaces | |||
34 | { | 34 | { |
35 | public interface ICapabilitiesModule | 35 | public interface ICapabilitiesModule |
36 | { | 36 | { |
37 | void NewUserConnection(AgentCircuitData agent); | ||
38 | |||
39 | /// <summary> | 37 | /// <summary> |
40 | /// Add a caps handler for the given agent. If the CAPS handler already exists for this agent, | 38 | /// Add a caps handler for the given agent. If the CAPS handler already exists for this agent, |
41 | /// then it is replaced by a new CAPS handler. | 39 | /// then it is replaced by a new CAPS handler. |
42 | /// | ||
43 | /// FIXME: On login this is called twice, once for the login and once when the connection is made. | ||
44 | /// This is somewhat innefficient and should be fixed. The initial login creation is necessary | ||
45 | /// since the client asks for capabilities immediately after being informed of the seed. | ||
46 | /// </summary> | 40 | /// </summary> |
47 | /// <param name="agentId"></param> | 41 | /// <param name="agentId"></param> |
48 | /// <param name="capsObjectPath"></param> | 42 | /// <param name="capsObjectPath"></param> |
49 | void AddCapsHandler(UUID agentId); | 43 | void CreateCaps(UUID agentId); |
50 | 44 | ||
51 | /// <summary> | 45 | /// <summary> |
52 | /// Remove the caps handler for a given agent. | 46 | /// Remove the caps handler for a given agent. |
53 | /// </summary> | 47 | /// </summary> |
54 | /// <param name="agentId"></param> | 48 | /// <param name="agentId"></param> |
55 | void RemoveCapsHandler(UUID agentId); | 49 | void RemoveCaps(UUID agentId); |
56 | 50 | ||
57 | /// <summary> | 51 | /// <summary> |
58 | /// Will return null if the agent doesn't have a caps handler registered | 52 | /// Will return null if the agent doesn't have a caps handler registered |
59 | /// </summary> | 53 | /// </summary> |
60 | /// <param name="agentId"></param> | 54 | /// <param name="agentId"></param> |
61 | Caps GetCapsHandlerForUser(UUID agentId); | 55 | Caps GetCapsForUser(UUID agentId); |
56 | |||
57 | void SetAgentCapsSeeds(AgentCircuitData agent); | ||
62 | 58 | ||
63 | Dictionary<ulong, string> GetChildrenSeeds(UUID agentID); | 59 | Dictionary<ulong, string> GetChildrenSeeds(UUID agentID); |
64 | 60 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs index 81e4952..bfa5d17 100644 --- a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs +++ b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs | |||
@@ -57,5 +57,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
57 | bool isModerator, bool textMute); | 57 | bool isModerator, bool textMute); |
58 | void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID); | 58 | void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID); |
59 | void GroupMembership(AgentGroupDataUpdatePacket groupUpdate, UUID avatarID); | 59 | void GroupMembership(AgentGroupDataUpdatePacket groupUpdate, UUID avatarID); |
60 | OSD ScriptRunningEvent(UUID objectID, UUID itemID, bool running, bool mono); | ||
61 | OSD BuildEvent(string eventName, OSD eventBody); | ||
60 | } | 62 | } |
61 | } | 63 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7c5e246..b537381 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3033,7 +3033,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3033 | m_sceneGraph.removeUserCount(!childagentYN); | 3033 | m_sceneGraph.removeUserCount(!childagentYN); |
3034 | 3034 | ||
3035 | if (CapsModule != null) | 3035 | if (CapsModule != null) |
3036 | CapsModule.RemoveCapsHandler(agentID); | 3036 | CapsModule.RemoveCaps(agentID); |
3037 | 3037 | ||
3038 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever | 3038 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever |
3039 | // this method is doing is HORRIBLE!!! | 3039 | // this method is doing is HORRIBLE!!! |
@@ -3290,8 +3290,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3290 | 3290 | ||
3291 | if (CapsModule != null) | 3291 | if (CapsModule != null) |
3292 | { | 3292 | { |
3293 | CapsModule.NewUserConnection(agent); | 3293 | CapsModule.SetAgentCapsSeeds(agent); |
3294 | CapsModule.AddCapsHandler(agent.AgentID); | 3294 | CapsModule.CreateCaps(agent.AgentID); |
3295 | } | 3295 | } |
3296 | } | 3296 | } |
3297 | else | 3297 | else |
@@ -3309,7 +3309,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3309 | sp.AdjustKnownSeeds(); | 3309 | sp.AdjustKnownSeeds(); |
3310 | 3310 | ||
3311 | if (CapsModule != null) | 3311 | if (CapsModule != null) |
3312 | CapsModule.NewUserConnection(agent); | 3312 | CapsModule.SetAgentCapsSeeds(agent); |
3313 | } | 3313 | } |
3314 | } | 3314 | } |
3315 | 3315 | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 8c01d75..2bf8489 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs | |||
@@ -34,12 +34,9 @@ using Nini.Config; | |||
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenMetaverse.StructuredData; | 35 | using OpenMetaverse.StructuredData; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Region.CoreModules.Framework.EventQueue; | ||
38 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
40 | 39 | ||
41 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
42 | |||
43 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 40 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
44 | { | 41 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
@@ -472,7 +469,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
472 | 469 | ||
473 | if (queue != null) | 470 | if (queue != null) |
474 | { | 471 | { |
475 | queue.Enqueue(EventQueueHelper.buildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId); | 472 | queue.Enqueue(queue.BuildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId); |
476 | } | 473 | } |
477 | } | 474 | } |
478 | 475 | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index a8dec63..1c791b9 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -39,13 +39,11 @@ using OpenMetaverse.StructuredData; | |||
39 | 39 | ||
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.Communications; | 41 | using OpenSim.Framework.Communications; |
42 | using OpenSim.Region.CoreModules.Framework.EventQueue; | ||
43 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
44 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
45 | 44 | ||
46 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
47 | 46 | ||
48 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
49 | using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags; | 47 | using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags; |
50 | 48 | ||
51 | 49 | ||
@@ -1154,7 +1152,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1154 | 1152 | ||
1155 | if (queue != null) | 1153 | if (queue != null) |
1156 | { | 1154 | { |
1157 | queue.Enqueue(EventQueueHelper.buildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient)); | 1155 | queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient)); |
1158 | } | 1156 | } |
1159 | 1157 | ||
1160 | } | 1158 | } |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 8629674..97ab411 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -41,7 +41,6 @@ using log4net; | |||
41 | using Nini.Config; | 41 | using Nini.Config; |
42 | using Amib.Threading; | 42 | using Amib.Threading; |
43 | using OpenSim.Framework; | 43 | using OpenSim.Framework; |
44 | using OpenSim.Region.CoreModules.Framework.EventQueue; | ||
45 | using OpenSim.Region.Framework.Scenes; | 44 | using OpenSim.Region.Framework.Scenes; |
46 | using OpenSim.Region.Framework.Interfaces; | 45 | using OpenSim.Region.Framework.Interfaces; |
47 | using OpenSim.Region.ScriptEngine.Shared; | 46 | using OpenSim.Region.ScriptEngine.Shared; |
@@ -1283,7 +1282,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1283 | } | 1282 | } |
1284 | else | 1283 | else |
1285 | { | 1284 | { |
1286 | eq.Enqueue(EventQueueHelper.ScriptRunningReplyEvent(objectID, itemID, GetScriptState(itemID), true), | 1285 | eq.Enqueue(eq.ScriptRunningEvent(objectID, itemID, GetScriptState(itemID), true), |
1287 | controllingClient.AgentId); | 1286 | controllingClient.AgentId); |
1288 | } | 1287 | } |
1289 | } | 1288 | } |
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index a03cc4c..3139b8a 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs | |||
@@ -44,7 +44,6 @@ using OpenSim.Region.Framework.Interfaces; | |||
44 | using OpenSim.Region.Framework.Scenes; | 44 | using OpenSim.Region.Framework.Scenes; |
45 | using Mono.Data.SqliteClient; | 45 | using Mono.Data.SqliteClient; |
46 | 46 | ||
47 | |||
48 | using Caps = OpenSim.Framework.Capabilities.Caps; | 47 | using Caps = OpenSim.Framework.Capabilities.Caps; |
49 | 48 | ||
50 | using OSD = OpenMetaverse.StructuredData.OSD; | 49 | using OSD = OpenMetaverse.StructuredData.OSD; |
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index ebd6f7c..ddc8855 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs | |||
@@ -32,7 +32,6 @@ using System.Net; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | 33 | ||
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Capabilities; | ||
36 | using OpenSim.Services.Interfaces; | 35 | using OpenSim.Services.Interfaces; |
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 36 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
38 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | 37 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 9bcc3dd..2ca2d15 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -38,7 +38,6 @@ using Nini.Config; | |||
38 | using OpenMetaverse; | 38 | using OpenMetaverse; |
39 | 39 | ||
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.Capabilities; | ||
42 | using OpenSim.Framework.Console; | 41 | using OpenSim.Framework.Console; |
43 | using OpenSim.Server.Base; | 42 | using OpenSim.Server.Base; |
44 | using OpenSim.Services.Interfaces; | 43 | using OpenSim.Services.Interfaces; |
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 99517d2..d122409 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | |||
@@ -39,7 +39,6 @@ using OpenSim.Region.Physics.Manager; | |||
39 | using OpenSim.Region.Framework; | 39 | using OpenSim.Region.Framework; |
40 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.CoreModules.Agent.Capabilities; | ||
43 | using OpenSim.Region.CoreModules.Avatar.Gods; | 42 | using OpenSim.Region.CoreModules.Avatar.Gods; |
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset; | 43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset; |
45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication; | 44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication; |