diff options
author | UbitUmarov | 2016-08-17 06:00:42 +0100 |
---|---|---|
committer | UbitUmarov | 2016-08-17 06:00:42 +0100 |
commit | 04ea34f379a1839e618ef1a7ba05a1be19f8e43c (patch) | |
tree | 9b0e7fad4f2b50b5dcfdcb1c261dacbeec7d7ffc /OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs | |
parent | drasticly reduce HG inventory caches Expire times, Remove them all onClientC... (diff) | |
download | opensim-SC-04ea34f379a1839e618ef1a7ba05a1be19f8e43c.zip opensim-SC-04ea34f379a1839e618ef1a7ba05a1be19f8e43c.tar.gz opensim-SC-04ea34f379a1839e618ef1a7ba05a1be19f8e43c.tar.bz2 opensim-SC-04ea34f379a1839e618ef1a7ba05a1be19f8e43c.tar.xz |
add GetUsersNames(string[] ids) to UserManagement. Make GetDisplayNames cap use it so several IDs are handle on a single call. Since there is no grid side suport, no much gain still
Diffstat (limited to 'OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs')
-rw-r--r-- | OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs b/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs index 155196c..3e01bbb 100644 --- a/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs | |||
@@ -29,8 +29,6 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Collections.Specialized; | 31 | using System.Collections.Specialized; |
32 | using System.Drawing; | ||
33 | using System.Drawing.Imaging; | ||
34 | using System.Reflection; | 32 | using System.Reflection; |
35 | using System.IO; | 33 | using System.IO; |
36 | using System.Web; | 34 | using System.Web; |
@@ -38,12 +36,7 @@ using log4net; | |||
38 | using Nini.Config; | 36 | using Nini.Config; |
39 | using OpenMetaverse; | 37 | using OpenMetaverse; |
40 | using OpenMetaverse.StructuredData; | 38 | using OpenMetaverse.StructuredData; |
41 | using OpenMetaverse.Imaging; | ||
42 | using OpenSim.Framework; | ||
43 | using OpenSim.Framework.Capabilities; | ||
44 | using OpenSim.Framework.Servers; | ||
45 | using OpenSim.Framework.Servers.HttpServer; | 39 | using OpenSim.Framework.Servers.HttpServer; |
46 | using OpenSim.Region.Framework.Interfaces; | ||
47 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
48 | using Caps = OpenSim.Framework.Capabilities.Caps; | 41 | using Caps = OpenSim.Framework.Capabilities.Caps; |
49 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; | 42 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; |
@@ -70,7 +63,6 @@ namespace OpenSim.Capabilities.Handlers | |||
70 | NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); | 63 | NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); |
71 | string[] ids = query.GetValues("ids"); | 64 | string[] ids = query.GetValues("ids"); |
72 | 65 | ||
73 | |||
74 | if (m_UserManagement == null) | 66 | if (m_UserManagement == null) |
75 | { | 67 | { |
76 | m_log.Error("[GET_DISPLAY_NAMES]: Cannot fetch display names without a user management component"); | 68 | m_log.Error("[GET_DISPLAY_NAMES]: Cannot fetch display names without a user management component"); |
@@ -78,35 +70,39 @@ namespace OpenSim.Capabilities.Handlers | |||
78 | return new byte[0]; | 70 | return new byte[0]; |
79 | } | 71 | } |
80 | 72 | ||
73 | Dictionary<UUID,string> names = m_UserManagement.GetUsersNames(ids); | ||
74 | |||
81 | OSDMap osdReply = new OSDMap(); | 75 | OSDMap osdReply = new OSDMap(); |
82 | OSDArray agents = new OSDArray(); | 76 | OSDArray agents = new OSDArray(); |
83 | 77 | ||
84 | osdReply["agents"] = agents; | 78 | osdReply["agents"] = agents; |
85 | foreach (string id in ids) | 79 | foreach (KeyValuePair<UUID,string> kvp in names) |
86 | { | 80 | { |
87 | UUID uuid = UUID.Zero; | 81 | if (string.IsNullOrEmpty(kvp.Value)) |
88 | if (UUID.TryParse(id, out uuid)) | 82 | continue; |
89 | { | 83 | if(kvp.Key == UUID.Zero) |
90 | string name = m_UserManagement.GetUserName(uuid); | 84 | continue; |
91 | if (!string.IsNullOrEmpty(name)) | ||
92 | { | ||
93 | string[] parts = name.Split(new char[] {' '}); | ||
94 | OSDMap osdname = new OSDMap(); | ||
95 | // a date that is valid | ||
96 | // osdname["display_name_next_update"] = OSD.FromDate(new DateTime(1970,1,1)); | ||
97 | // but send one that blocks edition, since we actually don't suport this | ||
98 | osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8)); | ||
99 | osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1)); | ||
100 | osdname["display_name"] = OSD.FromString(name); | ||
101 | osdname["legacy_first_name"] = parts[0]; | ||
102 | osdname["legacy_last_name"] = parts[1]; | ||
103 | osdname["username"] = OSD.FromString(name); | ||
104 | osdname["id"] = OSD.FromUUID(uuid); | ||
105 | osdname["is_display_name_default"] = OSD.FromBoolean(true); | ||
106 | 85 | ||
107 | agents.Add(osdname); | 86 | string[] parts = kvp.Value.Split(new char[] {' '}); |
108 | } | 87 | OSDMap osdname = new OSDMap(); |
88 | if(parts[0] == "Unknown") | ||
89 | { | ||
90 | osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1)); | ||
91 | osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddHours(2)); | ||
109 | } | 92 | } |
93 | else | ||
94 | { | ||
95 | osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8)); | ||
96 | osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1)); | ||
97 | } | ||
98 | osdname["display_name"] = OSD.FromString(kvp.Value); | ||
99 | osdname["legacy_first_name"] = parts[0]; | ||
100 | osdname["legacy_last_name"] = parts[1]; | ||
101 | osdname["username"] = OSD.FromString(kvp.Value); | ||
102 | osdname["id"] = OSD.FromUUID(kvp.Key); | ||
103 | osdname["is_display_name_default"] = OSD.FromBoolean(true); | ||
104 | |||
105 | agents.Add(osdname); | ||
110 | } | 106 | } |
111 | 107 | ||
112 | // Full content request | 108 | // Full content request |
@@ -116,8 +112,6 @@ namespace OpenSim.Capabilities.Handlers | |||
116 | 112 | ||
117 | string reply = OSDParser.SerializeLLSDXmlString(osdReply); | 113 | string reply = OSDParser.SerializeLLSDXmlString(osdReply); |
118 | return System.Text.Encoding.UTF8.GetBytes(reply); | 114 | return System.Text.Encoding.UTF8.GetBytes(reply); |
119 | |||
120 | } | 115 | } |
121 | |||
122 | } | 116 | } |
123 | } | 117 | } |