diff options
Diffstat (limited to '')
48 files changed, 1660 insertions, 224 deletions
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/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/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 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..025c6e6 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -5982,7 +5982,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5982 | AvatarWearingArgs wearingArgs = new AvatarWearingArgs(); | 5982 | AvatarWearingArgs wearingArgs = new AvatarWearingArgs(); |
5983 | for (int i = 0; i < nowWearing.WearableData.Length; i++) | 5983 | for (int i = 0; i < nowWearing.WearableData.Length; i++) |
5984 | { | 5984 | { |
5985 | m_log.DebugFormat("[XXX]: Wearable type {0} item {1}", nowWearing.WearableData[i].WearableType, nowWearing.WearableData[i].ItemID); | 5985 | //m_log.DebugFormat("[XXX]: Wearable type {0} item {1}", nowWearing.WearableData[i].WearableType, nowWearing.WearableData[i].ItemID); |
5986 | AvatarWearingArgs.Wearable wearable = | 5986 | AvatarWearingArgs.Wearable wearable = |
5987 | new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID, | 5987 | new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID, |
5988 | nowWearing.WearableData[i].WearableType); | 5988 | nowWearing.WearableData[i].WearableType); |
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/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index ea1317a..6e3a58e 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs | |||
@@ -96,6 +96,22 @@ namespace OpenSim.Region.ClientStack | |||
96 | 96 | ||
97 | MainServer.Instance = m_httpServer; | 97 | MainServer.Instance = m_httpServer; |
98 | 98 | ||
99 | // "OOB" Server | ||
100 | if (m_networkServersInfo.ssl_listener) | ||
101 | { | ||
102 | BaseHttpServer server = null; | ||
103 | server = new BaseHttpServer( | ||
104 | m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, | ||
105 | m_networkServersInfo.cert_pass); | ||
106 | // Add the server to m_Servers | ||
107 | if(server != null) | ||
108 | { | ||
109 | m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); | ||
110 | MainServer.AddHttpServer(server); | ||
111 | server.Start(); | ||
112 | } | ||
113 | } | ||
114 | |||
99 | base.StartupSpecific(); | 115 | base.StartupSpecific(); |
100 | } | 116 | } |
101 | 117 | ||
diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index 1d8e70e..111d808 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using Mono.Addins; | ||
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
@@ -38,8 +39,9 @@ using OpenSim.Region.Framework.Interfaces; | |||
38 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
39 | using Caps=OpenSim.Framework.Capabilities.Caps; | 40 | using Caps=OpenSim.Framework.Capabilities.Caps; |
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.Agent.Capabilities | 42 | namespace OpenSim.Region.CoreModules.Framework |
42 | { | 43 | { |
44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | ||
43 | public class CapabilitiesModule : INonSharedRegionModule, ICapabilitiesModule | 45 | public class CapabilitiesModule : INonSharedRegionModule, ICapabilitiesModule |
44 | { | 46 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -49,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
49 | /// <summary> | 51 | /// <summary> |
50 | /// Each agent has its own capabilities handler. | 52 | /// Each agent has its own capabilities handler. |
51 | /// </summary> | 53 | /// </summary> |
52 | protected Dictionary<UUID, Caps> m_capsHandlers = new Dictionary<UUID, Caps>(); | 54 | protected Dictionary<UUID, Caps> m_capsObjects = new Dictionary<UUID, Caps>(); |
53 | 55 | ||
54 | protected Dictionary<UUID, string> capsPaths = new Dictionary<UUID, string>(); | 56 | protected Dictionary<UUID, string> capsPaths = new Dictionary<UUID, string>(); |
55 | protected Dictionary<UUID, Dictionary<ulong, string>> childrenSeeds | 57 | protected Dictionary<UUID, Dictionary<ulong, string>> childrenSeeds |
@@ -93,19 +95,19 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
93 | get { return null; } | 95 | get { return null; } |
94 | } | 96 | } |
95 | 97 | ||
96 | public void AddCapsHandler(UUID agentId) | 98 | public void CreateCaps(UUID agentId) |
97 | { | 99 | { |
98 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId)) | 100 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId)) |
99 | return; | 101 | return; |
100 | 102 | ||
101 | String capsObjectPath = GetCapsPath(agentId); | 103 | String capsObjectPath = GetCapsPath(agentId); |
102 | 104 | ||
103 | if (m_capsHandlers.ContainsKey(agentId)) | 105 | if (m_capsObjects.ContainsKey(agentId)) |
104 | { | 106 | { |
105 | Caps oldCaps = m_capsHandlers[agentId]; | 107 | Caps oldCaps = m_capsObjects[agentId]; |
106 | 108 | ||
107 | m_log.DebugFormat( | 109 | m_log.DebugFormat( |
108 | "[CAPS]: Reregistering caps for agent {0}. Old caps path {1}, new caps path {2}. ", | 110 | "[CAPS]: Recreating caps for agent {0}. Old caps path {1}, new caps path {2}. ", |
109 | agentId, oldCaps.CapsObjectPath, capsObjectPath); | 111 | agentId, oldCaps.CapsObjectPath, capsObjectPath); |
110 | // This should not happen. The caller code is confused. We need to fix that. | 112 | // This should not happen. The caller code is confused. We need to fix that. |
111 | // CAPs can never be reregistered, or the client will be confused. | 113 | // CAPs can never be reregistered, or the client will be confused. |
@@ -113,39 +115,29 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
113 | //return; | 115 | //return; |
114 | } | 116 | } |
115 | 117 | ||
116 | Caps caps | 118 | Caps caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName, |
117 | = new Caps(m_scene, | ||
118 | m_scene.AssetService, MainServer.Instance, m_scene.RegionInfo.ExternalHostName, | ||
119 | (MainServer.Instance == null) ? 0: MainServer.Instance.Port, | 119 | (MainServer.Instance == null) ? 0: MainServer.Instance.Port, |
120 | capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName); | 120 | capsObjectPath, agentId, m_scene.RegionInfo.RegionName); |
121 | 121 | ||
122 | caps.RegisterHandlers(); | 122 | m_capsObjects[agentId] = caps; |
123 | 123 | ||
124 | m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); | 124 | m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); |
125 | |||
126 | caps.AddNewInventoryItem = m_scene.AddUploadedInventoryItem; | ||
127 | caps.ItemUpdatedCall = m_scene.CapsUpdateInventoryItemAsset; | ||
128 | caps.TaskScriptUpdatedCall = m_scene.CapsUpdateTaskInventoryScriptAsset; | ||
129 | caps.CAPSFetchInventoryDescendents = m_scene.HandleFetchInventoryDescendentsCAPS; | ||
130 | caps.GetClient = m_scene.SceneContents.GetControllingClient; | ||
131 | |||
132 | m_capsHandlers[agentId] = caps; | ||
133 | } | 125 | } |
134 | 126 | ||
135 | public void RemoveCapsHandler(UUID agentId) | 127 | public void RemoveCaps(UUID agentId) |
136 | { | 128 | { |
137 | if (childrenSeeds.ContainsKey(agentId)) | 129 | if (childrenSeeds.ContainsKey(agentId)) |
138 | { | 130 | { |
139 | childrenSeeds.Remove(agentId); | 131 | childrenSeeds.Remove(agentId); |
140 | } | 132 | } |
141 | 133 | ||
142 | lock (m_capsHandlers) | 134 | lock (m_capsObjects) |
143 | { | 135 | { |
144 | if (m_capsHandlers.ContainsKey(agentId)) | 136 | if (m_capsObjects.ContainsKey(agentId)) |
145 | { | 137 | { |
146 | m_capsHandlers[agentId].DeregisterHandlers(); | 138 | m_capsObjects[agentId].DeregisterHandlers(); |
147 | m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsHandlers[agentId]); | 139 | m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsObjects[agentId]); |
148 | m_capsHandlers.Remove(agentId); | 140 | m_capsObjects.Remove(agentId); |
149 | } | 141 | } |
150 | else | 142 | else |
151 | { | 143 | { |
@@ -156,20 +148,20 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
156 | } | 148 | } |
157 | } | 149 | } |
158 | 150 | ||
159 | public Caps GetCapsHandlerForUser(UUID agentId) | 151 | public Caps GetCapsForUser(UUID agentId) |
160 | { | 152 | { |
161 | lock (m_capsHandlers) | 153 | lock (m_capsObjects) |
162 | { | 154 | { |
163 | if (m_capsHandlers.ContainsKey(agentId)) | 155 | if (m_capsObjects.ContainsKey(agentId)) |
164 | { | 156 | { |
165 | return m_capsHandlers[agentId]; | 157 | return m_capsObjects[agentId]; |
166 | } | 158 | } |
167 | } | 159 | } |
168 | 160 | ||
169 | return null; | 161 | return null; |
170 | } | 162 | } |
171 | 163 | ||
172 | public void NewUserConnection(AgentCircuitData agent) | 164 | public void SetAgentCapsSeeds(AgentCircuitData agent) |
173 | { | 165 | { |
174 | capsPaths[agent.AgentID] = agent.CapsPath; | 166 | capsPaths[agent.AgentID] = agent.CapsPath; |
175 | childrenSeeds[agent.AgentID] | 167 | childrenSeeds[agent.AgentID] |
@@ -239,7 +231,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
239 | System.Text.StringBuilder caps = new System.Text.StringBuilder(); | 231 | System.Text.StringBuilder caps = new System.Text.StringBuilder(); |
240 | caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); | 232 | caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); |
241 | 233 | ||
242 | foreach (KeyValuePair<UUID, Caps> kvp in m_capsHandlers) | 234 | foreach (KeyValuePair<UUID, Caps> kvp in m_capsObjects) |
243 | { | 235 | { |
244 | caps.AppendFormat("** User {0}:\n", kvp.Key); | 236 | caps.AppendFormat("** User {0}:\n", kvp.Key); |
245 | for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); ) | 237 | for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); ) |
@@ -247,6 +239,8 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
247 | Uri uri = new Uri(kvp2.Value.ToString()); | 239 | Uri uri = new Uri(kvp2.Value.ToString()); |
248 | caps.AppendFormat(" {0} = {1}\n", kvp2.Key, uri.PathAndQuery); | 240 | caps.AppendFormat(" {0} = {1}\n", kvp2.Key, uri.PathAndQuery); |
249 | } | 241 | } |
242 | foreach (KeyValuePair<string, string> kvp3 in kvp.Value.ExternalCapsHandlers) | ||
243 | caps.AppendFormat(" {0} = {1}\n", kvp3.Key, kvp3.Value); | ||
250 | } | 244 | } |
251 | 245 | ||
252 | MainConsole.Instance.Output(caps.ToString()); | 246 | MainConsole.Instance.Output(caps.ToString()); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index b985fbb..e380067 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1759,11 +1759,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1759 | 1759 | ||
1760 | protected void ReInstantiateScripts(ScenePresence sp) | 1760 | protected void ReInstantiateScripts(ScenePresence sp) |
1761 | { | 1761 | { |
1762 | int i = 0; | ||
1762 | sp.Attachments.ForEach(delegate(SceneObjectGroup sog) | 1763 | sp.Attachments.ForEach(delegate(SceneObjectGroup sog) |
1763 | { | 1764 | { |
1765 | sog.SetState(sp.InTransitScriptStates[i++], sp.Scene); | ||
1764 | sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0); | 1766 | sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0); |
1765 | sog.ResumeScripts(); | 1767 | sog.ResumeScripts(); |
1766 | }); | 1768 | }); |
1769 | |||
1770 | sp.InTransitScriptStates.Clear(); | ||
1767 | } | 1771 | } |
1768 | #endregion | 1772 | #endregion |
1769 | 1773 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 6b3df9d..1370b1f 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -371,7 +371,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
371 | } | 371 | } |
372 | 372 | ||
373 | // This is a hook to do some per-asset post-processing for subclasses that need that | 373 | // This is a hook to do some per-asset post-processing for subclasses that need that |
374 | ExportAsset(remoteClient.AgentId, assetID); | 374 | if (remoteClient != null) |
375 | ExportAsset(remoteClient.AgentId, assetID); | ||
375 | 376 | ||
376 | return assetID; | 377 | return assetID; |
377 | } | 378 | } |
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/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 9b565ed..a552a28 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -78,7 +78,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
78 | 78 | ||
79 | private int m_TotalUrls = 100; | 79 | private int m_TotalUrls = 100; |
80 | 80 | ||
81 | private uint https_port = 0; | ||
81 | private IHttpServer m_HttpServer = null; | 82 | private IHttpServer m_HttpServer = null; |
83 | private IHttpServer m_HttpsServer = null; | ||
82 | 84 | ||
83 | private string m_ExternalHostNameForLSL = ""; | 85 | private string m_ExternalHostNameForLSL = ""; |
84 | 86 | ||
@@ -100,6 +102,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
100 | public void Initialise(IConfigSource config) | 102 | public void Initialise(IConfigSource config) |
101 | { | 103 | { |
102 | m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName); | 104 | m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName); |
105 | bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener",false); | ||
106 | if (ssl_enabled) | ||
107 | { | ||
108 | https_port = (uint) config.Configs["Network"].GetInt("https_port",0); | ||
109 | } | ||
103 | } | 110 | } |
104 | 111 | ||
105 | public void PostInitialise() | 112 | public void PostInitialise() |
@@ -113,6 +120,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
113 | // There can only be one | 120 | // There can only be one |
114 | // | 121 | // |
115 | m_HttpServer = MainServer.Instance; | 122 | m_HttpServer = MainServer.Instance; |
123 | // | ||
124 | // We can use the https if it is enabled | ||
125 | if (https_port > 0) | ||
126 | { | ||
127 | m_HttpsServer = MainServer.GetHttpServer(https_port); | ||
128 | } | ||
116 | } | 129 | } |
117 | 130 | ||
118 | scene.RegisterModuleInterface<IUrlModule>(this); | 131 | scene.RegisterModuleInterface<IUrlModule>(this); |
@@ -171,7 +184,40 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
171 | { | 184 | { |
172 | UUID urlcode = UUID.Random(); | 185 | UUID urlcode = UUID.Random(); |
173 | 186 | ||
174 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 187 | if (m_HttpsServer == null) |
188 | { | ||
189 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | ||
190 | return urlcode; | ||
191 | } | ||
192 | |||
193 | lock (m_UrlMap) | ||
194 | { | ||
195 | if (m_UrlMap.Count >= m_TotalUrls) | ||
196 | { | ||
197 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | ||
198 | return urlcode; | ||
199 | } | ||
200 | string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/"; | ||
201 | |||
202 | UrlData urlData = new UrlData(); | ||
203 | urlData.hostID = host.UUID; | ||
204 | urlData.itemID = itemID; | ||
205 | urlData.engine = engine; | ||
206 | urlData.url = url; | ||
207 | urlData.urlcode = urlcode; | ||
208 | urlData.requests = new Dictionary<UUID, RequestData>(); | ||
209 | |||
210 | |||
211 | m_UrlMap[url] = urlData; | ||
212 | |||
213 | string uri = "/lslhttps/" + urlcode.ToString() + "/"; | ||
214 | |||
215 | m_HttpsServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, | ||
216 | new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, | ||
217 | urlcode)); | ||
218 | |||
219 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); | ||
220 | } | ||
175 | 221 | ||
176 | return urlcode; | 222 | return urlcode; |
177 | } | 223 | } |
@@ -345,7 +391,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
345 | } | 391 | } |
346 | private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) | 392 | private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) |
347 | { | 393 | { |
348 | UrlData url = null; | 394 | UrlData url = null; |
349 | RequestData requestData = null; | 395 | RequestData requestData = null; |
350 | 396 | ||
351 | lock (m_RequestMap) | 397 | lock (m_RequestMap) |
@@ -391,11 +437,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
391 | lock (request) | 437 | lock (request) |
392 | { | 438 | { |
393 | string uri = request["uri"].ToString(); | 439 | string uri = request["uri"].ToString(); |
394 | 440 | bool is_ssl = uri.Contains("lslhttps"); | |
441 | |||
395 | try | 442 | try |
396 | { | 443 | { |
397 | Hashtable headers = (Hashtable)request["headers"]; | 444 | Hashtable headers = (Hashtable)request["headers"]; |
398 | 445 | ||
399 | // string uri_full = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri;// "/lslhttp/" + urlcode.ToString() + "/"; | 446 | // string uri_full = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri;// "/lslhttp/" + urlcode.ToString() + "/"; |
400 | 447 | ||
401 | int pos1 = uri.IndexOf("/");// /lslhttp | 448 | int pos1 = uri.IndexOf("/");// /lslhttp |
@@ -409,7 +456,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
409 | 456 | ||
410 | pathInfo = uri.Substring(pos3); | 457 | pathInfo = uri.Substring(pos3); |
411 | 458 | ||
412 | UrlData url = m_UrlMap["http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp]; | 459 | UrlData url = null; |
460 | if (!is_ssl) | ||
461 | url = m_UrlMap["http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp]; | ||
462 | else | ||
463 | url = m_UrlMap["https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp]; | ||
413 | 464 | ||
414 | //for llGetHttpHeader support we need to store original URI here | 465 | //for llGetHttpHeader support we need to store original URI here |
415 | //to make x-path-info / x-query-string / x-script-url / x-remote-ip headers | 466 | //to make x-path-info / x-query-string / x-script-url / x-remote-ip headers |
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index ab6a598..e983239 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs | |||
@@ -64,19 +64,26 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
64 | public void AddRegion(Scene scene) | 64 | public void AddRegion(Scene scene) |
65 | { | 65 | { |
66 | m_Scene = scene; | 66 | m_Scene = scene; |
67 | |||
67 | scene.RegisterModuleInterface<IRestartModule>(this); | 68 | scene.RegisterModuleInterface<IRestartModule>(this); |
68 | MainConsole.Instance.Commands.AddCommand("RestartModule", | 69 | MainConsole.Instance.Commands.AddCommand("RestartModule", |
69 | false, "region restart bluebox", | 70 | false, "region restart bluebox", |
70 | "region restart bluebox <message> <time> ...", | 71 | "region restart bluebox <message> <delta seconds>+", |
71 | "Restart the region", HandleRegionRestart); | 72 | "Schedule a region restart", |
73 | "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a transient notice. If multiple deltas are given then a notice is sent when we reach each delta.", | ||
74 | HandleRegionRestart); | ||
75 | |||
72 | MainConsole.Instance.Commands.AddCommand("RestartModule", | 76 | MainConsole.Instance.Commands.AddCommand("RestartModule", |
73 | false, "region restart notice", | 77 | false, "region restart notice", |
74 | "region restart notice <message> <time> ...", | 78 | "region restart notice <message> <delta seconds>+", |
75 | "Restart the region", HandleRegionRestart); | 79 | "Schedule a region restart", |
80 | "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a dismissable bluebox notice. If multiple deltas are given then a notice is sent when we reach each delta.", | ||
81 | HandleRegionRestart); | ||
82 | |||
76 | MainConsole.Instance.Commands.AddCommand("RestartModule", | 83 | MainConsole.Instance.Commands.AddCommand("RestartModule", |
77 | false, "region restart abort", | 84 | false, "region restart abort", |
78 | "region restart abort [<message>]", | 85 | "region restart abort [<message>]", |
79 | "Restart the region", HandleRegionRestart); | 86 | "Abort a region restart", HandleRegionRestart); |
80 | } | 87 | } |
81 | 88 | ||
82 | public void RegionLoaded(Scene scene) | 89 | public void RegionLoaded(Scene scene) |
@@ -245,7 +252,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
245 | } | 252 | } |
246 | } | 253 | } |
247 | 254 | ||
248 | MainConsole.Instance.Output("Error: restart region <mode> <name> <time> ..."); | 255 | MainConsole.Instance.Output("Error: restart region <mode> <name> <delta seconds>+"); |
249 | return; | 256 | return; |
250 | } | 257 | } |
251 | 258 | ||
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.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index b0f0de6..cd01a05 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -713,7 +713,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
713 | newName = item.Name; | 713 | newName = item.Name; |
714 | } | 714 | } |
715 | 715 | ||
716 | if (remoteClient.AgentId == oldAgentID) | 716 | if (remoteClient.AgentId == oldAgentID || (LibraryService != null && LibraryService.LibraryRootFolder != null && oldAgentID == LibraryService.LibraryRootFolder.Owner)) |
717 | { | 717 | { |
718 | CreateNewInventoryItem( | 718 | CreateNewInventoryItem( |
719 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, | 719 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7c5e246..49fbe33 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -775,6 +775,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
775 | m_regInfo = regInfo; | 775 | m_regInfo = regInfo; |
776 | m_eventManager = new EventManager(); | 776 | m_eventManager = new EventManager(); |
777 | 777 | ||
778 | m_permissions = new ScenePermissions(this); | ||
779 | |||
778 | m_lastUpdate = Util.EnvironmentTickCount(); | 780 | m_lastUpdate = Util.EnvironmentTickCount(); |
779 | } | 781 | } |
780 | 782 | ||
@@ -3033,7 +3035,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3033 | m_sceneGraph.removeUserCount(!childagentYN); | 3035 | m_sceneGraph.removeUserCount(!childagentYN); |
3034 | 3036 | ||
3035 | if (CapsModule != null) | 3037 | if (CapsModule != null) |
3036 | CapsModule.RemoveCapsHandler(agentID); | 3038 | CapsModule.RemoveCaps(agentID); |
3037 | 3039 | ||
3038 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever | 3040 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever |
3039 | // this method is doing is HORRIBLE!!! | 3041 | // this method is doing is HORRIBLE!!! |
@@ -3290,8 +3292,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3290 | 3292 | ||
3291 | if (CapsModule != null) | 3293 | if (CapsModule != null) |
3292 | { | 3294 | { |
3293 | CapsModule.NewUserConnection(agent); | 3295 | CapsModule.SetAgentCapsSeeds(agent); |
3294 | CapsModule.AddCapsHandler(agent.AgentID); | 3296 | CapsModule.CreateCaps(agent.AgentID); |
3295 | } | 3297 | } |
3296 | } | 3298 | } |
3297 | else | 3299 | else |
@@ -3309,7 +3311,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3309 | sp.AdjustKnownSeeds(); | 3311 | sp.AdjustKnownSeeds(); |
3310 | 3312 | ||
3311 | if (CapsModule != null) | 3313 | if (CapsModule != null) |
3312 | CapsModule.NewUserConnection(agent); | 3314 | CapsModule.SetAgentCapsSeeds(agent); |
3313 | } | 3315 | } |
3314 | } | 3316 | } |
3315 | 3317 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5b86735..631c91b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -232,6 +232,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
232 | private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); | 232 | private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); |
233 | 233 | ||
234 | /// <summary> | 234 | /// <summary> |
235 | /// Copy of the script states while the agent is in transit. This state may | ||
236 | /// need to be placed back in case of transfer fail. | ||
237 | /// </summary> | ||
238 | public List<string> InTransitScriptStates | ||
239 | { | ||
240 | get { return m_InTransitScriptStates; } | ||
241 | } | ||
242 | private List<string> m_InTransitScriptStates = new List<string>(); | ||
243 | |||
244 | /// <summary> | ||
235 | /// Implemented Control Flags | 245 | /// Implemented Control Flags |
236 | /// </summary> | 246 | /// </summary> |
237 | private enum Dir_ControlFlags | 247 | private enum Dir_ControlFlags |
@@ -2395,6 +2405,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2395 | 2405 | ||
2396 | // vars to support reduced update frequency when velocity is unchanged | 2406 | // vars to support reduced update frequency when velocity is unchanged |
2397 | private Vector3 lastVelocitySentToAllClients = Vector3.Zero; | 2407 | private Vector3 lastVelocitySentToAllClients = Vector3.Zero; |
2408 | private Vector3 lastPositionSentToAllClients = Vector3.Zero; | ||
2398 | private int lastTerseUpdateToAllClientsTick = Util.EnvironmentTickCount(); | 2409 | private int lastTerseUpdateToAllClientsTick = Util.EnvironmentTickCount(); |
2399 | 2410 | ||
2400 | /// <summary> | 2411 | /// <summary> |
@@ -2404,14 +2415,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
2404 | { | 2415 | { |
2405 | int currentTick = Util.EnvironmentTickCount(); | 2416 | int currentTick = Util.EnvironmentTickCount(); |
2406 | 2417 | ||
2407 | // decrease update frequency when avatar is moving but velocity is not changing | 2418 | // Decrease update frequency when avatar is moving but velocity is |
2408 | if (m_velocity.Length() < 0.01f | 2419 | // not changing. |
2409 | || Vector3.Distance(lastVelocitySentToAllClients, m_velocity) > 0.01f | 2420 | // If there is a mismatch between distance travelled and expected |
2410 | || currentTick - lastTerseUpdateToAllClientsTick > 1500) | 2421 | // distance based on last velocity sent and velocity hasnt changed, |
2422 | // then send a new terse update | ||
2423 | |||
2424 | float timeSinceLastUpdate = (currentTick - lastTerseUpdateToAllClientsTick) * 0.001f; | ||
2425 | |||
2426 | Vector3 expectedPosition = lastPositionSentToAllClients + lastVelocitySentToAllClients * timeSinceLastUpdate; | ||
2427 | |||
2428 | float distanceError = Vector3.Distance(OffsetPosition, expectedPosition); | ||
2429 | |||
2430 | float speed = Velocity.Length(); | ||
2431 | float velocidyDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity); | ||
2432 | |||
2433 | if (speed < 0.01f // allow rotation updates if avatar position is unchanged | ||
2434 | || Math.Abs(distanceError) > 0.25f // arbitrary distance error threshold | ||
2435 | || velocidyDiff > 0.01f) // did velocity change from last update? | ||
2411 | { | 2436 | { |
2412 | m_perfMonMS = currentTick; | 2437 | m_perfMonMS = currentTick; |
2413 | lastVelocitySentToAllClients = m_velocity; | 2438 | lastVelocitySentToAllClients = Velocity; |
2414 | lastTerseUpdateToAllClientsTick = currentTick; | 2439 | lastTerseUpdateToAllClientsTick = currentTick; |
2440 | lastPositionSentToAllClients = OffsetPosition; | ||
2415 | 2441 | ||
2416 | m_scene.ForEachClient(SendTerseUpdateToClient); | 2442 | m_scene.ForEachClient(SendTerseUpdateToClient); |
2417 | 2443 | ||
@@ -3126,6 +3152,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3126 | cAgent.AttachmentObjects = new List<ISceneObject>(); | 3152 | cAgent.AttachmentObjects = new List<ISceneObject>(); |
3127 | cAgent.AttachmentObjectStates = new List<string>(); | 3153 | cAgent.AttachmentObjectStates = new List<string>(); |
3128 | IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>(); | 3154 | IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>(); |
3155 | m_InTransitScriptStates.Clear(); | ||
3129 | foreach (SceneObjectGroup sog in m_attachments) | 3156 | foreach (SceneObjectGroup sog in m_attachments) |
3130 | { | 3157 | { |
3131 | // We need to make a copy and pass that copy | 3158 | // We need to make a copy and pass that copy |
@@ -3135,7 +3162,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3135 | ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos; | 3162 | ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos; |
3136 | ((SceneObjectGroup)clone).RootPart.IsAttachment = false; | 3163 | ((SceneObjectGroup)clone).RootPart.IsAttachment = false; |
3137 | cAgent.AttachmentObjects.Add(clone); | 3164 | cAgent.AttachmentObjects.Add(clone); |
3138 | cAgent.AttachmentObjectStates.Add(sog.GetStateSnapshot()); | 3165 | string state = sog.GetStateSnapshot(); |
3166 | cAgent.AttachmentObjectStates.Add(state); | ||
3167 | m_InTransitScriptStates.Add(state); | ||
3139 | // Let's remove the scripts of the original object here | 3168 | // Let's remove the scripts of the original object here |
3140 | sog.RemoveScriptInstances(true); | 3169 | sog.RemoveScriptInstances(true); |
3141 | } | 3170 | } |
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index db17d8f..62e6fae 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | |||
@@ -107,11 +107,10 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
107 | 107 | ||
108 | scene.AddCommand( | 108 | scene.AddCommand( |
109 | this, "emergency-monitoring", | 109 | this, "emergency-monitoring", |
110 | "Go on/off emergency monitoring mode", | 110 | "emergency-monitoring", |
111 | "Go on/off emergency monitoring mode", | 111 | "Go on/off emergency monitoring mode", |
112 | "Go on/off emergency monitoring mode", | 112 | "Go on/off emergency monitoring mode", |
113 | EmergencyMonitoring); | 113 | EmergencyMonitoring); |
114 | |||
115 | } | 114 | } |
116 | 115 | ||
117 | public void RemoveRegion(Scene scene) | 116 | public void RemoveRegion(Scene scene) |
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; |