summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/source/commands.rst2
-rw-r--r--src/core/commands.py9
-rw-r--r--src/core/core.py21
3 files changed, 25 insertions, 7 deletions
diff --git a/doc/source/commands.rst b/doc/source/commands.rst
index f8f2b5e1..875d372d 100644
--- a/doc/source/commands.rst
+++ b/doc/source/commands.rst
@@ -265,6 +265,8 @@ These commands work in *any* tab.
/self
Reminds you of who you are and what your status is.
+ /reload
+ Reload the config. You can achieve the same by sending SIGUSR1 to poezio.
/close
Close the tab.
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