From fe193190668c6f7033d6f5a15b4ea419e15d2979 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 14 Feb 2024 00:21:52 -0500 Subject: [PATCH] Set datatype and range for settings fields This allows the client to know that the values are all integers within some range. Note that the min/max settings aren't working quite right per https://codeberg.org/poezio/slixmpp/issues/3512 --- slixfeed/__main__.py | 1 + slixfeed/xmpp/client.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/slixfeed/__main__.py b/slixfeed/__main__.py index c00e51c..5982de0 100644 --- a/slixfeed/__main__.py +++ b/slixfeed/__main__.py @@ -127,6 +127,7 @@ class JabberClient: def __init__(self, jid, password, hostname=None, port=None, alias=None): xmpp = Slixfeed(jid, password, hostname, port, alias) xmpp.register_plugin('xep_0004') # Data Forms + xmpp.register_plugin('xep_0122') # Data Forms Validation xmpp.register_plugin('xep_0030') # Service Discovery xmpp.register_plugin('xep_0045') # Multi-User Chat xmpp.register_plugin('xep_0048') # Bookmarks diff --git a/slixfeed/xmpp/client.py b/slixfeed/xmpp/client.py index a3fecc4..71c18d2 100644 --- a/slixfeed/xmpp/client.py +++ b/slixfeed/xmpp/client.py @@ -926,6 +926,8 @@ class Slixfeed(slixmpp.ClientXMPP): label='Archive', desc='Number of news items to archive.', value=value) + options['validate']['datatype'] = 'xs:integer' + options['validate']['range'] = { 'minimum': 0, 'maximum': 500 } i = 0 while i <= 500: x = str(i) @@ -939,6 +941,8 @@ class Slixfeed(slixmpp.ClientXMPP): label='Amount', desc='Set amount of updates per update.', value=value) + options['validate']['datatype'] = 'xs:integer' + options['validate']['range'] = { 'minimum': 1, 'maximum': 5 } i = 1 while i <= 5: x = str(i)