change encoding few event cap messages

0.9.1.0-post-fixes
UbitUmarov 2019-01-29 21:11:21 +00:00
parent 6bc8e2413f
commit 6479eb9022
1 changed files with 89 additions and 124 deletions

View File

@ -13074,15 +13074,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
public static OSD BuildEvent(string eventName, OSD eventBody)
{
OSDMap osdEvent = new OSDMap(2);
osdEvent.Add("message", new OSDString(eventName));
osdEvent.Add("body", eventBody);
return osdEvent;
}
public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages) public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages)
{ {
AvatarInterestsReplyPacket packet = (AvatarInterestsReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarInterestsReply); AvatarInterestsReplyPacket packet = (AvatarInterestsReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarInterestsReply);
@ -13235,39 +13226,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendRemoveInventoryItems(UUID[] items) public void SendRemoveInventoryItems(UUID[] items)
{ {
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
if (eq == null) if (eq == null)
{ {
m_log.DebugFormat("[LLCLIENT]: Null event queue"); m_log.DebugFormat("[LLCLIENT]: Null event queue");
return; return;
} }
OSDMap llsd = new OSDMap(3); StringBuilder sb = eq.StartEvent("RemoveInventoryItem");
OSDMap AgentDataMap = new OSDMap(1); LLSDxmlEncode.AddArrayAndMap("AgentData", sb);
AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId)); LLSDxmlEncode.AddElem("AgentID", AgentId, sb);
AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId)); LLSDxmlEncode.AddElem("SessionID", SessionId, sb);
LLSDxmlEncode.AddEndMapAndArray(sb);
OSDArray AgentData = new OSDArray(1);
AgentData.Add(AgentDataMap);
llsd.Add("AgentData", AgentData);
OSDArray ItemData = new OSDArray();
LLSDxmlEncode.AddArray("InventoryData", sb);
foreach (UUID item in items) foreach (UUID item in items)
{ {
OSDMap ItemDataMap = new OSDMap(2); LLSDxmlEncode.AddMap(sb);
ItemDataMap.Add("ItemID", OSD.FromUUID(item)); LLSDxmlEncode.AddElem("ItemID",item, sb);
ItemDataMap.Add("AgentID", OSD.FromUUID(AgentId)); LLSDxmlEncode.AddEndMap(sb);
ItemData.Add(ItemDataMap);
} }
LLSDxmlEncode.AddEndArray(sb);
llsd.Add("InventoryData", ItemData); OSD ev = new OSDllsdxml(eq.EndEvent(sb));
eq.Enqueue(ev, AgentId);
eq.Enqueue(BuildEvent("RemoveInventoryItem",
llsd), AgentId);
} }
public void SendRemoveInventoryFolders(UUID[] folders) public void SendRemoveInventoryFolders(UUID[] folders)
@ -13280,40 +13262,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return; return;
} }
OSDMap llsd = new OSDMap(3); StringBuilder sb = eq.StartEvent("RemoveInventoryFolder");
OSDMap AgentDataMap = new OSDMap(1); LLSDxmlEncode.AddArrayAndMap("AgentData", sb);
AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId)); LLSDxmlEncode.AddElem("AgentID", AgentId, sb);
AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId)); LLSDxmlEncode.AddElem("SessionID", SessionId, sb);
LLSDxmlEncode.AddEndMapAndArray(sb);
OSDArray AgentData = new OSDArray(1);
AgentData.Add(AgentDataMap);
llsd.Add("AgentData", AgentData);
OSDArray FolderData = new OSDArray();
LLSDxmlEncode.AddArray("FolderData", sb);
foreach (UUID folder in folders) foreach (UUID folder in folders)
{ {
OSDMap FolderDataMap = new OSDMap(2); LLSDxmlEncode.AddMap(sb);
FolderDataMap.Add("FolderID", OSD.FromUUID(folder)); LLSDxmlEncode.AddElem("FolderID", folder, sb);
FolderDataMap.Add("AgentID", OSD.FromUUID(AgentId)); LLSDxmlEncode.AddEndMap(sb);
FolderData.Add(FolderDataMap);
} }
LLSDxmlEncode.AddEndArray(sb);
llsd.Add("FolderData", FolderData); OSD ev = new OSDllsdxml(eq.EndEvent(sb));
eq.Enqueue(ev, AgentId);
eq.Enqueue(BuildEvent("RemoveInventoryFolder",
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)
@ -13326,80 +13292,79 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return; return;
} }
OSDMap llsd = new OSDMap(3); StringBuilder sb = eq.StartEvent("BulkUpdateInventory");
OSDMap AgentDataMap = new OSDMap(1); LLSDxmlEncode.AddArrayAndMap("AgentData", sb);
AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId)); LLSDxmlEncode.AddElem("AgentID", AgentId, sb);
AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId)); LLSDxmlEncode.AddElem("TransactionID", UUID.Random(), sb);
AgentDataMap.Add("TransactionID", OSD.FromUUID(UUID.Random())); LLSDxmlEncode.AddEndMapAndArray(sb);
OSDArray AgentData = new OSDArray(1); if(folders.Length == 0)
AgentData.Add(AgentDataMap);
llsd.Add("AgentData", AgentData);
OSDArray FolderData = new OSDArray();
foreach (InventoryFolderBase folder in folders)
{ {
OSDMap FolderDataMap = new OSDMap(5); LLSDxmlEncode.AddEmptyArray("FolderData", sb);
FolderDataMap.Add("FolderID", OSD.FromUUID(folder.ID)); }
FolderDataMap.Add("AgentID", OSD.FromUUID(AgentId)); else
FolderDataMap.Add("ParentID", OSD.FromUUID(folder.ParentID)); {
FolderDataMap.Add("Type", OSD.FromInteger(folder.Type)); LLSDxmlEncode.AddArray("FolderData", sb);
FolderDataMap.Add("Name", OSD.FromString(folder.Name)); foreach (InventoryFolderBase folder in folders)
{
FolderData.Add(FolderDataMap); LLSDxmlEncode.AddMap(sb);
LLSDxmlEncode.AddElem("FolderID", folder.ID, sb);
LLSDxmlEncode.AddElem("ParentID", folder.ParentID, sb);
LLSDxmlEncode.AddElem("Type", (int)folder.Type, sb);
LLSDxmlEncode.AddElem("Name", folder.Name, sb);
LLSDxmlEncode.AddEndMap(sb);
}
LLSDxmlEncode.AddEndArray(sb);
} }
llsd.Add("FolderData", FolderData); if(items.Length == 0)
OSDArray ItemData = new OSDArray();
foreach (InventoryItemBase item in items)
{ {
OSDMap ItemDataMap = new OSDMap(); LLSDxmlEncode.AddEmptyArray("ItemData", sb);
}
ItemDataMap.Add("ItemID", OSD.FromUUID(item.ID)); else
ItemDataMap.Add("FolderID", OSD.FromUUID(item.Folder)); {
LLSDxmlEncode.AddArray("ItemData", sb);
ItemDataMap.Add("CreatorID", OSD.FromUUID(item.CreatorIdAsUuid)); foreach (InventoryItemBase item in items)
ItemDataMap.Add("OwnerID", OSD.FromUUID(item.Owner)); {
ItemDataMap.Add("GroupID", OSD.FromUUID(item.GroupID)); LLSDxmlEncode.AddMap(sb);
ItemDataMap.Add("BaseMask", OSD.FromBinary(EncodeU32((uint)item.BasePermissions))); LLSDxmlEncode.AddElem("ItemID", item.ID, sb);
ItemDataMap.Add("OwnerMask", OSD.FromBinary(EncodeU32((uint)item.CurrentPermissions))); LLSDxmlEncode.AddElem("CallbackID", (uint)0, sb);
ItemDataMap.Add("GroupMask", OSD.FromBinary(EncodeU32((uint)item.GroupPermissions))); LLSDxmlEncode.AddElem("FolderID", item.Folder, sb);
ItemDataMap.Add("EveryoneMask", OSD.FromBinary(EncodeU32((uint)item.EveryOnePermissions))); LLSDxmlEncode.AddElem("CreatorID", item.CreatorIdAsUuid, sb);
ItemDataMap.Add("NextOwnerMask", OSD.FromBinary(EncodeU32((uint)item.NextPermissions))); LLSDxmlEncode.AddElem("OwnerID", item.Owner, sb);
ItemDataMap.Add("GroupOwned", OSD.FromBoolean(item.GroupOwned)); LLSDxmlEncode.AddElem("GroupID", item.GroupID, sb);
ItemDataMap.Add("AssetID", OSD.FromUUID(item.AssetID)); LLSDxmlEncode.AddElem("BaseMask", item.BasePermissions, sb);
ItemDataMap.Add("Type", OSD.FromInteger(item.AssetType)); LLSDxmlEncode.AddElem("OwnerMask", item.CurrentPermissions, sb);
ItemDataMap.Add("InvType", OSD.FromInteger(item.InvType)); LLSDxmlEncode.AddElem("GroupMask", item.GroupPermissions, sb);
ItemDataMap.Add("Flags", OSD.FromBinary(EncodeU32((uint)item.Flags))); LLSDxmlEncode.AddElem("EveryoneMask", item.EveryOnePermissions, sb);
ItemDataMap.Add("SaleType", OSD.FromInteger((byte)item.SaleType)); LLSDxmlEncode.AddElem("NextOwnerMask", item.NextPermissions, sb);
ItemDataMap.Add("SalePrice", OSD.FromInteger(item.SalePrice)); LLSDxmlEncode.AddElem("GroupOwned", item.GroupOwned, sb);
ItemDataMap.Add("Name", OSD.FromString(item.Name)); LLSDxmlEncode.AddElem("AssetID", item.AssetID, sb);
ItemDataMap.Add("Description", OSD.FromString(item.Description)); LLSDxmlEncode.AddElem("Type", item.AssetType, sb);
ItemDataMap.Add("CreationDate", OSD.FromInteger(item.CreationDate)); LLSDxmlEncode.AddElem("InvType", item.InvType, sb);
LLSDxmlEncode.AddElem("Flags", item.Flags, sb);
ItemDataMap.Add("CRC", OSD.FromBinary(EncodeU32( LLSDxmlEncode.AddElem("SaleType", item.SaleType, sb);
Helpers.InventoryCRC(1000, 0, (sbyte)item.InvType, LLSDxmlEncode.AddElem("SalePrice", item.SalePrice, sb);
(sbyte)item.AssetType, item.AssetID, LLSDxmlEncode.AddElem("Name", item.Name, sb);
item.GroupID, 100, LLSDxmlEncode.AddElem("Description", item.Description, sb);
item.Owner, item.CreatorIdAsUuid, LLSDxmlEncode.AddElem("CreationDate", item.CreationDate, sb);
item.ID, item.Folder, LLSDxmlEncode.AddElem("CRC",
(uint)PermissionMask.All, 1, (uint)PermissionMask.All, (uint)PermissionMask.All, Helpers.InventoryCRC(1000, 0, (sbyte)item.InvType,
(uint)PermissionMask.All) (sbyte)item.AssetType, item.AssetID,
))); item.GroupID, 100,
ItemDataMap.Add("CallbackID", 0); item.Owner, item.CreatorIdAsUuid,
item.ID, item.Folder,
ItemData.Add(ItemDataMap); (uint)PermissionMask.All, 1, (uint)PermissionMask.All, (uint)PermissionMask.All,
(uint)PermissionMask.All),
sb);
LLSDxmlEncode.AddEndMap(sb);
}
LLSDxmlEncode.AddEndArray(sb);
} }
llsd.Add("ItemData", ItemData); OSD ev = new OSDllsdxml(eq.EndEvent(sb));
eq.Enqueue(ev, AgentId);
eq.Enqueue(BuildEvent("BulkUpdateInventory",
llsd), AgentId);
} }
private HashSet<string> m_outPacketsToDrop; private HashSet<string> m_outPacketsToDrop;