aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs558
-rw-r--r--OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs205
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs12
5 files changed, 8 insertions, 771 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs b/OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs
deleted file mode 100644
index 8ab958a..0000000
--- a/OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs
+++ /dev/null
@@ -1,558 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the 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//moved to a module, left here until the module is found to have no problems
29/*
30using System;
31using System.Collections.Generic;
32using System.IO;
33using libsecondlife;
34using libsecondlife.Packets;
35using OpenSim.Framework.Servers;
36using OpenSim.Region.Capabilities;
37
38namespace OpenSim.Framework.Communications.Cache
39{
40 /// <summary>
41 /// Manage asset transactions for a single agent.
42 /// </summary>
43 public class AgentAssetTransactions
44 {
45 private static readonly log4net.ILog m_log
46 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
47
48 // Fields
49 public List<AssetCapsUploader> CapsUploaders = new List<AssetCapsUploader>();
50 public List<NoteCardCapsUpdate> NotecardUpdaters = new List<NoteCardCapsUpdate>();
51 public LLUUID UserID;
52 public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>();
53 public AgentAssetTransactionsManager Manager;
54 private bool m_dumpAssetsToFile;
55
56 // Methods
57 public AgentAssetTransactions(LLUUID agentID, AgentAssetTransactionsManager manager, bool dumpAssetsToFile)
58 {
59 UserID = agentID;
60 Manager = manager;
61 m_dumpAssetsToFile = dumpAssetsToFile;
62 }
63
64 public AssetCapsUploader RequestCapsUploader()
65 {
66 AssetCapsUploader uploader = new AssetCapsUploader();
67 CapsUploaders.Add(uploader);
68 return uploader;
69 }
70
71 public NoteCardCapsUpdate RequestNoteCardUpdater()
72 {
73 NoteCardCapsUpdate update = new NoteCardCapsUpdate();
74 NotecardUpdaters.Add(update);
75 return update;
76 }
77
78 public AssetXferUploader RequestXferUploader(LLUUID transactionID)
79 {
80 if (!XferUploaders.ContainsKey(transactionID))
81 {
82 AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile);
83
84 lock (XferUploaders)
85 {
86 XferUploaders.Add(transactionID, uploader);
87 }
88
89 return uploader;
90 }
91 return null;
92 }
93
94 public void HandleXfer(ulong xferID, uint packetID, byte[] data)
95 {
96 AssetXferUploader uploaderFound = null;
97
98 lock (XferUploaders)
99 {
100 foreach (AssetXferUploader uploader in XferUploaders.Values)
101 {
102 if (uploader.XferID == xferID)
103 {
104 if (uploader.HandleXferPacket(xferID, packetID, data))
105 {
106 uploaderFound = uploader;
107 }
108
109 break;
110 }
111 }
112
113 // Remove the uploader once the uploader is complete
114 //[don't think we can be sure a upload has finished from here, uploads are multi part things]
115 // [or maybe we can if we do more checking like data lenght checks]
116 if (uploaderFound != null)
117 {
118// m_log.InfoFormat(
119// "[ASSET TRANSACTIONS] Removing asset xfer uploader with transfer id {0}, transaction {1}",
120// xferID, uploaderFound.TransactionID);
121
122 // XferUploaders.Remove(uploaderFound.TransactionID);
123
124 //m_log.InfoFormat("[ASSET TRANSACTIONS] Current uploaders: {0}", XferUploaders.Count);
125 }
126 }
127 }
128
129 public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
130 uint callbackID, string description, string name, sbyte invType,
131 sbyte type, byte wearableType, uint nextOwnerMask)
132 {
133 if (XferUploaders.ContainsKey(transactionID))
134 {
135 XferUploaders[transactionID].RequestCreateInventoryItem(remoteClient, transactionID, folderID,
136 callbackID, description, name, invType, type,
137 wearableType, nextOwnerMask);
138 }
139 }
140
141 public void RequestUpdateInventoryItem(IClientAPI remoteClient, LLUUID transactionID,
142 InventoryItemBase item)
143 {
144 if (XferUploaders.ContainsKey(transactionID))
145 {
146 XferUploaders[transactionID].RequestUpdateInventoryItem(remoteClient, transactionID, item);
147 }
148 }
149
150 /// <summary>
151 /// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed.
152 /// </summary>
153 /// <param name="transactionID"></param>
154 /// <returns>The asset if the upload has completed, null if it has not.</returns>
155 public AssetBase GetTransactionAsset(LLUUID transactionID)
156 {
157 if (XferUploaders.ContainsKey(transactionID))
158 {
159 AssetXferUploader uploader = XferUploaders[transactionID];
160 AssetBase asset = uploader.GetAssetData();
161
162 lock (XferUploaders)
163 {
164 XferUploaders.Remove(transactionID);
165 }
166
167 return asset;
168 }
169
170 return null;
171 }
172
173 // Nested Types
174 public class AssetXferUploader
175 {
176 // Fields
177 public bool AddToInventory;
178 public AssetBase Asset;
179 public LLUUID InventFolder = LLUUID.Zero;
180 private IClientAPI ourClient;
181 public LLUUID TransactionID = LLUUID.Zero;
182 public bool UploadComplete;
183 public ulong XferID;
184 private string m_name = String.Empty;
185 private string m_description = String.Empty;
186 private sbyte type = 0;
187 private sbyte invType = 0;
188 private uint nextPerm = 0;
189 private bool m_finished = false;
190 private bool m_createItem = false;
191 private AgentAssetTransactions m_userTransactions;
192 private bool m_storeLocal;
193 private bool m_dumpAssetToFile;
194
195 public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile)
196 {
197 m_userTransactions = transactions;
198 m_dumpAssetToFile = dumpAssetToFile;
199 }
200
201 /// <summary>
202 /// Process transfer data received from the client.
203 /// </summary>
204 /// <param name="xferID"></param>
205 /// <param name="packetID"></param>
206 /// <param name="data"></param>
207 /// <returns>True if the transfer is complete, false otherwise or if the xferID was not valid</returns>
208 public bool HandleXferPacket(ulong xferID, uint packetID, byte[] data)
209 {
210 if (XferID == xferID)
211 {
212 if (Asset.Data.Length > 1)
213 {
214 byte[] destinationArray = new byte[Asset.Data.Length + data.Length];
215 Array.Copy(Asset.Data, 0, destinationArray, 0, Asset.Data.Length);
216 Array.Copy(data, 0, destinationArray, Asset.Data.Length, data.Length);
217 Asset.Data = destinationArray;
218 }
219 else
220 {
221 byte[] buffer2 = new byte[data.Length - 4];
222 Array.Copy(data, 4, buffer2, 0, data.Length - 4);
223 Asset.Data = buffer2;
224 }
225 ConfirmXferPacketPacket newPack = new ConfirmXferPacketPacket();
226 newPack.XferID.ID = xferID;
227 newPack.XferID.Packet = packetID;
228 ourClient.OutPacket(newPack, ThrottleOutPacketType.Asset);
229 if ((packetID & 0x80000000) != 0)
230 {
231 SendCompleteMessage();
232 return true;
233 }
234 }
235
236 return false;
237 }
238
239 /// <summary>
240 /// Initialise asset transfer from the client
241 /// </summary>
242 /// <param name="xferID"></param>
243 /// <param name="packetID"></param>
244 /// <param name="data"></param>
245 /// <returns>True if the transfer is complete, false otherwise</returns>
246 public bool Initialise(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data,
247 bool storeLocal, bool tempFile)
248 {
249 ourClient = remoteClient;
250 Asset = new AssetBase();
251 Asset.FullID = assetID;
252 Asset.InvType = type;
253 Asset.Type = type;
254 Asset.Data = data;
255 Asset.Name = "blank";
256 Asset.Description = "empty";
257 Asset.Local = storeLocal;
258 Asset.Temporary = tempFile;
259
260 TransactionID = transaction;
261 m_storeLocal = storeLocal;
262 if (Asset.Data.Length > 2)
263 {
264 SendCompleteMessage();
265 return true;
266 }
267 else
268 {
269 RequestStartXfer();
270 }
271
272 return false;
273 }
274
275 protected void RequestStartXfer()
276 {
277 UploadComplete = false;
278 XferID = Util.GetNextXferID();
279 RequestXferPacket newPack = new RequestXferPacket();
280 newPack.XferID.ID = XferID;
281 newPack.XferID.VFileType = Asset.Type;
282 newPack.XferID.VFileID = Asset.FullID;
283 newPack.XferID.FilePath = 0;
284 newPack.XferID.Filename = new byte[0];
285 ourClient.OutPacket(newPack, ThrottleOutPacketType.Asset);
286 }
287
288 protected void SendCompleteMessage()
289 {
290 UploadComplete = true;
291 AssetUploadCompletePacket newPack = new AssetUploadCompletePacket();
292 newPack.AssetBlock.Type = Asset.Type;
293 newPack.AssetBlock.Success = true;
294 newPack.AssetBlock.UUID = Asset.FullID;
295 ourClient.OutPacket(newPack, ThrottleOutPacketType.Asset);
296 m_finished = true;
297 if (m_createItem)
298 {
299 DoCreateItem();
300 }
301 else if (m_storeLocal)
302 {
303 m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset);
304 }
305
306 // Console.WriteLine("upload complete "+ this.TransactionID);
307
308 if (m_dumpAssetToFile)
309 {
310 DateTime now = DateTime.Now;
311 string filename =
312 String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat", now.Year, now.Month, now.Day,
313 now.Hour, now.Minute, now.Second, Asset.Name, Asset.Type);
314 SaveAssetToFile(filename, Asset.Data);
315 }
316 }
317
318 ///Left this in and commented in case there are unforseen issues
319 //private void SaveAssetToFile(string filename, byte[] data)
320 //{
321 // FileStream fs = File.Create(filename);
322 // BinaryWriter bw = new BinaryWriter(fs);
323 // bw.Write(data);
324 // bw.Close();
325 // fs.Close();
326 //}
327 private void SaveAssetToFile(string filename, byte[] data)
328 {
329 string assetPath = "UserAssets";
330 if (!Directory.Exists(assetPath))
331 {
332 Directory.CreateDirectory(assetPath);
333 }
334 FileStream fs = File.Create(Path.Combine(assetPath, filename));
335 BinaryWriter bw = new BinaryWriter(fs);
336 bw.Write(data);
337 bw.Close();
338 fs.Close();
339 }
340
341 public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
342 uint callbackID, string description, string name, sbyte invType,
343 sbyte type, byte wearableType, uint nextOwnerMask)
344 {
345 if (TransactionID == transactionID)
346 {
347 InventFolder = folderID;
348 m_name = name;
349 m_description = description;
350 this.type = type;
351 this.invType = invType;
352 nextPerm = nextOwnerMask;
353 Asset.Name = name;
354 Asset.Description = description;
355 Asset.Type = type;
356 Asset.InvType = invType;
357 m_createItem = true;
358 if (m_finished)
359 {
360 DoCreateItem();
361 }
362 }
363 }
364
365 public void RequestUpdateInventoryItem(IClientAPI remoteClient, LLUUID transactionID,
366 InventoryItemBase item)
367 {
368 if (TransactionID == transactionID)
369 {
370 CachedUserInfo userInfo =
371 m_userTransactions.Manager.CommsManager.UserProfileCacheService.GetUserDetails(
372 remoteClient.AgentId);
373
374 if (userInfo != null)
375 {
376 LLUUID assetID = LLUUID.Combine(transactionID, remoteClient.SecureSessionId);
377
378 AssetBase asset
379 = m_userTransactions.Manager.CommsManager.AssetCache.GetAsset(
380 assetID, (item.assetType == (int) AssetType.Texture ? true : false));
381
382 if (asset == null)
383 {
384 asset = m_userTransactions.GetTransactionAsset(transactionID);
385 }
386
387 if (asset != null && asset.FullID == assetID)
388 {
389 asset.Name = item.inventoryName;
390 asset.Description = item.inventoryDescription;
391 asset.InvType = (sbyte) item.invType;
392 asset.Type = (sbyte) item.assetType;
393 item.assetID = asset.FullID;
394
395 m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset);
396 }
397
398 userInfo.UpdateItem(remoteClient.AgentId, item);
399 }
400 }
401 }
402
403 private void DoCreateItem()
404 {
405 //really need to fix this call, if lbsa71 saw this he would die.
406 m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset);
407 CachedUserInfo userInfo =
408 m_userTransactions.Manager.CommsManager.UserProfileCacheService.GetUserDetails(ourClient.AgentId);
409 if (userInfo != null)
410 {
411 InventoryItemBase item = new InventoryItemBase();
412 item.avatarID = ourClient.AgentId;
413 item.creatorsID = ourClient.AgentId;
414 item.inventoryID = LLUUID.Random();
415 item.assetID = Asset.FullID;
416 item.inventoryDescription = m_description;
417 item.inventoryName = m_name;
418 item.assetType = type;
419 item.invType = invType;
420 item.parentFolderID = InventFolder;
421 item.inventoryBasePermissions = 2147483647;
422 item.inventoryCurrentPermissions = 2147483647;
423 item.inventoryNextPermissions = nextPerm;
424
425 userInfo.AddItem(ourClient.AgentId, item);
426 ourClient.SendInventoryItemCreateUpdate(item);
427 }
428 }
429
430 public AssetBase GetAssetData()
431 {
432 if (m_finished)
433 {
434 return Asset;
435 }
436 return null;
437 }
438 }
439
440 #region Nested Classes currently not in use (waiting for them to be enabled)
441
442 public class AssetCapsUploader
443 {
444 // Fields
445 private BaseHttpServer httpListener;
446 private LLUUID inventoryItemID;
447 private string m_assetDescription = String.Empty;
448 private string m_assetName = String.Empty;
449 private LLUUID m_folderID;
450 private LLUUID newAssetID;
451 private bool m_dumpImageToFile;
452 private string uploaderPath = String.Empty;
453
454 // Events
455 public event UpLoadedAsset OnUpLoad;
456
457 // Methods
458 public void Initialise(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem,
459 LLUUID folderID, string path, BaseHttpServer httpServer, bool dumpImageToFile)
460 {
461 m_assetName = assetName;
462 m_assetDescription = assetDescription;
463 m_folderID = folderID;
464 newAssetID = assetID;
465 inventoryItemID = inventoryItem;
466 uploaderPath = path;
467 httpListener = httpServer;
468 m_dumpImageToFile = dumpImageToFile;
469 }
470
471 private void SaveImageToFile(string filename, byte[] data)
472 {
473 FileStream output = File.Create(filename);
474 BinaryWriter writer = new BinaryWriter(output);
475 writer.Write(data);
476 writer.Close();
477 output.Close();
478 }
479
480 public string uploaderCaps(byte[] data, string path, string param)
481 {
482 LLUUID inventoryItemID = this.inventoryItemID;
483 string text = String.Empty;
484 LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete();
485 complete.new_asset = newAssetID.ToString();
486 complete.new_inventory_item = inventoryItemID;
487 complete.state = "complete";
488 text = LLSDHelpers.SerialiseLLSDReply(complete);
489 httpListener.RemoveStreamHandler("POST", uploaderPath);
490 if (m_dumpImageToFile)
491 {
492 SaveImageToFile(m_assetName + ".jp2", data);
493 }
494 if (OnUpLoad != null)
495 {
496 OnUpLoad(m_assetName, "description", newAssetID, inventoryItemID, LLUUID.Zero, data, String.Empty, String.Empty);
497 }
498 return text;
499 }
500 }
501
502 public class NoteCardCapsUpdate
503 {
504 // Fields
505 private BaseHttpServer httpListener;
506 private LLUUID inventoryItemID;
507 private string m_assetName = String.Empty;
508 private LLUUID newAssetID;
509 private bool SaveImages = false;
510 private string uploaderPath = String.Empty;
511
512 // Events
513 public event UpLoadedAsset OnUpLoad;
514
515 // Methods
516 public void Initialise(LLUUID inventoryItem, string path, BaseHttpServer httpServer)
517 {
518 inventoryItemID = inventoryItem;
519 uploaderPath = path;
520 httpListener = httpServer;
521 newAssetID = LLUUID.Random();
522 }
523
524 private void SaveImageToFile(string filename, byte[] data)
525 {
526 FileStream output = File.Create(filename);
527 BinaryWriter writer = new BinaryWriter(output);
528 writer.Write(data);
529 writer.Close();
530 output.Close();
531 }
532
533 public string uploaderCaps(byte[] data, string path, string param)
534 {
535 LLUUID inventoryItemID = this.inventoryItemID;
536 string text = String.Empty;
537 LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete();
538 complete.new_asset = newAssetID.ToString();
539 complete.new_inventory_item = inventoryItemID;
540 complete.state = "complete";
541 text = LLSDHelpers.SerialiseLLSDReply(complete);
542 httpListener.RemoveStreamHandler("POST", uploaderPath);
543 if (SaveImages)
544 {
545 SaveImageToFile(m_assetName + "notecard.txt", data);
546 }
547 if (OnUpLoad != null)
548 {
549 OnUpLoad(m_assetName, "description", newAssetID, inventoryItemID, LLUUID.Zero, data, String.Empty, String.Empty);
550 }
551 return text;
552 }
553 }
554
555 #endregion
556 }
557}
558*/
diff --git a/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs b/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs
deleted file mode 100644
index e9d042d..0000000
--- a/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs
+++ /dev/null
@@ -1,205 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the 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//moved to a module, left here until the module is found to have no problems
29/*
30using System;
31using System.Collections.Generic;
32
33using libsecondlife;
34
35namespace OpenSim.Framework.Communications.Cache
36{
37 /// <summary>
38 /// Provider handlers for processing asset transactions originating from the agent. This encompasses
39 /// clothing creation and update as well as asset uploads.
40 /// </summary>
41 public class AgentAssetTransactionsManager
42 {
43 private static readonly log4net.ILog m_log
44 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
45
46 // Fields
47 public CommunicationsManager CommsManager;
48
49 /// <summary>
50 /// Each agent has its own singleton collection of transactions
51 /// </summary>
52 private Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions =
53 new Dictionary<LLUUID, AgentAssetTransactions>();
54
55 /// <summary>
56 /// Should we dump uploaded assets to the filesystem?
57 /// </summary>
58 private bool m_dumpAssetsToFile;
59
60 public AgentAssetTransactionsManager(CommunicationsManager commsManager, bool dumpAssetsToFile)
61 {
62 CommsManager = commsManager;
63 m_dumpAssetsToFile = dumpAssetsToFile;
64 }
65
66 /// <summary>
67 /// Get the collection of asset transactions for the given user. If one does not already exist, it
68 /// is created.
69 /// </summary>
70 /// <param name="userID"></param>
71 /// <returns></returns>
72 private AgentAssetTransactions GetUserTransactions(LLUUID userID)
73 {
74 lock (AgentTransactions)
75 {
76 if (!AgentTransactions.ContainsKey(userID))
77 {
78 AgentAssetTransactions transactions
79 = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
80 AgentTransactions.Add(userID, transactions);
81 }
82
83 return AgentTransactions[userID];
84 }
85 }
86
87 /// <summary>
88 /// Remove the given agent asset transactions. This should be called when a client is departing
89 /// from a scene (and hence won't be making any more transactions here).
90 /// </summary>
91 /// <param name="userID"></param>
92 public void RemoveAgentAssetTransactions(LLUUID userID)
93 {
94 m_log.DebugFormat("Removing agent asset transactions structure for agent {0}", userID);
95
96 lock (AgentTransactions)
97 {
98 AgentTransactions.Remove(userID);
99 }
100 }
101
102 /// <summary>
103 /// Create an inventory item from data that has been received through a transaction.
104 ///
105 /// This is called when new clothing or body parts are created. It may also be called in other
106 /// situations.
107 /// </summary>
108 /// <param name="remoteClient"></param>
109 /// <param name="transactionID"></param>
110 /// <param name="folderID"></param>
111 /// <param name="callbackID"></param>
112 /// <param name="description"></param>
113 /// <param name="name"></param>
114 /// <param name="invType"></param>
115 /// <param name="type"></param>
116 /// <param name="wearableType"></param>
117 /// <param name="nextOwnerMask"></param>
118 public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
119 uint callbackID, string description, string name, sbyte invType,
120 sbyte type, byte wearableType, uint nextOwnerMask)
121 {
122 m_log.DebugFormat(
123 "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name);
124
125 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
126
127 transactions.RequestCreateInventoryItem(
128 remoteClient, transactionID, folderID, callbackID, description,
129 name, invType, type, wearableType, nextOwnerMask);
130 }
131
132 /// <summary>
133 /// Update an inventory item with data that has been received through a transaction.
134 ///
135 /// This is called when clothing or body parts are updated (for instance, with new textures or
136 /// colours). It may also be called in other situations.
137 /// </summary>
138 /// <param name="remoteClient"></param>
139 /// <param name="transactionID"></param>
140 /// <param name="item"></param>
141 public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, LLUUID transactionID,
142 InventoryItemBase item)
143 {
144 m_log.DebugFormat(
145 "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}",
146 item.inventoryName);
147
148 AgentAssetTransactions transactions
149 = CommsManager.TransactionsManager.GetUserTransactions(remoteClient.AgentId);
150
151 transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item);
152 }
153
154 /// <summary>
155 /// Request that a client (agent) begin an asset transfer.
156 /// </summary>
157 /// <param name="remoteClient"></param>
158 /// <param name="assetID"></param>
159 /// <param name="transaction"></param>
160 /// <param name="type"></param>
161 /// <param name="data"></param></param>
162 /// <param name="tempFile"></param>
163 public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type,
164 byte[] data, bool storeLocal, bool tempFile)
165 {
166 // Console.WriteLine("asset upload of " + assetID);
167 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
168
169 AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
170 if (uploader != null)
171 {
172 // Upload has already compelted uploading...
173
174 if (uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile))
175 {
176 //[commenting out as this removal breaks uploads]
177 /*lock (transactions.XferUploaders)
178 {
179
180 // XXX Weak ass way of doing this by directly manipulating this public dictionary, purely temporary
181 transactions.XferUploaders.Remove(uploader.TransactionID);
182
183 //m_log.InfoFormat("[ASSET TRANSACTIONS] Current uploaders: {0}", transactions.XferUploaders.Count);
184 }*/
185 /* }
186 }
187 }
188
189 /// <summary>
190 /// Handle asset transfer data packets received in response to the asset upload request in
191 /// HandleUDPUploadRequest()
192 /// </summary>
193 /// <param name="remoteClient"></param>
194 /// <param name="xferID"></param>
195 /// <param name="packetID"></param>
196 /// <param name="data"></param>
197 public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
198 {
199 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
200
201 transactions.HandleXfer(xferID, packetID, data);
202 }
203 }
204}
205*/
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index aa27abd..ca9669a 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -302,7 +302,7 @@ namespace OpenSim.Framework.Communications.Cache
302 /// Add an item to the user's inventory 302 /// Add an item to the user's inventory
303 /// </summary> 303 /// </summary>
304 /// <param name="itemInfo"></param> 304 /// <param name="itemInfo"></param>
305 public void AddItem(LLUUID userID, InventoryItemBase itemInfo) 305 public void AddItem(InventoryItemBase itemInfo)
306 { 306 {
307 if (HasInventory) 307 if (HasInventory)
308 { 308 {
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index 555d5f4..19d2913 100644
--- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -392,7 +392,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
392 item.NextPermissions = nextPerm; 392 item.NextPermissions = nextPerm;
393 item.Flags = (uint) wearableType; 393 item.Flags = (uint) wearableType;
394 394
395 userInfo.AddItem(ourClient.AgentId, item); 395 userInfo.AddItem(item);
396 ourClient.SendInventoryItemCreateUpdate(item); 396 ourClient.SendInventoryItemCreateUpdate(item);
397 } 397 }
398 } 398 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 6bd5d1a..baca696 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Region.Environment.Scenes
69 69
70 if (userInfo != null) 70 if (userInfo != null)
71 { 71 {
72 userInfo.AddItem(remoteClient.AgentId, item); 72 userInfo.AddItem(item);
73 remoteClient.SendInventoryItemCreateUpdate(item); 73 remoteClient.SendInventoryItemCreateUpdate(item);
74 74
75 int userlevel = 0; 75 int userlevel = 0;
@@ -372,7 +372,7 @@ namespace OpenSim.Region.Environment.Scenes
372 itemCopy.SalePrice = item.SalePrice; 372 itemCopy.SalePrice = item.SalePrice;
373 itemCopy.SaleType = item.SaleType; 373 itemCopy.SaleType = item.SaleType;
374 374
375 recipientUserInfo.AddItem(recipientClient.AgentId, itemCopy); 375 recipientUserInfo.AddItem(itemCopy);
376 376
377 // Let the recipient client know about this new item 377 // Let the recipient client know about this new item
378 recipientClient.SendBulkUpdateInventory(itemCopy); 378 recipientClient.SendBulkUpdateInventory(itemCopy);
@@ -533,7 +533,7 @@ namespace OpenSim.Region.Environment.Scenes
533 item.CurrentPermissions = 2147483647; 533 item.CurrentPermissions = 2147483647;
534 item.NextPermissions = nextOwnerMask; 534 item.NextPermissions = nextOwnerMask;
535 535
536 userInfo.AddItem(remoteClient.AgentId, item); 536 userInfo.AddItem(item);
537 remoteClient.SendInventoryItemCreateUpdate(item); 537 remoteClient.SendInventoryItemCreateUpdate(item);
538 } 538 }
539 else 539 else
@@ -1011,7 +1011,7 @@ namespace OpenSim.Region.Environment.Scenes
1011 1011
1012 // TODO: add the new fields (Flags, Sale info, etc) 1012 // TODO: add the new fields (Flags, Sale info, etc)
1013 1013
1014 userInfo.AddItem(remoteClient.AgentId, item); 1014 userInfo.AddItem(item);
1015 remoteClient.SendInventoryItemCreateUpdate(item); 1015 remoteClient.SendInventoryItemCreateUpdate(item);
1016 } 1016 }
1017 1017
@@ -1101,7 +1101,7 @@ namespace OpenSim.Region.Environment.Scenes
1101 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 1101 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
1102 } 1102 }
1103 1103
1104 userInfo.AddItem(agentID, item); 1104 userInfo.AddItem(item);
1105 1105
1106 // this gets called when the agent loggs off! 1106 // this gets called when the agent loggs off!
1107 if (remoteClient != null) 1107 if (remoteClient != null)
@@ -1158,7 +1158,7 @@ namespace OpenSim.Region.Environment.Scenes
1158 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 1158 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
1159 } 1159 }
1160 1160
1161 userInfo.AddItem(remoteClient.AgentId, item); 1161 userInfo.AddItem(item);
1162 remoteClient.SendInventoryItemCreateUpdate(item); 1162 remoteClient.SendInventoryItemCreateUpdate(item);
1163 return item.AssetID; 1163 return item.AssetID;
1164 } 1164 }