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
This commit is contained in:
Stephen Paul Weber 2024-02-14 00:21:52 -05:00
parent d3af15d623
commit fe19319066
No known key found for this signature in database
GPG key ID: D11C2911CE519CDE
2 changed files with 5 additions and 0 deletions

View file

@ -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

View file

@ -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)