summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slixmpp/plugins/xep_0152/reachability.py39
1 files changed, 15 insertions, 24 deletions
diff --git a/slixmpp/plugins/xep_0152/reachability.py b/slixmpp/plugins/xep_0152/reachability.py
index 0ca0ae68..3c1a23aa 100644
--- a/slixmpp/plugins/xep_0152/reachability.py
+++ b/slixmpp/plugins/xep_0152/reachability.py
@@ -8,6 +8,8 @@
import logging
+from asyncio import Future
+
from slixmpp import JID
from typing import Dict, List, Optional, Callable
from slixmpp.plugins.base import BasePlugin
@@ -37,17 +39,12 @@ class XEP_0152(BasePlugin):
self.xmpp['xep_0163'].register_pep('reachability', Reachability)
def publish_reachability(self, addresses: List[Dict[str, str]],
- options: Optional[Form] = None,
- ifrom: Optional[JID] = None,
- callback: Optional[Callable] = None,
- timeout: Optional[int] = None,
- timeout_callback: Optional[Callable] = None):
+ **pubsubkwargs) -> Future:
"""
Publish alternative addresses where the user can be reached.
:param addresses: A list of dictionaries containing the URI and
optional description for each address.
- :param options: Optional form of publish options.
"""
if not isinstance(addresses, (list, tuple)):
addresses = [addresses]
@@ -60,25 +57,19 @@ class XEP_0152(BasePlugin):
for key, val in address.items():
addr[key] = val
reach.append(addr)
- return self.xmpp['xep_0163'].publish(reach,
- node=Reachability.namespace,
- options=options,
- ifrom=ifrom,
- callback=callback,
- timeout=timeout,
- timeout_callback=timeout_callback)
-
- def stop(self, ifrom: Optional[JID] = None,
- callback: Optional[Callable] = None,
- timeout: Optional[int] = None,
- timeout_callback: Optional[Callable] = None):
+ return self.xmpp['xep_0163'].publish(
+ reach,
+ node=Reachability.namespace,
+ **pubsubkwargs
+ )
+
+ def stop(self, **pubsubkwargs) -> Future:
"""
Clear existing user activity information to stop notifications.
"""
reach = Reachability()
- return self.xmpp['xep_0163'].publish(reach,
- node=Reachability.namespace,
- ifrom=ifrom,
- callback=callback,
- timeout=timeout,
- timeout_callback=timeout_callback)
+ return self.xmpp['xep_0163'].publish(
+ reach,
+ node=Reachability.namespace,
+ **pubsubkwargs
+ )