From a553e6f67ce2595868ceba0184f730af640961cf Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 4 Dec 2007 16:07:59 +0000 Subject: * Avatar picker works in grid mode now. * To test, click the communicate button, then click the 'add' button and type a name. You will get a list of closely matching avatar names. * Before this'll work on your sim in grid mode, the UGA needs to be updated. If it isn't updated, then you'll get a message on the sim console when searching like, 'got invalid queryid'. --- .../Region/Communications/OGS1/OGS1UserServices.cs | 48 +++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Communications') diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index 475066e..ed77e20 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs @@ -80,6 +80,34 @@ namespace OpenSim.Region.Communications.OGS1 return userData; } + public List ConvertXMLRPCDataToAvatarPickerList(LLUUID queryID,Hashtable data) + { + List pickerlist = new List(); + int pickercount = Convert.ToInt32((string)data["avcount"]); + LLUUID respqueryID = new LLUUID((string)data["queryid"]); + if (queryID == respqueryID) + { + for (int i = 0; i < pickercount; i++) + { + AvatarPickerAvatar apicker = new AvatarPickerAvatar(); + LLUUID avatarID = new LLUUID((string)data["avatarid" + i.ToString()]); + string firstname = (string)data["firstname" + i.ToString()]; + string lastname = (string)data["lastname" + i.ToString()]; + apicker.AvatarID = avatarID; + apicker.firstName = firstname; + apicker.lastName = lastname; + pickerlist.Add(apicker); + } + } + else + { + MainLog.Instance.Warn("INTERGRID", "Got invalid queryID from userServer"); + } + return pickerlist; + + } + + public UserProfileData GetUserProfile(string firstName, string lastName) { return GetUserProfile(firstName + " " + lastName); @@ -89,7 +117,25 @@ namespace OpenSim.Region.Communications.OGS1 public List GenerateAgentPickerRequestResponse(LLUUID queryID, string query) { List pickerlist = new List(); - + System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9 ]"); + try + { + Hashtable param = new Hashtable(); + param["queryid"] = (string)queryID.ToStringHyphenated(); + param["avquery"] = objAlphaNumericPattern.Replace(query, ""); + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("get_avatar_picker_avatar", parameters); + XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + pickerlist = ConvertXMLRPCDataToAvatarPickerList(queryID,respData); + } + catch (WebException e) + { + MainLog.Instance.Warn("Error when trying to fetch Avatar Picker Response: " + + e.Message); + // Return Empty picker list (no results) + } return pickerlist; } public UserProfileData GetUserProfile(string name) -- cgit v1.1