29 using System.Collections.Generic;
30 using System.Collections.Specialized;
32 using System.Reflection;
37 using OpenSim.Framework;
38 using OpenSim.Framework.Capabilities;
39 using OpenSim.Framework.Servers;
40 using OpenSim.Framework.Servers.HttpServer;
42 using OpenSim.Services.Interfaces;
49 private static readonly ILog m_log =
50 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 private IPeople m_PeopleService;
54 : base(
"GET", path, name, description)
56 m_PeopleService = peopleService;
62 NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
63 string names = query.GetOne(
"names");
64 string psize = query.GetOne(
"page_size");
65 string pnumber = query.GetOne(
"page");
67 if (m_PeopleService == null)
68 return FailureResponse(names, (
int)System.Net.HttpStatusCode.InternalServerError, httpResponse);
70 if (
string.IsNullOrEmpty(names) || names.Length < 3)
71 return FailureResponse(names, (
int)System.Net.HttpStatusCode.BadRequest, httpResponse);
73 m_log.DebugFormat(
"[AVATAR PICKER SEARCH]: search for {0}", names);
75 int page_size = (string.IsNullOrEmpty(psize) ? 500 : Int32.Parse(psize));
76 int page_number = (string.IsNullOrEmpty(pnumber) ? 1 : Int32.Parse(pnumber));
79 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
83 List<UserData> users = m_PeopleService.GetUserData(names, page_size, page_number);
86 osdReply.next_page_url = httpRequest.RawUrl;
88 osdReply.agents.Array.Add(ConvertUserData(u));
90 string reply = LLSDHelpers.SerialiseLLSDReply(osdReply);
91 return System.Text.Encoding.UTF8.GetBytes(reply);
97 p.legacy_first_name = user.FirstName;
98 p.legacy_last_name = user.LastName;
99 p.display_name = user.FirstName +
" " + user.LastName;
103 p.username = user.FirstName.ToLower() +
"." + user.
LastName.ToLower();
105 p.is_display_name_default =
false;
109 private byte[] FailureResponse(
string names,
int statuscode,
IOSHttpResponse httpResponse)
111 m_log.Error(
"[AVATAR PICKER SEARCH]: Error searching for " + names);
112 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
113 return System.Text.Encoding.UTF8.GetBytes(
string.Empty);
string ContentType
Content type property.
Base streamed request handler.
OpenSim.Framework.Capabilities.Caps Caps
AvatarPickerSearchHandler(string path, IPeople peopleService, string name, string description)
override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
Interactive OpenSim region server