summaryrefslogtreecommitdiff
path: root/slixmpp/plugins/xep_0092/version.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-02-05 20:14:41 +0100
committermathieui <mathieui@mathieui.net>2021-02-05 20:14:41 +0100
commitcff4588499d74e392cab646a46217f069cb1ef01 (patch)
treee349f9d4b1f13b57d4df820b8f649c8deee2a726 /slixmpp/plugins/xep_0092/version.py
parentc82e1a4039dbf5d24990d28d665ba973fc9c9de7 (diff)
parent89601289fea2c6f2b47002926eb2609bd72d2a17 (diff)
downloadslixmpp-cff4588499d74e392cab646a46217f069cb1ef01.tar.gz
slixmpp-cff4588499d74e392cab646a46217f069cb1ef01.tar.bz2
slixmpp-cff4588499d74e392cab646a46217f069cb1ef01.tar.xz
slixmpp-cff4588499d74e392cab646a46217f069cb1ef01.zip
Merge branch 'updat-typing-and-generic-args' into 'master'
Update typing and generic args for plugins (step 1) See merge request poezio/slixmpp!120
Diffstat (limited to 'slixmpp/plugins/xep_0092/version.py')
-rw-r--r--slixmpp/plugins/xep_0092/version.py25
1 files changed, 11 insertions, 14 deletions
diff --git a/slixmpp/plugins/xep_0092/version.py b/slixmpp/plugins/xep_0092/version.py
index a60acd99..3a7b949f 100644
--- a/slixmpp/plugins/xep_0092/version.py
+++ b/slixmpp/plugins/xep_0092/version.py
@@ -8,8 +8,12 @@
import logging
+from asyncio import Future
+from typing import Optional
+
import slixmpp
-from slixmpp import Iq
+from slixmpp import JID
+from slixmpp.stanza import Iq
from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.xmlstream.handler import Callback
from slixmpp.xmlstream.matcher import StanzaPath
@@ -57,12 +61,11 @@ class XEP_0092(BasePlugin):
def session_bind(self, jid):
self.xmpp.plugin['xep_0030'].add_feature('jabber:iq:version')
- def _handle_version(self, iq):
+ def _handle_version(self, iq: Iq):
"""
Respond to a software version query.
- Arguments:
- iq -- The Iq stanza containing the software version query.
+ :param iq: The Iq stanza containing the software version query.
"""
iq = iq.reply()
if self.software_name:
@@ -75,18 +78,12 @@ class XEP_0092(BasePlugin):
iq['error']['condition'] = 'service-unavailable'
iq.send()
- def get_version(self, jid, ifrom=None, timeout=None, callback=None,
- timeout_callback=None):
+ def get_version(self, jid: JID, ifrom: Optional[JID] = None, **iqkwargs) -> Future:
"""
Retrieve the software version of a remote agent.
- Arguments:
- jid -- The JID of the entity to query.
+ :param jid: The JID of the entity to query.
"""
- iq = self.xmpp.Iq()
- iq['to'] = jid
- iq['from'] = ifrom
- iq['type'] = 'get'
+ iq = self.xmpp.make_iq_get(ito=jid, ifrom=ifrom)
iq['query'] = Version.namespace
- return iq.send(timeout=timeout, callback=callback,
- timeout_callback=timeout_callback)
+ return iq.send(**iqkwargs)