From 282e116f948d431b570f7c17425cfc0a8ea767a2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 21 Apr 2011 22:34:49 +0200 Subject: Honor agent limit for region crossings and teleports --- OpenSim/Data/MySQL/MySQLUserAccountData.cs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs index 92afa75..a621d84 100644 --- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs +++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs @@ -46,17 +46,21 @@ namespace OpenSim.Data.MySQL { string[] words = query.Split(new char[] {' '}); + bool valid = false; + for (int i = 0 ; i < words.Length ; i++) { - if (words[i].Length < 3) - { - if (i != words.Length - 1) - Array.Copy(words, i + 1, words, i, words.Length - i - 1); - Array.Resize(ref words, words.Length - 1); - } + if (words[i].Length > 2) + valid = true; +// if (words[i].Length < 3) +// { +// if (i != words.Length - 1) +// Array.Copy(words, i + 1, words, i, words.Length - i - 1); +// Array.Resize(ref words, words.Length - 1); +// } } - if (words.Length == 0) + if ((!valid) || words.Length == 0) return new UserAccountData[0]; if (words.Length > 2) @@ -67,14 +71,14 @@ namespace OpenSim.Data.MySQL if (words.Length == 1) { cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm); - cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%"); + cmd.Parameters.AddWithValue("?search", words[0] + "%"); cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); } else { cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast)", m_Realm); - cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%"); - cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%"); + cmd.Parameters.AddWithValue("?searchFirst", words[0] + "%"); + cmd.Parameters.AddWithValue("?searchLast", words[1] + "%"); cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); } -- cgit v1.1