aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpaneldirfind.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:24 -0500
committerJacek Antonelli2008-08-15 23:45:24 -0500
commit0a78fa3920b32a51f01ebe7cfa30be45134f398f (patch)
tree7d0ebbf55bcb0a77c3957dd64315574281cc2f54 /linden/indra/newview/llpaneldirfind.cpp
parentSecond Life viewer sources 1.18.6.2-RC (diff)
downloadmeta-impy-0a78fa3920b32a51f01ebe7cfa30be45134f398f.zip
meta-impy-0a78fa3920b32a51f01ebe7cfa30be45134f398f.tar.gz
meta-impy-0a78fa3920b32a51f01ebe7cfa30be45134f398f.tar.bz2
meta-impy-0a78fa3920b32a51f01ebe7cfa30be45134f398f.tar.xz
Second Life viewer sources 1.18.6.4-RC
Diffstat (limited to 'linden/indra/newview/llpaneldirfind.cpp')
-rw-r--r--linden/indra/newview/llpaneldirfind.cpp36
1 files changed, 12 insertions, 24 deletions
diff --git a/linden/indra/newview/llpaneldirfind.cpp b/linden/indra/newview/llpaneldirfind.cpp
index 640cbef..2e887f9 100644
--- a/linden/indra/newview/llpaneldirfind.cpp
+++ b/linden/indra/newview/llpaneldirfind.cpp
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2001-2007, Linden Research, Inc. 7 * Copyright (c) 2001-2008, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -182,35 +182,23 @@ void LLPanelDirFindAll::search(const std::string& search_text)
182 // Replace spaces with "+" for use by Google search appliance 182 // Replace spaces with "+" for use by Google search appliance
183 // Yes, this actually works for double-spaces 183 // Yes, this actually works for double-spaces
184 // " foo bar" becomes "+foo++bar" and works fine. JC 184 // " foo bar" becomes "+foo++bar" and works fine. JC
185 185 std::string search_text_with_plus = search_text;
186 // Since we are already iterating over the query, 186 std::string::iterator it = search_text_with_plus.begin();
187 // do our own custom escaping here. 187 for ( ; it != search_text_with_plus.end(); ++it )
188 {
189 if ( std::isspace( *it ) )
190 {
191 *it = '+';
192 }
193 }
188 194
189 // Our own special set of allowed chars (RFC1738 http://www.ietf.org/rfc/rfc1738.txt) 195 // Our own special set of allowed chars (RFC1738 http://www.ietf.org/rfc/rfc1738.txt)
196 // Note that "+" is one of them, so we can do "+" addition first.
190 const char* allowed = 197 const char* allowed =
191 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 198 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
192 "0123456789" 199 "0123456789"
193 "-._~$+!*'()"; 200 "-._~$+!*'()";
194 201 std::string query = LLURI::escape(search_text_with_plus, allowed);
195 std::string query;
196 std::string::const_iterator it = search_text.begin();
197 for ( ; it != search_text.end(); ++it )
198 {
199 if ( std::isspace( *it ) )
200 {
201 query += '+';
202 }
203 else if(strchr(allowed,*it))
204 {
205 // The character is in the allowed set, just copy it
206 query += *it;
207 }
208 else
209 {
210 // Do escaping
211 query += llformat("%%%02X", *it);
212 }
213 }
214 202
215 std::string url = gSavedSettings.getString("SearchURLQuery"); 203 std::string url = gSavedSettings.getString("SearchURLQuery");
216 std::string substring = "[QUERY]"; 204 std::string substring = "[QUERY]";