diff options
author | UbitUmarov | 2018-01-25 08:02:45 +0000 |
---|---|---|
committer | UbitUmarov | 2018-01-25 08:02:45 +0000 |
commit | cdd3ef857c296a3aee88eea0386d166222684c04 (patch) | |
tree | de610b2876f25e4cab0009a12c4e05ed4f345946 /OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps | |
parent | add a low level LLSDxml encoder for cases where it makes no sense to use more... (diff) | |
download | opensim-SC-cdd3ef857c296a3aee88eea0386d166222684c04.zip opensim-SC-cdd3ef857c296a3aee88eea0386d166222684c04.tar.gz opensim-SC-cdd3ef857c296a3aee88eea0386d166222684c04.tar.bz2 opensim-SC-cdd3ef857c296a3aee88eea0386d166222684c04.tar.xz |
a few changes to encoder and a few more uses
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 130 |
1 files changed, 75 insertions, 55 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 85e5ec3..5c5d2b9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -1376,30 +1376,37 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1376 | IOSHttpResponse httpResponse) | 1376 | IOSHttpResponse httpResponse) |
1377 | { | 1377 | { |
1378 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | 1378 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); |
1379 | OSDMap resp = new OSDMap(); | ||
1380 | OSDArray object_ids = (OSDArray)req["object_ids"]; | 1379 | OSDArray object_ids = (OSDArray)req["object_ids"]; |
1381 | 1380 | ||
1382 | for (int i = 0 ; i < object_ids.Count ; i++) | 1381 | StringBuilder lsl = new StringBuilder(256); |
1382 | LLSDxmlEncode.AddStart(lsl); | ||
1383 | if(object_ids.Count == 0) | ||
1384 | LLSDxmlEncode.AddEmpyMap(lsl); | ||
1385 | else | ||
1383 | { | 1386 | { |
1384 | UUID uuid = object_ids[i].AsUUID(); | 1387 | LLSDxmlEncode.AddMap(lsl); |
1385 | 1388 | for (int i = 0 ; i < object_ids.Count ; i++) | |
1386 | SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); | ||
1387 | if (obj != null) | ||
1388 | { | 1389 | { |
1389 | OSDMap object_data = new OSDMap(); | 1390 | UUID uuid = object_ids[i].AsUUID(); |
1391 | |||
1392 | SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); | ||
1393 | if (obj != null) | ||
1394 | { | ||
1395 | LLSDxmlEncode.AddMap(uuid.ToString(),lsl); | ||
1390 | 1396 | ||
1391 | object_data["PhysicsShapeType"] = obj.PhysicsShapeType; | 1397 | LLSDxmlEncode.AddElem("PhysicsShapeType", obj.PhysicsShapeType, lsl); |
1392 | object_data["Density"] = obj.Density; | 1398 | LLSDxmlEncode.AddElem("Density", obj.Density, lsl); |
1393 | object_data["Friction"] = obj.Friction; | 1399 | LLSDxmlEncode.AddElem("Friction", obj.Friction, lsl); |
1394 | object_data["Restitution"] = obj.Restitution; | 1400 | LLSDxmlEncode.AddElem("Restitution", obj.Restitution, lsl); |
1395 | object_data["GravityMultiplier"] = obj.GravityModifier; | 1401 | LLSDxmlEncode.AddElem("GravityMultiplier", obj.GravityModifier, lsl); |
1396 | 1402 | ||
1397 | resp[uuid.ToString()] = object_data; | 1403 | LLSDxmlEncode.AddEndMap(lsl); |
1404 | } | ||
1405 | LLSDxmlEncode.AddEndMap(lsl); | ||
1398 | } | 1406 | } |
1399 | } | 1407 | } |
1400 | 1408 | LLSDxmlEncode.AddEnd(lsl); | |
1401 | string response = OSDParser.SerializeLLSDXmlString(resp); | 1409 | return lsl.ToString(); |
1402 | return response; | ||
1403 | } | 1410 | } |
1404 | 1411 | ||
1405 | public string GetObjectCost(string request, string path, | 1412 | public string GetObjectCost(string request, string path, |
@@ -1407,47 +1414,60 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1407 | IOSHttpResponse httpResponse) | 1414 | IOSHttpResponse httpResponse) |
1408 | { | 1415 | { |
1409 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | 1416 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); |
1410 | OSDMap resp = new OSDMap(); | ||
1411 | |||
1412 | OSDArray object_ids = (OSDArray)req["object_ids"]; | 1417 | OSDArray object_ids = (OSDArray)req["object_ids"]; |
1413 | 1418 | ||
1414 | for (int i = 0; i < object_ids.Count; i++) | 1419 | StringBuilder lsl = new StringBuilder(512); |
1420 | LLSDxmlEncode.AddStart(lsl); | ||
1421 | if(object_ids.Count == 0) | ||
1422 | LLSDxmlEncode.AddEmpyMap(lsl); | ||
1423 | else | ||
1415 | { | 1424 | { |
1416 | UUID uuid = object_ids[i].AsUUID(); | 1425 | bool haveone = false; |
1426 | LLSDxmlEncode.AddMap(lsl); | ||
1427 | for (int i = 0; i < object_ids.Count; i++) | ||
1428 | { | ||
1429 | UUID uuid = object_ids[i].AsUUID(); | ||
1430 | |||
1431 | SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); | ||
1432 | SceneObjectGroup grp = null; | ||
1433 | if (part != null) | ||
1434 | grp = part.ParentGroup; | ||
1435 | if (grp != null) | ||
1436 | { | ||
1437 | haveone = true; | ||
1438 | float linksetCost; | ||
1439 | float linksetPhysCost; | ||
1440 | float partCost; | ||
1441 | float partPhysCost; | ||
1417 | 1442 | ||
1418 | SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); | 1443 | grp.GetResourcesCosts(part,out linksetCost,out linksetPhysCost,out partCost,out partPhysCost); |
1419 | SceneObjectGroup grp = null; | 1444 | |
1420 | if (part != null) | 1445 | LLSDxmlEncode.AddMap(uuid.ToString(), lsl); |
1421 | grp = part.ParentGroup; | 1446 | |
1422 | if (grp != null) | 1447 | LLSDxmlEncode.AddElem("linked_set_resource_cost", linksetCost, lsl); |
1448 | LLSDxmlEncode.AddElem("resource_cost", partCost, lsl); | ||
1449 | LLSDxmlEncode.AddElem("physics_cost", partPhysCost, lsl); | ||
1450 | LLSDxmlEncode.AddElem("linked_set_physics_cost", linksetPhysCost, lsl); | ||
1451 | LLSDxmlEncode.AddElem("resource_limiting_type", "legacy", lsl); | ||
1452 | |||
1453 | LLSDxmlEncode.AddEndMap(lsl); | ||
1454 | } | ||
1455 | } | ||
1456 | if(!haveone) | ||
1423 | { | 1457 | { |
1424 | float linksetCost; | 1458 | LLSDxmlEncode.AddMap(UUID.Zero.ToString(), lsl); |
1425 | float linksetPhysCost; | 1459 | LLSDxmlEncode.AddElem("linked_set_resource_cost", 0, lsl); |
1426 | float partCost; | 1460 | LLSDxmlEncode.AddElem("resource_cost", 0, lsl); |
1427 | float partPhysCost; | 1461 | LLSDxmlEncode.AddElem("physics_cost", 0, lsl); |
1428 | 1462 | LLSDxmlEncode.AddElem("linked_set_physics_cost", 0, lsl); | |
1429 | grp.GetResourcesCosts(part,out linksetCost,out linksetPhysCost,out partCost,out partPhysCost); | 1463 | LLSDxmlEncode.AddElem("resource_limiting_type", "legacy", lsl); |
1430 | 1464 | LLSDxmlEncode.AddEndMap(lsl); | |
1431 | OSDMap object_data = new OSDMap(); | ||
1432 | object_data["linked_set_resource_cost"] = linksetCost; | ||
1433 | object_data["resource_cost"] = partCost; | ||
1434 | object_data["physics_cost"] = partPhysCost; | ||
1435 | object_data["linked_set_physics_cost"] = linksetPhysCost; | ||
1436 | object_data["resource_limiting_type"] = "legacy"; | ||
1437 | resp[uuid.ToString()] = object_data; | ||
1438 | } | 1465 | } |
1466 | LLSDxmlEncode.AddEndMap(lsl); | ||
1439 | } | 1467 | } |
1440 | if(resp.Count == 0) | 1468 | |
1441 | { | 1469 | LLSDxmlEncode.AddEnd(lsl); |
1442 | OSDMap object_data = new OSDMap(); | 1470 | return lsl.ToString(); |
1443 | object_data["linked_set_resource_cost"] = 0; | ||
1444 | object_data["resource_cost"] = 0; | ||
1445 | object_data["physics_cost"] = 0; | ||
1446 | object_data["linked_set_physics_cost"] = 0; | ||
1447 | resp[UUID.Zero.ToString()] = object_data; | ||
1448 | } | ||
1449 | string response = OSDParser.SerializeLLSDXmlString(resp); | ||
1450 | return response; | ||
1451 | } | 1471 | } |
1452 | 1472 | ||
1453 | public string ResourceCostSelected(string request, string path, | 1473 | public string ResourceCostSelected(string request, string path, |
@@ -1825,13 +1845,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1825 | Dictionary<UUID,string> names = m_UserManager.GetUsersNames(ids); | 1845 | Dictionary<UUID,string> names = m_UserManager.GetUsersNames(ids); |
1826 | 1846 | ||
1827 | StringBuilder lsl = new StringBuilder(names.Count * 256 + 256); | 1847 | StringBuilder lsl = new StringBuilder(names.Count * 256 + 256); |
1828 | LLSDxmlEncode.AddStartHeader(lsl); | 1848 | LLSDxmlEncode.AddStart(lsl); |
1829 | LLSDxmlEncode.AddStartMap(lsl); | 1849 | LLSDxmlEncode.AddMap(lsl); |
1830 | if(names.Count == 0) | 1850 | if(names.Count == 0) |
1831 | LLSDxmlEncode.AddEmpyArray("agents", lsl); | 1851 | LLSDxmlEncode.AddEmpyArray("agents", lsl); |
1832 | else | 1852 | else |
1833 | { | 1853 | { |
1834 | LLSDxmlEncode.AddStartArray("agents", lsl); | 1854 | LLSDxmlEncode.AddArray("agents", lsl); |
1835 | 1855 | ||
1836 | foreach (KeyValuePair<UUID,string> kvp in names) | 1856 | foreach (KeyValuePair<UUID,string> kvp in names) |
1837 | { | 1857 | { |
@@ -1846,7 +1866,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1846 | if(parts[0] == "Unknown") | 1866 | if(parts[0] == "Unknown") |
1847 | continue; | 1867 | continue; |
1848 | 1868 | ||
1849 | LLSDxmlEncode.AddStartMap(lsl); | 1869 | LLSDxmlEncode.AddMap(lsl); |
1850 | LLSDxmlEncode.AddElem("display_name_next_update", DateTime.UtcNow.AddDays(8), lsl); | 1870 | LLSDxmlEncode.AddElem("display_name_next_update", DateTime.UtcNow.AddDays(8), lsl); |
1851 | LLSDxmlEncode.AddElem("display_name_expires", DateTime.UtcNow.AddMonths(1), lsl); | 1871 | LLSDxmlEncode.AddElem("display_name_expires", DateTime.UtcNow.AddMonths(1), lsl); |
1852 | LLSDxmlEncode.AddElem("display_name", kvp.Value, lsl); | 1872 | LLSDxmlEncode.AddElem("display_name", kvp.Value, lsl); |
@@ -1861,7 +1881,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1861 | } | 1881 | } |
1862 | 1882 | ||
1863 | LLSDxmlEncode.AddEndMap(lsl); | 1883 | LLSDxmlEncode.AddEndMap(lsl); |
1864 | LLSDxmlEncode.AddEndHeader(lsl); | 1884 | LLSDxmlEncode.AddEnd(lsl); |
1865 | 1885 | ||
1866 | // Full content request | 1886 | // Full content request |
1867 | httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK; | 1887 | httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK; |