diff options
Diffstat (limited to 'linden/indra/newview/llurldispatcher.cpp')
-rw-r--r-- | linden/indra/newview/llurldispatcher.cpp | 64 |
1 files changed, 21 insertions, 43 deletions
diff --git a/linden/indra/newview/llurldispatcher.cpp b/linden/indra/newview/llurldispatcher.cpp index ad2ef62..51b9505 100644 --- a/linden/indra/newview/llurldispatcher.cpp +++ b/linden/indra/newview/llurldispatcher.cpp | |||
@@ -48,9 +48,6 @@ | |||
48 | // library includes | 48 | // library includes |
49 | #include "llsd.h" | 49 | #include "llsd.h" |
50 | 50 | ||
51 | // system includes | ||
52 | #include <boost/tokenizer.hpp> | ||
53 | |||
54 | const std::string SLURL_SL_HELP_PREFIX = "secondlife://app."; | 51 | const std::string SLURL_SL_HELP_PREFIX = "secondlife://app."; |
55 | const std::string SLURL_SL_PREFIX = "sl://"; | 52 | const std::string SLURL_SL_PREFIX = "sl://"; |
56 | const std::string SLURL_SECONDLIFE_PREFIX = "secondlife://"; | 53 | const std::string SLURL_SECONDLIFE_PREFIX = "secondlife://"; |
@@ -111,7 +108,7 @@ bool LLURLDispatcherImpl::isSLURL(const std::string& url) | |||
111 | 108 | ||
112 | // static | 109 | // static |
113 | bool LLURLDispatcherImpl::isSLURLCommand(const std::string& url) | 110 | bool LLURLDispatcherImpl::isSLURLCommand(const std::string& url) |
114 | { | 111 | { |
115 | if (matchPrefix(url, SLURL_SL_PREFIX + SLURL_APP_TOKEN) | 112 | if (matchPrefix(url, SLURL_SL_PREFIX + SLURL_APP_TOKEN) |
116 | || matchPrefix(url, SLURL_SECONDLIFE_PREFIX + "/" + SLURL_APP_TOKEN) | 113 | || matchPrefix(url, SLURL_SECONDLIFE_PREFIX + "/" + SLURL_APP_TOKEN) |
117 | || matchPrefix(url, SLURL_SLURL_PREFIX + SLURL_APP_TOKEN) ) | 114 | || matchPrefix(url, SLURL_SLURL_PREFIX + SLURL_APP_TOKEN) ) |
@@ -128,6 +125,14 @@ bool LLURLDispatcherImpl::dispatchCore(const std::string& url, bool right_mouse) | |||
128 | if (dispatchHelp(url, right_mouse)) return true; | 125 | if (dispatchHelp(url, right_mouse)) return true; |
129 | if (dispatchApp(url, right_mouse)) return true; | 126 | if (dispatchApp(url, right_mouse)) return true; |
130 | if (dispatchRegion(url, right_mouse)) return true; | 127 | if (dispatchRegion(url, right_mouse)) return true; |
128 | |||
129 | /* | ||
130 | // Inform the user we can't handle this | ||
131 | std::map<std::string, std::string> args; | ||
132 | args["[SLURL]"] = url; | ||
133 | gViewerWindow->alertXml("BadURL", args); | ||
134 | */ | ||
135 | |||
131 | return false; | 136 | return false; |
132 | } | 137 | } |
133 | 138 | ||
@@ -164,41 +169,14 @@ bool LLURLDispatcherImpl::dispatchApp(const std::string& url, BOOL right_mouse) | |||
164 | { | 169 | { |
165 | return false; | 170 | return false; |
166 | } | 171 | } |
167 | std::string s = stripProtocol(url); | ||
168 | |||
169 | // At this point, "secondlife://app/foo/bar/baz/" should be left | ||
170 | // as: "app/foo/bar/baz/" | ||
171 | typedef boost::tokenizer<boost::char_separator<char> > tokenizer; | ||
172 | boost::char_separator<char> sep("/", "", boost::drop_empty_tokens); | ||
173 | tokenizer tokens(s, sep); | ||
174 | tokenizer::iterator it = tokens.begin(); | ||
175 | tokenizer::iterator end = tokens.end(); | ||
176 | |||
177 | // Build parameter list suitable for LLDispatcher dispatch | ||
178 | if (it == end) return false; | ||
179 | if (*it != "app") return false; | ||
180 | ++it; | ||
181 | |||
182 | if (it == end) return false; | ||
183 | std::string cmd = *it; | ||
184 | ++it; | ||
185 | |||
186 | std::vector<std::string> params; | ||
187 | for ( ; it != end; ++it) | ||
188 | { | ||
189 | params.push_back(*it); | ||
190 | } | ||
191 | 172 | ||
192 | bool handled = LLCommandDispatcher::dispatch(cmd, params); | 173 | LLURI uri(url); |
193 | if (handled) return true; | 174 | LLSD pathArray = uri.pathArray(); |
194 | 175 | pathArray.erase(0); // erase "app" | |
195 | // Inform the user we can't handle this | 176 | std::string cmd = pathArray.get(0); |
196 | std::map<std::string, std::string> args; | 177 | pathArray.erase(0); // erase "cmd" |
197 | args["[SLURL]"] = url; | 178 | bool handled = LLCommandDispatcher::dispatch(cmd, pathArray, uri.queryMap()); |
198 | gViewerWindow->alertXml("BadURL", args); | 179 | return handled; |
199 | // This was a SLURL with a /app prefix, and we "handled" it by displaying an error dialog, | ||
200 | // so return true. It doesn't need to be parsed any further. | ||
201 | return true; | ||
202 | } | 180 | } |
203 | 181 | ||
204 | // static | 182 | // static |
@@ -211,14 +189,14 @@ bool LLURLDispatcherImpl::dispatchRegion(const std::string& url, BOOL right_mous | |||
211 | 189 | ||
212 | // Before we're logged in, need to update the startup screen | 190 | // Before we're logged in, need to update the startup screen |
213 | // to tell the user where they are going. | 191 | // to tell the user where they are going. |
214 | if (LLStartUp::getStartupState() < STATE_CLEANUP) | 192 | if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) |
215 | { | 193 | { |
216 | // Parse it and stash in globals, it will be dispatched in | 194 | // Parse it and stash in globals, it will be dispatched in |
217 | // STATE_CLEANUP. | 195 | // STATE_CLEANUP. |
218 | LLURLSimString::setString(url); | 196 | LLURLSimString::setString(url); |
219 | // We're at the login screen, so make sure user can see | 197 | // We're at the login screen, so make sure user can see |
220 | // the login location box to know where they are going. | 198 | // the login location box to know where they are going. |
221 | LLPanelLogin::refreshLocation( true ); | 199 | LLPanelLogin::loadLoginPage(); |
222 | return true; | 200 | return true; |
223 | } | 201 | } |
224 | 202 | ||
@@ -314,7 +292,7 @@ class LLTeleportHandler : public LLCommandHandler | |||
314 | { | 292 | { |
315 | public: | 293 | public: |
316 | LLTeleportHandler() : LLCommandHandler("teleport") { } | 294 | LLTeleportHandler() : LLCommandHandler("teleport") { } |
317 | bool handle(const std::vector<std::string>& tokens) | 295 | bool handle(const LLSD& tokens, const LLSD& queryMap) |
318 | { | 296 | { |
319 | // construct a "normal" SLURL, resolve the region to | 297 | // construct a "normal" SLURL, resolve the region to |
320 | // a global position, and teleport to it | 298 | // a global position, and teleport to it |
@@ -325,9 +303,9 @@ public: | |||
325 | 303 | ||
326 | // build secondlife://De%20Haro/123/45/67 for use in callback | 304 | // build secondlife://De%20Haro/123/45/67 for use in callback |
327 | std::string url = SLURL_SECONDLIFE_PREFIX; | 305 | std::string url = SLURL_SECONDLIFE_PREFIX; |
328 | for (size_t i = 0; i < tokens.size(); ++i) | 306 | for (int i = 0; i < tokens.size(); ++i) |
329 | { | 307 | { |
330 | url += tokens[i] + "/"; | 308 | url += tokens[i].asString() + "/"; |
331 | } | 309 | } |
332 | gWorldMap->sendNamedRegionRequest(region_name, | 310 | gWorldMap->sendNamedRegionRequest(region_name, |
333 | LLURLDispatcherImpl::regionHandleCallback, | 311 | LLURLDispatcherImpl::regionHandleCallback, |