XEP-0196: Fix return values and typing

This commit is contained in:
mathieui 2021-02-03 22:24:40 +01:00
parent e6e57f6e8c
commit cb3d9dd41c
3 changed files with 25 additions and 38 deletions

View file

@ -1,10 +1,7 @@
""" # Slixmpp: The Slick XMPP Library
Slixmpp: The Slick XMPP Library # Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout
Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout # This file is part of Slixmpp.
This file is part of Slixmpp. # See the file LICENSE for copying permission.
See the file LICENSE for copying permission.
"""
from slixmpp.plugins.base import register_plugin from slixmpp.plugins.base import register_plugin

View file

@ -1,10 +1,7 @@
""" # Slixmpp: The Slick XMPP Library
Slixmpp: The Slick XMPP Library # Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout
Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout # This file is part of Slixmpp.
This file is part of Slixmpp. # See the file LICENSE for copying permission.
See the file LICENSE for copying permission.
"""
from slixmpp.xmlstream import ElementBase, ET from slixmpp.xmlstream import ElementBase, ET

View file

@ -1,13 +1,11 @@
""" # Slixmpp: The Slick XMPP Library
Slixmpp: The Slick XMPP Library # Copyright (C) 2011 Nathanael C. Fritz, Lance J.T. Stout
Copyright (C) 2011 Nathanael C. Fritz, Lance J.T. Stout # This file is part of Slixmpp.
This file is part of Slixmpp. # See the file LICENSE for copying permission.
See the file LICENSE for copying permission.
"""
import logging import logging
from asyncio import Future
from slixmpp import JID from slixmpp import JID
from typing import Optional, Callable from typing import Optional, Callable
from slixmpp.plugins.base import BasePlugin from slixmpp.plugins.base import BasePlugin
@ -43,11 +41,7 @@ class XEP_0196(BasePlugin):
character_name: Optional[str] = None, character_name: Optional[str] = None,
character_profile: Optional[str] = None, character_profile: Optional[str] = None,
server_address: Optional[str] = None, server_address: Optional[str] = None,
options: Optional[Form] = None, **pubsubkwargs) -> Future:
ifrom: Optional[JID] = None,
callback: Optional[Callable] = None,
timeout: Optional[int] = None,
timeout_callback: Optional[Callable]=None):
""" """
Publish the user's current gaming status. Publish the user's current gaming status.
@ -69,20 +63,19 @@ class XEP_0196(BasePlugin):
gaming['character_profile'] = character_profile gaming['character_profile'] = character_profile
gaming['server_name'] = server_name gaming['server_name'] = server_name
gaming['server_address'] = server_address gaming['server_address'] = server_address
return self.xmpp['xep_0163'].publish(gaming, return self.xmpp['xep_0163'].publish(
node=UserGaming.namespace, gaming,
options=options, ifrom=ifrom, node=UserGaming.namespace,
callback=callback, timeout=timeout, **pubsubkwargs
timeout_callback=timeout_callback) )
def stop(self, ifrom=None, callback=None, timeout=None, def stop(self, **pubsubkwargs) -> Future:
timeout_callback=None):
""" """
Clear existing user gaming information to stop notifications. Clear existing user gaming information to stop notifications.
""" """
gaming = UserGaming() gaming = UserGaming()
return self.xmpp['xep_0163'].publish(gaming, return self.xmpp['xep_0163'].publish(
node=UserGaming.namespace, gaming,
ifrom=ifrom, callback=callback, node=UserGaming.namespace,
timeout=timeout, **pubsubkwargs
timeout_callback=timeout_callback) )