* Added AvatarPicker in Standalone mode. Works for finding avatar to ban, manually trying to add a friend (with the add button) or useful to those who are curious which usernames have visited your standalone sim. Important for future development :D.

* Grid mode always returns 0 results until the Grid Communications portion is done.
This commit is contained in:
Teravus Ovares
2007-11-13 22:48:19 +00:00
parent eb41ec00c9
commit 9f6b3e2357
23 changed files with 412 additions and 10 deletions

View File

@@ -28,6 +28,7 @@
using System;
using libsecondlife;
using OpenSim.Framework.Communications.Cache;
using System.Collections.Generic;
using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Servers;
@@ -173,6 +174,15 @@ namespace OpenSim.Framework.Communications
}
}
}
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
{
List<AvatarPickerAvatar> pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query);
return pickerlist;
}
#endregion
}

View File

@@ -36,5 +36,6 @@ namespace OpenSim.Framework.Communications
List<SimpleRegionInfo> RequestNeighbours(uint x, uint y);
RegionInfo RequestNeighbourInfo(ulong regionHandle);
List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY);
}
}

View File

@@ -105,6 +105,25 @@ namespace OpenSim.Framework.UserManagement
return null;
}
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
{
List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
{
try
{
pickerlist = plugin.Value.GeneratePickerResults(queryID, query);
}
catch (Exception e)
{
MainLog.Instance.Verbose("Unable to generate AgentPickerData via " + plugin.Key + "(" + query + ")");
return new List<AvatarPickerAvatar>();
}
}
return pickerlist;
}
/// <summary>
/// Loads a user profile by name

View File

@@ -27,6 +27,7 @@
*/
using System;
using System.Collections.Generic;
using libsecondlife;
namespace OpenSim.Framework.Data.DB4o
@@ -139,7 +140,16 @@ namespace OpenSim.Framework.Data.DB4o
{
manager = null;
}
/// <summary>
/// // Returns a list of avatar and UUIDs that match the query
/// </summary>
public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
{
//Do nothing yet
List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
return returnlist;
}
/// <summary>
/// Returns the providers name
/// </summary>

View File

@@ -27,6 +27,7 @@
*/
using System;
using System.IO;
using System.Collections.Generic;
using libsecondlife;
namespace OpenSim.Framework.Data.DB4o
@@ -131,7 +132,12 @@ namespace OpenSim.Framework.Data.DB4o
return null;
}
}
public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
{
//Do nothing yet
List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>();
return returnlist;
}
/// <summary>
/// Creates a new user profile
/// </summary>

View File

@@ -28,10 +28,12 @@
using System;
using System.Collections.Generic;
using System.Data;
using OpenSim.Framework;
using System.Security.Cryptography;
using System.Text;
using libsecondlife;
namespace OpenSim.Framework.Data.MSSQL
{
/// <summary>
@@ -130,7 +132,16 @@ namespace OpenSim.Framework.Data.MSSQL
return row;
}
/// <summary>
/// // Returns a list of avatar and UUIDs that match the query
/// </summary>
public List<OpenSim.Framework.Data.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
{
//Do nothing yet
List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
return returnlist;
}
/// <summary>
/// Adds a new specified region to the database
/// </summary>
@@ -190,5 +201,7 @@ namespace OpenSim.Framework.Data.MSSQL
{
return null;
}
// This is here because MSSQL GridData only seems to know about itself o.O
}
}

View File

