diff options
Diffstat (limited to 'linden/indra/newview/llurldispatcher.cpp')
-rw-r--r-- | linden/indra/newview/llurldispatcher.cpp | 68 |
1 files changed, 47 insertions, 21 deletions
diff --git a/linden/indra/newview/llurldispatcher.cpp b/linden/indra/newview/llurldispatcher.cpp index c2c704d..78b305c 100644 --- a/linden/indra/newview/llurldispatcher.cpp +++ b/linden/indra/newview/llurldispatcher.cpp | |||
@@ -12,12 +12,12 @@ | |||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | 12 | * ("GPL"), unless you have obtained a separate licensing agreement |
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 13 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
15 | * online at http://secondlife.com/developers/opensource/gplv2 | 15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
16 | * | 16 | * |
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlife.com/developers/opensource/flossexception | 20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception |
21 | * | 21 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
@@ -37,13 +37,13 @@ | |||
37 | #include "llcommandhandler.h" | 37 | #include "llcommandhandler.h" |
38 | #include "llfloaterurldisplay.h" | 38 | #include "llfloaterurldisplay.h" |
39 | #include "llfloaterdirectory.h" | 39 | #include "llfloaterdirectory.h" |
40 | #include "llfloaterhtmlhelp.h" | 40 | #include "llfloaterhtml.h" |
41 | //#include "llfloaterworldmap.h" | ||
42 | #include "llfloaterworldmap.h" | 41 | #include "llfloaterworldmap.h" |
43 | #include "llpanellogin.h" | 42 | #include "llpanellogin.h" |
44 | #include "llstartup.h" // gStartupState | 43 | #include "llstartup.h" // gStartupState |
45 | #include "llurlsimstring.h" | 44 | #include "llurlsimstring.h" |
46 | #include "llviewerwindow.h" // alertXml() | 45 | #include "llviewerwindow.h" // alertXml() |
46 | #include "llweb.h" | ||
47 | #include "llworldmap.h" | 47 | #include "llworldmap.h" |
48 | 48 | ||
49 | // library includes | 49 | // library includes |
@@ -63,23 +63,24 @@ public: | |||
63 | 63 | ||
64 | static bool isSLURLCommand(const std::string& url); | 64 | static bool isSLURLCommand(const std::string& url); |
65 | 65 | ||
66 | static bool dispatch(const std::string& url); | 66 | static bool dispatch(const std::string& url, bool from_external_browser); |
67 | // returns true if handled | 67 | // returns true if handled or explicitly blocked. |
68 | 68 | ||
69 | static bool dispatchRightClick(const std::string& url); | 69 | static bool dispatchRightClick(const std::string& url); |
70 | 70 | ||
71 | private: | 71 | private: |
72 | static bool dispatchCore(const std::string& url, bool right_mouse); | 72 | static bool dispatchCore(const std::string& url, |
73 | bool from_external_browser, bool right_mouse); | ||
73 | // handles both left and right click | 74 | // handles both left and right click |
74 | 75 | ||
75 | static bool dispatchHelp(const std::string& url, BOOL right_mouse); | 76 | static bool dispatchHelp(const std::string& url, BOOL right_mouse); |
76 | // Handles sl://app.floater.html.help by showing Help floater. | 77 | // Handles sl://app.floater.html.help by showing Help floater. |
77 | // Returns true if handled. | 78 | // Returns true if handled. |
78 | 79 | ||
79 | static bool dispatchApp(const std::string& url, BOOL right_mouse); | 80 | static bool dispatchApp(const std::string& url, bool from_external_browser, BOOL right_mouse); |
80 | // Handles secondlife://app/agent/<agent_id>/about and similar | 81 | // Handles secondlife:///app/agent/<agent_id>/about and similar |
81 | // by showing panel in Search floater. | 82 | // by showing panel in Search floater. |
82 | // Returns true if handled. | 83 | // Returns true if handled or explicitly blocked. |
83 | 84 | ||
84 | static bool dispatchRegion(const std::string& url, BOOL right_mouse); | 85 | static bool dispatchRegion(const std::string& url, BOOL right_mouse); |
85 | // handles secondlife://Ahern/123/45/67/ | 86 | // handles secondlife://Ahern/123/45/67/ |
@@ -120,11 +121,11 @@ bool LLURLDispatcherImpl::isSLURLCommand(const std::string& url) | |||
120 | } | 121 | } |
121 | 122 | ||
122 | // static | 123 | // static |
123 | bool LLURLDispatcherImpl::dispatchCore(const std::string& url, bool right_mouse) | 124 | bool LLURLDispatcherImpl::dispatchCore(const std::string& url, bool from_external_browser, bool right_mouse) |
124 | { | 125 | { |
125 | if (url.empty()) return false; | 126 | if (url.empty()) return false; |
126 | if (dispatchHelp(url, right_mouse)) return true; | 127 | if (dispatchHelp(url, right_mouse)) return true; |
127 | if (dispatchApp(url, right_mouse)) return true; | 128 | if (dispatchApp(url, from_external_browser, right_mouse)) return true; |
128 | if (dispatchRegion(url, right_mouse)) return true; | 129 | if (dispatchRegion(url, right_mouse)) return true; |
129 | 130 | ||
130 | /* | 131 | /* |
@@ -138,17 +139,20 @@ bool LLURLDispatcherImpl::dispatchCore(const std::string& url, bool right_mouse) | |||
138 | } | 139 | } |
139 | 140 | ||
140 | // static | 141 | // static |
141 | bool LLURLDispatcherImpl::dispatch(const std::string& url) | 142 | bool LLURLDispatcherImpl::dispatch(const std::string& url, bool from_external_browser) |
142 | { | 143 | { |
143 | llinfos << "url: " << url << llendl; | 144 | llinfos << "url: " << url << llendl; |
144 | return dispatchCore(url, false); // not right click | 145 | const bool right_click = false; |
146 | return dispatchCore(url, from_external_browser, right_click); | ||
145 | } | 147 | } |
146 | 148 | ||
147 | // static | 149 | // static |
148 | bool LLURLDispatcherImpl::dispatchRightClick(const std::string& url) | 150 | bool LLURLDispatcherImpl::dispatchRightClick(const std::string& url) |
149 | { | 151 | { |
150 | llinfos << "url: " << url << llendl; | 152 | llinfos << "url: " << url << llendl; |
151 | return dispatchCore(url, true); // yes right click | 153 | const bool from_external_browser = false; |
154 | const bool right_click = true; | ||
155 | return dispatchCore(url, from_external_browser, right_click); | ||
152 | } | 156 | } |
153 | // static | 157 | // static |
154 | bool LLURLDispatcherImpl::dispatchHelp(const std::string& url, BOOL right_mouse) | 158 | bool LLURLDispatcherImpl::dispatchHelp(const std::string& url, BOOL right_mouse) |
@@ -164,7 +168,9 @@ bool LLURLDispatcherImpl::dispatchHelp(const std::string& url, BOOL right_mouse) | |||
164 | } | 168 | } |
165 | 169 | ||
166 | // static | 170 | // static |
167 | bool LLURLDispatcherImpl::dispatchApp(const std::string& url, BOOL right_mouse) | 171 | bool LLURLDispatcherImpl::dispatchApp(const std::string& url, |
172 | bool from_external_browser, | ||
173 | BOOL right_mouse) | ||
168 | { | 174 | { |
169 | if (!isSLURL(url)) | 175 | if (!isSLURL(url)) |
170 | { | 176 | { |
@@ -176,7 +182,8 @@ bool LLURLDispatcherImpl::dispatchApp(const std::string& url, BOOL right_mouse) | |||
176 | pathArray.erase(0); // erase "app" | 182 | pathArray.erase(0); // erase "app" |
177 | std::string cmd = pathArray.get(0); | 183 | std::string cmd = pathArray.get(0); |
178 | pathArray.erase(0); // erase "cmd" | 184 | pathArray.erase(0); // erase "cmd" |
179 | bool handled = LLCommandDispatcher::dispatch(cmd, pathArray, uri.queryMap()); | 185 | bool handled = LLCommandDispatcher::dispatch( |
186 | cmd, from_external_browser, pathArray, uri.queryMap()); | ||
180 | return handled; | 187 | return handled; |
181 | } | 188 | } |
182 | 189 | ||
@@ -197,7 +204,8 @@ bool LLURLDispatcherImpl::dispatchRegion(const std::string& url, BOOL right_mous | |||
197 | LLURLSimString::setString(url); | 204 | LLURLSimString::setString(url); |
198 | // We're at the login screen, so make sure user can see | 205 | // We're at the login screen, so make sure user can see |
199 | // the login location box to know where they are going. | 206 | // the login location box to know where they are going. |
200 | LLPanelLogin::loadLoginPage(); | 207 | |
208 | LLPanelLogin::refreshLocation( true ); | ||
201 | return true; | 209 | return true; |
202 | } | 210 | } |
203 | 211 | ||
@@ -297,7 +305,9 @@ std::string LLURLDispatcherImpl::stripProtocol(const std::string& url) | |||
297 | class LLTeleportHandler : public LLCommandHandler | 305 | class LLTeleportHandler : public LLCommandHandler |
298 | { | 306 | { |
299 | public: | 307 | public: |
300 | LLTeleportHandler() : LLCommandHandler("teleport") { } | 308 | // not allowed from outside the app |
309 | LLTeleportHandler() : LLCommandHandler("teleport", false) { } | ||
310 | |||
301 | bool handle(const LLSD& tokens, const LLSD& queryMap) | 311 | bool handle(const LLSD& tokens, const LLSD& queryMap) |
302 | { | 312 | { |
303 | // construct a "normal" SLURL, resolve the region to | 313 | // construct a "normal" SLURL, resolve the region to |
@@ -337,12 +347,28 @@ bool LLURLDispatcher::isSLURLCommand(const std::string& url) | |||
337 | } | 347 | } |
338 | 348 | ||
339 | // static | 349 | // static |
340 | bool LLURLDispatcher::dispatch(const std::string& url) | 350 | bool LLURLDispatcher::dispatch(const std::string& url, bool from_external_browser) |
341 | { | 351 | { |
342 | return LLURLDispatcherImpl::dispatch(url); | 352 | return LLURLDispatcherImpl::dispatch(url, from_external_browser); |
343 | } | 353 | } |
344 | // static | 354 | // static |
345 | bool LLURLDispatcher::dispatchRightClick(const std::string& url) | 355 | bool LLURLDispatcher::dispatchRightClick(const std::string& url) |
346 | { | 356 | { |
347 | return LLURLDispatcherImpl::dispatchRightClick(url); | 357 | return LLURLDispatcherImpl::dispatchRightClick(url); |
348 | } | 358 | } |
359 | |||
360 | // static | ||
361 | bool LLURLDispatcher::dispatchFromTextEditor(const std::string& url) | ||
362 | { | ||
363 | // text editors are by definition internal to our code | ||
364 | const bool from_external_browser = false; | ||
365 | return LLURLDispatcherImpl::dispatch(url, from_external_browser); | ||
366 | } | ||
367 | |||
368 | // static | ||
369 | std::string LLURLDispatcher::buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z) | ||
370 | { | ||
371 | std::string slurl = SLURL_SLURL_PREFIX + regionname + llformat("/%d/%d/%d",x,y,z); | ||
372 | slurl = LLWeb::escapeURL( slurl ); | ||
373 | return slurl; | ||
374 | } | ||