diff options
author | Melanie | 2011-05-05 09:49:10 +0100 |
---|---|---|
committer | Melanie | 2011-05-05 09:49:10 +0100 |
commit | 4beb0c9b9b402c1e8f70a02c0efa557c1f292f1c (patch) | |
tree | 24e24cb7b424df74b13788d28be9d7588fbd99d0 /OpenSim | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
parent | Test m_Enabled on RemoveRegion. (diff) | |
download | opensim-SC_OLD-4beb0c9b9b402c1e8f70a02c0efa557c1f292f1c.zip opensim-SC_OLD-4beb0c9b9b402c1e8f70a02c0efa557c1f292f1c.tar.gz opensim-SC_OLD-4beb0c9b9b402c1e8f70a02c0efa557c1f292f1c.tar.bz2 opensim-SC_OLD-4beb0c9b9b402c1e8f70a02c0efa557c1f292f1c.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Capabilities/Caps.cs | 176 | ||||
-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/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs | 299 | ||||
-rw-r--r-- | OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs | 76 | ||||
-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/Capabilities/Caps.cs | 1368 | ||||
-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 | 938 | ||||
-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) | 22 | ||||
-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 | 139 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 142 | ||||
-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/Caps/WebFetchInvDescModule.cs | 134 | ||||
-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) | 56 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | 1 | ||||
-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 |
76 files changed, 2229 insertions, 1574 deletions
diff --git a/OpenSim/Capabilities/Caps.cs b/OpenSim/Capabilities/Caps.cs new file mode 100644 index 0000000..e188896 --- /dev/null +++ b/OpenSim/Capabilities/Caps.cs | |||
@@ -0,0 +1,176 @@ | |||
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 | public Dictionary<string, string> ExternalCapsHandlers | ||
110 | { | ||
111 | get { return m_externalCapsHandlers; } | ||
112 | } | ||
113 | |||
114 | public Caps(IHttpServer httpServer, string httpListen, uint httpPort, string capsPath, | ||
115 | UUID agent, string regionName) | ||
116 | { | ||
117 | m_capsObjectPath = capsPath; | ||
118 | m_httpListener = httpServer; | ||
119 | m_httpListenerHostName = httpListen; | ||
120 | |||
121 | m_httpListenPort = httpPort; | ||
122 | |||
123 | if (httpServer != null && httpServer.UseSSL) | ||
124 | { | ||
125 | m_httpListenPort = httpServer.SSLPort; | ||
126 | httpListen = httpServer.SSLCommonName; | ||
127 | httpPort = httpServer.SSLPort; | ||
128 | } | ||
129 | |||
130 | m_agentID = agent; | ||
131 | m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL); | ||
132 | m_externalCapsHandlers = new Dictionary<string, string>(); | ||
133 | m_regionName = regionName; | ||
134 | } | ||
135 | |||
136 | /// <summary> | ||
137 | /// Register a handler. This allows modules to register handlers. | ||
138 | /// </summary> | ||
139 | /// <param name="capName"></param> | ||
140 | /// <param name="handler"></param> | ||
141 | public void RegisterHandler(string capName, IRequestHandler handler) | ||
142 | { | ||
143 | m_capsHandlers[capName] = handler; | ||
144 | //m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path); | ||
145 | } | ||
146 | |||
147 | /// <summary> | ||
148 | /// Register an external handler. The service for this capability is somewhere else | ||
149 | /// given by the URL. | ||
150 | /// </summary> | ||
151 | /// <param name="capsName"></param> | ||
152 | /// <param name="url"></param> | ||
153 | public void RegisterHandler(string capsName, string url) | ||
154 | { | ||
155 | m_externalCapsHandlers.Add(capsName, url); | ||
156 | } | ||
157 | |||
158 | /// <summary> | ||
159 | /// Remove all CAPS service handlers. | ||
160 | /// | ||
161 | /// </summary> | ||
162 | /// <param name="httpListener"></param> | ||
163 | /// <param name="path"></param> | ||
164 | /// <param name="restMethod"></param> | ||
165 | public void DeregisterHandlers() | ||
166 | { | ||
167 | if (m_capsHandlers != null) | ||
168 | { | ||
169 | foreach (string capsName in m_capsHandlers.Caps) | ||
170 | { | ||
171 | m_capsHandlers.Remove(capsName); | ||
172 | } | ||
173 | } | ||
174 | } | ||
175 | } | ||
176 | } | ||
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..0d072f7 --- /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/GetTexture/" /*+ UUID.Random() */, m_AssetService)); | ||
66 | } | ||
67 | |||
68 | } | ||
69 | } | ||
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs new file mode 100644 index 0000000..6fd7946 --- /dev/null +++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs | |||
@@ -0,0 +1,299 @@ | |||
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.Reflection; | ||
32 | using log4net; | ||
33 | using Nini.Config; | ||
34 | using OpenMetaverse; | ||
35 | using OpenMetaverse.StructuredData; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Capabilities; | ||
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Framework.Servers.HttpServer; | ||
40 | using OpenSim.Services.Interfaces; | ||
41 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
42 | |||
43 | namespace OpenSim.Capabilities.Handlers | ||
44 | { | ||
45 | |||
46 | public class WebFetchInvDescHandler | ||
47 | { | ||
48 | private static readonly ILog m_log = | ||
49 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | private IInventoryService m_InventoryService; | ||
52 | private ILibraryService m_LibraryService; | ||
53 | private object m_fetchLock = new Object(); | ||
54 | |||
55 | public WebFetchInvDescHandler(IInventoryService invService, ILibraryService libService) | ||
56 | { | ||
57 | m_InventoryService = invService; | ||
58 | m_LibraryService = libService; | ||
59 | } | ||
60 | |||
61 | public string FetchInventoryDescendentsRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
62 | { | ||
63 | // nasty temporary hack here, the linden client falsely | ||
64 | // identifies the uuid 00000000-0000-0000-0000-000000000000 | ||
65 | // as a string which breaks us | ||
66 | // | ||
67 | // correctly mark it as a uuid | ||
68 | // | ||
69 | request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>"); | ||
70 | |||
71 | // another hack <integer>1</integer> results in a | ||
72 | // System.ArgumentException: Object type System.Int32 cannot | ||
73 | // be converted to target type: System.Boolean | ||
74 | // | ||
75 | request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>"); | ||
76 | request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>"); | ||
77 | |||
78 | Hashtable hash = new Hashtable(); | ||
79 | try | ||
80 | { | ||
81 | hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); | ||
82 | } | ||
83 | catch (LLSD.LLSDParseException pe) | ||
84 | { | ||
85 | m_log.Error("[AGENT INVENTORY]: Fetch error: " + pe.Message); | ||
86 | m_log.Error("Request: " + request.ToString()); | ||
87 | } | ||
88 | |||
89 | ArrayList foldersrequested = (ArrayList)hash["folders"]; | ||
90 | |||
91 | string response = ""; | ||
92 | lock (m_fetchLock) | ||
93 | { | ||
94 | for (int i = 0; i < foldersrequested.Count; i++) | ||
95 | { | ||
96 | string inventoryitemstr = ""; | ||
97 | Hashtable inventoryhash = (Hashtable)foldersrequested[i]; | ||
98 | |||
99 | LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents(); | ||
100 | |||
101 | try | ||
102 | { | ||
103 | LLSDHelpers.DeserialiseOSDMap(inventoryhash, llsdRequest); | ||
104 | } | ||
105 | catch (Exception e) | ||
106 | { | ||
107 | m_log.Debug("[CAPS]: caught exception doing OSD deserialize" + e); | ||
108 | } | ||
109 | LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest); | ||
110 | |||
111 | inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply); | ||
112 | inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", ""); | ||
113 | inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); | ||
114 | |||
115 | response += inventoryitemstr; | ||
116 | } | ||
117 | |||
118 | |||
119 | if (response.Length == 0) | ||
120 | { | ||
121 | // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. | ||
122 | // Therefore, I'm concluding that the client only has so many threads available to do requests | ||
123 | // and when a thread stalls.. is stays stalled. | ||
124 | // Therefore we need to return something valid | ||
125 | response = "<llsd><map><key>folders</key><array /></map></llsd>"; | ||
126 | } | ||
127 | else | ||
128 | { | ||
129 | response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>"; | ||
130 | } | ||
131 | |||
132 | //m_log.DebugFormat("[CAPS]: Replying to CAPS fetch inventory request with following xml"); | ||
133 | //m_log.Debug("[CAPS] "+response); | ||
134 | |||
135 | } | ||
136 | return response; | ||
137 | } | ||
138 | |||
139 | /// <summary> | ||
140 | /// Construct an LLSD reply packet to a CAPS inventory request | ||
141 | /// </summary> | ||
142 | /// <param name="invFetch"></param> | ||
143 | /// <returns></returns> | ||
144 | private LLSDInventoryDescendents FetchInventoryReply(LLSDFetchInventoryDescendents invFetch) | ||
145 | { | ||
146 | LLSDInventoryDescendents reply = new LLSDInventoryDescendents(); | ||
147 | LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents(); | ||
148 | contents.agent_id = invFetch.owner_id; | ||
149 | contents.owner_id = invFetch.owner_id; | ||
150 | contents.folder_id = invFetch.folder_id; | ||
151 | |||
152 | reply.folders.Array.Add(contents); | ||
153 | InventoryCollection inv = new InventoryCollection(); | ||
154 | inv.Folders = new List<InventoryFolderBase>(); | ||
155 | inv.Items = new List<InventoryItemBase>(); | ||
156 | int version = 0; | ||
157 | |||
158 | inv = Fetch(invFetch.owner_id, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version); | ||
159 | |||
160 | if (inv.Folders != null) | ||
161 | { | ||
162 | foreach (InventoryFolderBase invFolder in inv.Folders) | ||
163 | { | ||
164 | contents.categories.Array.Add(ConvertInventoryFolder(invFolder)); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | if (inv.Items != null) | ||
169 | { | ||
170 | foreach (InventoryItemBase invItem in inv.Items) | ||
171 | { | ||
172 | contents.items.Array.Add(ConvertInventoryItem(invItem)); | ||
173 | } | ||
174 | } | ||
175 | |||
176 | contents.descendents = contents.items.Array.Count + contents.categories.Array.Count; | ||
177 | contents.version = version; | ||
178 | |||
179 | return reply; | ||
180 | } | ||
181 | |||
182 | public InventoryCollection Fetch(UUID agentID, UUID folderID, UUID ownerID, | ||
183 | bool fetchFolders, bool fetchItems, int sortOrder, out int version) | ||
184 | { | ||
185 | m_log.DebugFormat( | ||
186 | "[WEBFETCHINVENTORYDESCENDANTS]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", | ||
187 | fetchFolders, fetchItems, folderID, agentID); | ||
188 | |||
189 | version = 0; | ||
190 | InventoryFolderImpl fold; | ||
191 | if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner) | ||
192 | if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(folderID)) != null) | ||
193 | { | ||
194 | InventoryCollection ret = new InventoryCollection(); | ||
195 | ret.Folders = new List<InventoryFolderBase>(); | ||
196 | ret.Items = fold.RequestListOfItems(); | ||
197 | |||
198 | return ret; | ||
199 | } | ||
200 | |||
201 | InventoryCollection contents = new InventoryCollection(); | ||
202 | |||
203 | if (folderID != UUID.Zero) | ||
204 | { | ||
205 | contents = m_InventoryService.GetFolderContent(agentID, folderID); | ||
206 | InventoryFolderBase containingFolder = new InventoryFolderBase(); | ||
207 | containingFolder.ID = folderID; | ||
208 | containingFolder.Owner = agentID; | ||
209 | containingFolder = m_InventoryService.GetFolder(containingFolder); | ||
210 | if (containingFolder != null) | ||
211 | version = containingFolder.Version; | ||
212 | } | ||
213 | else | ||
214 | { | ||
215 | // Lost itemsm don't really need a version | ||
216 | version = 1; | ||
217 | } | ||
218 | |||
219 | return contents; | ||
220 | |||
221 | } | ||
222 | /// <summary> | ||
223 | /// Convert an internal inventory folder object into an LLSD object. | ||
224 | /// </summary> | ||
225 | /// <param name="invFolder"></param> | ||
226 | /// <returns></returns> | ||
227 | private LLSDInventoryFolder ConvertInventoryFolder(InventoryFolderBase invFolder) | ||
228 | { | ||
229 | LLSDInventoryFolder llsdFolder = new LLSDInventoryFolder(); | ||
230 | llsdFolder.folder_id = invFolder.ID; | ||
231 | llsdFolder.parent_id = invFolder.ParentID; | ||
232 | llsdFolder.name = invFolder.Name; | ||
233 | if (invFolder.Type < 0 || invFolder.Type >= TaskInventoryItem.Types.Length) | ||
234 | llsdFolder.type = "-1"; | ||
235 | else | ||
236 | llsdFolder.type = TaskInventoryItem.Types[invFolder.Type]; | ||
237 | llsdFolder.preferred_type = "-1"; | ||
238 | |||
239 | return llsdFolder; | ||
240 | } | ||
241 | |||
242 | /// <summary> | ||
243 | /// Convert an internal inventory item object into an LLSD object. | ||
244 | /// </summary> | ||
245 | /// <param name="invItem"></param> | ||
246 | /// <returns></returns> | ||
247 | private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem) | ||
248 | { | ||
249 | LLSDInventoryItem llsdItem = new LLSDInventoryItem(); | ||
250 | llsdItem.asset_id = invItem.AssetID; | ||
251 | llsdItem.created_at = invItem.CreationDate; | ||
252 | llsdItem.desc = invItem.Description; | ||
253 | llsdItem.flags = (int)invItem.Flags; | ||
254 | llsdItem.item_id = invItem.ID; | ||
255 | llsdItem.name = invItem.Name; | ||
256 | llsdItem.parent_id = invItem.Folder; | ||
257 | try | ||
258 | { | ||
259 | // TODO reevaluate after upgrade to libomv >= r2566. Probably should use UtilsConversions. | ||
260 | llsdItem.type = TaskInventoryItem.Types[invItem.AssetType]; | ||
261 | llsdItem.inv_type = TaskInventoryItem.InvTypes[invItem.InvType]; | ||
262 | } | ||
263 | catch (Exception e) | ||
264 | { | ||
265 | m_log.ErrorFormat("[CAPS]: Problem setting asset {0} inventory {1} types while converting inventory item {2}: {3}", invItem.AssetType, invItem.InvType, invItem.Name, e.Message); | ||
266 | } | ||
267 | llsdItem.permissions = new LLSDPermissions(); | ||
268 | llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; | ||
269 | llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions; | ||
270 | llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions; | ||
271 | llsdItem.permissions.group_id = invItem.GroupID; | ||
272 | llsdItem.permissions.group_mask = (int)invItem.GroupPermissions; | ||
273 | llsdItem.permissions.is_owner_group = invItem.GroupOwned; | ||
274 | llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions; | ||
275 | llsdItem.permissions.owner_id = invItem.Owner; | ||
276 | llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; | ||
277 | llsdItem.sale_info = new LLSDSaleInfo(); | ||
278 | llsdItem.sale_info.sale_price = invItem.SalePrice; | ||
279 | switch (invItem.SaleType) | ||
280 | { | ||
281 | default: | ||
282 | llsdItem.sale_info.sale_type = "not"; | ||
283 | break; | ||
284 | case 1: | ||
285 | llsdItem.sale_info.sale_type = "original"; | ||
286 | break; | ||
287 | case 2: | ||
288 | llsdItem.sale_info.sale_type = "copy"; | ||
289 | break; | ||
290 | case 3: | ||
291 | llsdItem.sale_info.sale_type = "contents"; | ||
292 | break; | ||
293 | } | ||
294 | |||
295 | return llsdItem; | ||
296 | } | ||
297 | |||
298 | } | ||
299 | } | ||
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs new file mode 100644 index 0000000..92eeb14 --- /dev/null +++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs | |||
@@ -0,0 +1,76 @@ | |||
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 WebFetchInvDescServerConnector : ServiceConnector | ||
39 | { | ||
40 | private IInventoryService m_InventoryService; | ||
41 | private ILibraryService m_LibraryService; | ||
42 | private string m_ConfigName = "CapsService"; | ||
43 | |||
44 | public WebFetchInvDescServerConnector(IConfigSource config, IHttpServer server, string configName) : | ||
45 | base(config, server, configName) | ||
46 | { | ||
47 | if (configName != String.Empty) | ||
48 | m_ConfigName = configName; | ||
49 | |||
50 | IConfig serverConfig = config.Configs[m_ConfigName]; | ||
51 | if (serverConfig == null) | ||
52 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); | ||
53 | |||
54 | string invService = serverConfig.GetString("InventoryService", String.Empty); | ||
55 | |||
56 | if (invService == String.Empty) | ||
57 | throw new Exception("No InventoryService in config file"); | ||
58 | |||
59 | Object[] args = new Object[] { config }; | ||
60 | m_InventoryService = | ||
61 | ServerUtils.LoadPlugin<IInventoryService>(invService, args); | ||
62 | |||
63 | if (m_InventoryService == null) | ||
64 | throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName)); | ||
65 | |||
66 | string libService = serverConfig.GetString("LibraryService", String.Empty); | ||
67 | m_LibraryService = | ||
68 | ServerUtils.LoadPlugin<ILibraryService>(libService, args); | ||
69 | |||
70 | WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); | ||
71 | IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/, webFetchHandler.FetchInventoryDescendentsRequest); | ||
72 | server.AddStreamHandler(reqHandler); | ||
73 | } | ||
74 | |||
75 | } | ||
76 | } | ||
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/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs deleted file mode 100644 index 3be97b5..0000000 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ /dev/null | |||
@@ -1,1368 +0,0 @@ | |||
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 | public delegate void UpLoadedAsset( | ||
45 | string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, | ||
46 | byte[] data, string inventoryType, string assetType); | ||
47 | |||
48 | public delegate void UploadedBakedTexture(UUID assetID, byte[] data); | ||
49 | |||
50 | public delegate UUID UpdateItem(UUID itemID, byte[] data); | ||
51 | |||
52 | public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors); | ||
53 | |||
54 | public delegate void NewInventoryItem(UUID userID, InventoryItemBase item); | ||
55 | |||
56 | public delegate void NewAsset(AssetBase asset); | ||
57 | |||
58 | public delegate UUID ItemUpdatedCallback(UUID userID, UUID itemID, byte[] data); | ||
59 | |||
60 | public delegate ArrayList TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID, | ||
61 | bool isScriptRunning, byte[] data); | ||
62 | |||
63 | public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, | ||
64 | bool fetchFolders, bool fetchItems, int sortOrder, out int version); | ||
65 | |||
66 | /// <summary> | ||
67 | /// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that | ||
68 | /// we can popup a message on the user's client if the inventory service has permanently failed). But I didn't want | ||
69 | /// to just pass the whole Scene into CAPS. | ||
70 | /// </summary> | ||
71 | public delegate IClientAPI GetClientDelegate(UUID agentID); | ||
72 | |||
73 | public class Caps | ||
74 | { | ||
75 | private static readonly ILog m_log = | ||
76 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
77 | |||
78 | private string m_httpListenerHostName; | ||
79 | private uint m_httpListenPort; | ||
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 | |||
89 | private static readonly string m_requestPath = "0000/"; | ||
90 | // private static readonly string m_mapLayerPath = "0001/"; | ||
91 | private static readonly string m_newInventory = "0002/"; | ||
92 | //private static readonly string m_requestTexture = "0003/"; | ||
93 | private static readonly string m_notecardUpdatePath = "0004/"; | ||
94 | private static readonly string m_notecardTaskUpdatePath = "0005/"; | ||
95 | // 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. | ||
103 | private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule. | ||
104 | |||
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 | |||
131 | // These are callbacks which will be setup by the scene so that we can update scene data when we | ||
132 | // receive capability calls | ||
133 | public NewInventoryItem AddNewInventoryItem = null; | ||
134 | public NewAsset AddNewAsset = null; | ||
135 | public ItemUpdatedCallback ItemUpdatedCall = null; | ||
136 | public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; | ||
137 | public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; | ||
138 | public GetClientDelegate GetClient = null; | ||
139 | |||
140 | public Caps(IScene scene, IAssetService assetCache, IHttpServer httpServer, string httpListen, uint httpPort, string capsPath, | ||
141 | UUID agent, bool dumpAssetsToFile, string regionName) | ||
142 | { | ||
143 | m_Scene = scene; | ||
144 | m_assetCache = assetCache; | ||
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; | ||
153 | if (config != null) | ||
154 | { | ||
155 | IConfig sconfig = config.Configs["Startup"]; | ||
156 | if (sconfig != null) | ||
157 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures",m_persistBakedTextures); | ||
158 | } | ||
159 | |||
160 | if (httpServer != null && httpServer.UseSSL) | ||
161 | { | ||
162 | m_httpListenPort = httpServer.SSLPort; | ||
163 | httpListen = httpServer.SSLCommonName; | ||
164 | httpPort = httpServer.SSLPort; | ||
165 | } | ||
166 | |||
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 | } | ||
172 | |||
173 | /// <summary> | ||
174 | /// Register all CAPS http service handlers | ||
175 | /// </summary> | ||
176 | public void RegisterHandlers() | ||
177 | { | ||
178 | DeregisterHandlers(); | ||
179 | |||
180 | string capsBase = "/CAPS/" + m_capsObjectPath; | ||
181 | |||
182 | RegisterRegionServiceHandlers(capsBase); | ||
183 | RegisterInventoryServiceHandlers(capsBase); | ||
184 | } | ||
185 | |||
186 | public void RegisterRegionServiceHandlers(string capsBase) | ||
187 | { | ||
188 | try | ||
189 | { | ||
190 | // the root of all evil | ||
191 | m_capsHandlers["SEED"] = new RestStreamHandler("POST", capsBase + m_requestPath, CapsRequest); | ||
192 | m_log.DebugFormat( | ||
193 | "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_agentID); | ||
194 | |||
195 | //m_capsHandlers["MapLayer"] = | ||
196 | // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST", | ||
197 | // capsBase + m_mapLayerPath, | ||
198 | // GetMapLayer); | ||
199 | m_capsHandlers["UpdateScriptTaskInventory"] = | ||
200 | new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory); | ||
201 | m_capsHandlers["UpdateScriptTask"] = m_capsHandlers["UpdateScriptTaskInventory"]; | ||
202 | m_capsHandlers["UploadBakedTexture"] = | ||
203 | new RestStreamHandler("POST", capsBase + m_uploadBakedTexturePath, UploadBakedTexture); | ||
204 | |||
205 | } | ||
206 | catch (Exception e) | ||
207 | { | ||
208 | m_log.Error("[CAPS]: " + e.ToString()); | ||
209 | } | ||
210 | } | ||
211 | |||
212 | public void RegisterInventoryServiceHandlers(string capsBase) | ||
213 | { | ||
214 | try | ||
215 | { | ||
216 | // I don't think this one works... | ||
217 | m_capsHandlers["NewFileAgentInventory"] = | ||
218 | new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", | ||
219 | capsBase + m_newInventory, | ||
220 | NewAgentInventoryRequest); | ||
221 | m_capsHandlers["UpdateNotecardAgentInventory"] = | ||
222 | new RestStreamHandler("POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory); | ||
223 | m_capsHandlers["UpdateScriptAgentInventory"] = m_capsHandlers["UpdateNotecardAgentInventory"]; | ||
224 | m_capsHandlers["UpdateScriptAgent"] = m_capsHandlers["UpdateScriptAgentInventory"]; | ||
225 | |||
226 | // As of RC 1.22.9 of the Linden client this is | ||
227 | // supported | ||
228 | |||
229 | //m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest); | ||
230 | |||
231 | // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and | ||
232 | // subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires | ||
233 | // enhancements (probably filling out the folder part of the LLSD reply) to our CAPS service, | ||
234 | // but when I went on the Linden grid, the | ||
235 | // simulators I visited (version 1.21) were, surprisingly, no longer supplying this capability. Instead, | ||
236 | // the 1.19.1.4 client appeared to be happily flowing inventory data over UDP | ||
237 | // | ||
238 | // This is very probably just a temporary measure - once the CAPS service appears again on the Linden grid | ||
239 | // we will be | ||
240 | // able to get the data we need to implement the necessary part of the protocol to fix the issue above. | ||
241 | // m_capsHandlers["FetchInventoryDescendents"] = | ||
242 | // new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryRequest); | ||
243 | |||
244 | // m_capsHandlers["FetchInventoryDescendents"] = | ||
245 | // new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST", | ||
246 | // capsBase + m_fetchInventory, | ||
247 | // FetchInventory)); | ||
248 | // m_capsHandlers["RequestTextureDownload"] = new RestStreamHandler("POST", | ||
249 | // capsBase + m_requestTexture, | ||
250 | // RequestTexture); | ||
251 | } | ||
252 | catch (Exception e) | ||
253 | { | ||
254 | m_log.Error("[CAPS]: " + e.ToString()); | ||
255 | } | ||
256 | } | ||
257 | |||
258 | /// <summary> | ||
259 | /// Register a handler. This allows modules to register handlers. | ||
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> | ||
273 | /// <param name="httpListener"></param> | ||
274 | /// <param name="path"></param> | ||
275 | /// <param name="restMethod"></param> | ||
276 | public void DeregisterHandlers() | ||
277 | { | ||
278 | if (m_capsHandlers != null) | ||
279 | { | ||
280 | foreach (string capsName in m_capsHandlers.Caps) | ||
281 | { | ||
282 | m_capsHandlers.Remove(capsName); | ||
283 | } | ||
284 | } | ||
285 | } | ||
286 | |||
287 | /// <summary> | ||
288 | /// Construct a client response detailing all the capabilities this server can provide. | ||
289 | /// </summary> | ||
290 | /// <param name="request"></param> | ||
291 | /// <param name="path"></param> | ||
292 | /// <param name="param"></param> | ||
293 | /// <param name="httpRequest">HTTP request header object</param> | ||
294 | /// <param name="httpResponse">HTTP response header object</param> | ||
295 | /// <returns></returns> | ||
296 | public string CapsRequest(string request, string path, string param, | ||
297 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
298 | { | ||
299 | m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); | ||
300 | |||
301 | if (!m_Scene.CheckClient(m_agentID, httpRequest.RemoteIPEndPoint)) | ||
302 | { | ||
303 | m_log.DebugFormat("[CAPS]: Unauthorized CAPS client"); | ||
304 | return string.Empty; | ||
305 | } | ||
306 | |||
307 | string result = LLSDHelpers.SerialiseLLSDReply(m_capsHandlers.CapsDetails); | ||
308 | |||
309 | //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); | ||
310 | |||
311 | return result; | ||
312 | } | ||
313 | |||
314 | // FIXME: these all should probably go into the respective region | ||
315 | // modules | ||
316 | |||
317 | /// <summary> | ||
318 | /// Processes a fetch inventory request and sends the reply | ||
319 | |||
320 | /// </summary> | ||
321 | /// <param name="request"></param> | ||
322 | /// <param name="path"></param> | ||
323 | /// <param name="param"></param> | ||
324 | /// <returns></returns> | ||
325 | // Request is like: | ||
326 | //<llsd> | ||
327 | // <map><key>folders</key> | ||
328 | // <array> | ||
329 | // <map> | ||
330 | // <key>fetch-folders</key><boolean>1</boolean><key>fetch-items</key><boolean>1</boolean><key>folder-id</key><uuid>8e1e3a30-b9bf-11dc-95ff-0800200c9a66</uuid><key>owner-id</key><uuid>11111111-1111-0000-0000-000100bba000</uuid><key>sort-order</key><integer>1</integer> | ||
331 | // </map> | ||
332 | // </array> | ||
333 | // </map> | ||
334 | //</llsd> | ||
335 | // | ||
336 | // multiple fetch-folder maps are allowed within the larger folders map. | ||
337 | public string FetchInventoryRequest(string request, string path, string param) | ||
338 | { | ||
339 | // string unmodifiedRequest = request.ToString(); | ||
340 | |||
341 | //m_log.DebugFormat("[AGENT INVENTORY]: Received CAPS fetch inventory request {0}", unmodifiedRequest); | ||
342 | m_log.Debug("[CAPS]: Inventory Request in region: " + m_regionName); | ||
343 | |||
344 | Hashtable hash = new Hashtable(); | ||
345 | try | ||
346 | { | ||
347 | hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); | ||
348 | } | ||
349 | catch (LLSD.LLSDParseException pe) | ||
350 | { | ||
351 | m_log.Error("[AGENT INVENTORY]: Fetch error: " + pe.Message); | ||
352 | m_log.Error("Request: " + request.ToString()); | ||
353 | } | ||
354 | |||
355 | ArrayList foldersrequested = (ArrayList)hash["folders"]; | ||
356 | |||
357 | string response = ""; | ||
358 | |||
359 | for (int i = 0; i < foldersrequested.Count; i++) | ||
360 | { | ||
361 | string inventoryitemstr = ""; | ||
362 | Hashtable inventoryhash = (Hashtable)foldersrequested[i]; | ||
363 | |||
364 | LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents(); | ||
365 | LLSDHelpers.DeserialiseOSDMap(inventoryhash, llsdRequest); | ||
366 | LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest); | ||
367 | |||
368 | inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply); | ||
369 | inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", ""); | ||
370 | inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); | ||
371 | |||
372 | response += inventoryitemstr; | ||
373 | } | ||
374 | |||
375 | if (response.Length == 0) | ||
376 | { | ||
377 | // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. | ||
378 | // Therefore, I'm concluding that the client only has so many threads available to do requests | ||
379 | // and when a thread stalls.. is stays stalled. | ||
380 | // Therefore we need to return something valid | ||
381 | response = "<llsd><map><key>folders</key><array /></map></llsd>"; | ||
382 | } | ||
383 | else | ||
384 | { | ||
385 | response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>"; | ||
386 | } | ||
387 | |||
388 | //m_log.DebugFormat("[AGENT INVENTORY]: Replying to CAPS fetch inventory request with following xml"); | ||
389 | //m_log.Debug(Util.GetFormattedXml(response)); | ||
390 | |||
391 | return response; | ||
392 | } | ||
393 | |||
394 | public string FetchInventoryDescendentsRequest(string request, string path, string param,OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
395 | { | ||
396 | // nasty temporary hack here, the linden client falsely | ||
397 | // identifies the uuid 00000000-0000-0000-0000-000000000000 | ||
398 | // as a string which breaks us | ||
399 | // | ||
400 | // correctly mark it as a uuid | ||
401 | // | ||
402 | request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>"); | ||
403 | |||
404 | // another hack <integer>1</integer> results in a | ||
405 | // System.ArgumentException: Object type System.Int32 cannot | ||
406 | // be converted to target type: System.Boolean | ||
407 | // | ||
408 | request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>"); | ||
409 | request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>"); | ||
410 | |||
411 | Hashtable hash = new Hashtable(); | ||
412 | try | ||
413 | { | ||
414 | hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); | ||
415 | } | ||
416 | catch (LLSD.LLSDParseException pe) | ||
417 | { | ||
418 | m_log.Error("[AGENT INVENTORY]: Fetch error: " + pe.Message); | ||
419 | m_log.Error("Request: " + request.ToString()); | ||
420 | } | ||
421 | |||
422 | ArrayList foldersrequested = (ArrayList)hash["folders"]; | ||
423 | |||
424 | string response = ""; | ||
425 | lock (m_fetchLock) | ||
426 | { | ||
427 | for (int i = 0; i < foldersrequested.Count; i++) | ||
428 | { | ||
429 | string inventoryitemstr = ""; | ||
430 | Hashtable inventoryhash = (Hashtable)foldersrequested[i]; | ||
431 | |||
432 | LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents(); | ||
433 | |||
434 | try{ | ||
435 | LLSDHelpers.DeserialiseOSDMap(inventoryhash, llsdRequest); | ||
436 | } | ||
437 | catch(Exception e) | ||
438 | { | ||
439 | m_log.Debug("[CAPS]: caught exception doing OSD deserialize" + e); | ||
440 | } | ||
441 | LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest); | ||
442 | |||
443 | inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply); | ||
444 | inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", ""); | ||
445 | inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); | ||
446 | |||
447 | response += inventoryitemstr; | ||
448 | } | ||
449 | |||
450 | |||
451 | if (response.Length == 0) | ||
452 | { | ||
453 | // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. | ||
454 | // Therefore, I'm concluding that the client only has so many threads available to do requests | ||
455 | // and when a thread stalls.. is stays stalled. | ||
456 | // Therefore we need to return something valid | ||
457 | response = "<llsd><map><key>folders</key><array /></map></llsd>"; | ||
458 | } | ||
459 | else | ||
460 | { | ||
461 | response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>"; | ||
462 | } | ||
463 | |||
464 | //m_log.DebugFormat("[CAPS]: Replying to CAPS fetch inventory request with following xml"); | ||
465 | //m_log.Debug("[CAPS] "+response); | ||
466 | |||
467 | } | ||
468 | return response; | ||
469 | } | ||
470 | |||
471 | |||
472 | |||
473 | /// <summary> | ||
474 | /// Construct an LLSD reply packet to a CAPS inventory request | ||
475 | /// </summary> | ||
476 | /// <param name="invFetch"></param> | ||
477 | /// <returns></returns> | ||
478 | private LLSDInventoryDescendents FetchInventoryReply(LLSDFetchInventoryDescendents invFetch) | ||
479 | { | ||
480 | LLSDInventoryDescendents reply = new LLSDInventoryDescendents(); | ||
481 | LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents(); | ||
482 | contents.agent_id = m_agentID; | ||
483 | contents.owner_id = invFetch.owner_id; | ||
484 | contents.folder_id = invFetch.folder_id; | ||
485 | |||
486 | reply.folders.Array.Add(contents); | ||
487 | InventoryCollection inv = new InventoryCollection(); | ||
488 | inv.Folders = new List<InventoryFolderBase>(); | ||
489 | inv.Items = new List<InventoryItemBase>(); | ||
490 | int version = 0; | ||
491 | if (CAPSFetchInventoryDescendents != null) | ||
492 | { | ||
493 | inv = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version); | ||
494 | } | ||
495 | |||
496 | if (inv.Folders != null) | ||
497 | { | ||
498 | foreach (InventoryFolderBase invFolder in inv.Folders) | ||
499 | { | ||
500 | contents.categories.Array.Add(ConvertInventoryFolder(invFolder)); | ||
501 | } | ||
502 | } | ||
503 | |||
504 | if (inv.Items != null) | ||
505 | { | ||
506 | foreach (InventoryItemBase invItem in inv.Items) | ||
507 | { | ||
508 | contents.items.Array.Add(ConvertInventoryItem(invItem)); | ||
509 | } | ||
510 | } | ||
511 | |||
512 | contents.descendents = contents.items.Array.Count + contents.categories.Array.Count; | ||
513 | contents.version = version; | ||
514 | |||
515 | return reply; | ||
516 | } | ||
517 | |||
518 | /// <summary> | ||
519 | /// Convert an internal inventory folder object into an LLSD object. | ||
520 | /// </summary> | ||
521 | /// <param name="invFolder"></param> | ||
522 | /// <returns></returns> | ||
523 | private LLSDInventoryFolder ConvertInventoryFolder(InventoryFolderBase invFolder) | ||
524 | { | ||
525 | LLSDInventoryFolder llsdFolder = new LLSDInventoryFolder(); | ||
526 | llsdFolder.folder_id = invFolder.ID; | ||
527 | llsdFolder.parent_id = invFolder.ParentID; | ||
528 | llsdFolder.name = invFolder.Name; | ||
529 | if (invFolder.Type < 0 || invFolder.Type >= TaskInventoryItem.Types.Length) | ||
530 | llsdFolder.type = "-1"; | ||
531 | else | ||
532 | llsdFolder.type = TaskInventoryItem.Types[invFolder.Type]; | ||
533 | llsdFolder.preferred_type = "-1"; | ||
534 | |||
535 | return llsdFolder; | ||
536 | } | ||
537 | |||
538 | /// <summary> | ||
539 | /// Convert an internal inventory item object into an LLSD object. | ||
540 | /// </summary> | ||
541 | /// <param name="invItem"></param> | ||
542 | /// <returns></returns> | ||
543 | private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem) | ||
544 | { | ||
545 | LLSDInventoryItem llsdItem = new LLSDInventoryItem(); | ||
546 | llsdItem.asset_id = invItem.AssetID; | ||
547 | llsdItem.created_at = invItem.CreationDate; | ||
548 | llsdItem.desc = invItem.Description; | ||
549 | llsdItem.flags = (int)invItem.Flags; | ||
550 | llsdItem.item_id = invItem.ID; | ||
551 | llsdItem.name = invItem.Name; | ||
552 | llsdItem.parent_id = invItem.Folder; | ||
553 | try | ||
554 | { | ||
555 | // TODO reevaluate after upgrade to libomv >= r2566. Probably should use UtilsConversions. | ||
556 | llsdItem.type = TaskInventoryItem.Types[invItem.AssetType]; | ||
557 | llsdItem.inv_type = TaskInventoryItem.InvTypes[invItem.InvType]; | ||
558 | } | ||
559 | catch (Exception e) | ||
560 | { | ||
561 | m_log.Error("[CAPS]: Problem setting asset/inventory type while converting inventory item " + invItem.Name + " to LLSD:", e); | ||
562 | } | ||
563 | llsdItem.permissions = new LLSDPermissions(); | ||
564 | llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; | ||
565 | llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions; | ||
566 | llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions; | ||
567 | llsdItem.permissions.group_id = invItem.GroupID; | ||
568 | llsdItem.permissions.group_mask = (int)invItem.GroupPermissions; | ||
569 | llsdItem.permissions.is_owner_group = invItem.GroupOwned; | ||
570 | llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions; | ||
571 | llsdItem.permissions.owner_id = m_agentID; | ||
572 | llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; | ||
573 | llsdItem.sale_info = new LLSDSaleInfo(); | ||
574 | llsdItem.sale_info.sale_price = invItem.SalePrice; | ||
575 | switch (invItem.SaleType) | ||
576 | { | ||
577 | default: | ||
578 | llsdItem.sale_info.sale_type = "not"; | ||
579 | break; | ||
580 | case 1: | ||
581 | llsdItem.sale_info.sale_type = "original"; | ||
582 | break; | ||
583 | case 2: | ||
584 | llsdItem.sale_info.sale_type = "copy"; | ||
585 | break; | ||
586 | case 3: | ||
587 | llsdItem.sale_info.sale_type = "contents"; | ||
588 | break; | ||
589 | } | ||
590 | |||
591 | return llsdItem; | ||
592 | } | ||
593 | |||
594 | /// <summary> | ||
595 | /// | ||
596 | /// </summary> | ||
597 | /// <param name="mapReq"></param> | ||
598 | /// <returns></returns> | ||
599 | public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) | ||
600 | { | ||
601 | m_log.Debug("[CAPS]: MapLayer Request in region: " + m_regionName); | ||
602 | LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); | ||
603 | mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); | ||
604 | return mapResponse; | ||
605 | } | ||
606 | |||
607 | /// <summary> | ||
608 | /// | ||
609 | /// </summary> | ||
610 | /// <returns></returns> | ||
611 | protected static OSDMapLayer GetOSDMapLayerResponse() | ||
612 | { | ||
613 | OSDMapLayer mapLayer = new OSDMapLayer(); | ||
614 | mapLayer.Right = 5000; | ||
615 | mapLayer.Top = 5000; | ||
616 | mapLayer.ImageID = new UUID("00000000-0000-1111-9999-000000000006"); | ||
617 | |||
618 | return mapLayer; | ||
619 | } | ||
620 | |||
621 | /// <summary> | ||
622 | /// | ||
623 | /// </summary> | ||
624 | /// <param name="request"></param> | ||
625 | /// <param name="path"></param> | ||
626 | /// <param name="param"></param> | ||
627 | /// <returns></returns> | ||
628 | public string RequestTexture(string request, string path, string param) | ||
629 | { | ||
630 | m_log.Debug("texture request " + request); | ||
631 | // Needs implementing (added to remove compiler warning) | ||
632 | return String.Empty; | ||
633 | } | ||
634 | |||
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 | |||
805 | /// <summary> | ||
806 | /// Called by the notecard update handler. Provides a URL to which the client can upload a new asset. | ||
807 | /// </summary> | ||
808 | /// <param name="request"></param> | ||
809 | /// <param name="path"></param> | ||
810 | /// <param name="param"></param> | ||
811 | /// <returns></returns> | ||
812 | public string NoteCardAgentInventory(string request, string path, string param, | ||
813 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
814 | { | ||
815 | //m_log.Debug("[CAPS]: NoteCardAgentInventory Request in region: " + m_regionName + "\n" + request); | ||
816 | //m_log.Debug("[CAPS]: NoteCardAgentInventory Request is: " + request); | ||
817 | |||
818 | //OpenMetaverse.StructuredData.OSDMap hash = (OpenMetaverse.StructuredData.OSDMap)OpenMetaverse.StructuredData.LLSDParser.DeserializeBinary(Utils.StringToBytes(request)); | ||
819 | Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Utils.StringToBytes(request)); | ||
820 | LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); | ||
821 | LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest); | ||
822 | |||
823 | string capsBase = "/CAPS/" + m_capsObjectPath; | ||
824 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
825 | |||
826 | ItemUpdater uploader = | ||
827 | new ItemUpdater(llsdRequest.item_id, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile); | ||
828 | uploader.OnUpLoad += ItemUpdated; | ||
829 | |||
830 | m_httpListener.AddStreamHandler( | ||
831 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | ||
832 | |||
833 | string protocol = "http://"; | ||
834 | |||
835 | if (m_httpListener.UseSSL) | ||
836 | protocol = "https://"; | ||
837 | |||
838 | string uploaderURL = protocol + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + | ||
839 | uploaderPath; | ||
840 | |||
841 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | ||
842 | uploadResponse.uploader = uploaderURL; | ||
843 | uploadResponse.state = "upload"; | ||
844 | |||
845 | // m_log.InfoFormat("[CAPS]: " + | ||
846 | // "NoteCardAgentInventory response: {0}", | ||
847 | // LLSDHelpers.SerialiseLLSDReply(uploadResponse))); | ||
848 | |||
849 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | ||
850 | } | ||
851 | |||
852 | /// <summary> | ||
853 | /// | ||
854 | /// </summary> | ||
855 | /// <param name="llsdRequest"></param> | ||
856 | /// <returns></returns> | ||
857 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) | ||
858 | { | ||
859 | //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString()); | ||
860 | //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); | ||
861 | |||
862 | if (llsdRequest.asset_type == "texture" || | ||
863 | llsdRequest.asset_type == "animation" || | ||
864 | llsdRequest.asset_type == "sound") | ||
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 | |||
911 | string uploaderURL = protocol + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + | ||
912 | uploaderPath; | ||
913 | |||
914 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | ||
915 | uploadResponse.uploader = uploaderURL; | ||
916 | uploadResponse.state = "upload"; | ||
917 | uploader.OnUpLoad += UploadCompleteHandler; | ||
918 | return uploadResponse; | ||
919 | } | ||
920 | |||
921 | /// <summary> | ||
922 | /// | ||
923 | /// </summary> | ||
924 | /// <param name="assetID"></param> | ||
925 | /// <param name="inventoryItem"></param> | ||
926 | /// <param name="data"></param> | ||
927 | public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, | ||
928 | UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, | ||
929 | string assetType) | ||
930 | { | ||
931 | sbyte assType = 0; | ||
932 | sbyte inType = 0; | ||
933 | |||
934 | if (inventoryType == "sound") | ||
935 | { | ||
936 | inType = 1; | ||
937 | assType = 1; | ||
938 | } | ||
939 | else if (inventoryType == "animation") | ||
940 | { | ||
941 | inType = 19; | ||
942 | assType = 20; | ||
943 | } | ||
944 | else if (inventoryType == "wearable") | ||
945 | { | ||
946 | inType = 18; | ||
947 | switch (assetType) | ||
948 | { | ||
949 | case "bodypart": | ||
950 | assType = 13; | ||
951 | break; | ||
952 | case "clothing": | ||
953 | assType = 5; | ||
954 | break; | ||
955 | } | ||
956 | } | ||
957 | |||
958 | AssetBase asset; | ||
959 | asset = new AssetBase(assetID, assetName, assType, m_agentID.ToString()); | ||
960 | asset.Data = data; | ||
961 | if (AddNewAsset != null) | ||
962 | AddNewAsset(asset); | ||
963 | else if (m_assetCache != null) | ||
964 | m_assetCache.Store(asset); | ||
965 | |||
966 | InventoryItemBase item = new InventoryItemBase(); | ||
967 | item.Owner = m_agentID; | ||
968 | item.CreatorId = m_agentID.ToString(); | ||
969 | item.CreatorData = String.Empty; | ||
970 | item.ID = inventoryItem; | ||
971 | item.AssetID = asset.FullID; | ||
972 | item.Description = assetDescription; | ||
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 | { | ||
985 | AddNewInventoryItem(m_agentID, item); | ||
986 | } | ||
987 | } | ||
988 | |||
989 | public void BakedTextureUploaded(UUID assetID, byte[] data) | ||
990 | { | ||
991 | // m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); | ||
992 | |||
993 | AssetBase asset; | ||
994 | asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString()); | ||
995 | asset.Data = data; | ||
996 | asset.Temporary = true; | ||
997 | asset.Local = ! m_persistBakedTextures; // Local assets aren't persisted, non-local are | ||
998 | m_assetCache.Store(asset); | ||
999 | } | ||
1000 | |||
1001 | /// <summary> | ||
1002 | /// Called when new asset data for an agent inventory item update has been uploaded. | ||
1003 | /// </summary> | ||
1004 | /// <param name="itemID">Item to update</param> | ||
1005 | /// <param name="data">New asset data</param> | ||
1006 | /// <returns></returns> | ||
1007 | public UUID ItemUpdated(UUID itemID, byte[] data) | ||
1008 | { | ||
1009 | if (ItemUpdatedCall != null) | ||
1010 | { | ||
1011 | return ItemUpdatedCall(m_agentID, itemID, data); | ||
1012 | } | ||
1013 | |||
1014 | return UUID.Zero; | ||
1015 | } | ||
1016 | |||
1017 | /// <summary> | ||
1018 | /// Called when new asset data for an agent inventory item update has been uploaded. | ||
1019 | /// </summary> | ||
1020 | /// <param name="itemID">Item to update</param> | ||
1021 | /// <param name="primID">Prim containing item to update</param> | ||
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 | { | ||
1028 | ArrayList e = TaskScriptUpdatedCall(m_agentID, itemID, primID, isScriptRunning, data); | ||
1029 | foreach (Object item in e) | ||
1030 | errors.Add(item); | ||
1031 | } | ||
1032 | } | ||
1033 | |||
1034 | public class AssetUploader | ||
1035 | { | ||
1036 | public event UpLoadedAsset OnUpLoad; | ||
1037 | private UpLoadedAsset handlerUpLoad = null; | ||
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 | { | ||
1055 | m_assetName = assetName; | ||
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 | } | ||
1066 | |||
1067 | /// <summary> | ||
1068 | /// | ||
1069 | /// </summary> | ||
1070 | /// <param name="data"></param> | ||
1071 | /// <param name="path"></param> | ||
1072 | /// <param name="param"></param> | ||
1073 | /// <returns></returns> | ||
1074 | public string uploaderCaps(byte[] data, string path, string param) | ||
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 | |||
1083 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
1084 | |||
1085 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
1086 | |||
1087 | // TODO: probably make this a better set of extensions here | ||
1088 | string extension = ".jp2"; | ||
1089 | if (m_invType != "image") | ||
1090 | { | ||
1091 | extension = ".dat"; | ||
1092 | } | ||
1093 | |||
1094 | if (m_dumpAssetsToFile) | ||
1095 | { | ||
1096 | SaveAssetToFile(m_assetName + extension, data); | ||
1097 | } | ||
1098 | handlerUpLoad = OnUpLoad; | ||
1099 | if (handlerUpLoad != null) | ||
1100 | { | ||
1101 | handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); | ||
1102 | } | ||
1103 | |||
1104 | return res; | ||
1105 | } | ||
1106 | ///Left this in and commented in case there are unforseen issues | ||
1107 | //private void SaveAssetToFile(string filename, byte[] data) | ||
1108 | //{ | ||
1109 | // FileStream fs = File.Create(filename); | ||
1110 | // BinaryWriter bw = new BinaryWriter(fs); | ||
1111 | // bw.Write(data); | ||
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 | } | ||
1129 | |||
1130 | /// <summary> | ||
1131 | /// This class is a callback invoked when a client sends asset data to | ||
1132 | /// an agent inventory notecard update url | ||
1133 | /// </summary> | ||
1134 | public class ItemUpdater | ||
1135 | { | ||
1136 | public event UpdateItem OnUpLoad; | ||
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 | { | ||
1147 | m_dumpAssetToFile = dumpAssetToFile; | ||
1148 | |||
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; | ||
1165 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | ||
1166 | UUID assetID = UUID.Zero; | ||
1167 | handlerUpdateItem = OnUpLoad; | ||
1168 | if (handlerUpdateItem != null) | ||
1169 | { | ||
1170 | assetID = handlerUpdateItem(inv, data); | ||
1171 | } | ||
1172 | |||
1173 | uploadComplete.new_asset = assetID.ToString(); | ||
1174 | uploadComplete.new_inventory_item = inv; | ||
1175 | uploadComplete.state = "complete"; | ||
1176 | |||
1177 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
1178 | |||
1179 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
1180 | |||
1181 | if (m_dumpAssetToFile) | ||
1182 | { | ||
1183 | SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data); | ||
1184 | } | ||
1185 | |||
1186 | return res; | ||
1187 | } | ||
1188 | ///Left this in and commented in case there are unforseen issues | ||
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 | { | ||
1199 | string assetPath = "UserAssets"; | ||
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 | } | ||
1210 | } | ||
1211 | |||
1212 | /// <summary> | ||
1213 | /// This class is a callback invoked when a client sends asset data to | ||
1214 | /// a task inventory script update url | ||
1215 | /// </summary> | ||
1216 | public class TaskInventoryScriptUpdater | ||
1217 | { | ||
1218 | public event UpdateTaskScript OnUpLoad; | ||
1219 | |||
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 | { | ||
1232 | m_dumpAssetToFile = dumpAssetToFile; | ||
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 | } | ||
1243 | |||
1244 | /// <summary> | ||
1245 | /// | ||
1246 | /// </summary> | ||
1247 | /// <param name="data"></param> | ||
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 | |||
1286 | return res; | ||
1287 | } | ||
1288 | catch (Exception e) | ||
1289 | { | ||
1290 | m_log.Error("[CAPS]: " + e.ToString()); | ||
1291 | } | ||
1292 | |||
1293 | // XXX Maybe this should be some meaningful error packet | ||
1294 | return null; | ||
1295 | } | ||
1296 | ///Left this in and commented in case there are unforseen issues | ||
1297 | //private void SaveAssetToFile(string filename, byte[] data) | ||
1298 | //{ | ||
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 | } | ||
1319 | |||
1320 | public class BakedTextureUploader | ||
1321 | { | ||
1322 | public event UploadedBakedTexture OnUpLoad; | ||
1323 | private UploadedBakedTexture 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 | { | ||
1331 | newAssetID = UUID.Random(); | ||
1332 | uploaderPath = path; | ||
1333 | httpListener = httpServer; | ||
1334 | // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID); | ||
1335 | } | ||
1336 | |||
1337 | /// <summary> | ||
1338 | /// | ||
1339 | /// </summary> | ||
1340 | /// <param name="data"></param> | ||
1341 | /// <param name="path"></param> | ||
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 | |||
1358 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
1359 | |||
1360 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
1361 | |||
1362 | // m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID); | ||
1363 | |||
1364 | return res; | ||
1365 | } | ||
1366 | } | ||
1367 | } | ||
1368 | } | ||
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/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs new file mode 100644 index 0000000..95713e9 --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -0,0 +1,938 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.IO; | ||
5 | using System.Reflection; | ||
6 | |||
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; | ||
15 | using OpenSim.Framework.Servers; | ||
16 | using OpenSim.Framework.Servers.HttpServer; | ||
17 | using OpenSim.Services.Interfaces; | ||
18 | |||
19 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
20 | |||
21 | namespace OpenSim.Region.ClientStack.Linden | ||
22 | { | ||
23 | public delegate void UpLoadedAsset( | ||
24 | string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, | ||
25 | byte[] data, string inventoryType, string assetType); | ||
26 | |||
27 | public delegate void UploadedBakedTexture(UUID assetID, byte[] data); | ||
28 | |||
29 | public delegate UUID UpdateItem(UUID itemID, byte[] data); | ||
30 | |||
31 | public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors); | ||
32 | |||
33 | public delegate void NewInventoryItem(UUID userID, InventoryItemBase item); | ||
34 | |||
35 | public delegate void NewAsset(AssetBase asset); | ||
36 | |||
37 | public delegate UUID ItemUpdatedCallback(UUID userID, UUID itemID, byte[] data); | ||
38 | |||
39 | public delegate ArrayList TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID, | ||
40 | bool isScriptRunning, byte[] data); | ||
41 | |||
42 | public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, | ||
43 | bool fetchFolders, bool fetchItems, int sortOrder, out int version); | ||
44 | |||
45 | /// <summary> | ||
46 | /// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that | ||
47 | /// we can popup a message on the user's client if the inventory service has permanently failed). But I didn't want | ||
48 | /// to just pass the whole Scene into CAPS. | ||
49 | /// </summary> | ||
50 | public delegate IClientAPI GetClientDelegate(UUID agentID); | ||
51 | |||
52 | public class BunchOfCaps | ||
53 | { | ||
54 | private static readonly ILog m_log = | ||
55 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
56 | |||
57 | private Scene m_Scene; | ||
58 | private Caps m_HostCapsObj; | ||
59 | |||
60 | private static readonly string m_requestPath = "0000/"; | ||
61 | // private static readonly string m_mapLayerPath = "0001/"; | ||
62 | private static readonly string m_newInventory = "0002/"; | ||
63 | //private static readonly string m_requestTexture = "0003/"; | ||
64 | private static readonly string m_notecardUpdatePath = "0004/"; | ||
65 | private static readonly string m_notecardTaskUpdatePath = "0005/"; | ||
66 | // private static readonly string m_fetchInventoryPath = "0006/"; | ||
67 | // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. | ||
68 | private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule. | ||
69 | |||
70 | |||
71 | // These are callbacks which will be setup by the scene so that we can update scene data when we | ||
72 | // receive capability calls | ||
73 | public NewInventoryItem AddNewInventoryItem = null; | ||
74 | public NewAsset AddNewAsset = null; | ||
75 | public ItemUpdatedCallback ItemUpdatedCall = null; | ||
76 | public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; | ||
77 | public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; | ||
78 | public GetClientDelegate GetClient = null; | ||
79 | |||
80 | private bool m_persistBakedTextures = false; | ||
81 | private IAssetService m_assetService; | ||
82 | private bool m_dumpAssetsToFile; | ||
83 | private string m_regionName; | ||
84 | |||
85 | public BunchOfCaps(Scene scene, Caps caps) | ||
86 | { | ||
87 | m_Scene = scene; | ||
88 | m_HostCapsObj = caps; | ||
89 | IConfigSource config = m_Scene.Config; | ||
90 | if (config != null) | ||
91 | { | ||
92 | IConfig sconfig = config.Configs["Startup"]; | ||
93 | if (sconfig != null) | ||
94 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); | ||
95 | } | ||
96 | |||
97 | m_assetService = m_Scene.AssetService; | ||
98 | m_regionName = m_Scene.RegionInfo.RegionName; | ||
99 | |||
100 | RegisterHandlers(); | ||
101 | |||
102 | AddNewInventoryItem = m_Scene.AddUploadedInventoryItem; | ||
103 | ItemUpdatedCall = m_Scene.CapsUpdateInventoryItemAsset; | ||
104 | TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset; | ||
105 | CAPSFetchInventoryDescendents = m_Scene.HandleFetchInventoryDescendentsCAPS; | ||
106 | GetClient = m_Scene.SceneContents.GetControllingClient; | ||
107 | |||
108 | } | ||
109 | |||
110 | /// <summary> | ||
111 | /// Register a bunch of CAPS http service handlers | ||
112 | /// </summary> | ||
113 | public void RegisterHandlers() | ||
114 | { | ||
115 | string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; | ||
116 | |||
117 | RegisterRegionServiceHandlers(capsBase); | ||
118 | RegisterInventoryServiceHandlers(capsBase); | ||
119 | } | ||
120 | |||
121 | public void RegisterRegionServiceHandlers(string capsBase) | ||
122 | { | ||
123 | try | ||
124 | { | ||
125 | // the root of all evil | ||
126 | m_HostCapsObj.RegisterHandler("SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest)); | ||
127 | m_log.DebugFormat( | ||
128 | "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID); | ||
129 | |||
130 | //m_capsHandlers["MapLayer"] = | ||
131 | // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST", | ||
132 | // capsBase + m_mapLayerPath, | ||
133 | // GetMapLayer); | ||
134 | IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory); | ||
135 | m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req); | ||
136 | m_HostCapsObj.RegisterHandler("UpdateScriptTask", req); | ||
137 | m_HostCapsObj.RegisterHandler("UploadBakedTexture", new RestStreamHandler("POST", capsBase + m_uploadBakedTexturePath, UploadBakedTexture)); | ||
138 | |||
139 | } | ||
140 | catch (Exception e) | ||
141 | { | ||
142 | m_log.Error("[CAPS]: " + e.ToString()); | ||
143 | } | ||
144 | } | ||
145 | |||
146 | public void RegisterInventoryServiceHandlers(string capsBase) | ||
147 | { | ||
148 | try | ||
149 | { | ||
150 | // I don't think this one works... | ||
151 | m_HostCapsObj.RegisterHandler("NewFileAgentInventory", new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", | ||
152 | capsBase + m_newInventory, | ||
153 | NewAgentInventoryRequest)); | ||
154 | IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory); | ||
155 | m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); | ||
156 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); | ||
157 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); | ||
158 | |||
159 | // As of RC 1.22.9 of the Linden client this is | ||
160 | // supported | ||
161 | |||
162 | //m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest); | ||
163 | |||
164 | // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and | ||
165 | // subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires | ||
166 | // enhancements (probably filling out the folder part of the LLSD reply) to our CAPS service, | ||
167 | // but when I went on the Linden grid, the | ||
168 | // simulators I visited (version 1.21) were, surprisingly, no longer supplying this capability. Instead, | ||
169 | // the 1.19.1.4 client appeared to be happily flowing inventory data over UDP | ||
170 | // | ||
171 | // This is very probably just a temporary measure - once the CAPS service appears again on the Linden grid | ||
172 | // we will be | ||
173 | // able to get the data we need to implement the necessary part of the protocol to fix the issue above. | ||
174 | // m_capsHandlers["FetchInventoryDescendents"] = | ||
175 | // new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryRequest); | ||
176 | |||
177 | // m_capsHandlers["FetchInventoryDescendents"] = | ||
178 | // new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST", | ||
179 | // capsBase + m_fetchInventory, | ||
180 | // FetchInventory)); | ||
181 | // m_capsHandlers["RequestTextureDownload"] = new RestStreamHandler("POST", | ||
182 | // capsBase + m_requestTexture, | ||
183 | // RequestTexture); | ||
184 | } | ||
185 | catch (Exception e) | ||
186 | { | ||
187 | m_log.Error("[CAPS]: " + e.ToString()); | ||
188 | } | ||
189 | } | ||
190 | |||
191 | /// <summary> | ||
192 | /// Construct a client response detailing all the capabilities this server can provide. | ||
193 | /// </summary> | ||
194 | /// <param name="request"></param> | ||
195 | /// <param name="path"></param> | ||
196 | /// <param name="param"></param> | ||
197 | /// <param name="httpRequest">HTTP request header object</param> | ||
198 | /// <param name="httpResponse">HTTP response header object</param> | ||
199 | /// <returns></returns> | ||
200 | public string SeedCapRequest(string request, string path, string param, | ||
201 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
202 | { | ||
203 | m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); | ||
204 | |||
205 | if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) | ||
206 | { | ||
207 | m_log.DebugFormat("[CAPS]: Unauthorized CAPS client"); | ||
208 | return string.Empty; | ||
209 | } | ||
210 | |||
211 | Hashtable caps = m_HostCapsObj.CapsHandlers.CapsDetails; | ||
212 | // Add the external too | ||
213 | foreach (KeyValuePair<string, string> kvp in m_HostCapsObj.ExternalCapsHandlers) | ||
214 | caps[kvp.Key] = kvp.Value; | ||
215 | |||
216 | string result = LLSDHelpers.SerialiseLLSDReply(caps); | ||
217 | |||
218 | //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); | ||
219 | |||
220 | return result; | ||
221 | } | ||
222 | |||
223 | /// <summary> | ||
224 | /// Called by the script task update handler. Provides a URL to which the client can upload a new asset. | ||
225 | /// </summary> | ||
226 | /// <param name="request"></param> | ||
227 | /// <param name="path"></param> | ||
228 | /// <param name="param"></param> | ||
229 | /// <param name="httpRequest">HTTP request header object</param> | ||
230 | /// <param name="httpResponse">HTTP response header object</param> | ||
231 | /// <returns></returns> | ||
232 | public string ScriptTaskInventory(string request, string path, string param, | ||
233 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
234 | { | ||
235 | try | ||
236 | { | ||
237 | m_log.Debug("[CAPS]: ScriptTaskInventory Request in region: " + m_regionName); | ||
238 | //m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param); | ||
239 | |||
240 | Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); | ||
241 | LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate(); | ||
242 | LLSDHelpers.DeserialiseOSDMap(hash, llsdUpdateRequest); | ||
243 | |||
244 | string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; | ||
245 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
246 | |||
247 | TaskInventoryScriptUpdater uploader = | ||
248 | new TaskInventoryScriptUpdater( | ||
249 | llsdUpdateRequest.item_id, | ||
250 | llsdUpdateRequest.task_id, | ||
251 | llsdUpdateRequest.is_script_running, | ||
252 | capsBase + uploaderPath, | ||
253 | m_HostCapsObj.HttpListener, | ||
254 | m_dumpAssetsToFile); | ||
255 | uploader.OnUpLoad += TaskScriptUpdated; | ||
256 | |||
257 | m_HostCapsObj.HttpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | ||
258 | |||
259 | string protocol = "http://"; | ||
260 | |||
261 | if (m_HostCapsObj.SSLCaps) | ||
262 | protocol = "https://"; | ||
263 | |||
264 | string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + | ||
265 | uploaderPath; | ||
266 | |||
267 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | ||
268 | uploadResponse.uploader = uploaderURL; | ||
269 | uploadResponse.state = "upload"; | ||
270 | |||
271 | // m_log.InfoFormat("[CAPS]: " + | ||
272 | // "ScriptTaskInventory response: {0}", | ||
273 | // LLSDHelpers.SerialiseLLSDReply(uploadResponse))); | ||
274 | |||
275 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | ||
276 | } | ||
277 | catch (Exception e) | ||
278 | { | ||
279 | m_log.Error("[CAPS]: " + e.ToString()); | ||
280 | } | ||
281 | |||
282 | return null; | ||
283 | } | ||
284 | |||
285 | /// <summary> | ||
286 | /// Called when new asset data for an agent inventory item update has been uploaded. | ||
287 | /// </summary> | ||
288 | /// <param name="itemID">Item to update</param> | ||
289 | /// <param name="primID">Prim containing item to update</param> | ||
290 | /// <param name="isScriptRunning">Signals whether the script to update is currently running</param> | ||
291 | /// <param name="data">New asset data</param> | ||
292 | public void TaskScriptUpdated(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors) | ||
293 | { | ||
294 | if (TaskScriptUpdatedCall != null) | ||
295 | { | ||
296 | ArrayList e = TaskScriptUpdatedCall(m_HostCapsObj.AgentID, itemID, primID, isScriptRunning, data); | ||
297 | foreach (Object item in e) | ||
298 | errors.Add(item); | ||
299 | } | ||
300 | } | ||
301 | |||
302 | public string UploadBakedTexture(string request, string path, | ||
303 | string param, OSHttpRequest httpRequest, | ||
304 | OSHttpResponse httpResponse) | ||
305 | { | ||
306 | try | ||
307 | { | ||
308 | // m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + | ||
309 | // m_regionName); | ||
310 | |||
311 | string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; | ||
312 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
313 | |||
314 | BakedTextureUploader uploader = | ||
315 | new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener); | ||
316 | uploader.OnUpLoad += BakedTextureUploaded; | ||
317 | |||
318 | m_HostCapsObj.HttpListener.AddStreamHandler( | ||
319 | new BinaryStreamHandler("POST", capsBase + uploaderPath, | ||
320 | uploader.uploaderCaps)); | ||
321 | |||
322 | string protocol = "http://"; | ||
323 | |||
324 | if (m_HostCapsObj.SSLCaps) | ||
325 | protocol = "https://"; | ||
326 | |||
327 | string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + | ||
328 | m_HostCapsObj.Port.ToString() + capsBase + uploaderPath; | ||
329 | |||
330 | LLSDAssetUploadResponse uploadResponse = | ||
331 | new LLSDAssetUploadResponse(); | ||
332 | uploadResponse.uploader = uploaderURL; | ||
333 | uploadResponse.state = "upload"; | ||
334 | |||
335 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | ||
336 | } | ||
337 | catch (Exception e) | ||
338 | { | ||
339 | m_log.Error("[CAPS]: " + e.ToString()); | ||
340 | } | ||
341 | |||
342 | return null; | ||
343 | } | ||
344 | |||
345 | public void BakedTextureUploaded(UUID assetID, byte[] data) | ||
346 | { | ||
347 | // m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); | ||
348 | |||
349 | AssetBase asset; | ||
350 | asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString()); | ||
351 | asset.Data = data; | ||
352 | asset.Temporary = true; | ||
353 | asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are | ||
354 | m_assetService.Store(asset); | ||
355 | } | ||
356 | |||
357 | /// <summary> | ||
358 | /// Called when new asset data for an agent inventory item update has been uploaded. | ||
359 | /// </summary> | ||
360 | /// <param name="itemID">Item to update</param> | ||
361 | /// <param name="data">New asset data</param> | ||
362 | /// <returns></returns> | ||
363 | public UUID ItemUpdated(UUID itemID, byte[] data) | ||
364 | { | ||
365 | if (ItemUpdatedCall != null) | ||
366 | { | ||
367 | return ItemUpdatedCall(m_HostCapsObj.AgentID, itemID, data); | ||
368 | } | ||
369 | |||
370 | return UUID.Zero; | ||
371 | } | ||
372 | |||
373 | /// <summary> | ||
374 | /// | ||
375 | /// </summary> | ||
376 | /// <param name="llsdRequest"></param> | ||
377 | /// <returns></returns> | ||
378 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) | ||
379 | { | ||
380 | //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString()); | ||
381 | //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); | ||
382 | |||
383 | if (llsdRequest.asset_type == "texture" || | ||
384 | llsdRequest.asset_type == "animation" || | ||
385 | llsdRequest.asset_type == "sound") | ||
386 | { | ||
387 | IClientAPI client = null; | ||
388 | IScene scene = null; | ||
389 | if (GetClient != null) | ||
390 | { | ||
391 | client = GetClient(m_HostCapsObj.AgentID); | ||
392 | scene = client.Scene; | ||
393 | |||
394 | IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); | ||
395 | |||
396 | if (mm != null) | ||
397 | { | ||
398 | if (!mm.UploadCovered(client, mm.UploadCharge)) | ||
399 | { | ||
400 | if (client != null) | ||
401 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | ||
402 | |||
403 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | ||
404 | errorResponse.uploader = ""; | ||
405 | errorResponse.state = "error"; | ||
406 | return errorResponse; | ||
407 | } | ||
408 | } | ||
409 | } | ||
410 | } | ||
411 | |||
412 | string assetName = llsdRequest.name; | ||
413 | string assetDes = llsdRequest.description; | ||
414 | string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; | ||
415 | UUID newAsset = UUID.Random(); | ||
416 | UUID newInvItem = UUID.Random(); | ||
417 | UUID parentFolder = llsdRequest.folder_id; | ||
418 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
419 | |||
420 | AssetUploader uploader = | ||
421 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, | ||
422 | llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile); | ||
423 | m_HostCapsObj.HttpListener.AddStreamHandler( | ||
424 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | ||
425 | |||
426 | string protocol = "http://"; | ||
427 | |||
428 | if (m_HostCapsObj.SSLCaps) | ||
429 | protocol = "https://"; | ||
430 | |||
431 | string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + | ||
432 | uploaderPath; | ||
433 | |||
434 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | ||
435 | uploadResponse.uploader = uploaderURL; | ||
436 | uploadResponse.state = "upload"; | ||
437 | uploader.OnUpLoad += UploadCompleteHandler; | ||
438 | return uploadResponse; | ||
439 | } | ||
440 | |||
441 | /// <summary> | ||
442 | /// | ||
443 | /// </summary> | ||
444 | /// <param name="assetID"></param> | ||
445 | /// <param name="inventoryItem"></param> | ||
446 | /// <param name="data"></param> | ||
447 | public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, | ||
448 | UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, | ||
449 | string assetType) | ||
450 | { | ||
451 | sbyte assType = 0; | ||
452 | sbyte inType = 0; | ||
453 | |||
454 | if (inventoryType == "sound") | ||
455 | { | ||
456 | inType = 1; | ||
457 | assType = 1; | ||
458 | } | ||
459 | else if (inventoryType == "animation") | ||
460 | { | ||
461 | inType = 19; | ||
462 | assType = 20; | ||
463 | } | ||
464 | else if (inventoryType == "wearable") | ||
465 | { | ||
466 | inType = 18; | ||
467 | switch (assetType) | ||
468 | { | ||
469 | case "bodypart": | ||
470 | assType = 13; | ||
471 | break; | ||
472 | case "clothing": | ||
473 | assType = 5; | ||
474 | break; | ||
475 | } | ||
476 | } | ||
477 | |||
478 | AssetBase asset; | ||
479 | asset = new AssetBase(assetID, assetName, assType, m_HostCapsObj.AgentID.ToString()); | ||
480 | asset.Data = data; | ||
481 | if (AddNewAsset != null) | ||
482 | AddNewAsset(asset); | ||
483 | else if (m_assetService != null) | ||
484 | m_assetService.Store(asset); | ||
485 | |||
486 | InventoryItemBase item = new InventoryItemBase(); | ||
487 | item.Owner = m_HostCapsObj.AgentID; | ||
488 | item.CreatorId = m_HostCapsObj.AgentID.ToString(); | ||
489 | item.CreatorData = String.Empty; | ||
490 | item.ID = inventoryItem; | ||
491 | item.AssetID = asset.FullID; | ||
492 | item.Description = assetDescription; | ||
493 | item.Name = assetName; | ||
494 | item.AssetType = assType; | ||
495 | item.InvType = inType; | ||
496 | item.Folder = parentFolder; | ||
497 | item.CurrentPermissions = (uint)PermissionMask.All; | ||
498 | item.BasePermissions = (uint)PermissionMask.All; | ||
499 | item.EveryOnePermissions = 0; | ||
500 | item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); | ||
501 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
502 | |||
503 | if (AddNewInventoryItem != null) | ||
504 | { | ||
505 | AddNewInventoryItem(m_HostCapsObj.AgentID, item); | ||
506 | } | ||
507 | } | ||
508 | |||
509 | |||
510 | |||
511 | /// <summary> | ||
512 | /// | ||
513 | /// </summary> | ||
514 | /// <param name="mapReq"></param> | ||
515 | /// <returns></returns> | ||
516 | public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) | ||
517 | { | ||
518 | m_log.Debug("[CAPS]: MapLayer Request in region: " + m_regionName); | ||
519 | LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); | ||
520 | mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); | ||
521 | return mapResponse; | ||
522 | } | ||
523 | |||
524 | /// <summary> | ||
525 | /// | ||
526 | /// </summary> | ||
527 | /// <returns></returns> | ||
528 | protected static OSDMapLayer GetOSDMapLayerResponse() | ||
529 | { | ||
530 | OSDMapLayer mapLayer = new OSDMapLayer(); | ||
531 | mapLayer.Right = 5000; | ||
532 | mapLayer.Top = 5000; | ||
533 | mapLayer.ImageID = new UUID("00000000-0000-1111-9999-000000000006"); | ||
534 | |||
535 | return mapLayer; | ||
536 | } | ||
537 | |||
538 | /// <summary> | ||
539 | /// | ||
540 | /// </summary> | ||
541 | /// <param name="request"></param> | ||
542 | /// <param name="path"></param> | ||
543 | /// <param name="param"></param> | ||
544 | /// <returns></returns> | ||
545 | public string RequestTexture(string request, string path, string param) | ||
546 | { | ||
547 | m_log.Debug("texture request " + request); | ||
548 | // Needs implementing (added to remove compiler warning) | ||
549 | return String.Empty; | ||
550 | } | ||
551 | |||
552 | |||
553 | /// <summary> | ||
554 | /// Called by the notecard update handler. Provides a URL to which the client can upload a new asset. | ||
555 | /// </summary> | ||
556 | /// <param name="request"></param> | ||
557 | /// <param name="path"></param> | ||
558 | /// <param name="param"></param> | ||
559 | /// <returns></returns> | ||
560 | public string NoteCardAgentInventory(string request, string path, string param, | ||
561 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
562 | { | ||
563 | //m_log.Debug("[CAPS]: NoteCardAgentInventory Request in region: " + m_regionName + "\n" + request); | ||
564 | //m_log.Debug("[CAPS]: NoteCardAgentInventory Request is: " + request); | ||
565 | |||
566 | //OpenMetaverse.StructuredData.OSDMap hash = (OpenMetaverse.StructuredData.OSDMap)OpenMetaverse.StructuredData.LLSDParser.DeserializeBinary(Utils.StringToBytes(request)); | ||
567 | Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); | ||
568 | LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); | ||
569 | LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest); | ||
570 | |||
571 | string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; | ||
572 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
573 | |||
574 | ItemUpdater uploader = | ||
575 | new ItemUpdater(llsdRequest.item_id, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile); | ||
576 | uploader.OnUpLoad += ItemUpdated; | ||
577 | |||
578 | m_HostCapsObj.HttpListener.AddStreamHandler( | ||
579 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | ||
580 | |||
581 | string protocol = "http://"; | ||
582 | |||
583 | if (m_HostCapsObj.SSLCaps) | ||
584 | protocol = "https://"; | ||
585 | |||
586 | string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + | ||
587 | uploaderPath; | ||
588 | |||
589 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | ||
590 | uploadResponse.uploader = uploaderURL; | ||
591 | uploadResponse.state = "upload"; | ||
592 | |||
593 | // m_log.InfoFormat("[CAPS]: " + | ||
594 | // "NoteCardAgentInventory response: {0}", | ||
595 | // LLSDHelpers.SerialiseLLSDReply(uploadResponse))); | ||
596 | |||
597 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | ||
598 | } | ||
599 | } | ||
600 | |||
601 | public class AssetUploader | ||
602 | { | ||
603 | public event UpLoadedAsset OnUpLoad; | ||
604 | private UpLoadedAsset handlerUpLoad = null; | ||
605 | |||
606 | private string uploaderPath = String.Empty; | ||
607 | private UUID newAssetID; | ||
608 | private UUID inventoryItemID; | ||
609 | private UUID parentFolder; | ||
610 | private IHttpServer httpListener; | ||
611 | private bool m_dumpAssetsToFile; | ||
612 | private string m_assetName = String.Empty; | ||
613 | private string m_assetDes = String.Empty; | ||
614 | |||
615 | private string m_invType = String.Empty; | ||
616 | private string m_assetType = String.Empty; | ||
617 | |||
618 | public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, | ||
619 | UUID parentFolderID, string invType, string assetType, string path, | ||
620 | IHttpServer httpServer, bool dumpAssetsToFile) | ||
621 | { | ||
622 | m_assetName = assetName; | ||
623 | m_assetDes = description; | ||
624 | newAssetID = assetID; | ||
625 | inventoryItemID = inventoryItem; | ||
626 | uploaderPath = path; | ||
627 | httpListener = httpServer; | ||
628 | parentFolder = parentFolderID; | ||
629 | m_assetType = assetType; | ||
630 | m_invType = invType; | ||
631 | m_dumpAssetsToFile = dumpAssetsToFile; | ||
632 | } | ||
633 | |||
634 | /// <summary> | ||
635 | /// | ||
636 | /// </summary> | ||
637 | /// <param name="data"></param> | ||
638 | /// <param name="path"></param> | ||
639 | /// <param name="param"></param> | ||
640 | /// <returns></returns> | ||
641 | public string uploaderCaps(byte[] data, string path, string param) | ||
642 | { | ||
643 | UUID inv = inventoryItemID; | ||
644 | string res = String.Empty; | ||
645 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | ||
646 | uploadComplete.new_asset = newAssetID.ToString(); | ||
647 | uploadComplete.new_inventory_item = inv; | ||
648 | uploadComplete.state = "complete"; | ||
649 | |||
650 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
651 | |||
652 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
653 | |||
654 | // TODO: probably make this a better set of extensions here | ||
655 | string extension = ".jp2"; | ||
656 | if (m_invType != "image") | ||
657 | { | ||
658 | extension = ".dat"; | ||
659 | } | ||
660 | |||
661 | if (m_dumpAssetsToFile) | ||
662 | { | ||
663 | SaveAssetToFile(m_assetName + extension, data); | ||
664 | } | ||
665 | handlerUpLoad = OnUpLoad; | ||
666 | if (handlerUpLoad != null) | ||
667 | { | ||
668 | handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); | ||
669 | } | ||
670 | |||
671 | return res; | ||
672 | } | ||
673 | ///Left this in and commented in case there are unforseen issues | ||
674 | //private void SaveAssetToFile(string filename, byte[] data) | ||
675 | //{ | ||
676 | // FileStream fs = File.Create(filename); | ||
677 | // BinaryWriter bw = new BinaryWriter(fs); | ||
678 | // bw.Write(data); | ||
679 | // bw.Close(); | ||
680 | // fs.Close(); | ||
681 | //} | ||
682 | private static void SaveAssetToFile(string filename, byte[] data) | ||
683 | { | ||
684 | string assetPath = "UserAssets"; | ||
685 | if (!Directory.Exists(assetPath)) | ||
686 | { | ||
687 | Directory.CreateDirectory(assetPath); | ||
688 | } | ||
689 | FileStream fs = File.Create(Path.Combine(assetPath, Util.safeFileName(filename))); | ||
690 | BinaryWriter bw = new BinaryWriter(fs); | ||
691 | bw.Write(data); | ||
692 | bw.Close(); | ||
693 | fs.Close(); | ||
694 | } | ||
695 | } | ||
696 | |||
697 | /// <summary> | ||
698 | /// This class is a callback invoked when a client sends asset data to | ||
699 | /// an agent inventory notecard update url | ||
700 | /// </summary> | ||
701 | public class ItemUpdater | ||
702 | { | ||
703 | public event UpdateItem OnUpLoad; | ||
704 | |||
705 | private UpdateItem handlerUpdateItem = null; | ||
706 | |||
707 | private string uploaderPath = String.Empty; | ||
708 | private UUID inventoryItemID; | ||
709 | private IHttpServer httpListener; | ||
710 | private bool m_dumpAssetToFile; | ||
711 | |||
712 | public ItemUpdater(UUID inventoryItem, string path, IHttpServer httpServer, bool dumpAssetToFile) | ||
713 | { | ||
714 | m_dumpAssetToFile = dumpAssetToFile; | ||
715 | |||
716 | inventoryItemID = inventoryItem; | ||
717 | uploaderPath = path; | ||
718 | httpListener = httpServer; | ||
719 | } | ||
720 | |||
721 | /// <summary> | ||
722 | /// | ||
723 | /// </summary> | ||
724 | /// <param name="data"></param> | ||
725 | /// <param name="path"></param> | ||
726 | /// <param name="param"></param> | ||
727 | /// <returns></returns> | ||
728 | public string uploaderCaps(byte[] data, string path, string param) | ||
729 | { | ||
730 | UUID inv = inventoryItemID; | ||
731 | string res = String.Empty; | ||
732 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | ||
733 | UUID assetID = UUID.Zero; | ||
734 | handlerUpdateItem = OnUpLoad; | ||
735 | if (handlerUpdateItem != null) | ||
736 | { | ||
737 | assetID = handlerUpdateItem(inv, data); | ||
738 | } | ||
739 | |||
740 | uploadComplete.new_asset = assetID.ToString(); | ||
741 | uploadComplete.new_inventory_item = inv; | ||
742 | uploadComplete.state = "complete"; | ||
743 | |||
744 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
745 | |||
746 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
747 | |||
748 | if (m_dumpAssetToFile) | ||
749 | { | ||
750 | SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data); | ||
751 | } | ||
752 | |||
753 | return res; | ||
754 | } | ||
755 | ///Left this in and commented in case there are unforseen issues | ||
756 | //private void SaveAssetToFile(string filename, byte[] data) | ||
757 | //{ | ||
758 | // FileStream fs = File.Create(filename); | ||
759 | // BinaryWriter bw = new BinaryWriter(fs); | ||
760 | // bw.Write(data); | ||
761 | // bw.Close(); | ||
762 | // fs.Close(); | ||
763 | //} | ||
764 | private static void SaveAssetToFile(string filename, byte[] data) | ||
765 | { | ||
766 | string assetPath = "UserAssets"; | ||
767 | if (!Directory.Exists(assetPath)) | ||
768 | { | ||
769 | Directory.CreateDirectory(assetPath); | ||
770 | } | ||
771 | FileStream fs = File.Create(Path.Combine(assetPath, filename)); | ||
772 | BinaryWriter bw = new BinaryWriter(fs); | ||
773 | bw.Write(data); | ||
774 | bw.Close(); | ||
775 | fs.Close(); | ||
776 | } | ||
777 | } | ||
778 | |||
779 | /// <summary> | ||
780 | /// This class is a callback invoked when a client sends asset data to | ||
781 | /// a task inventory script update url | ||
782 | /// </summary> | ||
783 | public class TaskInventoryScriptUpdater | ||
784 | { | ||
785 | private static readonly ILog m_log = | ||
786 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
787 | |||
788 | public event UpdateTaskScript OnUpLoad; | ||
789 | |||
790 | private UpdateTaskScript handlerUpdateTaskScript = null; | ||
791 | |||
792 | private string uploaderPath = String.Empty; | ||
793 | private UUID inventoryItemID; | ||
794 | private UUID primID; | ||
795 | private bool isScriptRunning; | ||
796 | private IHttpServer httpListener; | ||
797 | private bool m_dumpAssetToFile; | ||
798 | |||
799 | public TaskInventoryScriptUpdater(UUID inventoryItemID, UUID primID, int isScriptRunning, | ||
800 | string path, IHttpServer httpServer, bool dumpAssetToFile) | ||
801 | { | ||
802 | m_dumpAssetToFile = dumpAssetToFile; | ||
803 | |||
804 | this.inventoryItemID = inventoryItemID; | ||
805 | this.primID = primID; | ||
806 | |||
807 | // This comes in over the packet as an integer, but actually appears to be treated as a bool | ||
808 | this.isScriptRunning = (0 == isScriptRunning ? false : true); | ||
809 | |||
810 | uploaderPath = path; | ||
811 | httpListener = httpServer; | ||
812 | } | ||
813 | |||
814 | /// <summary> | ||
815 | /// | ||
816 | /// </summary> | ||
817 | /// <param name="data"></param> | ||
818 | /// <param name="path"></param> | ||
819 | /// <param name="param"></param> | ||
820 | /// <returns></returns> | ||
821 | public string uploaderCaps(byte[] data, string path, string param) | ||
822 | { | ||
823 | try | ||
824 | { | ||
825 | // m_log.InfoFormat("[CAPS]: " + | ||
826 | // "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}", | ||
827 | // data, path, param)); | ||
828 | |||
829 | string res = String.Empty; | ||
830 | LLSDTaskScriptUploadComplete uploadComplete = new LLSDTaskScriptUploadComplete(); | ||
831 | |||
832 | ArrayList errors = new ArrayList(); | ||
833 | handlerUpdateTaskScript = OnUpLoad; | ||
834 | if (handlerUpdateTaskScript != null) | ||
835 | { | ||
836 | handlerUpdateTaskScript(inventoryItemID, primID, isScriptRunning, data, ref errors); | ||
837 | } | ||
838 | |||
839 | uploadComplete.new_asset = inventoryItemID; | ||
840 | uploadComplete.compiled = errors.Count > 0 ? false : true; | ||
841 | uploadComplete.state = "complete"; | ||
842 | uploadComplete.errors = new OSDArray(); | ||
843 | uploadComplete.errors.Array = errors; | ||
844 | |||
845 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
846 | |||
847 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
848 | |||
849 | if (m_dumpAssetToFile) | ||
850 | { | ||
851 | SaveAssetToFile("updatedtaskscript" + Util.RandomClass.Next(1, 1000) + ".dat", data); | ||
852 | } | ||
853 | |||
854 | // m_log.InfoFormat("[CAPS]: TaskInventoryScriptUpdater.uploaderCaps res: {0}", res); | ||
855 | |||
856 | return res; | ||
857 | } | ||
858 | catch (Exception e) | ||
859 | { | ||
860 | m_log.Error("[CAPS]: " + e.ToString()); | ||
861 | } | ||
862 | |||
863 | // XXX Maybe this should be some meaningful error packet | ||
864 | return null; | ||
865 | } | ||
866 | ///Left this in and commented in case there are unforseen issues | ||
867 | //private void SaveAssetToFile(string filename, byte[] data) | ||
868 | //{ | ||
869 | // FileStream fs = File.Create(filename); | ||
870 | // BinaryWriter bw = new BinaryWriter(fs); | ||
871 | // bw.Write(data); | ||
872 | // bw.Close(); | ||
873 | // fs.Close(); | ||
874 | //} | ||
875 | private static void SaveAssetToFile(string filename, byte[] data) | ||
876 | { | ||
877 | string assetPath = "UserAssets"; | ||
878 | if (!Directory.Exists(assetPath)) | ||
879 | { | ||
880 | Directory.CreateDirectory(assetPath); | ||
881 | } | ||
882 | FileStream fs = File.Create(Path.Combine(assetPath, filename)); | ||
883 | BinaryWriter bw = new BinaryWriter(fs); | ||
884 | bw.Write(data); | ||
885 | bw.Close(); | ||
886 | fs.Close(); | ||
887 | } | ||
888 | } | ||
889 | |||
890 | public class BakedTextureUploader | ||
891 | { | ||
892 | public event UploadedBakedTexture OnUpLoad; | ||
893 | private UploadedBakedTexture handlerUpLoad = null; | ||
894 | |||
895 | private string uploaderPath = String.Empty; | ||
896 | private UUID newAssetID; | ||
897 | private IHttpServer httpListener; | ||
898 | |||
899 | public BakedTextureUploader(string path, IHttpServer httpServer) | ||
900 | { | ||
901 | newAssetID = UUID.Random(); | ||
902 | uploaderPath = path; | ||
903 | httpListener = httpServer; | ||
904 | // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID); | ||
905 | } | ||
906 | |||
907 | /// <summary> | ||
908 | /// | ||
909 | /// </summary> | ||
910 | /// <param name="data"></param> | ||
911 | /// <param name="path"></param> | ||
912 | /// <param name="param"></param> | ||
913 | /// <returns></returns> | ||
914 | public string uploaderCaps(byte[] data, string path, string param) | ||
915 | { | ||
916 | handlerUpLoad = OnUpLoad; | ||
917 | if (handlerUpLoad != null) | ||
918 | { | ||
919 | Util.FireAndForget(delegate(object o) { handlerUpLoad(newAssetID, data); }); | ||
920 | } | ||
921 | |||
922 | string res = String.Empty; | ||
923 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | ||
924 | uploadComplete.new_asset = newAssetID.ToString(); | ||
925 | uploadComplete.new_inventory_item = UUID.Zero; | ||
926 | uploadComplete.state = "complete"; | ||
927 | |||
928 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
929 | |||
930 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
931 | |||
932 | // m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID); | ||
933 | |||
934 | return res; | ||
935 | } | ||
936 | } | ||
937 | |||
938 | } | ||
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..139d8b8 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); |
@@ -270,9 +272,9 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
270 | public void OnRegisterCaps(UUID agentID, Caps caps) | 272 | public void OnRegisterCaps(UUID agentID, Caps caps) |
271 | { | 273 | { |
272 | // Register an event queue for the client | 274 | // Register an event queue for the client |
273 | 275 | ||
274 | //m_log.DebugFormat( | 276 | //m_log.DebugFormat( |
275 | // "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}", | 277 | // "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}", |
276 | // agentID, caps, m_scene.RegionInfo.RegionName); | 278 | // agentID, caps, m_scene.RegionInfo.RegionName); |
277 | 279 | ||
278 | // Let's instantiate a Queue for this agent right now | 280 | // Let's instantiate a Queue for this agent right now |
@@ -315,7 +317,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
315 | { | 317 | { |
316 | return ProcessQueue(m_dhttpMethod, agentID, caps); | 318 | return ProcessQueue(m_dhttpMethod, agentID, caps); |
317 | })); | 319 | })); |
318 | 320 | ||
319 | // This will persist this beyond the expiry of the caps handlers | 321 | // This will persist this beyond the expiry of the caps handlers |
320 | MainServer.Instance.AddPollServiceHTTPHandler( | 322 | MainServer.Instance.AddPollServiceHTTPHandler( |
321 | capsBase + EventQueueGetUUID.ToString() + "/", EventQueuePoll, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID)); | 323 | capsBase + EventQueueGetUUID.ToString() + "/", EventQueuePoll, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID)); |
@@ -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..e0807ee --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.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.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 | if (!m_Enabled) | ||
91 | return; | ||
92 | |||
93 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | ||
94 | m_scene = null; | ||
95 | } | ||
96 | |||
97 | public void RegionLoaded(Scene scene) | ||
98 | { | ||
99 | if (!m_Enabled) | ||
100 | return; | ||
101 | |||
102 | m_AssetService = m_scene.RequestModuleInterface<IAssetService>(); | ||
103 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
104 | } | ||
105 | |||
106 | |||
107 | public void Close() { } | ||
108 | |||
109 | public string Name { get { return "GetMeshModule"; } } | ||
110 | |||
111 | #endregion | ||
112 | |||
113 | |||
114 | public void RegisterCaps(UUID agentID, Caps caps) | ||
115 | { | ||
116 | UUID capID = UUID.Random(); | ||
117 | |||
118 | //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); | ||
119 | if (m_URL == "localhost") | ||
120 | { | ||
121 | m_log.InfoFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | ||
122 | GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); | ||
123 | IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), | ||
124 | delegate(Hashtable m_dhttpMethod) | ||
125 | { | ||
126 | return gmeshHandler.ProcessGetMesh(m_dhttpMethod, UUID.Zero, null); | ||
127 | }); | ||
128 | |||
129 | caps.RegisterHandler("GetMesh", reqHandler); | ||
130 | } | ||
131 | else | ||
132 | { | ||
133 | m_log.InfoFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); | ||
134 | caps.RegisterHandler("GetMesh", m_URL); | ||
135 | } | ||
136 | } | ||
137 | |||
138 | } | ||
139 | } | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs new file mode 100644 index 0000000..35eedb4 --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -0,0 +1,142 @@ | |||
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 | if (!m_Enabled) | ||
94 | return; | ||
95 | |||
96 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | ||
97 | m_scene = null; | ||
98 | } | ||
99 | |||
100 | public void RegionLoaded(Scene s) | ||
101 | { | ||
102 | if (!m_Enabled) | ||
103 | return; | ||
104 | |||
105 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | ||
106 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
107 | } | ||
108 | |||
109 | public void PostInitialise() | ||
110 | { | ||
111 | } | ||
112 | |||
113 | public void Close() { } | ||
114 | |||
115 | public string Name { get { return "GetTextureModule"; } } | ||
116 | |||
117 | public Type ReplaceableInterface | ||
118 | { | ||
119 | get { return null; } | ||
120 | } | ||
121 | |||
122 | #endregion | ||
123 | |||
124 | public void RegisterCaps(UUID agentID, Caps caps) | ||
125 | { | ||
126 | UUID capID = UUID.Random(); | ||
127 | |||
128 | //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); | ||
129 | if (m_URL == "localhost") | ||
130 | { | ||
131 | m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | ||
132 | caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService)); | ||
133 | } | ||
134 | else | ||
135 | { | ||
136 | m_log.InfoFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); | ||
137 | caps.RegisterHandler("GetTexture", m_URL); | ||
138 | } | ||
139 | } | ||
140 | |||
141 | } | ||
142 | } | ||
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/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs new file mode 100644 index 0000000..94629a2 --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | |||
@@ -0,0 +1,134 @@ | |||
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.Reflection; | ||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using Mono.Addins; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Region.Framework.Interfaces; | ||
38 | using OpenSim.Region.Framework.Scenes; | ||
39 | using OpenSim.Services.Interfaces; | ||
40 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
41 | using OpenSim.Capabilities.Handlers; | ||
42 | |||
43 | namespace OpenSim.Region.ClientStack.Linden | ||
44 | { | ||
45 | |||
46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | ||
47 | public class WebFetchInvDescModule : INonSharedRegionModule | ||
48 | { | ||
49 | private static readonly ILog m_log = | ||
50 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
51 | private Scene m_scene; | ||
52 | |||
53 | private IInventoryService m_InventoryService; | ||
54 | private ILibraryService m_LibraryService; | ||
55 | private bool m_Enabled = false; | ||
56 | private string m_URL; | ||
57 | |||
58 | #region ISharedRegionModule Members | ||
59 | |||
60 | public void Initialise(IConfigSource source) | ||
61 | { | ||
62 | IConfig config = source.Configs["ClientStack.LindenCaps"]; | ||
63 | if (config == null) | ||
64 | return; | ||
65 | |||
66 | m_URL = config.GetString("Cap_WebFetchInventoryDescendents", string.Empty); | ||
67 | // Cap doesn't exist | ||
68 | if (m_URL != string.Empty) | ||
69 | m_Enabled = true; | ||
70 | } | ||
71 | |||
72 | public void AddRegion(Scene s) | ||
73 | { | ||
74 | if (!m_Enabled) | ||
75 | return; | ||
76 | |||
77 | m_scene = s; | ||
78 | } | ||
79 | |||
80 | public void RemoveRegion(Scene s) | ||
81 | { | ||
82 | if (!m_Enabled) | ||
83 | return; | ||
84 | |||
85 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | ||
86 | m_scene = null; | ||
87 | } | ||
88 | |||
89 | public void RegionLoaded(Scene s) | ||
90 | { | ||
91 | if (!m_Enabled) | ||
92 | return; | ||
93 | |||
94 | m_InventoryService = m_scene.InventoryService; ; | ||
95 | m_LibraryService = m_scene.LibraryService; | ||
96 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
97 | } | ||
98 | |||
99 | public void PostInitialise() | ||
100 | { | ||
101 | } | ||
102 | |||
103 | public void Close() { } | ||
104 | |||
105 | public string Name { get { return "WebFetchInvDescModule"; } } | ||
106 | |||
107 | public Type ReplaceableInterface | ||
108 | { | ||
109 | get { return null; } | ||
110 | } | ||
111 | |||
112 | #endregion | ||
113 | |||
114 | public void RegisterCaps(UUID agentID, Caps caps) | ||
115 | { | ||
116 | UUID capID = UUID.Random(); | ||
117 | |||
118 | //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); | ||
119 | if (m_URL == "localhost") | ||
120 | { | ||
121 | m_log.InfoFormat("[WEBFETCHINVENTORYDESCENDANTS]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | ||
122 | WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); | ||
123 | IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), webFetchHandler.FetchInventoryDescendentsRequest); | ||
124 | caps.RegisterHandler("WebFetchInventoryDescendents", reqHandler); | ||
125 | } | ||
126 | else | ||
127 | { | ||
128 | m_log.InfoFormat("[WEBFETCHINVENTORYDESCENDANTS]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); | ||
129 | caps.RegisterHandler("WebFetchInventoryDescendents", m_URL); | ||
130 | } | ||
131 | } | ||
132 | |||
133 | } | ||
134 | } | ||
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 9dd6663..9dd6663 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 910fb76..910fb76 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 95a8e23..95a8e23 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 ab6674d..ab6674d 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 d2779ba..d2779ba 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 7526bd2..b823fec 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,7 +95,7 @@ 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 | int flags = m_scene.GetUserFlags(agentId); | 100 | int flags = m_scene.GetUserFlags(agentId); |
99 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) | 101 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) |
@@ -101,12 +103,12 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
101 | 103 | ||
102 | String capsObjectPath = GetCapsPath(agentId); | 104 | String capsObjectPath = GetCapsPath(agentId); |
103 | 105 | ||
104 | if (m_capsHandlers.ContainsKey(agentId)) | 106 | if (m_capsObjects.ContainsKey(agentId)) |
105 | { | 107 | { |
106 | Caps oldCaps = m_capsHandlers[agentId]; | 108 | Caps oldCaps = m_capsObjects[agentId]; |
107 | 109 | ||
108 | m_log.DebugFormat( | 110 | m_log.DebugFormat( |
109 | "[CAPS]: Reregistering caps for agent {0}. Old caps path {1}, new caps path {2}. ", | 111 | "[CAPS]: Recreating caps for agent {0}. Old caps path {1}, new caps path {2}. ", |
110 | agentId, oldCaps.CapsObjectPath, capsObjectPath); | 112 | agentId, oldCaps.CapsObjectPath, capsObjectPath); |
111 | // This should not happen. The caller code is confused. We need to fix that. | 113 | // This should not happen. The caller code is confused. We need to fix that. |
112 | // CAPs can never be reregistered, or the client will be confused. | 114 | // CAPs can never be reregistered, or the client will be confused. |
@@ -114,39 +116,29 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
114 | //return; | 116 | //return; |
115 | } | 117 | } |
116 | 118 | ||
117 | Caps caps | 119 | Caps caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName, |
118 | = new Caps(m_scene, | ||
119 | m_scene.AssetService, MainServer.Instance, m_scene.RegionInfo.ExternalHostName, | ||
120 | (MainServer.Instance == null) ? 0: MainServer.Instance.Port, | 120 | (MainServer.Instance == null) ? 0: MainServer.Instance.Port, |
121 | capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName); | 121 | capsObjectPath, agentId, m_scene.RegionInfo.RegionName); |
122 | 122 | ||
123 | caps.RegisterHandlers(); | 123 | m_capsObjects[agentId] = caps; |
124 | 124 | ||
125 | m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); | 125 | m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); |
126 | |||
127 | caps.AddNewInventoryItem = m_scene.AddUploadedInventoryItem; | ||
128 | caps.ItemUpdatedCall = m_scene.CapsUpdateInventoryItemAsset; | ||
129 | caps.TaskScriptUpdatedCall = m_scene.CapsUpdateTaskInventoryScriptAsset; | ||
130 | caps.CAPSFetchInventoryDescendents = m_scene.HandleFetchInventoryDescendentsCAPS; | ||
131 | caps.GetClient = m_scene.SceneContents.GetControllingClient; | ||
132 | |||
133 | m_capsHandlers[agentId] = caps; | ||
134 | } | 126 | } |
135 | 127 | ||
136 | public void RemoveCapsHandler(UUID agentId) | 128 | public void RemoveCaps(UUID agentId) |
137 | { | 129 | { |
138 | if (childrenSeeds.ContainsKey(agentId)) | 130 | if (childrenSeeds.ContainsKey(agentId)) |
139 | { | 131 | { |
140 | childrenSeeds.Remove(agentId); | 132 | childrenSeeds.Remove(agentId); |
141 | } | 133 | } |
142 | 134 | ||
143 | lock (m_capsHandlers) | 135 | lock (m_capsObjects) |
144 | { | 136 | { |
145 | if (m_capsHandlers.ContainsKey(agentId)) | 137 | if (m_capsObjects.ContainsKey(agentId)) |
146 | { | 138 | { |
147 | m_capsHandlers[agentId].DeregisterHandlers(); | 139 | m_capsObjects[agentId].DeregisterHandlers(); |
148 | m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsHandlers[agentId]); | 140 | m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsObjects[agentId]); |
149 | m_capsHandlers.Remove(agentId); | 141 | m_capsObjects.Remove(agentId); |
150 | } | 142 | } |
151 | else | 143 | else |
152 | { | 144 | { |
@@ -157,20 +149,20 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
157 | } | 149 | } |
158 | } | 150 | } |
159 | 151 | ||
160 | public Caps GetCapsHandlerForUser(UUID agentId) | 152 | public Caps GetCapsForUser(UUID agentId) |
161 | { | 153 | { |
162 | lock (m_capsHandlers) | 154 | lock (m_capsObjects) |
163 | { | 155 | { |
164 | if (m_capsHandlers.ContainsKey(agentId)) | 156 | if (m_capsObjects.ContainsKey(agentId)) |
165 | { | 157 | { |
166 | return m_capsHandlers[agentId]; | 158 | return m_capsObjects[agentId]; |
167 | } | 159 | } |
168 | } | 160 | } |
169 | 161 | ||
170 | return null; | 162 | return null; |
171 | } | 163 | } |
172 | 164 | ||
173 | public void NewUserConnection(AgentCircuitData agent) | 165 | public void SetAgentCapsSeeds(AgentCircuitData agent) |
174 | { | 166 | { |
175 | capsPaths[agent.AgentID] = agent.CapsPath; | 167 | capsPaths[agent.AgentID] = agent.CapsPath; |
176 | childrenSeeds[agent.AgentID] | 168 | childrenSeeds[agent.AgentID] |
@@ -240,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
240 | System.Text.StringBuilder caps = new System.Text.StringBuilder(); | 232 | System.Text.StringBuilder caps = new System.Text.StringBuilder(); |
241 | caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); | 233 | caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); |
242 | 234 | ||
243 | foreach (KeyValuePair<UUID, Caps> kvp in m_capsHandlers) | 235 | foreach (KeyValuePair<UUID, Caps> kvp in m_capsObjects) |
244 | { | 236 | { |
245 | caps.AppendFormat("** User {0}:\n", kvp.Key); | 237 | caps.AppendFormat("** User {0}:\n", kvp.Key); |
246 | for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); ) | 238 | for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); ) |
@@ -248,6 +240,8 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
248 | Uri uri = new Uri(kvp2.Value.ToString()); | 240 | Uri uri = new Uri(kvp2.Value.ToString()); |
249 | caps.AppendFormat(" {0} = {1}\n", kvp2.Key, uri.PathAndQuery); | 241 | caps.AppendFormat(" {0} = {1}\n", kvp2.Key, uri.PathAndQuery); |
250 | } | 242 | } |
243 | foreach (KeyValuePair<string, string> kvp3 in kvp.Value.ExternalCapsHandlers) | ||
244 | caps.AppendFormat(" {0} = {1}\n", kvp3.Key, kvp3.Value); | ||
251 | } | 245 | } |
252 | 246 | ||
253 | MainConsole.Instance.Output(caps.ToString()); | 247 | MainConsole.Instance.Output(caps.ToString()); |
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..8a6735f 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -17,7 +17,6 @@ | |||
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" /> | ||
21 | <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" /> | 20 | <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" /> |
22 | <RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" /> | 21 | <RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" /> |
23 | <RegionModule id="Warp3DImageModule" type="OpenSim.Region.CoreModules.World.Warp3DMap.Warp3DImageModule" /> | 22 | <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 bbf36f1..758a2eb 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3151,7 +3151,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3151 | m_sceneGraph.removeUserCount(!childagentYN); | 3151 | m_sceneGraph.removeUserCount(!childagentYN); |
3152 | 3152 | ||
3153 | if (CapsModule != null) | 3153 | if (CapsModule != null) |
3154 | CapsModule.RemoveCapsHandler(agentID); | 3154 | CapsModule.RemoveCaps(agentID); |
3155 | 3155 | ||
3156 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever | 3156 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever |
3157 | // this method is doing is HORRIBLE!!! | 3157 | // this method is doing is HORRIBLE!!! |
@@ -3431,8 +3431,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3431 | 3431 | ||
3432 | if (CapsModule != null) | 3432 | if (CapsModule != null) |
3433 | { | 3433 | { |
3434 | CapsModule.NewUserConnection(agent); | 3434 | CapsModule.SetAgentCapsSeeds(agent); |
3435 | CapsModule.AddCapsHandler(agent.AgentID); | 3435 | CapsModule.CreateCaps(agent.AgentID); |
3436 | } | 3436 | } |
3437 | } | 3437 | } |
3438 | else | 3438 | else |
@@ -3450,7 +3450,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3450 | sp.AdjustKnownSeeds(); | 3450 | sp.AdjustKnownSeeds(); |
3451 | 3451 | ||
3452 | if (CapsModule != null) | 3452 | if (CapsModule != null) |
3453 | CapsModule.NewUserConnection(agent); | 3453 | CapsModule.SetAgentCapsSeeds(agent); |
3454 | } | 3454 | } |
3455 | } | 3455 | } |
3456 | 3456 | ||
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 6bdd4c8..9a78a42 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -42,7 +42,6 @@ using log4net; | |||
42 | using Nini.Config; | 42 | using Nini.Config; |
43 | using Amib.Threading; | 43 | using Amib.Threading; |
44 | using OpenSim.Framework; | 44 | using OpenSim.Framework; |
45 | using OpenSim.Region.CoreModules.Framework.EventQueue; | ||
46 | using OpenSim.Region.Framework.Scenes; | 45 | using OpenSim.Region.Framework.Scenes; |
47 | using OpenSim.Region.Framework.Interfaces; | 46 | using OpenSim.Region.Framework.Interfaces; |
48 | using OpenSim.Region.ScriptEngine.Shared; | 47 | using OpenSim.Region.ScriptEngine.Shared; |
@@ -1362,7 +1361,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1362 | } | 1361 | } |
1363 | else | 1362 | else |
1364 | { | 1363 | { |
1365 | eq.Enqueue(EventQueueHelper.ScriptRunningReplyEvent(objectID, itemID, GetScriptState(itemID), true), | 1364 | eq.Enqueue(eq.ScriptRunningEvent(objectID, itemID, GetScriptState(itemID), true), |
1366 | controllingClient.AgentId); | 1365 | controllingClient.AgentId); |
1367 | } | 1366 | } |
1368 | } | 1367 | } |
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 2ffcaf7..f8868f5 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 250f8f1..ffed15e 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; |