XEP-0128: API changes
- ``set_extended_info``, ``add_extended_info`` and ``del_extended_info`` return Futures.
This commit is contained in:
parent
4960cffcb4
commit
e24e2f58d4
2 changed files with 49 additions and 6 deletions
|
@ -7,3 +7,36 @@ XEP-0128: Service Discovery Extensions
|
|||
.. autoclass:: XEP_0128
|
||||
:members:
|
||||
:exclude-members: session_bind, plugin_init, plugin_end
|
||||
|
||||
Internal API methods
|
||||
--------------------
|
||||
|
||||
|
||||
|
||||
.. glossary::
|
||||
|
||||
add_extended_info
|
||||
- **jid**: JID to set the extended info for
|
||||
- **node**: note to set the info at
|
||||
- **ifrom**: unused
|
||||
- **args**: A :class:`~.Form` or list of forms to add to the disco
|
||||
extended info for this JID/node.
|
||||
|
||||
Add extended info for a JID/node.
|
||||
|
||||
set_extended_info
|
||||
- **jid**: JID to set the extended info for
|
||||
- **node**: note to set the info at
|
||||
- **ifrom**: unused
|
||||
- **args**: A :class:`~.Form` or list of forms to set as the disco
|
||||
extended info for this JID/node.
|
||||
|
||||
Set extended info for a JID/node.
|
||||
|
||||
del_extended_info
|
||||
- **jid**: JID to delete the extended info from
|
||||
- **node**: note to delete the info from
|
||||
- **ifrom**: unused
|
||||
- **args**: unused
|
||||
|
||||
Delete extended info for a JID/node.
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
# See the file LICENSE for copying permission.
|
||||
import logging
|
||||
|
||||
from asyncio import Future
|
||||
from typing import Optional
|
||||
|
||||
import slixmpp
|
||||
|
@ -53,37 +54,46 @@ class XEP_0128(BasePlugin):
|
|||
for op in self._disco_ops:
|
||||
self.api.register(getattr(self.static, op), op, default=True)
|
||||
|
||||
def set_extended_info(self, jid=None, node=None, **kwargs):
|
||||
def set_extended_info(self, jid=None, node=None, **kwargs) -> Future:
|
||||
"""
|
||||
Set additional, extended identity information to a node.
|
||||
|
||||
Replaces any existing extended information.
|
||||
|
||||
.. versionchanged:: 1.8.0
|
||||
This function now returns a Future.
|
||||
|
||||
:param jid: The JID to modify.
|
||||
:param node: The node to modify.
|
||||
:param data: Either a form, or a list of forms to use
|
||||
as extended information, replacing any
|
||||
existing extensions.
|
||||
"""
|
||||
self.api['set_extended_info'](jid, node, None, kwargs)
|
||||
return self.api['set_extended_info'](jid, node, None, kwargs)
|
||||
|
||||
def add_extended_info(self, jid=None, node=None, **kwargs):
|
||||
def add_extended_info(self, jid=None, node=None, **kwargs) -> Future:
|
||||
"""
|
||||
Add additional, extended identity information to a node.
|
||||
|
||||
.. versionchanged:: 1.8.0
|
||||
This function now returns a Future.
|
||||
|
||||
:param jid: The JID to modify.
|
||||
:param node: The node to modify.
|
||||
:param data: Either a form, or a list of forms to add
|
||||
as extended information.
|
||||
"""
|
||||
self.api['add_extended_info'](jid, node, None, kwargs)
|
||||
return self.api['add_extended_info'](jid, node, None, kwargs)
|
||||
|
||||
def del_extended_info(self, jid: Optional[JID] = None,
|
||||
node: Optional[str] = None, **kwargs):
|
||||
node: Optional[str] = None, **kwargs) -> Future:
|
||||
"""
|
||||
Remove all extended identity information to a node.
|
||||
|
||||
.. versionchanged:: 1.8.0
|
||||
This function now returns a Future.
|
||||
|
||||
:param jid: The JID to modify.
|
||||
:param node: The node to modify.
|
||||
"""
|
||||
self.api['del_extended_info'](jid, node, None, kwargs)
|
||||
return self.api['del_extended_info'](jid, node, None, kwargs)
|
||||
|
|
Loading…
Reference in a new issue