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