Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Daniel Brötzmann
python-nbxmpp
Commits
dd866a27
Commit
dd866a27
authored
Oct 11, 2020
by
Philipp Hörist
Browse files
Location: Use tasks
parent
8e99facd
Changes
1
Hide whitespace changes
Inline
Side-by-side
nbxmpp/modules/location.py
View file @
dd866a27
...
...
@@ -21,6 +21,8 @@ from nbxmpp.structs import StanzaHandler
from
nbxmpp.structs
import
LocationData
from
nbxmpp.const
import
LOCATION_DATA
from
nbxmpp.modules.base
import
BaseModule
from
nbxmpp.modules.util
import
finalize
from
nbxmpp.task
import
iq_request_task
class
Location
(
BaseModule
):
...
...
@@ -67,7 +69,10 @@ class Location(BaseModule):
properties
.
pubsub_event
=
pubsub_event
@
iq_request_task
def
set_location
(
self
,
data
):
task
=
yield
item
=
Node
(
'geoloc'
,
{
'xmlns'
:
Namespace
.
LOCATION
})
if
data
is
not
None
:
data
=
data
.
_asdict
()
...
...
@@ -75,4 +80,6 @@ class Location(BaseModule):
if
value
is
not
None
:
item
.
addChild
(
tag
,
payload
=
value
)
self
.
publish
(
Namespace
.
LOCATION
,
item
,
id_
=
'current'
)
result
=
yield
self
.
publish
(
Namespace
.
LOCATION
,
item
,
id_
=
'current'
)
yield
finalize
(
task
,
result
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment