poezio/core/commands: Use Config from Core
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
b889b3329f
commit
b56cfbafd9
1 changed files with 13 additions and 13 deletions
|
@ -17,7 +17,7 @@ from slixmpp.xmlstream.matcher import StanzaPath
|
|||
|
||||
from poezio import common, config as config_module, tabs, multiuserchat as muc
|
||||
from poezio.bookmarks import Bookmark
|
||||
from poezio.config import config, DEFAULT_CONFIG
|
||||
from poezio.config import DEFAULT_CONFIG
|
||||
from poezio.contact import Contact, Resource
|
||||
from poezio.decorators import deny_anonymous
|
||||
from poezio.plugin import PluginConfig
|
||||
|
@ -406,7 +406,7 @@ class CommandCore:
|
|||
if len(args) == 2:
|
||||
password = args[1]
|
||||
else:
|
||||
password = config.get_by_tabname('password', room, fallback=False)
|
||||
password = self.core.config.get_by_tabname('password', room, fallback=False)
|
||||
|
||||
if room in self.core.pending_invites:
|
||||
del self.core.pending_invites[room]
|
||||
|
@ -426,8 +426,8 @@ class CommandCore:
|
|||
tab.password = password
|
||||
tab.join()
|
||||
|
||||
if config.getbool('synchronise_open_rooms') and room not in self.core.bookmarks:
|
||||
method = 'remote' if config.getbool(
|
||||
if self.core.config.getbool('synchronise_open_rooms') and room not in self.core.bookmarks:
|
||||
method = 'remote' if self.core.config.getbool(
|
||||
'use_remote_bookmarks') else 'local'
|
||||
await self._add_bookmark(
|
||||
room=room,
|
||||
|
@ -479,7 +479,7 @@ class CommandCore:
|
|||
room, nick = self._parse_join_jid(args[0] if args else '')
|
||||
password = args[2] if len(args) > 2 else None
|
||||
|
||||
method = 'remote' if config.getbool('use_remote_bookmarks') else 'local'
|
||||
method = 'remote' if self.core.config.getbool('use_remote_bookmarks') else 'local'
|
||||
autojoin = (method == 'local' or
|
||||
(len(args) > 1 and args[1].lower() == 'true'))
|
||||
|
||||
|
@ -759,7 +759,7 @@ class CommandCore:
|
|||
if len(args) == 3 and args[1] == '=':
|
||||
args = [args[0], args[2]]
|
||||
if args is None or len(args) == 0:
|
||||
config_dict = config.to_dict()
|
||||
config_dict = self.core.config.to_dict()
|
||||
lines = []
|
||||
theme = get_theme()
|
||||
for section_name, section in config_dict.items():
|
||||
|
@ -780,7 +780,7 @@ class CommandCore:
|
|||
info = ('Current options:\n%s' % '\n'.join(lines), 'Info')
|
||||
elif len(args) == 1:
|
||||
option = args[0]
|
||||
value = config.get(option)
|
||||
value = self.core.config.get(option)
|
||||
if isinstance(option, str) and \
|
||||
'password' in option and 'eval_password' not in option and value is not None:
|
||||
value = '********'
|
||||
|
@ -804,16 +804,16 @@ class CommandCore:
|
|||
info = ('%s=%s' % (option, value), 'Info')
|
||||
else:
|
||||
possible_section = args[0]
|
||||
if (not config.has_option(section='Poezio', option=possible_section)
|
||||
and config.has_section(possible_section)):
|
||||
if (not self.core.config.has_option(section='Poezio', option=possible_section)
|
||||
and self.core.config.has_section(possible_section)):
|
||||
section = possible_section
|
||||
option = args[1]
|
||||
value = config.get(option, section=section)
|
||||
value = self.core.config.get(option, section=section)
|
||||
info = ('%s=%s' % (option, value), 'Info')
|
||||
else:
|
||||
option = args[0]
|
||||
value = args[1]
|
||||
info = config.set_and_save(option, value)
|
||||
info = self.core.config.set_and_save(option, value)
|
||||
self.core.trigger_configuration_change(option, value)
|
||||
elif len(args) == 3:
|
||||
if '|' in args[0]:
|
||||
|
@ -842,7 +842,7 @@ class CommandCore:
|
|||
section = args[0]
|
||||
option = args[1]
|
||||
value = args[2]
|
||||
info = config.set_and_save(option, value, section)
|
||||
info = self.core.config.set_and_save(option, value, section)
|
||||
self.core.trigger_configuration_change(option, value)
|
||||
elif len(args) > 3:
|
||||
return self.help('set')
|
||||
|
@ -1198,7 +1198,7 @@ class CommandCore:
|
|||
if args is None:
|
||||
return self.help('bind')
|
||||
|
||||
if not config.silent_set(args[0], args[1], section='bindings'):
|
||||
if not self.core.config.silent_set(args[0], args[1], section='bindings'):
|
||||
self.core.information('Unable to write in the config file',
|
||||
'Error')
|
||||
|
||||
|
|
Loading…
Reference in a new issue