summaryrefslogtreecommitdiff
path: root/slixmpp/plugins/xep_0118
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-02-03 22:24:03 +0100
committermathieui <mathieui@mathieui.net>2021-02-03 22:24:03 +0100
commit64299d6a5453c5c982a3daec74c41803458bdc75 (patch)
tree21194f309651d07caa48f749fb21cf352160f919 /slixmpp/plugins/xep_0118
parentf6761e513d820e658cd4fda9fa054f2e1787d4b8 (diff)
downloadslixmpp-64299d6a5453c5c982a3daec74c41803458bdc75.tar.gz
slixmpp-64299d6a5453c5c982a3daec74c41803458bdc75.tar.bz2
slixmpp-64299d6a5453c5c982a3daec74c41803458bdc75.tar.xz
slixmpp-64299d6a5453c5c982a3daec74c41803458bdc75.zip
XEP-0118: Fix return values and typing
Diffstat (limited to 'slixmpp/plugins/xep_0118')
-rw-r--r--slixmpp/plugins/xep_0118/stanza.py11
-rw-r--r--slixmpp/plugins/xep_0118/user_tune.py47
2 files changed, 26 insertions, 32 deletions
diff --git a/slixmpp/plugins/xep_0118/stanza.py b/slixmpp/plugins/xep_0118/stanza.py
index 579fcbf0..ad66ddbb 100644
--- a/slixmpp/plugins/xep_0118/stanza.py
+++ b/slixmpp/plugins/xep_0118/stanza.py
@@ -1,10 +1,7 @@
-"""
- Slixmpp: The Slick XMPP Library
- Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout
- This file is part of Slixmpp.
-
- See the file LICENSE for copying permission.
-"""
+# Slixmpp: The Slick XMPP Library
+# Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout
+# This file is part of Slixmpp.
+# See the file LICENSE for copying permission.
from slixmpp.xmlstream import ElementBase, ET
diff --git a/slixmpp/plugins/xep_0118/user_tune.py b/slixmpp/plugins/xep_0118/user_tune.py
index 4145dce6..112febbc 100644
--- a/slixmpp/plugins/xep_0118/user_tune.py
+++ b/slixmpp/plugins/xep_0118/user_tune.py
@@ -1,13 +1,12 @@
-"""
- Slixmpp: The Slick XMPP Library
- Copyright (C) 2011 Nathanael C. Fritz, Lance J.T. Stout
- This file is part of Slixmpp.
-
- See the file LICENSE for copying permission.
-"""
+# Slixmpp: The Slick XMPP Library
+# Copyright (C) 2011 Nathanael C. Fritz, Lance J.T. Stout
+# This file is part of Slixmpp.
+# See the file LICENSE for copying permission.
import logging
+from asyncio import Future
+from typing import Optional
from slixmpp.plugins.base import BasePlugin
from slixmpp.plugins.xep_0118 import stanza, UserTune
@@ -33,9 +32,11 @@ class XEP_0118(BasePlugin):
def session_bind(self, jid):
self.xmpp['xep_0163'].register_pep('user_tune', UserTune)
- def publish_tune(self, artist=None, length=None, rating=None, source=None,
- title=None, track=None, uri=None, options=None,
- ifrom=None, callback=None, timeout=None, timeout_callback=None):
+ def publish_tune(self, *, artist: Optional[str] = None,
+ length: Optional[int] =None, rating: Optional[int] = None,
+ source: Optional[str] = None, title: Optional[str] = None,
+ track: Optional[str] = None, uri: Optional[str] = None,
+ **pubsubkwargs) -> Future:
"""
Publish the user's current tune.
@@ -46,7 +47,6 @@ class XEP_0118(BasePlugin):
:param title: The title of the song.
:param track: The song's track number, or other unique identifier.
:param uri: A URL to more information about the song.
- :param options: Optional form of publish options.
"""
tune = UserTune()
tune['artist'] = artist
@@ -56,22 +56,19 @@ class XEP_0118(BasePlugin):
tune['title'] = title
tune['track'] = track
tune['uri'] = uri
- return self.xmpp['xep_0163'].publish(tune,
- node=UserTune.namespace,
- options=options,
- ifrom=ifrom,
- callback=callback,
- timeout=timeout,
- timeout_callback=timeout_callback)
+ return self.xmpp['xep_0163'].publish(
+ tune,
+ node=UserTune.namespace,
+ **pubsubkwargs
+ )
- def stop(self, ifrom=None, callback=None, timeout=None, timeout_callback=None):
+ def stop(self, **pubsubkwargs) -> Future:
"""
Clear existing user tune information to stop notifications.
"""
tune = UserTune()
- return self.xmpp['xep_0163'].publish(tune,
- node=UserTune.namespace,
- ifrom=ifrom,
- callback=callback,
- timeout=timeout,
- timeout_callback=timeout_callback)
+ return self.xmpp['xep_0163'].publish(
+ tune,
+ node=UserTune.namespace,
+ **pubsubkwargs
+ )