diff options
author | Teravus Ovares | 2007-12-04 16:07:59 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-12-04 16:07:59 +0000 |
commit | a553e6f67ce2595868ceba0184f730af640961cf (patch) | |
tree | 38de3c5b956d829064e541f671a5d8f0b2d935f4 /OpenSim/Framework | |
parent | * ApplyPhysics now creates the PhysActor as well. (diff) | |
download | opensim-SC_OLD-a553e6f67ce2595868ceba0184f730af640961cf.zip opensim-SC_OLD-a553e6f67ce2595868ceba0184f730af640961cf.tar.gz opensim-SC_OLD-a553e6f67ce2595868ceba0184f730af640961cf.tar.bz2 opensim-SC_OLD-a553e6f67ce2595868ceba0184f730af640961cf.tar.xz |
* 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'.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLGridData.cs | 17 | ||||
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLUserData.cs | 27 |
2 files changed, 25 insertions, 19 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs index 930b3f4..4d65ee9 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs | |||
@@ -176,20 +176,24 @@ namespace OpenSim.Framework.Data.MySQL | |||
176 | public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) | 176 | public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) |
177 | { | 177 | { |
178 | List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); | 178 | List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); |
179 | |||
180 | System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9]"); | ||
181 | |||
179 | string[] querysplit; | 182 | string[] querysplit; |
180 | querysplit = query.Split(' '); | 183 | querysplit = query.Split(' '); |
181 | if (querysplit.Length == 2) | 184 | if (querysplit.Length == 2) |
182 | { | 185 | { |
186 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
187 | param["?first"] = objAlphaNumericPattern.Replace(querysplit[0],"") + "%"; | ||
188 | param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], "") + "%"; | ||
183 | try | 189 | try |
184 | { | 190 | { |
185 | lock (database) | 191 | lock (database) |
186 | { | 192 | { |
187 | Dictionary<string, string> param = new Dictionary<string, string>(); | 193 | |
188 | param["?first"] = querysplit[0]; | ||
189 | param["?second"] = querysplit[1]; | ||
190 | 194 | ||
191 | IDbCommand result = | 195 | IDbCommand result = |
192 | database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first AND lastname = ?second", param); | 196 | database.Query("SELECT UUID,username,surname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100", param); |
193 | IDataReader reader = result.ExecuteReader(); | 197 | IDataReader reader = result.ExecuteReader(); |
194 | 198 | ||
195 | 199 | ||
@@ -224,11 +228,10 @@ namespace OpenSim.Framework.Data.MySQL | |||
224 | lock (database) | 228 | lock (database) |
225 | { | 229 | { |
226 | Dictionary<string, string> param = new Dictionary<string, string>(); | 230 | Dictionary<string, string> param = new Dictionary<string, string>(); |
227 | param["?first"] = querysplit[0]; | 231 | param["?first"] = objAlphaNumericPattern.Replace(querysplit[0],"") + "%"; |
228 | param["?second"] = querysplit[1]; | ||
229 | 232 | ||
230 | IDbCommand result = | 233 | IDbCommand result = |
231 | database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first OR lastname = ?second", param); | 234 | database.Query("SELECT UUID,username,surname FROM users WHERE username like ?first OR lastname like ?second", param); |
232 | IDataReader reader = result.ExecuteReader(); | 235 | IDataReader reader = result.ExecuteReader(); |
233 | 236 | ||
234 | 237 | ||
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs index 3ae1fba..3138911 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs | |||
@@ -110,31 +110,35 @@ namespace OpenSim.Framework.Data.MySQL | |||
110 | public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) | 110 | public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) |
111 | { | 111 | { |
112 | List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>(); | 112 | List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>(); |
113 | |||
114 | System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9]"); | ||
115 | |||
113 | string[] querysplit; | 116 | string[] querysplit; |
114 | querysplit = query.Split(' '); | 117 | querysplit = query.Split(' '); |
115 | if (querysplit.Length == 2) | 118 | if (querysplit.Length == 2) |
116 | { | 119 | { |
120 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
121 | param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%"; | ||
122 | param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], "") + "%"; | ||
117 | try | 123 | try |
118 | { | 124 | { |
119 | lock (database) | 125 | lock (database) |
120 | { | 126 | { |
121 | Dictionary<string, string> param = new Dictionary<string, string>(); | 127 | |
122 | param["?first"] = querysplit[0]; | ||
123 | param["?second"] = querysplit[1]; | ||
124 | 128 | ||
125 | IDbCommand result = | 129 | IDbCommand result = |
126 | database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first AND lastname = ?second", param); | 130 | database.Query("SELECT UUID,username,lastname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100", param); |
127 | IDataReader reader = result.ExecuteReader(); | 131 | IDataReader reader = result.ExecuteReader(); |
128 | 132 | ||
129 | 133 | ||
130 | while (reader.Read()) | 134 | while (reader.Read()) |
131 | { | 135 | { |
132 | OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); | 136 | OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); |
133 | user.AvatarID = new LLUUID((string)reader["UUID"]); | 137 | user.AvatarID = new LLUUID((string)reader["UUID"]); |
134 | user.firstName = (string)reader["username"]; | 138 | user.firstName = (string)reader["username"]; |
135 | user.lastName = (string)reader["surname"]; | 139 | user.lastName = (string)reader["lastname"]; |
136 | returnlist.Add(user); | 140 | returnlist.Add(user); |
137 | 141 | ||
138 | } | 142 | } |
139 | reader.Close(); | 143 | reader.Close(); |
140 | result.Dispose(); | 144 | result.Dispose(); |
@@ -148,7 +152,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
148 | } | 152 | } |
149 | 153 | ||
150 | 154 | ||
151 | 155 | ||
152 | } | 156 | } |
153 | else if (querysplit.Length == 1) | 157 | else if (querysplit.Length == 1) |
154 | { | 158 | { |
@@ -158,11 +162,10 @@ namespace OpenSim.Framework.Data.MySQL | |||
158 | lock (database) | 162 | lock (database) |
159 | { | 163 | { |
160 | Dictionary<string, string> param = new Dictionary<string, string>(); | 164 | Dictionary<string, string> param = new Dictionary<string, string>(); |
161 | param["?first"] = querysplit[0]; | 165 | param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%"; |
162 | param["?second"] = querysplit[1]; | ||
163 | 166 | ||
164 | IDbCommand result = | 167 | IDbCommand result = |
165 | database.Query("SELECT UUID,username,surname FROM users WHERE username = ?first OR lastname = ?second", param); | 168 | database.Query("SELECT UUID,username,lastname FROM users WHERE username like ?first OR lastname like ?first LIMIT 100", param); |
166 | IDataReader reader = result.ExecuteReader(); | 169 | IDataReader reader = result.ExecuteReader(); |
167 | 170 | ||
168 | 171 | ||
@@ -171,7 +174,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
171 | OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); | 174 | OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); |
172 | user.AvatarID = new LLUUID((string)reader["UUID"]); | 175 | user.AvatarID = new LLUUID((string)reader["UUID"]); |
173 | user.firstName = (string)reader["username"]; | 176 | user.firstName = (string)reader["username"]; |
174 | user.lastName = (string)reader["surname"]; | 177 | user.lastName = (string)reader["lastname"]; |
175 | returnlist.Add(user); | 178 | returnlist.Add(user); |
176 | 179 | ||
177 | } | 180 | } |