@@ -169,6 +169,91 @@ namespace OpenSim.Framework.Data.MySQL
return null;
}
}
/// <summary>
/// // Returns a list of avatar and UUIDs that match the query
/// </summary>
public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
{
List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
string[] querysplit;
querysplit = query.Split(' ');
if (querysplit.Length == 2)
{
try
{
lock (database)
{
Dictionary<string, string> param = new Dictionary<string, string>();
param["?first"] = querysplit[0];
param["?second"] = querysplit[1];
IDbCommand result =
database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first AND lastname = ?second", param);
IDataReader reader = result.ExecuteReader();
while (reader.Read())
{
AvatarPickerAvatar user = new AvatarPickerAvatar();
user.AvatarID = new LLUUID((string)reader["UUID"]);
user.firstName = (string)reader["username"];
user.lastName = (string)reader["surname"];
returnlist.Add(user);
}
reader.Close();
result.Dispose();
}
}
catch (Exception e)
{
database.Reconnect();
MainLog.Instance.Error(e.ToString());
return returnlist;
}
}
else if (querysplit.Length == 1)
{
try
{
lock (database)
{
Dictionary<string, string> param = new Dictionary<string, string>();
param["?first"] = querysplit[0];
param["?second"] = querysplit[1];
IDbCommand result =
database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first OR lastname = ?second", param);
IDataReader reader = result.ExecuteReader();
while (reader.Read())
{
AvatarPickerAvatar user = new AvatarPickerAvatar();
user.AvatarID = new LLUUID((string)reader["UUID"]);
user.firstName = (string)reader["username"];
user.lastName = (string)reader["surname"];
returnlist.Add(user);
}
reader.Close();
result.Dispose();
}
}
catch (Exception e)
{
database.Reconnect();
MainLog.Instance.Error(e.ToString());
return returnlist;
}
}
return returnlist;
}
/// <summary>
/// Returns a sim profile from it's UUID

View File

@@ -97,7 +97,6 @@ namespace OpenSim.Framework.Data.MySQL
reader.Close();
result.Dispose();
return row;
}
}
@@ -108,7 +107,87 @@ namespace OpenSim.Framework.Data.MySQL
return null;
}
}
public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
{
List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>();
string[] querysplit;
querysplit = query.Split(' ');
if (querysplit.Length == 2)
{
try
{
lock (database)
{
Dictionary<string, string> param = new Dictionary<string, string>();
param["?first"] = querysplit[0];
param["?second"] = querysplit[1];
IDbCommand result =
database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first AND lastname = ?second", param);
IDataReader reader = result.ExecuteReader();
while (reader.Read())
{
OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar();
user.AvatarID = new LLUUID((string)reader["UUID"]);
user.firstName = (string)reader["username"];
user.lastName = (string)reader["surname"];
returnlist.Add(user);
}
reader.Close();
result.Dispose();
}
}
catch (Exception e)
{
database.Reconnect();
MainLog.Instance.Error(e.ToString());
return returnlist;
}
}
else if (querysplit.Length == 1)
{
try
{
lock (database)
{
Dictionary<string, string> param = new Dictionary<string, string>();
param["?first"] = querysplit[0];
param["?second"] = querysplit[1];
IDbCommand result =
database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first OR lastname = ?second", param);
IDataReader reader = result.ExecuteReader();
while (reader.Read())
{
OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar();
user.AvatarID = new LLUUID((string)reader["UUID"]);
user.firstName = (string)reader["username"];
user.lastName = (string)reader["surname"];
returnlist.Add(user);
}
reader.Close();
result.Dispose();
}
}
catch (Exception e)
{
database.Reconnect();
MainLog.Instance.Error(e.ToString());
return returnlist;
}
}
return returnlist;
}
/// <summary>
/// Searches the database for a specified user profile by UUID
/// </summary>

View File

@@ -130,7 +130,16 @@ namespace OpenSim.Framework.Data.SQLite
return row;
}
/// <summary>
/// // Returns a list of avatar and UUIDs that match the query
/// </summary>
public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
{
//Do nothing yet
List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
return returnlist;
}
/// <summary>
/// Adds a new specified region to the database
/// </summary>

View File

@@ -26,16 +26,22 @@
*
*/
using System;
using System.Collections.Generic;
using System.Data;
using libsecondlife;
using Mono.Data.SqliteClient;
using OpenSim.Framework;
using OpenSim.Framework.Console;
namespace OpenSim.Framework.Data.SQLite
{
/// <summary>
/// A User storage interface for the DB4o database system
/// </summary>
///
public class SQLiteUserData : SQLiteBase, IUserData
{
/// <summary>
@@ -135,6 +141,53 @@ namespace OpenSim.Framework.Data.SQLite
}
}
public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
{
List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>();
string[] querysplit;
querysplit = query.Split(' ');
if (querysplit.Length == 2)
{
string select = "username like '" + querysplit[0] + "%' and surname like '" + querysplit[1] + "%'";
lock(ds)
{
DataRow[] rows = ds.Tables["users"].Select(select);
if (rows.Length > 0)
{
for (int i = 0; i < rows.Length; i++)
{
OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar();
DataRow row = rows[i];
user.AvatarID = new LLUUID((string)row["UUID"]);
user.firstName = (string)row["username"];
user.lastName = (string)row["surname"];
returnlist.Add(user);
}
}
}
}
else if (querysplit.Length == 1)
{
string select = "username like '" + querysplit[0] + "%' OR surname like '" + querysplit[0] + "%'";
lock(ds)
{
DataRow[] rows = ds.Tables["users"].Select(select);
if (rows.Length > 0)
{
for (int i = 0;i<rows.Length;i++) {
OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar();
DataRow row = rows[i];
user.AvatarID = new LLUUID((string)row[0]);
user.firstName = (string)row[1];
user.lastName = (string)row[2];
returnlist.Add(user);
}
}
}
}
return returnlist;
}
/// <summary>
/// Returns a user by UUID direct
/// </summary>

