summaryrefslogtreecommitdiff
path: root/slixmpp/plugins
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-03-08 21:04:21 +0100
committermathieui <mathieui@mathieui.net>2021-03-08 21:04:21 +0100
commit30b1d27fc122eee1cacc1d25dd580ac416b81783 (patch)
tree1bddc46dccc4538cc2e87970dea2e2100c4b6a02 /slixmpp/plugins
parentcb83ebe32c12b4ccf36753e8f19f4b5d514ae00e (diff)
downloadslixmpp-30b1d27fc122eee1cacc1d25dd580ac416b81783.tar.gz
slixmpp-30b1d27fc122eee1cacc1d25dd580ac416b81783.tar.bz2
slixmpp-30b1d27fc122eee1cacc1d25dd580ac416b81783.tar.xz
slixmpp-30b1d27fc122eee1cacc1d25dd580ac416b81783.zip
XEP-0004: stanza, only delete field type if it is not 'hidden'
Not strictly required, but most XEPs use it like that for forms of type='submit', and that makes it easier to write stanza tests.
Diffstat (limited to 'slixmpp/plugins')
-rw-r--r--slixmpp/plugins/xep_0004/stanza/form.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/slixmpp/plugins/xep_0004/stanza/form.py b/slixmpp/plugins/xep_0004/stanza/form.py
index 84c89173..c04193f0 100644
--- a/slixmpp/plugins/xep_0004/stanza/form.py
+++ b/slixmpp/plugins/xep_0004/stanza/form.py
@@ -48,7 +48,8 @@ class Form(ElementBase):
fields = self.get_fields()
for var in fields:
field = fields[var]
- del field['type']
+ if field['type'] != 'hidden':
+ del field['type']
del field['label']
del field['desc']
del field['required']
@@ -74,7 +75,8 @@ class Form(ElementBase):
for option in options:
field.add_option(**option)
else:
- del field['type']
+ if field['type'] != 'hidden':
+ del field['type']
self.append(field)
return field