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

View File

@ -212,7 +212,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
im.dialog != (byte)InstantMessageDialog.MessageFromAgent &&
im.dialog != (byte)InstantMessageDialog.GroupNotice &&
im.dialog != (byte)InstantMessageDialog.GroupInvitation &&
im.dialog != (byte)InstantMessageDialog.InventoryOffered)
im.dialog != (byte)InstantMessageDialog.InventoryOffered &&
im.dialog != (byte)InstantMessageDialog.TaskInventoryOffered)
{
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));
@ -276,30 +277,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
else
{
if (m_TransferModule != null)
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);
});
m_TransferModule.SendInstantMessage(im, delegate(bool success) {});
}
}
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
// inventory is loaded. Courtesy of the above bulk update,
@ -335,6 +317,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{
folder.ParentID = trashFolder.ID;
invService.MoveFolder(folder);
client.SendBulkUpdateInventory(folder);
}
}

View File

@ -4368,22 +4368,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (agentItem == null)
return;
byte[] bucket = new byte[17];
byte[] bucket = new byte[1];
bucket[0] = (byte)assetType;
byte[] objBytes = agentItem.ID.GetBytes();
Array.Copy(objBytes, 0, bucket, 1, 16);
//byte[] objBytes = agentItem.ID.GetBytes();
//Array.Copy(objBytes, 0, bucket, 1, 16);
GridInstantMessage msg = new GridInstantMessage(World,
m_host.UUID, m_host.Name+", an object owned by "+
resolveName(m_host.OwnerID)+",", destId,
m_host.OwnerID, m_host.Name, destId,
(byte)InstantMessageDialog.TaskInventoryOffered,
false, objName+"\n"+m_host.Name+" is located at "+
false, objName+". "+m_host.Name+" is located at "+
World.RegionInfo.RegionName+" "+
m_host.AbsolutePosition.ToString(),
agentItem.ID, true, m_host.AbsolutePosition,
bucket);
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.
ScriptSleep(3000);
@ -6708,16 +6717,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (folderID == UUID.Zero)
return;
byte[] bucket = new byte[17];
byte[] bucket = new byte[1];
bucket[0] = (byte)AssetType.Folder;
byte[] objBytes = folderID.GetBytes();
Array.Copy(objBytes, 0, bucket, 1, 16);
//byte[] objBytes = folderID.GetBytes();
//Array.Copy(objBytes, 0, bucket, 1, 16);
GridInstantMessage msg = new GridInstantMessage(World,
m_host.UUID, m_host.Name+", an object owned by "+
resolveName(m_host.OwnerID)+",", destID,
(byte)InstantMessageDialog.InventoryOffered,
false, category+"\n"+m_host.Name+" is located at "+
m_host.OwnerID, m_host.Name, destID,
(byte)InstantMessageDialog.TaskInventoryOffered,
false, category+". "+m_host.Name+" is located at "+
World.RegionInfo.RegionName+" "+
m_host.AbsolutePosition.ToString(),
folderID, true, m_host.AbsolutePosition,