summaryrefslogtreecommitdiff
path: root/src/core/commands.py
diff options
context:
space:
mode:
authorEijebong <eijebong@bananium.fr>2014-12-03 13:53:41 +0100
committermathieui <mathieui@mathieui.net>2014-12-05 20:39:23 +0100
commit9caa992333cfc1a38c3b0a678fea7fa18e07eca9 (patch)
treecbd9f790baa5428d8c4bc828abfe7b8d866cae31 /src/core/commands.py
parent5b7606722e56c867f9d5bf2065b7dc5535d87d1d (diff)
downloadpoezio-9caa992333cfc1a38c3b0a678fea7fa18e07eca9.tar.gz
poezio-9caa992333cfc1a38c3b0a678fea7fa18e07eca9.tar.bz2
poezio-9caa992333cfc1a38c3b0a678fea7fa18e07eca9.tar.xz
poezio-9caa992333cfc1a38c3b0a678fea7fa18e07eca9.zip
Add a set_default command.
Diffstat (limited to 'src/core/commands.py')
-rw-r--r--src/core/commands.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/core/commands.py b/src/core/commands.py
index 712840d2..ca77501e 100644
--- a/src/core/commands.py
+++ b/src/core/commands.py
@@ -23,7 +23,7 @@ import fixes
import pep
import tabs
from common import safeJID
-from config import config, options as config_opts
+from config import config, DEFAULT_CONFIG, options as config_opts
import multiuserchat as muc
from plugin import PluginConfig
from roster import roster
@@ -648,11 +648,30 @@ def command_set(self, args):
info = config.set_and_save(option, value, section)
self.trigger_configuration_change(option, value)
else:
- self.command_help('set')
- return
+ return self.command_help('set')
self.call_for_resize()
self.information(*info)
+@command_args_parser.quoted(1, 2)
+def command_set_default(self, args):
+ """
+ /set_default [section] <option>
+ """
+ if len(args) == 1:
+ option = args[0]
+ section = 'Poezio'
+ elif len(args) == 2:
+ section = args[0]
+ option = args[1]
+ else:
+ return self.command_help('set_default')
+
+ default_config = DEFAULT_CONFIG.get(section, tuple())
+ if option not in default_config:
+ info = ("Option %s has no default value" % (option), "Error")
+ return self.information(*info)
+ self.command_set('%s %s %s' % (section, option, default_config[option]))
+
@command_args_parser.quoted(1)
def command_toggle(self, args):
"""