Fix task inventory giving

avinationmerge
Melanie 2011-12-07 00:43:59 +01:00
parent 62d0a0cdbf
commit d6486fe14a
4 changed files with 39 additions and 56 deletions

View File

@ -146,20 +146,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
ScenePresence sp = scene.GetScenePresence(toAgentID); ScenePresence sp = scene.GetScenePresence(toAgentID);
if (sp != null && !sp.IsChildAgent) if (sp != null && !sp.IsChildAgent)
{ {
// m_log.DebugFormat( // Local message
// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID);
// toAgentID.ToString(), scene.RegionInfo.RegionName); sp.ControllingClient.SendInstantMessage(im);
ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
if (!user.IsChildAgent)
{
// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client");
user.ControllingClient.SendInstantMessage(im);
// Message sent // Message sent
result(true); result(true);
return; return;
}
} }
} }
@ -172,10 +165,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (sp != null) if (sp != null)
{ {
// Local message // Local message
ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID);
sp.ControllingClient.SendInstantMessage(im);
// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client");
user.ControllingClient.SendInstantMessage(im);
// Message sent // Message sent
result(true); result(true);

View File

@ -212,7 +212,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
im.dialog != (byte)InstantMessageDialog.MessageFromAgent && im.dialog != (byte)InstantMessageDialog.MessageFromAgent &&
im.dialog != (byte)InstantMessageDialog.GroupNotice && im.dialog != (byte)InstantMessageDialog.GroupNotice &&
im.dialog != (byte)InstantMessageDialog.GroupInvitation && im.dialog != (byte)InstantMessageDialog.GroupInvitation &&
im.dialog != (byte)InstantMessageDialog.InventoryOffered) im.dialog != (byte)InstantMessageDialog.InventoryOffered &&
im.dialog != (byte)InstantMessageDialog.TaskInventoryOffered)
{ {
return; return;
} }

View File

@ -265,7 +265,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
}); });
} }
} }
else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted) else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted ||
im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted)
{ {
ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID));
@ -276,30 +277,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
else else
{ {
if (m_TransferModule != null) if (m_TransferModule != null)
m_TransferModule.SendInstantMessage(im, delegate(bool success) { m_TransferModule.SendInstantMessage(im, delegate(bool success) {});
// justincc - FIXME: Comment out for now. This code was added in commit db91044 Mon Aug 22 2011
// and is apparently supposed to fix bulk inventory updates after accepting items. But
// instead it appears to cause two copies of an accepted folder for the receiving user in
// at least some cases. Folder/item update is already done when the offer is made (see code above)
// // Send BulkUpdateInventory
// IInventoryService invService = scene.InventoryService;
// UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item /folder, back from it's trip
//
// InventoryFolderBase folder = new InventoryFolderBase(inventoryEntityID, client.AgentId);
// folder = invService.GetFolder(folder);
//
// ScenePresence fromUser = scene.GetScenePresence(new UUID(im.fromAgentID));
//
// // If the user has left the scene by the time the message comes back then we can't send
// // them the update.
// if (fromUser != null)
// fromUser.ControllingClient.SendBulkUpdateInventory(folder);
});
} }
} }
else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined ||
im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined)
{ {
// Here, the recipient is local and we can assume that the // Here, the recipient is local and we can assume that the
// inventory is loaded. Courtesy of the above bulk update, // inventory is loaded. Courtesy of the above bulk update,
@ -335,6 +317,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{ {
folder.ParentID = trashFolder.ID; folder.ParentID = trashFolder.ID;
invService.MoveFolder(folder); invService.MoveFolder(folder);
client.SendBulkUpdateInventory(folder);
} }
} }

View File

@ -4368,22 +4368,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (agentItem == null) if (agentItem == null)
return; return;
byte[] bucket = new byte[17]; byte[] bucket = new byte[1];
bucket[0] = (byte)assetType; bucket[0] = (byte)assetType;
byte[] objBytes = agentItem.ID.GetBytes(); //byte[] objBytes = agentItem.ID.GetBytes();
Array.Copy(objBytes, 0, bucket, 1, 16); //Array.Copy(objBytes, 0, bucket, 1, 16);
GridInstantMessage msg = new GridInstantMessage(World, GridInstantMessage msg = new GridInstantMessage(World,
m_host.UUID, m_host.Name+", an object owned by "+ m_host.OwnerID, m_host.Name, destId,
resolveName(m_host.OwnerID)+",", destId,
(byte)InstantMessageDialog.TaskInventoryOffered, (byte)InstantMessageDialog.TaskInventoryOffered,
false, objName+"\n"+m_host.Name+" is located at "+ false, objName+". "+m_host.Name+" is located at "+
World.RegionInfo.RegionName+" "+ World.RegionInfo.RegionName+" "+
m_host.AbsolutePosition.ToString(), m_host.AbsolutePosition.ToString(),
agentItem.ID, true, m_host.AbsolutePosition, agentItem.ID, true, m_host.AbsolutePosition,
bucket); bucket);
if (m_TransferModule != null)
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); ScenePresence sp;
if (World.TryGetScenePresence(destId, out sp))
{
sp.ControllingClient.SendInstantMessage(msg);
}
else
{
if (m_TransferModule != null)
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
}
//This delay should only occur when giving inventory to avatars. //This delay should only occur when giving inventory to avatars.
ScriptSleep(3000); ScriptSleep(3000);
@ -6708,16 +6717,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (folderID == UUID.Zero) if (folderID == UUID.Zero)
return; return;
byte[] bucket = new byte[17]; byte[] bucket = new byte[1];
bucket[0] = (byte)AssetType.Folder; bucket[0] = (byte)AssetType.Folder;
byte[] objBytes = folderID.GetBytes(); //byte[] objBytes = folderID.GetBytes();
Array.Copy(objBytes, 0, bucket, 1, 16); //Array.Copy(objBytes, 0, bucket, 1, 16);
GridInstantMessage msg = new GridInstantMessage(World, GridInstantMessage msg = new GridInstantMessage(World,
m_host.UUID, m_host.Name+", an object owned by "+ m_host.OwnerID, m_host.Name, destID,
resolveName(m_host.OwnerID)+",", destID, (byte)InstantMessageDialog.TaskInventoryOffered,
(byte)InstantMessageDialog.InventoryOffered, false, category+". "+m_host.Name+" is located at "+
false, category+"\n"+m_host.Name+" is located at "+
World.RegionInfo.RegionName+" "+ World.RegionInfo.RegionName+" "+
m_host.AbsolutePosition.ToString(), m_host.AbsolutePosition.ToString(),
folderID, true, m_host.AbsolutePosition, folderID, true, m_host.AbsolutePosition,