aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llurldispatcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llurldispatcher.cpp')
-rw-r--r--linden/indra/newview/llurldispatcher.cpp128
1 files changed, 82 insertions, 46 deletions
diff --git a/linden/indra/newview/llurldispatcher.cpp b/linden/indra/newview/llurldispatcher.cpp
index e49e9e5..880822a 100644
--- a/linden/indra/newview/llurldispatcher.cpp
+++ b/linden/indra/newview/llurldispatcher.cpp
@@ -35,11 +35,10 @@
35// viewer includes 35// viewer includes
36#include "llagent.h" // teleportViaLocation() 36#include "llagent.h" // teleportViaLocation()
37#include "llcommandhandler.h" 37#include "llcommandhandler.h"
38// *FIX: code in merge sl-search-8 38#include "llfloaterurldisplay.h"
39//#include "llfloaterurldisplay.h"
40#include "llfloaterdirectory.h" 39#include "llfloaterdirectory.h"
41#include "llfloaterhtmlhelp.h" 40#include "llfloaterhtmlhelp.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"
@@ -88,11 +87,10 @@ private:
88 // handles secondlife://Ahern/123/45/67/ 87 // handles secondlife://Ahern/123/45/67/
89 // Returns true if handled. 88 // Returns true if handled.
90 89
91// *FIX: code in merge sl-search-8 90 static void regionHandleCallback(U64 handle, const std::string& url,
92// static void regionHandleCallback(U64 handle, const std::string& url, 91 const LLUUID& snapshot_id, bool teleport);
93// const LLUUID& snapshot_id, bool teleport); 92 // Called by LLWorldMap when a region name has been resolved to a
94// // Called by LLWorldMap when a region name has been resolved to a 93 // location in-world, used by places-panel display.
95// // location in-world, used by places-panel display.
96 94
97 static bool matchPrefix(const std::string& url, const std::string& prefix); 95 static bool matchPrefix(const std::string& url, const std::string& prefix);
98 96
@@ -151,7 +149,9 @@ bool LLURLDispatcherImpl::dispatchHelp(const std::string& url, BOOL right_mouse)
151{ 149{
152 if (matchPrefix(url, SLURL_SL_HELP_PREFIX)) 150 if (matchPrefix(url, SLURL_SL_HELP_PREFIX))
153 { 151 {
152#if LL_LIBXUL_ENABLED
154 gViewerHtmlHelp.show(); 153 gViewerHtmlHelp.show();
154#endif // LL_LIBXUL_ENABLED
155 return true; 155 return true;
156 } 156 }
157 return false; 157 return false;
@@ -228,13 +228,52 @@ bool LLURLDispatcherImpl::dispatchRegion(const std::string& url, BOOL right_mous
228 S32 y = 128; 228 S32 y = 128;
229 S32 z = 0; 229 S32 z = 0;
230 LLURLSimString::parse(sim_string, &region_name, &x, &y, &z); 230 LLURLSimString::parse(sim_string, &region_name, &x, &y, &z);
231 if (gFloaterWorldMap) 231
232 LLFloaterURLDisplay* url_displayp = LLFloaterURLDisplay::getInstance(LLSD());
233 url_displayp->setName(region_name);
234
235 // Request a region handle by name
236 gWorldMap->sendNamedRegionRequest(region_name,
237 LLURLDispatcherImpl::regionHandleCallback,
238 url,
239 false); // don't teleport
240 return true;
241}
242
243/*static*/
244void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport)
245{
246 std::string sim_string = stripProtocol(url);
247 std::string region_name;
248 S32 x = 128;
249 S32 y = 128;
250 S32 z = 0;
251 LLURLSimString::parse(sim_string, &region_name, &x, &y, &z);
252
253 LLVector3 local_pos;
254 local_pos.mV[VX] = (F32)x;
255 local_pos.mV[VY] = (F32)y;
256 local_pos.mV[VZ] = (F32)z;
257
258 if (teleport)
232 { 259 {
233 llinfos << "Opening map to " << region_name << llendl; 260 LLVector3d global_pos = from_region_handle(region_handle);
234 gFloaterWorldMap->trackURL( region_name.c_str(), x, y, z ); 261 global_pos += LLVector3d(local_pos);
235 LLFloaterWorldMap::show(NULL, TRUE); 262 gAgent.teleportViaLocation(global_pos);
263 }
264 else
265 {
266 // display informational floater, allow user to click teleport btn
267 LLFloaterURLDisplay* url_displayp = LLFloaterURLDisplay::getInstance(LLSD());
268
269 url_displayp->displayParcelInfo(region_handle, local_pos);
270 if(snapshot_id.notNull())
271 {
272 url_displayp->setSnapshotDisplay(snapshot_id);
273 }
274 std::string locationString = llformat("%s %d, %d, %d", region_name.c_str(), x, y, z);
275 url_displayp->setLocationString(locationString);
236 } 276 }
237 return true;
238} 277}
239 278
240// static 279// static
@@ -268,38 +307,36 @@ std::string LLURLDispatcherImpl::stripProtocol(const std::string& url)
268 return stripped; 307 return stripped;
269} 308}
270 309
271// *FIX: code in merge sl-search-8 310//---------------------------------------------------------------------------
272// 311// Teleportation links are handled here because they are tightly coupled
273////--------------------------------------------------------------------------- 312// to URL parsing and sim-fragment parsing
274//// Teleportation links are handled here because they are tightly coupled 313class LLTeleportHandler : public LLCommandHandler
275//// to URL parsing and sim-fragment parsing 314{
276//class LLTeleportHandler : public LLCommandHandler 315public:
277//{ 316 LLTeleportHandler() : LLCommandHandler("teleport") { }
278//public: 317 bool handle(const std::vector<std::string>& tokens)
279// LLTeleportHandler() : LLCommandHandler("teleport") { } 318 {
280// bool handle(const std::vector<std::string>& tokens) 319 // construct a "normal" SLURL, resolve the region to
281// { 320 // a global position, and teleport to it
282// // construct a "normal" SLURL, resolve the region to 321 if (tokens.size() < 1) return false;
283// // a global position, and teleport to it 322
284// if (tokens.size() < 1) return false; 323 // Region names may be %20 escaped.
285// 324 std::string region_name = LLURLSimString::unescapeRegionName(tokens[0]);
286// // Region names may be %20 escaped. 325
287// std::string region_name = LLURLSimString::unescapeRegionName(tokens[0]); 326 // build secondlife://De%20Haro/123/45/67 for use in callback
288// 327 std::string url = SLURL_SECONDLIFE_PREFIX;
289// // build secondlife://De%20Haro/123/45/67 for use in callback 328 for (size_t i = 0; i < tokens.size(); ++i)
290// std::string url = SLURL_SECONDLIFE_PREFIX; 329 {
291// for (size_t i = 0; i < tokens.size(); ++i) 330 url += tokens[i] + "/";
292// { 331 }
293// url += tokens[i] + "/"; 332 gWorldMap->sendNamedRegionRequest(region_name,
294// } 333 LLURLDispatcherImpl::regionHandleCallback,
295// gWorldMap->sendNamedRegionRequest(region_name, 334 url,
296// LLURLDispatcherImpl::regionHandleCallback, 335 true); // teleport
297// url, 336 return true;
298// true); // teleport 337 }
299// return true; 338};
300// } 339LLTeleportHandler gTeleportHandler;
301//};
302//LLTeleportHandler gTeleportHandler;
303 340
304//--------------------------------------------------------------------------- 341//---------------------------------------------------------------------------
305 342
@@ -325,4 +362,3 @@ bool LLURLDispatcher::dispatchRightClick(const std::string& url)
325{ 362{
326 return LLURLDispatcherImpl::dispatchRightClick(url); 363 return LLURLDispatcherImpl::dispatchRightClick(url);
327} 364}
328