diff options
Diffstat (limited to 'OpenSim/Region')
40 files changed, 174 insertions, 1724 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 6b7026c..d961b73 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -39,14 +39,16 @@ using OpenSim.Framework.Servers; | |||
39 | using OpenSim.Framework.Types; | 39 | using OpenSim.Framework.Types; |
40 | using OpenSim.Framework.Configuration; | 40 | using OpenSim.Framework.Configuration; |
41 | using OpenSim.Physics.Manager; | 41 | using OpenSim.Physics.Manager; |
42 | using OpenSim.Region.Caches; | 42 | |
43 | using OpenSim.Region.ClientStack; | 43 | using OpenSim.Region.ClientStack; |
44 | using OpenSim.Region.Communications.Local; | 44 | using OpenSim.Region.Communications.Local; |
45 | using OpenSim.Region.Communications.OGS1; | 45 | using OpenSim.Region.Communications.OGS1; |
46 | using OpenSim.Framework.Communications.Caches; | ||
46 | using OpenSim.Region.Environment.Scenes; | 47 | using OpenSim.Region.Environment.Scenes; |
47 | using OpenSim.Region.Environment; | 48 | using OpenSim.Region.Environment; |
48 | using System.Text; | 49 | using System.Text; |
49 | using System.Collections.Generic; | 50 | using System.Collections.Generic; |
51 | using OpenSim.Framework.Utilities; | ||
50 | 52 | ||
51 | namespace OpenSim | 53 | namespace OpenSim |
52 | { | 54 | { |
@@ -97,11 +99,11 @@ namespace OpenSim | |||
97 | 99 | ||
98 | if (m_sandbox) | 100 | if (m_sandbox) |
99 | { | 101 | { |
100 | m_commsManager = new CommunicationsLocal( m_networkServersInfo, m_httpServer); | 102 | m_commsManager = new CommunicationsLocal( m_networkServersInfo, m_httpServer, m_assetCache); |
101 | } | 103 | } |
102 | else | 104 | else |
103 | { | 105 | { |
104 | m_commsManager = new CommunicationsOGS1( m_networkServersInfo, m_httpServer ); | 106 | m_commsManager = new CommunicationsOGS1( m_networkServersInfo, m_httpServer , m_assetCache); |
105 | } | 107 | } |
106 | 108 | ||
107 | string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions"); | 109 | string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions"); |
@@ -137,6 +139,7 @@ namespace OpenSim | |||
137 | this.m_udpServers[i].ServerListener(); | 139 | this.m_udpServers[i].ServerListener(); |
138 | } | 140 | } |
139 | 141 | ||
142 | |||
140 | } | 143 | } |
141 | 144 | ||
142 | protected override StorageManager CreateStorageManager(RegionInfo regionInfo) | 145 | protected override StorageManager CreateStorageManager(RegionInfo regionInfo) |
diff --git a/OpenSim/Region/Caches/AssetCache.cs b/OpenSim/Region/Caches/AssetCache.cs deleted file mode 100644 index 8deb0a1..0000000 --- a/OpenSim/Region/Caches/AssetCache.cs +++ /dev/null | |||
@@ -1,669 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using System.Threading; | ||
33 | using libsecondlife; | ||
34 | using libsecondlife.Packets; | ||
35 | using OpenSim.Framework.Interfaces; | ||
36 | using OpenSim.Framework.Types; | ||
37 | |||
38 | namespace OpenSim.Region.Caches | ||
39 | { | ||
40 | public delegate void DownloadComplete(AssetCache.TextureSender sender); | ||
41 | |||
42 | /// <summary> | ||
43 | /// Manages local cache of assets and their sending to viewers. | ||
44 | /// </summary> | ||
45 | public class AssetCache : IAssetReceiver | ||
46 | { | ||
47 | public Dictionary<LLUUID, AssetInfo> Assets; | ||
48 | public Dictionary<LLUUID, TextureImage> Textures; | ||
49 | |||
50 | public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers | ||
51 | public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent | ||
52 | |||
53 | public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server | ||
54 | public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server | ||
55 | |||
56 | public Dictionary<LLUUID, TextureSender> SendingTextures = new Dictionary<LLUUID, TextureSender>(); | ||
57 | private IAssetServer _assetServer; | ||
58 | private Thread _assetCacheThread; | ||
59 | private LLUUID[] textureList = new LLUUID[5]; | ||
60 | |||
61 | /// <summary> | ||
62 | /// | ||
63 | /// </summary> | ||
64 | public AssetCache(IAssetServer assetServer) | ||
65 | { | ||
66 | Console.WriteLine("Creating Asset cache"); | ||
67 | _assetServer = assetServer; | ||
68 | _assetServer.SetReceiver(this); | ||
69 | Assets = new Dictionary<LLUUID, AssetInfo>(); | ||
70 | Textures = new Dictionary<LLUUID, TextureImage>(); | ||
71 | this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); | ||
72 | this._assetCacheThread.IsBackground = true; | ||
73 | this._assetCacheThread.Start(); | ||
74 | |||
75 | } | ||
76 | |||
77 | public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey) | ||
78 | { | ||
79 | Console.WriteLine("Creating Asset cache"); | ||
80 | _assetServer = this.LoadAssetDll(assetServerDLLName); | ||
81 | _assetServer.SetServerInfo(assetServerURL, assetServerKey); | ||
82 | _assetServer.SetReceiver(this); | ||
83 | Assets = new Dictionary<LLUUID, AssetInfo>(); | ||
84 | Textures = new Dictionary<LLUUID, TextureImage>(); | ||
85 | this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); | ||
86 | this._assetCacheThread.IsBackground = true; | ||
87 | this._assetCacheThread.Start(); | ||
88 | |||
89 | } | ||
90 | |||
91 | /// <summary> | ||
92 | /// | ||
93 | /// </summary> | ||
94 | public void RunAssetManager() | ||
95 | { | ||
96 | while (true) | ||
97 | { | ||
98 | try | ||
99 | { | ||
100 | //Console.WriteLine("Asset cache loop"); | ||
101 | this.ProcessAssetQueue(); | ||
102 | this.ProcessTextureQueue(); | ||
103 | Thread.Sleep(500); | ||
104 | } | ||
105 | catch (Exception e) | ||
106 | { | ||
107 | Console.WriteLine(e.Message); | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | |||
112 | public void LoadDefaultTextureSet() | ||
113 | { | ||
114 | //hack: so we can give each user a set of textures | ||
115 | textureList[0] = new LLUUID("00000000-0000-0000-9999-000000000001"); | ||
116 | textureList[1] = new LLUUID("00000000-0000-0000-9999-000000000002"); | ||
117 | textureList[2] = new LLUUID("00000000-0000-0000-9999-000000000003"); | ||
118 | textureList[3] = new LLUUID("00000000-0000-0000-9999-000000000004"); | ||
119 | textureList[4] = new LLUUID("00000000-0000-0000-9999-000000000005"); | ||
120 | |||
121 | for (int i = 0; i < textureList.Length; i++) | ||
122 | { | ||
123 | this._assetServer.RequestAsset(textureList[i], true); | ||
124 | } | ||
125 | |||
126 | } | ||
127 | |||
128 | public AssetBase[] CreateNewInventorySet(LLUUID agentID) | ||
129 | { | ||
130 | AssetBase[] inventorySet = new AssetBase[this.textureList.Length]; | ||
131 | for (int i = 0; i < textureList.Length; i++) | ||
132 | { | ||
133 | if (this.Textures.ContainsKey(textureList[i])) | ||
134 | { | ||
135 | inventorySet[i] = this.CloneImage(agentID, this.Textures[textureList[i]]); | ||
136 | TextureImage image = new TextureImage(inventorySet[i]); | ||
137 | this.Textures.Add(image.FullID, image); | ||
138 | this._assetServer.UploadNewAsset(image); //save the asset to the asset server | ||
139 | } | ||
140 | } | ||
141 | return inventorySet; | ||
142 | } | ||
143 | |||
144 | public AssetBase GetAsset(LLUUID assetID) | ||
145 | { | ||
146 | AssetBase asset = null; | ||
147 | if (this.Textures.ContainsKey(assetID)) | ||
148 | { | ||
149 | asset = this.Textures[assetID]; | ||
150 | } | ||
151 | else if (this.Assets.ContainsKey(assetID)) | ||
152 | { | ||
153 | asset = this.Assets[assetID]; | ||
154 | } | ||
155 | return asset; | ||
156 | } | ||
157 | |||
158 | public void AddAsset(AssetBase asset) | ||
159 | { | ||
160 | // Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); | ||
161 | if (asset.Type == 0) | ||
162 | { | ||
163 | //Console.WriteLine("which is a texture"); | ||
164 | if (!this.Textures.ContainsKey(asset.FullID)) | ||
165 | { //texture | ||
166 | TextureImage textur = new TextureImage(asset); | ||
167 | this.Textures.Add(textur.FullID, textur); | ||
168 | this._assetServer.UploadNewAsset(asset); | ||
169 | } | ||
170 | } | ||
171 | else | ||
172 | { | ||
173 | if (!this.Assets.ContainsKey(asset.FullID)) | ||
174 | { | ||
175 | AssetInfo assetInf = new AssetInfo(asset); | ||
176 | this.Assets.Add(assetInf.FullID, assetInf); | ||
177 | this._assetServer.UploadNewAsset(asset); | ||
178 | } | ||
179 | } | ||
180 | } | ||
181 | |||
182 | /// <summary> | ||
183 | /// | ||
184 | /// </summary> | ||
185 | private void ProcessTextureQueue() | ||
186 | { | ||
187 | if (this.TextureRequests.Count == 0) | ||
188 | { | ||
189 | //no requests waiting | ||
190 | return; | ||
191 | } | ||
192 | int num; | ||
193 | num = this.TextureRequests.Count; | ||
194 | |||
195 | AssetRequest req; | ||
196 | for (int i = 0; i < num; i++) | ||
197 | { | ||
198 | req = (AssetRequest)this.TextureRequests[i]; | ||
199 | if (!this.SendingTextures.ContainsKey(req.ImageInfo.FullID)) | ||
200 | { | ||
201 | TextureSender sender = new TextureSender(req); | ||
202 | sender.OnComplete += this.TextureSent; | ||
203 | lock (this.SendingTextures) | ||
204 | { | ||
205 | this.SendingTextures.Add(req.ImageInfo.FullID, sender); | ||
206 | } | ||
207 | } | ||
208 | |||
209 | } | ||
210 | |||
211 | this.TextureRequests.Clear(); | ||
212 | } | ||
213 | |||
214 | /// <summary> | ||
215 | /// Event handler, called by a TextureSender object to say that texture has been sent | ||
216 | /// </summary> | ||
217 | /// <param name="sender"></param> | ||
218 | public void TextureSent(TextureSender sender) | ||
219 | { | ||
220 | if (this.SendingTextures.ContainsKey(sender.request.ImageInfo.FullID)) | ||
221 | { | ||
222 | lock (this.SendingTextures) | ||
223 | { | ||
224 | this.SendingTextures.Remove(sender.request.ImageInfo.FullID); | ||
225 | } | ||
226 | } | ||
227 | } | ||
228 | |||
229 | public void AssetReceived(AssetBase asset, bool IsTexture) | ||
230 | { | ||
231 | if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server | ||
232 | { | ||
233 | //check if it is a texture or not | ||
234 | //then add to the correct cache list | ||
235 | //then check for waiting requests for this asset/texture (in the Requested lists) | ||
236 | //and move those requests into the Requests list. | ||
237 | if (IsTexture) | ||
238 | { | ||
239 | TextureImage image = new TextureImage(asset); | ||
240 | this.Textures.Add(image.FullID, image); | ||
241 | if (this.RequestedTextures.ContainsKey(image.FullID)) | ||
242 | { | ||
243 | AssetRequest req = this.RequestedTextures[image.FullID]; | ||
244 | req.ImageInfo = image; | ||
245 | if (image.Data.LongLength > 600) | ||
246 | { | ||
247 | //over 600 bytes so split up file | ||
248 | req.NumPackets = 1 + (int)(image.Data.Length - 600 + 999) / 1000; | ||
249 | } | ||
250 | else | ||
251 | { | ||
252 | req.NumPackets = 1; | ||
253 | } | ||
254 | this.RequestedTextures.Remove(image.FullID); | ||
255 | this.TextureRequests.Add(req); | ||
256 | } | ||
257 | } | ||
258 | else | ||
259 | { | ||
260 | AssetInfo assetInf = new AssetInfo(asset); | ||
261 | this.Assets.Add(assetInf.FullID, assetInf); | ||
262 | if (this.RequestedAssets.ContainsKey(assetInf.FullID)) | ||
263 | { | ||
264 | AssetRequest req = this.RequestedAssets[assetInf.FullID]; | ||
265 | req.AssetInf = assetInf; | ||
266 | if (assetInf.Data.LongLength > 600) | ||
267 | { | ||
268 | //over 600 bytes so split up file | ||
269 | req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000; | ||
270 | } | ||
271 | else | ||
272 | { | ||
273 | req.NumPackets = 1; | ||
274 | } | ||
275 | this.RequestedAssets.Remove(assetInf.FullID); | ||
276 | this.AssetRequests.Add(req); | ||
277 | } | ||
278 | } | ||
279 | } | ||
280 | } | ||
281 | |||
282 | public void AssetNotFound(AssetBase asset) | ||
283 | { | ||
284 | //the asset server had no knowledge of requested asset | ||
285 | |||
286 | } | ||
287 | |||
288 | #region Assets | ||
289 | /// <summary> | ||
290 | /// | ||
291 | /// </summary> | ||
292 | /// <param name="userInfo"></param> | ||
293 | /// <param name="transferRequest"></param> | ||
294 | public void AddAssetRequest(IClientAPI userInfo, TransferRequestPacket transferRequest) | ||
295 | { | ||
296 | LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0); | ||
297 | //check to see if asset is in local cache, if not we need to request it from asset server. | ||
298 | |||
299 | if (!this.Assets.ContainsKey(requestID)) | ||
300 | { | ||
301 | //not found asset | ||
302 | // so request from asset server | ||
303 | if (!this.RequestedAssets.ContainsKey(requestID)) | ||
304 | { | ||
305 | AssetRequest request = new AssetRequest(); | ||
306 | request.RequestUser = userInfo; | ||
307 | request.RequestAssetID = requestID; | ||
308 | request.TransferRequestID = transferRequest.TransferInfo.TransferID; | ||
309 | this.RequestedAssets.Add(requestID, request); | ||
310 | this._assetServer.RequestAsset(requestID, false); | ||
311 | } | ||
312 | return; | ||
313 | } | ||
314 | //it is in our cache | ||
315 | AssetInfo asset = this.Assets[requestID]; | ||
316 | |||
317 | //work out how many packets it should be sent in | ||
318 | // and add to the AssetRequests list | ||
319 | AssetRequest req = new AssetRequest(); | ||
320 | req.RequestUser = userInfo; | ||
321 | req.RequestAssetID = requestID; | ||
322 | req.TransferRequestID = transferRequest.TransferInfo.TransferID; | ||
323 | req.AssetInf = asset; | ||
324 | |||
325 | if (asset.Data.LongLength > 600) | ||
326 | { | ||
327 | //over 600 bytes so split up file | ||
328 | req.NumPackets = 1 + (int)(asset.Data.Length - 600 + 999) / 1000; | ||
329 | } | ||
330 | else | ||
331 | { | ||
332 | req.NumPackets = 1; | ||
333 | } | ||
334 | |||
335 | this.AssetRequests.Add(req); | ||
336 | } | ||
337 | |||
338 | /// <summary> | ||
339 | /// | ||
340 | /// </summary> | ||
341 | private void ProcessAssetQueue() | ||
342 | { | ||
343 | if (this.AssetRequests.Count == 0) | ||
344 | { | ||
345 | //no requests waiting | ||
346 | return; | ||
347 | } | ||
348 | int num; | ||
349 | |||
350 | if (this.AssetRequests.Count < 5) | ||
351 | { | ||
352 | //lower than 5 so do all of them | ||
353 | num = this.AssetRequests.Count; | ||
354 | } | ||
355 | else | ||
356 | { | ||
357 | num = 5; | ||
358 | } | ||
359 | AssetRequest req; | ||
360 | for (int i = 0; i < num; i++) | ||
361 | { | ||
362 | req = (AssetRequest)this.AssetRequests[i]; | ||
363 | |||
364 | TransferInfoPacket Transfer = new TransferInfoPacket(); | ||
365 | Transfer.TransferInfo.ChannelType = 2; | ||
366 | Transfer.TransferInfo.Status = 0; | ||
367 | Transfer.TransferInfo.TargetType = 0; | ||
368 | Transfer.TransferInfo.Params = req.RequestAssetID.GetBytes(); | ||
369 | Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length; | ||
370 | Transfer.TransferInfo.TransferID = req.TransferRequestID; | ||
371 | req.RequestUser.OutPacket(Transfer); | ||
372 | |||
373 | if (req.NumPackets == 1) | ||
374 | { | ||
375 | TransferPacketPacket TransferPacket = new TransferPacketPacket(); | ||
376 | TransferPacket.TransferData.Packet = 0; | ||
377 | TransferPacket.TransferData.ChannelType = 2; | ||
378 | TransferPacket.TransferData.TransferID = req.TransferRequestID; | ||
379 | TransferPacket.TransferData.Data = req.AssetInf.Data; | ||
380 | TransferPacket.TransferData.Status = 1; | ||
381 | req.RequestUser.OutPacket(TransferPacket); | ||
382 | } | ||
383 | else | ||
384 | { | ||
385 | //more than one packet so split file up , for now it can't be bigger than 2000 bytes | ||
386 | TransferPacketPacket TransferPacket = new TransferPacketPacket(); | ||
387 | TransferPacket.TransferData.Packet = 0; | ||
388 | TransferPacket.TransferData.ChannelType = 2; | ||
389 | TransferPacket.TransferData.TransferID = req.TransferRequestID; | ||
390 | byte[] chunk = new byte[1000]; | ||
391 | Array.Copy(req.AssetInf.Data, chunk, 1000); | ||
392 | TransferPacket.TransferData.Data = chunk; | ||
393 | TransferPacket.TransferData.Status = 0; | ||
394 | req.RequestUser.OutPacket(TransferPacket); | ||
395 | |||
396 | TransferPacket = new TransferPacketPacket(); | ||
397 | TransferPacket.TransferData.Packet = 1; | ||
398 | TransferPacket.TransferData.ChannelType = 2; | ||
399 | TransferPacket.TransferData.TransferID = req.TransferRequestID; | ||
400 | byte[] chunk1 = new byte[(req.AssetInf.Data.Length - 1000)]; | ||
401 | Array.Copy(req.AssetInf.Data, 1000, chunk1, 0, chunk1.Length); | ||
402 | TransferPacket.TransferData.Data = chunk1; | ||
403 | TransferPacket.TransferData.Status = 1; | ||
404 | req.RequestUser.OutPacket(TransferPacket); | ||
405 | } | ||
406 | |||
407 | } | ||
408 | |||
409 | //remove requests that have been completed | ||
410 | for (int i = 0; i < num; i++) | ||
411 | { | ||
412 | this.AssetRequests.RemoveAt(0); | ||
413 | } | ||
414 | |||
415 | } | ||
416 | |||
417 | public AssetInfo CloneAsset(LLUUID newOwner, AssetInfo sourceAsset) | ||
418 | { | ||
419 | AssetInfo newAsset = new AssetInfo(); | ||
420 | newAsset.Data = new byte[sourceAsset.Data.Length]; | ||
421 | Array.Copy(sourceAsset.Data, newAsset.Data, sourceAsset.Data.Length); | ||
422 | newAsset.FullID = LLUUID.Random(); | ||
423 | newAsset.Type = sourceAsset.Type; | ||
424 | newAsset.InvType = sourceAsset.InvType; | ||
425 | return (newAsset); | ||
426 | } | ||
427 | #endregion | ||
428 | |||
429 | #region Textures | ||
430 | /// <summary> | ||
431 | /// | ||
432 | /// </summary> | ||
433 | /// <param name="userInfo"></param> | ||
434 | /// <param name="imageID"></param> | ||
435 | public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID) | ||
436 | { | ||
437 | //Console.WriteLine("texture request for " + imageID.ToStringHyphenated()); | ||
438 | //check to see if texture is in local cache, if not request from asset server | ||
439 | if (!this.Textures.ContainsKey(imageID)) | ||
440 | { | ||
441 | if (!this.RequestedTextures.ContainsKey(imageID)) | ||
442 | { | ||
443 | //not is cache so request from asset server | ||
444 | AssetRequest request = new AssetRequest(); | ||
445 | request.RequestUser = userInfo; | ||
446 | request.RequestAssetID = imageID; | ||
447 | request.IsTextureRequest = true; | ||
448 | this.RequestedTextures.Add(imageID, request); | ||
449 | this._assetServer.RequestAsset(imageID, true); | ||
450 | } | ||
451 | return; | ||
452 | } | ||
453 | |||
454 | //Console.WriteLine("texture already in cache"); | ||
455 | TextureImage imag = this.Textures[imageID]; | ||
456 | AssetRequest req = new AssetRequest(); | ||
457 | req.RequestUser = userInfo; | ||
458 | req.RequestAssetID = imageID; | ||
459 | req.IsTextureRequest = true; | ||
460 | req.ImageInfo = imag; | ||
461 | |||
462 | if (imag.Data.LongLength > 600) | ||
463 | { | ||
464 | //over 600 bytes so split up file | ||
465 | req.NumPackets = 1 + (int)(imag.Data.Length - 600 + 999) / 1000; | ||
466 | } | ||
467 | else | ||
468 | { | ||
469 | req.NumPackets = 1; | ||
470 | } | ||
471 | this.TextureRequests.Add(req); | ||
472 | } | ||
473 | |||
474 | public TextureImage CloneImage(LLUUID newOwner, TextureImage source) | ||
475 | { | ||
476 | TextureImage newImage = new TextureImage(); | ||
477 | newImage.Data = new byte[source.Data.Length]; | ||
478 | Array.Copy(source.Data, newImage.Data, source.Data.Length); | ||
479 | //newImage.filename = source.filename; | ||
480 | newImage.FullID = LLUUID.Random(); | ||
481 | newImage.Name = source.Name; | ||
482 | return (newImage); | ||
483 | } | ||
484 | #endregion | ||
485 | |||
486 | private IAssetServer LoadAssetDll(string dllName) | ||
487 | { | ||
488 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
489 | IAssetServer server = null; | ||
490 | |||
491 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
492 | { | ||
493 | if (pluginType.IsPublic) | ||
494 | { | ||
495 | if (!pluginType.IsAbstract) | ||
496 | { | ||
497 | Type typeInterface = pluginType.GetInterface("IAssetPlugin", true); | ||
498 | |||
499 | if (typeInterface != null) | ||
500 | { | ||
501 | IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
502 | server = plug.GetAssetServer(); | ||
503 | break; | ||
504 | } | ||
505 | |||
506 | typeInterface = null; | ||
507 | } | ||
508 | } | ||
509 | } | ||
510 | pluginAssembly = null; | ||
511 | return server; | ||
512 | } | ||
513 | |||
514 | public class AssetRequest | ||
515 | { | ||
516 | public IClientAPI RequestUser; | ||
517 | public LLUUID RequestAssetID; | ||
518 | public AssetInfo AssetInf; | ||
519 | public TextureImage ImageInfo; | ||
520 | public LLUUID TransferRequestID; | ||
521 | public long DataPointer = 0; | ||
522 | public int NumPackets = 0; | ||
523 | public int PacketCounter = 0; | ||
524 | public bool IsTextureRequest; | ||
525 | //public bool AssetInCache; | ||
526 | //public int TimeRequested; | ||
527 | |||
528 | public AssetRequest() | ||
529 | { | ||
530 | |||
531 | } | ||
532 | } | ||
533 | |||
534 | public class AssetInfo : AssetBase | ||
535 | { | ||
536 | public AssetInfo() | ||
537 | { | ||
538 | |||
539 | } | ||
540 | |||
541 | public AssetInfo(AssetBase aBase) | ||
542 | { | ||
543 | Data = aBase.Data; | ||
544 | FullID = aBase.FullID; | ||
545 | Type = aBase.Type; | ||
546 | InvType = aBase.InvType; | ||
547 | Name = aBase.Name; | ||
548 | Description = aBase.Description; | ||
549 | } | ||
550 | } | ||
551 | |||
552 | public class TextureImage : AssetBase | ||
553 | { | ||
554 | public TextureImage() | ||
555 | { | ||
556 | |||
557 | } | ||
558 | |||
559 | public TextureImage(AssetBase aBase) | ||
560 | { | ||
561 | Data = aBase.Data; | ||
562 | FullID = aBase.FullID; | ||
563 | Type = aBase.Type; | ||
564 | InvType = aBase.InvType; | ||
565 | Name = aBase.Name; | ||
566 | Description = aBase.Description; | ||
567 | } | ||
568 | } | ||
569 | |||
570 | public class TextureSender | ||
571 | { | ||
572 | public AssetRequest request; | ||
573 | public event DownloadComplete OnComplete; | ||
574 | Thread m_thread; | ||
575 | public TextureSender(AssetRequest req) | ||
576 | { | ||
577 | request = req; | ||
578 | //Console.WriteLine("creating worker thread for texture " + req.ImageInfo.FullID.ToStringHyphenated()); | ||
579 | //Console.WriteLine("texture data length is " + req.ImageInfo.Data.Length); | ||
580 | // Console.WriteLine("in " + req.NumPackets + " packets"); | ||
581 | //ThreadPool.QueueUserWorkItem(new WaitCallback(SendTexture), new object()); | ||
582 | |||
583 | //need some sort of custom threadpool here, as using the .net one, overloads it and stops the handling of incoming packets etc | ||
584 | //but don't really want to create a thread for every texture download | ||
585 | m_thread = new Thread(new ThreadStart(SendTexture)); | ||
586 | m_thread.IsBackground = true; | ||
587 | m_thread.Start(); | ||
588 | } | ||
589 | |||
590 | public void SendTexture() | ||
591 | { | ||
592 | //Console.WriteLine("starting to send sending texture " + request.ImageInfo.FullID.ToStringHyphenated()); | ||
593 | while (request.PacketCounter != request.NumPackets) | ||
594 | { | ||
595 | SendPacket(); | ||
596 | Thread.Sleep(500); | ||
597 | } | ||
598 | |||
599 | //Console.WriteLine("finished sending texture " + request.ImageInfo.FullID.ToStringHyphenated()); | ||
600 | if (OnComplete != null) | ||
601 | { | ||
602 | OnComplete(this); | ||
603 | } | ||
604 | } | ||
605 | |||
606 | public void SendPacket() | ||
607 | { | ||
608 | AssetRequest req = request; | ||
609 | // Console.WriteLine("sending " + req.ImageInfo.FullID); | ||
610 | |||
611 | // if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005")) | ||
612 | if (req.PacketCounter == 0) | ||
613 | { | ||
614 | //first time for this request so send imagedata packet | ||
615 | if (req.NumPackets == 1) | ||
616 | { | ||
617 | //only one packet so send whole file | ||
618 | ImageDataPacket im = new ImageDataPacket(); | ||
619 | im.ImageID.Packets = 1; | ||
620 | im.ImageID.ID = req.ImageInfo.FullID; | ||
621 | im.ImageID.Size = (uint)req.ImageInfo.Data.Length; | ||
622 | im.ImageData.Data = req.ImageInfo.Data; | ||
623 | im.ImageID.Codec = 2; | ||
624 | req.RequestUser.OutPacket(im); | ||
625 | req.PacketCounter++; | ||
626 | //req.ImageInfo.l= time; | ||
627 | //System.Console.WriteLine("sent texture: " + req.ImageInfo.FullID); | ||
628 | // Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated()); | ||
629 | } | ||
630 | else | ||
631 | { | ||
632 | //more than one packet so split file up | ||
633 | ImageDataPacket im = new ImageDataPacket(); | ||
634 | im.ImageID.Packets = (ushort)req.NumPackets; | ||
635 | im.ImageID.ID = req.ImageInfo.FullID; | ||
636 | im.ImageID.Size = (uint)req.ImageInfo.Data.Length; | ||
637 | im.ImageData.Data = new byte[600]; | ||
638 | Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600); | ||
639 | im.ImageID.Codec = 2; | ||
640 | req.RequestUser.OutPacket(im); | ||
641 | req.PacketCounter++; | ||
642 | //req.ImageInfo.last_used = time; | ||
643 | //System.Console.WriteLine("sent first packet of texture: | ||
644 | // Console.WriteLine("sending packet 1 for " + req.ImageInfo.FullID.ToStringHyphenated()); | ||
645 | } | ||
646 | } | ||
647 | else | ||
648 | { | ||
649 | //Console.WriteLine("sending packet" + req.PacketCounter + "for " + req.ImageInfo.FullID.ToStringHyphenated()); | ||
650 | //send imagepacket | ||
651 | //more than one packet so split file up | ||
652 | ImagePacketPacket im = new ImagePacketPacket(); | ||
653 | im.ImageID.Packet = (ushort)req.PacketCounter; | ||
654 | im.ImageID.ID = req.ImageInfo.FullID; | ||
655 | int size = req.ImageInfo.Data.Length - 600 - 1000 * (req.PacketCounter - 1); | ||
656 | if (size > 1000) size = 1000; | ||
657 | im.ImageData.Data = new byte[size]; | ||
658 | Array.Copy(req.ImageInfo.Data, 600 + 1000 * (req.PacketCounter - 1), im.ImageData.Data, 0, size); | ||
659 | req.RequestUser.OutPacket(im); | ||
660 | req.PacketCounter++; | ||
661 | //req.ImageInfo.last_used = time; | ||
662 | //System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID); | ||
663 | } | ||
664 | |||
665 | } | ||
666 | } | ||
667 | } | ||
668 | } | ||
669 | |||
diff --git a/OpenSim/Region/Caches/Properties/AssemblyInfo.cs b/OpenSim/Region/Caches/Properties/AssemblyInfo.cs deleted file mode 100644 index 4ba42b9..0000000 --- a/OpenSim/Region/Caches/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.InteropServices; | ||
3 | // General Information about an assembly is controlled through the following | ||
4 | // set of attributes. Change these attribute values to modify the information | ||
5 | // associated with an assembly. | ||
6 | [assembly: AssemblyTitle("OpenSim.Region.Caches")] | ||
7 | [assembly: AssemblyDescription("")] | ||
8 | [assembly: AssemblyConfiguration("")] | ||
9 | [assembly: AssemblyCompany("")] | ||
10 | [assembly: AssemblyProduct("OpenSim.Region.Caches")] | ||
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
12 | [assembly: AssemblyTrademark("")] | ||
13 | [assembly: AssemblyCulture("")] | ||
14 | |||
15 | // Setting ComVisible to false makes the types in this assembly not visible | ||
16 | // to COM components. If you need to access a type in this assembly from | ||
17 | // COM, set the ComVisible attribute to true on that type. | ||
18 | [assembly: ComVisible(false)] | ||
19 | |||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
21 | [assembly: Guid("2b15ddbf-0341-49a6-85c0-cece268a4518")] | ||
22 | |||
23 | // Version information for an assembly consists of the following four values: | ||
24 | // | ||
25 | // Major Version | ||
26 | // Minor Version | ||
27 | // Build Number | ||
28 | // Revision | ||
29 | // | ||
30 | // You can specify all the values or you can default the Revision and Build Numbers | ||
31 | // by using the '*' as shown below: | ||
32 | [assembly: AssemblyVersion("1.0.0.0")] | ||
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs deleted file mode 100644 index 06a4bd5..0000000 --- a/OpenSim/Region/Capabilities/Caps.cs +++ /dev/null | |||
@@ -1,330 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.IO; | ||
33 | using libsecondlife; | ||
34 | using OpenSim.Framework.Servers; | ||
35 | using OpenSim.Framework.Types; | ||
36 | using OpenSim.Framework.Utilities; | ||
37 | using OpenSim.Region.Caches; | ||
38 | |||
39 | namespace OpenSim.Region.Capabilities | ||
40 | { | ||
41 | public delegate void UpLoadedTexture(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data); | ||
42 | |||
43 | public class Caps | ||
44 | { | ||
45 | private string m_httpListenerHostName; | ||
46 | private int m_httpListenPort; | ||
47 | private string m_capsObjectPath = "00001-"; | ||
48 | private string m_requestPath = "0000/"; | ||
49 | private string m_mapLayerPath = "0001/"; | ||
50 | private string m_newInventory = "0002/"; | ||
51 | // private string m_requestTexture = "0003/"; | ||
52 | //private string eventQueue = "0100/"; | ||
53 | private BaseHttpServer httpListener; | ||
54 | private LLUUID agentID; | ||
55 | private AssetCache assetCache; | ||
56 | private int eventQueueCount = 1; | ||
57 | private Queue<string> CapsEventQueue = new Queue<string>(); | ||
58 | |||
59 | public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent) | ||
60 | { | ||
61 | assetCache = assetCach; | ||
62 | m_capsObjectPath = capsPath; | ||
63 | httpListener = httpServer; | ||
64 | m_httpListenerHostName = httpListen; | ||
65 | m_httpListenPort = httpPort; | ||
66 | agentID = agent; | ||
67 | } | ||
68 | |||
69 | /// <summary> | ||
70 | /// | ||
71 | /// </summary> | ||
72 | public void RegisterHandlers() | ||
73 | { | ||
74 | Console.WriteLine("registering CAPS handlers"); | ||
75 | string capsBase = "/CAPS/" + m_capsObjectPath; | ||
76 | |||
77 | httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, this.GetMapLayer )); | ||
78 | httpListener.AddStreamHandler( new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", capsBase + m_newInventory, this.NewAgentInventoryRequest)); | ||
79 | |||
80 | AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); | ||
81 | } | ||
82 | |||
83 | [Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")] | ||
84 | private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod) | ||
85 | { | ||
86 | string capsBase = "/CAPS/" + m_capsObjectPath; | ||
87 | httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); | ||
88 | } | ||
89 | |||
90 | /// <summary> | ||
91 | /// | ||
92 | /// </summary> | ||
93 | /// <param name="request"></param> | ||
94 | /// <param name="path"></param> | ||
95 | /// <param name="param"></param> | ||
96 | /// <returns></returns> | ||
97 | public string CapsRequest(string request, string path, string param) | ||
98 | { | ||
99 | // Console.WriteLine("caps request " + request); | ||
100 | string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); | ||
101 | return result; | ||
102 | } | ||
103 | |||
104 | /// <summary> | ||
105 | /// | ||
106 | /// </summary> | ||
107 | /// <returns></returns> | ||
108 | protected LLSDCapsDetails GetCapabilities() | ||
109 | { | ||
110 | LLSDCapsDetails caps = new LLSDCapsDetails(); | ||
111 | string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; | ||
112 | caps.MapLayer = capsBaseUrl + m_mapLayerPath; | ||
113 | caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; | ||
114 | //caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; | ||
115 | // caps.ChatSessionRequest = capsBaseUrl + m_requestTexture; | ||
116 | return caps; | ||
117 | } | ||
118 | |||
119 | /// <summary> | ||
120 | /// | ||
121 | /// </summary> | ||
122 | /// <param name="mapReq"></param> | ||
123 | /// <returns></returns> | ||
124 | public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) | ||
125 | { | ||
126 | LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); | ||
127 | mapResponse.LayerData.Array.Add(this.GetLLSDMapLayerResponse()); | ||
128 | return mapResponse; | ||
129 | } | ||
130 | |||
131 | /// <summary> | ||
132 | /// | ||
133 | /// </summary> | ||
134 | /// <returns></returns> | ||
135 | protected LLSDMapLayer GetLLSDMapLayerResponse() | ||
136 | { | ||
137 | LLSDMapLayer mapLayer = new LLSDMapLayer(); | ||
138 | mapLayer.Right = 5000; | ||
139 | mapLayer.Top = 5000; | ||
140 | mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); | ||
141 | return mapLayer; | ||
142 | } | ||
143 | |||
144 | /// <summary> | ||
145 | /// | ||
146 | /// </summary> | ||
147 | /// <param name="request"></param> | ||
148 | /// <param name="path"></param> | ||
149 | /// <param name="param"></param> | ||
150 | /// <returns></returns> | ||
151 | public string RequestTexture(string request, string path, string param) | ||
152 | { | ||
153 | Console.WriteLine("texture request " + request); | ||
154 | // Needs implementing (added to remove compiler warning) | ||
155 | return ""; | ||
156 | } | ||
157 | |||
158 | #region EventQueue (Currently not enabled) | ||
159 | /// <summary> | ||
160 | /// | ||
161 | /// </summary> | ||
162 | /// <param name="request"></param> | ||
163 | /// <param name="path"></param> | ||
164 | /// <param name="param"></param> | ||
165 | /// <returns></returns> | ||
166 | public string ProcessEventQueue(string request, string path, string param) | ||
167 | { | ||
168 | string res = ""; | ||
169 | |||
170 | if (this.CapsEventQueue.Count > 0) | ||
171 | { | ||
172 | lock (this.CapsEventQueue) | ||
173 | { | ||
174 | string item = CapsEventQueue.Dequeue(); | ||
175 | res = item; | ||
176 | } | ||
177 | } | ||
178 | else | ||
179 | { | ||
180 | res = this.CreateEmptyEventResponse(); | ||
181 | } | ||
182 | return res; | ||
183 | } | ||
184 | |||
185 | /// <summary> | ||
186 | /// | ||
187 | /// </summary> | ||
188 | /// <param name="caps"></param> | ||
189 | /// <param name="ipAddressPort"></param> | ||
190 | /// <returns></returns> | ||
191 | public string CreateEstablishAgentComms(string caps, string ipAddressPort) | ||
192 | { | ||
193 | LLSDCapEvent eventItem = new LLSDCapEvent(); | ||
194 | eventItem.id = eventQueueCount; | ||
195 | //should be creating a EstablishAgentComms item, but there isn't a class for it yet | ||
196 | eventItem.events.Array.Add(new LLSDEmpty()); | ||
197 | string res = LLSDHelpers.SerialiseLLSDReply(eventItem); | ||
198 | eventQueueCount++; | ||
199 | |||
200 | this.CapsEventQueue.Enqueue(res); | ||
201 | return res; | ||
202 | } | ||
203 | |||
204 | /// <summary> | ||
205 | /// | ||
206 | /// </summary> | ||
207 | /// <returns></returns> | ||
208 | public string CreateEmptyEventResponse() | ||
209 | { | ||
210 | LLSDCapEvent eventItem = new LLSDCapEvent(); | ||
211 | eventItem.id = eventQueueCount; | ||
212 | eventItem.events.Array.Add(new LLSDEmpty()); | ||
213 | string res = LLSDHelpers.SerialiseLLSDReply(eventItem); | ||
214 | eventQueueCount++; | ||
215 | return res; | ||
216 | } | ||
217 | #endregion | ||
218 | |||
219 | /// <summary> | ||
220 | /// | ||
221 | /// </summary> | ||
222 | /// <param name="llsdRequest"></param> | ||
223 | /// <returns></returns> | ||
224 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) | ||
225 | { | ||
226 | // Console.WriteLine("asset upload request via CAPS"); | ||
227 | string assetName = llsdRequest.name; | ||
228 | string capsBase = "/CAPS/" + m_capsObjectPath; | ||
229 | LLUUID newAsset = LLUUID.Random(); | ||
230 | LLUUID newInvItem = LLUUID.Random(); | ||
231 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
232 | |||
233 | AssetUploader uploader = new AssetUploader(assetName, newAsset, newInvItem, capsBase + uploaderPath, this.httpListener); | ||
234 | httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | ||
235 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; | ||
236 | |||
237 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | ||
238 | uploadResponse.uploader = uploaderURL; | ||
239 | uploadResponse.state = "upload"; | ||
240 | uploader.OnUpLoad += this.UploadCompleteHandler; | ||
241 | return uploadResponse; | ||
242 | } | ||
243 | |||
244 | /// <summary> | ||
245 | /// | ||
246 | /// </summary> | ||
247 | /// <param name="assetID"></param> | ||
248 | /// <param name="inventoryItem"></param> | ||
249 | /// <param name="data"></param> | ||
250 | public void UploadCompleteHandler(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data) | ||
251 | { | ||
252 | AssetBase asset; | ||
253 | asset = new AssetBase(); | ||
254 | asset.FullID = assetID; | ||
255 | asset.Type = 0; | ||
256 | asset.InvType = 0; | ||
257 | asset.Name = assetName; | ||
258 | asset.Data = data; | ||
259 | this.assetCache.AddAsset(asset); | ||
260 | } | ||
261 | |||
262 | public class AssetUploader | ||
263 | { | ||
264 | public event UpLoadedTexture OnUpLoad; | ||
265 | |||
266 | private string uploaderPath = ""; | ||
267 | private LLUUID newAssetID; | ||
268 | private LLUUID inventoryItemID; | ||
269 | private BaseHttpServer httpListener; | ||
270 | private bool SaveImages = false; | ||
271 | private string m_assetName = ""; | ||
272 | |||
273 | /// <summary> | ||
274 | /// | ||
275 | /// </summary> | ||
276 | /// <param name="assetID"></param> | ||
277 | /// <param name="inventoryItem"></param> | ||
278 | /// <param name="path"></param> | ||
279 | /// <param name="httpServer"></param> | ||
280 | public AssetUploader(string assetName, LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer) | ||
281 | { | ||
282 | m_assetName = assetName; | ||
283 | newAssetID = assetID; | ||
284 | inventoryItemID = inventoryItem; | ||
285 | uploaderPath = path; | ||
286 | httpListener = httpServer; | ||
287 | } | ||
288 | |||
289 | /// <summary> | ||
290 | /// | ||
291 | /// </summary> | ||
292 | /// <param name="data"></param> | ||
293 | /// <param name="path"></param> | ||
294 | /// <param name="param"></param> | ||
295 | /// <returns></returns> | ||
296 | public string uploaderCaps(byte[] data, string path, string param) | ||
297 | { | ||
298 | LLUUID inv = this.inventoryItemID; | ||
299 | string res = ""; | ||
300 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | ||
301 | uploadComplete.new_asset = newAssetID.ToStringHyphenated(); | ||
302 | uploadComplete.new_inventory_item = inv; | ||
303 | uploadComplete.state = "complete"; | ||
304 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
305 | |||
306 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
307 | |||
308 | if(this.SaveImages) | ||
309 | this.SaveImageToFile(m_assetName + ".jp2", data); | ||
310 | |||
311 | if (OnUpLoad != null) | ||
312 | { | ||
313 | OnUpLoad(m_assetName, newAssetID, inv, data); | ||
314 | } | ||
315 | |||
316 | return res; | ||
317 | } | ||
318 | |||
319 | private void SaveImageToFile(string filename, byte[] data) | ||
320 | { | ||
321 | |||
322 | FileStream fs = File.Create(filename); | ||
323 | BinaryWriter bw = new BinaryWriter(fs); | ||
324 | bw.Write(data); | ||
325 | bw.Close(); | ||
326 | fs.Close(); | ||
327 | } | ||
328 | } | ||
329 | } | ||
330 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDArray.cs b/OpenSim/Region/Capabilities/LLSDArray.cs deleted file mode 100644 index d3e1979..0000000 --- a/OpenSim/Region/Capabilities/LLSDArray.cs +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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.Collections; | ||
29 | |||
30 | namespace OpenSim.Region.Capabilities | ||
31 | { | ||
32 | [LLSDType("ARRAY")] | ||
33 | public class LLSDArray | ||
34 | { | ||
35 | public ArrayList Array = new ArrayList(); | ||
36 | |||
37 | public LLSDArray() | ||
38 | { | ||
39 | |||
40 | } | ||
41 | } | ||
42 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Region/Capabilities/LLSDAssetUploadComplete.cs deleted file mode 100644 index 5718b8f..0000000 --- a/OpenSim/Region/Capabilities/LLSDAssetUploadComplete.cs +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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 libsecondlife; | ||
29 | |||
30 | namespace OpenSim.Region.Capabilities | ||
31 | { | ||
32 | [LLSDType("MAP")] | ||
33 | public class LLSDAssetUploadComplete | ||
34 | { | ||
35 | public string new_asset = ""; | ||
36 | public LLUUID new_inventory_item = LLUUID.Zero; | ||
37 | public string state = ""; | ||
38 | |||
39 | public LLSDAssetUploadComplete() | ||
40 | { | ||
41 | |||
42 | } | ||
43 | } | ||
44 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDAssetUploadRequest.cs b/OpenSim/Region/Capabilities/LLSDAssetUploadRequest.cs deleted file mode 100644 index 0096fb1..0000000 --- a/OpenSim/Region/Capabilities/LLSDAssetUploadRequest.cs +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenSim.Region.Capabilities | ||
7 | { | ||
8 | [LLSDMap] | ||
9 | public class LLSDAssetUploadRequest | ||
10 | { | ||
11 | public string asset_type = ""; | ||
12 | public string description = ""; | ||
13 | public LLUUID folder_id = LLUUID.Zero; | ||
14 | public string inventory_type = ""; | ||
15 | public string name = ""; | ||
16 | |||
17 | public LLSDAssetUploadRequest() | ||
18 | { | ||
19 | } | ||
20 | } | ||
21 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDAssetUploadResponse.cs b/OpenSim/Region/Capabilities/LLSDAssetUploadResponse.cs deleted file mode 100644 index 2a2a5d1..0000000 --- a/OpenSim/Region/Capabilities/LLSDAssetUploadResponse.cs +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Region.Capabilities | ||
6 | { | ||
7 | [LLSDMap] | ||
8 | public class LLSDAssetUploadResponse | ||
9 | { | ||
10 | public string uploader = ""; | ||
11 | public string state = ""; | ||
12 | |||
13 | public LLSDAssetUploadResponse() | ||
14 | { | ||
15 | |||
16 | } | ||
17 | } | ||
18 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDCapEvent.cs b/OpenSim/Region/Capabilities/LLSDCapEvent.cs deleted file mode 100644 index 2c2689b..0000000 --- a/OpenSim/Region/Capabilities/LLSDCapEvent.cs +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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 | namespace OpenSim.Region.Capabilities | ||
29 | { | ||
30 | [LLSDType("MAP")] | ||
31 | public class LLSDCapEvent | ||
32 | { | ||
33 | public int id = 0; | ||
34 | public LLSDArray events = new LLSDArray(); | ||
35 | |||
36 | public LLSDCapEvent() | ||
37 | { | ||
38 | |||
39 | } | ||
40 | } | ||
41 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs deleted file mode 100644 index 132b8f7..0000000 --- a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | namespace OpenSim.Region.Capabilities | ||
2 | { | ||
3 | [LLSDType("MAP")] | ||
4 | public class LLSDCapsDetails | ||
5 | { | ||
6 | public string MapLayer = ""; | ||
7 | public string NewFileAgentInventory = ""; | ||
8 | //public string EventQueueGet = ""; | ||
9 | //public string RequestTextureDownload = ""; | ||
10 | //public string ChatSessionRequest = ""; | ||
11 | |||
12 | public LLSDCapsDetails() | ||
13 | { | ||
14 | |||
15 | } | ||
16 | } | ||
17 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDEmpty.cs b/OpenSim/Region/Capabilities/LLSDEmpty.cs deleted file mode 100644 index ca27c9d..0000000 --- a/OpenSim/Region/Capabilities/LLSDEmpty.cs +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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 | namespace OpenSim.Region.Capabilities | ||
29 | { | ||
30 | [LLSDType("MAP")] | ||
31 | public class LLSDEmpty | ||
32 | { | ||
33 | public LLSDEmpty() | ||
34 | { | ||
35 | |||
36 | } | ||
37 | } | ||
38 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDHelpers.cs b/OpenSim/Region/Capabilities/LLSDHelpers.cs deleted file mode 100644 index efeb9b1..0000000 --- a/OpenSim/Region/Capabilities/LLSDHelpers.cs +++ /dev/null | |||
@@ -1,164 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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.IO; | ||
31 | using System.Reflection; | ||
32 | using System.Xml; | ||
33 | using libsecondlife; | ||
34 | |||
35 | namespace OpenSim.Region.Capabilities | ||
36 | { | ||
37 | public class LLSDHelpers | ||
38 | { | ||
39 | public static string SerialiseLLSDReply(object obj) | ||
40 | { | ||
41 | StringWriter sw = new StringWriter(); | ||
42 | XmlTextWriter writer = new XmlTextWriter(sw); | ||
43 | writer.Formatting = Formatting.None; | ||
44 | writer.WriteStartElement(String.Empty, "llsd", String.Empty); | ||
45 | SerializeLLSDType(writer, obj); | ||
46 | writer.WriteEndElement(); | ||
47 | writer.Close(); | ||
48 | return sw.ToString(); | ||
49 | } | ||
50 | |||
51 | public static void SerializeLLSDType(XmlTextWriter writer, object obj) | ||
52 | { | ||
53 | Type myType = obj.GetType(); | ||
54 | LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); | ||
55 | if (llsdattributes.Length > 0) | ||
56 | { | ||
57 | switch (llsdattributes[0].ObjectType) | ||
58 | { | ||
59 | case "MAP": | ||
60 | writer.WriteStartElement(String.Empty, "map", String.Empty); | ||
61 | FieldInfo[] fields = myType.GetFields(); | ||
62 | for (int i = 0; i < fields.Length; i++) | ||
63 | { | ||
64 | object fieldValue = fields[i].GetValue(obj); | ||
65 | LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false); | ||
66 | if (fieldAttributes.Length > 0) | ||
67 | { | ||
68 | writer.WriteStartElement(String.Empty, "key", String.Empty); | ||
69 | writer.WriteString(fields[i].Name); | ||
70 | writer.WriteEndElement(); | ||
71 | SerializeLLSDType(writer, fieldValue); | ||
72 | } | ||
73 | else | ||
74 | { | ||
75 | writer.WriteStartElement(String.Empty, "key", String.Empty); | ||
76 | writer.WriteString(fields[i].Name); | ||
77 | writer.WriteEndElement(); | ||
78 | LLSD.LLSDWriteOne(writer, fieldValue); | ||
79 | } | ||
80 | } | ||
81 | writer.WriteEndElement(); | ||
82 | break; | ||
83 | case "ARRAY": | ||
84 | // LLSDArray arrayObject = obj as LLSDArray; | ||
85 | // ArrayList a = arrayObject.Array; | ||
86 | ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); | ||
87 | if (a != null) | ||
88 | { | ||
89 | writer.WriteStartElement(String.Empty, "array", String.Empty); | ||
90 | foreach (object item in a) | ||
91 | { | ||
92 | SerializeLLSDType(writer, item); | ||
93 | } | ||
94 | writer.WriteEndElement(); | ||
95 | } | ||
96 | break; | ||
97 | } | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | LLSD.LLSDWriteOne(writer, obj); | ||
102 | } | ||
103 | } | ||
104 | |||
105 | public static object DeserialiseLLSDMap(Hashtable llsd, object obj) | ||
106 | { | ||
107 | Type myType = obj.GetType(); | ||
108 | LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); | ||
109 | if (llsdattributes.Length > 0) | ||
110 | { | ||
111 | switch (llsdattributes[0].ObjectType) | ||
112 | { | ||
113 | case "MAP": | ||
114 | IDictionaryEnumerator enumerator = llsd.GetEnumerator(); | ||
115 | while (enumerator.MoveNext()) | ||
116 | { | ||
117 | FieldInfo field = myType.GetField((string)enumerator.Key); | ||
118 | if (field != null) | ||
119 | { | ||
120 | if (enumerator.Value is Hashtable) | ||
121 | { | ||
122 | object fieldValue = field.GetValue(obj); | ||
123 | DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue); | ||
124 | } | ||
125 | else if (enumerator.Value is ArrayList) | ||
126 | { | ||
127 | object fieldValue = field.GetValue(obj); | ||
128 | fieldValue.GetType().GetField("Array").SetValue(fieldValue, enumerator.Value); | ||
129 | //TODO | ||
130 | // the LLSD map/array types in the array need to be deserialised | ||
131 | // but first we need to know the right class to deserialise them into. | ||
132 | } | ||
133 | else | ||
134 | { | ||
135 | field.SetValue(obj, enumerator.Value); | ||
136 | } | ||
137 | } | ||
138 | } | ||
139 | break; | ||
140 | } | ||
141 | } | ||
142 | return obj; | ||
143 | } | ||
144 | } | ||
145 | |||
146 | |||
147 | |||
148 | |||
149 | |||
150 | |||
151 | |||
152 | |||
153 | |||
154 | |||
155 | |||
156 | |||
157 | |||
158 | |||
159 | |||
160 | |||
161 | |||
162 | |||
163 | |||
164 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDMapLayer.cs b/OpenSim/Region/Capabilities/LLSDMapLayer.cs deleted file mode 100644 index e0c006c..0000000 --- a/OpenSim/Region/Capabilities/LLSDMapLayer.cs +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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 libsecondlife; | ||
29 | |||
30 | namespace OpenSim.Region.Capabilities | ||
31 | { | ||
32 | [LLSDType("MAP")] | ||
33 | public class LLSDMapLayer | ||
34 | { | ||
35 | public int Left = 0; | ||
36 | public int Right = 0; | ||
37 | public int Top = 0; | ||
38 | public int Bottom = 0; | ||
39 | public LLUUID ImageID = LLUUID.Zero; | ||
40 | |||
41 | public LLSDMapLayer() | ||
42 | { | ||
43 | |||
44 | } | ||
45 | } | ||
46 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs deleted file mode 100644 index 8b9837b..0000000 --- a/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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 | namespace OpenSim.Region.Capabilities | ||
29 | { | ||
30 | [LLSDType("MAP")] | ||
31 | public class LLSDMapLayerResponse | ||
32 | { | ||
33 | public LLSDMapRequest AgentData = new LLSDMapRequest(); | ||
34 | public LLSDArray LayerData = new LLSDArray(); | ||
35 | |||
36 | public LLSDMapLayerResponse() | ||
37 | { | ||
38 | |||
39 | } | ||
40 | } | ||
41 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDMapRequest.cs b/OpenSim/Region/Capabilities/LLSDMapRequest.cs deleted file mode 100644 index 8ac7943..0000000 --- a/OpenSim/Region/Capabilities/LLSDMapRequest.cs +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | namespace OpenSim.Region.Capabilities | ||
2 | { | ||
3 | [LLSDType("MAP")] | ||
4 | public class LLSDMapRequest | ||
5 | { | ||
6 | public int Flags = 0; | ||
7 | |||
8 | public LLSDMapRequest() | ||
9 | { | ||
10 | |||
11 | } | ||
12 | } | ||
13 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDMethod.cs b/OpenSim/Region/Capabilities/LLSDMethod.cs deleted file mode 100644 index 068d539..0000000 --- a/OpenSim/Region/Capabilities/LLSDMethod.cs +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Region.Capabilities | ||
6 | { | ||
7 | public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request); | ||
8 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDStreamHandler.cs b/OpenSim/Region/Capabilities/LLSDStreamHandler.cs deleted file mode 100644 index d98e23f..0000000 --- a/OpenSim/Region/Capabilities/LLSDStreamHandler.cs +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Framework.Servers; | ||
5 | using System.IO; | ||
6 | using System.Collections; | ||
7 | using libsecondlife; | ||
8 | |||
9 | namespace OpenSim.Region.Capabilities | ||
10 | { | ||
11 | public class LLSDStreamhandler<TRequest, TResponse> : BaseStreamHandler | ||
12 | where TRequest : new() | ||
13 | { | ||
14 | private LLSDMethod<TRequest, TResponse> m_method; | ||
15 | |||
16 | public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) | ||
17 | : base(httpMethod, path ) | ||
18 | { | ||
19 | m_method = method; | ||
20 | } | ||
21 | |||
22 | public override byte[] Handle(string path, Stream request) | ||
23 | { | ||
24 | //Encoding encoding = Encoding.UTF8; | ||
25 | //StreamReader streamReader = new StreamReader(request, false); | ||
26 | |||
27 | //string requestBody = streamReader.ReadToEnd(); | ||
28 | //streamReader.Close(); | ||
29 | |||
30 | Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request ); | ||
31 | TRequest llsdRequest = new TRequest(); | ||
32 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); | ||
33 | |||
34 | TResponse response = m_method(llsdRequest); | ||
35 | |||
36 | Encoding encoding = new UTF8Encoding(false); | ||
37 | |||
38 | return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) ); | ||
39 | |||
40 | } | ||
41 | } | ||
42 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDTest.cs b/OpenSim/Region/Capabilities/LLSDTest.cs deleted file mode 100644 index 78ccf67..0000000 --- a/OpenSim/Region/Capabilities/LLSDTest.cs +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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 | namespace OpenSim.Region.Capabilities | ||
29 | { | ||
30 | [LLSDType("MAP")] | ||
31 | public class LLSDTest | ||
32 | { | ||
33 | public int Test1 = 20; | ||
34 | public int Test2 = 10; | ||
35 | |||
36 | public LLSDTest() | ||
37 | { | ||
38 | |||
39 | } | ||
40 | } | ||
41 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDType.cs b/OpenSim/Region/Capabilities/LLSDType.cs deleted file mode 100644 index 04f4d9a..0000000 --- a/OpenSim/Region/Capabilities/LLSDType.cs +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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 | |||
30 | namespace OpenSim.Region.Capabilities | ||
31 | { | ||
32 | [AttributeUsage(AttributeTargets.Class)] | ||
33 | public class LLSDType : Attribute | ||
34 | { | ||
35 | protected string myType; | ||
36 | |||
37 | public LLSDType(string type) | ||
38 | { | ||
39 | myType = type; | ||
40 | |||
41 | } | ||
42 | |||
43 | public string ObjectType | ||
44 | { | ||
45 | get | ||
46 | { | ||
47 | return myType; | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | |||
52 | [AttributeUsage(AttributeTargets.Class)] | ||
53 | public class LLSDMap : LLSDType | ||
54 | { | ||
55 | public LLSDMap() : base( "MAP" ) | ||
56 | { | ||
57 | } | ||
58 | } | ||
59 | } | ||
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index c99c365..956f2b4 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -81,8 +81,10 @@ namespace OpenSim.Region.ClientStack | |||
81 | public event RequestMapBlocks OnRequestMapBlocks; | 81 | public event RequestMapBlocks OnRequestMapBlocks; |
82 | public event TeleportLocationRequest OnTeleportLocationRequest; | 82 | public event TeleportLocationRequest OnTeleportLocationRequest; |
83 | 83 | ||
84 | public event CreateNewInventoryItem OnCreateNewInventoryItem; | ||
84 | public event CreateInventoryFolder OnCreateNewInventoryFolder; | 85 | public event CreateInventoryFolder OnCreateNewInventoryFolder; |
85 | public event FetchInventoryDescendents OnFetchInventoryDescendents; | 86 | public event FetchInventoryDescendents OnFetchInventoryDescendents; |
87 | public event FetchInventory OnFetchInventory; | ||
86 | public event RequestTaskInventory OnRequestTaskInventory; | 88 | public event RequestTaskInventory OnRequestTaskInventory; |
87 | 89 | ||
88 | public event UUIDNameRequest OnNameFromUUIDRequest; | 90 | public event UUIDNameRequest OnNameFromUUIDRequest; |
@@ -549,7 +551,7 @@ namespace OpenSim.Region.ClientStack | |||
549 | 551 | ||
550 | } | 552 | } |
551 | 553 | ||
552 | public void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item) | 554 | public void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item) |
553 | { | 555 | { |
554 | Encoding enc = Encoding.ASCII; | 556 | Encoding enc = Encoding.ASCII; |
555 | uint FULL_MASK_PERMISSIONS = 2147483647; | 557 | uint FULL_MASK_PERMISSIONS = 2147483647; |
diff --git a/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs b/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs index 109f7e6..a785eff 100644 --- a/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs +++ b/OpenSim/Region/ClientStack/ClientView.AgentAssetUpload.cs | |||
@@ -33,7 +33,8 @@ using OpenSim.Assets; | |||
33 | using OpenSim.Framework.Interfaces; | 33 | using OpenSim.Framework.Interfaces; |
34 | using OpenSim.Framework.Types; | 34 | using OpenSim.Framework.Types; |
35 | using OpenSim.Framework.Utilities; | 35 | using OpenSim.Framework.Utilities; |
36 | using OpenSim.Region.Caches; | 36 | using OpenSim.Framework.Communications.Caches; |
37 | |||
37 | 38 | ||
38 | namespace OpenSim.Region.ClientStack | 39 | namespace OpenSim.Region.ClientStack |
39 | { | 40 | { |
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 267e7ee..1613aa1 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | |||
@@ -387,11 +387,9 @@ namespace OpenSim.Region.ClientStack | |||
387 | { | 387 | { |
388 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; | 388 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; |
389 | this.OnCreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); | 389 | this.OnCreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); |
390 | //m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); | ||
391 | } | 390 | } |
392 | break; | 391 | break; |
393 | case PacketType.CreateInventoryItem: | 392 | case PacketType.CreateInventoryItem: |
394 | //Console.WriteLine(Pack.ToString()); | ||
395 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; | 393 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; |
396 | if (createItem.InventoryBlock.TransactionID != LLUUID.Zero) | 394 | if (createItem.InventoryBlock.TransactionID != LLUUID.Zero) |
397 | { | 395 | { |
@@ -399,20 +397,28 @@ namespace OpenSim.Region.ClientStack | |||
399 | } | 397 | } |
400 | else | 398 | else |
401 | { | 399 | { |
402 | // Console.Write(Pack.ToString()); | 400 | if (this.OnCreateNewInventoryItem != null) |
403 | this.CreateInventoryItem(createItem); | 401 | { |
402 | this.OnCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID, createItem.InventoryBlock.FolderID, createItem.InventoryBlock.CallbackID, | ||
403 | Util.FieldToString(createItem.InventoryBlock.Description), Util.FieldToString(createItem.InventoryBlock.Name), createItem.InventoryBlock.InvType, | ||
404 | createItem.InventoryBlock.Type, createItem.InventoryBlock.WearableType, createItem.InventoryBlock.NextOwnerMask); | ||
405 | } | ||
404 | } | 406 | } |
405 | break; | 407 | break; |
406 | case PacketType.FetchInventory: | 408 | case PacketType.FetchInventory: |
407 | //Console.WriteLine("fetch item packet"); | 409 | if (this.OnFetchInventory != null) |
408 | FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; | 410 | { |
409 | m_inventoryCache.FetchInventory(this, FetchInventory); | 411 | FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; |
412 | for (int i = 0; i < FetchInventory.InventoryData.Length; i++) | ||
413 | { | ||
414 | this.OnFetchInventory(this, FetchInventory.InventoryData[i].ItemID, FetchInventory.InventoryData[i].OwnerID); | ||
415 | } | ||
416 | } | ||
410 | break; | 417 | break; |
411 | case PacketType.FetchInventoryDescendents: | 418 | case PacketType.FetchInventoryDescendents: |
412 | if (this.OnFetchInventoryDescendents != null) | 419 | if (this.OnFetchInventoryDescendents != null) |
413 | { | 420 | { |
414 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; | 421 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; |
415 | // m_inventoryCache.FetchInventoryDescendents(this, Fetch); | ||
416 | this.OnFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID, Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems, Fetch.InventoryData.SortOrder); | 422 | this.OnFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID, Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems, Fetch.InventoryData.SortOrder); |
417 | } | 423 | } |
418 | break; | 424 | break; |
@@ -450,7 +456,6 @@ namespace OpenSim.Region.ClientStack | |||
450 | } | 456 | } |
451 | break; | 457 | break; |
452 | case PacketType.RequestTaskInventory: | 458 | case PacketType.RequestTaskInventory: |
453 | // Console.WriteLine(Pack.ToString()); | ||
454 | RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; | 459 | RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; |
455 | if (this.OnRequestTaskInventory != null) | 460 | if (this.OnRequestTaskInventory != null) |
456 | { | 461 | { |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 90ca600..3fd3a46 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -40,7 +40,8 @@ using OpenSim.Framework.Interfaces; | |||
40 | using OpenSim.Framework.Inventory; | 40 | using OpenSim.Framework.Inventory; |
41 | using OpenSim.Framework.Types; | 41 | using OpenSim.Framework.Types; |
42 | using OpenSim.Framework.Utilities; | 42 | using OpenSim.Framework.Utilities; |
43 | using OpenSim.Region.Caches; | 43 | using OpenSim.Framework.Communications.Caches; |
44 | |||
44 | using Timer=System.Timers.Timer; | 45 | using Timer=System.Timers.Timer; |
45 | 46 | ||
46 | namespace OpenSim.Region.ClientStack | 47 | namespace OpenSim.Region.ClientStack |
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs index 7b15ab4..596cdbe 100644 --- a/OpenSim/Region/ClientStack/PacketServer.cs +++ b/OpenSim/Region/ClientStack/PacketServer.cs | |||
@@ -33,7 +33,7 @@ using OpenSim.Assets; | |||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Types; | 34 | using OpenSim.Framework.Types; |
35 | using OpenSim.Framework.Interfaces; | 35 | using OpenSim.Framework.Interfaces; |
36 | using OpenSim.Region.Caches; | 36 | using OpenSim.Framework.Communications.Caches; |
37 | 37 | ||
38 | namespace OpenSim.Region.ClientStack | 38 | namespace OpenSim.Region.ClientStack |
39 | { | 39 | { |
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 1651ec2..d91cd95 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs | |||
@@ -36,11 +36,11 @@ using OpenSim.Framework.Interfaces; | |||
36 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
37 | using OpenSim.Framework.Types; | 37 | using OpenSim.Framework.Types; |
38 | using OpenSim.Physics.Manager; | 38 | using OpenSim.Physics.Manager; |
39 | using OpenSim.Region.Caches; | ||
40 | using OpenSim.Region.Environment; | 39 | using OpenSim.Region.Environment; |
41 | using libsecondlife; | 40 | using libsecondlife; |
42 | using OpenSim.Region.Environment.Scenes; | 41 | using OpenSim.Region.Environment.Scenes; |
43 | using OpenSim.Framework.Communications; | 42 | using OpenSim.Framework.Communications; |
43 | using OpenSim.Framework.Communications.Caches; | ||
44 | 44 | ||
45 | namespace OpenSim.Region.ClientStack | 45 | namespace OpenSim.Region.ClientStack |
46 | { | 46 | { |
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index 2c10df9..ec64bad 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs | |||
@@ -35,7 +35,7 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Framework.Types; | 35 | using OpenSim.Framework.Types; |
36 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
37 | using OpenSim.Framework.Interfaces; | 37 | using OpenSim.Framework.Interfaces; |
38 | using OpenSim.Region.Caches; | 38 | using OpenSim.Framework.Communications.Caches; |
39 | 39 | ||
40 | namespace OpenSim.Region.ClientStack | 40 | namespace OpenSim.Region.ClientStack |
41 | { | 41 | { |
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index 3ce0cc5..0c40453 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using OpenSim.Framework.Communications; | 28 | using OpenSim.Framework.Communications; |
29 | using OpenSim.Framework.Types; | 29 | using OpenSim.Framework.Types; |
30 | using OpenSim.Framework.Servers; | 30 | using OpenSim.Framework.Servers; |
31 | using OpenSim.Framework.Communications.Caches; | ||
31 | 32 | ||
32 | namespace OpenSim.Region.Communications.Local | 33 | namespace OpenSim.Region.Communications.Local |
33 | { | 34 | { |
@@ -36,8 +37,8 @@ namespace OpenSim.Region.Communications.Local | |||
36 | public LocalBackEndServices SandBoxServices = new LocalBackEndServices(); | 37 | public LocalBackEndServices SandBoxServices = new LocalBackEndServices(); |
37 | public LocalUserServices UserServices; | 38 | public LocalUserServices UserServices; |
38 | 39 | ||
39 | public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer ) | 40 | public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache ) |
40 | : base(serversInfo, httpServer) | 41 | : base(serversInfo, httpServer, assetCache) |
41 | { | 42 | { |
42 | UserServices = new LocalUserServices(this, serversInfo); | 43 | UserServices = new LocalUserServices(this, serversInfo); |
43 | UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll"); | 44 | UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll"); |
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 9322f3b..47968fc 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs | |||
@@ -161,12 +161,21 @@ namespace OpenSim.Region.Communications.Local | |||
161 | /// <param name="agentID"></param> | 161 | /// <param name="agentID"></param> |
162 | /// <param name="position"></param> | 162 | /// <param name="position"></param> |
163 | /// <returns></returns> | 163 | /// <returns></returns> |
164 | public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) | 164 | public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) |
165 | { | 165 | { |
166 | if (this.regionHosts.ContainsKey(regionHandle)) | 166 | if (this.regionHosts.ContainsKey(regionHandle)) |
167 | { | 167 | { |
168 | // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); | 168 | // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); |
169 | this.regionHosts[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); | 169 | this.regionHosts[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); |
170 | return true; | ||
171 | } | ||
172 | return false; | ||
173 | } | ||
174 | |||
175 | public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentID) | ||
176 | { | ||
177 | if (this.regionHosts.ContainsKey(regionHandle)) | ||
178 | { | ||
170 | return true; | 179 | return true; |
171 | } | 180 | } |
172 | return false; | 181 | return false; |
diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index 9df0901..47d3148 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs | |||
@@ -1,13 +1,15 @@ | |||
1 | using OpenSim.Framework.Communications; | 1 | using OpenSim.Framework.Communications; |
2 | using OpenSim.Framework.Types; | 2 | using OpenSim.Framework.Types; |
3 | using OpenSim.Framework.Servers; | 3 | using OpenSim.Framework.Servers; |
4 | using OpenSim.Framework.Communications.Caches; | ||
5 | |||
4 | 6 | ||
5 | namespace OpenSim.Region.Communications.OGS1 | 7 | namespace OpenSim.Region.Communications.OGS1 |
6 | { | 8 | { |
7 | public class CommunicationsOGS1 : CommunicationsManager | 9 | public class CommunicationsOGS1 : CommunicationsManager |
8 | { | 10 | { |
9 | 11 | ||
10 | public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer ) :base(serversInfo, httpServer) | 12 | public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache ) :base(serversInfo, httpServer, assetCache) |
11 | { | 13 | { |
12 | OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer); | 14 | OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer); |
13 | GridServer = gridInterComms; | 15 | GridServer = gridInterComms; |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index aadf85a..69d0d57 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -382,13 +382,13 @@ namespace OpenSim.Region.Communications.OGS1 | |||
382 | /// <param name="agentID"></param> | 382 | /// <param name="agentID"></param> |
383 | /// <param name="position"></param> | 383 | /// <param name="position"></param> |
384 | /// <returns></returns> | 384 | /// <returns></returns> |
385 | public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) | 385 | public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) |
386 | { | 386 | { |
387 | try | 387 | try |
388 | { | 388 | { |
389 | if (this.listeners.ContainsKey(regionHandle)) | 389 | if (this.listeners.ContainsKey(regionHandle)) |
390 | { | 390 | { |
391 | this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); | 391 | this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); |
392 | return true; | 392 | return true; |
393 | } | 393 | } |
394 | RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle); | 394 | RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle); |
@@ -400,7 +400,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
400 | "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); | 400 | "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); |
401 | if (remObject != null) | 401 | if (remObject != null) |
402 | { | 402 | { |
403 | retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position); | 403 | retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); |
404 | } | 404 | } |
405 | else | 405 | else |
406 | { | 406 | { |
@@ -420,6 +420,15 @@ namespace OpenSim.Region.Communications.OGS1 | |||
420 | return false; | 420 | return false; |
421 | } | 421 | } |
422 | } | 422 | } |
423 | |||
424 | public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentID) | ||
425 | { | ||
426 | if (this.listeners.ContainsKey(regionHandle)) | ||
427 | { | ||
428 | return true; | ||
429 | } | ||
430 | return false; | ||
431 | } | ||
423 | #endregion | 432 | #endregion |
424 | 433 | ||
425 | #region Methods triggered by calls from external instances | 434 | #region Methods triggered by calls from external instances |
@@ -453,13 +462,13 @@ namespace OpenSim.Region.Communications.OGS1 | |||
453 | /// <param name="agentID"></param> | 462 | /// <param name="agentID"></param> |
454 | /// <param name="position"></param> | 463 | /// <param name="position"></param> |
455 | /// <returns></returns> | 464 | /// <returns></returns> |
456 | public bool IncomingArrival(ulong regionHandle, LLUUID agentID, LLVector3 position) | 465 | public bool IncomingArrival(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) |
457 | { | 466 | { |
458 | try | 467 | try |
459 | { | 468 | { |
460 | if (this.listeners.ContainsKey(regionHandle)) | 469 | if (this.listeners.ContainsKey(regionHandle)) |
461 | { | 470 | { |
462 | this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); | 471 | this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); |
463 | return true; | 472 | return true; |
464 | } | 473 | } |
465 | } | 474 | } |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs index 87d62c8..ae08e9c 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs | |||
@@ -5,7 +5,7 @@ using OpenSim.Framework.Types; | |||
5 | namespace OpenSim.Region.Communications.OGS1 | 5 | namespace OpenSim.Region.Communications.OGS1 |
6 | { | 6 | { |
7 | public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); | 7 | public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); |
8 | public delegate bool ExpectArrival(ulong regionHandle, LLUUID agentID, LLVector3 position); | 8 | public delegate bool ExpectArrival(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); |
9 | 9 | ||
10 | public sealed class InterRegionSingleton | 10 | public sealed class InterRegionSingleton |
11 | { | 11 | { |
@@ -39,11 +39,11 @@ namespace OpenSim.Region.Communications.OGS1 | |||
39 | return false; | 39 | return false; |
40 | } | 40 | } |
41 | 41 | ||
42 | public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) | 42 | public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) |
43 | { | 43 | { |
44 | if (OnArrival != null) | 44 | if (OnArrival != null) |
45 | { | 45 | { |
46 | return OnArrival(regionHandle, agentID, position); | 46 | return OnArrival(regionHandle, agentID, position, isFlying); |
47 | } | 47 | } |
48 | return false; | 48 | return false; |
49 | } | 49 | } |
@@ -69,11 +69,11 @@ namespace OpenSim.Region.Communications.OGS1 | |||
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) | 72 | public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) |
73 | { | 73 | { |
74 | try | 74 | try |
75 | { | 75 | { |
76 | return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position); | 76 | return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); |
77 | } | 77 | } |
78 | catch (System.Runtime.Remoting.RemotingException e) | 78 | catch (System.Runtime.Remoting.RemotingException e) |
79 | { | 79 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index f421529..93e4959 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs | |||
@@ -587,6 +587,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
587 | 587 | ||
588 | #endregion | 588 | #endregion |
589 | 589 | ||
590 | #region Inventory | ||
591 | public void GetInventory(IClientAPI client, uint localID) | ||
592 | { | ||
593 | if (localID == this.m_localId) | ||
594 | { | ||
595 | client.SendTaskInventory(this.m_uuid, 0, new byte[0]); | ||
596 | } | ||
597 | } | ||
598 | #endregion | ||
599 | |||
590 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) | 600 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) |
591 | { | 601 | { |
592 | this.m_Shape.ExtraParams = new byte[data.Length + 7]; | 602 | this.m_Shape.ExtraParams = new byte[data.Length + 7]; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index e963737..126b636 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -26,11 +26,14 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using libsecondlife; | 31 | using libsecondlife; |
31 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
32 | using OpenSim.Framework.Interfaces; | 33 | using OpenSim.Framework.Interfaces; |
33 | using OpenSim.Framework.Types; | 34 | using OpenSim.Framework.Types; |
35 | using OpenSim.Framework.Communications.Caches; | ||
36 | using OpenSim.Framework.Data; | ||
34 | 37 | ||
35 | namespace OpenSim.Region.Environment.Scenes | 38 | namespace OpenSim.Region.Environment.Scenes |
36 | { | 39 | { |
@@ -139,7 +142,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
139 | /// <param name="fromAgentID"></param> | 142 | /// <param name="fromAgentID"></param> |
140 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | 143 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) |
141 | { | 144 | { |
142 | ScenePresence avatar = null; | 145 | ScenePresence avatar = null; |
143 | if (this.Avatars.ContainsKey(fromAgentID)) | 146 | if (this.Avatars.ContainsKey(fromAgentID)) |
144 | { | 147 | { |
145 | avatar = this.Avatars[fromAgentID]; | 148 | avatar = this.Avatars[fromAgentID]; |
@@ -343,6 +346,29 @@ namespace OpenSim.Region.Environment.Scenes | |||
343 | } | 346 | } |
344 | } | 347 | } |
345 | } | 348 | } |
349 | |||
350 | /// <summary> | ||
351 | /// | ||
352 | /// </summary> | ||
353 | /// <param name="remoteClient"></param> | ||
354 | /// <param name="primLocalID"></param> | ||
355 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) | ||
356 | { | ||
357 | Primitive prim = null; | ||
358 | foreach (EntityBase ent in Entities.Values) | ||
359 | { | ||
360 | if (ent is SceneObject) | ||
361 | { | ||
362 | prim = ((SceneObject)ent).HasChildPrim(primLocalID); | ||
363 | if (prim != null) | ||
364 | { | ||
365 | prim.GetInventory(remoteClient, primLocalID); | ||
366 | break; | ||
367 | } | ||
368 | } | ||
369 | } | ||
370 | } | ||
371 | |||
346 | /// <summary> | 372 | /// <summary> |
347 | /// | 373 | /// |
348 | /// </summary> | 374 | /// </summary> |
@@ -623,6 +649,50 @@ namespace OpenSim.Region.Environment.Scenes | |||
623 | } | 649 | } |
624 | 650 | ||
625 | /// <summary> | 651 | /// <summary> |
652 | /// temporary method to test out creating new inventory items | ||
653 | /// </summary> | ||
654 | /// <param name="remoteClient"></param> | ||
655 | /// <param name="transActionID"></param> | ||
656 | /// <param name="folderID"></param> | ||
657 | /// <param name="callbackID"></param> | ||
658 | /// <param name="description"></param> | ||
659 | /// <param name="name"></param> | ||
660 | /// <param name="invType"></param> | ||
661 | /// <param name="type"></param> | ||
662 | /// <param name="wearableType"></param> | ||
663 | /// <param name="nextOwnerMask"></param> | ||
664 | public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) | ||
665 | { | ||
666 | CachedUserInfo userInfo = commsManager.UserProfilesCache.GetUserDetails(remoteClient.AgentId); | ||
667 | if (userInfo != null) | ||
668 | { | ||
669 | AssetBase asset = new AssetBase(); | ||
670 | asset.Name = name; | ||
671 | asset.Description = description; | ||
672 | asset.InvType = invType; | ||
673 | asset.Type = type; | ||
674 | asset.FullID = LLUUID.Random(); | ||
675 | asset.Data = new byte[0]; | ||
676 | this.assetCache.AddAsset(asset); | ||
677 | |||
678 | InventoryItemBase item = new InventoryItemBase(); | ||
679 | item.avatarID = remoteClient.AgentId; | ||
680 | item.creatorsID = remoteClient.AgentId; | ||
681 | item.inventoryID = LLUUID.Random(); | ||
682 | item.assetID = asset.FullID; | ||
683 | item.inventoryDescription = description; | ||
684 | item.inventoryName = name; | ||
685 | item.type = invType; | ||
686 | item.parentFolderID = folderID; | ||
687 | item.inventoryCurrentPermissions = 2147483647; | ||
688 | item.inventoryNextPermissions = nextOwnerMask; | ||
689 | |||
690 | userInfo.ItemReceive(remoteClient.AgentId, item); | ||
691 | remoteClient.SendInventoryItemUpdate(item); | ||
692 | } | ||
693 | } | ||
694 | |||
695 | /// <summary> | ||
626 | /// Sends prims to a client | 696 | /// Sends prims to a client |
627 | /// </summary> | 697 | /// </summary> |
628 | /// <param name="RemoteClient">Client to send to</param> | 698 | /// <param name="RemoteClient">Client to send to</param> |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 64676f0..518a53f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -37,7 +37,7 @@ using OpenSim.Framework.Interfaces; | |||
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | using OpenSim.Framework.Types; | 38 | using OpenSim.Framework.Types; |
39 | using OpenSim.Physics.Manager; | 39 | using OpenSim.Physics.Manager; |
40 | using OpenSim.Region.Caches; | 40 | using OpenSim.Framework.Communications.Caches; |
41 | using OpenSim.Region.Environment.LandManagement; | 41 | using OpenSim.Region.Environment.LandManagement; |
42 | using OpenSim.Region.Scripting; | 42 | using OpenSim.Region.Scripting; |
43 | using OpenSim.Region.Terrain; | 43 | using OpenSim.Region.Terrain; |
@@ -550,13 +550,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
550 | m_estateManager.sendRegionHandshake(client); | 550 | m_estateManager.sendRegionHandshake(client); |
551 | CreateAndAddScenePresence(client); | 551 | CreateAndAddScenePresence(client); |
552 | m_LandManager.sendParcelOverlay(client); | 552 | m_LandManager.sendParcelOverlay(client); |
553 | //commsManager.UserProfilesCache.AddNewUser(client.AgentId); | 553 | commsManager.UserProfilesCache.AddNewUser(client.AgentId); |
554 | } | 554 | } |
555 | 555 | ||
556 | protected virtual void SubscribeToClientEvents(IClientAPI client) | 556 | protected virtual void SubscribeToClientEvents(IClientAPI client) |
557 | { | 557 | { |
558 | client.OnRegionHandShakeReply += SendLayerData; | 558 | client.OnRegionHandShakeReply += SendLayerData; |
559 | //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); | 559 | //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); |
560 | client.OnModifyTerrain += ModifyTerrain; | ||
560 | client.OnChatFromViewer += SimChat; | 561 | client.OnChatFromViewer += SimChat; |
561 | client.OnInstantMessage += InstantMessage; | 562 | client.OnInstantMessage += InstantMessage; |
562 | client.OnRequestWearables += InformClientOfNeighbours; | 563 | client.OnRequestWearables += InformClientOfNeighbours; |
@@ -592,9 +593,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
592 | new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest); | 593 | new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest); |
593 | 594 | ||
594 | client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); | 595 | client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); |
595 | 596 | ||
596 | //client.OnCreateNewInventoryFolder += commsManager.UserProfilesCache.HandleCreateInventoryFolder; | 597 | // client.OnCreateNewInventoryItem += CreateNewInventoryItem; |
598 | // client.OnCreateNewInventoryFolder += commsManager.UserProfilesCache.HandleCreateInventoryFolder; | ||
597 | // client.OnFetchInventoryDescendents += commsManager.UserProfilesCache.HandleFecthInventoryDescendents; | 599 | // client.OnFetchInventoryDescendents += commsManager.UserProfilesCache.HandleFecthInventoryDescendents; |
600 | // client.OnRequestTaskInventory += RequestTaskInventory; | ||
598 | } | 601 | } |
599 | 602 | ||
600 | protected ScenePresence CreateAndAddScenePresence(IClientAPI client) | 603 | protected ScenePresence CreateAndAddScenePresence(IClientAPI client) |
@@ -819,13 +822,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
819 | } | 822 | } |
820 | } | 823 | } |
821 | 824 | ||
822 | public void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) | 825 | public void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) |
823 | { | 826 | { |
824 | if (regionHandle == m_regInfo.RegionHandle) | 827 | if (regionHandle == m_regInfo.RegionHandle) |
825 | { | 828 | { |
826 | if (Avatars.ContainsKey(agentID)) | 829 | if (Avatars.ContainsKey(agentID)) |
827 | { | 830 | { |
828 | Avatars[agentID].MakeAvatar(position); | 831 | Avatars[agentID].MakeAvatar(position, isFlying); |
829 | } | 832 | } |
830 | } | 833 | } |
831 | } | 834 | } |
@@ -909,7 +912,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
909 | agent.startpos = new LLVector3(128, 128, 70); | 912 | agent.startpos = new LLVector3(128, 128, 70); |
910 | agent.child = true; | 913 | agent.child = true; |
911 | commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); | 914 | commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); |
912 | commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); | 915 | commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position, false); |
913 | 916 | ||
914 | remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); | 917 | remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); |
915 | } | 918 | } |
@@ -922,9 +925,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
922 | /// <param name="regionhandle"></param> | 925 | /// <param name="regionhandle"></param> |
923 | /// <param name="agentID"></param> | 926 | /// <param name="agentID"></param> |
924 | /// <param name="position"></param> | 927 | /// <param name="position"></param> |
925 | public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) | 928 | public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying) |
926 | { | 929 | { |
927 | return commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); | 930 | return commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying); |
928 | } | 931 | } |
929 | 932 | ||
930 | public void performParcelPrimCountUpdate() | 933 | public void performParcelPrimCountUpdate() |
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index c91c654..3c2193e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs | |||
@@ -32,7 +32,7 @@ using libsecondlife; | |||
32 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
33 | using OpenSim.Framework.Interfaces; | 33 | using OpenSim.Framework.Interfaces; |
34 | using OpenSim.Framework.Types; | 34 | using OpenSim.Framework.Types; |
35 | using OpenSim.Region.Caches; | 35 | using OpenSim.Framework.Communications.Caches; |
36 | using OpenSim.Region.Terrain; | 36 | using OpenSim.Region.Terrain; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | 38 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 294087f..d513634 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs | |||
@@ -40,13 +40,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
40 | private Encoding enc = Encoding.ASCII; | 40 | private Encoding enc = Encoding.ASCII; |
41 | private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group | 41 | private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group |
42 | public Primitive rootPrimitive; | 42 | public Primitive rootPrimitive; |
43 | private new Scene m_world; | ||
44 | protected ulong m_regionHandle; | 43 | protected ulong m_regionHandle; |
45 | 44 | ||
46 | private bool physicsEnabled = false; // HOUSEKEEPING : Do we really need this? | ||
47 | private PhysicsScene m_PhysScene; // HOUSEKEEPING : Do we really need this? | ||
48 | private PhysicsActor m_PhysActor; // HOUSEKEEPING : Do we really need this? | ||
49 | |||
50 | private EventManager m_eventManager; | 45 | private EventManager m_eventManager; |
51 | 46 | ||
52 | public bool isSelected = false; | 47 | public bool isSelected = false; |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 2bb4fb2..e81ac7b 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -66,6 +66,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
66 | private IScenePresenceBody m_body; // HOUSEKEEPING : Do we really need this? | 66 | private IScenePresenceBody m_body; // HOUSEKEEPING : Do we really need this? |
67 | 67 | ||
68 | protected RegionInfo m_regionInfo; | 68 | protected RegionInfo m_regionInfo; |
69 | protected ulong crossingFromRegion = 0; | ||
69 | 70 | ||
70 | private Vector3[] Dir_Vectors = new Vector3[6]; | 71 | private Vector3[] Dir_Vectors = new Vector3[6]; |
71 | private enum Dir_ControlFlags | 72 | private enum Dir_ControlFlags |
@@ -183,10 +184,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
183 | /// | 184 | /// |
184 | /// </summary> | 185 | /// </summary> |
185 | /// <param name="pos"></param> | 186 | /// <param name="pos"></param> |
186 | public void MakeAvatar(LLVector3 pos) | 187 | public void MakeAvatar(LLVector3 pos, bool isFlying) |
187 | { | 188 | { |
188 | //this.childAvatar = false; | 189 | //this.childAvatar = false; |
189 | this.Pos = pos; | 190 | this.Pos = pos; |
191 | this._physActor.Flying = isFlying; | ||
190 | this.newAvatar = true; | 192 | this.newAvatar = true; |
191 | this.childAgent = false; | 193 | this.childAgent = false; |
192 | } | 194 | } |
@@ -194,8 +196,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
194 | protected void MakeChildAgent() | 196 | protected void MakeChildAgent() |
195 | { | 197 | { |
196 | this.Velocity = new LLVector3(0, 0, 0); | 198 | this.Velocity = new LLVector3(0, 0, 0); |
197 | this.Pos = new LLVector3(128, 128, 70); | ||
198 | this.childAgent = true; | 199 | this.childAgent = true; |
200 | //this.Pos = new LLVector3(128, 128, 70); | ||
199 | } | 201 | } |
200 | 202 | ||
201 | /// <summary> | 203 | /// <summary> |
@@ -551,11 +553,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
551 | RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle); | 553 | RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle); |
552 | if (neighbourRegion != null) | 554 | if (neighbourRegion != null) |
553 | { | 555 | { |
554 | bool res = this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos); | 556 | bool res = this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos, this._physActor.Flying); |
555 | if (res) | 557 | if (res) |
556 | { | 558 | { |
557 | this.MakeChildAgent(); | ||
558 | this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint); | 559 | this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint); |
560 | this.MakeChildAgent(); | ||
559 | } | 561 | } |
560 | } | 562 | } |
561 | } | 563 | } |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index e64d9f0..b8e6af5 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -66,8 +66,10 @@ namespace SimpleApp | |||
66 | public event NewAvatar OnNewAvatar; | 66 | public event NewAvatar OnNewAvatar; |
67 | public event GenericCall6 OnRemoveAvatar; | 67 | public event GenericCall6 OnRemoveAvatar; |
68 | 68 | ||
69 | public event CreateNewInventoryItem OnCreateNewInventoryItem; | ||
69 | public event CreateInventoryFolder OnCreateNewInventoryFolder; | 70 | public event CreateInventoryFolder OnCreateNewInventoryFolder; |
70 | public event FetchInventoryDescendents OnFetchInventoryDescendents; | 71 | public event FetchInventoryDescendents OnFetchInventoryDescendents; |
72 | public event FetchInventory OnFetchInventory; | ||
71 | public event RequestTaskInventory OnRequestTaskInventory; | 73 | public event RequestTaskInventory OnRequestTaskInventory; |
72 | 74 | ||
73 | public event UUIDNameRequest OnNameFromUUIDRequest; | 75 | public event UUIDNameRequest OnNameFromUUIDRequest; |
@@ -142,7 +144,7 @@ namespace SimpleApp | |||
142 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) { } | 144 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) { } |
143 | 145 | ||
144 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { } | 146 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { } |
145 | public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item) { } | 147 | public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item) { } |
146 | public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } | 148 | public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } |
147 | public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } | 149 | public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } |
148 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { } | 150 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { } |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index 6704a19..1a69e74 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs | |||
@@ -5,10 +5,11 @@ using OpenSim.Framework.Communications; | |||
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Framework.Servers; | 6 | using OpenSim.Framework.Servers; |
7 | using OpenSim.Framework.Types; | 7 | using OpenSim.Framework.Types; |
8 | using OpenSim.Region.Caches; | 8 | |
9 | using OpenSim.Region.Environment.Scenes; | 9 | using OpenSim.Region.Environment.Scenes; |
10 | using OpenSim.Region.Terrain; | 10 | using OpenSim.Region.Terrain; |
11 | using OpenSim.Region.Environment; | 11 | using OpenSim.Region.Environment; |
12 | using OpenSim.Framework.Communications.Caches; | ||
12 | 13 | ||
13 | using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; | 14 | using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; |
14 | 15 | ||
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 5c16d6b..a5bc999 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs | |||
@@ -8,10 +8,11 @@ using OpenSim.Framework.Interfaces; | |||
8 | using OpenSim.Framework.Servers; | 8 | using OpenSim.Framework.Servers; |
9 | using OpenSim.Framework.Types; | 9 | using OpenSim.Framework.Types; |
10 | using OpenSim.Physics.Manager; | 10 | using OpenSim.Physics.Manager; |
11 | using OpenSim.Region.Caches; | 11 | |
12 | using OpenSim.Region.Capabilities; | 12 | using OpenSim.Region.Capabilities; |
13 | using OpenSim.Region.ClientStack; | 13 | using OpenSim.Region.ClientStack; |
14 | using OpenSim.Region.Communications.Local; | 14 | using OpenSim.Region.Communications.Local; |
15 | using OpenSim.Framework.Communications.Caches; | ||
15 | using OpenSim.Region.GridInterfaces.Local; | 16 | using OpenSim.Region.GridInterfaces.Local; |
16 | using System.Timers; | 17 | using System.Timers; |
17 | using OpenSim.Region.Environment.Scenes; | 18 | using OpenSim.Region.Environment.Scenes; |
@@ -47,7 +48,7 @@ namespace SimpleApp | |||
47 | { | 48 | { |
48 | base.StartUp(); | 49 | base.StartUp(); |
49 | 50 | ||
50 | m_commsManager = new CommunicationsLocal(m_networkServersInfo, m_httpServer); | 51 | m_commsManager = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache); |
51 | 52 | ||
52 | m_log.Notice(m_log.LineInfo); | 53 | m_log.Notice(m_log.LineInfo); |
53 | 54 | ||