aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Agent/AssetTransaction
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Agent/AssetTransaction')
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs407
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs286
2 files changed, 693 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
new file mode 100644
index 0000000..74bb247
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -0,0 +1,407 @@
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
28using System;
29using System.Collections.Generic;
30using System.IO;
31using libsecondlife;
32using libsecondlife.Packets;
33using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache;
35
36namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
37{
38 /// <summary>
39 /// Manage asset transactions for a single agent.
40 /// </summary>
41 public class AgentAssetTransactions
42 {
43 //private static readonly log4net.ILog m_log
44 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
45
46 // Fields
47 public LLUUID UserID;
48 public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>();
49 public AgentAssetTransactionsManager Manager;
50 private bool m_dumpAssetsToFile;
51
52 // Methods
53 public AgentAssetTransactions(LLUUID agentID, AgentAssetTransactionsManager manager, bool dumpAssetsToFile)
54 {
55 UserID = agentID;
56 Manager = manager;
57 m_dumpAssetsToFile = dumpAssetsToFile;
58 }
59
60 public AssetXferUploader RequestXferUploader(LLUUID transactionID)
61 {
62 if (!XferUploaders.ContainsKey(transactionID))
63 {
64 AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile);
65
66 lock (XferUploaders)
67 {
68 XferUploaders.Add(transactionID, uploader);
69 }
70
71 return uploader;
72 }
73 return null;
74 }
75
76 public void HandleXfer(ulong xferID, uint packetID, byte[] data)
77 {
78 // AssetXferUploader uploaderFound = null;
79
80 lock (XferUploaders)
81 {
82 foreach (AssetXferUploader uploader in XferUploaders.Values)
83 {
84 if (uploader.XferID == xferID)
85 {
86 uploader.HandleXferPacket(xferID, packetID, data);
87 break;
88 }
89 }
90 }
91 }
92
93 public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
94 uint callbackID, string description, string name, sbyte invType,
95 sbyte type, byte wearableType, uint nextOwnerMask)
96 {
97 if (XferUploaders.ContainsKey(transactionID))
98 {
99 XferUploaders[transactionID].RequestCreateInventoryItem(remoteClient, transactionID, folderID,
100 callbackID, description, name, invType, type,
101 wearableType, nextOwnerMask);
102 }
103 }
104
105 public void RequestUpdateInventoryItem(IClientAPI remoteClient, LLUUID transactionID,
106 InventoryItemBase item)
107 {
108 if (XferUploaders.ContainsKey(transactionID))
109 {
110 XferUploaders[transactionID].RequestUpdateInventoryItem(remoteClient, transactionID, item);
111 }
112 }
113
114 /// <summary>
115 /// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed.
116 /// </summary>
117 /// <param name="transactionID"></param>
118 /// <returns>The asset if the upload has completed, null if it has not.</returns>
119 public AssetBase GetTransactionAsset(LLUUID transactionID)
120 {
121 if (XferUploaders.ContainsKey(transactionID))
122 {
123 AssetXferUploader uploader = XferUploaders[transactionID];
124 AssetBase asset = uploader.GetAssetData();
125
126 lock (XferUploaders)
127 {
128 XferUploaders.Remove(transactionID);
129 }
130
131 return asset;
132 }
133
134 return null;
135 }
136
137 // Nested Types
138 public class AssetXferUploader
139 {
140 // Fields
141 public bool AddToInventory;
142 public AssetBase Asset;
143 public LLUUID InventFolder = LLUUID.Zero;
144 private IClientAPI ourClient;
145 public LLUUID TransactionID = LLUUID.Zero;
146 public bool UploadComplete;
147 public ulong XferID;
148 private string m_name = String.Empty;
149 private string m_description = String.Empty;
150 private sbyte type = 0;
151 private sbyte invType = 0;
152 private byte wearableType = 0;
153 private uint nextPerm = 0;
154 private bool m_finished = false;
155 private bool m_createItem = false;
156 private AgentAssetTransactions m_userTransactions;
157 private bool m_storeLocal;
158 private bool m_dumpAssetToFile;
159
160 public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile)
161 {
162 m_userTransactions = transactions;
163 m_dumpAssetToFile = dumpAssetToFile;
164 }
165
166 /// <summary>
167 /// Process transfer data received from the client.
168 /// </summary>
169 /// <param name="xferID"></param>
170 /// <param name="packetID"></param>
171 /// <param name="data"></param>
172 /// <returns>True if the transfer is complete, false otherwise or if the xferID was not valid</returns>
173 public bool HandleXferPacket(ulong xferID, uint packetID, byte[] data)
174 {
175 if (XferID == xferID)
176 {
177 if (Asset.Data.Length > 1)
178 {
179 byte[] destinationArray = new byte[Asset.Data.Length + data.Length];
180 Array.Copy(Asset.Data, 0, destinationArray, 0, Asset.Data.Length);
181 Array.Copy(data, 0, destinationArray, Asset.Data.Length, data.Length);
182 Asset.Data = destinationArray;
183 }
184 else
185 {
186 byte[] buffer2 = new byte[data.Length - 4];
187 Array.Copy(data, 4, buffer2, 0, data.Length - 4);
188 Asset.Data = buffer2;
189 }
190 ConfirmXferPacketPacket newPack = new ConfirmXferPacketPacket();
191 newPack.XferID.ID = xferID;
192 newPack.XferID.Packet = packetID;
193 ourClient.OutPacket(newPack, ThrottleOutPacketType.Asset);
194 if ((packetID & 0x80000000) != 0)
195 {
196 SendCompleteMessage();
197 return true;
198 }
199 }
200
201 return false;
202 }
203
204 /// <summary>
205 /// Initialise asset transfer from the client
206 /// </summary>
207 /// <param name="xferID"></param>
208 /// <param name="packetID"></param>
209 /// <param name="data"></param>
210 /// <returns>True if the transfer is complete, false otherwise</returns>
211 public bool Initialise(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data,
212 bool storeLocal, bool tempFile)
213 {
214 ourClient = remoteClient;
215 Asset = new AssetBase();
216 Asset.FullID = assetID;
217 Asset.InvType = type;
218 Asset.Type = type;
219 Asset.Data = data;
220 Asset.Name = "blank";
221 Asset.Description = "empty";
222 Asset.Local = storeLocal;
223 Asset.Temporary = tempFile;
224
225 TransactionID = transaction;
226 m_storeLocal = storeLocal;
227 if (Asset.Data.Length > 2)
228 {
229 SendCompleteMessage();
230 return true;
231 }
232 else
233 {
234 RequestStartXfer();
235 }
236
237 return false;
238 }
239
240 protected void RequestStartXfer()
241 {
242 UploadComplete = false;
243 XferID = Util.GetNextXferID();
244 RequestXferPacket newPack = new RequestXferPacket();
245 newPack.XferID.ID = XferID;
246 newPack.XferID.VFileType = Asset.Type;
247 newPack.XferID.VFileID = Asset.FullID;
248 newPack.XferID.FilePath = 0;
249 newPack.XferID.Filename = new byte[0];
250 ourClient.OutPacket(newPack, ThrottleOutPacketType.Asset);
251 }
252
253 protected void SendCompleteMessage()
254 {
255 UploadComplete = true;
256 AssetUploadCompletePacket newPack = new AssetUploadCompletePacket();
257 newPack.AssetBlock.Type = Asset.Type;
258 newPack.AssetBlock.Success = true;
259 newPack.AssetBlock.UUID = Asset.FullID;
260 ourClient.OutPacket(newPack, ThrottleOutPacketType.Asset);
261 m_finished = true;
262 if (m_createItem)
263 {
264 DoCreateItem();
265 }
266 else if (m_storeLocal)
267 {
268 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(Asset);
269 }
270
271 // Console.WriteLine("upload complete "+ this.TransactionID);
272
273 if (m_dumpAssetToFile)
274 {
275 DateTime now = DateTime.Now;
276 string filename =
277 String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat", now.Year, now.Month, now.Day,
278 now.Hour, now.Minute, now.Second, Asset.Name, Asset.Type);
279 SaveAssetToFile(filename, Asset.Data);
280 }
281 }
282
283 ///Left this in and commented in case there are unforseen issues
284 //private void SaveAssetToFile(string filename, byte[] data)
285 //{
286 // FileStream fs = File.Create(filename);
287 // BinaryWriter bw = new BinaryWriter(fs);
288 // bw.Write(data);
289 // bw.Close();
290 // fs.Close();
291 //}
292 private void SaveAssetToFile(string filename, byte[] data)
293 {
294 string assetPath = "UserAssets";
295 if (!Directory.Exists(assetPath))
296 {
297 Directory.CreateDirectory(assetPath);
298 }
299 FileStream fs = File.Create(Path.Combine(assetPath, filename));
300 BinaryWriter bw = new BinaryWriter(fs);
301 bw.Write(data);
302 bw.Close();
303 fs.Close();
304 }
305
306 public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
307 uint callbackID, string description, string name, sbyte invType,
308 sbyte type, byte wearableType, uint nextOwnerMask)
309 {
310 if (TransactionID == transactionID)
311 {
312 InventFolder = folderID;
313 m_name = name;
314 m_description = description;
315 this.type = type;
316 this.invType = invType;
317 this.wearableType = wearableType;
318 nextPerm = nextOwnerMask;
319 Asset.Name = name;
320 Asset.Description = description;
321 Asset.Type = type;
322 Asset.InvType = invType;
323 m_createItem = true;
324 if (m_finished)
325 {
326 DoCreateItem();
327 }
328 }
329 }
330
331 public void RequestUpdateInventoryItem(IClientAPI remoteClient, LLUUID transactionID,
332 InventoryItemBase item)
333 {
334 if (TransactionID == transactionID)
335 {
336 CachedUserInfo userInfo =
337 m_userTransactions.Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(
338 remoteClient.AgentId);
339
340 if (userInfo != null)
341 {
342 LLUUID assetID = LLUUID.Combine(transactionID, remoteClient.SecureSessionId);
343
344 AssetBase asset
345 = m_userTransactions.Manager.MyScene.CommsManager.AssetCache.GetAsset(
346 assetID, (item.AssetType == (int) AssetType.Texture ? true : false));
347
348 if (asset == null)
349 {
350 asset = m_userTransactions.GetTransactionAsset(transactionID);
351 }
352
353 if (asset != null && asset.FullID == assetID)
354 {
355 asset.Name = item.Name;
356 asset.Description = item.Description;
357 asset.InvType = (sbyte) item.InvType;
358 asset.Type = (sbyte) item.AssetType;
359 item.AssetID = asset.FullID;
360
361 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(Asset);
362 }
363
364 userInfo.UpdateItem(remoteClient.AgentId, item);
365 }
366 }
367 }
368
369 private void DoCreateItem()
370 {
371 //really need to fix this call, if lbsa71 saw this he would die.
372 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(Asset);
373 CachedUserInfo userInfo =
374 m_userTransactions.Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(ourClient.AgentId);
375 if (userInfo != null)
376 {
377 InventoryItemBase item = new InventoryItemBase();
378 item.Owner = ourClient.AgentId;
379 item.Creator = ourClient.AgentId;
380 item.ID = LLUUID.Random();
381 item.AssetID = Asset.FullID;
382 item.Description = m_description;
383 item.Name = m_name;
384 item.AssetType = type;
385 item.InvType = invType;
386 item.Folder = InventFolder;
387 item.BasePermissions = 2147483647;
388 item.CurrentPermissions = 2147483647;
389 item.NextPermissions = nextPerm;
390 item.Flags = (uint)wearableType;
391
392 userInfo.AddItem(ourClient.AgentId, item);
393 ourClient.SendInventoryItemCreateUpdate(item);
394 }
395 }
396
397 public AssetBase GetAssetData()
398 {
399 if (m_finished)
400 {
401 return Asset;
402 }
403 return null;
404 }
405 }
406 }
407} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs
new file mode 100644
index 0000000..ef81625
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs
@@ -0,0 +1,286 @@
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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using libsecondlife;
32using log4net;
33using Nini.Config;
34using OpenSim.Framework;
35using OpenSim.Region.Environment.Interfaces;
36using OpenSim.Region.Environment.Modules.Agent.AssetTransaction;
37using OpenSim.Region.Environment.Scenes;
38
39namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
40{
41 public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions
42 {
43 private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
44 private Scene m_scene = null;
45 private bool m_dumpAssetsToFile = false;
46
47 private AgentAssetTransactionsManager m_transactionManager;
48
49 public AssetTransactionModule()
50 {
51 // System.Console.WriteLine("creating AgentAssetTransactionModule");
52 }
53
54 public void Initialise(Scene scene, IConfigSource config)
55 {
56 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
57 {
58 // System.Console.WriteLine("initialising AgentAssetTransactionModule");
59 RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
60 scene.RegisterModuleInterface<IAgentAssetTransactions>(this);
61
62 scene.EventManager.OnNewClient += NewClient;
63 }
64
65 if (m_scene == null)
66 {
67 m_scene = scene;
68 if (config.Configs["StandAlone"] != null)
69 {
70 try
71 {
72 m_dumpAssetsToFile = config.Configs["StandAlone"].GetBoolean("dump_assets_to_file", false);
73 m_transactionManager = new AgentAssetTransactionsManager(m_scene, m_dumpAssetsToFile);
74 }
75 catch (Exception)
76 {
77 m_transactionManager = new AgentAssetTransactionsManager(m_scene, false);
78 }
79 }
80 else
81 {
82 m_transactionManager = new AgentAssetTransactionsManager(m_scene, false);
83 }
84
85 }
86 }
87
88 public void PostInitialise()
89 {
90
91 }
92
93 public void Close()
94 {
95 }
96
97 public string Name
98 {
99 get { return "AgentTransactionModule"; }
100 }
101
102 public bool IsSharedModule
103 {
104 get { return true; }
105 }
106
107 public void NewClient(IClientAPI client)
108 {
109 client.OnAssetUploadRequest += m_transactionManager.HandleUDPUploadRequest;
110 client.OnXferReceive += m_transactionManager.HandleXfer;
111 }
112
113 public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
114 uint callbackID, string description, string name, sbyte invType,
115 sbyte type, byte wearableType, uint nextOwnerMask)
116 {
117 m_transactionManager.HandleItemCreationFromTransaction(remoteClient, transactionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask);
118 }
119
120 public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, LLUUID transactionID,
121 InventoryItemBase item)
122 {
123 m_transactionManager.HandleItemUpdateFromTransaction(remoteClient, transactionID, item);
124 }
125
126 public void RemoveAgentAssetTransactions(LLUUID userID)
127 {
128 m_transactionManager.RemoveAgentAssetTransactions(userID);
129 }
130 }
131
132 public class AgentAssetTransactionsManager
133 {
134 private static readonly ILog m_log
135 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
136
137 // Fields
138 public Scene MyScene;
139
140 /// <summary>
141 /// Each agent has its own singleton collection of transactions
142 /// </summary>
143 private Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions =
144 new Dictionary<LLUUID, AgentAssetTransactions>();
145
146 /// <summary>
147 /// Should we dump uploaded assets to the filesystem?
148 /// </summary>
149 private bool m_dumpAssetsToFile;
150
151 public AgentAssetTransactionsManager(Scene scene, bool dumpAssetsToFile)
152 {
153 MyScene = scene;
154 m_dumpAssetsToFile = dumpAssetsToFile;
155 }
156
157 /// <summary>
158 /// Get the collection of asset transactions for the given user. If one does not already exist, it
159 /// is created.
160 /// </summary>
161 /// <param name="userID"></param>
162 /// <returns></returns>
163 private AgentAssetTransactions GetUserTransactions(LLUUID userID)
164 {
165 lock (AgentTransactions)
166 {
167 if (!AgentTransactions.ContainsKey(userID))
168 {
169 AgentAssetTransactions transactions
170 = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
171 AgentTransactions.Add(userID, transactions);
172 }
173
174 return AgentTransactions[userID];
175 }
176 }
177
178 /// <summary>
179 /// Remove the given agent asset transactions. This should be called when a client is departing
180 /// from a scene (and hence won't be making any more transactions here).
181 /// </summary>
182 /// <param name="userID"></param>
183 public void RemoveAgentAssetTransactions(LLUUID userID)
184 {
185 // m_log.DebugFormat("Removing agent asset transactions structure for agent {0}", userID);
186
187 lock (AgentTransactions)
188 {
189 AgentTransactions.Remove(userID);
190 }
191 }
192
193 /// <summary>
194 /// Create an inventory item from data that has been received through a transaction.
195 ///
196 /// This is called when new clothing or body parts are created. It may also be called in other
197 /// situations.
198 /// </summary>
199 /// <param name="remoteClient"></param>
200 /// <param name="transactionID"></param>
201 /// <param name="folderID"></param>
202 /// <param name="callbackID"></param>
203 /// <param name="description"></param>
204 /// <param name="name"></param>
205 /// <param name="invType"></param>
206 /// <param name="type"></param>
207 /// <param name="wearableType"></param>
208 /// <param name="nextOwnerMask"></param>
209 public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
210 uint callbackID, string description, string name, sbyte invType,
211 sbyte type, byte wearableType, uint nextOwnerMask)
212 {
213 m_log.DebugFormat(
214 "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name);
215
216 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
217
218 transactions.RequestCreateInventoryItem(
219 remoteClient, transactionID, folderID, callbackID, description,
220 name, invType, type, wearableType, nextOwnerMask);
221 }
222
223 /// <summary>
224 /// Update an inventory item with data that has been received through a transaction.
225 ///
226 /// This is called when clothing or body parts are updated (for instance, with new textures or
227 /// colours). It may also be called in other situations.
228 /// </summary>
229 /// <param name="remoteClient"></param>
230 /// <param name="transactionID"></param>
231 /// <param name="item"></param>
232 public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, LLUUID transactionID,
233 InventoryItemBase item)
234 {
235 m_log.DebugFormat(
236 "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}",
237 item.Name);
238
239 AgentAssetTransactions transactions
240 = GetUserTransactions(remoteClient.AgentId);
241
242 transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item);
243 }
244
245 /// <summary>
246 /// Request that a client (agent) begin an asset transfer.
247 /// </summary>
248 /// <param name="remoteClient"></param>
249 /// <param name="assetID"></param>
250 /// <param name="transaction"></param>
251 /// <param name="type"></param>
252 /// <param name="data"></param></param>
253 /// <param name="tempFile"></param>
254 public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type,
255 byte[] data, bool storeLocal, bool tempFile)
256 {
257 // Console.WriteLine("asset upload of " + assetID);
258 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
259
260 AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
261 if (uploader != null)
262 {
263
264 if (uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile))
265 {
266
267 }
268 }
269 }
270
271 /// <summary>
272 /// Handle asset transfer data packets received in response to the asset upload request in
273 /// HandleUDPUploadRequest()
274 /// </summary>
275 /// <param name="remoteClient"></param>
276 /// <param name="xferID"></param>
277 /// <param name="packetID"></param>
278 /// <param name="data"></param>
279 public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
280 {
281 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
282
283 transactions.HandleXfer(xferID, packetID, data);
284 }
285 }
286} \ No newline at end of file