diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/CapabilitiesModule.cs (renamed from OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs) | 4 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs (renamed from OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs) | 14 | ||||
-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 (renamed from OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs) | 2 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 97 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs (renamed from OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs) | 2 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs (renamed from OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs) | 2 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs (renamed from OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs) | 2 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/IncomingPacket.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/IncomingPacketHistoryCollection.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/IncomingPacketHistoryCollection.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/OutgoingPacket.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLPacketServer.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs | 402 | ||||
-rw-r--r-- | OpenSim/Region/DataSnapshot/DataRequestHandler.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IEventQueue.cs | 2 | ||||
-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 |
32 files changed, 132 insertions, 428 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/CapabilitiesModule.cs index 1d8e70e..b136555 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/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.ClientStack.Linden |
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); |
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 05fe3ee..4827baa 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); |
@@ -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/CoreModules/Avatar/Assets/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index fc1ddef..1d57143 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | |||
@@ -44,7 +44,7 @@ using OpenSim.Region.Framework.Scenes; | |||
44 | using OpenSim.Services.Interfaces; | 44 | using OpenSim.Services.Interfaces; |
45 | using Caps = OpenSim.Framework.Capabilities.Caps; | 45 | using Caps = OpenSim.Framework.Capabilities.Caps; |
46 | 46 | ||
47 | namespace OpenSim.Region.CoreModules.Avatar.Assets | 47 | namespace OpenSim.Region.ClientStack.Linden |
48 | { | 48 | { |
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
50 | public class GetMeshModule : INonSharedRegionModule | 50 | public class GetMeshModule : INonSharedRegionModule |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs new file mode 100644 index 0000000..341240d --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -0,0 +1,97 @@ | |||
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 : IRegionModule | ||
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 | public const string DefaultFormat = "x-j2c"; | ||
63 | |||
64 | // TODO: Change this to a config option | ||
65 | const string REDIRECT_URL = null; | ||
66 | |||
67 | |||
68 | #region IRegionModule Members | ||
69 | |||
70 | public void Initialise(Scene pScene, IConfigSource pSource) | ||
71 | { | ||
72 | m_scene = pScene; | ||
73 | } | ||
74 | |||
75 | public void PostInitialise() | ||
76 | { | ||
77 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | ||
78 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
79 | } | ||
80 | |||
81 | public void Close() { } | ||
82 | |||
83 | public string Name { get { return "GetTextureModule"; } } | ||
84 | public bool IsSharedModule { get { return false; } } | ||
85 | |||
86 | public void RegisterCaps(UUID agentID, Caps caps) | ||
87 | { | ||
88 | UUID capID = UUID.Random(); | ||
89 | |||
90 | // m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | ||
91 | //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); | ||
92 | caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService)); | ||
93 | } | ||
94 | |||
95 | #endregion | ||
96 | } | ||
97 | } | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs index 3d4c7b7..eddc288 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 |
diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs index a0d72ed..15139a3 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs | |||
@@ -39,7 +39,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
39 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using Caps=OpenSim.Framework.Capabilities.Caps; | 40 | using Caps=OpenSim.Framework.Capabilities.Caps; |
41 | 41 | ||
42 | namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps | 42 | namespace OpenSim.Region.ClientStack.Linden |
43 | { | 43 | { |
44 | public class ObjectAdd : IRegionModule | 44 | public class ObjectAdd : IRegionModule |
45 | { | 45 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs index 3114d7f..3809f84 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs | |||
@@ -49,7 +49,7 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap; | |||
49 | using OpenSim.Framework.Capabilities; | 49 | using OpenSim.Framework.Capabilities; |
50 | using ExtraParamType = OpenMetaverse.ExtraParamType; | 50 | using ExtraParamType = OpenMetaverse.ExtraParamType; |
51 | 51 | ||
52 | namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps | 52 | namespace OpenSim.Region.ClientStack.Linden |
53 | { | 53 | { |
54 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 54 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
55 | public class UploadObjectAssetModule : INonSharedRegionModule | 55 | public class UploadObjectAssetModule : INonSharedRegionModule |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/IncomingPacket.cs b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs index 90b3ede..90b3ede 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/IncomingPacket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/IncomingPacketHistoryCollection.cs b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacketHistoryCollection.cs index 1f73a1d..1f73a1d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/IncomingPacketHistoryCollection.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacketHistoryCollection.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index e9e2dca..e9e2dca 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 43903ce..43903ce 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index 9e0db12..9e0db12 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index ca5501d..ca5501d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index aff90c5..aff90c5 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 6eebd9d..6eebd9d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs b/OpenSim/Region/ClientStack/Linden/UDP/OutgoingPacket.cs index 76c6c14..76c6c14 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OutgoingPacket.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs index daab84f..daab84f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs index 34c21aa..34c21aa 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs index 7d0757f..7d0757f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLPacketServer.cs index e995d65..e995d65 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLPacketServer.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs index f98586d..f98586d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs index c9aac0b..c9aac0b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 29fd1a4..29fd1a4 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | |||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs index 793aefe..793aefe 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs | |||
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs deleted file mode 100644 index df4d561..0000000 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs +++ /dev/null | |||
@@ -1,402 +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.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 OpenMetaverse; | ||
39 | using OpenMetaverse.StructuredData; | ||
40 | using OpenMetaverse.Imaging; | ||
41 | using OpenSim.Framework; | ||
42 | using OpenSim.Framework.Servers; | ||
43 | using OpenSim.Framework.Servers.HttpServer; | ||
44 | using OpenSim.Region.Framework.Interfaces; | ||
45 | using OpenSim.Region.Framework.Scenes; | ||
46 | using OpenSim.Services.Interfaces; | ||
47 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
48 | |||
49 | namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps | ||
50 | { | ||
51 | #region Stream Handler | ||
52 | |||
53 | public delegate byte[] StreamHandlerCallback(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse); | ||
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 | { | ||
75 | private static readonly ILog m_log = | ||
76 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
77 | private Scene m_scene; | ||
78 | private IAssetService m_assetService; | ||
79 | |||
80 | public const string DefaultFormat = "x-j2c"; | ||
81 | |||
82 | // TODO: Change this to a config option | ||
83 | const string REDIRECT_URL = null; | ||
84 | |||
85 | |||
86 | #region IRegionModule Members | ||
87 | |||
88 | public void Initialise(Scene pScene, IConfigSource pSource) | ||
89 | { | ||
90 | m_scene = pScene; | ||
91 | } | ||
92 | |||
93 | public void PostInitialise() | ||
94 | { | ||
95 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | ||
96 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
97 | } | ||
98 | |||
99 | public void Close() { } | ||
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 | { | ||
116 | //m_log.DebugFormat("[GETTEXTURE]: called in {0}", m_scene.RegionInfo.RegionName); | ||
117 | |||
118 | // Try to parse the texture ID from the request URL | ||
119 | NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); | ||
120 | string textureStr = query.GetOne("texture_id"); | ||
121 | string format = query.GetOne("format"); | ||
122 | |||
123 | if (m_assetService == null) | ||
124 | { | ||
125 | m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service"); | ||
126 | httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; | ||
127 | return null; | ||
128 | } | ||
129 | |||
130 | UUID textureID; | ||
131 | if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID)) | ||
132 | { | ||
133 | string[] formats; | ||
134 | if (format != null && format != string.Empty) | ||
135 | { | ||
136 | formats = new string[1] { format.ToLower() }; | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | formats = WebUtil.GetPreferredImageTypes(httpRequest.Headers.Get("Accept")); | ||
141 | if (formats.Length == 0) | ||
142 | formats = new string[1] { DefaultFormat }; // default | ||
143 | |||
144 | } | ||
145 | // OK, we have an array with preferred formats, possibly with only one entry | ||
146 | |||
147 | httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; | ||
148 | foreach (string f in formats) | ||
149 | { | ||
150 | if (FetchTexture(httpRequest, httpResponse, textureID, f)) | ||
151 | break; | ||
152 | } | ||
153 | |||
154 | } | ||
155 | else | ||
156 | { | ||
157 | m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url); | ||
158 | } | ||
159 | |||
160 | httpResponse.Send(); | ||
161 | return null; | ||
162 | } | ||
163 | |||
164 | /// <summary> | ||
165 | /// | ||
166 | /// </summary> | ||
167 | /// <param name="httpRequest"></param> | ||
168 | /// <param name="httpResponse"></param> | ||
169 | /// <param name="textureID"></param> | ||
170 | /// <param name="format"></param> | ||
171 | /// <returns>False for "caller try another codec"; true otherwise</returns> | ||
172 | private bool FetchTexture(OSHttpRequest httpRequest, OSHttpResponse httpResponse, UUID textureID, string format) | ||
173 | { | ||
174 | // m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format); | ||
175 | AssetBase texture; | ||
176 | |||
177 | string fullID = textureID.ToString(); | ||
178 | if (format != DefaultFormat) | ||
179 | fullID = fullID + "-" + format; | ||
180 | |||
181 | if (!String.IsNullOrEmpty(REDIRECT_URL)) | ||
182 | { | ||
183 | // Only try to fetch locally cached textures. Misses are redirected | ||
184 | texture = m_assetService.GetCached(fullID); | ||
185 | |||
186 | if (texture != null) | ||
187 | { | ||
188 | if (texture.Type != (sbyte)AssetType.Texture) | ||
189 | { | ||
190 | httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; | ||
191 | return true; | ||
192 | } | ||
193 | WriteTextureData(httpRequest, httpResponse, texture, format); | ||
194 | } | ||
195 | else | ||
196 | { | ||
197 | string textureUrl = REDIRECT_URL + textureID.ToString(); | ||
198 | m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl); | ||
199 | httpResponse.RedirectLocation = textureUrl; | ||
200 | return true; | ||
201 | } | ||
202 | } | ||
203 | else // no redirect | ||
204 | { | ||
205 | // try the cache | ||
206 | texture = m_assetService.GetCached(fullID); | ||
207 | |||
208 | if (texture == null) | ||
209 | { | ||
210 | //m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache"); | ||
211 | |||
212 | // Fetch locally or remotely. Misses return a 404 | ||
213 | texture = m_assetService.Get(textureID.ToString()); | ||
214 | |||
215 | if (texture != null) | ||
216 | { | ||
217 | if (texture.Type != (sbyte)AssetType.Texture) | ||
218 | { | ||
219 | httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; | ||
220 | return true; | ||
221 | } | ||
222 | if (format == DefaultFormat) | ||
223 | { | ||
224 | WriteTextureData(httpRequest, httpResponse, texture, format); | ||
225 | return true; | ||
226 | } | ||
227 | else | ||
228 | { | ||
229 | AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID); | ||
230 | newTexture.Data = ConvertTextureData(texture, format); | ||
231 | if (newTexture.Data.Length == 0) | ||
232 | return false; // !!! Caller try another codec, please! | ||
233 | |||
234 | newTexture.Flags = AssetFlags.Collectable; | ||
235 | newTexture.Temporary = true; | ||
236 | m_assetService.Store(newTexture); | ||
237 | WriteTextureData(httpRequest, httpResponse, newTexture, format); | ||
238 | return true; | ||
239 | } | ||
240 | } | ||
241 | } | ||
242 | else // it was on the cache | ||
243 | { | ||
244 | //m_log.DebugFormat("[GETTEXTURE]: texture was in the cache"); | ||
245 | WriteTextureData(httpRequest, httpResponse, texture, format); | ||
246 | return true; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | // not found | ||
251 | // m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); | ||
252 | httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; | ||
253 | return true; | ||
254 | } | ||
255 | |||
256 | private void WriteTextureData(OSHttpRequest request, OSHttpResponse response, AssetBase texture, string format) | ||
257 | { | ||
258 | string range = request.Headers.GetOne("Range"); | ||
259 | //m_log.DebugFormat("[GETTEXTURE]: Range {0}", range); | ||
260 | if (!String.IsNullOrEmpty(range)) // JP2's only | ||
261 | { | ||
262 | // Range request | ||
263 | int start, end; | ||
264 | if (TryParseRange(range, out start, out end)) | ||
265 | { | ||
266 | // Before clamping start make sure we can satisfy it in order to avoid | ||
267 | // sending back the last byte instead of an error status | ||
268 | if (start >= texture.Data.Length) | ||
269 | { | ||
270 | response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable; | ||
271 | return; | ||
272 | } | ||
273 | |||
274 | end = Utils.Clamp(end, 0, texture.Data.Length - 1); | ||
275 | start = Utils.Clamp(start, 0, end); | ||
276 | int len = end - start + 1; | ||
277 | |||
278 | //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); | ||
279 | |||
280 | if (len < texture.Data.Length) | ||
281 | response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent; | ||
282 | |||
283 | response.ContentLength = len; | ||
284 | response.ContentType = texture.Metadata.ContentType; | ||
285 | response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length)); | ||
286 | |||
287 | response.Body.Write(texture.Data, start, len); | ||
288 | } | ||
289 | else | ||
290 | { | ||
291 | m_log.Warn("[GETTEXTURE]: Malformed Range header: " + range); | ||
292 | response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest; | ||
293 | } | ||
294 | } | ||
295 | else // JP2's or other formats | ||
296 | { | ||
297 | // Full content request | ||
298 | response.StatusCode = (int)System.Net.HttpStatusCode.OK; | ||
299 | response.ContentLength = texture.Data.Length; | ||
300 | if (format == DefaultFormat) | ||
301 | response.ContentType = texture.Metadata.ContentType; | ||
302 | else | ||
303 | response.ContentType = "image/" + format; | ||
304 | response.Body.Write(texture.Data, 0, texture.Data.Length); | ||
305 | } | ||
306 | } | ||
307 | |||
308 | private bool TryParseRange(string header, out int start, out int end) | ||
309 | { | ||
310 | if (header.StartsWith("bytes=")) | ||
311 | { | ||
312 | string[] rangeValues = header.Substring(6).Split('-'); | ||
313 | if (rangeValues.Length == 2) | ||
314 | { | ||
315 | if (Int32.TryParse(rangeValues[0], out start) && Int32.TryParse(rangeValues[1], out end)) | ||
316 | return true; | ||
317 | } | ||
318 | } | ||
319 | |||
320 | start = end = 0; | ||
321 | return false; | ||
322 | } | ||
323 | |||
324 | |||
325 | private byte[] ConvertTextureData(AssetBase texture, string format) | ||
326 | { | ||
327 | m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format); | ||
328 | byte[] data = new byte[0]; | ||
329 | |||
330 | MemoryStream imgstream = new MemoryStream(); | ||
331 | Bitmap mTexture = new Bitmap(1, 1); | ||
332 | ManagedImage managedImage; | ||
333 | Image image = (Image)mTexture; | ||
334 | |||
335 | try | ||
336 | { | ||
337 | // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data | ||
338 | |||
339 | imgstream = new MemoryStream(); | ||
340 | |||
341 | // Decode image to System.Drawing.Image | ||
342 | if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image)) | ||
343 | { | ||
344 | // Save to bitmap | ||
345 | mTexture = new Bitmap(image); | ||
346 | |||
347 | EncoderParameters myEncoderParameters = new EncoderParameters(); | ||
348 | myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, 95L); | ||
349 | |||
350 | // Save bitmap to stream | ||
351 | ImageCodecInfo codec = GetEncoderInfo("image/" + format); | ||
352 | if (codec != null) | ||
353 | { | ||
354 | mTexture.Save(imgstream, codec, myEncoderParameters); | ||
355 | // Write the stream to a byte array for output | ||
356 | data = imgstream.ToArray(); | ||
357 | } | ||
358 | else | ||
359 | m_log.WarnFormat("[GETTEXTURE]: No such codec {0}", format); | ||
360 | |||
361 | } | ||
362 | } | ||
363 | catch (Exception e) | ||
364 | { | ||
365 | m_log.WarnFormat("[GETTEXTURE]: Unable to convert texture {0} to {1}: {2}", texture.ID, format, e.Message); | ||
366 | } | ||
367 | finally | ||
368 | { | ||
369 | // Reclaim memory, these are unmanaged resources | ||
370 | // If we encountered an exception, one or more of these will be null | ||
371 | if (mTexture != null) | ||
372 | mTexture.Dispose(); | ||
373 | |||
374 | if (image != null) | ||
375 | image.Dispose(); | ||
376 | |||
377 | if (imgstream != null) | ||
378 | { | ||
379 | imgstream.Close(); | ||
380 | imgstream.Dispose(); | ||
381 | } | ||
382 | } | ||
383 | |||
384 | return data; | ||
385 | } | ||
386 | |||
387 | // From msdn | ||
388 | private static ImageCodecInfo GetEncoderInfo(String mimeType) | ||
389 | { | ||
390 | ImageCodecInfo[] encoders; | ||
391 | encoders = ImageCodecInfo.GetImageEncoders(); | ||
392 | for (int j = 0; j < encoders.Length; ++j) | ||
393 | { | ||
394 | if (encoders[j].MimeType == mimeType) | ||
395 | return encoders[j]; | ||
396 | } | ||
397 | return null; | ||
398 | } | ||
399 | |||
400 | |||
401 | } | ||
402 | } | ||
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/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/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 8c01d75..2bf8489 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs | |||
@@ -34,12 +34,9 @@ using Nini.Config; | |||
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenMetaverse.StructuredData; | 35 | using OpenMetaverse.StructuredData; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Region.CoreModules.Framework.EventQueue; | ||
38 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
40 | 39 | ||
41 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
42 | |||
43 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 40 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
44 | { | 41 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
@@ -472,7 +469,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
472 | 469 | ||
473 | if (queue != null) | 470 | if (queue != null) |
474 | { | 471 | { |
475 | queue.Enqueue(EventQueueHelper.buildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId); | 472 | queue.Enqueue(queue.BuildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId); |
476 | } | 473 | } |
477 | } | 474 | } |
478 | 475 | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index a8dec63..1c791b9 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -39,13 +39,11 @@ using OpenMetaverse.StructuredData; | |||
39 | 39 | ||
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.Communications; | 41 | using OpenSim.Framework.Communications; |
42 | using OpenSim.Region.CoreModules.Framework.EventQueue; | ||
43 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
44 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
45 | 44 | ||
46 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
47 | 46 | ||
48 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
49 | using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags; | 47 | using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags; |
50 | 48 | ||
51 | 49 | ||
@@ -1154,7 +1152,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1154 | 1152 | ||
1155 | if (queue != null) | 1153 | if (queue != null) |
1156 | { | 1154 | { |
1157 | queue.Enqueue(EventQueueHelper.buildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient)); | 1155 | queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient)); |
1158 | } | 1156 | } |
1159 | 1157 | ||
1160 | } | 1158 | } |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 8629674..97ab411 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -41,7 +41,6 @@ using log4net; | |||
41 | using Nini.Config; | 41 | using Nini.Config; |
42 | using Amib.Threading; | 42 | using Amib.Threading; |
43 | using OpenSim.Framework; | 43 | using OpenSim.Framework; |
44 | using OpenSim.Region.CoreModules.Framework.EventQueue; | ||
45 | using OpenSim.Region.Framework.Scenes; | 44 | using OpenSim.Region.Framework.Scenes; |
46 | using OpenSim.Region.Framework.Interfaces; | 45 | using OpenSim.Region.Framework.Interfaces; |
47 | using OpenSim.Region.ScriptEngine.Shared; | 46 | using OpenSim.Region.ScriptEngine.Shared; |
@@ -1283,7 +1282,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1283 | } | 1282 | } |
1284 | else | 1283 | else |
1285 | { | 1284 | { |
1286 | eq.Enqueue(EventQueueHelper.ScriptRunningReplyEvent(objectID, itemID, GetScriptState(itemID), true), | 1285 | eq.Enqueue(eq.ScriptRunningEvent(objectID, itemID, GetScriptState(itemID), true), |
1287 | controllingClient.AgentId); | 1286 | controllingClient.AgentId); |
1288 | } | 1287 | } |
1289 | } | 1288 | } |
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index a03cc4c..3139b8a 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs | |||
@@ -44,7 +44,6 @@ using OpenSim.Region.Framework.Interfaces; | |||
44 | using OpenSim.Region.Framework.Scenes; | 44 | using OpenSim.Region.Framework.Scenes; |
45 | using Mono.Data.SqliteClient; | 45 | using Mono.Data.SqliteClient; |
46 | 46 | ||
47 | |||
48 | using Caps = OpenSim.Framework.Capabilities.Caps; | 47 | using Caps = OpenSim.Framework.Capabilities.Caps; |
49 | 48 | ||
50 | using OSD = OpenMetaverse.StructuredData.OSD; | 49 | using OSD = OpenMetaverse.StructuredData.OSD; |