* 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'.afrisby
parent
bf8239c7fa
commit
a553e6f67c
|
@ -176,20 +176,24 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
|
public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
|
||||||
{
|
{
|
||||||
List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
|
List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
|
||||||
|
|
||||||
|
System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9]");
|
||||||
|
|
||||||
string[] querysplit;
|
string[] querysplit;
|
||||||
querysplit = query.Split(' ');
|
querysplit = query.Split(' ');
|
||||||
if (querysplit.Length == 2)
|
if (querysplit.Length == 2)
|
||||||
{
|
{
|
||||||
|
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||||
|
param["?first"] = objAlphaNumericPattern.Replace(querysplit[0],"") + "%";
|
||||||
|
param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], "") + "%";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
lock (database)
|
lock (database)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
|
||||||
param["?first"] = querysplit[0];
|
|
||||||
param["?second"] = querysplit[1];
|
|
||||||
|
|
||||||
IDbCommand result =
|
IDbCommand result =
|
||||||
database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first AND lastname = ?second", param);
|
database.Query("SELECT UUID,username,surname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100", param);
|
||||||
IDataReader reader = result.ExecuteReader();
|
IDataReader reader = result.ExecuteReader();
|
||||||
|
|
||||||
|
|
||||||
|
@ -224,11 +228,10 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
lock (database)
|
lock (database)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||||
param["?first"] = querysplit[0];
|
param["?first"] = objAlphaNumericPattern.Replace(querysplit[0],"") + "%";
|
||||||
param["?second"] = querysplit[1];
|
|
||||||
|
|
||||||
IDbCommand result =
|
IDbCommand result =
|
||||||
database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first OR lastname = ?second", param);
|
database.Query("SELECT UUID,username,surname FROM users WHERE username like ?first OR lastname like ?second", param);
|
||||||
IDataReader reader = result.ExecuteReader();
|
IDataReader reader = result.ExecuteReader();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -110,31 +110,35 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
|
public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
|
||||||
{
|
{
|
||||||
List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>();
|
List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>();
|
||||||
|
|
||||||
|
System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9]");
|
||||||
|
|
||||||
string[] querysplit;
|
string[] querysplit;
|
||||||
querysplit = query.Split(' ');
|
querysplit = query.Split(' ');
|
||||||
if (querysplit.Length == 2)
|
if (querysplit.Length == 2)
|
||||||
{
|
{
|
||||||
|
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||||
|
param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%";
|
||||||
|
param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], "") + "%";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
lock (database)
|
lock (database)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
|
||||||
param["?first"] = querysplit[0];
|
|
||||||
param["?second"] = querysplit[1];
|
|
||||||
|
|
||||||
IDbCommand result =
|
IDbCommand result =
|
||||||
database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first AND lastname = ?second", param);
|
database.Query("SELECT UUID,username,lastname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100", param);
|
||||||
IDataReader reader = result.ExecuteReader();
|
IDataReader reader = result.ExecuteReader();
|
||||||
|
|
||||||
|
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar();
|
OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar();
|
||||||
user.AvatarID = new LLUUID((string)reader["UUID"]);
|
user.AvatarID = new LLUUID((string)reader["UUID"]);
|
||||||
user.firstName = (string)reader["username"];
|
user.firstName = (string)reader["username"];
|
||||||
user.lastName = (string)reader["surname"];
|
user.lastName = (string)reader["lastname"];
|
||||||
returnlist.Add(user);
|
returnlist.Add(user);
|
||||||
|
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
result.Dispose();
|
result.Dispose();
|
||||||
|
@ -148,7 +152,7 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (querysplit.Length == 1)
|
else if (querysplit.Length == 1)
|
||||||
{
|
{
|
||||||
|
@ -158,11 +162,10 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
lock (database)
|
lock (database)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||||
param["?first"] = querysplit[0];
|
param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%";
|
||||||
param["?second"] = querysplit[1];
|
|
||||||
|
|
||||||
IDbCommand result =
|
IDbCommand result =
|
||||||
database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first OR lastname = ?second", param);
|
database.Query("SELECT UUID,username,lastname FROM users WHERE username like ?first OR lastname like ?first LIMIT 100", param);
|
||||||
IDataReader reader = result.ExecuteReader();
|
IDataReader reader = result.ExecuteReader();
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,7 +174,7 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar();
|
OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar();
|
||||||
user.AvatarID = new LLUUID((string)reader["UUID"]);
|
user.AvatarID = new LLUUID((string)reader["UUID"]);
|
||||||
user.firstName = (string)reader["username"];
|
user.firstName = (string)reader["username"];
|
||||||
user.lastName = (string)reader["surname"];
|
user.lastName = (string)reader["lastname"];
|
||||||
returnlist.Add(user);
|
returnlist.Add(user);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,8 @@ namespace OpenSim.Grid.UserServer
|
||||||
|
|
||||||
httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
|
httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
|
||||||
httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
|
httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
|
||||||
|
httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", m_userManager.XmlRPCGetAvatarPickerAvatar);
|
||||||
|
|
||||||
|
|
||||||
httpServer.AddStreamHandler(
|
httpServer.AddStreamHandler(
|
||||||
new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod));
|
new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod));
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using Nwc.XmlRpc;
|
using Nwc.XmlRpc;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
@ -70,6 +71,24 @@ namespace OpenSim.Grid.UserServer
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public XmlRpcResponse AvatarPickerListtoXmlRPCResponse(LLUUID queryID, List<AvatarPickerAvatar> returnUsers)
|
||||||
|
{
|
||||||
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
Hashtable responseData = new Hashtable();
|
||||||
|
// Query Result Information
|
||||||
|
responseData["queryid"] = (string)queryID.ToStringHyphenated();
|
||||||
|
responseData["avcount"] = (string)returnUsers.Count.ToString();
|
||||||
|
|
||||||
|
for (int i = 0; i < returnUsers.Count; i++)
|
||||||
|
{
|
||||||
|
responseData["avatarid" + i.ToString()] = returnUsers[i].AvatarID.ToStringHyphenated();
|
||||||
|
responseData["firstname" + i.ToString()] = returnUsers[i].firstName;
|
||||||
|
responseData["lastname" + i.ToString()] = returnUsers[i].lastName;
|
||||||
|
}
|
||||||
|
response.Value = responseData;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts a user profile to an XML element which can be returned
|
/// Converts a user profile to an XML element which can be returned
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -113,6 +132,23 @@ namespace OpenSim.Grid.UserServer
|
||||||
|
|
||||||
#region XMLRPC User Methods
|
#region XMLRPC User Methods
|
||||||
|
|
||||||
|
public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request)
|
||||||
|
{
|
||||||
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
|
List<AvatarPickerAvatar> returnAvatar = new List<AvatarPickerAvatar>();
|
||||||
|
LLUUID queryID = new LLUUID(LLUUID.Zero.ToStringHyphenated());
|
||||||
|
|
||||||
|
if (requestData.Contains("avquery") && requestData.Contains("queryid"))
|
||||||
|
{
|
||||||
|
queryID = new LLUUID((string)requestData["queryid"]);
|
||||||
|
returnAvatar = GenerateAgentPickerRequestResponse(queryID,(string)requestData["avquery"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("[AVATARINFO]: Servicing Avatar Query: " + (string)requestData["avquery"]);
|
||||||
|
return AvatarPickerListtoXmlRPCResponse(queryID,returnAvatar);
|
||||||
|
}
|
||||||
|
|
||||||
public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request)
|
public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
|
|
@ -80,6 +80,34 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
return userData;
|
return userData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<AvatarPickerAvatar> ConvertXMLRPCDataToAvatarPickerList(LLUUID queryID,Hashtable data)
|
||||||
|
{
|
||||||
|
List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
|
||||||
|
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)
|
public UserProfileData GetUserProfile(string firstName, string lastName)
|
||||||
{
|
{
|
||||||
return GetUserProfile(firstName + " " + lastName);
|
return GetUserProfile(firstName + " " + lastName);
|
||||||
|
@ -89,7 +117,25 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
|
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
|
||||||
{
|
{
|
||||||
List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
|
List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
|
||||||
|
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;
|
return pickerlist;
|
||||||
}
|
}
|
||||||
public UserProfileData GetUserProfile(string name)
|
public UserProfileData GetUserProfile(string name)
|
||||||
|
|
Loading…
Reference in New Issue