aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Agent/AssetTransaction
diff options
context:
space:
mode:
authorAdam Frisby2008-04-30 21:43:47 +0000
committerAdam Frisby2008-04-30 21:43:47 +0000
commitbe20f41637b6c06ce3ab16bc25851b6e43468e12 (patch)
treec41081329891f4c24de704fc760fb9012954ac9d /OpenSim/Region/Environment/Modules/Agent/AssetTransaction
parent* Sometimes you know, you do something really stupid. (diff)
downloadopensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.zip
opensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.gz
opensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.bz2
opensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.xz
* Cruft removal step #1. Cleaning Modules directory.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Agent/AssetTransaction')
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs83
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs55
2 files changed, 74 insertions, 64 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
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs
index ef81625..b264c8a 100644
--- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs
@@ -33,7 +33,6 @@ using 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.Modules.Agent.AssetTransaction;
37using OpenSim.Region.Environment.Scenes; 36using OpenSim.Region.Environment.Scenes;
38 37
39namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction 38namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
@@ -41,8 +40,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
41 public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions 40 public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions
42 { 41 {
43 private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); 42 private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
44 private Scene m_scene = null;
45 private bool m_dumpAssetsToFile = false; 43 private bool m_dumpAssetsToFile = false;
44 private Scene m_scene = null;
46 45
47 private AgentAssetTransactionsManager m_transactionManager; 46 private AgentAssetTransactionsManager m_transactionManager;
48 47
@@ -51,6 +50,31 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
51 // System.Console.WriteLine("creating AgentAssetTransactionModule"); 50 // System.Console.WriteLine("creating AgentAssetTransactionModule");
52 } 51 }
53 52
53 #region IAgentAssetTransactions Members
54
55 public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
56 uint callbackID, string description, string name, sbyte invType,
57 sbyte type, byte wearableType, uint nextOwnerMask)
58 {
59 m_transactionManager.HandleItemCreationFromTransaction(remoteClient, transactionID, folderID, callbackID, description, name, invType, type,
60 wearableType, nextOwnerMask);
61 }
62
63 public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, LLUUID transactionID,
64 InventoryItemBase item)
65 {
66 m_transactionManager.HandleItemUpdateFromTransaction(remoteClient, transactionID, item);
67 }
68
69 public void RemoveAgentAssetTransactions(LLUUID userID)
70 {
71 m_transactionManager.RemoveAgentAssetTransactions(userID);
72 }
73
74 #endregion
75
76 #region IRegionModule Members
77
54 public void Initialise(Scene scene, IConfigSource config) 78 public void Initialise(Scene scene, IConfigSource config)
55 { 79 {
56 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) 80 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
@@ -81,13 +105,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
81 { 105 {
82 m_transactionManager = new AgentAssetTransactionsManager(m_scene, false); 106 m_transactionManager = new AgentAssetTransactionsManager(m_scene, false);
83 } 107 }
84
85 } 108 }
86 } 109 }
87 110
88 public void PostInitialise() 111 public void PostInitialise()
89 { 112 {
90
91 } 113 }
92 114
93 public void Close() 115 public void Close()
@@ -104,29 +126,13 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
104 get { return true; } 126 get { return true; }
105 } 127 }
106 128
129 #endregion
130
107 public void NewClient(IClientAPI client) 131 public void NewClient(IClientAPI client)
108 { 132 {
109 client.OnAssetUploadRequest += m_transactionManager.HandleUDPUploadRequest; 133 client.OnAssetUploadRequest += m_transactionManager.HandleUDPUploadRequest;
110 client.OnXferReceive += m_transactionManager.HandleXfer; 134 client.OnXferReceive += m_transactionManager.HandleXfer;
111 } 135 }
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 } 136 }
131 137
132 public class AgentAssetTransactionsManager 138 public class AgentAssetTransactionsManager
@@ -135,7 +141,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
135 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 141 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
136 142
137 // Fields 143 // Fields
138 public Scene MyScene;
139 144
140 /// <summary> 145 /// <summary>
141 /// Each agent has its own singleton collection of transactions 146 /// Each agent has its own singleton collection of transactions
@@ -148,6 +153,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
148 /// </summary> 153 /// </summary>
149 private bool m_dumpAssetsToFile; 154 private bool m_dumpAssetsToFile;
150 155
156 public Scene MyScene;
157
151 public AgentAssetTransactionsManager(Scene scene, bool dumpAssetsToFile) 158 public AgentAssetTransactionsManager(Scene scene, bool dumpAssetsToFile)
152 { 159 {
153 MyScene = scene; 160 MyScene = scene;
@@ -260,10 +267,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
260 AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction); 267 AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
261 if (uploader != null) 268 if (uploader != null)
262 { 269 {
263
264 if (uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile)) 270 if (uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile))
265 { 271 {
266
267 } 272 }
268 } 273 }
269 } 274 }