From 9f6b3e2357e76b9b85b447da189b4bf4163edd3c Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 13 Nov 2007 22:48:19 +0000 Subject: * 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. --- OpenSim/Framework/Data.SQLite/SQLiteGridData.cs | 11 ++++- OpenSim/Framework/Data.SQLite/SQLiteUserData.cs | 53 +++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/Data.SQLite') diff --git a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs index 8f3e8aa..b8fc639 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs @@ -130,7 +130,16 @@ namespace OpenSim.Framework.Data.SQLite return row; } - + /// + /// // Returns a list of avatar and UUIDs that match the query + /// + + public List GeneratePickerResults(LLUUID queryID, string query) + { + //Do nothing yet + List returnlist = new List(); + return returnlist; + } /// /// Adds a new specified region to the database /// diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs index d7a6b39..1385ffc 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs @@ -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 { /// /// A User storage interface for the DB4o database system /// + /// + + public class SQLiteUserData : SQLiteBase, IUserData { /// @@ -135,6 +141,53 @@ namespace OpenSim.Framework.Data.SQLite } } + public List GeneratePickerResults(LLUUID queryID, string query) + { + List returnlist = new List(); + 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 /// Returns a user by UUID direct /// -- cgit v1.1