aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs3
-rw-r--r--OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs5
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs12
-rw-r--r--OpenSim/Region/Environment/Modules/AgentAgentTransactionModule.cs244
-rw-r--r--OpenSim/Region/Environment/Modules/AgentAssetsTransactions.cs382
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs81
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs19
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs3
9 files changed, 701 insertions, 60 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs b/OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs
index 3882ade..4aefe83 100644
--- a/OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs
+++ b/OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs
@@ -25,6 +25,8 @@
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*/
28//moved to a module, left here until the module is found to have no problems
29/*
28using System; 30using System;
29using System.Collections.Generic; 31using System.Collections.Generic;
30using System.IO; 32using System.IO;
@@ -553,3 +555,4 @@ namespace OpenSim.Framework.Communications.Cache
553 #endregion 555 #endregion
554 } 556 }
555} 557}
558*/ \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs b/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs
index bb523f4..97b716c 100644
--- a/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs
+++ b/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs
@@ -26,6 +26,8 @@
26* 26*
27*/ 27*/
28 28
29//moved to a module, left here until the module is found to have no problems
30/*
29using System; 31using System;
30using System.Collections.Generic; 32using System.Collections.Generic;
31 33
@@ -181,7 +183,7 @@ namespace OpenSim.Framework.Communications.Cache
181 183
182 //m_log.InfoFormat("[ASSET TRANSACTIONS] Current uploaders: {0}", transactions.XferUploaders.Count); 184 //m_log.InfoFormat("[ASSET TRANSACTIONS] Current uploaders: {0}", transactions.XferUploaders.Count);
183 }*/ 185 }*/
184 } 186 /* }
185 } 187 }
186 } 188 }
187 189
@@ -201,3 +203,4 @@ namespace OpenSim.Framework.Communications.Cache
201 } 203 }
202 } 204 }
203} 205}
206*/ \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index 3e72d89..eb820c1 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -73,12 +73,12 @@ namespace OpenSim.Framework.Communications
73 get { return m_userProfileCacheService; } 73 get { return m_userProfileCacheService; }
74 } 74 }
75 75
76 protected AgentAssetTransactionsManager m_transactionsManager; 76 // protected AgentAssetTransactionsManager m_transactionsManager;
77 77
78 public AgentAssetTransactionsManager TransactionsManager 78 // public AgentAssetTransactionsManager TransactionsManager
79 { 79 // {
80 get { return m_transactionsManager; } 80 // get { return m_transactionsManager; }
81 } 81 // }
82 82
83 protected AssetCache m_assetCache; 83 protected AssetCache m_assetCache;
84 84
@@ -100,7 +100,7 @@ namespace OpenSim.Framework.Communications
100 m_networkServersInfo = serversInfo; 100 m_networkServersInfo = serversInfo;
101 m_assetCache = assetCache; 101 m_assetCache = assetCache;
102 m_userProfileCacheService = new UserProfileCacheService(this); 102 m_userProfileCacheService = new UserProfileCacheService(this);
103 m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile); 103 // m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile);
104 } 104 }
105 105
106 public void doCreate(string[] cmmdParams) 106 public void doCreate(string[] cmmdParams)
diff --git a/OpenSim/Region/Environment/Modules/AgentAgentTransactionModule.cs b/OpenSim/Region/Environment/Modules/AgentAgentTransactionModule.cs
new file mode 100644
index 0000000..2374964
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/AgentAgentTransactionModule.cs
@@ -0,0 +1,244 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using Nini.Config;
6using OpenSim.Framework;
7using OpenSim.Region.Environment.Interfaces;
8using OpenSim.Region.Environment.Scenes;
9
10namespace OpenSim.Region.Environment.Modules
11{
12 public class AgentAgentTransactionModule : IRegionModule, IAgentAssetTransactions
13 {
14 private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
15 private Scene m_scene = null;
16 private bool m_dumpAssetsToFile = false;
17
18 private AgentAssetTransactionsManager m_transactionManager;
19
20 public void Initialise(Scene scene, IConfigSource config)
21 {
22 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
23 {
24 RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
25 scene.RegisterModuleInterface<IAgentAssetTransactions>(this);
26
27 scene.EventManager.OnNewClient += NewClient;
28
29 try
30 {
31 m_dumpAssetsToFile = config.Configs["StandAlone"].GetBoolean("dump_assets_to_file", false);
32 }
33 catch (Exception)
34 {
35 }
36 }
37
38 if (m_scene == null)
39 {
40 m_scene = scene;
41 m_transactionManager = new AgentAssetTransactionsManager(m_scene, m_dumpAssetsToFile);
42 }
43 }
44
45 public void PostInitialise()
46 {
47
48 }
49
50 public void Close()
51 {
52 }
53
54 public string Name
55 {
56 get { return "AgentTransactionModule"; }
57 }
58
59 public bool IsSharedModule
60 {
61 get { return true; }
62 }
63
64 public void NewClient(IClientAPI client)
65 {
66 client.OnAssetUploadRequest += m_transactionManager.HandleUDPUploadRequest;
67 client.OnXferReceive += m_transactionManager.HandleXfer;
68 }
69
70 public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
71 uint callbackID, string description, string name, sbyte invType,
72 sbyte type, byte wearableType, uint nextOwnerMask)
73 {
74 m_transactionManager.HandleItemCreationFromTransaction(remoteClient, transactionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask);
75 }
76
77 public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, LLUUID transactionID,
78 InventoryItemBase item)
79 {
80 m_transactionManager.HandleItemUpdateFromTransaction(remoteClient, transactionID, item);
81 }
82
83 public void RemoveAgentAssetTransactions(LLUUID userID)
84 {
85 m_transactionManager.RemoveAgentAssetTransactions(userID);
86 }
87 }
88
89 //should merge this classes and clean up
90 public class AgentAssetTransactionsManager
91 {
92 private static readonly log4net.ILog m_log
93 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
94
95 // Fields
96 public Scene MyScene;
97
98 /// <summary>
99 /// Each agent has its own singleton collection of transactions
100 /// </summary>
101 private Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions =
102 new Dictionary<LLUUID, AgentAssetTransactions>();
103
104 /// <summary>
105 /// Should we dump uploaded assets to the filesystem?
106 /// </summary>
107 private bool m_dumpAssetsToFile;
108
109 public AgentAssetTransactionsManager(Scene scene, bool dumpAssetsToFile)
110 {
111 MyScene = scene;
112 m_dumpAssetsToFile = dumpAssetsToFile;
113 }
114
115 /// <summary>
116 /// Get the collection of asset transactions for the given user. If one does not already exist, it
117 /// is created.
118 /// </summary>
119 /// <param name="userID"></param>
120 /// <returns></returns>
121 private AgentAssetTransactions GetUserTransactions(LLUUID userID)
122 {
123 lock (AgentTransactions)
124 {
125 if (!AgentTransactions.ContainsKey(userID))
126 {
127 AgentAssetTransactions transactions
128 = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
129 AgentTransactions.Add(userID, transactions);
130 }
131
132 return AgentTransactions[userID];
133 }
134 }
135
136 /// <summary>
137 /// Remove the given agent asset transactions. This should be called when a client is departing
138 /// from a scene (and hence won't be making any more transactions here).
139 /// </summary>
140 /// <param name="userID"></param>
141 public void RemoveAgentAssetTransactions(LLUUID userID)
142 {
143 // m_log.DebugFormat("Removing agent asset transactions structure for agent {0}", userID);
144
145 lock (AgentTransactions)
146 {
147 AgentTransactions.Remove(userID);
148 }
149 }
150
151 /// <summary>
152 /// Create an inventory item from data that has been received through a transaction.
153 ///
154 /// This is called when new clothing or body parts are created. It may also be called in other
155 /// situations.
156 /// </summary>
157 /// <param name="remoteClient"></param>
158 /// <param name="transactionID"></param>
159 /// <param name="folderID"></param>
160 /// <param name="callbackID"></param>
161 /// <param name="description"></param>
162 /// <param name="name"></param>
163 /// <param name="invType"></param>
164 /// <param name="type"></param>
165 /// <param name="wearableType"></param>
166 /// <param name="nextOwnerMask"></param>
167 public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
168 uint callbackID, string description, string name, sbyte invType,
169 sbyte type, byte wearableType, uint nextOwnerMask)
170 {
171 m_log.DebugFormat(
172 "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name);
173
174 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
175
176 transactions.RequestCreateInventoryItem(
177 remoteClient, transactionID, folderID, callbackID, description,
178 name, invType, type, wearableType, nextOwnerMask);
179 }
180
181 /// <summary>
182 /// Update an inventory item with data that has been received through a transaction.
183 ///
184 /// This is called when clothing or body parts are updated (for instance, with new textures or
185 /// colours). It may also be called in other situations.
186 /// </summary>
187 /// <param name="remoteClient"></param>
188 /// <param name="transactionID"></param>
189 /// <param name="item"></param>
190 public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, LLUUID transactionID,
191 InventoryItemBase item)
192 {
193 m_log.DebugFormat(
194 "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}",
195 item.inventoryName);
196
197 AgentAssetTransactions transactions
198 = GetUserTransactions(remoteClient.AgentId);
199
200 transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item);
201 }
202
203 /// <summary>
204 /// Request that a client (agent) begin an asset transfer.
205 /// </summary>
206 /// <param name="remoteClient"></param>
207 /// <param name="assetID"></param>
208 /// <param name="transaction"></param>
209 /// <param name="type"></param>
210 /// <param name="data"></param></param>
211 /// <param name="tempFile"></param>
212 public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type,
213 byte[] data, bool storeLocal, bool tempFile)
214 {
215 // Console.WriteLine("asset upload of " + assetID);
216 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
217
218 AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
219 if (uploader != null)
220 {
221
222 if (uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile))
223 {
224
225 }
226 }
227 }
228
229 /// <summary>
230 /// Handle asset transfer data packets received in response to the asset upload request in
231 /// HandleUDPUploadRequest()
232 /// </summary>
233 /// <param name="remoteClient"></param>
234 /// <param name="xferID"></param>
235 /// <param name="packetID"></param>
236 /// <param name="data"></param>
237 public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
238 {
239 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
240
241 transactions.HandleXfer(xferID, packetID, data);
242 }
243 }
244}
diff --git a/OpenSim/Region/Environment/Modules/AgentAssetsTransactions.cs b/OpenSim/Region/Environment/Modules/AgentAssetsTransactions.cs
new file mode 100644
index 0000000..d9126f4
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/AgentAssetsTransactions.cs
@@ -0,0 +1,382 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.IO;
5using libsecondlife;
6using libsecondlife.Packets;
7using OpenSim.Framework.Servers;
8using OpenSim.Framework;
9using OpenSim.Framework.Communications.Cache;
10
11namespace OpenSim.Region.Environment.Modules
12{
13
14 /// <summary>
15 /// Manage asset transactions for a single agent.
16 /// </summary>
17 public class AgentAssetTransactions
18 {
19 //private static readonly log4net.ILog m_log
20 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
21
22 // Fields
23 public LLUUID UserID;
24 public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>();
25 public AgentAssetTransactionsManager Manager;
26 private bool m_dumpAssetsToFile;
27
28 // Methods
29 public AgentAssetTransactions(LLUUID agentID, AgentAssetTransactionsManager manager, bool dumpAssetsToFile)
30 {
31 UserID = agentID;
32 Manager = manager;
33 m_dumpAssetsToFile = dumpAssetsToFile;
34 }
35
36 public AssetXferUploader RequestXferUploader(LLUUID transactionID)
37 {
38 if (!XferUploaders.ContainsKey(transactionID))
39 {
40 AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile);
41
42 lock (XferUploaders)
43 {
44 XferUploaders.Add(transactionID, uploader);
45 }
46
47 return uploader;
48 }
49 return null;
50 }
51
52 public void HandleXfer(ulong xferID, uint packetID, byte[] data)
53 {
54 AssetXferUploader uploaderFound = null;
55
56 lock (XferUploaders)
57 {
58 foreach (AssetXferUploader uploader in XferUploaders.Values)
59 {
60 if (uploader.XferID == xferID)
61 {
62 break;
63 }
64 }
65
66 }
67 }
68
69 public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
70 uint callbackID, string description, string name, sbyte invType,
71 sbyte type, byte wearableType, uint nextOwnerMask)
72 {
73 if (XferUploaders.ContainsKey(transactionID))
74 {
75 XferUploaders[transactionID].RequestCreateInventoryItem(remoteClient, transactionID, folderID,
76 callbackID, description, name, invType, type,
77 wearableType, nextOwnerMask);
78 }
79 }
80
81 public void RequestUpdateInventoryItem(IClientAPI remoteClient, LLUUID transactionID,
82 InventoryItemBase item)
83 {
84 if (XferUploaders.ContainsKey(transactionID))
85 {
86 XferUploaders[transactionID].RequestUpdateInventoryItem(remoteClient, transactionID, item);
87 }
88 }
89
90 /// <summary>
91 /// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed.
92 /// </summary>
93 /// <param name="transactionID"></param>
94 /// <returns>The asset if the upload has completed, null if it has not.</returns>
95 public AssetBase GetTransactionAsset(LLUUID transactionID)
96 {
97 if (XferUploaders.ContainsKey(transactionID))
98 {
99 AssetXferUploader uploader = XferUploaders[transactionID];
100 AssetBase asset = uploader.GetAssetData();
101
102 lock (XferUploaders)
103 {
104 XferUploaders.Remove(transactionID);
105 }
106
107 return asset;
108 }
109
110 return null;
111 }
112
113 // Nested Types
114 public class AssetXferUploader
115 {
116 // Fields
117 public bool AddToInventory;
118 public AssetBase Asset;
119 public LLUUID InventFolder = LLUUID.Zero;
120 private IClientAPI ourClient;
121 public LLUUID TransactionID = LLUUID.Zero;
122 public bool UploadComplete;
123 public ulong XferID;
124 private string m_name = String.Empty;
125 private string m_description = String.Empty;
126 private sbyte type = 0;
127 private sbyte invType = 0;
128 private uint nextPerm = 0;
129 private bool m_finished = false;
130 private bool m_createItem = false;
131 private AgentAssetTransactions m_userTransactions;
132 private bool m_storeLocal;
133 private bool m_dumpAssetToFile;
134
135 public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile)
136 {
137 m_userTransactions = transactions;
138 m_dumpAssetToFile = dumpAssetToFile;
139 }
140
141 /// <summary>
142 /// Process transfer data received from the client.
143 /// </summary>
144 /// <param name="xferID"></param>
145 /// <param name="packetID"></param>
146 /// <param name="data"></param>
147 /// <returns>True if the transfer is complete, false otherwise or if the xferID was not valid</returns>
148 public bool HandleXferPacket(ulong xferID, uint packetID, byte[] data)
149 {
150 if (XferID == xferID)
151 {
152 if (Asset.Data.Length > 1)
153 {
154 byte[] destinationArray = new byte[Asset.Data.Length + data.Length];
155 Array.Copy(Asset.Data, 0, destinationArray, 0, Asset.Data.Length);
156 Array.Copy(data, 0, destinationArray, Asset.Data.Length, data.Length);
157 Asset.Data = destinationArray;
158 }
159 else
160 {
161 byte[] buffer2 = new byte[data.Length - 4];
162 Array.Copy(data, 4, buffer2, 0, data.Length - 4);
163 Asset.Data = buffer2;
164 }
165 ConfirmXferPacketPacket newPack = new ConfirmXferPacketPacket();
166 newPack.XferID.ID = xferID;
167 newPack.XferID.Packet = packetID;
168 ourClient.OutPacket(newPack, ThrottleOutPacketType.Asset);
169 if ((packetID & 0x80000000) != 0)
170 {
171 SendCompleteMessage();
172 return true;
173 }
174 }
175
176 return false;
177 }
178
179 /// <summary>
180 /// Initialise asset transfer from the client
181 /// </summary>
182 /// <param name="xferID"></param>
183 /// <param name="packetID"></param>
184 /// <param name="data"></param>
185 /// <returns>True if the transfer is complete, false otherwise</returns>
186 public bool Initialise(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data,
187 bool storeLocal, bool tempFile)
188 {
189 ourClient = remoteClient;
190 Asset = new AssetBase();
191 Asset.FullID = assetID;
192 Asset.InvType = type;
193 Asset.Type = type;
194 Asset.Data = data;
195 Asset.Name = "blank";
196 Asset.Description = "empty";
197 Asset.Local = storeLocal;
198 Asset.Temporary = tempFile;
199
200 TransactionID = transaction;
201 m_storeLocal = storeLocal;
202 if (Asset.Data.Length > 2)
203 {
204 SendCompleteMessage();
205 return true;
206 }
207 else
208 {
209 RequestStartXfer();
210 }
211
212 return false;
213 }
214
215 protected void RequestStartXfer()
216 {
217 UploadComplete = false;
218 XferID = Util.GetNextXferID();
219 RequestXferPacket newPack = new RequestXferPacket();
220 newPack.XferID.ID = XferID;
221 newPack.XferID.VFileType = Asset.Type;
222 newPack.XferID.VFileID = Asset.FullID;
223 newPack.XferID.FilePath = 0;
224 newPack.XferID.Filename = new byte[0];
225 ourClient.OutPacket(newPack, ThrottleOutPacketType.Asset);
226 }
227
228 protected void SendCompleteMessage()
229 {
230 UploadComplete = true;
231 AssetUploadCompletePacket newPack = new AssetUploadCompletePacket();
232 newPack.AssetBlock.Type = Asset.Type;
233 newPack.AssetBlock.Success = true;
234 newPack.AssetBlock.UUID = Asset.FullID;
235 ourClient.OutPacket(newPack, ThrottleOutPacketType.Asset);
236 m_finished = true;
237 if (m_createItem)
238 {
239 DoCreateItem();
240 }
241 else if (m_storeLocal)
242 {
243 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(Asset);
244 }
245
246 // Console.WriteLine("upload complete "+ this.TransactionID);
247
248 if (m_dumpAssetToFile)
249 {
250 DateTime now = DateTime.Now;
251 string filename =
252 String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat", now.Year, now.Month, now.Day,
253 now.Hour, now.Minute, now.Second, Asset.Name, Asset.Type);
254 SaveAssetToFile(filename, Asset.Data);
255 }
256 }
257
258 ///Left this in and commented in case there are unforseen issues
259 //private void SaveAssetToFile(string filename, byte[] data)
260 //{
261 // FileStream fs = File.Create(filename);
262 // BinaryWriter bw = new BinaryWriter(fs);
263 // bw.Write(data);
264 // bw.Close();
265 // fs.Close();
266 //}
267 private void SaveAssetToFile(string filename, byte[] data)
268 {
269 string assetPath = "UserAssets";
270 if (!Directory.Exists(assetPath))
271 {
272 Directory.CreateDirectory(assetPath);
273 }
274 FileStream fs = File.Create(Path.Combine(assetPath, filename));
275 BinaryWriter bw = new BinaryWriter(fs);
276 bw.Write(data);
277 bw.Close();
278 fs.Close();
279 }
280
281 public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
282 uint callbackID, string description, string name, sbyte invType,
283 sbyte type, byte wearableType, uint nextOwnerMask)
284 {
285 if (TransactionID == transactionID)
286 {
287 InventFolder = folderID;
288 m_name = name;
289 m_description = description;
290 this.type = type;
291 this.invType = invType;
292 nextPerm = nextOwnerMask;
293 Asset.Name = name;
294 Asset.Description = description;
295 Asset.Type = type;
296 Asset.InvType = invType;
297 m_createItem = true;
298 if (m_finished)
299 {
300 DoCreateItem();
301 }
302 }
303 }
304
305 public void RequestUpdateInventoryItem(IClientAPI remoteClient, LLUUID transactionID,
306 InventoryItemBase item)
307 {
308 if (TransactionID == transactionID)
309 {
310 CachedUserInfo userInfo =
311 m_userTransactions.Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(
312 remoteClient.AgentId);
313
314 if (userInfo != null)
315 {
316 LLUUID assetID = LLUUID.Combine(transactionID, remoteClient.SecureSessionId);
317
318 AssetBase asset
319 = m_userTransactions.Manager.MyScene.CommsManager.AssetCache.GetAsset(
320 assetID, (item.assetType == (int) AssetType.Texture ? true : false));
321
322 if (asset == null)
323 {
324 asset = m_userTransactions.GetTransactionAsset(transactionID);
325 }
326
327 if (asset != null && asset.FullID == assetID)
328 {
329 asset.Name = item.inventoryName;
330 asset.Description = item.inventoryDescription;
331 asset.InvType = (sbyte) item.invType;
332 asset.Type = (sbyte) item.assetType;
333 item.assetID = asset.FullID;
334
335 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(Asset);
336 }
337
338 userInfo.UpdateItem(remoteClient.AgentId, item);
339 }
340 }
341 }
342
343 private void DoCreateItem()
344 {
345 //really need to fix this call, if lbsa71 saw this he would die.
346 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(Asset);
347 CachedUserInfo userInfo =
348 m_userTransactions.Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(ourClient.AgentId);
349 if (userInfo != null)
350 {
351 InventoryItemBase item = new InventoryItemBase();
352 item.avatarID = ourClient.AgentId;
353 item.creatorsID = ourClient.AgentId;
354 item.inventoryID = LLUUID.Random();
355 item.assetID = Asset.FullID;
356 item.inventoryDescription = m_description;
357 item.inventoryName = m_name;
358 item.assetType = type;
359 item.invType = invType;
360 item.parentFolderID = InventFolder;
361 item.inventoryBasePermissions = 2147483647;
362 item.inventoryCurrentPermissions = 2147483647;
363 item.inventoryNextPermissions = nextPerm;
364
365 userInfo.AddItem(ourClient.AgentId, item);
366 ourClient.SendInventoryItemCreateUpdate(item);
367 }
368 }
369
370 public AssetBase GetAssetData()
371 {
372 if (m_finished)
373 {
374 return Asset;
375 }
376 return null;
377 }
378 }
379
380 }
381
382}
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 48fa3dc..57b8ae7 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -150,7 +150,7 @@ namespace OpenSim.Region.Environment.Scenes
150 { 150 {
151 lock (m_syncRoot) 151 lock (m_syncRoot)
152 { 152 {
153 return _PhyScene.Simulate((float) elapsed); 153 return _PhyScene.Simulate((float)elapsed);
154 } 154 }
155 } 155 }
156 156
@@ -175,7 +175,7 @@ namespace OpenSim.Region.Environment.Scenes
175 foreach (SceneObjectPart part in sceneObject.Children.Values) 175 foreach (SceneObjectPart part in sceneObject.Children.Values)
176 { 176 {
177 part.LocalID = m_parentScene.PrimIDAllocate(); 177 part.LocalID = m_parentScene.PrimIDAllocate();
178 178
179 } 179 }
180 sceneObject.UpdateParentIDs(); 180 sceneObject.UpdateParentIDs();
181 AddEntity(sceneObject); 181 AddEntity(sceneObject);
@@ -222,9 +222,9 @@ namespace OpenSim.Region.Environment.Scenes
222 { 222 {
223 if (obj is SceneObjectGroup) 223 if (obj is SceneObjectGroup)
224 { 224 {
225 if (((SceneObjectGroup) obj).LocalId == localID) 225 if (((SceneObjectGroup)obj).LocalId == localID)
226 { 226 {
227 m_parentScene.RemoveEntity((SceneObjectGroup) obj); 227 m_parentScene.RemoveEntity((SceneObjectGroup)obj);
228 m_numPrim--; 228 m_numPrim--;
229 return; 229 return;
230 } 230 }
@@ -237,7 +237,8 @@ namespace OpenSim.Region.Environment.Scenes
237 System.Console.WriteLine("Attaching object " + objectLocalID + " to " + AttachmentPt); 237 System.Console.WriteLine("Attaching object " + objectLocalID + " to " + AttachmentPt);
238 SceneObjectPart p = GetSceneObjectPart(objectLocalID); 238 SceneObjectPart p = GetSceneObjectPart(objectLocalID);
239 ScenePresence av = null; 239 ScenePresence av = null;
240 if (TryGetAvatar(remoteClient.AgentId, out av)) { 240 if (TryGetAvatar(remoteClient.AgentId, out av))
241 {
241 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 242 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
242 objupdate.RegionData.RegionHandle = m_regInfo.RegionHandle; 243 objupdate.RegionData.RegionHandle = m_regInfo.RegionHandle;
243 objupdate.RegionData.TimeDilation = ushort.MaxValue; 244 objupdate.RegionData.TimeDilation = ushort.MaxValue;
@@ -287,7 +288,7 @@ namespace OpenSim.Region.Environment.Scenes
287 objupdate.ObjectData[0].NameValue = 288 objupdate.ObjectData[0].NameValue =
288 Helpers.StringToField("FirstName STRING RW SV " + av.Firstname + "\nLastName STRING RW SV " + av.Lastname); 289 Helpers.StringToField("FirstName STRING RW SV " + av.Firstname + "\nLastName STRING RW SV " + av.Lastname);
289 LLVector3 pos2 = av.AbsolutePosition; 290 LLVector3 pos2 = av.AbsolutePosition;
290 // new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z); 291 // new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z);
291 byte[] pb = pos2.GetBytes(); 292 byte[] pb = pos2.GetBytes();
292 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); 293 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
293 294
@@ -318,7 +319,7 @@ namespace OpenSim.Region.Environment.Scenes
318 319
319 objupdate.ObjectData[1].TextureEntry = primData.TextureEntry; 320 objupdate.ObjectData[1].TextureEntry = primData.TextureEntry;
320 objupdate.ObjectData[1].PCode = primData.PCode; 321 objupdate.ObjectData[1].PCode = primData.PCode;
321 objupdate.ObjectData[1].State = (byte)(((byte)AttachmentPt) << 4) ; 322 objupdate.ObjectData[1].State = (byte)(((byte)AttachmentPt) << 4);
322 objupdate.ObjectData[1].PathBegin = primData.PathBegin; 323 objupdate.ObjectData[1].PathBegin = primData.PathBegin;
323 objupdate.ObjectData[1].PathEnd = primData.PathEnd; 324 objupdate.ObjectData[1].PathEnd = primData.PathEnd;
324 objupdate.ObjectData[1].PathScaleX = primData.PathScaleX; 325 objupdate.ObjectData[1].PathScaleX = primData.PathScaleX;
@@ -356,7 +357,7 @@ namespace OpenSim.Region.Environment.Scenes
356 objupdate.ObjectData[1].Radius = 20; 357 objupdate.ObjectData[1].Radius = 20;
357 objupdate.ObjectData[1].NameValue = 358 objupdate.ObjectData[1].NameValue =
358 Helpers.StringToField("AttachItemID STRING RW SV " + p.UUID); 359 Helpers.StringToField("AttachItemID STRING RW SV " + p.UUID);
359 LLVector3 pos = new LLVector3((float) 0.0, (float) 0.0, (float) 0.0); 360 LLVector3 pos = new LLVector3((float)0.0, (float)0.0, (float)0.0);
360 361
361 pb = pos.GetBytes(); 362 pb = pos.GetBytes();
362 Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length); 363 Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length);
@@ -364,13 +365,7 @@ namespace OpenSim.Region.Environment.Scenes
364 byte[] brot = rot.GetBytes(); 365 byte[] brot = rot.GetBytes();
365 Array.Copy(brot, 0, objupdate.ObjectData[1].ObjectData, 36, brot.Length); 366 Array.Copy(brot, 0, objupdate.ObjectData[1].ObjectData, 36, brot.Length);
366 367
367 368 remoteClient.OutPacket(objupdate, ThrottleOutPacketType.Task);
368
369 remoteClient.OutPacket(objupdate, ThrottleOutPacketType.Task);
370
371
372
373
374 } 369 }
375 else 370 else
376 { 371 {
@@ -466,8 +461,8 @@ namespace OpenSim.Region.Environment.Scenes
466 { 461 {
467 // some network situations come in where child agents get closed twice. 462 // some network situations come in where child agents get closed twice.
468 if (m_numChildAgents < 0) 463 if (m_numChildAgents < 0)
469 { 464 {
470 m_numChildAgents = 0; 465 m_numChildAgents = 0;
471 } 466 }
472 467
473 return m_numChildAgents; 468 return m_numChildAgents;
@@ -569,8 +564,8 @@ namespace OpenSim.Region.Environment.Scenes
569 { 564 {
570 if (ent is SceneObjectGroup) 565 if (ent is SceneObjectGroup)
571 { 566 {
572 if (((SceneObjectGroup) ent).HasChildPrim(localID)) 567 if (((SceneObjectGroup)ent).HasChildPrim(localID))
573 return (SceneObjectGroup) ent; 568 return (SceneObjectGroup)ent;
574 } 569 }
575 } 570 }
576 return null; 571 return null;
@@ -584,8 +579,8 @@ namespace OpenSim.Region.Environment.Scenes
584 { 579 {
585 if (ent is SceneObjectGroup) 580 if (ent is SceneObjectGroup)
586 { 581 {
587 if (((SceneObjectGroup) ent).HasChildPrim(fullID)) 582 if (((SceneObjectGroup)ent).HasChildPrim(fullID))
588 return (SceneObjectGroup) ent; 583 return (SceneObjectGroup)ent;
589 } 584 }
590 } 585 }
591 return null; 586 return null;
@@ -600,7 +595,7 @@ namespace OpenSim.Region.Environment.Scenes
600 { 595 {
601 if (ent is SceneObjectGroup) 596 if (ent is SceneObjectGroup)
602 { 597 {
603 SceneObjectGroup reportingG = (SceneObjectGroup) ent; 598 SceneObjectGroup reportingG = (SceneObjectGroup)ent;
604 EntityIntersection result = reportingG.TestIntersection(hray); 599 EntityIntersection result = reportingG.TestIntersection(hray);
605 if (result.HitTF) 600 if (result.HitTF)
606 { 601 {
@@ -613,7 +608,7 @@ namespace OpenSim.Region.Environment.Scenes
613 } 608 }
614 } 609 }
615 return returnResult; 610 return returnResult;
616 } 611 }
617 612
618 public SceneObjectPart GetSceneObjectPart(uint localID) 613 public SceneObjectPart GetSceneObjectPart(uint localID)
619 { 614 {
@@ -719,7 +714,7 @@ namespace OpenSim.Region.Environment.Scenes
719 if (presence.IsChildAgent && m_parentScene.m_seeIntoRegionFromNeighbor) 714 if (presence.IsChildAgent && m_parentScene.m_seeIntoRegionFromNeighbor)
720 { 715 {
721 LLVector3 oLoc = ((SceneObjectGroup)ent).AbsolutePosition; 716 LLVector3 oLoc = ((SceneObjectGroup)ent).AbsolutePosition;
722 float distResult = (float)Util.GetDistanceTo(presence.AbsolutePosition,oLoc); 717 float distResult = (float)Util.GetDistanceTo(presence.AbsolutePosition, oLoc);
723 718
724 //m_log.Info("[DISTANCE]: " + distResult.ToString()); 719 //m_log.Info("[DISTANCE]: " + distResult.ToString());
725 720
@@ -727,13 +722,13 @@ namespace OpenSim.Region.Environment.Scenes
727 { 722 {
728 // Send Only if we don't already know about it. 723 // Send Only if we don't already know about it.
729 // KnownPrim also makes the prim known when called. 724 // KnownPrim also makes the prim known when called.
730 if (!presence.KnownPrim(((SceneObjectGroup) ent).UUID)) 725 if (!presence.KnownPrim(((SceneObjectGroup)ent).UUID))
731 ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence); 726 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence);
732 } 727 }
733 } 728 }
734 else 729 else
735 { 730 {
736 ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence); 731 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence);
737 } 732 }
738 } 733 }
739 } 734 }
@@ -903,7 +898,7 @@ namespace OpenSim.Region.Environment.Scenes
903 { 898 {
904 if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID)) 899 if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID))
905 { 900 {
906 group.UpdatePrimFlags(localID, (ushort) packet.Type, true, packet.ToBytes()); 901 group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes());
907 } 902 }
908 } 903 }
909 } 904 }
@@ -1003,9 +998,9 @@ namespace OpenSim.Region.Environment.Scenes
1003 { 998 {
1004 if (ent is SceneObjectGroup) 999 if (ent is SceneObjectGroup)
1005 { 1000 {
1006 if (((SceneObjectGroup) ent).LocalId == parentPrim) 1001 if (((SceneObjectGroup)ent).LocalId == parentPrim)
1007 { 1002 {
1008 parenPrim = (SceneObjectGroup) ent; 1003 parenPrim = (SceneObjectGroup)ent;
1009 break; 1004 break;
1010 } 1005 }
1011 } 1006 }
@@ -1020,9 +1015,9 @@ namespace OpenSim.Region.Environment.Scenes
1020 { 1015 {
1021 if (ent is SceneObjectGroup) 1016 if (ent is SceneObjectGroup)
1022 { 1017 {
1023 if (((SceneObjectGroup) ent).LocalId == childPrims[i]) 1018 if (((SceneObjectGroup)ent).LocalId == childPrims[i])
1024 { 1019 {
1025 children.Add((SceneObjectGroup) ent); 1020 children.Add((SceneObjectGroup)ent);
1026 } 1021 }
1027 } 1022 }
1028 } 1023 }
@@ -1049,25 +1044,25 @@ namespace OpenSim.Region.Environment.Scenes
1049 // be more efficient yet to keep this dictionary permanently on hand. 1044 // be more efficient yet to keep this dictionary permanently on hand.
1050 1045
1051 Dictionary<uint, SceneObjectGroup> sceneObjects = new Dictionary<uint, SceneObjectGroup>(); 1046 Dictionary<uint, SceneObjectGroup> sceneObjects = new Dictionary<uint, SceneObjectGroup>();
1052 1047
1053 List<EntityBase> EntitieList = GetEntities(); 1048 List<EntityBase> EntitieList = GetEntities();
1054 foreach (EntityBase ent in EntitieList) 1049 foreach (EntityBase ent in EntitieList)
1055 { 1050 {
1056 if (ent is SceneObjectGroup) 1051 if (ent is SceneObjectGroup)
1057 { 1052 {
1058 SceneObjectGroup obj = (SceneObjectGroup) ent; 1053 SceneObjectGroup obj = (SceneObjectGroup)ent;
1059 sceneObjects.Add(obj.LocalId, obj); 1054 sceneObjects.Add(obj.LocalId, obj);
1060 1055
1061 } 1056 }
1062 } 1057 }
1063 1058
1064 // Find the root prim among the prim ids we've been given 1059 // Find the root prim among the prim ids we've been given
1065 for (int i = 0; i < primIds.Count; i++) 1060 for (int i = 0; i < primIds.Count; i++)
1066 { 1061 {
1067 1062
1068 if (sceneObjects.ContainsKey(primIds[i])) 1063 if (sceneObjects.ContainsKey(primIds[i]))
1069 { 1064 {
1070 1065
1071 parenPrim = sceneObjects[primIds[i]]; 1066 parenPrim = sceneObjects[primIds[i]];
1072 primIds.RemoveAt(i); 1067 primIds.RemoveAt(i);
1073 break; 1068 break;
@@ -1124,9 +1119,9 @@ namespace OpenSim.Region.Environment.Scenes
1124 { 1119 {
1125 if (ent is SceneObjectGroup) 1120 if (ent is SceneObjectGroup)
1126 { 1121 {
1127 if (((SceneObjectGroup) ent).LocalId == originalPrim) 1122 if (((SceneObjectGroup)ent).LocalId == originalPrim)
1128 { 1123 {
1129 originPrim = (SceneObjectGroup) ent; 1124 originPrim = (SceneObjectGroup)ent;
1130 break; 1125 break;
1131 } 1126 }
1132 } 1127 }
@@ -1139,14 +1134,14 @@ namespace OpenSim.Region.Environment.Scenes
1139 SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); 1134 SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID);
1140 copy.AbsolutePosition = copy.AbsolutePosition + offset; 1135 copy.AbsolutePosition = copy.AbsolutePosition + offset;
1141 copy.ResetIDs(); 1136 copy.ResetIDs();
1142 1137
1143 lock (Entities) 1138 lock (Entities)
1144 { 1139 {
1145 Entities.Add(copy.UUID, copy); 1140 Entities.Add(copy.UUID, copy);
1146 } 1141 }
1147 1142
1148 m_numPrim++; 1143 m_numPrim++;
1149 1144
1150 copy.StartScripts(); 1145 copy.StartScripts();
1151 copy.ScheduleGroupForFullUpdate(); 1146 copy.ScheduleGroupForFullUpdate();
1152 } 1147 }
@@ -1170,7 +1165,7 @@ namespace OpenSim.Region.Environment.Scenes
1170 1165
1171 return 1166 return
1172 (float) 1167 (float)
1173 Math.Sqrt((v1.x - v2.x)*(v1.x - v2.x) + (v1.y - v2.y)*(v1.y - v2.y) + (v1.z - v2.z)*(v1.z - v2.z)); 1168 Math.Sqrt((v1.x - v2.x) * (v1.x - v2.x) + (v1.y - v2.y) * (v1.y - v2.y) + (v1.z - v2.z) * (v1.z - v2.z));
1174 } 1169 }
1175 1170
1176 #endregion 1171 #endregion
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 952b039..2212216 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -36,6 +36,7 @@ using OpenSim.Framework.Console;
36using System.IO; 36using System.IO;
37using System.Text; 37using System.Text;
38using System.Xml; 38using System.Xml;
39using OpenSim.Region.Environment.Interfaces;
39 40
40 41
41namespace OpenSim.Region.Environment.Scenes 42namespace OpenSim.Region.Environment.Scenes
@@ -266,8 +267,12 @@ namespace OpenSim.Region.Environment.Scenes
266 } 267 }
267 else 268 else
268 { 269 {
269 CommsManager.TransactionsManager.HandleItemUpdateFromTransaction( 270 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
270 remoteClient, transactionID, item); 271 if (agentTransactions != null)
272 {
273 agentTransactions.HandleItemUpdateFromTransaction(
274 remoteClient, transactionID, item);
275 }
271 } 276 }
272 } 277 }
273 else 278 else
@@ -459,9 +464,15 @@ namespace OpenSim.Region.Environment.Scenes
459 } 464 }
460 else 465 else
461 { 466 {
462 CommsManager.TransactionsManager.HandleItemCreationFromTransaction( 467 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
468 if (agentTransactions != null)
469 {
470 agentTransactions.HandleItemCreationFromTransaction(
463 remoteClient, transactionID, folderID, callbackID, description, 471 remoteClient, transactionID, folderID, callbackID, description,
464 name, invType, assetType, wearableType, nextOwnerMask); 472 name, invType, assetType, wearableType, nextOwnerMask);
473 }
474
475
465 } 476 }
466 } 477 }
467 478
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index b534b4d..d3b051f 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1397,8 +1397,8 @@ namespace OpenSim.Region.Environment.Scenes
1397 client.OnUpdateInventoryItem += UpdateInventoryItemAsset; 1397 client.OnUpdateInventoryItem += UpdateInventoryItemAsset;
1398 client.OnCopyInventoryItem += CopyInventoryItem; 1398 client.OnCopyInventoryItem += CopyInventoryItem;
1399 client.OnMoveInventoryItem += MoveInventoryItem; 1399 client.OnMoveInventoryItem += MoveInventoryItem;
1400 client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest; 1400 // client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest;
1401 client.OnXferReceive += CommsManager.TransactionsManager.HandleXfer; 1401 // client.OnXferReceive += CommsManager.TransactionsManager.HandleXfer;
1402 client.OnRezScript += RezScript; 1402 client.OnRezScript += RezScript;
1403 1403
1404 client.OnRequestTaskInventory += RequestTaskInventory; 1404 client.OnRequestTaskInventory += RequestTaskInventory;
@@ -1489,8 +1489,12 @@ namespace OpenSim.Region.Environment.Scenes
1489 1489
1490 ForEachScenePresence( 1490 ForEachScenePresence(
1491 delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); 1491 delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
1492 1492
1493 CommsManager.TransactionsManager.RemoveAgentAssetTransactions(agentID); 1493 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
1494 if (agentTransactions != null)
1495 {
1496 agentTransactions.RemoveAgentAssetTransactions(agentID);
1497 }
1494 1498
1495 lock (m_scenePresences) 1499 lock (m_scenePresences)
1496 { 1500 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 5756a0b..00cabf8 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -1618,8 +1618,7 @@ namespace OpenSim.Region.Environment.Scenes
1618 SendFullUpdateToAllClients(); 1618 SendFullUpdateToAllClients();
1619 1619
1620 SendObjectPropertiesToClient(AgentID); 1620 SendObjectPropertiesToClient(AgentID);
1621 1621
1622
1623 } 1622 }
1624 } 1623 }
1625 1624