From 1f47557e982b8153df46c1b23e83dbdc7037fcce Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Tue, 21 Jul 2015 18:04:18 +0200 Subject: Disable/enable carbons immediately when we change the enable_carbons option --- src/core/core.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/core') diff --git a/src/core/core.py b/src/core/core.py index e55a6503..1533695f 100644 --- a/src/core/core.py +++ b/src/core/core.py @@ -319,6 +319,8 @@ class Core(object): self.on_vertical_tab_list_config_change) self.add_configuration_handler("deterministic_nick_colors", self.on_nick_determinism_changed) + self.add_configuration_handler("enable_carbons", + self.on_carbons_switch) self.add_configuration_handler("", self.on_any_config_change) @@ -427,6 +429,16 @@ class Core(object): for tab in self.get_tabs(tabs.MucTab): tab.command_recolor('') + def on_carbons_switch(self, option, value): + """Whenever the user enables or disables carbons using /set, we should + inform the server immediately, this way we do not require a restart + for the change to take effect + """ + if value: + self.xmpp.plugin['xep_0280'].enable() + else: + self.xmpp.plugin['xep_0280'].disable() + def reload_config(self): # reload all log files log.debug("Reloading the log files…") -- cgit v1.2.3