diff options
author | onefang | 2019-05-19 21:24:15 +1000 |
---|---|---|
committer | onefang | 2019-05-19 21:24:15 +1000 |
commit | 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch) | |
tree | a9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |
parent | Add a build script. (diff) | |
download | opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2 opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz |
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | 236 |
1 files changed, 141 insertions, 95 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index bba48cc..5d7f25c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -149,10 +149,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
149 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) | 149 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) |
150 | { | 150 | { |
151 | // m_log.DebugFormat( | 151 | // m_log.DebugFormat( |
152 | // "[INVENTORY TRANSFER]: {0} IM type received from client {1}. From={2} ({3}), To={4}", | 152 | // "[INVENTORY TRANSFER]: {0} IM type received from client {1}. From={2} ({3}), To={4}", |
153 | // (InstantMessageDialog)im.dialog, client.Name, | 153 | // (InstantMessageDialog)im.dialog, client.Name, |
154 | // im.fromAgentID, im.fromAgentName, im.toAgentID); | 154 | // im.fromAgentID, im.fromAgentName, im.toAgentID); |
155 | 155 | ||
156 | Scene scene = FindClientScene(client.AgentId); | 156 | Scene scene = FindClientScene(client.AgentId); |
157 | 157 | ||
158 | if (scene == null) // Something seriously wrong here. | 158 | if (scene == null) // Something seriously wrong here. |
@@ -164,31 +164,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
164 | 164 | ||
165 | if (im.binaryBucket.Length < 17) // Invalid | 165 | if (im.binaryBucket.Length < 17) // Invalid |
166 | return; | 166 | return; |
167 | 167 | ||
168 | UUID receipientID = new UUID(im.toAgentID); | 168 | UUID recipientID = new UUID(im.toAgentID); |
169 | ScenePresence user = scene.GetScenePresence(receipientID); | 169 | ScenePresence user = scene.GetScenePresence(recipientID); |
170 | UUID copyID; | 170 | UUID copyID; |
171 | 171 | ||
172 | // First byte is the asset type | 172 | // First byte is the asset type |
173 | AssetType assetType = (AssetType)im.binaryBucket[0]; | 173 | AssetType assetType = (AssetType)im.binaryBucket[0]; |
174 | 174 | ||
175 | if (AssetType.Folder == assetType) | 175 | if (AssetType.Folder == assetType) |
176 | { | 176 | { |
177 | UUID folderID = new UUID(im.binaryBucket, 1); | 177 | UUID folderID = new UUID(im.binaryBucket, 1); |
178 | 178 | ||
179 | m_log.DebugFormat( | 179 | m_log.DebugFormat( |
180 | "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory", | 180 | "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory", |
181 | folderID, new UUID(im.toAgentID)); | 181 | folderID, new UUID(im.toAgentID)); |
182 | 182 | ||
183 | InventoryFolderBase folderCopy | 183 | InventoryFolderBase folderCopy |
184 | = scene.GiveInventoryFolder(client, receipientID, client.AgentId, folderID, UUID.Zero); | 184 | = scene.GiveInventoryFolder(client, recipientID, client.AgentId, folderID, UUID.Zero); |
185 | 185 | ||
186 | if (folderCopy == null) | 186 | if (folderCopy == null) |
187 | { | 187 | { |
188 | client.SendAgentAlertMessage("Can't find folder to give. Nothing given.", false); | 188 | client.SendAgentAlertMessage("Can't find folder to give. Nothing given.", false); |
189 | return; | 189 | return; |
190 | } | 190 | } |
191 | 191 | ||
192 | // The outgoing binary bucket should contain only the byte which signals an asset folder is | 192 | // The outgoing binary bucket should contain only the byte which signals an asset folder is |
193 | // being copied and the following bytes for the copied folder's UUID | 193 | // being copied and the following bytes for the copied folder's UUID |
194 | copyID = folderCopy.ID; | 194 | copyID = folderCopy.ID; |
@@ -196,7 +196,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
196 | im.binaryBucket = new byte[1 + copyIDBytes.Length]; | 196 | im.binaryBucket = new byte[1 + copyIDBytes.Length]; |
197 | im.binaryBucket[0] = (byte)AssetType.Folder; | 197 | im.binaryBucket[0] = (byte)AssetType.Folder; |
198 | Array.Copy(copyIDBytes, 0, im.binaryBucket, 1, copyIDBytes.Length); | 198 | Array.Copy(copyIDBytes, 0, im.binaryBucket, 1, copyIDBytes.Length); |
199 | 199 | ||
200 | if (user != null) | 200 | if (user != null) |
201 | user.ControllingClient.SendBulkUpdateInventory(folderCopy); | 201 | user.ControllingClient.SendBulkUpdateInventory(folderCopy); |
202 | 202 | ||
@@ -225,10 +225,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
225 | client.SendAgentAlertMessage(message, false); | 225 | client.SendAgentAlertMessage(message, false); |
226 | return; | 226 | return; |
227 | } | 227 | } |
228 | 228 | ||
229 | copyID = itemCopy.ID; | 229 | copyID = itemCopy.ID; |
230 | Array.Copy(copyID.GetBytes(), 0, im.binaryBucket, 1, 16); | 230 | Array.Copy(copyID.GetBytes(), 0, im.binaryBucket, 1, 16); |
231 | 231 | ||
232 | if (user != null) | 232 | if (user != null) |
233 | user.ControllingClient.SendBulkUpdateInventory(itemCopy); | 233 | user.ControllingClient.SendBulkUpdateInventory(itemCopy); |
234 | 234 | ||
@@ -239,6 +239,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
239 | im.imSessionID = copyID.Guid; | 239 | im.imSessionID = copyID.Guid; |
240 | } | 240 | } |
241 | 241 | ||
242 | im.offline = 0; | ||
243 | |||
242 | // Send the IM to the recipient. The item is already | 244 | // Send the IM to the recipient. The item is already |
243 | // in their inventory, so it will not be lost if | 245 | // in their inventory, so it will not be lost if |
244 | // they are offline. | 246 | // they are offline. |
@@ -251,15 +253,47 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
251 | else | 253 | else |
252 | { | 254 | { |
253 | if (m_TransferModule != null) | 255 | if (m_TransferModule != null) |
254 | m_TransferModule.SendInstantMessage(im, delegate(bool success) | 256 | m_TransferModule.SendInstantMessage(im, delegate(bool success) |
255 | { | 257 | { |
256 | if (!success) | 258 | if (!success) |
257 | client.SendAlertMessage("User not online. Inventory has been saved"); | 259 | client.SendAlertMessage("User not online. Inventory has been saved"); |
258 | }); | 260 | }); |
259 | } | 261 | } |
260 | } | 262 | } |
261 | else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted) | 263 | else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted || |
264 | im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) | ||
262 | { | 265 | { |
266 | UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip | ||
267 | IInventoryService invService = scene.InventoryService; | ||
268 | |||
269 | // Special case: folder redirect. | ||
270 | // RLV uses this | ||
271 | if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) | ||
272 | { | ||
273 | InventoryFolderBase folder = invService.GetFolder(client.AgentId, inventoryID); | ||
274 | |||
275 | if (folder != null) | ||
276 | { | ||
277 | if (im.binaryBucket.Length >= 16) | ||
278 | { | ||
279 | UUID destFolderID = new UUID(im.binaryBucket, 0); | ||
280 | if (destFolderID != UUID.Zero) | ||
281 | { | ||
282 | InventoryFolderBase destFolder = invService.GetFolder(client.AgentId, destFolderID); | ||
283 | if (destFolder != null) | ||
284 | { | ||
285 | if (folder.ParentID != destFolder.ID) | ||
286 | { | ||
287 | folder.ParentID = destFolder.ID; | ||
288 | invService.MoveFolder(folder); | ||
289 | client.SendBulkUpdateInventory(folder); | ||
290 | } | ||
291 | } | ||
292 | } | ||
293 | } | ||
294 | } | ||
295 | } | ||
296 | |||
263 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); | 297 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); |
264 | 298 | ||
265 | if (user != null) // Local | 299 | if (user != null) // Local |
@@ -269,33 +303,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
269 | else | 303 | else |
270 | { | 304 | { |
271 | if (m_TransferModule != null) | 305 | if (m_TransferModule != null) |
272 | m_TransferModule.SendInstantMessage(im, delegate(bool success) { | 306 | m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); |
273 | |||
274 | // justincc - FIXME: Comment out for now. This code was added in commit db91044 Mon Aug 22 2011 | ||
275 | // and is apparently supposed to fix bulk inventory updates after accepting items. But | ||
276 | // instead it appears to cause two copies of an accepted folder for the receiving user in | ||
277 | // at least some cases. Folder/item update is already done when the offer is made (see code above) | ||
278 | |||
279 | // // Send BulkUpdateInventory | ||
280 | // IInventoryService invService = scene.InventoryService; | ||
281 | // UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item /folder, back from it's trip | ||
282 | // | ||
283 | // InventoryFolderBase folder = new InventoryFolderBase(inventoryEntityID, client.AgentId); | ||
284 | // folder = invService.GetFolder(folder); | ||
285 | // | ||
286 | // ScenePresence fromUser = scene.GetScenePresence(new UUID(im.fromAgentID)); | ||
287 | // | ||
288 | // // If the user has left the scene by the time the message comes back then we can't send | ||
289 | // // them the update. | ||
290 | // if (fromUser != null) | ||
291 | // fromUser.ControllingClient.SendBulkUpdateInventory(folder); | ||
292 | }); | ||
293 | } | 307 | } |
294 | } | 308 | } |
295 | 309 | ||
296 | // XXX: This code was placed here to try and accomodate RLV which moves given folders named #RLV/~<name> | 310 | // XXX: This code was placed here to try and accomodate RLV which moves given folders named #RLV/~<name> |
297 | // to the requested folder, which in this case is #RLV. However, it is the viewer that appears to be | 311 | // to the requested folder, which in this case is #RLV. However, it is the viewer that appears to be |
298 | // response from renaming the #RLV/~example folder to ~example. For some reason this is not yet | 312 | // response from renaming the #RLV/~example folder to ~example. For some reason this is not yet |
299 | // happening, possibly because we are not sending the correct inventory update messages with the correct | 313 | // happening, possibly because we are not sending the correct inventory update messages with the correct |
300 | // transaction IDs | 314 | // transaction IDs |
301 | else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) | 315 | else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) |
@@ -310,21 +324,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
310 | if (destinationFolderID != UUID.Zero) | 324 | if (destinationFolderID != UUID.Zero) |
311 | { | 325 | { |
312 | InventoryFolderBase destinationFolder = new InventoryFolderBase(destinationFolderID, client.AgentId); | 326 | InventoryFolderBase destinationFolder = new InventoryFolderBase(destinationFolderID, client.AgentId); |
313 | if (destinationFolder == null) | ||
314 | { | ||
315 | m_log.WarnFormat( | ||
316 | "[INVENTORY TRANSFER]: TaskInventoryAccepted message from {0} in {1} specified folder {2} which does not exist", | ||
317 | client.Name, scene.Name, destinationFolderID); | ||
318 | |||
319 | return; | ||
320 | } | ||
321 | |||
322 | IInventoryService invService = scene.InventoryService; | 327 | IInventoryService invService = scene.InventoryService; |
323 | 328 | ||
324 | UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip | 329 | UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip |
325 | 330 | ||
326 | InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); | 331 | InventoryItemBase item = invService.GetItem(client.AgentId, inventoryID); |
327 | item = invService.GetItem(item); | ||
328 | InventoryFolderBase folder = null; | 332 | InventoryFolderBase folder = null; |
329 | UUID? previousParentFolderID = null; | 333 | UUID? previousParentFolderID = null; |
330 | 334 | ||
@@ -338,8 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
338 | } | 342 | } |
339 | else | 343 | else |
340 | { | 344 | { |
341 | folder = new InventoryFolderBase(inventoryID, client.AgentId); | 345 | folder = invService.GetFolder(client.AgentId, inventoryID); |
342 | folder = invService.GetFolder(folder); | ||
343 | 346 | ||
344 | if (folder != null) // It's a folder | 347 | if (folder != null) // It's a folder |
345 | { | 348 | { |
@@ -352,9 +355,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
352 | // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). | 355 | // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). |
353 | if (previousParentFolderID != null) | 356 | if (previousParentFolderID != null) |
354 | { | 357 | { |
355 | InventoryFolderBase previousParentFolder | 358 | InventoryFolderBase previousParentFolder = invService.GetFolder(client.AgentId, (UUID)previousParentFolderID); |
356 | = new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId); | ||
357 | previousParentFolder = invService.GetFolder(previousParentFolder); | ||
358 | scene.SendInventoryUpdate(client, previousParentFolder, true, true); | 359 | scene.SendInventoryUpdate(client, previousParentFolder, true, true); |
359 | 360 | ||
360 | scene.SendInventoryUpdate(client, destinationFolder, true, true); | 361 | scene.SendInventoryUpdate(client, destinationFolder, true, true); |
@@ -376,11 +377,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
376 | 377 | ||
377 | UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip | 378 | UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip |
378 | 379 | ||
379 | InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); | 380 | InventoryItemBase item = invService.GetItem(client.AgentId, inventoryID); |
380 | item = invService.GetItem(item); | ||
381 | InventoryFolderBase folder = null; | 381 | InventoryFolderBase folder = null; |
382 | UUID? previousParentFolderID = null; | 382 | UUID? previousParentFolderID = null; |
383 | 383 | ||
384 | if (item != null && trashFolder != null) | 384 | if (item != null && trashFolder != null) |
385 | { | 385 | { |
386 | previousParentFolderID = item.Folder; | 386 | previousParentFolderID = item.Folder; |
@@ -394,37 +394,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
394 | } | 394 | } |
395 | else | 395 | else |
396 | { | 396 | { |
397 | folder = new InventoryFolderBase(inventoryID, client.AgentId); | 397 | folder = invService.GetFolder(client.AgentId, inventoryID); |
398 | folder = invService.GetFolder(folder); | ||
399 | 398 | ||
400 | if (folder != null & trashFolder != null) | 399 | if (folder != null & trashFolder != null) |
401 | { | 400 | { |
402 | previousParentFolderID = folder.ParentID; | 401 | previousParentFolderID = folder.ParentID; |
403 | folder.ParentID = trashFolder.ID; | 402 | folder.ParentID = trashFolder.ID; |
404 | invService.MoveFolder(folder); | 403 | invService.MoveFolder(folder); |
404 | client.SendBulkUpdateInventory(folder); | ||
405 | } | 405 | } |
406 | } | 406 | } |
407 | 407 | ||
408 | if ((null == item && null == folder) | null == trashFolder) | 408 | if ((null == item && null == folder) | null == trashFolder) |
409 | { | 409 | { |
410 | string reason = String.Empty; | 410 | string reason = String.Empty; |
411 | 411 | ||
412 | if (trashFolder == null) | 412 | if (trashFolder == null) |
413 | reason += " Trash folder not found."; | 413 | reason += " Trash folder not found."; |
414 | if (item == null) | 414 | if (item == null) |
415 | reason += " Item not found."; | 415 | reason += " Item not found."; |
416 | if (folder == null) | 416 | if (folder == null) |
417 | reason += " Folder not found."; | 417 | reason += " Folder not found."; |
418 | 418 | ||
419 | client.SendAgentAlertMessage("Unable to delete "+ | 419 | client.SendAgentAlertMessage("Unable to delete "+ |
420 | "received inventory" + reason, false); | 420 | "received inventory" + reason, false); |
421 | } | 421 | } |
422 | // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). | 422 | // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). |
423 | else if (previousParentFolderID != null) | 423 | else if (previousParentFolderID != null) |
424 | { | 424 | { |
425 | InventoryFolderBase previousParentFolder | 425 | InventoryFolderBase previousParentFolder = invService.GetFolder(client.AgentId, (UUID)previousParentFolderID); |
426 | = new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId); | ||
427 | previousParentFolder = invService.GetFolder(previousParentFolder); | ||
428 | scene.SendInventoryUpdate(client, previousParentFolder, true, true); | 426 | scene.SendInventoryUpdate(client, previousParentFolder, true, true); |
429 | 427 | ||
430 | scene.SendInventoryUpdate(client, trashFolder, true, true); | 428 | scene.SendInventoryUpdate(client, trashFolder, true, true); |
@@ -453,18 +451,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
453 | /// <param name="im"></param> | 451 | /// <param name="im"></param> |
454 | private void OnGridInstantMessage(GridInstantMessage im) | 452 | private void OnGridInstantMessage(GridInstantMessage im) |
455 | { | 453 | { |
456 | // Check if it's a type of message that we should handle | ||
457 | if (!((im.dialog == (byte) InstantMessageDialog.InventoryOffered) | ||
458 | || (im.dialog == (byte) InstantMessageDialog.TaskInventoryOffered) | ||
459 | || (im.dialog == (byte) InstantMessageDialog.InventoryAccepted) | ||
460 | || (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) | ||
461 | || (im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined))) | ||
462 | return; | ||
463 | |||
464 | m_log.DebugFormat( | ||
465 | "[INVENTORY TRANSFER]: {0} IM type received from grid. From={1} ({2}), To={3}", | ||
466 | (InstantMessageDialog)im.dialog, im.fromAgentID, im.fromAgentName, im.toAgentID); | ||
467 | |||
468 | // Check if this is ours to handle | 454 | // Check if this is ours to handle |
469 | // | 455 | // |
470 | Scene scene = FindClientScene(new UUID(im.toAgentID)); | 456 | Scene scene = FindClientScene(new UUID(im.toAgentID)); |
@@ -475,32 +461,92 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
475 | // Find agent to deliver to | 461 | // Find agent to deliver to |
476 | // | 462 | // |
477 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); | 463 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); |
464 | if (user == null) | ||
465 | return; | ||
478 | 466 | ||
479 | if (user != null) | 467 | // This requires a little bit of processing because we have to make the |
468 | // new item visible in the recipient's inventory here | ||
469 | // | ||
470 | if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) | ||
480 | { | 471 | { |
481 | user.ControllingClient.SendInstantMessage(im); | 472 | if (im.binaryBucket.Length < 17) // Invalid |
473 | return; | ||
482 | 474 | ||
483 | if (im.dialog == (byte)InstantMessageDialog.InventoryOffered) | 475 | UUID recipientID = new UUID(im.toAgentID); |
476 | |||
477 | // First byte is the asset type | ||
478 | AssetType assetType = (AssetType)im.binaryBucket[0]; | ||
479 | |||
480 | if (AssetType.Folder == assetType) | ||
484 | { | 481 | { |
485 | AssetType assetType = (AssetType)im.binaryBucket[0]; | 482 | UUID folderID = new UUID(im.binaryBucket, 1); |
486 | UUID inventoryID = new UUID(im.binaryBucket, 1); | 483 | |
487 | 484 | InventoryFolderBase folder = | |
488 | IInventoryService invService = scene.InventoryService; | 485 | scene.InventoryService.GetFolder(recipientID, folderID); |
489 | InventoryNodeBase node = null; | 486 | |
490 | if (AssetType.Folder == assetType) | 487 | if (folder != null) |
488 | user.ControllingClient.SendBulkUpdateInventory(folder); | ||
489 | } | ||
490 | else | ||
491 | { | ||
492 | UUID itemID = new UUID(im.binaryBucket, 1); | ||
493 | |||
494 | InventoryItemBase item = | ||
495 | scene.InventoryService.GetItem(recipientID, itemID); | ||
496 | |||
497 | if (item != null) | ||
491 | { | 498 | { |
492 | InventoryFolderBase folder = new InventoryFolderBase(inventoryID, new UUID(im.toAgentID)); | 499 | user.ControllingClient.SendBulkUpdateInventory(item); |
493 | node = invService.GetFolder(folder); | ||
494 | } | 500 | } |
495 | else | 501 | } |
502 | user.ControllingClient.SendInstantMessage(im); | ||
503 | } | ||
504 | if (im.dialog == (byte) InstantMessageDialog.TaskInventoryOffered) | ||
505 | { | ||
506 | if (im.binaryBucket.Length < 1) // Invalid | ||
507 | return; | ||
508 | |||
509 | UUID recipientID = new UUID(im.toAgentID); | ||
510 | |||
511 | // Bucket is the asset type | ||
512 | AssetType assetType = (AssetType)im.binaryBucket[0]; | ||
513 | |||
514 | if (AssetType.Folder == assetType) | ||
515 | { | ||
516 | UUID folderID = new UUID(im.imSessionID); | ||
517 | |||
518 | InventoryFolderBase folder = | ||
519 | scene.InventoryService.GetFolder(recipientID, folderID); | ||
520 | |||
521 | if (folder != null) | ||
522 | user.ControllingClient.SendBulkUpdateInventory(folder); | ||
523 | } | ||
524 | else | ||
525 | { | ||
526 | UUID itemID = new UUID(im.imSessionID); | ||
527 | |||
528 | InventoryItemBase item = | ||
529 | scene.InventoryService.GetItem(recipientID, itemID); | ||
530 | |||
531 | if (item != null) | ||
496 | { | 532 | { |
497 | InventoryItemBase item = new InventoryItemBase(inventoryID, new UUID(im.toAgentID)); | 533 | user.ControllingClient.SendBulkUpdateInventory(item); |
498 | node = invService.GetItem(item); | ||
499 | } | 534 | } |
500 | |||
501 | if (node != null) | ||
502 | user.ControllingClient.SendBulkUpdateInventory(node); | ||
503 | } | 535 | } |
536 | |||
537 | // Fix up binary bucket since this may be 17 chars long here | ||
538 | Byte[] bucket = new Byte[1]; | ||
539 | bucket[0] = im.binaryBucket[0]; | ||
540 | im.binaryBucket = bucket; | ||
541 | |||
542 | user.ControllingClient.SendInstantMessage(im); | ||
543 | } | ||
544 | else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted || | ||
545 | im.dialog == (byte) InstantMessageDialog.InventoryDeclined || | ||
546 | im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined || | ||
547 | im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) | ||
548 | { | ||
549 | user.ControllingClient.SendInstantMessage(im); | ||
504 | } | 550 | } |
505 | } | 551 | } |
506 | } | 552 | } |