View File

@@ -26,9 +26,19 @@
*
*/
using libsecondlife;
using System.Collections.Generic;
namespace OpenSim.Framework.Data
{
public class AvatarPickerAvatar
{
public LLUUID AvatarID;
public string firstName;
public string lastName;
public AvatarPickerAvatar()
{
}
}
public enum DataResponse
{
RESPONSE_OK,
@@ -66,6 +76,8 @@ namespace OpenSim.Framework.Data
/// <returns>An array containing all the sim profiles in the specified range</returns>
RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query);
/// <summary>
/// Authenticates a sim by use of it's recv key.
/// WARNING: Insecure

View File

@@ -228,6 +228,7 @@ namespace OpenSim.Framework
public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset);
public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID);
public delegate void AvatarPickerRequest(IClientAPI remoteClient, LLUUID agentdata, LLUUID queryID, string UserQuery);
public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient);
@@ -305,6 +306,7 @@ namespace OpenSim.Framework
event UpdateAgent OnAgentUpdate;
event AgentRequestSit OnAgentRequestSit;
event AgentSit OnAgentSit;
event AvatarPickerRequest OnAvatarPickerRequest;
event Action<IClientAPI> OnRequestAvatarsData;
event AddNewPrim OnAddPrim;
event ObjectDuplicate OnObjectDuplicate;
@@ -423,6 +425,7 @@ namespace OpenSim.Framework
void SendRemoveInventoryItem(LLUUID itemID);
void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName);
void SendXferPacket(ulong xferID, uint packet, byte[] data);
void SendAvatarPickerReply(AvatarPickerReplyPacket Pack);
void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID);
void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags);

View File

@@ -26,6 +26,7 @@
*
*/
using libsecondlife;
using System.Collections.Generic;
namespace OpenSim.Framework
{
@@ -56,6 +57,8 @@ namespace OpenSim.Framework
/// <returns>The user data profile</returns>
UserProfileData GetUserByName(string fname, string lname);
List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query);
/// <summary>
/// Returns the current agent for a user searching by it's UUID
/// </summary>
@@ -131,4 +134,13 @@ namespace OpenSim.Framework
/// </summary>
void Initialise();
}
public class AvatarPickerAvatar
{
public LLUUID AvatarID;
public string firstName;
public string lastName;
public AvatarPickerAvatar()
{
}
}
}

View File

@@ -26,6 +26,7 @@
*
*/
using libsecondlife;
using System.Collections.Generic;
namespace OpenSim.Framework.Interfaces
{
@@ -35,6 +36,7 @@ namespace OpenSim.Framework.Interfaces
UserProfileData GetUserProfile(string name);
UserProfileData GetUserProfile(LLUUID userId);
void clearUserAgent(LLUUID avatarID);
List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID QueryID, string Query);
UserProfileData SetupMasterUser(string firstName, string lastName);
UserProfileData SetupMasterUser(string firstName, string lastName, string password);

View File

@@ -145,6 +145,19 @@ namespace OpenSim.Framework
public UserAgentData currentAgent;
}
/// <summary>
/// Minimal User Data required to service the AvatarPickerReply
/// </summary>
//public class AvatarPickerAvatar
//{
//public LLUUID AvatarID;
//public string firstName;
//public string lastName;
//public AvatarPickerAvatar()
//{
//}
//}
/// <summary>
/// Information about a users session
/// </summary>