diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 594 |
1 files changed, 240 insertions, 354 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index f6a7a0c..49b9378 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -37,6 +37,7 @@ using System.Xml; | |||
37 | using log4net; | 37 | using log4net; |
38 | using OpenMetaverse; | 38 | using OpenMetaverse; |
39 | using OpenMetaverse.Packets; | 39 | using OpenMetaverse.Packets; |
40 | using OpenMetaverse.StructuredData; | ||
40 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
41 | using OpenSim.Framework.Client; | 42 | using OpenSim.Framework.Client; |
42 | using OpenSim.Framework.Communications.Cache; | 43 | using OpenSim.Framework.Communications.Cache; |
@@ -219,6 +220,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
219 | public event FriendActionDelegate OnApproveFriendRequest; | 220 | public event FriendActionDelegate OnApproveFriendRequest; |
220 | public event FriendActionDelegate OnDenyFriendRequest; | 221 | public event FriendActionDelegate OnDenyFriendRequest; |
221 | public event FriendshipTermination OnTerminateFriendship; | 222 | public event FriendshipTermination OnTerminateFriendship; |
223 | public event GrantUserFriendRights OnGrantUserRights; | ||
222 | public event MoneyTransferRequest OnMoneyTransferRequest; | 224 | public event MoneyTransferRequest OnMoneyTransferRequest; |
223 | public event EconomyDataRequest OnEconomyDataRequest; | 225 | public event EconomyDataRequest OnEconomyDataRequest; |
224 | public event MoneyBalanceRequest OnMoneyBalanceRequest; | 226 | public event MoneyBalanceRequest OnMoneyBalanceRequest; |
@@ -314,14 +316,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
314 | private readonly LLUDPClient m_udpClient; | 316 | private readonly LLUDPClient m_udpClient; |
315 | private readonly UUID m_sessionId; | 317 | private readonly UUID m_sessionId; |
316 | private readonly UUID m_secureSessionId; | 318 | private readonly UUID m_secureSessionId; |
317 | private readonly UUID m_agentId; | 319 | protected readonly UUID m_agentId; |
318 | private readonly uint m_circuitCode; | 320 | private readonly uint m_circuitCode; |
319 | private readonly byte[] m_channelVersion = Utils.EmptyBytes; | 321 | private readonly byte[] m_channelVersion = Utils.EmptyBytes; |
320 | private readonly Dictionary<string, UUID> m_defaultAnimations = new Dictionary<string, UUID>(); | 322 | private readonly Dictionary<string, UUID> m_defaultAnimations = new Dictionary<string, UUID>(); |
321 | private readonly IGroupsModule m_GroupsModule; | 323 | private readonly IGroupsModule m_GroupsModule; |
322 | 324 | ||
323 | private int m_cachedTextureSerial; | 325 | private int m_cachedTextureSerial; |
324 | private PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_avatarTerseUpdates; | 326 | protected PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_avatarTerseUpdates; |
325 | private PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_primTerseUpdates; | 327 | private PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_primTerseUpdates; |
326 | private PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates; | 328 | private PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates; |
327 | private int m_moneyBalance; | 329 | private int m_moneyBalance; |
@@ -783,6 +785,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
783 | public virtual void SendLayerData(float[] map) | 785 | public virtual void SendLayerData(float[] map) |
784 | { | 786 | { |
785 | Util.FireAndForget(DoSendLayerData, map); | 787 | Util.FireAndForget(DoSendLayerData, map); |
788 | |||
789 | // Send it sync, and async. It's not that much data | ||
790 | // and it improves user experience just so much! | ||
791 | DoSendLayerData(map); | ||
786 | } | 792 | } |
787 | 793 | ||
788 | /// <summary> | 794 | /// <summary> |
@@ -795,16 +801,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
795 | 801 | ||
796 | try | 802 | try |
797 | { | 803 | { |
798 | //for (int y = 0; y < 16; y++) | 804 | for (int y = 0; y < 16; y++) |
799 | //{ | 805 | { |
800 | // for (int x = 0; x < 16; x++) | 806 | for (int x = 0; x < 16; x+=4) |
801 | // { | 807 | { |
802 | // SendLayerData(x, y, map); | 808 | SendLayerPacket(x, y, map); |
803 | // } | 809 | } |
804 | //} | 810 | } |
805 | |||
806 | // Send LayerData in a spiral pattern. Fun! | ||
807 | SendLayerTopRight(map, 0, 0, 15, 15); | ||
808 | } | 811 | } |
809 | catch (Exception e) | 812 | catch (Exception e) |
810 | { | 813 | { |
@@ -812,51 +815,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
812 | } | 815 | } |
813 | } | 816 | } |
814 | 817 | ||
815 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | ||
816 | { | ||
817 | // Row | ||
818 | for (int i = x1; i <= x2; i++) | ||
819 | SendLayerData(i, y1, map); | ||
820 | |||
821 | // Column | ||
822 | for (int j = y1 + 1; j <= y2; j++) | ||
823 | SendLayerData(x2, j, map); | ||
824 | |||
825 | if (x2 - x1 > 0) | ||
826 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | ||
827 | } | ||
828 | |||
829 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | ||
830 | { | ||
831 | // Row in reverse | ||
832 | for (int i = x2; i >= x1; i--) | ||
833 | SendLayerData(i, y2, map); | ||
834 | |||
835 | // Column in reverse | ||
836 | for (int j = y2 - 1; j >= y1; j--) | ||
837 | SendLayerData(x1, j, map); | ||
838 | |||
839 | if (x2 - x1 > 0) | ||
840 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | ||
841 | } | ||
842 | |||
843 | /// <summary> | 818 | /// <summary> |
844 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client | 819 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client |
845 | /// </summary> | 820 | /// </summary> |
846 | /// <param name="map">heightmap</param> | 821 | /// <param name="map">heightmap</param> |
847 | /// <param name="px">X coordinate for patches 0..12</param> | 822 | /// <param name="px">X coordinate for patches 0..12</param> |
848 | /// <param name="py">Y coordinate for patches 0..15</param> | 823 | /// <param name="py">Y coordinate for patches 0..15</param> |
849 | // private void SendLayerPacket(float[] map, int y, int x) | 824 | private void SendLayerPacket(int x, int y, float[] map) |
850 | // { | 825 | { |
851 | // int[] patches = new int[4]; | 826 | int[] patches = new int[4]; |
852 | // patches[0] = x + 0 + y * 16; | 827 | patches[0] = x + 0 + y * 16; |
853 | // patches[1] = x + 1 + y * 16; | 828 | patches[1] = x + 1 + y * 16; |
854 | // patches[2] = x + 2 + y * 16; | 829 | patches[2] = x + 2 + y * 16; |
855 | // patches[3] = x + 3 + y * 16; | 830 | patches[3] = x + 3 + y * 16; |
856 | 831 | ||
857 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | 832 | float[] heightmap = (map.Length == 65536) ? |
858 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 833 | map : |
859 | // } | 834 | LLHeightFieldMoronize(map); |
835 | |||
836 | try | ||
837 | { | ||
838 | Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
839 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
840 | } | ||
841 | catch | ||
842 | { | ||
843 | for (int px = x ; px < x + 4 ; px++) | ||
844 | SendLayerData(px, y, map); | ||
845 | } | ||
846 | } | ||
860 | 847 | ||
861 | /// <summary> | 848 | /// <summary> |
862 | /// Sends a specified patch to a client | 849 | /// Sends a specified patch to a client |
@@ -1250,7 +1237,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1250 | /// <param name="fetchFolders">Do we need to send folder information?</param> | 1237 | /// <param name="fetchFolders">Do we need to send folder information?</param> |
1251 | /// <param name="fetchItems">Do we need to send item information?</param> | 1238 | /// <param name="fetchItems">Do we need to send item information?</param> |
1252 | public void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items, | 1239 | public void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items, |
1253 | List<InventoryFolderBase> folders, | 1240 | List<InventoryFolderBase> folders, int version, |
1254 | bool fetchFolders, bool fetchItems) | 1241 | bool fetchFolders, bool fetchItems) |
1255 | { | 1242 | { |
1256 | // An inventory descendents packet consists of a single agent section and an inventory details | 1243 | // An inventory descendents packet consists of a single agent section and an inventory details |
@@ -1263,174 +1250,107 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1263 | // | 1250 | // |
1264 | // for one example of this kind of thing. In fact, the Linden servers appear to only send about | 1251 | // for one example of this kind of thing. In fact, the Linden servers appear to only send about |
1265 | // 6 to 7 items at a time, so let's stick with 6 | 1252 | // 6 to 7 items at a time, so let's stick with 6 |
1266 | int MAX_ITEMS_PER_PACKET = 6; | 1253 | int MAX_ITEMS_PER_PACKET = 5; |
1267 | 1254 | int MAX_FOLDERS_PER_PACKET = 6; | |
1268 | //Ckrinke This variable is not used, so comment out to remove the warning from the compiler (3-21-08) | ||
1269 | //Ckrinke uint FULL_MASK_PERMISSIONS = 2147483647; | ||
1270 | 1255 | ||
1256 | int totalItems = fetchItems ? items.Count : 0; | ||
1257 | int totalFolders = fetchFolders ? folders.Count : 0; | ||
1271 | int itemsSent = 0; | 1258 | int itemsSent = 0; |
1272 | if (fetchItems) | 1259 | int foldersSent = 0; |
1273 | { | 1260 | int foldersToSend = 0; |
1274 | InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID); | 1261 | int itemsToSend = 0; |
1275 | |||
1276 | if (items.Count < MAX_ITEMS_PER_PACKET) | ||
1277 | { | ||
1278 | descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count]; | ||
1279 | } | ||
1280 | else | ||
1281 | { | ||
1282 | descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[MAX_ITEMS_PER_PACKET]; | ||
1283 | } | ||
1284 | 1262 | ||
1285 | // Descendents must contain the *total* number of descendents (plus folders, whether we | 1263 | InventoryDescendentsPacket currentPacket = null; |
1286 | // fetch them or not), not the number of entries we send in this packet. For consistency, | ||
1287 | // I'll use it for folder-requests, too, although I wasn't able to get one with | ||
1288 | // FetchFolders = true. | ||
1289 | // TODO this should be checked with FetchFolders = true | ||
1290 | descend.AgentData.Descendents = items.Count + folders.Count; | ||
1291 | 1264 | ||
1292 | int count = 0; | 1265 | // Handle empty folders |
1293 | int i = 0; | 1266 | // |
1294 | foreach (InventoryItemBase item in items) | 1267 | if (totalItems == 0 && totalFolders == 0) |
1268 | currentPacket = CreateInventoryDescendentsPacket(ownerID, folderID, version, items.Count + folders.Count, 0, 0); | ||
1269 | |||
1270 | // To preserve SL compatibility, we will NOT combine folders and items in one packet | ||
1271 | // | ||
1272 | while(itemsSent < totalItems || foldersSent < totalFolders) | ||
1273 | { | ||
1274 | if (currentPacket == null) // Start a new packet | ||
1295 | { | 1275 | { |
1296 | descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock(); | 1276 | foldersToSend = totalFolders - foldersSent; |
1297 | descend.ItemData[i].ItemID = item.ID; | 1277 | if (foldersToSend > MAX_FOLDERS_PER_PACKET) |
1298 | descend.ItemData[i].AssetID = item.AssetID; | 1278 | foldersToSend = MAX_FOLDERS_PER_PACKET; |
1299 | descend.ItemData[i].CreatorID = item.CreatorIdAsUuid; | 1279 | |
1300 | descend.ItemData[i].BaseMask = item.BasePermissions; | 1280 | if (foldersToSend == 0) |
1301 | descend.ItemData[i].Description = Util.StringToBytes256(item.Description); | 1281 | { |
1302 | descend.ItemData[i].EveryoneMask = item.EveryOnePermissions; | 1282 | itemsToSend = totalItems - itemsSent; |
1303 | descend.ItemData[i].OwnerMask = item.CurrentPermissions; | 1283 | if (itemsToSend > MAX_ITEMS_PER_PACKET) |
1304 | descend.ItemData[i].FolderID = item.Folder; | 1284 | itemsToSend = MAX_ITEMS_PER_PACKET; |
1305 | descend.ItemData[i].InvType = (sbyte)item.InvType; | ||
1306 | descend.ItemData[i].Name = Util.StringToBytes256(item.Name); | ||
1307 | descend.ItemData[i].NextOwnerMask = item.NextPermissions; | ||
1308 | descend.ItemData[i].OwnerID = item.Owner; | ||
1309 | descend.ItemData[i].Type = (sbyte)item.AssetType; | ||
1310 | |||
1311 | descend.ItemData[i].GroupID = item.GroupID; | ||
1312 | descend.ItemData[i].GroupOwned = item.GroupOwned; | ||
1313 | descend.ItemData[i].GroupMask = item.GroupPermissions; | ||
1314 | descend.ItemData[i].CreationDate = item.CreationDate; | ||
1315 | descend.ItemData[i].SalePrice = item.SalePrice; | ||
1316 | descend.ItemData[i].SaleType = item.SaleType; | ||
1317 | descend.ItemData[i].Flags = item.Flags; | ||
1318 | |||
1319 | descend.ItemData[i].CRC = | ||
1320 | Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType, | ||
1321 | descend.ItemData[i].InvType, descend.ItemData[i].Type, | ||
1322 | descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, | ||
1323 | descend.ItemData[i].SalePrice, | ||
1324 | descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID, | ||
1325 | descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, | ||
1326 | descend.ItemData[i].EveryoneMask, | ||
1327 | descend.ItemData[i].Flags, descend.ItemData[i].OwnerMask, | ||
1328 | descend.ItemData[i].GroupMask, item.CurrentPermissions); | ||
1329 | |||
1330 | i++; | ||
1331 | count++; | ||
1332 | itemsSent++; | ||
1333 | if (i == MAX_ITEMS_PER_PACKET) | ||
1334 | { | ||
1335 | descend.Header.Zerocoded = true; | ||
1336 | AddNullFolderBlockToDecendentsPacket(ref descend); | ||
1337 | OutPacket(descend, ThrottleOutPacketType.Asset); | ||
1338 | |||
1339 | if ((items.Count - count) > 0) | ||
1340 | { | ||
1341 | descend = CreateInventoryDescendentsPacket(ownerID, folderID); | ||
1342 | if ((items.Count - count) < MAX_ITEMS_PER_PACKET) | ||
1343 | { | ||
1344 | descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count - count]; | ||
1345 | } | ||
1346 | else | ||
1347 | { | ||
1348 | descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[MAX_ITEMS_PER_PACKET]; | ||
1349 | } | ||
1350 | descend.AgentData.Descendents = items.Count + folders.Count; | ||
1351 | i = 0; | ||
1352 | } | ||
1353 | } | 1285 | } |
1354 | } | ||
1355 | 1286 | ||
1356 | if (0 < i && i < MAX_ITEMS_PER_PACKET) | 1287 | currentPacket = CreateInventoryDescendentsPacket(ownerID, folderID, version, items.Count + folders.Count, foldersToSend, itemsToSend); |
1357 | { | ||
1358 | AddNullFolderBlockToDecendentsPacket(ref descend); | ||
1359 | OutPacket(descend, ThrottleOutPacketType.Asset); | ||
1360 | } | 1288 | } |
1361 | } | ||
1362 | 1289 | ||
1363 | //send subfolders | 1290 | if (foldersToSend-- > 0) |
1364 | if (fetchFolders) | 1291 | currentPacket.FolderData[foldersSent % MAX_FOLDERS_PER_PACKET] = CreateFolderDataBlock(folders[foldersSent++]); |
1365 | { | 1292 | else if(itemsToSend-- > 0) |
1366 | InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID); | 1293 | currentPacket.ItemData[itemsSent % MAX_ITEMS_PER_PACKET] = CreateItemDataBlock(items[itemsSent++]); |
1367 | |||
1368 | if (folders.Count < MAX_ITEMS_PER_PACKET) | ||
1369 | { | ||
1370 | descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count]; | ||
1371 | } | ||
1372 | else | 1294 | else |
1373 | { | 1295 | { |
1374 | descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET]; | 1296 | OutPacket(currentPacket, ThrottleOutPacketType.Asset, false); |
1297 | currentPacket = null; | ||
1375 | } | 1298 | } |
1376 | 1299 | ||
1377 | // Not sure if this scenario ever actually occurs, but nonetheless we include the items | 1300 | } |
1378 | // count even if we're not sending item data for the same reasons as above. | ||
1379 | descend.AgentData.Descendents = items.Count + folders.Count; | ||
1380 | 1301 | ||
1381 | int i = 0; | 1302 | if (currentPacket != null) |
1382 | int count = 0; | 1303 | OutPacket(currentPacket, ThrottleOutPacketType.Asset, false); |
1383 | foreach (InventoryFolderBase folder in folders) | 1304 | } |
1384 | { | ||
1385 | descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock(); | ||
1386 | descend.FolderData[i].FolderID = folder.ID; | ||
1387 | descend.FolderData[i].Name = Util.StringToBytes256(folder.Name); | ||
1388 | descend.FolderData[i].ParentID = folder.ParentID; | ||
1389 | descend.FolderData[i].Type = (sbyte)folder.Type; | ||
1390 | 1305 | ||
1391 | i++; | 1306 | private InventoryDescendentsPacket.FolderDataBlock CreateFolderDataBlock(InventoryFolderBase folder) |
1392 | count++; | 1307 | { |
1393 | itemsSent++; | 1308 | InventoryDescendentsPacket.FolderDataBlock newBlock = new InventoryDescendentsPacket.FolderDataBlock(); |
1394 | if (i == MAX_ITEMS_PER_PACKET) | 1309 | newBlock.FolderID = folder.ID; |
1395 | { | 1310 | newBlock.Name = Util.StringToBytes256(folder.Name); |
1396 | AddNullItemBlockToDescendentsPacket(ref descend); | 1311 | newBlock.ParentID = folder.ParentID; |
1397 | OutPacket(descend, ThrottleOutPacketType.Asset); | 1312 | newBlock.Type = (sbyte)folder.Type; |
1398 | 1313 | ||
1399 | if ((folders.Count - count) > 0) | 1314 | return newBlock; |
1400 | { | 1315 | } |
1401 | descend = CreateInventoryDescendentsPacket(ownerID, folderID); | ||
1402 | if ((folders.Count - count) < MAX_ITEMS_PER_PACKET) | ||
1403 | { | ||
1404 | descend.FolderData = | ||
1405 | new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count]; | ||
1406 | } | ||
1407 | else | ||
1408 | { | ||
1409 | descend.FolderData = | ||
1410 | new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET]; | ||
1411 | } | ||
1412 | descend.AgentData.Descendents = items.Count + folders.Count; | ||
1413 | i = 0; | ||
1414 | } | ||
1415 | } | ||
1416 | } | ||
1417 | 1316 | ||
1418 | if (0 < i && i < MAX_ITEMS_PER_PACKET) | 1317 | private InventoryDescendentsPacket.ItemDataBlock CreateItemDataBlock(InventoryItemBase item) |
1419 | { | 1318 | { |
1420 | AddNullItemBlockToDescendentsPacket(ref descend); | 1319 | InventoryDescendentsPacket.ItemDataBlock newBlock = new InventoryDescendentsPacket.ItemDataBlock(); |
1421 | OutPacket(descend, ThrottleOutPacketType.Asset); | 1320 | newBlock.ItemID = item.ID; |
1422 | } | 1321 | newBlock.AssetID = item.AssetID; |
1423 | } | 1322 | newBlock.CreatorID = item.CreatorIdAsUuid; |
1323 | newBlock.BaseMask = item.BasePermissions; | ||
1324 | newBlock.Description = Util.StringToBytes256(item.Description); | ||
1325 | newBlock.EveryoneMask = item.EveryOnePermissions; | ||
1326 | newBlock.OwnerMask = item.CurrentPermissions; | ||
1327 | newBlock.FolderID = item.Folder; | ||
1328 | newBlock.InvType = (sbyte)item.InvType; | ||
1329 | newBlock.Name = Util.StringToBytes256(item.Name); | ||
1330 | newBlock.NextOwnerMask = item.NextPermissions; | ||
1331 | newBlock.OwnerID = item.Owner; | ||
1332 | newBlock.Type = (sbyte)item.AssetType; | ||
1424 | 1333 | ||
1425 | if (itemsSent == 0) | 1334 | newBlock.GroupID = item.GroupID; |
1426 | { | 1335 | newBlock.GroupOwned = item.GroupOwned; |
1427 | // no items found. | 1336 | newBlock.GroupMask = item.GroupPermissions; |
1428 | InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID); | 1337 | newBlock.CreationDate = item.CreationDate; |
1429 | descend.AgentData.Descendents = 0; | 1338 | newBlock.SalePrice = item.SalePrice; |
1430 | AddNullItemBlockToDescendentsPacket(ref descend); | 1339 | newBlock.SaleType = item.SaleType; |
1431 | AddNullFolderBlockToDecendentsPacket(ref descend); | 1340 | newBlock.Flags = item.Flags; |
1432 | OutPacket(descend, ThrottleOutPacketType.Asset); | 1341 | |
1433 | } | 1342 | newBlock.CRC = |
1343 | Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType, | ||
1344 | newBlock.InvType, newBlock.Type, | ||
1345 | newBlock.AssetID, newBlock.GroupID, | ||
1346 | newBlock.SalePrice, | ||
1347 | newBlock.OwnerID, newBlock.CreatorID, | ||
1348 | newBlock.ItemID, newBlock.FolderID, | ||
1349 | newBlock.EveryoneMask, | ||
1350 | newBlock.Flags, newBlock.OwnerMask, | ||
1351 | newBlock.GroupMask, newBlock.NextOwnerMask); | ||
1352 | |||
1353 | return newBlock; | ||
1434 | } | 1354 | } |
1435 | 1355 | ||
1436 | private void AddNullFolderBlockToDecendentsPacket(ref InventoryDescendentsPacket packet) | 1356 | private void AddNullFolderBlockToDecendentsPacket(ref InventoryDescendentsPacket packet) |
@@ -1472,14 +1392,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1472 | // No need to add CRC | 1392 | // No need to add CRC |
1473 | } | 1393 | } |
1474 | 1394 | ||
1475 | private InventoryDescendentsPacket CreateInventoryDescendentsPacket(UUID ownerID, UUID folderID) | 1395 | private InventoryDescendentsPacket CreateInventoryDescendentsPacket(UUID ownerID, UUID folderID, int version, int descendents, int folders, int items) |
1476 | { | 1396 | { |
1477 | InventoryDescendentsPacket descend = (InventoryDescendentsPacket)PacketPool.Instance.GetPacket(PacketType.InventoryDescendents); | 1397 | InventoryDescendentsPacket descend = (InventoryDescendentsPacket)PacketPool.Instance.GetPacket(PacketType.InventoryDescendents); |
1478 | descend.Header.Zerocoded = true; | 1398 | descend.Header.Zerocoded = true; |
1479 | descend.AgentData.AgentID = AgentId; | 1399 | descend.AgentData.AgentID = AgentId; |
1480 | descend.AgentData.OwnerID = ownerID; | 1400 | descend.AgentData.OwnerID = ownerID; |
1481 | descend.AgentData.FolderID = folderID; | 1401 | descend.AgentData.FolderID = folderID; |
1482 | descend.AgentData.Version = 1; | 1402 | descend.AgentData.Version = version; |
1403 | descend.AgentData.Descendents = descendents; | ||
1404 | |||
1405 | if (folders > 0) | ||
1406 | descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders]; | ||
1407 | else | ||
1408 | AddNullFolderBlockToDecendentsPacket(ref descend); | ||
1409 | |||
1410 | if (items > 0) | ||
1411 | descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items]; | ||
1412 | else | ||
1413 | AddNullItemBlockToDescendentsPacket(ref descend); | ||
1483 | 1414 | ||
1484 | return descend; | 1415 | return descend; |
1485 | } | 1416 | } |
@@ -1856,7 +1787,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1856 | economyData.Info.TeleportMinPrice = TeleportMinPrice; | 1787 | economyData.Info.TeleportMinPrice = TeleportMinPrice; |
1857 | economyData.Info.TeleportPriceExponent = TeleportPriceExponent; | 1788 | economyData.Info.TeleportPriceExponent = TeleportPriceExponent; |
1858 | economyData.Header.Reliable = true; | 1789 | economyData.Header.Reliable = true; |
1859 | OutPacket(economyData, ThrottleOutPacketType.Unknown); | 1790 | OutPacket(economyData, ThrottleOutPacketType.Task); |
1860 | } | 1791 | } |
1861 | 1792 | ||
1862 | public void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data) | 1793 | public void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data) |
@@ -2786,30 +2717,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2786 | 2717 | ||
2787 | public void SendAvatarGroupsReply(UUID avatarID, GroupMembershipData[] data) | 2718 | public void SendAvatarGroupsReply(UUID avatarID, GroupMembershipData[] data) |
2788 | { | 2719 | { |
2789 | AvatarGroupsReplyPacket p = (AvatarGroupsReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarGroupsReply); | 2720 | OSDMap llsd = new OSDMap(3); |
2790 | 2721 | OSDArray AgentData = new OSDArray(1); | |
2791 | p.AgentData = new AvatarGroupsReplyPacket.AgentDataBlock(); | 2722 | OSDMap AgentDataMap = new OSDMap(1); |
2792 | p.AgentData.AgentID = AgentId; | 2723 | AgentDataMap.Add("AgentID", OSD.FromUUID(this.AgentId)); |
2793 | p.AgentData.AvatarID = avatarID; | 2724 | AgentDataMap.Add("AvatarID", OSD.FromUUID(avatarID)); |
2794 | 2725 | AgentData.Add(AgentDataMap); | |
2795 | p.GroupData = new AvatarGroupsReplyPacket.GroupDataBlock[data.Length]; | 2726 | llsd.Add("AgentData", AgentData); |
2796 | int i = 0; | 2727 | OSDArray GroupData = new OSDArray(data.Length); |
2797 | foreach (GroupMembershipData m in data) | 2728 | OSDArray NewGroupData = new OSDArray(data.Length); |
2798 | { | 2729 | foreach (GroupMembershipData m in data) |
2799 | p.GroupData[i] = new AvatarGroupsReplyPacket.GroupDataBlock(); | 2730 | { |
2800 | p.GroupData[i].GroupPowers = m.GroupPowers; | 2731 | OSDMap GroupDataMap = new OSDMap(6); |
2801 | p.GroupData[i].AcceptNotices = m.AcceptNotices; | 2732 | OSDMap NewGroupDataMap = new OSDMap(1); |
2802 | p.GroupData[i].GroupTitle = Utils.StringToBytes(m.GroupTitle); | 2733 | GroupDataMap.Add("GroupPowers", OSD.FromBinary(m.GroupPowers)); |
2803 | p.GroupData[i].GroupID = m.GroupID; | 2734 | GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(m.AcceptNotices)); |
2804 | p.GroupData[i].GroupName = Utils.StringToBytes(m.GroupName); | 2735 | GroupDataMap.Add("GroupTitle", OSD.FromString(m.GroupTitle)); |
2805 | p.GroupData[i].GroupInsigniaID = m.GroupPicture; | 2736 | GroupDataMap.Add("GroupID", OSD.FromUUID(m.GroupID)); |
2806 | i++; | 2737 | GroupDataMap.Add("GroupName", OSD.FromString(m.GroupName)); |
2807 | } | 2738 | GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(m.GroupPicture)); |
2808 | 2739 | NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(m.ListInProfile)); | |
2809 | p.NewGroupData = new AvatarGroupsReplyPacket.NewGroupDataBlock(); | 2740 | GroupData.Add(GroupDataMap); |
2810 | p.NewGroupData.ListInProfile = true; | 2741 | NewGroupData.Add(NewGroupDataMap); |
2811 | 2742 | } | |
2812 | OutPacket(p, ThrottleOutPacketType.Task); | 2743 | llsd.Add("GroupData", GroupData); |
2744 | llsd.Add("NewGroupData", NewGroupData); | ||
2745 | |||
2746 | IEventQueue eq = this.Scene.RequestModuleInterface<IEventQueue>(); | ||
2747 | if (eq != null) | ||
2748 | { | ||
2749 | eq.Enqueue(BuildEvent("AvatarGroupsReply", llsd), this.AgentId); | ||
2750 | } | ||
2813 | } | 2751 | } |
2814 | 2752 | ||
2815 | public void SendJoinGroupReply(UUID groupID, bool success) | 2753 | public void SendJoinGroupReply(UUID groupID, bool success) |
@@ -3168,107 +3106,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3168 | 3106 | ||
3169 | #endregion | 3107 | #endregion |
3170 | 3108 | ||
3171 | #region Prim/Avatar Updates | ||
3172 | |||
3173 | /*void SendObjectUpdate(SceneObjectPart obj, PrimFlags creatorFlags, PrimUpdateFlags updateFlags) | ||
3174 | { | ||
3175 | bool canUseCompressed, canUseImproved; | ||
3176 | UpdateFlagsToPacketType(creatorFlags, updateFlags, out canUseCompressed, out canUseImproved); | ||
3177 | |||
3178 | if (!canUseImproved && !canUseCompressed) | ||
3179 | SendFullObjectUpdate(obj, creatorFlags, updateFlags); | ||
3180 | else if (!canUseImproved) | ||
3181 | SendObjectUpdateCompressed(obj, creatorFlags, updateFlags); | ||
3182 | else | ||
3183 | SendImprovedTerseObjectUpdate(obj, creatorFlags, updateFlags); | ||
3184 | } | ||
3185 | |||
3186 | void SendFullObjectUpdate(SceneObjectPart obj, PrimFlags creatorFlags, PrimUpdateFlags updateFlags) | ||
3187 | { | ||
3188 | IClientAPI owner; | ||
3189 | if (m_scene.ClientManager.TryGetValue(obj.OwnerID, out owner) && owner is LLClientView) | ||
3190 | { | ||
3191 | LLClientView llOwner = (LLClientView)owner; | ||
3192 | |||
3193 | // Send an update out to the owner | ||
3194 | ObjectUpdatePacket updateToOwner = new ObjectUpdatePacket(); | ||
3195 | updateToOwner.RegionData.RegionHandle = obj.RegionHandle; | ||
3196 | //updateToOwner.RegionData.TimeDilation = (ushort)(timeDilation * (float)UInt16.MaxValue); | ||
3197 | updateToOwner.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | ||
3198 | updateToOwner.ObjectData[0] = BuildUpdateBlock(obj, obj.Flags | creatorFlags | PrimFlags.ObjectYouOwner, 0); | ||
3199 | |||
3200 | m_udpServer.SendPacket(llOwner.UDPClient, updateToOwner, ThrottleOutPacketType.State, true); | ||
3201 | } | ||
3202 | |||
3203 | // Send an update out to everyone else | ||
3204 | ObjectUpdatePacket updateToOthers = new ObjectUpdatePacket(); | ||
3205 | updateToOthers.RegionData.RegionHandle = obj.RegionHandle; | ||
3206 | //updateToOthers.RegionData.TimeDilation = (ushort)(timeDilation * (float)UInt16.MaxValue); | ||
3207 | updateToOthers.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | ||
3208 | updateToOthers.ObjectData[0] = BuildUpdateBlock(obj, obj.Flags, 0); | ||
3209 | |||
3210 | m_scene.ClientManager.ForEach( | ||
3211 | delegate(IClientAPI client) | ||
3212 | { | ||
3213 | if (client.AgentId != obj.OwnerID && client is LLClientView) | ||
3214 | { | ||
3215 | LLClientView llClient = (LLClientView)client; | ||
3216 | m_udpServer.SendPacket(llClient.UDPClient, updateToOthers, ThrottleOutPacketType.State, true); | ||
3217 | } | ||
3218 | } | ||
3219 | ); | ||
3220 | } | ||
3221 | |||
3222 | void SendObjectUpdateCompressed(SceneObjectPart obj, PrimFlags creatorFlags, PrimUpdateFlags updateFlags) | ||
3223 | { | ||
3224 | } | ||
3225 | |||
3226 | void SendImprovedTerseObjectUpdate(SceneObjectPart obj, PrimFlags creatorFlags, PrimUpdateFlags updateFlags) | ||
3227 | { | ||
3228 | } | ||
3229 | |||
3230 | void UpdateFlagsToPacketType(PrimFlags creatorFlags, PrimUpdateFlags updateFlags, out bool canUseCompressed, out bool canUseImproved) | ||
3231 | { | ||
3232 | canUseCompressed = true; | ||
3233 | canUseImproved = true; | ||
3234 | |||
3235 | if ((updateFlags & PrimUpdateFlags.FullUpdate) == PrimUpdateFlags.FullUpdate || creatorFlags != PrimFlags.None) | ||
3236 | { | ||
3237 | canUseCompressed = false; | ||
3238 | canUseImproved = false; | ||
3239 | } | ||
3240 | else | ||
3241 | { | ||
3242 | if ((updateFlags & PrimUpdateFlags.Velocity) != 0 || | ||
3243 | (updateFlags & PrimUpdateFlags.Acceleration) != 0 || | ||
3244 | (updateFlags & PrimUpdateFlags.CollisionPlane) != 0 || | ||
3245 | (updateFlags & PrimUpdateFlags.Joint) != 0) | ||
3246 | { | ||
3247 | canUseCompressed = false; | ||
3248 | } | ||
3249 | |||
3250 | if ((updateFlags & PrimUpdateFlags.PrimFlags) != 0 || | ||
3251 | (updateFlags & PrimUpdateFlags.ParentID) != 0 || | ||
3252 | (updateFlags & PrimUpdateFlags.Scale) != 0 || | ||
3253 | (updateFlags & PrimUpdateFlags.PrimData) != 0 || | ||
3254 | (updateFlags & PrimUpdateFlags.Text) != 0 || | ||
3255 | (updateFlags & PrimUpdateFlags.NameValue) != 0 || | ||
3256 | (updateFlags & PrimUpdateFlags.ExtraData) != 0 || | ||
3257 | (updateFlags & PrimUpdateFlags.TextureAnim) != 0 || | ||
3258 | (updateFlags & PrimUpdateFlags.Sound) != 0 || | ||
3259 | (updateFlags & PrimUpdateFlags.Particles) != 0 || | ||
3260 | (updateFlags & PrimUpdateFlags.Material) != 0 || | ||
3261 | (updateFlags & PrimUpdateFlags.ClickAction) != 0 || | ||
3262 | (updateFlags & PrimUpdateFlags.MediaURL) != 0 || | ||
3263 | (updateFlags & PrimUpdateFlags.Joint) != 0) | ||
3264 | { | ||
3265 | canUseImproved = false; | ||
3266 | } | ||
3267 | } | ||
3268 | }*/ | ||
3269 | |||
3270 | #endregion Prim/Avatar Updates | ||
3271 | |||
3272 | #region Avatar Packet/Data Sending Methods | 3109 | #region Avatar Packet/Data Sending Methods |
3273 | 3110 | ||
3274 | /// <summary> | 3111 | /// <summary> |
@@ -3314,7 +3151,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3314 | ProcessAvatarTerseUpdates(); | 3151 | ProcessAvatarTerseUpdates(); |
3315 | } | 3152 | } |
3316 | 3153 | ||
3317 | private void ProcessAvatarTerseUpdates() | 3154 | protected void ProcessAvatarTerseUpdates() |
3318 | { | 3155 | { |
3319 | ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); | 3156 | ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); |
3320 | terse.Header.Reliable = false; | 3157 | terse.Header.Reliable = false; |
@@ -3335,6 +3172,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3335 | terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue(); | 3172 | terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue(); |
3336 | } | 3173 | } |
3337 | 3174 | ||
3175 | // HACK: Using the task category until the tiered reprioritization code is in | ||
3338 | OutPacket(terse, ThrottleOutPacketType.Task); | 3176 | OutPacket(terse, ThrottleOutPacketType.Task); |
3339 | } | 3177 | } |
3340 | 3178 | ||
@@ -3343,12 +3181,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3343 | if (!IsActive) return; // We don't need to update inactive clients. | 3181 | if (!IsActive) return; // We don't need to update inactive clients. |
3344 | 3182 | ||
3345 | CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); | 3183 | CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); |
3346 | // TODO: don't create new blocks if recycling an old packet | 3184 | loc.Header.Reliable = false; |
3347 | int total = CoarseLocations.Count; | 3185 | |
3348 | CoarseLocationUpdatePacket.IndexBlock ib = | 3186 | // Each packet can only hold around 62 avatar positions and the client clears the mini-map each time |
3349 | new CoarseLocationUpdatePacket.IndexBlock(); | 3187 | // a CoarseLocationUpdate packet is received. Oh well. |
3188 | int total = Math.Min(CoarseLocations.Count, 60); | ||
3189 | |||
3190 | CoarseLocationUpdatePacket.IndexBlock ib = new CoarseLocationUpdatePacket.IndexBlock(); | ||
3191 | |||
3350 | loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; | 3192 | loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; |
3351 | loc.AgentData = new CoarseLocationUpdatePacket.AgentDataBlock[total]; | 3193 | loc.AgentData = new CoarseLocationUpdatePacket.AgentDataBlock[total]; |
3194 | |||
3352 | int selfindex = -1; | 3195 | int selfindex = -1; |
3353 | for (int i = 0; i < total; i++) | 3196 | for (int i = 0; i < total; i++) |
3354 | { | 3197 | { |
@@ -3358,18 +3201,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3358 | lb.X = (byte)CoarseLocations[i].X; | 3201 | lb.X = (byte)CoarseLocations[i].X; |
3359 | lb.Y = (byte)CoarseLocations[i].Y; | 3202 | lb.Y = (byte)CoarseLocations[i].Y; |
3360 | 3203 | ||
3361 | lb.Z = CoarseLocations[i].Z > 1024 ? (byte)0 : (byte)(CoarseLocations[i].Z * 0.25); | 3204 | lb.Z = CoarseLocations[i].Z > 1024 ? (byte)0 : (byte)(CoarseLocations[i].Z * 0.25f); |
3362 | loc.Location[i] = lb; | 3205 | loc.Location[i] = lb; |
3363 | loc.AgentData[i] = new CoarseLocationUpdatePacket.AgentDataBlock(); | 3206 | loc.AgentData[i] = new CoarseLocationUpdatePacket.AgentDataBlock(); |
3364 | loc.AgentData[i].AgentID = users[i]; | 3207 | loc.AgentData[i].AgentID = users[i]; |
3365 | if (users[i] == AgentId) | 3208 | if (users[i] == AgentId) |
3366 | selfindex = i; | 3209 | selfindex = i; |
3367 | } | 3210 | } |
3211 | |||
3368 | ib.You = (short)selfindex; | 3212 | ib.You = (short)selfindex; |
3369 | ib.Prey = -1; | 3213 | ib.Prey = -1; |
3370 | loc.Index = ib; | 3214 | loc.Index = ib; |
3371 | loc.Header.Reliable = false; | ||
3372 | loc.Header.Zerocoded = true; | ||
3373 | 3215 | ||
3374 | OutPacket(loc, ThrottleOutPacketType.Task); | 3216 | OutPacket(loc, ThrottleOutPacketType.Task); |
3375 | } | 3217 | } |
@@ -4180,11 +4022,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4180 | 4022 | ||
4181 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(SendPrimitiveTerseData data) | 4023 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(SendPrimitiveTerseData data) |
4182 | { | 4024 | { |
4183 | return CreateImprovedTerseBlock(false, data.LocalID, data.State, Vector4.Zero, data.Position, data.Velocity, | 4025 | return CreateImprovedTerseBlock(false, data.LocalID, data.AttachPoint, Vector4.Zero, data.Position, data.Velocity, |
4184 | data.Acceleration, data.Rotation, data.AngularVelocity, data.TextureEntry); | 4026 | data.Acceleration, data.Rotation, data.AngularVelocity, data.TextureEntry); |
4185 | } | 4027 | } |
4186 | 4028 | ||
4187 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(bool avatar, uint localID, byte state, | 4029 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(bool avatar, uint localID, int attachPoint, |
4188 | Vector4 collisionPlane, Vector3 position, Vector3 velocity, Vector3 acceleration, Quaternion rotation, | 4030 | Vector4 collisionPlane, Vector3 position, Vector3 velocity, Vector3 acceleration, Quaternion rotation, |
4189 | Vector3 angularVelocity, byte[] textureEntry) | 4031 | Vector3 angularVelocity, byte[] textureEntry) |
4190 | { | 4032 | { |
@@ -4196,7 +4038,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4196 | pos += 4; | 4038 | pos += 4; |
4197 | 4039 | ||
4198 | // Avatar/CollisionPlane | 4040 | // Avatar/CollisionPlane |
4199 | data[pos++] = state; | 4041 | data[pos++] = (byte)((attachPoint % 16) * 16 + (attachPoint / 16)); ; |
4200 | if (avatar) | 4042 | if (avatar) |
4201 | { | 4043 | { |
4202 | data[pos++] = 1; | 4044 | data[pos++] = 1; |
@@ -4430,11 +4272,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4430 | /// </summary> | 4272 | /// </summary> |
4431 | protected virtual void RegisterLocalPacketHandlers() | 4273 | protected virtual void RegisterLocalPacketHandlers() |
4432 | { | 4274 | { |
4433 | AddLocalPacketHandler(PacketType.LogoutRequest, Logout); | 4275 | AddLocalPacketHandler(PacketType.LogoutRequest, HandleLogout); |
4434 | AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate); | 4276 | AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate); |
4435 | AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect); | 4277 | AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect); |
4436 | AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached); | 4278 | AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached); |
4437 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate); | 4279 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate); |
4438 | AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest); | 4280 | AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest); |
4439 | AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest); | 4281 | AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest); |
4440 | AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest); | 4282 | AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest); |
@@ -4703,7 +4545,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4703 | /// <param name="client"></param> | 4545 | /// <param name="client"></param> |
4704 | /// <param name="packet"></param> | 4546 | /// <param name="packet"></param> |
4705 | /// <returns></returns> | 4547 | /// <returns></returns> |
4706 | protected virtual bool Logout(IClientAPI client, Packet packet) | 4548 | protected virtual bool HandleLogout(IClientAPI client, Packet packet) |
4707 | { | 4549 | { |
4708 | if (packet.Type == PacketType.LogoutRequest) | 4550 | if (packet.Type == PacketType.LogoutRequest) |
4709 | { | 4551 | { |
@@ -4741,7 +4583,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4741 | /// <param name="simclient"></param> | 4583 | /// <param name="simclient"></param> |
4742 | /// <param name="packet"></param> | 4584 | /// <param name="packet"></param> |
4743 | /// <returns></returns> | 4585 | /// <returns></returns> |
4744 | protected bool AgentTextureCached(IClientAPI simclient, Packet packet) | 4586 | protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) |
4745 | { | 4587 | { |
4746 | //m_log.Debug("texture cached: " + packet.ToString()); | 4588 | //m_log.Debug("texture cached: " + packet.ToString()); |
4747 | AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; | 4589 | AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; |
@@ -4771,7 +4613,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4771 | return true; | 4613 | return true; |
4772 | } | 4614 | } |
4773 | 4615 | ||
4774 | protected bool MultipleObjUpdate(IClientAPI simClient, Packet packet) | 4616 | protected bool HandleMultipleObjUpdate(IClientAPI simClient, Packet packet) |
4775 | { | 4617 | { |
4776 | MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; | 4618 | MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; |
4777 | if (multipleupdate.AgentData.SessionID != SessionId) return false; | 4619 | if (multipleupdate.AgentData.SessionID != SessionId) return false; |
@@ -5050,11 +4892,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5050 | /// </summary> | 4892 | /// </summary> |
5051 | /// <param name="packet">Packet to send</param> | 4893 | /// <param name="packet">Packet to send</param> |
5052 | /// <param name="throttlePacketType">Throttling category for the packet</param> | 4894 | /// <param name="throttlePacketType">Throttling category for the packet</param> |
5053 | private void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType) | 4895 | protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType) |
5054 | { | 4896 | { |
4897 | #region BinaryStats | ||
4898 | LLUDPServer.LogPacketHeader(false, m_circuitCode, 0, packet.Type, (ushort)packet.Length); | ||
4899 | #endregion BinaryStats | ||
4900 | |||
5055 | m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, true); | 4901 | m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, true); |
5056 | } | 4902 | } |
5057 | 4903 | ||
4904 | /// <summary> | ||
4905 | /// This is the starting point for sending a simulator packet out to the client | ||
4906 | /// </summary> | ||
4907 | /// <param name="packet">Packet to send</param> | ||
4908 | /// <param name="throttlePacketType">Throttling category for the packet</param> | ||
4909 | /// <param name="doAutomaticSplitting">True to automatically split oversized | ||
4910 | /// packets (the default), or false to disable splitting if the calling code | ||
4911 | /// handles splitting manually</param> | ||
4912 | protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting) | ||
4913 | { | ||
4914 | m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); | ||
4915 | } | ||
4916 | |||
5058 | public bool AddMoney(int debit) | 4917 | public bool AddMoney(int debit) |
5059 | { | 4918 | { |
5060 | if (m_moneyBalance + debit >= 0) | 4919 | if (m_moneyBalance + debit >= 0) |
@@ -9854,7 +9713,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9854 | Utils.BytesToString(avatarInterestUpdate.PropertiesData.SkillsText), | 9713 | Utils.BytesToString(avatarInterestUpdate.PropertiesData.SkillsText), |
9855 | Utils.BytesToString(avatarInterestUpdate.PropertiesData.LanguagesText)); | 9714 | Utils.BytesToString(avatarInterestUpdate.PropertiesData.LanguagesText)); |
9856 | break; | 9715 | break; |
9857 | 9716 | ||
9717 | case PacketType.GrantUserRights: | ||
9718 | GrantUserRightsPacket GrantUserRights = | ||
9719 | (GrantUserRightsPacket)Pack; | ||
9720 | #region Packet Session and User Check | ||
9721 | if (m_checkPackets) | ||
9722 | { | ||
9723 | if (GrantUserRights.AgentData.SessionID != SessionId || | ||
9724 | GrantUserRights.AgentData.AgentID != AgentId) | ||
9725 | break; | ||
9726 | } | ||
9727 | #endregion | ||
9728 | GrantUserFriendRights GrantUserRightsHandler = OnGrantUserRights; | ||
9729 | if (GrantUserRightsHandler != null) | ||
9730 | GrantUserRightsHandler(this, | ||
9731 | GrantUserRights.AgentData.AgentID, | ||
9732 | GrantUserRights.Rights[0].AgentRelated, | ||
9733 | GrantUserRights.Rights[0].RelatedRights); | ||
9734 | break; | ||
9735 | |||
9858 | case PacketType.PlacesQuery: | 9736 | case PacketType.PlacesQuery: |
9859 | PlacesQueryPacket placesQueryPacket = | 9737 | PlacesQueryPacket placesQueryPacket = |
9860 | (PlacesQueryPacket)Pack; | 9738 | (PlacesQueryPacket)Pack; |
@@ -9944,7 +9822,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9944 | commandMessagePacket.CommandBlock.Command = (uint)command; | 9822 | commandMessagePacket.CommandBlock.Command = (uint)command; |
9945 | commandMessagePacket.CommandBlock.Time = time; | 9823 | commandMessagePacket.CommandBlock.Time = time; |
9946 | 9824 | ||
9947 | OutPacket(commandMessagePacket, ThrottleOutPacketType.Unknown); | 9825 | OutPacket(commandMessagePacket, ThrottleOutPacketType.Task); |
9948 | } | 9826 | } |
9949 | 9827 | ||
9950 | public void SendParcelMediaUpdate(string mediaUrl, UUID mediaTextureID, | 9828 | public void SendParcelMediaUpdate(string mediaUrl, UUID mediaTextureID, |
@@ -9962,7 +9840,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9962 | updatePacket.DataBlockExtended.MediaHeight = mediaHeight; | 9840 | updatePacket.DataBlockExtended.MediaHeight = mediaHeight; |
9963 | updatePacket.DataBlockExtended.MediaLoop = mediaLoop; | 9841 | updatePacket.DataBlockExtended.MediaLoop = mediaLoop; |
9964 | 9842 | ||
9965 | OutPacket(updatePacket, ThrottleOutPacketType.Unknown); | 9843 | OutPacket(updatePacket, ThrottleOutPacketType.Task); |
9966 | } | 9844 | } |
9967 | 9845 | ||
9968 | #endregion | 9846 | #endregion |
@@ -10236,7 +10114,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10236 | } | 10114 | } |
10237 | 10115 | ||
10238 | #region PriorityQueue | 10116 | #region PriorityQueue |
10239 | private class PriorityQueue<TPriority, TValue> | 10117 | public class PriorityQueue<TPriority, TValue> |
10240 | { | 10118 | { |
10241 | internal delegate bool UpdatePriorityHandler(ref TPriority priority, uint local_id); | 10119 | internal delegate bool UpdatePriorityHandler(ref TPriority priority, uint local_id); |
10242 | 10120 | ||
@@ -10264,7 +10142,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10264 | this.m_comparison = comparison; | 10142 | this.m_comparison = comparison; |
10265 | } | 10143 | } |
10266 | 10144 | ||
10267 | internal object SyncRoot { get { return this.m_syncRoot; } } | 10145 | public object SyncRoot { get { return this.m_syncRoot; } } |
10268 | internal int Count | 10146 | internal int Count |
10269 | { | 10147 | { |
10270 | get | 10148 | get |
@@ -10276,7 +10154,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10276 | } | 10154 | } |
10277 | } | 10155 | } |
10278 | 10156 | ||
10279 | internal bool Enqueue(TPriority priority, TValue value, uint local_id) | 10157 | public bool Enqueue(TPriority priority, TValue value, uint local_id) |
10280 | { | 10158 | { |
10281 | LookupItem item; | 10159 | LookupItem item; |
10282 | 10160 | ||
@@ -10396,5 +10274,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10396 | } | 10274 | } |
10397 | #endregion | 10275 | #endregion |
10398 | 10276 | ||
10277 | public static OSD BuildEvent(string eventName, OSD eventBody) | ||
10278 | { | ||
10279 | OSDMap osdEvent = new OSDMap(2); | ||
10280 | osdEvent.Add("message", new OSDString(eventName)); | ||
10281 | osdEvent.Add("body", eventBody); | ||
10282 | |||
10283 | return osdEvent; | ||
10284 | } | ||
10399 | } | 10285 | } |
10400 | } | 10286 | } |