poezio: Pass in Config object from Core

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2022-08-31 16:00:18 +02:00
parent 52322cf09d
commit b53d99044f
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2
3 changed files with 6 additions and 6 deletions

View file

@ -44,7 +44,7 @@ from slixmpp import (
from slixmpp.exceptions import IqError, IqTimeout
from slixmpp.plugins.xep_0048 import Bookmarks, Conference, URL
from poezio.connection import Connection
from poezio.config import config
from poezio.config import Config
log = logging.getLogger(__name__)
@ -158,7 +158,7 @@ class Bookmark:
class BookmarkList:
def __init__(self):
def __init__(self, config: Config):
self.config = config
self.bookmarks: List[Bookmark] = []
preferred = self.config.getstr('use_bookmarks_method').lower()

View file

@ -28,7 +28,7 @@ from slixmpp.util import FileSystemCache
from poezio import common
from poezio import fixes
from poezio.libpoezio import XDG
from poezio.config import config
from poezio.config import Config
class Connection(slixmpp.ClientXMPP):
@ -38,7 +38,7 @@ class Connection(slixmpp.ClientXMPP):
"""
__init = False
def __init__(self, custom_version=''):
def __init__(self, config: Config, custom_version=''):
self.config = config
keyfile = self.config.getstr('keyfile')

View file

@ -148,12 +148,12 @@ class Core:
status = POSSIBLE_SHOW.get(status) or ''
self.status = Status(show=status, message=self.config.getstr('status_message'))
self.custom_version = custom_version
self.xmpp = connection.Connection(custom_version)
self.xmpp = connection.Connection(self.config, custom_version)
self.xmpp.core = self
self.keyboard = keyboard.Keyboard()
roster.set_node(self.xmpp.client_roster)
decorators.refresh_wrapper.core = self
self.bookmarks = BookmarkList()
self.bookmarks = BookmarkList(self.config)
self.remote_fifo = None
self.avatar_cache = FileSystemPerJidCache(
str(XDG.cache_dir), 'avatars', binary=True)