diff options
author | UbitUmarov | 2018-01-25 06:50:49 +0000 |
---|---|---|
committer | UbitUmarov | 2018-01-25 06:50:49 +0000 |
commit | 266eabcad493863de2ddb8430b7d4509e584dfb9 (patch) | |
tree | 7eddd1568f3757dc95baf1b7348fb918b8758858 /OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps | |
parent | change DataSnapeShoot init again. May still fail on multi regions instances (diff) | |
download | opensim-SC-266eabcad493863de2ddb8430b7d4509e584dfb9.zip opensim-SC-266eabcad493863de2ddb8430b7d4509e584dfb9.tar.gz opensim-SC-266eabcad493863de2ddb8430b7d4509e584dfb9.tar.bz2 opensim-SC-266eabcad493863de2ddb8430b7d4509e584dfb9.tar.xz |
add a low level LLSDxml encoder for cases where it makes no sense to use more heavy things like OSD, and use it on displaynames
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index daa40c4..85e5ec3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -1824,52 +1824,51 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1824 | 1824 | ||
1825 | Dictionary<UUID,string> names = m_UserManager.GetUsersNames(ids); | 1825 | Dictionary<UUID,string> names = m_UserManager.GetUsersNames(ids); |
1826 | 1826 | ||
1827 | OSDMap osdReply = new OSDMap(); | 1827 | StringBuilder lsl = new StringBuilder(names.Count * 256 + 256); |
1828 | OSDArray agents = new OSDArray(); | 1828 | LLSDxmlEncode.AddStartHeader(lsl); |
1829 | 1829 | LLSDxmlEncode.AddStartMap(lsl); | |
1830 | osdReply["agents"] = agents; | 1830 | if(names.Count == 0) |
1831 | foreach (KeyValuePair<UUID,string> kvp in names) | 1831 | LLSDxmlEncode.AddEmpyArray("agents", lsl); |
1832 | else | ||
1832 | { | 1833 | { |
1833 | if (string.IsNullOrEmpty(kvp.Value)) | 1834 | LLSDxmlEncode.AddStartArray("agents", lsl); |
1834 | continue; | 1835 | |
1835 | if(kvp.Key == UUID.Zero) | 1836 | foreach (KeyValuePair<UUID,string> kvp in names) |
1836 | continue; | 1837 | { |
1838 | if (string.IsNullOrEmpty(kvp.Value)) | ||
1839 | continue; | ||
1840 | if(kvp.Key == UUID.Zero) | ||
1841 | continue; | ||
1837 | 1842 | ||
1838 | string[] parts = kvp.Value.Split(new char[] {' '}); | 1843 | string[] parts = kvp.Value.Split(new char[] {' '}); |
1839 | OSDMap osdname = new OSDMap(); | ||
1840 | 1844 | ||
1841 | // dont tell about unknown users, we can't send them back on Bad either | 1845 | // dont tell about unknown users, we can't send them back on Bad either |
1842 | if(parts[0] == "Unknown") | 1846 | if(parts[0] == "Unknown") |
1843 | continue; | 1847 | continue; |
1844 | /* | 1848 | |
1845 | if(parts[0] == "Unknown") | 1849 | LLSDxmlEncode.AddStartMap(lsl); |
1846 | { | 1850 | LLSDxmlEncode.AddElem("display_name_next_update", DateTime.UtcNow.AddDays(8), lsl); |
1847 | osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1)); | 1851 | LLSDxmlEncode.AddElem("display_name_expires", DateTime.UtcNow.AddMonths(1), lsl); |
1848 | osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddHours(2)); | 1852 | LLSDxmlEncode.AddElem("display_name", kvp.Value, lsl); |
1849 | } | 1853 | LLSDxmlEncode.AddElem("legacy_first_name", parts[0], lsl); |
1850 | else | 1854 | LLSDxmlEncode.AddElem("legacy_last_name", parts[1], lsl); |
1851 | */ | 1855 | LLSDxmlEncode.AddElem("username", kvp.Value, lsl); |
1852 | { | 1856 | LLSDxmlEncode.AddElem("id", kvp.Key, lsl); |
1853 | osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8)); | 1857 | LLSDxmlEncode.AddElem("is_display_name_default", true, lsl); |
1854 | osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1)); | 1858 | LLSDxmlEncode.AddEndMap(lsl); |
1855 | } | 1859 | } |
1856 | osdname["display_name"] = OSD.FromString(kvp.Value); | 1860 | LLSDxmlEncode.AddEndArray(lsl); |
1857 | osdname["legacy_first_name"] = parts[0]; | ||
1858 | osdname["legacy_last_name"] = parts[1]; | ||
1859 | osdname["username"] = OSD.FromString(kvp.Value); | ||
1860 | osdname["id"] = OSD.FromUUID(kvp.Key); | ||
1861 | osdname["is_display_name_default"] = OSD.FromBoolean(true); | ||
1862 | |||
1863 | agents.Add(osdname); | ||
1864 | } | 1861 | } |
1862 | |||
1863 | LLSDxmlEncode.AddEndMap(lsl); | ||
1864 | LLSDxmlEncode.AddEndHeader(lsl); | ||
1865 | 1865 | ||
1866 | // Full content request | 1866 | // Full content request |
1867 | httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK; | 1867 | httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK; |
1868 | //httpResponse.ContentLength = ??; | 1868 | //httpResponse.ContentLength = ??; |
1869 | httpResponse.ContentType = "application/llsd+xml"; | 1869 | httpResponse.ContentType = "application/llsd+xml"; |
1870 | 1870 | ||
1871 | string reply = OSDParser.SerializeLLSDXmlString(osdReply); | 1871 | return lsl.ToString(); |
1872 | return reply; | ||
1873 | } | 1872 | } |
1874 | } | 1873 | } |
1875 | 1874 | ||