Fix #2719 (write/read in the plugin config files even when not loaded)

This commit is contained in:
mathieui 2014-10-20 23:24:27 +02:00
parent 6b8af2413e
commit 9d58c9d32e
No known key found for this signature in database
GPG key ID: C59F84CEEFD616E3

View file

@ -6,6 +6,7 @@ import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
import os
import sys import sys
from datetime import datetime from datetime import datetime
from gettext import gettext as _ from gettext import gettext as _
@ -23,6 +24,7 @@ import tabs
from common import safeJID from common import safeJID
from config import config, options as config_opts from config import config, options as config_opts
import multiuserchat as muc import multiuserchat as muc
from plugin import PluginConfig
from roster import roster from roster import roster
from theming import dump_tuple, get_theme from theming import dump_tuple, get_theme
@ -600,9 +602,12 @@ def command_set(self, arg):
section = plugin_name section = plugin_name
option = args[1] option = args[1]
if not plugin_name in self.plugin_manager.plugins: if not plugin_name in self.plugin_manager.plugins:
return file_name = self.plugin_manager.plugins_conf_dir
plugin = self.plugin_manager.plugins[plugin_name] file_name = os.path.join(file_name, plugin_name + '.cfg')
value = plugin.config.get(option, default='', section=section) plugin_config = PluginConfig(file_name, plugin_name)
else:
plugin_config = self.plugin_manager.plugins[plugin_name].config
value = plugin_config.get(option, default='', section=section)
info = ('%s=%s' % (option, value), 'Info') info = ('%s=%s' % (option, value), 'Info')
else: else:
possible_section = args[0] possible_section = args[0]
@ -624,9 +629,12 @@ def command_set(self, arg):
option = args[1] option = args[1]
value = args[2] value = args[2]
if not plugin_name in self.plugin_manager.plugins: if not plugin_name in self.plugin_manager.plugins:
return file_name = self.plugin_manager.plugins_conf_dir
plugin = self.plugin_manager.plugins[plugin_name] file_name = os.path.join(file_name, plugin_name + '.cfg')
info = plugin.config.set_and_save(option, value, section) plugin_config = PluginConfig(file_name, plugin_name)
else:
plugin_config = self.plugin_manager.plugins[plugin_name].config
info = plugin_config.set_and_save(option, value, section)
else: else:
section = args[0] section = args[0]
option = args[1] option = args[1]