refactoring: rename SAT class to LiberviaBackend
This commit is contained in:
parent
d2685ba11b
commit
af1c203450
9 changed files with 20 additions and 20 deletions
|
|
@ -55,7 +55,7 @@ import libervia.backend.plugins
|
||||||
|
|
||||||
log = getLogger(__name__)
|
log = getLogger(__name__)
|
||||||
|
|
||||||
class SAT(service.Service):
|
class LiberviaBackend(service.Service):
|
||||||
|
|
||||||
def _init(self):
|
def _init(self):
|
||||||
# we don't use __init__ to avoid doule initialisation with twistd
|
# we don't use __init__ to avoid doule initialisation with twistd
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
from libervia.backend.core.constants import Const as C
|
from libervia.backend.core.constants import Const as C
|
||||||
from libervia.backend.core.i18n import D_
|
from libervia.backend.core.i18n import D_
|
||||||
from libervia.backend.core.sat_main import SAT
|
from libervia.backend.core.sat_main import LiberviaBackend
|
||||||
from libervia.backend.tools import xmpp_datetime
|
from libervia.backend.tools import xmpp_datetime
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ class XEP_0082: # pylint: disable=invalid-name
|
||||||
actively, but offers API for other plugins to use.
|
actively, but offers API for other plugins to use.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, sat: SAT) -> None:
|
def __init__(self, sat: LiberviaBackend) -> None:
|
||||||
"""
|
"""
|
||||||
@param sat: The SAT instance.
|
@param sat: The SAT instance.
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ from libervia.backend.core.constants import Const as C
|
||||||
from libervia.backend.core.core_types import SatXMPPEntity
|
from libervia.backend.core.core_types import SatXMPPEntity
|
||||||
from libervia.backend.core.i18n import _, D_
|
from libervia.backend.core.i18n import _, D_
|
||||||
from libervia.backend.core.log import getLogger, Logger
|
from libervia.backend.core.log import getLogger, Logger
|
||||||
from libervia.backend.core.sat_main import SAT
|
from libervia.backend.core.sat_main import LiberviaBackend
|
||||||
from libervia.backend.core.xmpp import SatXMPPClient
|
from libervia.backend.core.xmpp import SatXMPPClient
|
||||||
from libervia.backend.memory import persistent
|
from libervia.backend.memory import persistent
|
||||||
from libervia.backend.plugins.plugin_xep_0045 import XEP_0045
|
from libervia.backend.plugins.plugin_xep_0045 import XEP_0045
|
||||||
|
|
@ -976,7 +976,7 @@ DEFAULT_TRUST_MODEL_PARAM = f"""
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def get_gpg_provider(sat: SAT, client: SatXMPPClient) -> GPGProvider:
|
def get_gpg_provider(sat: LiberviaBackend, client: SatXMPPClient) -> GPGProvider:
|
||||||
"""Get the GPG provider for a client.
|
"""Get the GPG provider for a client.
|
||||||
|
|
||||||
@param sat: The SAT instance.
|
@param sat: The SAT instance.
|
||||||
|
|
@ -1004,7 +1004,7 @@ class XEP_0373:
|
||||||
Implementation of XEP-0373: OpenPGP for XMPP under namespace ``urn:xmpp:openpgp:0``.
|
Implementation of XEP-0373: OpenPGP for XMPP under namespace ``urn:xmpp:openpgp:0``.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, host: SAT) -> None:
|
def __init__(self, host: LiberviaBackend) -> None:
|
||||||
"""
|
"""
|
||||||
@param sat: The SAT instance.
|
@param sat: The SAT instance.
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ from libervia.backend.core.constants import Const as C
|
||||||
from libervia.backend.core.core_types import SatXMPPEntity
|
from libervia.backend.core.core_types import SatXMPPEntity
|
||||||
from libervia.backend.core.i18n import _, D_
|
from libervia.backend.core.i18n import _, D_
|
||||||
from libervia.backend.core.log import getLogger, Logger
|
from libervia.backend.core.log import getLogger, Logger
|
||||||
from libervia.backend.core.sat_main import SAT
|
from libervia.backend.core.sat_main import LiberviaBackend
|
||||||
from libervia.backend.core.xmpp import SatXMPPClient
|
from libervia.backend.core.xmpp import SatXMPPClient
|
||||||
from libervia.backend.plugins.plugin_xep_0045 import XEP_0045
|
from libervia.backend.plugins.plugin_xep_0045 import XEP_0045
|
||||||
from libervia.backend.plugins.plugin_xep_0334 import XEP_0334
|
from libervia.backend.plugins.plugin_xep_0334 import XEP_0334
|
||||||
|
|
@ -71,7 +71,7 @@ class XEP_0374:
|
||||||
management, the two trust models "BTBV" and "manual" are supported.
|
management, the two trust models "BTBV" and "manual" are supported.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, sat: SAT) -> None:
|
def __init__(self, sat: LiberviaBackend) -> None:
|
||||||
"""
|
"""
|
||||||
@param sat: The SAT instance.
|
@param sat: The SAT instance.
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ from libervia.backend.core.constants import Const as C
|
||||||
from libervia.backend.core.core_types import MessageData, SatXMPPEntity
|
from libervia.backend.core.core_types import MessageData, SatXMPPEntity
|
||||||
from libervia.backend.core.i18n import _, D_
|
from libervia.backend.core.i18n import _, D_
|
||||||
from libervia.backend.core.log import getLogger, Logger
|
from libervia.backend.core.log import getLogger, Logger
|
||||||
from libervia.backend.core.sat_main import SAT
|
from libervia.backend.core.sat_main import LiberviaBackend
|
||||||
from libervia.backend.core.xmpp import SatXMPPClient
|
from libervia.backend.core.xmpp import SatXMPPClient
|
||||||
from libervia.backend.memory import persistent
|
from libervia.backend.memory import persistent
|
||||||
from libervia.backend.plugins.plugin_misc_text_commands import TextCommands
|
from libervia.backend.plugins.plugin_misc_text_commands import TextCommands
|
||||||
|
|
@ -803,7 +803,7 @@ async def send_trust_messages(
|
||||||
await client.a_send(message_data["xml"])
|
await client.a_send(message_data["xml"])
|
||||||
|
|
||||||
|
|
||||||
def make_session_manager(sat: SAT, profile: str) -> Type[omemo.SessionManager]:
|
def make_session_manager(sat: LiberviaBackend, profile: str) -> Type[omemo.SessionManager]:
|
||||||
"""
|
"""
|
||||||
@param sat: The SAT instance.
|
@param sat: The SAT instance.
|
||||||
@param profile: The profile.
|
@param profile: The profile.
|
||||||
|
|
@ -1389,7 +1389,7 @@ def make_session_manager(sat: SAT, profile: str) -> Type[omemo.SessionManager]:
|
||||||
|
|
||||||
|
|
||||||
async def prepare_for_profile(
|
async def prepare_for_profile(
|
||||||
sat: SAT,
|
sat: LiberviaBackend,
|
||||||
profile: str,
|
profile: str,
|
||||||
initial_own_label: Optional[str],
|
initial_own_label: Optional[str],
|
||||||
signed_pre_key_rotation_period: int = 7 * 24 * 60 * 60,
|
signed_pre_key_rotation_period: int = 7 * 24 * 60 * 60,
|
||||||
|
|
@ -1540,7 +1540,7 @@ class OMEMO:
|
||||||
custom_policies={}
|
custom_policies={}
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, sat: SAT) -> None:
|
def __init__(self, sat: LiberviaBackend) -> None:
|
||||||
"""
|
"""
|
||||||
@param sat: The SAT instance.
|
@param sat: The SAT instance.
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ from libervia.backend.core import exceptions
|
||||||
from libervia.backend.core.constants import Const as C
|
from libervia.backend.core.constants import Const as C
|
||||||
from libervia.backend.core.i18n import D_
|
from libervia.backend.core.i18n import D_
|
||||||
from libervia.backend.core.log import Logger, getLogger
|
from libervia.backend.core.log import Logger, getLogger
|
||||||
from libervia.backend.core.sat_main import SAT
|
from libervia.backend.core.sat_main import LiberviaBackend
|
||||||
from libervia.backend.tools.xml_tools import ElementParser
|
from libervia.backend.tools.xml_tools import ElementParser
|
||||||
from libervia.backend.plugins.plugin_xep_0033 import NS_ADDRESS
|
from libervia.backend.plugins.plugin_xep_0033 import NS_ADDRESS
|
||||||
from libervia.backend.plugins.plugin_xep_0082 import XEP_0082
|
from libervia.backend.plugins.plugin_xep_0082 import XEP_0082
|
||||||
|
|
@ -251,7 +251,7 @@ class XEP_0420: # pylint: disable=invalid-name
|
||||||
# potential future use.
|
# potential future use.
|
||||||
MUST_BE_PLAINTEXT_ELEMENTS: Set[Tuple[str, str]] = set()
|
MUST_BE_PLAINTEXT_ELEMENTS: Set[Tuple[str, str]] = set()
|
||||||
|
|
||||||
def __init__(self, sat: SAT) -> None:
|
def __init__(self, sat: LiberviaBackend) -> None:
|
||||||
"""
|
"""
|
||||||
@param sat: The SAT instance.
|
@param sat: The SAT instance.
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ from libervia.backend.core.log import getLogger
|
||||||
from twisted.protocols import basic
|
from twisted.protocols import basic
|
||||||
from twisted.internet import interfaces
|
from twisted.internet import interfaces
|
||||||
|
|
||||||
from libervia.backend.core.sat_main import SAT
|
from libervia.backend.core.sat_main import LiberviaBackend
|
||||||
|
|
||||||
log = getLogger(__name__)
|
log = getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ class SatFile:
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
host: SAT,
|
host: LiberviaBackend,
|
||||||
client: SatXMPPEntity,
|
client: SatXMPPEntity,
|
||||||
path: Union[str, Path],
|
path: Union[str, Path],
|
||||||
mode: str = "rb",
|
mode: str = "rb",
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ from unittest.mock import MagicMock, AsyncMock
|
||||||
from pytest import fixture
|
from pytest import fixture
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from twisted.words.protocols.jabber import jid
|
from twisted.words.protocols.jabber import jid
|
||||||
from libervia.backend.core.sat_main import SAT
|
from libervia.backend.core.sat_main import LiberviaBackend
|
||||||
from libervia.backend.tools import async_trigger as trigger
|
from libervia.backend.tools import async_trigger as trigger
|
||||||
from libervia.backend.core import xmpp
|
from libervia.backend.core import xmpp
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ def storage():
|
||||||
return AsyncMock()
|
return AsyncMock()
|
||||||
|
|
||||||
|
|
||||||
class MockSAT(SAT):
|
class MockSAT(LiberviaBackend):
|
||||||
|
|
||||||
def __init__(self, bridge, storage):
|
def __init__(self, bridge, storage):
|
||||||
self._cb_map = {}
|
self._cb_map = {}
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,8 @@ class SatMaker:
|
||||||
# XXX: Libervia must be imported after log configuration,
|
# XXX: Libervia must be imported after log configuration,
|
||||||
# because it write stuff to logs
|
# because it write stuff to logs
|
||||||
initialise(options.parent)
|
initialise(options.parent)
|
||||||
from libervia.backend.core.sat_main import SAT
|
from libervia.backend.core.sat_main import LiberviaBackend
|
||||||
return SAT()
|
return LiberviaBackend()
|
||||||
|
|
||||||
|
|
||||||
serviceMaker = SatMaker()
|
serviceMaker = SatMaker()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue