aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/IUserAccountData.cs1
-rw-r--r--OpenSim/Data/MSSQL/MSSQLUserAccountData.cs5
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs38
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs12
4 files changed, 53 insertions, 3 deletions
diff --git a/OpenSim/Data/IUserAccountData.cs b/OpenSim/Data/IUserAccountData.cs
index e350a18..6ee5995 100644
--- a/OpenSim/Data/IUserAccountData.cs
+++ b/OpenSim/Data/IUserAccountData.cs
@@ -48,5 +48,6 @@ namespace OpenSim.Data
48 { 48 {
49 UserAccountData[] Get(string[] fields, string[] values); 49 UserAccountData[] Get(string[] fields, string[] values);
50 bool Store(UserAccountData data); 50 bool Store(UserAccountData data);
51 UserAccountData[] GetUsers(UUID scopeID, string query);
51 } 52 }
52} 53}
diff --git a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs
index ca09029..01c64dc 100644
--- a/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLUserAccountData.cs
@@ -194,5 +194,10 @@ namespace OpenSim.Data.MSSQL
194 { 194 {
195 return null; 195 return null;
196 } 196 }
197
198 public UserAccountData[] GetUsers(UUID scopeID, string query)
199 {
200 return null;
201 }
197 } 202 }
198} 203}
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
index ae7d5ca..aa69d68 100644
--- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs
@@ -42,9 +42,43 @@ namespace OpenSim.Data.MySQL
42 { 42 {
43 } 43 }
44 44
45 public bool Store(UserAccountData data) 45 public UserAccountData[] GetUsers(UUID scopeID, string query)
46 { 46 {
47 return Store(data); 47 string[] words = query.Split(new char[] {' '});
48
49 for (int i = 0 ; i < words.Length ; i++)
50 {
51 if (words[i].Length < 3)
52 {
53 if (i != words.Length - 1)
54 Array.Copy(words, i + 1, words, i, words.Length - i - 1);
55 Array.Resize(ref words, words.Length - 1);
56 }
57 }
58
59 if (words.Length == 0)
60 return new UserAccountData[0];
61
62 if (words.Length > 2)
63 return new UserAccountData[0];
64
65 MySqlCommand cmd = new MySqlCommand();
66
67 if (words.Length == 1)
68 {
69 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);
70 cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%");
71 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
72 }
73 else
74 {
75 cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm);
76 cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%");
77 cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%");
78 cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
79 }
80
81 return DoQuery(cmd);
48 } 82 }
49 } 83 }
50} 84}
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 2954589..c14651d 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -168,7 +168,17 @@ namespace OpenSim.Services.UserAccountService
168 168
169 public List<UserAccount> GetUserAccounts(UUID scopeID, string query) 169 public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
170 { 170 {
171 return null; 171 UserAccountData[] d = m_Database.GetUsers(scopeID, query);
172
173 if (d == null)
174 return new List<UserAccount>();
175
176 List<UserAccount> ret = new List<UserAccount>();
177
178 foreach (UserAccountData data in d)
179 ret.Add(MakeUserAccount(data));
180
181 return ret;
172 } 182 }
173 } 183 }
174} 184}