Revert "Revert "Implement bulk inventory update over CAPS (not recursive by design,""

This reverts commit a90b0e302c.

Sorry, accidentally reverted this completely by mistake, reverting the revert.
0.7.4.1
Justin Clark-Casey (justincc) 2012-04-27 23:54:45 +01:00
parent 737e177163
commit ab71779221
1 changed files with 47 additions and 1 deletions

View File

@ -12296,7 +12296,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ItemData.Add(ItemDataMap); ItemData.Add(ItemDataMap);
} }
llsd.Add("ItemData", ItemData); llsd.Add("InventoryData", ItemData);
eq.Enqueue(BuildEvent("RemoveInventoryItem", eq.Enqueue(BuildEvent("RemoveInventoryItem",
llsd), AgentId); llsd), AgentId);
@ -12340,6 +12340,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
llsd), AgentId); llsd), AgentId);
} }
private byte[] EncodeU32(uint val)
{
byte[] ret = BitConverter.GetBytes(val);
if (BitConverter.IsLittleEndian)
Array.Reverse(ret);
return ret;
}
public void SendBulkUpdateInventory(InventoryFolderBase[] folders, InventoryItemBase[] items) public void SendBulkUpdateInventory(InventoryFolderBase[] folders, InventoryItemBase[] items)
{ {
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
@ -12355,6 +12363,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OSDMap AgentDataMap = new OSDMap(1); OSDMap AgentDataMap = new OSDMap(1);
AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId)); AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId));
AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId)); AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId));
AgentDataMap.Add("TransactionID", OSD.FromUUID(UUID.Random()));
OSDArray AgentData = new OSDArray(1); OSDArray AgentData = new OSDArray(1);
AgentData.Add(AgentDataMap); AgentData.Add(AgentDataMap);
@ -12382,10 +12391,47 @@ namespace OpenSim.Region.ClientStack.LindenUDP
foreach (InventoryItemBase item in items) foreach (InventoryItemBase item in items)
{ {
OSDMap ItemDataMap = new OSDMap(); OSDMap ItemDataMap = new OSDMap();
ItemDataMap.Add("ItemID", OSD.FromUUID(item.ID));
ItemDataMap.Add("FolderID", OSD.FromUUID(item.Folder));
ItemDataMap.Add("CreatorID", OSD.FromUUID(item.CreatorIdAsUuid));
ItemDataMap.Add("OwnerID", OSD.FromUUID(item.Owner));
ItemDataMap.Add("GroupID", OSD.FromUUID(item.GroupID));
ItemDataMap.Add("BaseMask", OSD.FromBinary(EncodeU32((uint)item.BasePermissions)));
ItemDataMap.Add("OwnerMask", OSD.FromBinary(EncodeU32((uint)item.CurrentPermissions)));
ItemDataMap.Add("GroupMask", OSD.FromBinary(EncodeU32((uint)item.GroupPermissions)));
ItemDataMap.Add("EveryoneMask", OSD.FromBinary(EncodeU32((uint)item.EveryOnePermissions)));
ItemDataMap.Add("NextOwnerMask", OSD.FromBinary(EncodeU32((uint)item.NextPermissions)));
ItemDataMap.Add("GroupOwned", OSD.FromBoolean(item.GroupOwned));
ItemDataMap.Add("AssetID", OSD.FromUUID(item.AssetID));
ItemDataMap.Add("Type", OSD.FromInteger(item.AssetType));
ItemDataMap.Add("InvType", OSD.FromInteger(item.InvType));
ItemDataMap.Add("Flags", OSD.FromBinary(EncodeU32((uint)item.Flags)));
ItemDataMap.Add("SaleType", OSD.FromInteger((byte)item.SaleType));
ItemDataMap.Add("SalePrice", OSD.FromInteger(item.SalePrice));
ItemDataMap.Add("Name", OSD.FromString(item.Name));
ItemDataMap.Add("Description", OSD.FromString(item.Description));
ItemDataMap.Add("CreationDate", OSD.FromInteger(item.CreationDate));
ItemDataMap.Add("CRC", OSD.FromBinary(EncodeU32(
Helpers.InventoryCRC(1000, 0, (sbyte)item.InvType,
(sbyte)item.AssetType, item.AssetID,
item.GroupID, 100,
item.Owner, item.CreatorIdAsUuid,
item.ID, item.Folder,
(uint)PermissionMask.All, 1, (uint)PermissionMask.All, (uint)PermissionMask.All,
(uint)PermissionMask.All)
)));
ItemDataMap.Add("CallbackID", 0);
ItemData.Add(ItemDataMap); ItemData.Add(ItemDataMap);
} }
llsd.Add("ItemData", ItemData); llsd.Add("ItemData", ItemData);
eq.Enqueue(BuildEvent("BulkUpdateInventory",
llsd), AgentId);
} }
} }
} }