aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs83
1 files changed, 44 insertions, 39 deletions
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index 74bb247..8192be4 100644
--- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -42,12 +42,12 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
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;
48 public AgentAssetTransactionsManager Manager;
47 public LLUUID UserID; 49 public LLUUID UserID;
48 public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>(); 50 public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>();
49 public AgentAssetTransactionsManager Manager;
50 private bool m_dumpAssetsToFile;
51 51
52 // Methods 52 // Methods
53 public AgentAssetTransactions(LLUUID agentID, AgentAssetTransactionsManager manager, bool dumpAssetsToFile) 53 public AgentAssetTransactions(LLUUID agentID, AgentAssetTransactionsManager manager, bool dumpAssetsToFile)
@@ -67,7 +67,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
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;
@@ -76,7 +76,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
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)
@@ -86,7 +86,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
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
@@ -101,15 +101,15 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
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.
@@ -122,40 +122,43 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
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
139 #region Nested type: AssetXferUploader
140
138 public class AssetXferUploader 141 public class AssetXferUploader
139 { 142 {
140 // Fields 143 // Fields
141 public bool AddToInventory; 144 public bool AddToInventory;
142 public AssetBase Asset; 145 public AssetBase Asset;
143 public LLUUID InventFolder = LLUUID.Zero; 146 public LLUUID InventFolder = LLUUID.Zero;
147 private sbyte invType = 0;
148 private bool m_createItem = false;
149 private string m_description = String.Empty;
150 private bool m_dumpAssetToFile;
151 private bool m_finished = false;
152 private string m_name = String.Empty;
153 private bool m_storeLocal;
154 private AgentAssetTransactions m_userTransactions;
155 private uint nextPerm = 0;
144 private IClientAPI ourClient; 156 private IClientAPI ourClient;
145 public LLUUID TransactionID = LLUUID.Zero; 157 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; 158 private sbyte type = 0;
151 private sbyte invType = 0; 159 public bool UploadComplete;
152 private byte wearableType = 0; 160 private byte wearableType = 0;
153 private uint nextPerm = 0; 161 public ulong XferID;
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 162
160 public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile) 163 public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile)
161 { 164 {
@@ -197,7 +200,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
197 return true; 200 return true;
198 } 201 }
199 } 202 }
200 203
201 return false; 204 return false;
202 } 205 }
203 206
@@ -233,7 +236,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
233 { 236 {
234 RequestStartXfer(); 237 RequestStartXfer();
235 } 238 }
236 239
237 return false; 240 return false;
238 } 241 }
239 242
@@ -279,7 +282,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
279 SaveAssetToFile(filename, Asset.Data); 282 SaveAssetToFile(filename, Asset.Data);
280 } 283 }
281 } 284 }
282 285
283 ///Left this in and commented in case there are unforseen issues 286 ///Left this in and commented in case there are unforseen issues
284 //private void SaveAssetToFile(string filename, byte[] data) 287 //private void SaveAssetToFile(string filename, byte[] data)
285 //{ 288 //{
@@ -327,28 +330,28 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
327 } 330 }
328 } 331 }
329 } 332 }
330 333
331 public void RequestUpdateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, 334 public void RequestUpdateInventoryItem(IClientAPI remoteClient, LLUUID transactionID,
332 InventoryItemBase item) 335 InventoryItemBase item)
333 { 336 {
334 if (TransactionID == transactionID) 337 if (TransactionID == transactionID)
335 { 338 {
336 CachedUserInfo userInfo = 339 CachedUserInfo userInfo =
337 m_userTransactions.Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails( 340 m_userTransactions.Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(
338 remoteClient.AgentId); 341 remoteClient.AgentId);
339 342
340 if (userInfo != null) 343 if (userInfo != null)
341 { 344 {
342 LLUUID assetID = LLUUID.Combine(transactionID, remoteClient.SecureSessionId); 345 LLUUID assetID = LLUUID.Combine(transactionID, remoteClient.SecureSessionId);
343 346
344 AssetBase asset 347 AssetBase asset
345 = m_userTransactions.Manager.MyScene.CommsManager.AssetCache.GetAsset( 348 = m_userTransactions.Manager.MyScene.CommsManager.AssetCache.GetAsset(
346 assetID, (item.AssetType == (int) AssetType.Texture ? true : false)); 349 assetID, (item.AssetType == (int) AssetType.Texture ? true : false));
347 350
348 if (asset == null) 351 if (asset == null)
349 { 352 {
350 asset = m_userTransactions.GetTransactionAsset(transactionID); 353 asset = m_userTransactions.GetTransactionAsset(transactionID);
351 } 354 }
352 355
353 if (asset != null && asset.FullID == assetID) 356 if (asset != null && asset.FullID == assetID)
354 { 357 {
@@ -359,10 +362,10 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
359 item.AssetID = asset.FullID; 362 item.AssetID = asset.FullID;
360 363
361 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(Asset); 364 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(Asset);
362 } 365 }
363 366
364 userInfo.UpdateItem(remoteClient.AgentId, item); 367 userInfo.UpdateItem(remoteClient.AgentId, item);
365 } 368 }
366 } 369 }
367 } 370 }
368 371
@@ -387,7 +390,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
387 item.BasePermissions = 2147483647; 390 item.BasePermissions = 2147483647;
388 item.CurrentPermissions = 2147483647; 391 item.CurrentPermissions = 2147483647;
389 item.NextPermissions = nextPerm; 392 item.NextPermissions = nextPerm;
390 item.Flags = (uint)wearableType; 393 item.Flags = (uint) wearableType;
391 394
392 userInfo.AddItem(ourClient.AgentId, item); 395 userInfo.AddItem(ourClient.AgentId, item);
393 ourClient.SendInventoryItemCreateUpdate(item); 396 ourClient.SendInventoryItemCreateUpdate(item);
@@ -403,5 +406,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
403 return null; 406 return null;
404 } 407 }
405 } 408 }
409
410 #endregion
406 } 411 }
407} \ No newline at end of file 412} \ No newline at end of file