aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorMW2008-11-24 10:03:18 +0000
committerMW2008-11-24 10:03:18 +0000
commit0be9ff19490149509dec72898be3f9dfe84612af (patch)
tree9f8f22a0995d99d3b4315d083cd4ec37c839d681 /OpenSim/Region/Environment
parentThanks SachaMagne for a patch which adds the following console commands: (diff)
downloadopensim-SC_OLD-0be9ff19490149509dec72898be3f9dfe84612af.zip
opensim-SC_OLD-0be9ff19490149509dec72898be3f9dfe84612af.tar.gz
opensim-SC_OLD-0be9ff19490149509dec72898be3f9dfe84612af.tar.bz2
opensim-SC_OLD-0be9ff19490149509dec72898be3f9dfe84612af.tar.xz
Some refactoring from about a week ago that I forgot to commit, of AssetTransactionModule to cut down on number of classes and to work towards having a base AssetXferUploader class than can be shared with EstateTerrainXferHandler
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs132
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs219
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs68
4 files changed, 299 insertions, 126 deletions
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs
index 010fcf7..f9f44f0 100644
--- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs
@@ -35,6 +35,7 @@ using OpenSim.Region.Interfaces;
35 35
36namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction 36namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
37{ 37{
38 /*
38 public class AgentAssetTransactionsManager 39 public class AgentAssetTransactionsManager
39 { 40 {
40 //private static readonly ILog m_log 41 //private static readonly ILog m_log
@@ -71,8 +72,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
71 { 72 {
72 if (!AgentTransactions.ContainsKey(userID)) 73 if (!AgentTransactions.ContainsKey(userID))
73 { 74 {
74 AgentAssetTransactions transactions 75 AgentAssetTransactions transactions = null;
75 = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile); 76 //= new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
76 AgentTransactions.Add(userID, transactions); 77 AgentTransactions.Add(userID, transactions);
77 } 78 }
78 79
@@ -226,4 +227,5 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
226 transactions.HandleXfer(xferID, packetID, data); 227 transactions.HandleXfer(xferID, packetID, data);
227 } 228 }
228 } 229 }
230 */
229} 231}
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index 2a91624..689b4d5 100644
--- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Environment.Scenes; 32using OpenSim.Region.Environment.Scenes;
33using OpenSim.Framework.Communications.Cache;
33 34
34namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction 35namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
35{ 36{
@@ -38,17 +39,16 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
38 /// </summary> 39 /// </summary>
39 public class AgentAssetTransactions 40 public class AgentAssetTransactions
40 { 41 {
41 //private static readonly log4net.ILog m_log 42 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
42 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
43 43
44 // Fields 44 // Fields
45 private bool m_dumpAssetsToFile; 45 private bool m_dumpAssetsToFile;
46 public AgentAssetTransactionsManager Manager; 46 public AssetTransactionModule Manager;
47 public UUID UserID; 47 public UUID UserID;
48 public Dictionary<UUID, AssetXferUploader> XferUploaders = new Dictionary<UUID, AssetXferUploader>(); 48 public Dictionary<UUID, AssetXferUploader> XferUploaders = new Dictionary<UUID, AssetXferUploader>();
49 49
50 // Methods 50 // Methods
51 public AgentAssetTransactions(UUID agentID, AgentAssetTransactionsManager manager, bool dumpAssetsToFile) 51 public AgentAssetTransactions(UUID agentID, AssetTransactionModule manager, bool dumpAssetsToFile)
52 { 52 {
53 UserID = agentID; 53 UserID = agentID;
54 Manager = manager; 54 Manager = manager;
@@ -97,24 +97,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
97 wearableType, nextOwnerMask); 97 wearableType, nextOwnerMask);
98 } 98 }
99 } 99 }
100
101 public void RequestUpdateInventoryItem(IClientAPI remoteClient, UUID transactionID,
102 InventoryItemBase item)
103 {
104 if (XferUploaders.ContainsKey(transactionID))
105 {
106 XferUploaders[transactionID].RequestUpdateInventoryItem(remoteClient, transactionID, item);
107 }
108 }
109 100
110 public void RequestUpdateTaskInventoryItem( 101
111 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
112 {
113 if (XferUploaders.ContainsKey(transactionID))
114 {
115 XferUploaders[transactionID].RequestUpdateTaskInventoryItem(remoteClient, part, transactionID, item);
116 }
117 }
118 102
119 /// <summary> 103 /// <summary>
120 /// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed. 104 /// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed.
@@ -138,5 +122,111 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
138 122
139 return null; 123 return null;
140 } 124 }
125
126 //private void CreateItemFromUpload(AssetBase asset, IClientAPI ourClient, UUID inventoryFolderID, uint nextPerms, uint wearableType)
127 //{
128 // Manager.MyScene.CommsManager.AssetCache.AddAsset(asset);
129 // CachedUserInfo userInfo = Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(
130 // ourClient.AgentId);
131
132 // if (userInfo != null)
133 // {
134 // InventoryItemBase item = new InventoryItemBase();
135 // item.Owner = ourClient.AgentId;
136 // item.Creator = ourClient.AgentId;
137 // item.ID = UUID.Random();
138 // item.AssetID = asset.FullID;
139 // item.Description = asset.Description;
140 // item.Name = asset.Name;
141 // item.AssetType = asset.Type;
142 // item.InvType = asset.Type;
143 // item.Folder = inventoryFolderID;
144 // item.BasePermissions = 0x7fffffff;
145 // item.CurrentPermissions = 0x7fffffff;
146 // item.EveryOnePermissions = 0;
147 // item.NextPermissions = nextPerms;
148 // item.Flags = wearableType;
149 // item.CreationDate = Util.UnixTimeSinceEpoch();
150
151 // userInfo.AddItem(item);
152 // ourClient.SendInventoryItemCreateUpdate(item);
153 // }
154 // else
155 // {
156 // m_log.ErrorFormat(
157 // "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation",
158 // ourClient.AgentId);
159 // }
160 //}
161
162 public void RequestUpdateTaskInventoryItem(
163 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
164 {
165 if (XferUploaders.ContainsKey(transactionID))
166 {
167 AssetBase asset = XferUploaders[transactionID].GetAssetData();
168 if (asset != null)
169 {
170 m_log.DebugFormat(
171 "[ASSET TRANSACTIONS]: Updating task item {0} in {1} with asset in transaction {2}",
172 item.Name, part.Name, transactionID);
173
174 asset.Name = item.Name;
175 asset.Description = item.Description;
176 asset.Type = (sbyte)item.Type;
177 item.AssetID = asset.FullID;
178
179 Manager.MyScene.CommsManager.AssetCache.AddAsset(asset);
180
181 if (part.Inventory.UpdateInventoryItem(item))
182 part.GetProperties(remoteClient);
183 }
184 }
185 }
186
187
188 public void RequestUpdateInventoryItem(IClientAPI remoteClient, UUID transactionID,
189 InventoryItemBase item)
190 {
191 if (XferUploaders.ContainsKey(transactionID))
192 {
193 CachedUserInfo userInfo = Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(
194 remoteClient.AgentId);
195
196 if (userInfo != null)
197 {
198 UUID assetID = UUID.Combine(transactionID, remoteClient.SecureSessionId);
199
200 AssetBase asset
201 = Manager.MyScene.CommsManager.AssetCache.GetAsset(
202 assetID, (item.AssetType == (int)AssetType.Texture ? true : false));
203
204 if (asset == null)
205 {
206 asset = GetTransactionAsset(transactionID);
207 }
208
209 if (asset != null && asset.FullID == assetID)
210 {
211 // Assets never get updated, new ones get created
212 asset.FullID = UUID.Random();
213 asset.Name = item.Name;
214 asset.Description = item.Description;
215 asset.Type = (sbyte)item.AssetType;
216 item.AssetID = asset.FullID;
217
218 Manager.MyScene.CommsManager.AssetCache.AddAsset(asset);
219 }
220
221 userInfo.UpdateItem(item);
222 }
223 else
224 {
225 m_log.ErrorFormat(
226 "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item update",
227 remoteClient.AgentId);
228 }
229 }
230 }
141 } 231 }
142} 232}
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs
index 19d7066..d98d07d 100644
--- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs
@@ -42,48 +42,23 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
42 private bool m_dumpAssetsToFile = false; 42 private bool m_dumpAssetsToFile = false;
43 private Scene m_scene = null; 43 private Scene m_scene = null;
44 44
45 private AgentAssetTransactionsManager m_transactionManager; 45 public Scene MyScene
46
47
48 public AssetTransactionModule()
49 {
50 // System.Console.WriteLine("creating AgentAssetTransactionModule");
51 }
52
53 #region IAgentAssetTransactions Members
54
55 public void HandleItemCreationFromTransaction(IClientAPI remoteClient, UUID transactionID, UUID folderID,
56 uint callbackID, string description, string name, sbyte invType,
57 sbyte type, byte wearableType, uint nextOwnerMask)
58 { 46 {
59 m_transactionManager.HandleItemCreationFromTransaction(remoteClient, transactionID, folderID, callbackID, description, name, invType, type, 47 get{ return m_scene;}
60 wearableType, nextOwnerMask);
61 } 48 }
62 49
63 public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, UUID transactionID, InventoryItemBase item) 50 /// <summary>
64 { 51 /// Each agent has its own singleton collection of transactions
65 m_transactionManager.HandleItemUpdateFromTransaction(remoteClient, transactionID, item); 52 /// </summary>
66 } 53 private Dictionary<UUID, AgentAssetTransactions> AgentTransactions =
54 new Dictionary<UUID, AgentAssetTransactions>();
67 55
68 public void HandleTaskItemUpdateFromTransaction(
69 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
70 {
71 m_transactionManager.HandleTaskItemUpdateFromTransaction(remoteClient, part, transactionID, item);
72 }
73
74 public void RequestXferFromClient(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type,
75 byte[] data, bool storeLocal, bool tempFile)
76 {
77 m_transactionManager.HandleUDPUploadRequest(remoteClient, assetID, transaction, type, data, storeLocal, tempFile);
78 }
79 56
80 public void RemoveAgentAssetTransactions(UUID userID) 57 public AssetTransactionModule()
81 { 58 {
82 m_transactionManager.RemoveAgentAssetTransactions(userID); 59 // System.Console.WriteLine("creating AgentAssetTransactionModule");
83 } 60 }
84 61
85 #endregion
86
87 #region IRegionModule Members 62 #region IRegionModule Members
88 63
89 public void Initialise(Scene scene, IConfigSource config) 64 public void Initialise(Scene scene, IConfigSource config)
@@ -105,16 +80,13 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
105 try 80 try
106 { 81 {
107 m_dumpAssetsToFile = config.Configs["StandAlone"].GetBoolean("dump_assets_to_file", false); 82 m_dumpAssetsToFile = config.Configs["StandAlone"].GetBoolean("dump_assets_to_file", false);
108 m_transactionManager = new AgentAssetTransactionsManager(m_scene, m_dumpAssetsToFile);
109 } 83 }
110 catch (Exception) 84 catch (Exception)
111 { 85 {
112 m_transactionManager = new AgentAssetTransactionsManager(m_scene, false);
113 } 86 }
114 } 87 }
115 else 88 else
116 { 89 {
117 m_transactionManager = new AgentAssetTransactionsManager(m_scene, false);
118 } 90 }
119 } 91 }
120 } 92 }
@@ -141,8 +113,177 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
141 113
142 public void NewClient(IClientAPI client) 114 public void NewClient(IClientAPI client)
143 { 115 {
144 client.OnAssetUploadRequest += m_transactionManager.HandleUDPUploadRequest; 116 client.OnAssetUploadRequest += HandleUDPUploadRequest;
145 client.OnXferReceive += m_transactionManager.HandleXfer; 117 client.OnXferReceive += HandleXfer;
118 }
119
120 #region AgentAssetTransactions
121 /// <summary>
122 /// Get the collection of asset transactions for the given user. If one does not already exist, it
123 /// is created.
124 /// </summary>
125 /// <param name="userID"></param>
126 /// <returns></returns>
127 private AgentAssetTransactions GetUserTransactions(UUID userID)
128 {
129 lock (AgentTransactions)
130 {
131 if (!AgentTransactions.ContainsKey(userID))
132 {
133 AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
134 AgentTransactions.Add(userID, transactions);
135 }
136
137 return AgentTransactions[userID];
138 }
139 }
140
141 /// <summary>
142 /// Remove the given agent asset transactions. This should be called when a client is departing
143 /// from a scene (and hence won't be making any more transactions here).
144 /// </summary>
145 /// <param name="userID"></param>
146 public void RemoveAgentAssetTransactions(UUID userID)
147 {
148 // m_log.DebugFormat("Removing agent asset transactions structure for agent {0}", userID);
149
150 lock (AgentTransactions)
151 {
152 AgentTransactions.Remove(userID);
153 }
154 }
155
156 /// <summary>
157 /// Create an inventory item from data that has been received through a transaction.
158 ///
159 /// This is called when new clothing or body parts are created. It may also be called in other
160 /// situations.
161 /// </summary>
162 /// <param name="remoteClient"></param>
163 /// <param name="transactionID"></param>
164 /// <param name="folderID"></param>
165 /// <param name="callbackID"></param>
166 /// <param name="description"></param>
167 /// <param name="name"></param>
168 /// <param name="invType"></param>
169 /// <param name="type"></param>
170 /// <param name="wearableType"></param>
171 /// <param name="nextOwnerMask"></param>
172 public void HandleItemCreationFromTransaction(IClientAPI remoteClient, UUID transactionID, UUID folderID,
173 uint callbackID, string description, string name, sbyte invType,
174 sbyte type, byte wearableType, uint nextOwnerMask)
175 {
176 // m_log.DebugFormat(
177 // "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name);
178
179 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
180
181 transactions.RequestCreateInventoryItem(
182 remoteClient, transactionID, folderID, callbackID, description,
183 name, invType, type, wearableType, nextOwnerMask);
146 } 184 }
185
186 /// <summary>
187 /// Update an inventory item with data that has been received through a transaction.
188 ///
189 /// This is called when clothing or body parts are updated (for instance, with new textures or
190 /// colours). It may also be called in other situations.
191 /// </summary>
192 /// <param name="remoteClient"></param>
193 /// <param name="transactionID"></param>
194 /// <param name="item"></param>
195 public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, UUID transactionID,
196 InventoryItemBase item)
197 {
198 // m_log.DebugFormat(
199 // "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}",
200 // item.Name);
201
202 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
203
204 transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item);
205 }
206
207 /// <summary>
208 /// Update a task inventory item with data that has been received through a transaction.
209 ///
210 /// This is currently called when, for instance, a notecard in a prim is saved. The data is sent
211 /// up through a single AssetUploadRequest. A subsequent UpdateTaskInventory then references the transaction
212 /// and comes through this method.
213 /// </summary>
214 /// <param name="remoteClient"></param>
215 /// <param name="transactionID"></param>
216 /// <param name="item"></param>
217 public void HandleTaskItemUpdateFromTransaction(
218 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
219 {
220 // m_log.DebugFormat(
221 // "[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0}",
222 // item.Name);
223
224 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
225
226 transactions.RequestUpdateTaskInventoryItem(remoteClient, part, transactionID, item);
227 }
228
229 /// <summary>
230 /// Request that a client (agent) begin an asset transfer.
231 /// </summary>
232 /// <param name="remoteClient"></param>
233 /// <param name="assetID"></param>
234 /// <param name="transaction"></param>
235 /// <param name="type"></param>
236 /// <param name="data"></param></param>
237 /// <param name="tempFile"></param>
238 public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type,
239 byte[] data, bool storeLocal, bool tempFile)
240 {
241 //System.Console.WriteLine("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile);
242 if (((AssetType)type == AssetType.Texture ||
243 (AssetType)type == AssetType.Sound ||
244 (AssetType)type == AssetType.TextureTGA ||
245 (AssetType)type == AssetType.Animation) &&
246 tempFile == false)
247 {
248 Scene scene = (Scene)remoteClient.Scene;
249 IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>();
250
251 if (mm != null)
252 {
253 if (!mm.UploadCovered(remoteClient))
254 {
255 remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
256 return;
257 }
258 }
259 }
260
261 //Console.WriteLine("asset upload of " + assetID);
262 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
263
264 AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
265 if (uploader != null)
266 {
267 uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile);
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 //System.Console.WriteLine("xferID: " + xferID + " packetID: " + packetID + " data!");
282 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
283
284 transactions.HandleXfer(xferID, packetID, data);
285 }
286
287 #endregion
147 } 288 }
148} 289}
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs
index 3ef2e1f..6dcbe83 100644
--- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -199,81 +199,21 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
199 m_asset.Name = name; 199 m_asset.Name = name;
200 m_asset.Description = description; 200 m_asset.Description = description;
201 m_asset.Type = type; 201 m_asset.Type = type;
202 m_createItem = true; 202
203
204 if (m_finished) 203 if (m_finished)
205 { 204 {
206 DoCreateItem(); 205 DoCreateItem();
207 } 206 }
208 }
209 }
210
211 public void RequestUpdateInventoryItem(IClientAPI remoteClient, UUID transactionID,
212 InventoryItemBase item)
213 {
214 if (TransactionID == transactionID)
215 {
216 CachedUserInfo userInfo =
217 m_userTransactions.Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(
218 remoteClient.AgentId);
219
220 if (userInfo != null)
221 {
222 UUID assetID = UUID.Combine(transactionID, remoteClient.SecureSessionId);
223
224 AssetBase asset
225 = m_userTransactions.Manager.MyScene.CommsManager.AssetCache.GetAsset(
226 assetID, (item.AssetType == (int) AssetType.Texture ? true : false));
227
228 if (asset == null)
229 {
230 asset = m_userTransactions.GetTransactionAsset(transactionID);
231 }
232
233 if (asset != null && asset.FullID == assetID)
234 {
235 // Assets never get updated, new ones get created
236 asset.FullID = UUID.Random();
237 asset.Name = item.Name;
238 asset.Description = item.Description;
239 asset.Type = (sbyte) item.AssetType;
240 item.AssetID = asset.FullID;
241
242 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(m_asset);
243 }
244
245 userInfo.UpdateItem(item);
246 }
247 else 207 else
248 { 208 {
249 m_log.ErrorFormat( 209 m_createItem = true; //set flag so the inventory item is created when upload is complete
250 "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item update", 210 }
251 remoteClient.AgentId);
252 }
253 } 211 }
254 } 212 }
255 213
256 public void RequestUpdateTaskInventoryItem(
257 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
258 {
259 m_log.DebugFormat(
260 "[ASSET TRANSACTIONS]: Updating task item {0} in {1} with asset in transaction {2}",
261 item.Name, part.Name, transactionID);
262
263 m_asset.Name = item.Name;
264 m_asset.Description = item.Description;
265 m_asset.Type = (sbyte) item.Type;
266 item.AssetID = m_asset.FullID;
267
268 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(m_asset);
269
270 if (part.Inventory.UpdateInventoryItem(item))
271 part.GetProperties(remoteClient);
272 }
273 214
274 private void DoCreateItem() 215 private void DoCreateItem()
275 { 216 {
276 //really need to fix this call, if lbsa71 saw this he would die.
277 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(m_asset); 217 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(m_asset);
278 CachedUserInfo userInfo = 218 CachedUserInfo userInfo =
279 m_userTransactions.Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails( 219 m_userTransactions.Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(