Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
8ebd4c7b
Commit
8ebd4c7b
authored
6 years ago
by
callum_linden
Browse files
Options
Downloads
Patches
Plain Diff
Pull in @Nat's changes to make teleports work correctly
parent
5cc74835
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/newview/llurldispatcher.cpp
+48
-3
48 additions, 3 deletions
indra/newview/llurldispatcher.cpp
with
48 additions
and
3 deletions
indra/newview/llurldispatcher.cpp
+
48
−
3
View file @
8ebd4c7b
...
...
@@ -47,6 +47,7 @@
// library includes
#include
"llnotificationsutil.h"
#include
"llsd.h"
#include
"stringize.h"
static
LLURLDispatcherListener
sURLDispatcherListener
;
...
...
@@ -255,14 +256,23 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL&
// Teleportation links are handled here because they are tightly coupled
// to SLURL parsing and sim-fragment parsing
class
LLTeleportHandler
:
public
LLCommandHandler
class
LLTeleportHandler
:
public
LLCommandHandler
,
public
LLEventAPI
{
public:
// Teleport requests *must* come from a trusted browser
// inside the app, otherwise a malicious web page could
// cause a constant teleport loop. JC
LLTeleportHandler
()
:
LLCommandHandler
(
"teleport"
,
UNTRUSTED_THROTTLE
)
{
}
LLTeleportHandler
()
:
LLCommandHandler
(
"teleport"
,
UNTRUSTED_THROTTLE
),
LLEventAPI
(
"LLTeleportHandler"
,
"Low-level teleport API"
)
{
LLEventAPI
::
add
(
"teleport"
,
"Teleport to specified [
\"
regionname
\"
] at
\n
"
"specified region-relative [
\"
x
\"
], [
\"
y
\"
], [
\"
z
\"
].
\n
"
"If [
\"
regionname
\"
] omitted, teleport to GLOBAL
\n
"
"coordinates [
\"
x
\"
], [
\"
y
\"
], [
\"
z
\"
]."
,
&
LLTeleportHandler
::
from_event
);
}
bool
handle
(
const
LLSD
&
tokens
,
const
LLSD
&
query_map
,
LLMediaCtrl
*
web
)
...
...
@@ -293,6 +303,41 @@ class LLTeleportHandler : public LLCommandHandler
return
true
;
}
void
from_event
(
const
LLSD
&
params
)
const
{
Response
response
(
LLSD
(),
params
);
if
(
params
.
has
(
"regionname"
))
{
// region specified, coordinates (if any) are region-local
LLVector3
local_pos
(
params
.
has
(
"x"
)
?
params
[
"x"
].
asReal
()
:
128
,
params
.
has
(
"y"
)
?
params
[
"y"
].
asReal
()
:
128
,
params
.
has
(
"z"
)
?
params
[
"z"
].
asReal
()
:
0
);
std
::
string
regionname
(
params
[
"regionname"
]);
std
::
string
destination
(
LLSLURL
(
regionname
,
local_pos
).
getSLURLString
());
// have to resolve region's global coordinates first
teleport_via_slapp
(
regionname
,
destination
);
response
[
"message"
]
=
"Teleporting to "
+
destination
;
}
else
// no regionname
{
// coordinates are global, and at least (x, y) are required
if
(
!
(
params
.
has
(
"x"
)
&&
params
.
has
(
"y"
)))
{
return
response
.
error
(
"Specify either regionname or global (x, y)"
);
}
LLVector3d
global_pos
(
params
[
"x"
].
asReal
(),
params
[
"y"
].
asReal
(),
params
[
"z"
].
asReal
());
gAgent
.
teleportViaLocation
(
global_pos
);
LLFloaterWorldMap
*
instance
=
LLFloaterWorldMap
::
getInstance
();
if
(
instance
)
{
instance
->
trackLocation
(
global_pos
);
}
response
[
"message"
]
=
STRINGIZE
(
"Teleporting to global "
<<
global_pos
);
}
}
static
void
teleport_via_slapp
(
std
::
string
region_name
,
std
::
string
callback_url
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment