diff --git a/src/memory/params.py b/src/memory/params.py index a8354634..f8158785 100644 --- a/src/memory/params.py +++ b/src/memory/params.py @@ -44,17 +44,17 @@ class Params(object): - + - + - - - - + + + + @@ -65,13 +65,13 @@ class Params(object): 'category_general': D_("General"), 'category_connection': D_("Connection"), 'history_param': C.HISTORY_LIMIT, - 'label_history': D_('Chat history limit'), - 'label_NewAccount': D_("Register new account"), - 'label_autoconnect': D_('Connect on frontend startup'), - 'label_autodisconnect': D_('Disconnect on frontend closure'), - 'category_misc': D_("Misc"), + 'history_label': D_('Chat history limit'), 'force_server_param': C.FORCE_SERVER_PARAM, 'force_port_param': C.FORCE_PORT_PARAM, + 'new_account_label': D_("Register new account"), + 'autoconnect_label': D_('Connect on frontend startup'), + 'autodisconnect_label': D_('Disconnect on frontend closure'), + 'category_misc': D_("Misc"), } def load_default_params(self): @@ -755,10 +755,13 @@ class Params(object): log.debug(_("Trying to set parameter '%(param)s' in category '%(cat)s' with an non-integer value" % {'param': name, 'cat': category})) return defer.succeed(None) - if node[1].hasAttribute("min"): - value = str(max(int(value), int(node[1].getAttribute("min")))) - if node[1].hasAttribute("max"): - value = str(min(int(value), int(node[1].getAttribute("max")))) + if node[1].hasAttribute("constraint"): + constraint = node[1].getAttribute("constraint") + try: + min_, max_ = [int(limit) for limit in constraint.split(";")] + except ValueError: + raise exceptions.InternalError("Invalid integer parameter constraint: %s" % constraint) + value = str(min(max(int(value), min_), max_)) log.info(_("Setting parameter (%(category)s, %(name)s) = %(value)s") % {'category': category, 'name': name, 'value': value if type_ != 'password' else '********'}) diff --git a/src/plugins/plugin_misc_imap.py b/src/plugins/plugin_misc_imap.py index d09d12fe..bfe06736 100755 --- a/src/plugins/plugin_misc_imap.py +++ b/src/plugins/plugin_misc_imap.py @@ -51,7 +51,7 @@ class IMAP_server(object): - + diff --git a/src/plugins/plugin_misc_smtp.py b/src/plugins/plugin_misc_smtp.py index eadae328..376ff03e 100755 --- a/src/plugins/plugin_misc_smtp.py +++ b/src/plugins/plugin_misc_smtp.py @@ -51,7 +51,7 @@ class SMTP_server(object): - + diff --git a/src/plugins/plugin_xep_0065.py b/src/plugins/plugin_xep_0065.py index 18fc208f..86d82ef1 100755 --- a/src/plugins/plugin_xep_0065.py +++ b/src/plugins/plugin_xep_0065.py @@ -444,14 +444,14 @@ class XEP_0065(object): - + - +