disco plugin: Allow any dataform to be displayed.
This commit is contained in:
parent
25df5ef410
commit
efc9489f33
1 changed files with 5 additions and 9 deletions
|
@ -31,23 +31,19 @@ class Plugin(BasePlugin):
|
||||||
self.api.information('\n'.join(identities), 'Identities')
|
self.api.information('\n'.join(identities), 'Identities')
|
||||||
features = sorted(str(feature) for feature in info['features'])
|
features = sorted(str(feature) for feature in info['features'])
|
||||||
self.api.information('\n'.join(features), 'Features')
|
self.api.information('\n'.join(features), 'Features')
|
||||||
for field in info['form']['fields']:
|
title = 'Server Info'
|
||||||
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
|
|
||||||
server_info = []
|
server_info = []
|
||||||
for field in info['form']:
|
for field in info['form']:
|
||||||
var = field['var']
|
var = field['var']
|
||||||
if field['type'] == 'hidden' and var == 'FORM_TYPE':
|
if field['type'] == 'hidden' and var == 'FORM_TYPE':
|
||||||
|
title = field['value'][0]
|
||||||
continue
|
continue
|
||||||
sep = '\n ' + len(var) * ' '
|
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))
|
server_info.append('%s: %s' % (var, value))
|
||||||
if server_info:
|
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):
|
def command_disco(self, jid):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue