plugin XEP-0384: Fully reworked to adjust to the reworked python-omemo:
- support for both (modern) OMEMO under the `urn:xmpp:omemo:2` namespace and (legacy) OMEMO under the `eu.siacs.conversations.axolotl` namespace - maintains one identity across both versions of OMEMO - migrates data from the old plugin - includes more features for protocol stability - uses SCE for modern OMEMO - fully type-checked, linted and format-checked - added type hints to various pieces of backend code used by the plugin - added stubs for some Twisted APIs used by the plugin under stubs/ (use `export MYPYPATH=stubs/` before running mypy) - core (xmpp): enabled `send` trigger and made it an asyncPoint fix 375
This commit is contained in:
parent
6eac59dc2d
commit
75ae8160ae
1 changed files with 2202 additions and 1414 deletions
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
from collections import namedtuple
|
||||
from functools import reduce
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union, Callable
|
||||
from typing import Any, Dict, Iterable, List, Optional, Tuple, Union, Callable
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
|
|
@ -39,6 +39,7 @@ from sat.core.constants import Const as C
|
|||
from sat.core.core_types import SatXMPPEntity
|
||||
from sat.core.i18n import _
|
||||
from sat.core.log import getLogger
|
||||
from sat.core.xmpp import SatXMPPClient
|
||||
from sat.tools import utils
|
||||
from sat.tools import sat_defer
|
||||
from sat.tools import xml_tools
|
||||
|
|
@ -538,17 +539,22 @@ class XEP_0060(object):
|
|||
))
|
||||
|
||||
async def sendItem(
|
||||
self, client, service, nodeIdentifier, payload, item_id=None, extra=None
|
||||
):
|
||||
self,
|
||||
client: SatXMPPClient,
|
||||
service: Union[jid.JID, None],
|
||||
nodeIdentifier: str,
|
||||
payload: domish.Element,
|
||||
item_id: Optional[str] = None,
|
||||
extra: Optional[Dict[str, Any]] = None
|
||||
) -> Optional[str]:
|
||||
"""High level method to send one item
|
||||
|
||||
@param service(jid.JID, None): service to send the item to
|
||||
None to use PEP
|
||||
@param NodeIdentifier(unicode): PubSub node to use
|
||||
@param payload(domish.Element): payload of the item to send
|
||||
@param item_id(unicode, None): id to use or None to create one
|
||||
@param extra(dict, None): extra option, not used yet
|
||||
@return (unicode, None): id of the created item
|
||||
@param service: service to send the item to None to use PEP
|
||||
@param NodeIdentifier: PubSub node to use
|
||||
@param payload: payload of the item to send
|
||||
@param item_id: id to use or None to create one
|
||||
@param extra: extra options
|
||||
@return: id of the created item
|
||||
"""
|
||||
assert isinstance(payload, domish.Element)
|
||||
item_elt = domish.Element((pubsub.NS_PUBSUB, 'item'))
|
||||
|
|
@ -1090,7 +1096,12 @@ class XEP_0060(object):
|
|||
client, jid.JID(service_s) if service_s else None, nodeIdentifier
|
||||
)
|
||||
|
||||
def deleteNode(self, client, service, nodeIdentifier):
|
||||
def deleteNode(
|
||||
self,
|
||||
client: SatXMPPClient,
|
||||
service: jid.JID,
|
||||
nodeIdentifier: str
|
||||
) -> defer.Deferred:
|
||||
return client.pubsub_client.deleteNode(service, nodeIdentifier)
|
||||
|
||||
def _addWatch(self, service_s, node, profile_key):
|
||||
|
|
@ -1132,12 +1143,12 @@ class XEP_0060(object):
|
|||
|
||||
def retractItems(
|
||||
self,
|
||||
client,
|
||||
service,
|
||||
nodeIdentifier,
|
||||
itemIdentifiers,
|
||||
notify=True,
|
||||
):
|
||||
client: SatXMPPClient,
|
||||
service: jid.JID,
|
||||
nodeIdentifier: str,
|
||||
itemIdentifiers: Iterable[str],
|
||||
notify: bool = True,
|
||||
) -> defer.Deferred:
|
||||
return client.pubsub_client.retractItems(
|
||||
service, nodeIdentifier, itemIdentifiers, notify=notify
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue