aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/Interfaces/IAgentAssetTransactions.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs52
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs53
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs13
4 files changed, 86 insertions, 36 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/IAgentAssetTransactions.cs b/OpenSim/Region/Environment/Interfaces/IAgentAssetTransactions.cs
index 90d1c12..43c733d 100644
--- a/OpenSim/Region/Environment/Interfaces/IAgentAssetTransactions.cs
+++ b/OpenSim/Region/Environment/Interfaces/IAgentAssetTransactions.cs
@@ -27,6 +27,7 @@
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using OpenSim.Region.Environment.Scenes;
30 31
31namespace OpenSim.Region.Environment.Interfaces 32namespace OpenSim.Region.Environment.Interfaces
32{ 33{
@@ -38,6 +39,9 @@ namespace OpenSim.Region.Environment.Interfaces
38 void HandleItemCreationFromTransaction(IClientAPI remoteClient, UUID transactionID, UUID folderID, 39 void HandleItemCreationFromTransaction(IClientAPI remoteClient, UUID transactionID, UUID folderID,
39 uint callbackID, string description, string name, sbyte invType, 40 uint callbackID, string description, string name, sbyte invType,
40 sbyte type, byte wearableType, uint nextOwnerMask); 41 sbyte type, byte wearableType, uint nextOwnerMask);
42
43 void HandleTaskItemUpdateFromTransaction(
44 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item);
41 45
42 void RemoveAgentAssetTransactions(UUID userID); 46 void RemoveAgentAssetTransactions(UUID userID);
43 } 47 }
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index c46c4a4..b32d199 100644
--- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -28,10 +28,13 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection;
32using log4net;
31using OpenMetaverse; 33using OpenMetaverse;
32using OpenMetaverse.Packets; 34using OpenMetaverse.Packets;
33using OpenSim.Framework; 35using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 36using OpenSim.Framework.Communications.Cache;
37using OpenSim.Region.Environment.Scenes;
35 38
36namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction 39namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
37{ 40{
@@ -74,9 +77,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
74 } 77 }
75 78
76 public void HandleXfer(ulong xferID, uint packetID, byte[] data) 79 public void HandleXfer(ulong xferID, uint packetID, byte[] data)
77 { 80 {
78 // AssetXferUploader uploaderFound = null;
79
80 lock (XferUploaders) 81 lock (XferUploaders)
81 { 82 {
82 foreach (AssetXferUploader uploader in XferUploaders.Values) 83 foreach (AssetXferUploader uploader in XferUploaders.Values)
@@ -110,6 +111,15 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
110 XferUploaders[transactionID].RequestUpdateInventoryItem(remoteClient, transactionID, item); 111 XferUploaders[transactionID].RequestUpdateInventoryItem(remoteClient, transactionID, item);
111 } 112 }
112 } 113 }
114
115 public void RequestUpdateTaskInventoryItem(
116 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
117 {
118 if (XferUploaders.ContainsKey(transactionID))
119 {
120 XferUploaders[transactionID].RequestUpdateTaskInventoryItem(remoteClient, part, transactionID, item);
121 }
122 }
113 123
114 /// <summary> 124 /// <summary>
115 /// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed. 125 /// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed.
@@ -140,6 +150,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
140 150
141 public class AssetXferUploader 151 public class AssetXferUploader
142 { 152 {
153 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
154
143 // Fields 155 // Fields
144 public bool AddToInventory; 156 public bool AddToInventory;
145 public AssetBase Asset; 157 public AssetBase Asset;
@@ -225,6 +237,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
225 237
226 TransactionID = transaction; 238 TransactionID = transaction;
227 m_storeLocal = storeLocal; 239 m_storeLocal = storeLocal;
240
228 if (Asset.Data.Length > 2) 241 if (Asset.Data.Length > 2)
229 { 242 {
230 SendCompleteMessage(); 243 SendCompleteMessage();
@@ -251,7 +264,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
251 264
252 ourClient.SendAssetUploadCompleteMessage(Asset.Type, true, Asset.FullID); 265 ourClient.SendAssetUploadCompleteMessage(Asset.Type, true, Asset.FullID);
253 266
254
255 m_finished = true; 267 m_finished = true;
256 if (m_createItem) 268 if (m_createItem)
257 { 269 {
@@ -262,7 +274,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
262 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(Asset); 274 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(Asset);
263 } 275 }
264 276
265 // Console.WriteLine("upload complete "+ this.TransactionID); 277 m_log.DebugFormat("[ASSET TRANSACTIONS]: Uploaded asset data for transaction {0}", TransactionID);
266 278
267 if (m_dumpAssetToFile) 279 if (m_dumpAssetToFile)
268 { 280 {
@@ -274,15 +286,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
274 } 286 }
275 } 287 }
276 288
277 ///Left this in and commented in case there are unforseen issues
278 //private void SaveAssetToFile(string filename, byte[] data)
279 //{
280 // FileStream fs = File.Create(filename);
281 // BinaryWriter bw = new BinaryWriter(fs);
282 // bw.Write(data);
283 // bw.Close();
284 // fs.Close();
285 //}
286 private void SaveAssetToFile(string filename, byte[] data) 289 private void SaveAssetToFile(string filename, byte[] data)
287 { 290 {
288 string assetPath = "UserAssets"; 291 string assetPath = "UserAssets";
@@ -314,6 +317,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
314 Asset.Description = description; 317 Asset.Description = description;
315 Asset.Type = type; 318 Asset.Type = type;
316 m_createItem = true; 319 m_createItem = true;
320
317 if (m_finished) 321 if (m_finished)
318 { 322 {
319 DoCreateItem(); 323 DoCreateItem();
@@ -359,7 +363,25 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
359 } 363 }
360 } 364 }
361 } 365 }
362 366
367 public void RequestUpdateTaskInventoryItem(
368 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
369 {
370 m_log.DebugFormat(
371 "[ASSET TRANSACTIONS]: Updating task item {0} in {1} with asset in transaction {2}",
372 item.Name, part.Name, transactionID);
373
374 Asset.Name = item.Name;
375 Asset.Description = item.Description;
376 Asset.Type = (sbyte) item.Type;
377 item.AssetID = Asset.FullID;
378
379 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(Asset);
380
381 if (part.UpdateInventoryItem(item))
382 part.GetProperties(remoteClient);
383 }
384
363 private void DoCreateItem() 385 private void DoCreateItem()
364 { 386 {
365 //really need to fix this call, if lbsa71 saw this he would die. 387 //really need to fix this call, if lbsa71 saw this he would die.
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs
index e6e27be..56ca1a1 100644
--- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs
@@ -61,11 +61,16 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
61 wearableType, nextOwnerMask); 61 wearableType, nextOwnerMask);
62 } 62 }
63 63
64 public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, UUID transactionID, 64 public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, UUID transactionID, InventoryItemBase item)
65 InventoryItemBase item)
66 { 65 {
67 m_transactionManager.HandleItemUpdateFromTransaction(remoteClient, transactionID, item); 66 m_transactionManager.HandleItemUpdateFromTransaction(remoteClient, transactionID, item);
68 } 67 }
68
69 public void HandleTaskItemUpdateFromTransaction(
70 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
71 {
72 m_transactionManager.HandleTaskItemUpdateFromTransaction(remoteClient, part, transactionID, item);
73 }
69 74
70 public void RemoveAgentAssetTransactions(UUID userID) 75 public void RemoveAgentAssetTransactions(UUID userID)
71 { 76 {
@@ -141,8 +146,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
141 private static readonly ILog m_log 146 private static readonly ILog m_log
142 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 147 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
143 148
144 // Fields
145
146 /// <summary> 149 /// <summary>
147 /// Each agent has its own singleton collection of transactions 150 /// Each agent has its own singleton collection of transactions
148 /// </summary> 151 /// </summary>
@@ -218,8 +221,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
218 uint callbackID, string description, string name, sbyte invType, 221 uint callbackID, string description, string name, sbyte invType,
219 sbyte type, byte wearableType, uint nextOwnerMask) 222 sbyte type, byte wearableType, uint nextOwnerMask)
220 { 223 {
221 m_log.DebugFormat( 224// m_log.DebugFormat(
222 "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name); 225// "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name);
223 226
224 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); 227 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
225 228
@@ -240,15 +243,36 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
240 public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, UUID transactionID, 243 public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, UUID transactionID,
241 InventoryItemBase item) 244 InventoryItemBase item)
242 { 245 {
243 m_log.DebugFormat( 246// m_log.DebugFormat(
244 "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}", 247// "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}",
245 item.Name); 248// item.Name);
246 249
247 AgentAssetTransactions transactions 250 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
248 = GetUserTransactions(remoteClient.AgentId);
249 251
250 transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item); 252 transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item);
251 } 253 }
254
255 /// <summary>
256 /// Update a task inventory item with data that has been received through a transaction.
257 ///
258 /// This is currently called when, for instance, a notecard in a prim is saved. The data is sent
259 /// up through a single AssetUploadRequest. A subsequent UpdateTaskInventory then references the transaction
260 /// and comes through this method.
261 /// </summary>
262 /// <param name="remoteClient"></param>
263 /// <param name="transactionID"></param>
264 /// <param name="item"></param>
265 public void HandleTaskItemUpdateFromTransaction(
266 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
267 {
268// m_log.DebugFormat(
269// "[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0}",
270// item.Name);
271
272 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
273
274 transactions.RequestUpdateTaskInventoryItem(remoteClient, part, transactionID, item);
275 }
252 276
253 /// <summary> 277 /// <summary>
254 /// Request that a client (agent) begin an asset transfer. 278 /// Request that a client (agent) begin an asset transfer.
@@ -270,6 +294,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
270 { 294 {
271 Scene scene = (Scene)remoteClient.Scene; 295 Scene scene = (Scene)remoteClient.Scene;
272 IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); 296 IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>();
297
273 if (mm != null) 298 if (mm != null)
274 { 299 {
275 if (!mm.UploadCovered(remoteClient)) 300 if (!mm.UploadCovered(remoteClient))
@@ -280,15 +305,13 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
280 } 305 }
281 } 306 }
282 307
283 // Console.WriteLine("asset upload of " + assetID); 308 //Console.WriteLine("asset upload of " + assetID);
284 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); 309 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
285 310
286 AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction); 311 AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
287 if (uploader != null) 312 if (uploader != null)
288 { 313 {
289 if (uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile)) 314 uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile);
290 {
291 }
292 } 315 }
293 } 316 }
294 317
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 8fec13f..186e13e 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1256,12 +1256,13 @@ namespace OpenSim.Region.Environment.Scenes
1256 } 1256 }
1257 } 1257 }
1258 else // Updating existing item with new perms etc 1258 else // Updating existing item with new perms etc
1259 { 1259 {
1260 TaskInventoryItem prevItem = part.GetInventoryItem(itemID); 1260 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
1261System.Console.WriteLine("Item asset {0}, request asset {1}", prevItem.AssetID.ToString(), itemInfo.AssetID.ToString()); 1261 if (agentTransactions != null)
1262 itemInfo.AssetID = prevItem.AssetID; 1262 {
1263 if (part.UpdateInventoryItem(itemInfo)) 1263 agentTransactions.HandleTaskItemUpdateFromTransaction(
1264 part.GetProperties(remoteClient); 1264 remoteClient, part, transactionID, currentItem);
1265 }
1265 } 1266 }
1266 } 1267 }
1267 else 1268 else