summaryrefslogtreecommitdiff
path: root/slixmpp/plugins/xep_0202/time.py
diff options
context:
space:
mode:
authorLink Mauve <linkmauve@linkmauve.fr>2020-12-10 19:45:30 +0100
committerLink Mauve <linkmauve@linkmauve.fr>2020-12-10 19:45:30 +0100
commit1e2d15b8f58249b31dd5882772d58add1369fc37 (patch)
tree6d39e5fc8241884acf30b209a07ef4cabd80c323 /slixmpp/plugins/xep_0202/time.py
parentd37182804102682a715df43c48a6d874835cd71a (diff)
parent155fc58a22d631746436a81119a94c80d6ea2d2b (diff)
downloadslixmpp-1e2d15b8f58249b31dd5882772d58add1369fc37.tar.gz
slixmpp-1e2d15b8f58249b31dd5882772d58add1369fc37.tar.bz2
slixmpp-1e2d15b8f58249b31dd5882772d58add1369fc37.tar.xz
slixmpp-1e2d15b8f58249b31dd5882772d58add1369fc37.zip
Merge branch 'docs-event-sphinx-plugins' into 'master'
Docs: add more events, add plugins to the doc See merge request poezio/slixmpp!84
Diffstat (limited to 'slixmpp/plugins/xep_0202/time.py')
-rw-r--r--slixmpp/plugins/xep_0202/time.py20
1 files changed, 7 insertions, 13 deletions
diff --git a/slixmpp/plugins/xep_0202/time.py b/slixmpp/plugins/xep_0202/time.py
index 2b40dbb2..bec3a771 100644
--- a/slixmpp/plugins/xep_0202/time.py
+++ b/slixmpp/plugins/xep_0202/time.py
@@ -8,6 +8,9 @@
import logging
+from typing import Optional
+
+from slixmpp import JID
from slixmpp.stanza.iq import Iq
from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.xmlstream.handler import Callback
@@ -61,7 +64,7 @@ class XEP_0202(BasePlugin):
def session_bind(self, jid):
self.xmpp['xep_0030'].add_feature('urn:xmpp:time')
- def _handle_time_request(self, iq):
+ def _handle_time_request(self, iq: Iq):
"""
Respond to a request for the local time.
@@ -69,26 +72,17 @@ class XEP_0202(BasePlugin):
during plugin configuration with a function that maps JIDs to
times.
- Arguments:
- iq -- The Iq time request stanza.
+ :param iq: The Iq time request stanza.
"""
iq = iq.reply()
iq['entity_time']['time'] = self.local_time(iq['to'])
iq.send()
- def get_entity_time(self, to, ifrom=None, **iqargs):
+ def get_entity_time(self, to: JID, ifrom: Optional[JID] = None, **iqargs):
"""
Request the time from another entity.
- Arguments:
- to -- JID of the entity to query.
- ifrom -- Specifiy the sender's JID.
- block -- If true, block and wait for the stanzas' reply.
- timeout -- The time in seconds to block while waiting for
- a reply. If None, then wait indefinitely.
- callback -- Optional callback to execute when a reply is
- received instead of blocking and waiting for
- the reply.
+ :param to: JID of the entity to query.
"""
iq = self.xmpp.Iq()
iq['type'] = 'get'