summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-05-30 21:04:02 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-05-30 21:04:02 +0200
commitefc9489f332cf529e8fb6a24a21a97f08f812f1d (patch)
tree14fc9e04badce8dbfa80676a690b6dfe7fdfd2e2 /plugins
parent25df5ef410e66d96bfd6dac081a073b20e57f4e2 (diff)
downloadpoezio-efc9489f332cf529e8fb6a24a21a97f08f812f1d.tar.gz
poezio-efc9489f332cf529e8fb6a24a21a97f08f812f1d.tar.bz2
poezio-efc9489f332cf529e8fb6a24a21a97f08f812f1d.tar.xz
poezio-efc9489f332cf529e8fb6a24a21a97f08f812f1d.zip
disco plugin: Allow any dataform to be displayed.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/disco.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/plugins/disco.py b/plugins/disco.py
index 53da67a8..e2cdd0b0 100644
--- a/plugins/disco.py
+++ b/plugins/disco.py
@@ -31,23 +31,19 @@ class Plugin(BasePlugin):
self.api.information('\n'.join(identities), 'Identities')
features = sorted(str(feature) for feature in info['features'])
self.api.information('\n'.join(features), 'Features')
- for field in info['form']['fields']:
- if field['type'] == 'hidden' and field['var'] == 'FORM_TYPE':
- value = field['value']
- if 'http://jabber.org/network/serverinfo' not in value:
- self.api.information('Unknown form type ā€œ%sā€' % value, 'Error')
- return
- break
+ title = 'Server Info'
server_info = []
for field in info['form']:
var = field['var']
if field['type'] == 'hidden' and var == 'FORM_TYPE':
+ title = field['value'][0]
continue
sep = '\n ' + len(var) * ' '
- value = sep.join(field.get_value(convert=False))
+ field_value = field.get_value(convert=False)
+ value = sep.join(field_value) if isinstance(field_value, list) else field_value
server_info.append('%s: %s' % (var, value))
if server_info:
- self.api.information('\n'.join(server_info), 'Server Info')
+ self.api.information('\n'.join(server_info), title)
def command_disco(self, jid):
try: