XEP-0157 finally finished

* fixed XEP 0157 functionality
* updated README.MD
This commit is contained in:
mightyBroccoli 2018-07-20 23:16:59 +02:00
parent abbbb88191
commit b9a2e5adcd
2 changed files with 8 additions and 3 deletions

View file

@ -6,11 +6,11 @@ Do not opperate this bot on foreign servers.
### functions
- query xmpp server software and version [XEP-0092](https://xmpp.org/extensions/xep-0092.html)
- query xmpp server uptime [XEP-0012](https://xmpp.org/extensions/xep-0012.html)
- query xmpp server contact addresses [XEP-0157](https://xmpp.org/extensions/xep-0157.html)
- display help output
- respond to username being mentioned
### todo
- [ ] extract xmpp server contact addresses [XEP-0157](https://xmpp.org/extensions/xep-0157.html) from result
- [ ] Github Webhook
### install

View file

@ -157,12 +157,16 @@ class QueryBot(slixmpp.ClientXMPP):
if field['type'] == 'hidden' and var == 'FORM_TYPE':
title = field['value'][0]
continue
sep = '\n ' + len(var) * ' '
sep = ', '
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))
self.send_message(mto=msg['from'].bare, mbody=server_info, mtype=msg['type'])
text = "contact addresses for %s are" % (line[1])
for count in range(len(server_info)):
text += "\n" + server_info[count]
self.send_message(mto=msg['from'].bare, mbody=text, mtype=msg['type'])
except NameError:
pass
except XMPPError:
@ -221,6 +225,7 @@ if __name__ == '__main__':
xmpp.register_plugin('xep_0060') # PubSub
xmpp.register_plugin('xep_0085') # Chat State Notifications
xmpp.register_plugin('xep_0092') # Software Version
xmpp.register_plugin('xep_0128') # Service Discovery Extensions
xmpp.register_plugin('xep_0199') # XMPP Ping
# connect and start receiving stanzas