diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 217 |
1 files changed, 117 insertions, 100 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 6f5775a..b8d423f 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -503,7 +503,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
503 | errorResponse.state = "error"; | 503 | errorResponse.state = "error"; |
504 | errorResponse.error = resperror; | 504 | errorResponse.error = resperror; |
505 | return errorResponse; | 505 | return errorResponse; |
506 | break; | ||
507 | case FileAgentInventoryState.waitUpload: | 506 | case FileAgentInventoryState.waitUpload: |
508 | // todo stop current uploader server | 507 | // todo stop current uploader server |
509 | break; | 508 | break; |
@@ -1377,30 +1376,37 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1377 | IOSHttpResponse httpResponse) | 1376 | IOSHttpResponse httpResponse) |
1378 | { | 1377 | { |
1379 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | 1378 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); |
1380 | OSDMap resp = new OSDMap(); | ||
1381 | OSDArray object_ids = (OSDArray)req["object_ids"]; | 1379 | OSDArray object_ids = (OSDArray)req["object_ids"]; |
1382 | 1380 | ||
1383 | for (int i = 0 ; i < object_ids.Count ; i++) | 1381 | StringBuilder lsl = LLSDxmlEncode.Start(); |
1382 | |||
1383 | if(object_ids.Count == 0) | ||
1384 | LLSDxmlEncode.AddEmptyMap(lsl); | ||
1385 | else | ||
1384 | { | 1386 | { |
1385 | UUID uuid = object_ids[i].AsUUID(); | 1387 | LLSDxmlEncode.AddMap(lsl); |
1386 | 1388 | for (int i = 0 ; i < object_ids.Count ; i++) | |
1387 | SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); | ||
1388 | if (obj != null) | ||
1389 | { | 1389 | { |
1390 | 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); | ||
1391 | 1396 | ||
1392 | object_data["PhysicsShapeType"] = obj.PhysicsShapeType; | 1397 | LLSDxmlEncode.AddElem("PhysicsShapeType", obj.PhysicsShapeType, lsl); |
1393 | object_data["Density"] = obj.Density; | 1398 | LLSDxmlEncode.AddElem("Density", obj.Density, lsl); |
1394 | object_data["Friction"] = obj.Friction; | 1399 | LLSDxmlEncode.AddElem("Friction", obj.Friction, lsl); |
1395 | object_data["Restitution"] = obj.Restitution; | 1400 | LLSDxmlEncode.AddElem("Restitution", obj.Restitution, lsl); |
1396 | object_data["GravityMultiplier"] = obj.GravityModifier; | 1401 | LLSDxmlEncode.AddElem("GravityMultiplier", obj.GravityModifier, lsl); |
1397 | 1402 | ||
1398 | resp[uuid.ToString()] = object_data; | 1403 | LLSDxmlEncode.AddEndMap(lsl); |
1404 | } | ||
1405 | LLSDxmlEncode.AddEndMap(lsl); | ||
1399 | } | 1406 | } |
1400 | } | 1407 | } |
1401 | 1408 | ||
1402 | string response = OSDParser.SerializeLLSDXmlString(resp); | 1409 | return LLSDxmlEncode.End(lsl); |
1403 | return response; | ||
1404 | } | 1410 | } |
1405 | 1411 | ||
1406 | public string GetObjectCost(string request, string path, | 1412 | public string GetObjectCost(string request, string path, |
@@ -1408,47 +1414,59 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1408 | IOSHttpResponse httpResponse) | 1414 | IOSHttpResponse httpResponse) |
1409 | { | 1415 | { |
1410 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | 1416 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); |
1411 | OSDMap resp = new OSDMap(); | ||
1412 | |||
1413 | OSDArray object_ids = (OSDArray)req["object_ids"]; | 1417 | OSDArray object_ids = (OSDArray)req["object_ids"]; |
1414 | 1418 | ||
1415 | for (int i = 0; i < object_ids.Count; i++) | 1419 | StringBuilder lsl = LLSDxmlEncode.Start(512); |
1420 | |||
1421 | if(object_ids.Count == 0) | ||
1422 | LLSDxmlEncode.AddEmptyMap(lsl); | ||
1423 | else | ||
1416 | { | 1424 | { |
1417 | 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(); | ||
1418 | 1430 | ||
1419 | SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); | 1431 | SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid); |
1420 | SceneObjectGroup grp = null; | 1432 | SceneObjectGroup grp = null; |
1421 | if (part != null) | 1433 | if (part != null) |
1422 | grp = part.ParentGroup; | 1434 | grp = part.ParentGroup; |
1423 | if (grp != null) | 1435 | if (grp != null) |
1436 | { | ||
1437 | haveone = true; | ||
1438 | float linksetCost; | ||
1439 | float linksetPhysCost; | ||
1440 | float partCost; | ||
1441 | float partPhysCost; | ||
1442 | |||
1443 | grp.GetResourcesCosts(part,out linksetCost,out linksetPhysCost,out partCost,out partPhysCost); | ||
1444 | |||
1445 | LLSDxmlEncode.AddMap(uuid.ToString(), lsl); | ||
1446 | |||
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) | ||
1424 | { | 1457 | { |
1425 | float linksetCost; | 1458 | LLSDxmlEncode.AddMap(UUID.Zero.ToString(), lsl); |
1426 | float linksetPhysCost; | 1459 | LLSDxmlEncode.AddElem("linked_set_resource_cost", 0, lsl); |
1427 | float partCost; | 1460 | LLSDxmlEncode.AddElem("resource_cost", 0, lsl); |
1428 | float partPhysCost; | 1461 | LLSDxmlEncode.AddElem("physics_cost", 0, lsl); |
1429 | 1462 | LLSDxmlEncode.AddElem("linked_set_physics_cost", 0, lsl); | |
1430 | grp.GetResourcesCosts(part,out linksetCost,out linksetPhysCost,out partCost,out partPhysCost); | 1463 | LLSDxmlEncode.AddElem("resource_limiting_type", "legacy", lsl); |
1431 | 1464 | LLSDxmlEncode.AddEndMap(lsl); | |
1432 | OSDMap object_data = new OSDMap(); | ||
1433 | object_data["linked_set_resource_cost"] = linksetCost; | ||
1434 | object_data["resource_cost"] = partCost; | ||
1435 | object_data["physics_cost"] = partPhysCost; | ||
1436 | object_data["linked_set_physics_cost"] = linksetPhysCost; | ||
1437 | object_data["resource_limiting_type"] = "legacy"; | ||
1438 | resp[uuid.ToString()] = object_data; | ||
1439 | } | 1465 | } |
1466 | LLSDxmlEncode.AddEndMap(lsl); | ||
1440 | } | 1467 | } |
1441 | if(resp.Count == 0) | 1468 | |
1442 | { | 1469 | return LLSDxmlEncode.End(lsl); |
1443 | OSDMap object_data = new OSDMap(); | ||
1444 | object_data["linked_set_resource_cost"] = 0; | ||
1445 | object_data["resource_cost"] = 0; | ||
1446 | object_data["physics_cost"] = 0; | ||
1447 | object_data["linked_set_physics_cost"] = 0; | ||
1448 | resp[UUID.Zero.ToString()] = object_data; | ||
1449 | } | ||
1450 | string response = OSDParser.SerializeLLSDXmlString(resp); | ||
1451 | return response; | ||
1452 | } | 1470 | } |
1453 | 1471 | ||
1454 | public string ResourceCostSelected(string request, string path, | 1472 | public string ResourceCostSelected(string request, string path, |
@@ -1456,8 +1474,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1456 | IOSHttpResponse httpResponse) | 1474 | IOSHttpResponse httpResponse) |
1457 | { | 1475 | { |
1458 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | 1476 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); |
1459 | OSDMap resp = new OSDMap(); | ||
1460 | |||
1461 | 1477 | ||
1462 | float phys=0; | 1478 | float phys=0; |
1463 | float stream=0; | 1479 | float stream=0; |
@@ -1508,16 +1524,21 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1508 | } | 1524 | } |
1509 | } | 1525 | } |
1510 | 1526 | ||
1511 | OSDMap object_data = new OSDMap(); | 1527 | StringBuilder lsl = LLSDxmlEncode.Start(); |
1528 | LLSDxmlEncode.AddMap(lsl); | ||
1529 | |||
1530 | LLSDxmlEncode.AddMap("selected", lsl); | ||
1512 | 1531 | ||
1513 | object_data["physics"] = phys; | 1532 | LLSDxmlEncode.AddElem("physics", phys, lsl); |
1514 | object_data["streaming"] = stream; | 1533 | LLSDxmlEncode.AddElem("streaming", stream, lsl); |
1515 | object_data["simulation"] = simul; | 1534 | LLSDxmlEncode.AddElem("simulation", simul, lsl); |
1516 | 1535 | ||
1517 | resp["selected"] = object_data; | 1536 | LLSDxmlEncode.AddEndMap(lsl); |
1537 | LLSDxmlEncode.AddEndMap(lsl); | ||
1538 | |||
1518 | // resp["transaction_id"] = "undef"; | 1539 | // resp["transaction_id"] = "undef"; |
1519 | string response = OSDParser.SerializeLLSDXmlString(resp); | 1540 | return LLSDxmlEncode.End(lsl); |
1520 | return response; | 1541 | |
1521 | } | 1542 | } |
1522 | 1543 | ||
1523 | public string UpdateAgentInformation(string request, string path, | 1544 | public string UpdateAgentInformation(string request, string path, |
@@ -1820,57 +1841,53 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1820 | return ""; | 1841 | return ""; |
1821 | } | 1842 | } |
1822 | 1843 | ||
1844 | // Full content request | ||
1845 | httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK; | ||
1846 | //httpResponse.ContentLength = ??; | ||
1847 | httpResponse.ContentType = "application/llsd+xml"; | ||
1848 | |||
1823 | NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); | 1849 | NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); |
1824 | string[] ids = query.GetValues("ids"); | 1850 | string[] ids = query.GetValues("ids"); |
1825 | 1851 | ||
1826 | Dictionary<UUID,string> names = m_UserManager.GetUsersNames(ids); | 1852 | Dictionary<UUID,string> names = m_UserManager.GetUsersNames(ids); |
1827 | 1853 | ||
1828 | OSDMap osdReply = new OSDMap(); | 1854 | StringBuilder lsl = LLSDxmlEncode.Start(names.Count * 256 + 256); |
1829 | OSDArray agents = new OSDArray(); | 1855 | LLSDxmlEncode.AddMap(lsl); |
1830 | 1856 | if(names.Count == 0) | |
1831 | osdReply["agents"] = agents; | 1857 | LLSDxmlEncode.AddEmptyArray("agents", lsl); |
1832 | foreach (KeyValuePair<UUID,string> kvp in names) | 1858 | else |
1833 | { | 1859 | { |
1834 | if (string.IsNullOrEmpty(kvp.Value)) | 1860 | LLSDxmlEncode.AddArray("agents", lsl); |
1835 | continue; | 1861 | |
1836 | if(kvp.Key == UUID.Zero) | 1862 | foreach (KeyValuePair<UUID,string> kvp in names) |
1837 | continue; | 1863 | { |
1864 | if (string.IsNullOrEmpty(kvp.Value)) | ||
1865 | continue; | ||
1866 | if(kvp.Key == UUID.Zero) | ||
1867 | continue; | ||
1838 | 1868 | ||
1839 | string[] parts = kvp.Value.Split(new char[] {' '}); | 1869 | string[] parts = kvp.Value.Split(new char[] {' '}); |
1840 | OSDMap osdname = new OSDMap(); | ||
1841 | 1870 | ||
1842 | // dont tell about unknown users, we can't send them back on Bad either | 1871 | // dont tell about unknown users, we can't send them back on Bad either |
1843 | if(parts[0] == "Unknown") | 1872 | if(parts[0] == "Unknown") |
1844 | continue; | 1873 | continue; |
1845 | /* | 1874 | |
1846 | if(parts[0] == "Unknown") | 1875 | LLSDxmlEncode.AddMap(lsl); |
1847 | { | 1876 | LLSDxmlEncode.AddElem("display_name_next_update", DateTime.UtcNow.AddDays(8), lsl); |
1848 | osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1)); | 1877 | LLSDxmlEncode.AddElem("display_name_expires", DateTime.UtcNow.AddMonths(1), lsl); |
1849 | osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddHours(2)); | 1878 | LLSDxmlEncode.AddElem("display_name", kvp.Value, lsl); |
1879 | LLSDxmlEncode.AddElem("legacy_first_name", parts[0], lsl); | ||
1880 | LLSDxmlEncode.AddElem("legacy_last_name", parts[1], lsl); | ||
1881 | LLSDxmlEncode.AddElem("username", kvp.Value, lsl); | ||
1882 | LLSDxmlEncode.AddElem("id", kvp.Key, lsl); | ||
1883 | LLSDxmlEncode.AddElem("is_display_name_default", true, lsl); | ||
1884 | LLSDxmlEncode.AddEndMap(lsl); | ||
1850 | } | 1885 | } |
1851 | else | 1886 | LLSDxmlEncode.AddEndArray(lsl); |
1852 | */ | ||
1853 | { | ||
1854 | osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8)); | ||
1855 | osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1)); | ||
1856 | } | ||
1857 | osdname["display_name"] = OSD.FromString(kvp.Value); | ||
1858 | osdname["legacy_first_name"] = parts[0]; | ||
1859 | osdname["legacy_last_name"] = parts[1]; | ||
1860 | osdname["username"] = OSD.FromString(kvp.Value); | ||
1861 | osdname["id"] = OSD.FromUUID(kvp.Key); | ||
1862 | osdname["is_display_name_default"] = OSD.FromBoolean(true); | ||
1863 | |||
1864 | agents.Add(osdname); | ||
1865 | } | 1887 | } |
1866 | 1888 | ||
1867 | // Full content request | 1889 | LLSDxmlEncode.AddEndMap(lsl); |
1868 | httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK; | 1890 | return LLSDxmlEncode.End(lsl);; |
1869 | //httpResponse.ContentLength = ??; | ||
1870 | httpResponse.ContentType = "application/llsd+xml"; | ||
1871 | |||
1872 | string reply = OSDParser.SerializeLLSDXmlString(osdReply); | ||
1873 | return reply; | ||
1874 | } | 1891 | } |
1875 | } | 1892 | } |
1876 | 1893 | ||