diff options
author | Eijebong <eijebong@bananium.fr> | 2014-12-30 22:58:22 +0100 |
---|---|---|
committer | Eijebong <eijebong@bananium.fr> | 2014-12-30 22:58:22 +0100 |
commit | 71f38487061cf6ad3e71b3cc1d0e80cb0f607111 (patch) | |
tree | bceecf36700599da389f7e0f2fb0b83c529fd5c3 /src | |
parent | 96442e93e3ce412abfa553030ec32cdd9b8ad2e2 (diff) | |
download | poezio-71f38487061cf6ad3e71b3cc1d0e80cb0f607111.tar.gz poezio-71f38487061cf6ad3e71b3cc1d0e80cb0f607111.tar.bz2 poezio-71f38487061cf6ad3e71b3cc1d0e80cb0f607111.tar.xz poezio-71f38487061cf6ad3e71b3cc1d0e80cb0f607111.zip |
Add a command to reload the config.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/commands.py | 9 | ||||
-rw-r--r-- | src/core/core.py | 21 |
2 files changed, 23 insertions, 7 deletions
diff --git a/src/core/commands.py b/src/core/commands.py index 15ff96e2..5912abe2 100644 --- a/src/core/commands.py +++ b/src/core/commands.py @@ -1036,5 +1036,14 @@ def command_self(self): config_opts.version)) self.information(info, 'Info') + +@command_args_parser.ignored +def command_reload(self): + """ + /reload + """ + self.reload_config() + def dumb_callback(*args, **kwargs): "mock callback" + diff --git a/src/core/core.py b/src/core/core.py index ba9b16e0..a750cfa3 100644 --- a/src/core/core.py +++ b/src/core/core.py @@ -397,19 +397,14 @@ class Core(object): """ self.xmpp.password = value - def sigusr_handler(self, num, stack): - """ - Handle SIGUSR1 (10) - When caught, reload all the possible files. - """ - log.debug("SIGUSR1 caught, reloading the files…") + def reload_config(self): # reload all log files log.debug("Reloading the log files…") logger.reload_all() log.debug("Log files reloaded.") # reload the theme log.debug("Reloading the theme…") - self.command_theme("") + theming.reload_theme() log.debug("Theme reloaded.") # reload the config from the disk log.debug("Reloading the config…") @@ -429,6 +424,14 @@ class Core(object): # in case some roster options have changed roster.modified() + def sigusr_handler(self, num, stack): + """ + Handle SIGUSR1 (10) + When caught, reload all the possible files. + """ + log.debug("SIGUSR1 caught, reloading the files…") + self.reload_config() + def exit_from_signal(self, *args, **kwargs): """ Quit when receiving SIGHUP or SIGTERM or SIGPIPE @@ -1877,6 +1880,9 @@ class Core(object): self.register_command('ad-hoc', self.command_adhoc, usage='<jid>', shortdesc=_('List available ad-hoc commands on the given jid')) + self.register_command('reload', self.command_reload, + shortdesc=_('Reload the config. You can achieve the same by ' + 'sending SIGUSR1 to poezio.')) if config.get('enable_user_activity'): self.register_command('activity', self.command_activity, @@ -2000,6 +2006,7 @@ class Core(object): command_xml_tab = commands.command_xml_tab command_adhoc = commands.command_adhoc command_self = commands.command_self + command_reload = commands.command_reload completion_help = completions.completion_help completion_status = completions.completion_status completion_presence = completions.completion_presence |