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:
Syndace 2022-08-23 21:06:24 +02:00
commit 75ae8160ae

View file

@ -26,6 +26,7 @@ from twisted.words.protocols.jabber import error as xmpp_error
from twisted.python import failure
from sat.core import exceptions
from sat.core.xmpp import SatXMPPClient
from sat.memory import memory
import time
@ -204,10 +205,10 @@ class XEP_0045(object):
return False
return True
def getRoom(self, client, room_jid):
def getRoom(self, client: SatXMPPClient, room_jid: jid.JID) -> muc.Room:
"""Retrieve Room instance from its jid
@param room_jid(jid.JID): jid of the room
@param room_jid: jid of the room
@raise exceptions.NotFound: the room has not been joined
"""
try:
@ -223,10 +224,10 @@ class XEP_0045(object):
if room_jid not in client._muc_client.joined_rooms:
raise exceptions.NotFound(_("This room has not been joined"))
def isJoinedRoom(self, client, room_jid):
def isJoinedRoom(self, client: SatXMPPClient, room_jid: jid.JID) -> bool:
"""Tell if a jid is a known and joined room
@room_jid(jid.JID): jid of the room
@room_jid: jid of the room
"""
try:
self.checkRoomJoined(client, room_jid)