summaryrefslogtreecommitdiff
path: root/poezio/core
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-04-11 18:38:22 +0200
committermathieui <mathieui@mathieui.net>2021-04-11 18:38:22 +0200
commit57cd999f7081d94fb1c623665e016576725b5353 (patch)
tree3204c170a9de4fe7bd59b7b52fb5934a71dea969 /poezio/core
parent29a7c6eca555402e6c7aacbf5f523ce4f3f4a5c4 (diff)
downloadpoezio-57cd999f7081d94fb1c623665e016576725b5353.tar.gz
poezio-57cd999f7081d94fb1c623665e016576725b5353.tar.bz2
poezio-57cd999f7081d94fb1c623665e016576725b5353.tar.xz
poezio-57cd999f7081d94fb1c623665e016576725b5353.zip
refactor: move argument parsing away from config.py
global state--
Diffstat (limited to 'poezio/core')
-rw-r--r--poezio/core/commands.py4
-rw-r--r--poezio/core/core.py9
2 files changed, 8 insertions, 5 deletions
diff --git a/poezio/core/commands.py b/poezio/core/commands.py
index 3cd65207..75f90279 100644
--- a/poezio/core/commands.py
+++ b/poezio/core/commands.py
@@ -18,7 +18,7 @@ from poezio import common
from poezio import tabs
from poezio import multiuserchat as muc
from poezio.bookmarks import Bookmark
-from poezio.config import config, DEFAULT_CONFIG, options as config_opts
+from poezio.config import config, DEFAULT_CONFIG
from poezio.contact import Contact, Resource
from poezio.decorators import deny_anonymous
from poezio.plugin import PluginConfig
@@ -1346,7 +1346,7 @@ class CommandCore:
info = ('Your JID is %s\nYour current status is "%s" (%s)'
'\nYour default nickname is %s\nYou are running poezio %s' %
(jid, message if message else '', show
- if show else 'available', nick, config_opts.custom_version))
+ if show else 'available', nick, self.core.custom_version))
self.core.information(info, 'Info')
@command_args_parser.ignored
diff --git a/poezio/core/core.py b/poezio/core/core.py
index 5ea8978f..66af7a28 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -73,7 +73,6 @@ from poezio.core.structs import (
from poezio.ui.types import (
Message,
- InfoMessage,
PersistentInfoMessage,
)
@@ -81,12 +80,15 @@ log = logging.getLogger(__name__)
T = TypeVar('T', bound=tabs.Tab)
+
class Core:
"""
“Main” class of poezion
"""
- def __init__(self):
+ custom_version: str
+
+ def __init__(self, custom_version: str):
self.completion = CompletionCore(self)
self.command = CommandCore(self)
self.handler = HandlerCore(self)
@@ -100,7 +102,8 @@ class Core:
status = POSSIBLE_SHOW.get(status, None)
self.status = Status(show=status, message=config.getstr('status_message'))
self.running = True
- self.xmpp = connection.Connection()
+ self.custom_version = custom_version
+ self.xmpp = connection.Connection(custom_version)
self.xmpp.core = self
self.keyboard = keyboard.Keyboard()
roster.set_node(self.xmpp.client_roster)