Skip to content

Instantly share code, notes, and snippets.

@legastero
Created June 3, 2010 03:45
Show Gist options
  • Save legastero/423419 to your computer and use it in GitHub Desktop.
Save legastero/423419 to your computer and use it in GitHub Desktop.
Disco Example
# self.add_event_handler('disco_info_request', self.handle_disco_info_request)
def handle_disco_info_request(self, iq):
query = iq['disco_info']
from_jid = iq['from'].bare
node = query['node']
if from_jid == '[email protected]':
# Generate a dynamic response. Could pull identities
# and features from a database if needed.
iq.reply()
iq['disco_info']['node'] = node
iq['disco_info'].addFeature('foo')
iq['disco_info'].addFeature('bar')
iq.send()
else:
# Fall back to the default behavior. Note the forwarded=True.
self['xep_0030'].handle_disco_info(iq, forwarded=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment