diff options
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs | 152 |
2 files changed, 160 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 95713e9..d52ebda 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -439,7 +439,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
439 | } | 439 | } |
440 | 440 | ||
441 | /// <summary> | 441 | /// <summary> |
442 | /// | 442 | /// Convert raw uploaded data into the appropriate asset and item. |
443 | /// </summary> | 443 | /// </summary> |
444 | /// <param name="assetID"></param> | 444 | /// <param name="assetID"></param> |
445 | /// <param name="inventoryItem"></param> | 445 | /// <param name="inventoryItem"></param> |
@@ -506,8 +506,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
509 | |||
510 | |||
511 | /// <summary> | 509 | /// <summary> |
512 | /// | 510 | /// |
513 | /// </summary> | 511 | /// </summary> |
@@ -632,7 +630,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
632 | } | 630 | } |
633 | 631 | ||
634 | /// <summary> | 632 | /// <summary> |
635 | /// | 633 | /// Handle raw asset upload data via the capability. |
636 | /// </summary> | 634 | /// </summary> |
637 | /// <param name="data"></param> | 635 | /// <param name="data"></param> |
638 | /// <param name="path"></param> | 636 | /// <param name="path"></param> |
@@ -670,6 +668,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
670 | 668 | ||
671 | return res; | 669 | return res; |
672 | } | 670 | } |
671 | |||
673 | ///Left this in and commented in case there are unforseen issues | 672 | ///Left this in and commented in case there are unforseen issues |
674 | //private void SaveAssetToFile(string filename, byte[] data) | 673 | //private void SaveAssetToFile(string filename, byte[] data) |
675 | //{ | 674 | //{ |
@@ -679,6 +678,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
679 | // bw.Close(); | 678 | // bw.Close(); |
680 | // fs.Close(); | 679 | // fs.Close(); |
681 | //} | 680 | //} |
681 | |||
682 | private static void SaveAssetToFile(string filename, byte[] data) | 682 | private static void SaveAssetToFile(string filename, byte[] data) |
683 | { | 683 | { |
684 | string assetPath = "UserAssets"; | 684 | string assetPath = "UserAssets"; |
@@ -719,7 +719,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
719 | } | 719 | } |
720 | 720 | ||
721 | /// <summary> | 721 | /// <summary> |
722 | /// | 722 | /// Handle raw uploaded asset data. |
723 | /// </summary> | 723 | /// </summary> |
724 | /// <param name="data"></param> | 724 | /// <param name="data"></param> |
725 | /// <param name="path"></param> | 725 | /// <param name="path"></param> |
@@ -752,6 +752,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
752 | 752 | ||
753 | return res; | 753 | return res; |
754 | } | 754 | } |
755 | |||
755 | ///Left this in and commented in case there are unforseen issues | 756 | ///Left this in and commented in case there are unforseen issues |
756 | //private void SaveAssetToFile(string filename, byte[] data) | 757 | //private void SaveAssetToFile(string filename, byte[] data) |
757 | //{ | 758 | //{ |
@@ -761,6 +762,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
761 | // bw.Close(); | 762 | // bw.Close(); |
762 | // fs.Close(); | 763 | // fs.Close(); |
763 | //} | 764 | //} |
765 | |||
764 | private static void SaveAssetToFile(string filename, byte[] data) | 766 | private static void SaveAssetToFile(string filename, byte[] data) |
765 | { | 767 | { |
766 | string assetPath = "UserAssets"; | 768 | string assetPath = "UserAssets"; |
@@ -905,7 +907,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
905 | } | 907 | } |
906 | 908 | ||
907 | /// <summary> | 909 | /// <summary> |
908 | /// | 910 | /// Handle raw uploaded baked texture data. |
909 | /// </summary> | 911 | /// </summary> |
910 | /// <param name="data"></param> | 912 | /// <param name="data"></param> |
911 | /// <param name="path"></param> | 913 | /// <param name="path"></param> |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs new file mode 100644 index 0000000..9f78948 --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs | |||
@@ -0,0 +1,152 @@ | |||
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 OpenMetaverse.StructuredData; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Servers.HttpServer; | ||
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | using OpenSim.Services.Interfaces; | ||
41 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
42 | |||
43 | namespace OpenSim.Region.ClientStack.Linden | ||
44 | { | ||
45 | /// <summary> | ||
46 | /// SimulatorFeatures capability. This is required for uploading Mesh. | ||
47 | /// Since is accepts an open-ended response, we also send more information | ||
48 | /// for viewers that care to interpret it. | ||
49 | /// | ||
50 | /// NOTE: Part of this code was adapted from the Aurora project, specifically | ||
51 | /// the normal part of the response in the capability handler. | ||
52 | /// </summary> | ||
53 | /// | ||
54 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | ||
55 | public class SimulatorFeaturesModule : ISharedRegionModule | ||
56 | { | ||
57 | private static readonly ILog m_log = | ||
58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
59 | private Scene m_scene; | ||
60 | |||
61 | private string m_MapImageServerURL = string.Empty; | ||
62 | private string m_SearchURL = string.Empty; | ||
63 | |||
64 | #region ISharedRegionModule Members | ||
65 | |||
66 | public void Initialise(IConfigSource source) | ||
67 | { | ||
68 | IConfig config = source.Configs["SimulatorFeatures"]; | ||
69 | if (config == null) | ||
70 | return; | ||
71 | |||
72 | m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty); | ||
73 | if (m_MapImageServerURL != string.Empty) | ||
74 | { | ||
75 | m_MapImageServerURL = m_MapImageServerURL.Trim(); | ||
76 | if (!m_MapImageServerURL.EndsWith("/")) | ||
77 | m_MapImageServerURL = m_MapImageServerURL + "/"; | ||
78 | } | ||
79 | |||
80 | m_SearchURL = config.GetString("SearchServerURI", string.Empty); | ||
81 | } | ||
82 | |||
83 | public void AddRegion(Scene s) | ||
84 | { | ||
85 | m_scene = s; | ||
86 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
87 | } | ||
88 | |||
89 | public void RemoveRegion(Scene s) | ||
90 | { | ||
91 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | ||
92 | } | ||
93 | |||
94 | public void RegionLoaded(Scene s) | ||
95 | { | ||
96 | } | ||
97 | |||
98 | public void PostInitialise() | ||
99 | { | ||
100 | } | ||
101 | |||
102 | public void Close() { } | ||
103 | |||
104 | public string Name { get { return "SimulatorFeaturesModule"; } } | ||
105 | |||
106 | public Type ReplaceableInterface | ||
107 | { | ||
108 | get { return null; } | ||
109 | } | ||
110 | |||
111 | #endregion | ||
112 | |||
113 | public void RegisterCaps(UUID agentID, Caps caps) | ||
114 | { | ||
115 | IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), SimulatorFeatures); | ||
116 | caps.RegisterHandler("SimulatorFeatures", reqHandler); | ||
117 | } | ||
118 | |||
119 | private Hashtable SimulatorFeatures(Hashtable mDhttpMethod) | ||
120 | { | ||
121 | m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); | ||
122 | OSDMap data = new OSDMap(); | ||
123 | data["MeshRezEnabled"] = true; | ||
124 | data["MeshUploadEnabled"] = true; | ||
125 | data["MeshXferEnabled"] = true; | ||
126 | data["PhysicsMaterialsEnabled"] = true; | ||
127 | |||
128 | OSDMap typesMap = new OSDMap(); | ||
129 | typesMap["convex"] = true; | ||
130 | typesMap["none"] = true; | ||
131 | typesMap["prim"] = true; | ||
132 | data["PhysicsShapeTypes"] = typesMap; | ||
133 | |||
134 | // Extra information for viewers that want to use it | ||
135 | OSDMap gridServicesMap = new OSDMap(); | ||
136 | if (m_MapImageServerURL != string.Empty) | ||
137 | gridServicesMap["map-server-url"] = m_MapImageServerURL; | ||
138 | if (m_SearchURL != string.Empty) | ||
139 | gridServicesMap["search"] = m_SearchURL; | ||
140 | data["GridServices"] = gridServicesMap; | ||
141 | |||
142 | //Send back data | ||
143 | Hashtable responsedata = new Hashtable(); | ||
144 | responsedata["int_response_code"] = 200; | ||
145 | responsedata["content_type"] = "text/plain"; | ||
146 | responsedata["keepalive"] = false; | ||
147 | responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data); | ||
148 | return responsedata; | ||
149 | } | ||
150 | |||
151 | } | ||
152 | } | ||